Date: Tue, 5 Apr 2022 15:39:54 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7b9d8e33bc4e - stable/13 - LinuxKPI: 802.11: fix RSSI (and NF) Message-ID: <202204051539.235FdsQA001422@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7b9d8e33bc4ee0b8cc22ab28a1f09a062e103bd5 commit 7b9d8e33bc4ee0b8cc22ab28a1f09a062e103bd5 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-04-01 22:31:23 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-04-05 14:47:13 +0000 LinuxKPI: 802.11: fix RSSI (and NF) As in 4a22cd6c4e5f4fc4a38aa7400742d4005c5ae3de nf and rss should be signed and not unsigned. Change the types in the header and while here change a magic number to a define as done elsewhere (value does not change). When calculating c_rssi we need to make it relative so subtract nf. And while here improve the debug output. This will hopefully fix ifconfig wlanN list scan S:N output which tools use to chose a BSSID and help net80211 internal calculations. Sponsored by: The FreeBSD Foundation (cherry picked from commit 60970a328e280b25b05f1d9a9de1ef91af573c4a) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_80211.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 4e3342837ddc..49088cdea0eb 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -509,8 +509,8 @@ struct ieee80211_rx_status { uint8_t ampdu_reference; uint8_t band; uint8_t chains; - uint8_t chain_signal[4]; - uint8_t signal; + int8_t chain_signal[IEEE80211_MAX_CHAINS]; + int8_t signal; uint8_t enc_flags; uint8_t he_dcm; uint8_t he_gi; diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 13ad2908c021..72bbb1ff1382 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3696,7 +3696,7 @@ linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, /* Implement a dump_rxcb() !!! */ if (linuxkpi_debug_80211 & D80211_TRACE_RX) printf("TRACE %s: RXCB: %ju %ju %u, %#0x, %u, %#0x, %#0x, " - "%u band %u, %u %u %u %u, %u, %#x %#x %#x %#x %u %u %u\n", + "%u band %u, %u { %d %d %d %d }, %d, %#x %#x %#x %#x %u %u %u\n", __func__, (uintmax_t)rx_status->boottime_ns, (uintmax_t)rx_status->mactime, @@ -3711,6 +3711,7 @@ linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, rx_status->chain_signal[0], rx_status->chain_signal[1], rx_status->chain_signal[2], + rx_status->chain_signal[3], rx_status->signal, rx_status->enc_flags, rx_status->he_dcm, @@ -3724,12 +3725,14 @@ no_trace_beacons: memset(&rx_stats, 0, sizeof(rx_stats)); rx_stats.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI; + /* XXX-BZ correct hardcoded rssi and noise floor, how? survey? */ + rx_stats.c_nf = -96; if (ieee80211_hw_check(hw, SIGNAL_DBM) && !(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) rx_stats.c_rssi = rx_status->signal; else - rx_stats.c_rssi = 0; /* XXX */ - rx_stats.c_nf = -96; /* XXX */ + rx_stats.c_rssi = 0; + rx_stats.c_rssi -= rx_stats.c_nf; rx_stats.r_flags |= IEEE80211_R_BAND; rx_stats.c_band = lkpi_nl80211_band_to_net80211_band(rx_status->band); @@ -3737,7 +3740,6 @@ no_trace_beacons: rx_stats.c_freq = rx_status->freq; rx_stats.c_ieee = ieee80211_mhz2ieee(rx_stats.c_freq, rx_stats.c_band); - /* XXX-BZ correct hardcoded rssi and noise floor. */ /* XXX (*sta_statistics)() to get to some of that? */ /* XXX-BZ dump the FreeBSD version of rx_stats as well! */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204051539.235FdsQA001422>