From 796562b1e5843c4cc8963c19ab36cfac04182dcd Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Tue, 2 Apr 2024 17:19:53 +0200 Subject: [PATCH] iwm: Fix S:N reporting in ifconfig(8) While there, rename ieee80211_rx_stats fields nf and rssi to c_nf and c_rssi, following FreeBSD and other field names of the struct. With this commit, S:N is properly reported: > ifconfig wlan0 scan SSID/MESH ID BSSID CHAN RATE S:N INT CAPS The Bloom R... 00:e0:4c:b7:65:8c 1 54M -33:-96 100 EP WPA RSN HTCAP WME 0x4e68c3a02... 50:0f:f5:c5:cd:d9 1 54M -82:-96 100 EP HTCAP MESHCONF RSN WME Genetica ta... b0:be:76:df:af:a6 1 54M -83:-96 100 EPS RSN HTCAP WME ATH WPS The Bloom R... 00:e0:4c:b7:6a:b0 6 54M -57:-96 100 EP WPA RSN HTCAP WME ... Fixes: https://bugs.dragonflybsd.org/issues/3366 (#3366) --- sys/dev/netif/iwm/if_iwm.c | 8 -------- sys/netproto/802_11/ieee80211_dragonfly.h | 4 ++-- sys/netproto/802_11/wlan/ieee80211_input.c | 6 +++--- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/sys/dev/netif/iwm/if_iwm.c b/sys/dev/netif/iwm/if_iwm.c index 45323aa8f0..9772efd9f0 100644 --- a/sys/dev/netif/iwm/if_iwm.c +++ b/sys/dev/netif/iwm/if_iwm.c @@ -3273,12 +3273,8 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, } /* rssi is in 1/2db units */ -#if !defined(__DragonFly__) rxs.c_rssi = rssi * 2; rxs.c_nf = sc->sc_noise; -#else - /* old DFly ieee80211 ABI does not have c_rssi */ -#endif if (ieee80211_add_rx_params(m, &rxs) == 0) return false; @@ -3385,12 +3381,8 @@ iwm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ); /* rssi is in 1/2db units */ -#if !defined(__DragonFly__) rxs.c_rssi = rssi * 2; rxs.c_nf = sc->sc_noise; -#else - /* old DFly ieee80211 ABI does not have c_rssi */ -#endif if (ieee80211_add_rx_params(m, &rxs) == 0) return false; diff --git a/sys/netproto/802_11/ieee80211_dragonfly.h b/sys/netproto/802_11/ieee80211_dragonfly.h index 40d68c9a94..d7c68ceb0a 100644 --- a/sys/netproto/802_11/ieee80211_dragonfly.h +++ b/sys/netproto/802_11/ieee80211_dragonfly.h @@ -531,8 +531,8 @@ struct ieee80211_rx_stats { int16_t c_nf_ext[IEEE80211_MAX_CHAINS]; /* per-chain NF */ int16_t c_rssi_ctl[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */ int16_t c_rssi_ext[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */ - uint8_t nf; /* global NF */ - uint8_t rssi; /* global RSSI */ + uint8_t c_nf; /* global NF */ + uint8_t c_rssi; /* global RSSI */ uint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS]; /* per-chain, per-pilot EVM values */ uint16_t c_freq; diff --git a/sys/netproto/802_11/wlan/ieee80211_input.c b/sys/netproto/802_11/wlan/ieee80211_input.c index 0389571fad..ce6428cc34 100644 --- a/sys/netproto/802_11/wlan/ieee80211_input.c +++ b/sys/netproto/802_11/wlan/ieee80211_input.c @@ -99,7 +99,7 @@ ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m, ieee80211_process_mimo(ni, &rxs); //return ieee80211_input(ni, m, rx->rssi, rx->nf); - return ni->ni_vap->iv_input(ni, m, &rxs, rxs.rssi, rxs.nf); + return ni->ni_vap->iv_input(ni, m, &rxs, rxs.c_rssi, rxs.c_nf); } int @@ -108,8 +108,8 @@ ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf) struct ieee80211_rx_stats rx; rx.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI; - rx.nf = nf; - rx.rssi = rssi; + rx.c_nf = nf; + rx.c_rssi = rssi; return ieee80211_input_mimo_all(ic, m, &rx); } -- 2.41.0