diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index b8de9d2750e4..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 |
@@ -231,14 +212,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
231 | * Determine retry information. | 212 | * Determine retry information. |
232 | */ | 213 | */ |
233 | txdesc->retry_limit = tx_info->control.rates[0].count - 1; | 214 | txdesc->retry_limit = tx_info->control.rates[0].count - 1; |
234 | /* | 215 | if (txdesc->retry_limit >= rt2x00dev->long_retry) |
235 | * XXX: If at this point we knew whether the HW is going to use | ||
236 | * the RETRY_MODE bit or the retry_limit (currently all | ||
237 | * use the RETRY_MODE bit) we could do something like b43 | ||
238 | * does, set the RETRY_MODE bit when the RC algorithm is | ||
239 | * requesting more than the long retry limit. | ||
240 | */ | ||
241 | if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) | ||
242 | __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); | 216 | __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); |
243 | 217 | ||
244 | /* | 218 | /* |
@@ -427,8 +401,12 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) | |||
427 | * the frame so we can provide it to the driver seperately. | 401 | * the frame so we can provide it to the driver seperately. |
428 | */ | 402 | */ |
429 | if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) && | 403 | if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) && |
430 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) | 404 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) { |
431 | rt2x00crypto_tx_remove_iv(skb, iv_len); | 405 | if (test_bit(CONFIG_CRYPTO_COPY_IV, &queue->rt2x00dev->flags)) |
406 | rt2x00crypto_tx_copy_iv(skb, iv_len); | ||
407 | else | ||
408 | rt2x00crypto_tx_remove_iv(skb, iv_len); | ||
409 | } | ||
432 | 410 | ||
433 | /* | 411 | /* |
434 | * It could be possible that the queue was corrupted and this | 412 | * It could be possible that the queue was corrupted and this |