summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2017-11-28 04:35:39 +0000
committerstsp <stsp@openbsd.org>2017-11-28 04:35:39 +0000
commit04586493ece51898f60d2abcb19d8baa04a635d8 (patch)
tree16c353d230390d0299a1114ef88f8c68764ff79c
parentIn athn(4), fix a comment which misidentifies the field where RSSI (diff)
downloadwireguard-openbsd-04586493ece51898f60d2abcb19d8baa04a635d8.tar.xz
wireguard-openbsd-04586493ece51898f60d2abcb19d8baa04a635d8.zip
The athn(4) PCI driver forgot about adding the default noisefloor to
measured RSSI values. The same is already done for USB devices. RSSI values shown in ifconfig make sense now. ok kevlo@
-rw-r--r--sys/dev/ic/ar5008.c5
-rw-r--r--sys/dev/ic/athnreg.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c
index 248960e4777..e0188134edd 100644
--- a/sys/dev/ic/ar5008.c
+++ b/sys/dev/ic/ar5008.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5008.c,v 1.45 2017/07/17 14:25:29 stsp Exp $ */
+/* $OpenBSD: ar5008.c,v 1.46 2017/11/28 04:35:39 stsp Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -925,6 +925,7 @@ ar5008_rx_process(struct athn_softc *sc)
/* Send the frame to the 802.11 layer. */
rxi.rxi_flags = 0; /* XXX */
rxi.rxi_rssi = MS(ds->ds_status4, AR_RXS4_RSSI_COMBINED);
+ rxi.rxi_rssi += AR_DEFAULT_NOISE_FLOOR;
rxi.rxi_tstamp = ds->ds_status2;
ieee80211_input(ifp, m, ni, &rxi);
@@ -1927,7 +1928,7 @@ ar5008_bb_load_noisefloor(struct athn_softc *sc)
/* Restore noisefloor values to initial (max) values. */
for (i = 0; i < AR_MAX_CHAINS; i++)
- nf[i] = nf_ext[i] = -50 * 2;
+ nf[i] = nf_ext[i] = AR_DEFAULT_NOISE_FLOOR;
ar5008_write_noisefloor(sc, nf, nf_ext);
}
diff --git a/sys/dev/ic/athnreg.h b/sys/dev/ic/athnreg.h
index 0ed85b15afa..e8dd7005980 100644
--- a/sys/dev/ic/athnreg.h
+++ b/sys/dev/ic/athnreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: athnreg.h,v 1.20 2017/05/19 11:42:48 stsp Exp $ */
+/* $OpenBSD: athnreg.h,v 1.21 2017/11/28 04:35:39 stsp Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -1449,6 +1449,8 @@
#define AR_CTL_2GHT40 7
#define AR_CTL_5GHT40 8
+#define AR_DEFAULT_NOISE_FLOOR (-95)
+
/*
* Macros to access registers.
*/