diff options
-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, |