From: Sarika Sharma <sarika.sharma@oss.qualcomm.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
Sarika Sharma <sarika.sharma@oss.qualcomm.com>
Subject: [PATCH wireless-next 2/2] wifi: cfg80211/mac80211: set only non-MLO-applicable fields for non-MLO stations
Date: Tue, 28 Apr 2026 14:39:19 +0530 [thread overview]
Message-ID: <20260428090919.1798601-3-sarika.sharma@oss.qualcomm.com> (raw)
In-Reply-To: <20260428090919.1798601-1-sarika.sharma@oss.qualcomm.com>
Currently, in sta_set_sinfo() during the NL80211_CMD_GET_STATION call,
mac80211 sets certain non-MLO applicable fields with default values
even for MLO stations. These fields are later cleared in cfg80211
before the data is sent to userspace, resulting in unnecessary operations.
Hence, avoid setting these fields for MLO stations to simplify the
code and eliminate redundant processing.
Signed-off-by: Sarika Sharma <sarika.sharma@oss.qualcomm.com>
---
net/mac80211/sta_info.c | 49 +++++++++++++++++++++++------------------
net/wireless/nl80211.c | 6 -----
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 6c6fc7641a53..5307dc30595a 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -3150,27 +3150,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
}
}
- /* for the average - if pcpu_rx_stats isn't set - rxstats must point to
- * the sta->rx_stats struct, so the check here is fine with and without
- * pcpu statistics
- */
- if (last_rxstats->chains &&
- !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL) |
- BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) {
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
- if (!sta->deflink.pcpu_rx_stats)
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
-
- 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];
- sinfo->chain_signal_avg[i] =
- -ewma_signal_read(&sta->deflink.rx_stats_avg.chain_signal[i]);
- }
- }
-
if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) &&
!sta->sta.valid_links &&
ieee80211_rate_valid(&sta->deflink.tx_stats.last_rate)) {
@@ -3278,6 +3257,34 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
sta_set_link_sinfo(sta, link_sinfo, link, tidstats);
sinfo->links[link_id] = link_sinfo;
}
+ } else {
+ /*
+ * Set non-MLO applicable fields.
+ * For the average: if pcpu_rx_stats isn't set, rxstats must
+ * point to the sta->rx_stats struct, so the check here is fine
+ * with and without per-CPU statistics.
+ */
+ if (last_rxstats->chains &&
+ !(sinfo->filled &
+ (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL) |
+ BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) {
+ sinfo->filled |=
+ BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
+ if (!sta->deflink.pcpu_rx_stats)
+ sinfo->filled |=
+ BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
+
+ sinfo->chains = last_rxstats->chains;
+
+ for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
+ struct ewma_signal chain_signal =
+ sta->deflink.rx_stats_avg.chain_signal[i];
+ sinfo->chain_signal[i] =
+ last_rxstats->chain_signal_last[i];
+ sinfo->chain_signal_avg[i] =
+ -ewma_signal_read(&chain_signal);
+ }
+ }
}
}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 108583fb2cd2..2a62be4f574a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8182,12 +8182,6 @@ static void cfg80211_sta_set_mld_sinfo(struct station_info *sinfo)
BIT(NL80211_TID_STATS_TX_MSDU_FAILED);
}
}
-
- /* Reset sinfo->filled bits to exclude fields which don't make
- * much sense at the MLO level.
- */
- sinfo->filled &= ~BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
- sinfo->filled &= ~BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG);
}
static int nl80211_dump_station(struct sk_buff *skb,
--
2.34.1
prev parent reply other threads:[~2026-04-28 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 9:09 [PATCH wireless-next 0/2] wifi: cfg80211/mac80211: optimize station info handling Sarika Sharma
2026-04-28 9:09 ` [PATCH wireless-next 1/2] wifi: cfg80211/mac80211: change memory allocation for link_sinfo structure Sarika Sharma
2026-04-28 9:31 ` Johannes Berg
2026-04-29 6:08 ` Sarika Sharma
2026-04-29 6:16 ` Johannes Berg
2026-04-29 7:24 ` Sarika Sharma
2026-04-28 9:09 ` Sarika Sharma [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260428090919.1798601-3-sarika.sharma@oss.qualcomm.com \
--to=sarika.sharma@oss.qualcomm.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox