diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00crypto.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 29 |
3 files changed, 36 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c index c6709b392165..37ad0d2fb64c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c +++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c | |||
@@ -46,6 +46,29 @@ enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key) | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry, | ||
50 | struct txentry_desc *txdesc) | ||
51 | { | ||
52 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | ||
53 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; | ||
54 | |||
55 | __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags); | ||
56 | |||
57 | txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key); | ||
58 | |||
59 | if (hw_key->flags & IEEE80211_KEY_FLAG_PAIRWISE) | ||
60 | __set_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags); | ||
61 | |||
62 | txdesc->key_idx = hw_key->hw_key_idx; | ||
63 | txdesc->iv_offset = ieee80211_get_hdrlen_from_skb(entry->skb); | ||
64 | |||
65 | if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) | ||
66 | __set_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags); | ||
67 | |||
68 | if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) | ||
69 | __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags); | ||
70 | } | ||
71 | |||
49 | unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info) | 72 | unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info) |
50 | { | 73 | { |
51 | struct ieee80211_key_conf *key = tx_info->control.hw_key; | 74 | struct ieee80211_key_conf *key = tx_info->control.hw_key; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 1e1893772b6c..03024327767b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -218,6 +218,8 @@ static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, | |||
218 | */ | 218 | */ |
219 | #ifdef CONFIG_RT2X00_LIB_CRYPTO | 219 | #ifdef CONFIG_RT2X00_LIB_CRYPTO |
220 | enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key); | 220 | enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key); |
221 | void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry, | ||
222 | struct txentry_desc *txdesc); | ||
221 | unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info); | 223 | unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info); |
222 | void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, unsigned int iv_len); | 224 | void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, unsigned int iv_len); |
223 | void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, unsigned int iv_len); | 225 | void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, unsigned int iv_len); |
@@ -231,6 +233,11 @@ static inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf * | |||
231 | return CIPHER_NONE; | 233 | return CIPHER_NONE; |
232 | } | 234 | } |
233 | 235 | ||
236 | static inline void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry, | ||
237 | struct txentry_desc *txdesc) | ||
238 | { | ||
239 | } | ||
240 | |||
234 | static inline unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info) | 241 | static inline unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info) |
235 | { | 242 | { |
236 | return 0; | 243 | return 0; |
@@ -256,7 +263,7 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, | |||
256 | struct rxdone_entry_desc *rxdesc) | 263 | struct rxdone_entry_desc *rxdesc) |
257 | { | 264 | { |
258 | } | 265 | } |
259 | #endif | 266 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ |
260 | 267 | ||
261 | /* | 268 | /* |
262 | * RFkill handlers. | 269 | * RFkill handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index e4a1dbeb18fd..eaec6bd93ed5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -55,14 +55,12 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, | |||
55 | /* | 55 | /* |
56 | * For IV/EIV/ICV assembly we must make sure there is | 56 | * For IV/EIV/ICV assembly we must make sure there is |
57 | * at least 8 bytes bytes available in headroom for IV/EIV | 57 | * at least 8 bytes bytes available in headroom for IV/EIV |
58 | * and 4 bytes for ICV data as tailroon. | 58 | * and 8 bytes for ICV data as tailroon. |
59 | */ | 59 | */ |
60 | #ifdef CONFIG_RT2X00_LIB_CRYPTO | ||
61 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 60 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { |
62 | head_size += 8; | 61 | head_size += 8; |
63 | tail_size += 4; | 62 | tail_size += 8; |
64 | } | 63 | } |
65 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ | ||
66 | 64 | ||
67 | /* | 65 | /* |
68 | * Allocate skbuffer. | 66 | * Allocate skbuffer. |
@@ -174,7 +172,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
174 | txdesc->cw_max = entry->queue->cw_max; | 172 | txdesc->cw_max = entry->queue->cw_max; |
175 | txdesc->aifs = entry->queue->aifs; | 173 | txdesc->aifs = entry->queue->aifs; |
176 | 174 | ||
177 | /* Data length + CRC + IV/EIV/ICV/MMIC (when using encryption) */ | 175 | /* Data length + CRC */ |
178 | data_length = entry->skb->len + 4; | 176 | data_length = entry->skb->len + 4; |
179 | 177 | ||
180 | /* | 178 | /* |
@@ -183,34 +181,17 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
183 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) | 181 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) |
184 | __set_bit(ENTRY_TXD_ACK, &txdesc->flags); | 182 | __set_bit(ENTRY_TXD_ACK, &txdesc->flags); |
185 | 183 | ||
186 | #ifdef CONFIG_RT2X00_LIB_CRYPTO | ||
187 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) && | 184 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) && |
188 | !entry->skb->do_not_encrypt) { | 185 | !entry->skb->do_not_encrypt) { |
189 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; | 186 | /* Apply crypto specific descriptor information */ |
190 | 187 | rt2x00crypto_create_tx_descriptor(entry, txdesc); | |
191 | __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags); | ||
192 | |||
193 | txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key); | ||
194 | |||
195 | if (hw_key->flags & IEEE80211_KEY_FLAG_PAIRWISE) | ||
196 | __set_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags); | ||
197 | |||
198 | txdesc->key_idx = hw_key->hw_key_idx; | ||
199 | txdesc->iv_offset = ieee80211_get_hdrlen_from_skb(entry->skb); | ||
200 | 188 | ||
201 | /* | 189 | /* |
202 | * Extend frame length to include all encryption overhead | 190 | * Extend frame length to include all encryption overhead |
203 | * that will be added by the hardware. | 191 | * that will be added by the hardware. |
204 | */ | 192 | */ |
205 | data_length += rt2x00crypto_tx_overhead(tx_info); | 193 | data_length += rt2x00crypto_tx_overhead(tx_info); |
206 | |||
207 | if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) | ||
208 | __set_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags); | ||
209 | |||
210 | if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) | ||
211 | __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags); | ||
212 | } | 194 | } |
213 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ | ||
214 | 195 | ||
215 | /* | 196 | /* |
216 | * Check if this is a RTS/CTS frame | 197 | * Check if this is a RTS/CTS frame |