aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwl8k.c
diff options
context:
space:
mode:
authorNishant Sarmukadam <nishants@marvell.com>2010-12-30 14:23:32 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-19 11:36:05 -0500
commite53d9b964e2568172149d41b3157af9cde9accaf (patch)
treeba0bafa44d50e0e1dd527a79752683606ee20272 /drivers/net/wireless/mwl8k.c
parent252486a13a36e2846ff046c18aae67658692eced (diff)
mwl8k: Add encapsulation of data packet for crypto
Different tail pads will be needed for crypto depending on the crypto mode. Add support to encapsulate the packets with appropriate pad value. Signed-off-by: Nishant Sarmukadam <nishants@marvell.com> Signed-off-by: Pradeep Nemavat <pnemavat@marvell.com> Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r--drivers/net/wireless/mwl8k.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 1798b7e8283f..95bbdca0ba87 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -232,6 +232,9 @@ struct mwl8k_priv {
232 struct completion firmware_loading_complete; 232 struct completion firmware_loading_complete;
233}; 233};
234 234
235#define MAX_WEP_KEY_LEN 13
236#define NUM_WEP_KEYS 4
237
235/* Per interface specific private data */ 238/* Per interface specific private data */
236struct mwl8k_vif { 239struct mwl8k_vif {
237 struct list_head list; 240 struct list_head list;
@@ -242,6 +245,12 @@ struct mwl8k_vif {
242 245
243 /* Non AMPDU sequence number assigned by driver. */ 246 /* Non AMPDU sequence number assigned by driver. */
244 u16 seqno; 247 u16 seqno;
248
249 /* Saved WEP keys */
250 struct {
251 u8 enabled;
252 u8 key[sizeof(struct ieee80211_key_conf) + MAX_WEP_KEY_LEN];
253 } wep_key_conf[NUM_WEP_KEYS];
245}; 254};
246#define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) 255#define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv))
247 256
@@ -754,6 +763,49 @@ mwl8k_add_dma_header(struct sk_buff *skb, int tail_pad)
754 tr->fwlen = cpu_to_le16(skb->len - sizeof(*tr) + tail_pad); 763 tr->fwlen = cpu_to_le16(skb->len - sizeof(*tr) + tail_pad);
755} 764}
756 765
766static void mwl8k_encapsulate_tx_frame(struct sk_buff *skb)
767{
768 struct ieee80211_hdr *wh;
769 struct ieee80211_tx_info *tx_info;
770 struct ieee80211_key_conf *key_conf;
771 int data_pad;
772
773 wh = (struct ieee80211_hdr *)skb->data;
774
775 tx_info = IEEE80211_SKB_CB(skb);
776
777 key_conf = NULL;
778 if (ieee80211_is_data(wh->frame_control))
779 key_conf = tx_info->control.hw_key;
780
781 /*
782 * Make sure the packet header is in the DMA header format (4-address
783 * without QoS), the necessary crypto padding between the header and the
784 * payload has already been provided by mac80211, but it doesn't add tail
785 * padding when HW crypto is enabled.
786 *
787 * We have the following trailer padding requirements:
788 * - WEP: 4 trailer bytes (ICV)
789 * - TKIP: 12 trailer bytes (8 MIC + 4 ICV)
790 * - CCMP: 8 trailer bytes (MIC)
791 */
792 data_pad = 0;
793 if (key_conf != NULL) {
794 switch (key_conf->cipher) {
795 case WLAN_CIPHER_SUITE_WEP40:
796 case WLAN_CIPHER_SUITE_WEP104:
797 data_pad = 4;
798 break;
799 case WLAN_CIPHER_SUITE_TKIP:
800 data_pad = 12;
801 break;
802 case WLAN_CIPHER_SUITE_CCMP:
803 data_pad = 8;
804 break;
805 }
806 }
807 mwl8k_add_dma_header(skb, data_pad);
808}
757 809
758/* 810/*
759 * Packet reception for 88w8366 AP firmware. 811 * Packet reception for 88w8366 AP firmware.
@@ -1447,7 +1499,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
1447 else 1499 else
1448 qos = 0; 1500 qos = 0;
1449 1501
1450 mwl8k_add_dma_header(skb, 0); 1502 mwl8k_encapsulate_tx_frame(skb);
1451 wh = &((struct mwl8k_dma_data *)skb->data)->wh; 1503 wh = &((struct mwl8k_dma_data *)skb->data)->wh;
1452 1504
1453 tx_info = IEEE80211_SKB_CB(skb); 1505 tx_info = IEEE80211_SKB_CB(skb);