diff options
author | Jakub KiciĆski <kubakici@wp.pl> | 2011-12-27 19:53:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-04 14:31:46 -0500 |
commit | 4bcafac8c64e015775fcb844f643c2c70115bf46 (patch) | |
tree | dc18e8279f8545bd874e1495cb53558df5de43ab /drivers/net/wireless/rt2x00/rt2800usb.c | |
parent | 5aa570159090b8bcf1357ef92386c24ff32d76d2 (diff) |
rt2800usb: Let rt2x00usb handle USB padding
Older USB drivers does not append end padding to skb but instead report
it in size of data to be transmitted to HW. rt2800usb should follow that
behaviour. Custom write_tx_data callback which was adding pad to skb
is not be needed any more.
Thanks to this patch frames handed back from rt2800usb to mac80211 will
no longer contain end padding.
Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 5bff4957a862..7f21005c1bb0 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -400,10 +400,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, | |||
400 | /* | 400 | /* |
401 | * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is | 401 | * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is |
402 | * TXWI + 802.11 header + L2 pad + payload + pad, | 402 | * TXWI + 802.11 header + L2 pad + payload + pad, |
403 | * so need to decrease size of TXINFO and USB end pad. | 403 | * so need to decrease size of TXINFO. |
404 | */ | 404 | */ |
405 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 405 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |
406 | entry->skb->len - TXINFO_DESC_SIZE - 4); | 406 | roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE); |
407 | rt2x00_set_field32(&word, TXINFO_W0_WIV, | 407 | rt2x00_set_field32(&word, TXINFO_W0_WIV, |
408 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); | 408 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); |
409 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); | 409 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); |
@@ -421,37 +421,20 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, | |||
421 | skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; | 421 | skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; |
422 | } | 422 | } |
423 | 423 | ||
424 | static void rt2800usb_write_tx_data(struct queue_entry *entry, | 424 | /* |
425 | struct txentry_desc *txdesc) | 425 | * TX data initialization |
426 | */ | ||
427 | static int rt2800usb_get_tx_data_len(struct queue_entry *entry) | ||
426 | { | 428 | { |
427 | unsigned int len; | ||
428 | int err; | ||
429 | |||
430 | rt2800_write_tx_data(entry, txdesc); | ||
431 | |||
432 | /* | 429 | /* |
433 | * pad(1~3 bytes) is added after each 802.11 payload. | 430 | * pad(1~3 bytes) is needed after each 802.11 payload. |
434 | * USB end pad(4 bytes) is added at each USB bulk out packet end. | 431 | * USB end pad(4 bytes) is needed at each USB bulk out packet end. |
435 | * TX frame format is : | 432 | * TX frame format is : |
436 | * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | | 433 | * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | |
437 | * |<------------- tx_pkt_len ------------->| | 434 | * |<------------- tx_pkt_len ------------->| |
438 | */ | 435 | */ |
439 | len = roundup(entry->skb->len, 4) + 4; | ||
440 | err = skb_padto(entry->skb, len); | ||
441 | if (unlikely(err)) { | ||
442 | WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n"); | ||
443 | return; | ||
444 | } | ||
445 | 436 | ||
446 | entry->skb->len = len; | 437 | return roundup(entry->skb->len, 4) + 4; |
447 | } | ||
448 | |||
449 | /* | ||
450 | * TX data initialization | ||
451 | */ | ||
452 | static int rt2800usb_get_tx_data_len(struct queue_entry *entry) | ||
453 | { | ||
454 | return entry->skb->len; | ||
455 | } | 438 | } |
456 | 439 | ||
457 | /* | 440 | /* |
@@ -807,7 +790,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | |||
807 | .flush_queue = rt2x00usb_flush_queue, | 790 | .flush_queue = rt2x00usb_flush_queue, |
808 | .tx_dma_done = rt2800usb_tx_dma_done, | 791 | .tx_dma_done = rt2800usb_tx_dma_done, |
809 | .write_tx_desc = rt2800usb_write_tx_desc, | 792 | .write_tx_desc = rt2800usb_write_tx_desc, |
810 | .write_tx_data = rt2800usb_write_tx_data, | 793 | .write_tx_data = rt2800_write_tx_data, |
811 | .write_beacon = rt2800_write_beacon, | 794 | .write_beacon = rt2800_write_beacon, |
812 | .clear_beacon = rt2800_clear_beacon, | 795 | .clear_beacon = rt2800_clear_beacon, |
813 | .get_tx_data_len = rt2800usb_get_tx_data_len, | 796 | .get_tx_data_len = rt2800usb_get_tx_data_len, |