From 96eaa6857ffe009c141c5a6dbea88f96efed9b2d Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Thu, 19 Jun 2025 00:05:27 +0000 Subject: net80211: define a type for rssi values Due to net80211 keeping values in 0.5dBm relative to the noise floor an int8_t is not good enough to prevent a double wrap around, which means the reported rssi values can be wrong (see D50928 or likely a commit in the future for more information). In order to address the problem and not break the userspace API, start by defining a type within the kernel and use that. In a next step we will then update the int8_t to int16_t to avoid the problem up to the ioctl code. This will then allow us to work on the the user space API indepedently (see PR 293016 for possible impact outside the base system). No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57021 --- sys/dev/ath/if_ath.c | 4 ++-- sys/dev/mwl/if_mwl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 1304b597c545..2d52afcf62aa 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -179,7 +179,7 @@ static struct ieee80211_node *ath_node_alloc(struct ieee80211vap *, static void ath_node_cleanup(struct ieee80211_node *); static void ath_node_free(struct ieee80211_node *); static void ath_node_getsignal(const struct ieee80211_node *, - int8_t *, int8_t *); + net80211_rssi_t *, int8_t *); static void ath_txq_init(struct ath_softc *sc, struct ath_txq *, int); static struct ath_txq *ath_txq_setup(struct ath_softc*, int qtype, int subtype); static int ath_tx_setup(struct ath_softc *, int, int); @@ -3957,7 +3957,7 @@ ath_node_free(struct ieee80211_node *ni) } static void -ath_node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) +ath_node_getsignal(const struct ieee80211_node *ni, net80211_rssi_t *rssi, int8_t *noise) { struct ieee80211com *ic = ni->ni_ic; struct ath_softc *sc = ic->ic_softc; diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c index 513c3d9c60e4..b7f85e65cfd9 100644 --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -129,7 +129,7 @@ static struct ieee80211_node *mwl_node_alloc(struct ieee80211vap *, static void mwl_node_cleanup(struct ieee80211_node *); static void mwl_node_drain(struct ieee80211_node *); static void mwl_node_getsignal(const struct ieee80211_node *, - int8_t *, int8_t *); + net80211_rssi_t *, int8_t *); static void mwl_node_getmimoinfo(const struct ieee80211_node *, struct ieee80211_mimo_info *); static int mwl_rxbuf_init(struct mwl_softc *, struct mwl_rxbuf *); @@ -2390,7 +2390,7 @@ mwl_node_drain(struct ieee80211_node *ni) } static void -mwl_node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) +mwl_node_getsignal(const struct ieee80211_node *ni, net80211_rssi_t *rssi, int8_t *noise) { *rssi = ni->ni_ic->ic_node_getrssi(ni); #ifdef MWL_ANT_INFO_SUPPORT -- cgit v1.3