]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
wl12xx: add TX_HW_ATTR_HOST_ENCRYPT flag
authorEliad Peller <eliad@wizery.com>
Tue, 31 Jan 2012 15:54:42 +0000 (17:54 +0200)
committerLuciano Coelho <coelho@ti.com>
Wed, 15 Feb 2012 06:38:33 +0000 (08:38 +0200)
In WEP shared authentication, we encrypt the auth frame
in the host, and we want the fw to pass it as-is.
Use the TX_HW_ATTR_HOST_ENCRYPT flag in order to indicate
it to the fw.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/tx.c
drivers/net/wireless/wl12xx/tx.h

index ee313e7ce8fea0dab4e1430896872a7193c793b0..1f5cc2af5bc61e9b6755f58762952ee0b25e9117 100644 (file)
@@ -255,16 +255,20 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        int aligned_len, ac, rate_idx;
        s64 hosttime;
        u16 tx_attr = 0;
+       __le16 frame_control;
+       struct ieee80211_hdr *hdr;
+       u8 *frame_start;
        bool is_dummy;
 
        desc = (struct wl1271_tx_hw_descr *) skb->data;
+       frame_start = (u8 *)(desc + 1);
+       hdr = (struct ieee80211_hdr *)(frame_start + extra);
+       frame_control = hdr->frame_control;
 
        /* relocate space for security header */
        if (extra) {
-               void *framestart = skb->data + sizeof(*desc);
-               u16 fc = *(u16 *)(framestart + extra);
-               int hdrlen = ieee80211_hdrlen(cpu_to_le16(fc));
-               memmove(framestart, framestart + extra, hdrlen);
+               int hdrlen = ieee80211_hdrlen(frame_control);
+               memmove(frame_start, hdr, hdrlen);
        }
 
        /* configure packet life time */
@@ -353,6 +357,11 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                             desc->wl127x_mem.total_mem_blocks);
        }
 
+       /* for WEP shared auth - no fw encryption is needed */
+       if (ieee80211_is_auth(frame_control) &&
+           ieee80211_has_protected(frame_control))
+               tx_attr |= TX_HW_ATTR_HOST_ENCRYPT;
+
        desc->tx_attr = cpu_to_le16(tx_attr);
 }
 
index 2dbb24e6d541a8c9dbff30efd9144f922217fb92..7ceb3ceaa64888e0d258e31532423fdd715fdd25 100644 (file)
@@ -39,6 +39,7 @@
 #define TX_HW_ATTR_LAST_WORD_PAD         (BIT(10) | BIT(11))
 #define TX_HW_ATTR_TX_CMPLT_REQ          BIT(12)
 #define TX_HW_ATTR_TX_DUMMY_REQ          BIT(13)
+#define TX_HW_ATTR_HOST_ENCRYPT          BIT(14)
 
 #define TX_HW_ATTR_OFST_SAVE_RETRIES     0
 #define TX_HW_ATTR_OFST_HEADER_PAD       1