diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 54 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 56 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 50 |
4 files changed, 60 insertions, 102 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 525267d4cc3e..28d82ce05527 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -281,6 +281,60 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) | |||
281 | } | 281 | } |
282 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); | 282 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); |
283 | 283 | ||
284 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc) | ||
285 | { | ||
286 | __le32 *txwi = (__le32 *)(skb->data - TXWI_DESC_SIZE); | ||
287 | u32 word; | ||
288 | |||
289 | /* | ||
290 | * Initialize TX Info descriptor | ||
291 | */ | ||
292 | rt2x00_desc_read(txwi, 0, &word); | ||
293 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
294 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
295 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
296 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
297 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
298 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
299 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
300 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
301 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
302 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
303 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
304 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
305 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
306 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
307 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
308 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
309 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
310 | rt2x00_desc_write(txwi, 0, word); | ||
311 | |||
312 | rt2x00_desc_read(txwi, 1, &word); | ||
313 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
314 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
315 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
316 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
317 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
318 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
319 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
320 | txdesc->key_idx : 0xff); | ||
321 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
322 | txdesc->length); | ||
323 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->queue + 1); | ||
324 | rt2x00_desc_write(txwi, 1, word); | ||
325 | |||
326 | /* | ||
327 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
328 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
329 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
330 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
331 | * crypto entry in the registers should be used to encrypt the frame. | ||
332 | */ | ||
333 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
334 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
335 | } | ||
336 | EXPORT_SYMBOL_GPL(rt2800_write_txwi); | ||
337 | |||
284 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 338 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
285 | const struct rt2x00debug rt2800_rt2x00debug = { | 339 | const struct rt2x00debug rt2800_rt2x00debug = { |
286 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index ebabeae62d1b..b805310e126c 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -111,6 +111,8 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
111 | const u8 command, const u8 token, | 111 | const u8 command, const u8 token, |
112 | const u8 arg0, const u8 arg1); | 112 | const u8 arg0, const u8 arg1); |
113 | 113 | ||
114 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc); | ||
115 | |||
114 | extern const struct rt2x00debug rt2800_rt2x00debug; | 116 | extern const struct rt2x00debug rt2800_rt2x00debug; |
115 | 117 | ||
116 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); | 118 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index b9ec08180aad..bd56cd16485a 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -616,67 +616,13 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, | 616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, |
617 | struct txentry_desc *txdesc) | 617 | struct txentry_desc *txdesc) |
618 | { | 618 | { |
619 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
620 | struct sk_buff *skb = entry->skb; | ||
621 | struct skb_frame_desc *skbdesc; | ||
622 | int ret; | 619 | int ret; |
623 | __le32 *txwi; | ||
624 | u32 word; | ||
625 | 620 | ||
626 | ret = rt2x00pci_write_tx_data(entry, txdesc); | 621 | ret = rt2x00pci_write_tx_data(entry, txdesc); |
627 | if (ret) | 622 | if (ret) |
628 | return ret; | 623 | return ret; |
629 | 624 | ||
630 | skbdesc = get_skb_frame_desc(skb); | 625 | rt2800_write_txwi(entry->skb, txdesc); |
631 | txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom); | ||
632 | |||
633 | /* | ||
634 | * Initialize TX Info descriptor | ||
635 | */ | ||
636 | rt2x00_desc_read(txwi, 0, &word); | ||
637 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
638 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
639 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
640 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
641 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
642 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
643 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
644 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
645 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
646 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
647 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
648 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
649 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
650 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
651 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
652 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
653 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
654 | rt2x00_desc_write(txwi, 0, word); | ||
655 | |||
656 | rt2x00_desc_read(txwi, 1, &word); | ||
657 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
658 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
659 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
660 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
661 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
662 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
663 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
664 | txdesc->key_idx : 0xff); | ||
665 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
666 | txdesc->length); | ||
667 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
668 | skbdesc->entry->queue->qid + 1); | ||
669 | rt2x00_desc_write(txwi, 1, word); | ||
670 | |||
671 | /* | ||
672 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
673 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
674 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
675 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
676 | * crypto entry in the registers should be used to encrypt the frame. | ||
677 | */ | ||
678 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
679 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
680 | 626 | ||
681 | return 0; | 627 | return 0; |
682 | } | 628 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index df7ad981b808..b39b858e0cf1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -401,59 +401,15 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
401 | { | 401 | { |
402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
403 | __le32 *txi = skbdesc->desc; | 403 | __le32 *txi = skbdesc->desc; |
404 | __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)]; | ||
405 | u32 word; | 404 | u32 word; |
406 | 405 | ||
407 | /* | 406 | /* |
408 | * Initialize TX Info descriptor | 407 | * Initialize TXWI descriptor |
409 | */ | 408 | */ |
410 | rt2x00_desc_read(txwi, 0, &word); | 409 | rt2800_write_txwi(skb, txdesc); |
411 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
412 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
413 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
414 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
415 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
416 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
417 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
418 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
419 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
420 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
421 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
422 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
423 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
424 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
425 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
426 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
427 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
428 | rt2x00_desc_write(txwi, 0, word); | ||
429 | |||
430 | rt2x00_desc_read(txwi, 1, &word); | ||
431 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
432 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
433 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
434 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
435 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
436 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
437 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
438 | txdesc->key_idx : 0xff); | ||
439 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
440 | txdesc->length); | ||
441 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
442 | skbdesc->entry->queue->qid + 1); | ||
443 | rt2x00_desc_write(txwi, 1, word); | ||
444 | 410 | ||
445 | /* | 411 | /* |
446 | * Always write 0 to IV/EIV fields, hardware will insert the IV | 412 | * Initialize TXINFO descriptor |
447 | * from the IVEIV register when TXINFO_W0_WIV is set to 0. | ||
448 | * When TXINFO_W0_WIV is set to 1 it will use the IV data | ||
449 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
450 | * crypto entry in the registers should be used to encrypt the frame. | ||
451 | */ | ||
452 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
453 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
454 | |||
455 | /* | ||
456 | * Initialize TX descriptor | ||
457 | */ | 413 | */ |
458 | rt2x00_desc_read(txi, 0, &word); | 414 | rt2x00_desc_read(txi, 0, &word); |
459 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |