aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2021-03-31 16:38:15 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2021-04-19 05:52:31 +0000
commitbed90bf8ed5c8fd69822529a839bacad762817a2 (patch)
treef429a1912556cdfa9d7b0cc7d8f7329e8e1acace /sys/contrib
parentdead34f82219b4017effc3a2e50ae3476870f6ab (diff)
downloadsrc-bed90bf8ed5c8fd69822529a839bacad762817a2.tar.gz
src-bed90bf8ed5c8fd69822529a839bacad762817a2.zip
[ath_hal] Add get/set NAV functions
The NAV (network allocation vector) register reflects the current MAC tracking of NAV - when it will stay quiet before transmitting. Other devices transmit their frame durations in their 802.11 PHY headers and all devices that hear a frame - even if it's one in an encoding they don't understand - will understand the low bitrate PHY header that includes the frame duration. So, they'll set NAV to this value so they'll stay quiet until the transmit completes. Anyway, sometimes the PHY NAV header is garbled and sometimes, notably older broadcom devices, will fake a long NAV so they can get "cleaner" air for local calibration. When this happens, the hardware will stay quiet for quite some time and this can lead to missed/stuck beacons, or (for Very Large Values) a MAC hang. This code just adds the ability to get/set the NAV; the driver will need to take care of using it during transmit hangs and beacon misses to see if it's due to a trash looking NAV.
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
index 37e64bc86cdd..68e5f018cc6c 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
@@ -69,6 +69,23 @@ ar9300_get_next_tbtt(struct ath_hal *ah)
return (OS_REG_READ(ah, AR_NEXT_TBTT_TIMER));
}
+static u_int
+ar9300_get_nav(struct ath_hal *ah)
+{
+ uint32_t reg;
+
+ reg = OS_REG_READ(ah, AR_NAV);
+ if (reg == 0xdeadbeef)
+ return 0;
+ return reg;
+}
+
+static void
+ar9300_set_nav(struct ath_hal *ah, u_int nav)
+{
+
+ OS_REG_WRITE(ah, AR_NAV, nav);
+}
/*
* TODO: implement the antenna diversity control for AR9485 and
@@ -484,6 +501,8 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
/* ah_get11nExtBusy */
ah->ah_set11nMac2040 = ar9300_set_11n_mac2040;
ah->ah_setChainMasks = ar9300SetChainMasks;
+ ah->ah_getNav = ar9300_get_nav;
+ ah->ah_setNav = ar9300_set_nav;
/* ah_get11nRxClear */
/* ah_set11nRxClear */