diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 5752aaae906b..e15086af7278 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -227,6 +227,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
227 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 227 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
228 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 228 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
229 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); | 229 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); |
230 | unsigned int header_length = ieee80211_get_hdrlen_from_skb(entry->skb); | ||
230 | u8 rate_idx, rate_flags; | 231 | u8 rate_idx, rate_flags; |
231 | 232 | ||
232 | /* | 233 | /* |
@@ -235,13 +236,19 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
235 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); | 236 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); |
236 | 237 | ||
237 | /* | 238 | /* |
239 | * Remove L2 padding which was added during | ||
240 | */ | ||
241 | if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags)) | ||
242 | rt2x00queue_payload_align(entry->skb, true, header_length); | ||
243 | |||
244 | /* | ||
238 | * If the IV/EIV data was stripped from the frame before it was | 245 | * If the IV/EIV data was stripped from the frame before it was |
239 | * passed to the hardware, we should now reinsert it again because | 246 | * passed to the hardware, we should now reinsert it again because |
240 | * mac80211 will expect the the same data to be present it the | 247 | * mac80211 will expect the the same data to be present it the |
241 | * frame as it was passed to us. | 248 | * frame as it was passed to us. |
242 | */ | 249 | */ |
243 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) | 250 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) |
244 | rt2x00crypto_tx_insert_iv(entry->skb); | 251 | rt2x00crypto_tx_insert_iv(entry->skb, header_length); |
245 | 252 | ||
246 | /* | 253 | /* |
247 | * Send frame to debugfs immediately, after this call is completed | 254 | * Send frame to debugfs immediately, after this call is completed |
@@ -325,7 +332,7 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
325 | struct ieee80211_supported_band *sband; | 332 | struct ieee80211_supported_band *sband; |
326 | const struct rt2x00_rate *rate; | 333 | const struct rt2x00_rate *rate; |
327 | unsigned int header_length; | 334 | unsigned int header_length; |
328 | unsigned int align; | 335 | bool l2pad; |
329 | unsigned int i; | 336 | unsigned int i; |
330 | int idx = -1; | 337 | int idx = -1; |
331 | 338 | ||
@@ -348,12 +355,15 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
348 | memset(&rxdesc, 0, sizeof(rxdesc)); | 355 | memset(&rxdesc, 0, sizeof(rxdesc)); |
349 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); | 356 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); |
350 | 357 | ||
358 | /* Trim buffer to correct size */ | ||
359 | skb_trim(entry->skb, rxdesc.size); | ||
360 | |||
351 | /* | 361 | /* |
352 | * The data behind the ieee80211 header must be | 362 | * The data behind the ieee80211 header must be |
353 | * aligned on a 4 byte boundary. | 363 | * aligned on a 4 byte boundary. |
354 | */ | 364 | */ |
355 | header_length = ieee80211_get_hdrlen_from_skb(entry->skb); | 365 | header_length = ieee80211_get_hdrlen_from_skb(entry->skb); |
356 | align = ((unsigned long)(entry->skb->data + header_length)) & 3; | 366 | l2pad = !!(rxdesc.dev_flags & RXDONE_L2PAD); |
357 | 367 | ||
358 | /* | 368 | /* |
359 | * Hardware might have stripped the IV/EIV/ICV data, | 369 | * Hardware might have stripped the IV/EIV/ICV data, |
@@ -362,18 +372,11 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
362 | * in which case we should reinsert the data into the frame. | 372 | * in which case we should reinsert the data into the frame. |
363 | */ | 373 | */ |
364 | if ((rxdesc.dev_flags & RXDONE_CRYPTO_IV) && | 374 | if ((rxdesc.dev_flags & RXDONE_CRYPTO_IV) && |
365 | (rxdesc.flags & RX_FLAG_IV_STRIPPED)) { | 375 | (rxdesc.flags & RX_FLAG_IV_STRIPPED)) |
366 | rt2x00crypto_rx_insert_iv(entry->skb, align, | 376 | rt2x00crypto_rx_insert_iv(entry->skb, l2pad, header_length, |
367 | header_length, &rxdesc); | 377 | &rxdesc); |
368 | } else if (align) { | 378 | else |
369 | skb_push(entry->skb, align); | 379 | rt2x00queue_payload_align(entry->skb, l2pad, header_length); |
370 | /* Move entire frame in 1 command */ | ||
371 | memmove(entry->skb->data, entry->skb->data + align, | ||
372 | rxdesc.size); | ||
373 | } | ||
374 | |||
375 | /* Update data pointers, trim buffer to correct size */ | ||
376 | skb_trim(entry->skb, rxdesc.size); | ||
377 | 380 | ||
378 | /* | 381 | /* |
379 | * Update RX statistics. | 382 | * Update RX statistics. |