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 | |
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>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 17 |
3 files changed, 14 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 874c4e9d9899..1fa3fe7d5ae4 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2616,21 +2616,6 @@ void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting) | |||
2616 | } | 2616 | } |
2617 | EXPORT_SYMBOL(ath9k_hw_set_tsfadjust); | 2617 | EXPORT_SYMBOL(ath9k_hw_set_tsfadjust); |
2618 | 2618 | ||
2619 | /* | ||
2620 | * Extend 15-bit time stamp from rx descriptor to | ||
2621 | * a full 64-bit TSF using the current h/w TSF. | ||
2622 | */ | ||
2623 | u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp) | ||
2624 | { | ||
2625 | u64 tsf; | ||
2626 | |||
2627 | tsf = ath9k_hw_gettsf64(ah); | ||
2628 | if ((tsf & 0x7fff) < rstamp) | ||
2629 | tsf -= 0x8000; | ||
2630 | return (tsf & ~0x7fff) | rstamp; | ||
2631 | } | ||
2632 | EXPORT_SYMBOL(ath9k_hw_extend_tsf); | ||
2633 | |||
2634 | void ath9k_hw_set11nmac2040(struct ath_hw *ah) | 2619 | void ath9k_hw_set11nmac2040(struct ath_hw *ah) |
2635 | { | 2620 | { |
2636 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; | 2621 | struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 009f0fafee5d..ba84ac7ac4e2 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -894,7 +894,6 @@ u64 ath9k_hw_gettsf64(struct ath_hw *ah); | |||
894 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); | 894 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); |
895 | void ath9k_hw_reset_tsf(struct ath_hw *ah); | 895 | void ath9k_hw_reset_tsf(struct ath_hw *ah); |
896 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); | 896 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); |
897 | u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp); | ||
898 | void ath9k_hw_init_global_settings(struct ath_hw *ah); | 897 | void ath9k_hw_init_global_settings(struct ath_hw *ah); |
899 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); | 898 | void ath9k_hw_set11nmac2040(struct ath_hw *ah); |
900 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); | 899 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
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) |