aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c44
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c57
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c74
4 files changed, 79 insertions, 97 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 28d82ce0552..7410ac1acaf 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -335,6 +335,50 @@ void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc)
335} 335}
336EXPORT_SYMBOL_GPL(rt2800_write_txwi); 336EXPORT_SYMBOL_GPL(rt2800_write_txwi);
337 337
338void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *rxdesc)
339{
340 __le32 *rxwi = (__le32 *) skb->data;
341 u32 word;
342
343 rt2x00_desc_read(rxwi, 0, &word);
344
345 rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF);
346 rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
347
348 rt2x00_desc_read(rxwi, 1, &word);
349
350 if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI))
351 rxdesc->flags |= RX_FLAG_SHORT_GI;
352
353 if (rt2x00_get_field32(word, RXWI_W1_BW))
354 rxdesc->flags |= RX_FLAG_40MHZ;
355
356 /*
357 * Detect RX rate, always use MCS as signal type.
358 */
359 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS;
360 rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS);
361 rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE);
362
363 /*
364 * Mask of 0x8 bit to remove the short preamble flag.
365 */
366 if (rxdesc->rate_mode == RATE_MODE_CCK)
367 rxdesc->signal &= ~0x8;
368
369 rt2x00_desc_read(rxwi, 2, &word);
370
371 rxdesc->rssi =
372 (rt2x00_get_field32(word, RXWI_W2_RSSI0) +
373 rt2x00_get_field32(word, RXWI_W2_RSSI1)) / 2;
374
375 /*
376 * Remove RXWI descriptor from start of buffer.
377 */
378 skb_pull(skb, RXWI_DESC_SIZE);
379}
380EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
381
338#ifdef CONFIG_RT2X00_LIB_DEBUGFS 382#ifdef CONFIG_RT2X00_LIB_DEBUGFS
339const struct rt2x00debug rt2800_rt2x00debug = { 383const struct rt2x00debug rt2800_rt2x00debug = {
340 .owner = THIS_MODULE, 384 .owner = THIS_MODULE,
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index b805310e126..94de999e229 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -112,6 +112,7 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
112 const u8 arg0, const u8 arg1); 112 const u8 arg0, const u8 arg1);
113 113
114void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc); 114void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc);
115void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *txdesc);
115 116
116extern const struct rt2x00debug rt2800_rt2x00debug; 117extern const struct rt2x00debug rt2800_rt2x00debug;
117 118
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index bd56cd16485..308842a2e8b 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -770,20 +770,11 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry,
770 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 770 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
771 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 771 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
772 __le32 *rxd = entry_priv->desc; 772 __le32 *rxd = entry_priv->desc;
773 __le32 *rxwi = (__le32 *)entry->skb->data; 773 u32 word;
774 u32 rxd3; 774
775 u32 rxwi0; 775 rt2x00_desc_read(rxd, 3, &word);
776 u32 rxwi1; 776
777 u32 rxwi2; 777 if (rt2x00_get_field32(word, RXD_W3_CRC_ERROR))
778 u32 rxwi3;
779
780 rt2x00_desc_read(rxd, 3, &rxd3);
781 rt2x00_desc_read(rxwi, 0, &rxwi0);
782 rt2x00_desc_read(rxwi, 1, &rxwi1);
783 rt2x00_desc_read(rxwi, 2, &rxwi2);
784 rt2x00_desc_read(rxwi, 3, &rxwi3);
785
786 if (rt2x00_get_field32(rxd3, RXD_W3_CRC_ERROR))
787 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 778 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
788 779
789 /* 780 /*
@@ -791,10 +782,9 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry,
791 * decryption. This prevents us from correct providing 782 * decryption. This prevents us from correct providing
792 * correct statistics through debugfs. 783 * correct statistics through debugfs.
793 */ 784 */
794 rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); 785 rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W3_CIPHER_ERROR);
795 rxdesc->cipher_status = rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR);
796 786
797 if (rt2x00_get_field32(rxd3, RXD_W3_DECRYPTED)) { 787 if (rt2x00_get_field32(word, RXD_W3_DECRYPTED)) {
798 /* 788 /*
799 * Hardware has stripped IV/EIV data from 802.11 frame during 789 * Hardware has stripped IV/EIV data from 802.11 frame during
800 * decryption. Unfortunately the descriptor doesn't contain 790 * decryption. Unfortunately the descriptor doesn't contain
@@ -809,47 +799,22 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry,
809 rxdesc->flags |= RX_FLAG_MMIC_ERROR; 799 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
810 } 800 }
811 801
812 if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) 802 if (rt2x00_get_field32(word, RXD_W3_MY_BSS))
813 rxdesc->dev_flags |= RXDONE_MY_BSS; 803 rxdesc->dev_flags |= RXDONE_MY_BSS;
814 804
815 if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) 805 if (rt2x00_get_field32(word, RXD_W3_L2PAD))
816 rxdesc->dev_flags |= RXDONE_L2PAD; 806 rxdesc->dev_flags |= RXDONE_L2PAD;
817 807
818 if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
819 rxdesc->flags |= RX_FLAG_SHORT_GI;
820
821 if (rt2x00_get_field32(rxwi1, RXWI_W1_BW))
822 rxdesc->flags |= RX_FLAG_40MHZ;
823
824 /* 808 /*
825 * Detect RX rate, always use MCS as signal type. 809 * Process the RXWI structure that is at the start of the buffer.
826 */ 810 */
827 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; 811 rt2800_process_rxwi(entry->skb, rxdesc);
828 rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE);
829 rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS);
830
831 /*
832 * Mask of 0x8 bit to remove the short preamble flag.
833 */
834 if (rxdesc->rate_mode == RATE_MODE_CCK)
835 rxdesc->signal &= ~0x8;
836
837 rxdesc->rssi =
838 (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) +
839 rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2;
840
841 rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
842 812
843 /* 813 /*
844 * Set RX IDX in register to inform hardware that we have handled 814 * Set RX IDX in register to inform hardware that we have handled
845 * this entry and it is available for reuse again. 815 * this entry and it is available for reuse again.
846 */ 816 */
847 rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); 817 rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx);
848
849 /*
850 * Remove TXWI descriptor from start of buffer.
851 */
852 skb_pull(entry->skb, RXWI_DESC_SIZE);
853} 818}
854 819
855/* 820/*
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index b39b858e0cf..db371193b50 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -507,53 +507,45 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
507{ 507{
508 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 508 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
509 __le32 *rxi = (__le32 *)entry->skb->data; 509 __le32 *rxi = (__le32 *)entry->skb->data;
510 __le32 *rxwi;
511 __le32 *rxd; 510 __le32 *rxd;
512 u32 rxi0; 511 u32 word;
513 u32 rxwi0;
514 u32 rxwi1;
515 u32 rxwi2;
516 u32 rxwi3;
517 u32 rxd0;
518 int rx_pkt_len; 512 int rx_pkt_len;
519 513
520 /* 514 /*
515 * Copy descriptor to the skbdesc->desc buffer, making it safe from
516 * moving of frame data in rt2x00usb.
517 */
518 memcpy(skbdesc->desc, rxi, skbdesc->desc_len);
519
520 /*
521 * RX frame format is : 521 * RX frame format is :
522 * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | 522 * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad |
523 * |<------------ rx_pkt_len -------------->| 523 * |<------------ rx_pkt_len -------------->|
524 */ 524 */
525 rt2x00_desc_read(rxi, 0, &rxi0); 525 rt2x00_desc_read(rxi, 0, &word);
526 rx_pkt_len = rt2x00_get_field32(rxi0, RXINFO_W0_USB_DMA_RX_PKT_LEN); 526 rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN);
527
528 rxwi = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE);
529 527
530 /* 528 /*
531 * FIXME : we need to check for rx_pkt_len validity 529 * Remove the RXINFO structure from the sbk.
532 */ 530 */
533 rxd = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE + rx_pkt_len); 531 skb_pull(entry->skb, RXINFO_DESC_SIZE);
534 532
535 /* 533 /*
536 * Copy descriptor to the skbdesc->desc buffer, making it safe from 534 * FIXME: we need to check for rx_pkt_len validity
537 * moving of frame data in rt2x00usb.
538 */ 535 */
539 memcpy(skbdesc->desc, rxi, skbdesc->desc_len); 536 rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
540 537
541 /* 538 /*
542 * It is now safe to read the descriptor on all architectures. 539 * It is now safe to read the descriptor on all architectures.
543 */ 540 */
544 rt2x00_desc_read(rxwi, 0, &rxwi0); 541 rt2x00_desc_read(rxd, 0, &word);
545 rt2x00_desc_read(rxwi, 1, &rxwi1);
546 rt2x00_desc_read(rxwi, 2, &rxwi2);
547 rt2x00_desc_read(rxwi, 3, &rxwi3);
548 rt2x00_desc_read(rxd, 0, &rxd0);
549 542
550 if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR)) 543 if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR))
551 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 544 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
552 545
553 rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); 546 rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR);
554 rxdesc->cipher_status = rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR);
555 547
556 if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) { 548 if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) {
557 /* 549 /*
558 * Hardware has stripped IV/EIV data from 802.11 frame during 550 * Hardware has stripped IV/EIV data from 802.11 frame during
559 * decryption. Unfortunately the descriptor doesn't contain 551 * decryption. Unfortunately the descriptor doesn't contain
@@ -568,41 +560,21 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
568 rxdesc->flags |= RX_FLAG_MMIC_ERROR; 560 rxdesc->flags |= RX_FLAG_MMIC_ERROR;
569 } 561 }
570 562
571 if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS)) 563 if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
572 rxdesc->dev_flags |= RXDONE_MY_BSS; 564 rxdesc->dev_flags |= RXDONE_MY_BSS;
573 565
574 if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) 566 if (rt2x00_get_field32(word, RXD_W0_L2PAD))
575 rxdesc->dev_flags |= RXDONE_L2PAD; 567 rxdesc->dev_flags |= RXDONE_L2PAD;
576 568
577 if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
578 rxdesc->flags |= RX_FLAG_SHORT_GI;
579
580 if (rt2x00_get_field32(rxwi1, RXWI_W1_BW))
581 rxdesc->flags |= RX_FLAG_40MHZ;
582
583 /* 569 /*
584 * Detect RX rate, always use MCS as signal type. 570 * Remove RXD descriptor from end of buffer.
585 */ 571 */
586 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; 572 skb_trim(entry->skb, rx_pkt_len);
587 rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE);
588 rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS);
589
590 /*
591 * Mask of 0x8 bit to remove the short preamble flag.
592 */
593 if (rxdesc->rate_mode == RATE_MODE_CCK)
594 rxdesc->signal &= ~0x8;
595
596 rxdesc->rssi =
597 (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) +
598 rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2;
599
600 rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT);
601 573
602 /* 574 /*
603 * Remove RXWI descriptor from start of buffer. 575 * Process the RXWI structure.
604 */ 576 */
605 skb_pull(entry->skb, skbdesc->desc_len); 577 rt2800_process_rxwi(entry->skb, rxdesc);
606} 578}
607 579
608/* 580/*