Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211:  Allow drivers to report avg chain signal.
@ 2022-02-25 23:28 greearb
  2022-02-25 23:28 ` [PATCH 2/2] iwlwifi: RX signal improvements greearb
  2022-05-04 10:53 ` [PATCH 1/2] mac80211: Allow drivers to report avg chain signal Johannes Berg
  0 siblings, 2 replies; 9+ messages in thread
From: greearb @ 2022-02-25 23:28 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Drivers that use RSS cannot get the avg signal from mac80211.
So allow drivers to report the avg chain signal while letting
mac80211 take care of the last chain signal.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/mac80211/sta_info.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 43a58b30c6a4..00836f587b6d 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2543,6 +2543,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 	if (last_rxstats->chains &&
 	    !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL) |
 			       BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) {
+		/* Neither chain signal nor chain signal avg is filled */
 		sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
 		if (!sta->pcpu_rx_stats)
 			sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
@@ -2557,6 +2558,21 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 		}
 	}
 
+	/* Check if chain signal is not filled, for cases avg was filled by
+	 * driver bug last chain signal was not.
+	 */
+	if (last_rxstats->chains &&
+		 !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)))) {
+		sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
+
+		sinfo->chains = last_rxstats->chains;
+
+		for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
+			sinfo->chain_signal[i] =
+				last_rxstats->chain_signal_last[i];
+		}
+	}
+
 	if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {
 		sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate,
 				     &sinfo->txrate);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-17  1:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-25 23:28 [PATCH 1/2] mac80211: Allow drivers to report avg chain signal greearb
2022-02-25 23:28 ` [PATCH 2/2] iwlwifi: RX signal improvements greearb
2022-05-04 10:57   ` Johannes Berg
2022-05-04 14:46     ` Ben Greear
2022-05-17  1:26       ` Ben Greear
2022-05-04 10:53 ` [PATCH 1/2] mac80211: Allow drivers to report avg chain signal Johannes Berg
2022-05-04 13:49   ` Ben Greear
2022-05-04 13:53     ` Johannes Berg
2022-05-04 14:31       ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox