diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-05-08 17:40:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-10 14:56:48 -0400 |
commit | 2de64dd22d0390688b853788dcadee3c0ad9e518 (patch) | |
tree | b0a6197647817f13a49dfab29899653377027a40 /drivers/net/wireless/rt2x00/rt2800pci.c | |
parent | 59679b91d1d33ebe90b72ffded9a57dba788fa6b (diff) |
rt2x00: Factor out RXWI processing to common rt2800 code.
RXWI processing is exactly the same for rt2800pci and rt2800usb, so
make it common code.
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/rt2800pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 57 |
1 files changed, 11 insertions, 46 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index bd56cd16485a..308842a2e8ba 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 | /* |