diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-03-29 23:09:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:46:41 -0400 |
commit | 8e6f5aa250d6013ec0d66f9f45f376678d3fc4ab (patch) | |
tree | be379f3c3ea007c3f239b5043242db29143937c3 /drivers | |
parent | db1a052b73f7c97f9e8b21f3f19a92313ed2acb1 (diff) |
ath9k: split out access to rx status information
This patch passes in a pointer to the ath_rx_status data structure for
functions that need it, instead of letting them grab it directly from
the ath_desc struct. This is useful for making it possible to allocate
the intermediate rx status data separately.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/mac.c | 72 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/mac.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 14 |
5 files changed, 52 insertions, 60 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 6a4ef9bcff33..c7e895925393 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -660,30 +660,29 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
660 | #undef PHY_ERR | 660 | #undef PHY_ERR |
661 | } | 661 | } |
662 | 662 | ||
663 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_buf *bf) | 663 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
664 | { | 664 | { |
665 | #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++ | 665 | #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++ |
666 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ | 666 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ |
667 | 667 | ||
668 | struct ath_desc *ds = bf->bf_desc; | ||
669 | u32 phyerr; | 668 | u32 phyerr; |
670 | 669 | ||
671 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC) | 670 | if (rs->rs_status & ATH9K_RXERR_CRC) |
672 | RX_STAT_INC(crc_err); | 671 | RX_STAT_INC(crc_err); |
673 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_DECRYPT) | 672 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) |
674 | RX_STAT_INC(decrypt_crc_err); | 673 | RX_STAT_INC(decrypt_crc_err); |
675 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_MIC) | 674 | if (rs->rs_status & ATH9K_RXERR_MIC) |
676 | RX_STAT_INC(mic_err); | 675 | RX_STAT_INC(mic_err); |
677 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DELIM_CRC_PRE) | 676 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) |
678 | RX_STAT_INC(pre_delim_crc_err); | 677 | RX_STAT_INC(pre_delim_crc_err); |
679 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DELIM_CRC_POST) | 678 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) |
680 | RX_STAT_INC(post_delim_crc_err); | 679 | RX_STAT_INC(post_delim_crc_err); |
681 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DECRYPT_BUSY) | 680 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) |
682 | RX_STAT_INC(decrypt_busy_err); | 681 | RX_STAT_INC(decrypt_busy_err); |
683 | 682 | ||
684 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_PHY) { | 683 | if (rs->rs_status & ATH9K_RXERR_PHY) { |
685 | RX_STAT_INC(phy_err); | 684 | RX_STAT_INC(phy_err); |
686 | phyerr = ds->ds_rxstat.rs_phyerr & 0x24; | 685 | phyerr = rs->rs_phyerr & 0x24; |
687 | RX_PHY_ERR_INC(phyerr); | 686 | RX_PHY_ERR_INC(phyerr); |
688 | } | 687 | } |
689 | 688 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 789c67791092..9551d8eb9453 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -168,7 +168,7 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); | |||
168 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate); | 168 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate); |
169 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, | 169 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, |
170 | struct ath_buf *bf, struct ath_tx_status *ts); | 170 | struct ath_buf *bf, struct ath_tx_status *ts); |
171 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_buf *bf); | 171 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs); |
172 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, | 172 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
173 | int xretries, int retries, u8 per); | 173 | int xretries, int retries, u8 per); |
174 | 174 | ||
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 08ad6dfa976d..e020b82a677e 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -859,7 +859,7 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q) | |||
859 | EXPORT_SYMBOL(ath9k_hw_resettxqueue); | 859 | EXPORT_SYMBOL(ath9k_hw_resettxqueue); |
860 | 860 | ||
861 | int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | 861 | int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, |
862 | u32 pa, struct ath_desc *nds, u64 tsf) | 862 | struct ath_rx_status *rs, u64 tsf) |
863 | { | 863 | { |
864 | struct ar5416_desc ads; | 864 | struct ar5416_desc ads; |
865 | struct ar5416_desc *adsp = AR5416DESC(ds); | 865 | struct ar5416_desc *adsp = AR5416DESC(ds); |
@@ -870,70 +870,70 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | |||
870 | 870 | ||
871 | ads.u.rx = adsp->u.rx; | 871 | ads.u.rx = adsp->u.rx; |
872 | 872 | ||
873 | ds->ds_rxstat.rs_status = 0; | 873 | rs->rs_status = 0; |
874 | ds->ds_rxstat.rs_flags = 0; | 874 | rs->rs_flags = 0; |
875 | 875 | ||
876 | ds->ds_rxstat.rs_datalen = ads.ds_rxstatus1 & AR_DataLen; | 876 | rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen; |
877 | ds->ds_rxstat.rs_tstamp = ads.AR_RcvTimestamp; | 877 | rs->rs_tstamp = ads.AR_RcvTimestamp; |
878 | 878 | ||
879 | if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) { | 879 | if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) { |
880 | ds->ds_rxstat.rs_rssi = ATH9K_RSSI_BAD; | 880 | rs->rs_rssi = ATH9K_RSSI_BAD; |
881 | ds->ds_rxstat.rs_rssi_ctl0 = ATH9K_RSSI_BAD; | 881 | rs->rs_rssi_ctl0 = ATH9K_RSSI_BAD; |
882 | ds->ds_rxstat.rs_rssi_ctl1 = ATH9K_RSSI_BAD; | 882 | rs->rs_rssi_ctl1 = ATH9K_RSSI_BAD; |
883 | ds->ds_rxstat.rs_rssi_ctl2 = ATH9K_RSSI_BAD; | 883 | rs->rs_rssi_ctl2 = ATH9K_RSSI_BAD; |
884 | ds->ds_rxstat.rs_rssi_ext0 = ATH9K_RSSI_BAD; | 884 | rs->rs_rssi_ext0 = ATH9K_RSSI_BAD; |
885 | ds->ds_rxstat.rs_rssi_ext1 = ATH9K_RSSI_BAD; | 885 | rs->rs_rssi_ext1 = ATH9K_RSSI_BAD; |
886 | ds->ds_rxstat.rs_rssi_ext2 = ATH9K_RSSI_BAD; | 886 | rs->rs_rssi_ext2 = ATH9K_RSSI_BAD; |
887 | } else { | 887 | } else { |
888 | ds->ds_rxstat.rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined); | 888 | rs->rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined); |
889 | ds->ds_rxstat.rs_rssi_ctl0 = MS(ads.ds_rxstatus0, | 889 | rs->rs_rssi_ctl0 = MS(ads.ds_rxstatus0, |
890 | AR_RxRSSIAnt00); | 890 | AR_RxRSSIAnt00); |
891 | ds->ds_rxstat.rs_rssi_ctl1 = MS(ads.ds_rxstatus0, | 891 | rs->rs_rssi_ctl1 = MS(ads.ds_rxstatus0, |
892 | AR_RxRSSIAnt01); | 892 | AR_RxRSSIAnt01); |
893 | ds->ds_rxstat.rs_rssi_ctl2 = MS(ads.ds_rxstatus0, | 893 | rs->rs_rssi_ctl2 = MS(ads.ds_rxstatus0, |
894 | AR_RxRSSIAnt02); | 894 | AR_RxRSSIAnt02); |
895 | ds->ds_rxstat.rs_rssi_ext0 = MS(ads.ds_rxstatus4, | 895 | rs->rs_rssi_ext0 = MS(ads.ds_rxstatus4, |
896 | AR_RxRSSIAnt10); | 896 | AR_RxRSSIAnt10); |
897 | ds->ds_rxstat.rs_rssi_ext1 = MS(ads.ds_rxstatus4, | 897 | rs->rs_rssi_ext1 = MS(ads.ds_rxstatus4, |
898 | AR_RxRSSIAnt11); | 898 | AR_RxRSSIAnt11); |
899 | ds->ds_rxstat.rs_rssi_ext2 = MS(ads.ds_rxstatus4, | 899 | rs->rs_rssi_ext2 = MS(ads.ds_rxstatus4, |
900 | AR_RxRSSIAnt12); | 900 | AR_RxRSSIAnt12); |
901 | } | 901 | } |
902 | if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) | 902 | if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) |
903 | ds->ds_rxstat.rs_keyix = MS(ads.ds_rxstatus8, AR_KeyIdx); | 903 | rs->rs_keyix = MS(ads.ds_rxstatus8, AR_KeyIdx); |
904 | else | 904 | else |
905 | ds->ds_rxstat.rs_keyix = ATH9K_RXKEYIX_INVALID; | 905 | rs->rs_keyix = ATH9K_RXKEYIX_INVALID; |
906 | 906 | ||
907 | ds->ds_rxstat.rs_rate = RXSTATUS_RATE(ah, (&ads)); | 907 | rs->rs_rate = RXSTATUS_RATE(ah, (&ads)); |
908 | ds->ds_rxstat.rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0; | 908 | rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0; |
909 | 909 | ||
910 | ds->ds_rxstat.rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0; | 910 | rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0; |
911 | ds->ds_rxstat.rs_moreaggr = | 911 | rs->rs_moreaggr = |
912 | (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; | 912 | (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; |
913 | ds->ds_rxstat.rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); | 913 | rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); |
914 | ds->ds_rxstat.rs_flags = | 914 | rs->rs_flags = |
915 | (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0; | 915 | (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0; |
916 | ds->ds_rxstat.rs_flags |= | 916 | rs->rs_flags |= |
917 | (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0; | 917 | (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0; |
918 | 918 | ||
919 | if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) | 919 | if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) |
920 | ds->ds_rxstat.rs_flags |= ATH9K_RX_DELIM_CRC_PRE; | 920 | rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; |
921 | if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) | 921 | if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) |
922 | ds->ds_rxstat.rs_flags |= ATH9K_RX_DELIM_CRC_POST; | 922 | rs->rs_flags |= ATH9K_RX_DELIM_CRC_POST; |
923 | if (ads.ds_rxstatus8 & AR_DecryptBusyErr) | 923 | if (ads.ds_rxstatus8 & AR_DecryptBusyErr) |
924 | ds->ds_rxstat.rs_flags |= ATH9K_RX_DECRYPT_BUSY; | 924 | rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY; |
925 | 925 | ||
926 | if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) { | 926 | if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) { |
927 | if (ads.ds_rxstatus8 & AR_CRCErr) | 927 | if (ads.ds_rxstatus8 & AR_CRCErr) |
928 | ds->ds_rxstat.rs_status |= ATH9K_RXERR_CRC; | 928 | rs->rs_status |= ATH9K_RXERR_CRC; |
929 | else if (ads.ds_rxstatus8 & AR_PHYErr) { | 929 | else if (ads.ds_rxstatus8 & AR_PHYErr) { |
930 | ds->ds_rxstat.rs_status |= ATH9K_RXERR_PHY; | 930 | rs->rs_status |= ATH9K_RXERR_PHY; |
931 | phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode); | 931 | phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode); |
932 | ds->ds_rxstat.rs_phyerr = phyerr; | 932 | rs->rs_phyerr = phyerr; |
933 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) | 933 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) |
934 | ds->ds_rxstat.rs_status |= ATH9K_RXERR_DECRYPT; | 934 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
935 | else if (ads.ds_rxstatus8 & AR_MichaelErr) | 935 | else if (ads.ds_rxstatus8 & AR_MichaelErr) |
936 | ds->ds_rxstat.rs_status |= ATH9K_RXERR_MIC; | 936 | rs->rs_status |= ATH9K_RXERR_MIC; |
937 | } | 937 | } |
938 | 938 | ||
939 | return 0; | 939 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 27529204d91e..d1d5b238cdee 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -241,9 +241,6 @@ struct ath_desc { | |||
241 | void *ds_vdata; | 241 | void *ds_vdata; |
242 | } __packed; | 242 | } __packed; |
243 | 243 | ||
244 | #define ds_rxstat ds_us.rx | ||
245 | #define ds_stat ds_us.stats | ||
246 | |||
247 | #define ATH9K_TXDESC_CLRDMASK 0x0001 | 244 | #define ATH9K_TXDESC_CLRDMASK 0x0001 |
248 | #define ATH9K_TXDESC_NOACK 0x0002 | 245 | #define ATH9K_TXDESC_NOACK 0x0002 |
249 | #define ATH9K_TXDESC_RTSENA 0x0004 | 246 | #define ATH9K_TXDESC_RTSENA 0x0004 |
@@ -732,7 +729,7 @@ int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, | |||
732 | bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q); | 729 | bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q); |
733 | bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q); | 730 | bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q); |
734 | int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | 731 | int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, |
735 | u32 pa, struct ath_desc *nds, u64 tsf); | 732 | struct ath_rx_status *rs, u64 tsf); |
736 | void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, | 733 | void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, |
737 | u32 size, u32 flags); | 734 | u32 size, u32 flags); |
738 | bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set); | 735 | bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set); |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 1ca42e5148c8..9617887907b7 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -506,6 +506,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
506 | 506 | ||
507 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); | 507 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); |
508 | ds = bf->bf_desc; | 508 | ds = bf->bf_desc; |
509 | rx_stats = &ds->ds_us.rx; | ||
509 | 510 | ||
510 | /* | 511 | /* |
511 | * Must provide the virtual address of the current | 512 | * Must provide the virtual address of the current |
@@ -518,10 +519,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
518 | * on. All this is necessary because of our use of | 519 | * on. All this is necessary because of our use of |
519 | * a self-linked list to avoid rx overruns. | 520 | * a self-linked list to avoid rx overruns. |
520 | */ | 521 | */ |
521 | retval = ath9k_hw_rxprocdesc(ah, ds, | 522 | retval = ath9k_hw_rxprocdesc(ah, ds, rx_stats, 0); |
522 | bf->bf_daddr, | ||
523 | PA2DESC(sc, ds->ds_link), | ||
524 | 0); | ||
525 | if (retval == -EINPROGRESS) { | 523 | if (retval == -EINPROGRESS) { |
526 | struct ath_buf *tbf; | 524 | struct ath_buf *tbf; |
527 | struct ath_desc *tds; | 525 | struct ath_desc *tds; |
@@ -545,8 +543,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
545 | */ | 543 | */ |
546 | 544 | ||
547 | tds = tbf->bf_desc; | 545 | tds = tbf->bf_desc; |
548 | retval = ath9k_hw_rxprocdesc(ah, tds, tbf->bf_daddr, | 546 | retval = ath9k_hw_rxprocdesc(ah, tds, &tds->ds_us.rx, 0); |
549 | PA2DESC(sc, tds->ds_link), 0); | ||
550 | if (retval == -EINPROGRESS) { | 547 | if (retval == -EINPROGRESS) { |
551 | break; | 548 | break; |
552 | } | 549 | } |
@@ -569,9 +566,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
569 | rxs = IEEE80211_SKB_RXCB(skb); | 566 | rxs = IEEE80211_SKB_RXCB(skb); |
570 | 567 | ||
571 | hw = ath_get_virt_hw(sc, hdr); | 568 | hw = ath_get_virt_hw(sc, hdr); |
572 | rx_stats = &ds->ds_rxstat; | ||
573 | 569 | ||
574 | ath_debug_stat_rx(sc, bf); | 570 | ath_debug_stat_rx(sc, rx_stats); |
575 | 571 | ||
576 | /* | 572 | /* |
577 | * If we're asked to flush receive queue, directly | 573 | * If we're asked to flush receive queue, directly |
@@ -626,7 +622,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
626 | * change the default rx antenna if rx diversity chooses the | 622 | * change the default rx antenna if rx diversity chooses the |
627 | * other antenna 3 times in a row. | 623 | * other antenna 3 times in a row. |
628 | */ | 624 | */ |
629 | if (sc->rx.defant != ds->ds_rxstat.rs_antenna) { | 625 | if (sc->rx.defant != rx_stats->rs_antenna) { |
630 | if (++sc->rx.rxotherant >= 3) | 626 | if (++sc->rx.rxotherant >= 3) |
631 | ath_setdefantenna(sc, rx_stats->rs_antenna); | 627 | ath_setdefantenna(sc, rx_stats->rs_antenna); |
632 | } else { | 628 | } else { |