diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-06-12 00:33:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-14 15:39:31 -0400 |
commit | a6d2055b02dde1067075795274672720baadd3ca (patch) | |
tree | ec2014019e26fc19be90c81c13373cbe1f7afe09 /drivers/net/wireless/ath/ath9k/recv.c | |
parent | ebe297c35d5e7137a2d626b49b4c8c4c0ab4f242 (diff) |
ath9k: fix extending the rx timestamp with the hardware TSF
AR5416 and all newer chipsets use a 32 bit rx timestamp, so there
is no need to keep the 15 bit timestamp extending logic around.
This patch removes ath9k_hw_extend_tsf (replaced by a call to
ath9k_hw_gettsf64), and reduces the frequency of TSF reads, which
can improve performance in some cases.
This change also has the side effect of making rx timestamps
more accurate.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 5141cd81b5d0..78ef1aed060c 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1002,8 +1002,6 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, | |||
1002 | struct ieee80211_rx_status *rx_status, | 1002 | struct ieee80211_rx_status *rx_status, |
1003 | bool *decrypt_error) | 1003 | bool *decrypt_error) |
1004 | { | 1004 | { |
1005 | struct ath_hw *ah = common->ah; | ||
1006 | |||
1007 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 1005 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
1008 | 1006 | ||
1009 | /* | 1007 | /* |
@@ -1018,7 +1016,6 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, | |||
1018 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) | 1016 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) |
1019 | return -EINVAL; | 1017 | return -EINVAL; |
1020 | 1018 | ||
1021 | rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); | ||
1022 | rx_status->band = hw->conf.channel->band; | 1019 | rx_status->band = hw->conf.channel->band; |
1023 | rx_status->freq = hw->conf.channel->center_freq; | 1020 | rx_status->freq = hw->conf.channel->center_freq; |
1024 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; | 1021 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; |
@@ -1100,6 +1097,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1100 | bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); | 1097 | bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); |
1101 | int dma_type; | 1098 | int dma_type; |
1102 | u8 rx_status_len = ah->caps.rx_status_len; | 1099 | u8 rx_status_len = ah->caps.rx_status_len; |
1100 | u64 tsf = 0; | ||
1101 | u32 tsf_lower = 0; | ||
1103 | 1102 | ||
1104 | if (edma) | 1103 | if (edma) |
1105 | dma_type = DMA_BIDIRECTIONAL; | 1104 | dma_type = DMA_BIDIRECTIONAL; |
@@ -1109,6 +1108,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1109 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; | 1108 | qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; |
1110 | spin_lock_bh(&sc->rx.rxbuflock); | 1109 | spin_lock_bh(&sc->rx.rxbuflock); |
1111 | 1110 | ||
1111 | tsf = ath9k_hw_gettsf64(ah); | ||
1112 | tsf_lower = tsf & 0xffffffff; | ||
1113 | |||
1112 | do { | 1114 | do { |
1113 | /* If handling rx interrupt and flush is in progress => exit */ | 1115 | /* If handling rx interrupt and flush is in progress => exit */ |
1114 | if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0)) | 1116 | if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0)) |
@@ -1141,6 +1143,15 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1141 | if (flush) | 1143 | if (flush) |
1142 | goto requeue; | 1144 | goto requeue; |
1143 | 1145 | ||
1146 | rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; | ||
1147 | if (rs.rs_tstamp > tsf_lower && | ||
1148 | unlikely(rs.rs_tstamp - tsf_lower > 0x10000000)) | ||
1149 | rxs->mactime -= 0x100000000ULL; | ||
1150 | |||
1151 | if (rs.rs_tstamp < tsf_lower && | ||
1152 | unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) | ||
1153 | rxs->mactime += 0x100000000ULL; | ||
1154 | |||
1144 | retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs, | 1155 | retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs, |
1145 | rxs, &decrypt_error); | 1156 | rxs, &decrypt_error); |
1146 | if (retval) | 1157 | if (retval) |