From: P Praneesh <praneesh.p@oss.qualcomm.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
praneesh.p@oss.qualcomm.com
Subject: [PATCH wireless-next 1/5] wifi: cfg80211: Drop unused link stats handling in nl80211_send_station()
Date: Sun, 7 Jun 2026 23:29:08 +0530 [thread overview]
Message-ID: <20260607175912.2266215-2-praneesh.p@oss.qualcomm.com> (raw)
In-Reply-To: <20260607175912.2266215-1-praneesh.p@oss.qualcomm.com>
Remove the link level statistics handling from
nl80211_send_station() and drop the unused link_stats parameter
from its signature and callers. The removed code iterated over
each MLO link and attempted to send link specific station data
through NL80211_ATTR_MLO_LINKS, but this logic was never used
because link_stats was always false.
This logic was introduced during early work on link level station
statistics with the intention of reporting information for each
link. Due to message size concerns when a station has multiple
links, the feature was disabled behind the link_stats flag and
remained unused.
The link level reporting block in nl80211_send_station() is dead
code and cannot support larger messages, so remove it. This
cleanup also prepares for proper link level statistics reporting
in nl80211_dump_station() in a later patch, where fragmentation
allows safe transmission of multi link data.
Signed-off-by: P Praneesh <praneesh.p@oss.qualcomm.com>
---
net/wireless/nl80211.c | 227 +----------------------------------------
1 file changed, 5 insertions(+), 222 deletions(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 85057bd4d565..33609a065423 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7841,197 +7841,14 @@ static bool nl80211_put_signal(struct sk_buff *msg, u8 mask, s8 *signal,
return true;
}
-static int nl80211_fill_link_station(struct sk_buff *msg,
- struct cfg80211_registered_device *rdev,
- struct link_station_info *link_sinfo)
-{
- struct nlattr *bss_param, *link_sinfoattr;
-
-#define PUT_LINK_SINFO(attr, memb, type) do { \
- BUILD_BUG_ON(sizeof(type) == sizeof(u64)); \
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) && \
- nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr, \
- link_sinfo->memb)) \
- goto nla_put_failure; \
- } while (0)
-#define PUT_LINK_SINFO_U64(attr, memb) do { \
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) && \
- nla_put_u64_64bit(msg, NL80211_STA_INFO_ ## attr, \
- link_sinfo->memb, NL80211_STA_INFO_PAD)) \
- goto nla_put_failure; \
- } while (0)
-
- link_sinfoattr = nla_nest_start_noflag(msg, NL80211_ATTR_STA_INFO);
- if (!link_sinfoattr)
- goto nla_put_failure;
-
- PUT_LINK_SINFO(INACTIVE_TIME, inactive_time, u32);
-
- if (link_sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES) |
- BIT_ULL(NL80211_STA_INFO_RX_BYTES64)) &&
- nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES,
- (u32)link_sinfo->rx_bytes))
- goto nla_put_failure;
-
- if (link_sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES) |
- BIT_ULL(NL80211_STA_INFO_TX_BYTES64)) &&
- nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
- (u32)link_sinfo->tx_bytes))
- goto nla_put_failure;
-
- PUT_LINK_SINFO_U64(RX_BYTES64, rx_bytes);
- PUT_LINK_SINFO_U64(TX_BYTES64, tx_bytes);
- PUT_LINK_SINFO_U64(RX_DURATION, rx_duration);
- PUT_LINK_SINFO_U64(TX_DURATION, tx_duration);
-
- if (wiphy_ext_feature_isset(&rdev->wiphy,
- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
- PUT_LINK_SINFO(AIRTIME_WEIGHT, airtime_weight, u16);
-
- switch (rdev->wiphy.signal_type) {
- case CFG80211_SIGNAL_TYPE_MBM:
- PUT_LINK_SINFO(SIGNAL, signal, u8);
- PUT_LINK_SINFO(SIGNAL_AVG, signal_avg, u8);
- break;
- default:
- break;
- }
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) {
- if (!nl80211_put_signal(msg, link_sinfo->chains,
- link_sinfo->chain_signal,
- NL80211_STA_INFO_CHAIN_SIGNAL))
- goto nla_put_failure;
- }
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) {
- if (!nl80211_put_signal(msg, link_sinfo->chains,
- link_sinfo->chain_signal_avg,
- NL80211_STA_INFO_CHAIN_SIGNAL_AVG))
- goto nla_put_failure;
- }
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) {
- if (!nl80211_put_sta_rate(msg, &link_sinfo->txrate,
- NL80211_STA_INFO_TX_BITRATE))
- goto nla_put_failure;
- }
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) {
- if (!nl80211_put_sta_rate(msg, &link_sinfo->rxrate,
- NL80211_STA_INFO_RX_BITRATE))
- goto nla_put_failure;
- }
-
- PUT_LINK_SINFO(RX_PACKETS, rx_packets, u32);
- PUT_LINK_SINFO(TX_PACKETS, tx_packets, u32);
- PUT_LINK_SINFO(TX_RETRIES, tx_retries, u32);
- PUT_LINK_SINFO(TX_FAILED, tx_failed, u32);
- PUT_LINK_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32);
- PUT_LINK_SINFO(BEACON_LOSS, beacon_loss_count, u32);
-
- if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) {
- bss_param = nla_nest_start_noflag(msg,
- NL80211_STA_INFO_BSS_PARAM);
- if (!bss_param)
- goto nla_put_failure;
-
- if (((link_sinfo->bss_param.flags &
- BSS_PARAM_FLAGS_CTS_PROT) &&
- nla_put_flag(msg, NL80211_STA_BSS_PARAM_CTS_PROT)) ||
- ((link_sinfo->bss_param.flags &
- BSS_PARAM_FLAGS_SHORT_PREAMBLE) &&
- nla_put_flag(msg,
- NL80211_STA_BSS_PARAM_SHORT_PREAMBLE)) ||
- ((link_sinfo->bss_param.flags &
- BSS_PARAM_FLAGS_SHORT_SLOT_TIME) &&
- nla_put_flag(msg,
- NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME)) ||
- nla_put_u8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD,
- link_sinfo->bss_param.dtim_period) ||
- nla_put_u16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL,
- link_sinfo->bss_param.beacon_interval))
- goto nla_put_failure;
-
- nla_nest_end(msg, bss_param);
- }
-
- PUT_LINK_SINFO_U64(RX_DROP_MISC, rx_dropped_misc);
- PUT_LINK_SINFO_U64(BEACON_RX, rx_beacon);
- PUT_LINK_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8);
- PUT_LINK_SINFO(RX_MPDUS, rx_mpdu_count, u32);
- PUT_LINK_SINFO(FCS_ERROR_COUNT, fcs_err_count, u32);
- if (wiphy_ext_feature_isset(&rdev->wiphy,
- NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT)) {
- PUT_LINK_SINFO(ACK_SIGNAL, ack_signal, u8);
- PUT_LINK_SINFO(ACK_SIGNAL_AVG, avg_ack_signal, s8);
- }
-
-#undef PUT_LINK_SINFO
-#undef PUT_LINK_SINFO_U64
-
- if (link_sinfo->pertid) {
- struct nlattr *tidsattr;
- int tid;
-
- tidsattr = nla_nest_start_noflag(msg,
- NL80211_STA_INFO_TID_STATS);
- if (!tidsattr)
- goto nla_put_failure;
-
- for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) {
- struct cfg80211_tid_stats *tidstats;
- struct nlattr *tidattr;
-
- tidstats = &link_sinfo->pertid[tid];
-
- if (!tidstats->filled)
- continue;
-
- tidattr = nla_nest_start_noflag(msg, tid + 1);
- if (!tidattr)
- goto nla_put_failure;
-
-#define PUT_TIDVAL_U64(attr, memb) do { \
- if (tidstats->filled & BIT(NL80211_TID_STATS_ ## attr) && \
- nla_put_u64_64bit(msg, NL80211_TID_STATS_ ## attr, \
- tidstats->memb, NL80211_TID_STATS_PAD)) \
- goto nla_put_failure; \
- } while (0)
-
- PUT_TIDVAL_U64(RX_MSDU, rx_msdu);
- PUT_TIDVAL_U64(TX_MSDU, tx_msdu);
- PUT_TIDVAL_U64(TX_MSDU_RETRIES, tx_msdu_retries);
- PUT_TIDVAL_U64(TX_MSDU_FAILED, tx_msdu_failed);
-
-#undef PUT_TIDVAL_U64
- if ((tidstats->filled &
- BIT(NL80211_TID_STATS_TXQ_STATS)) &&
- !nl80211_put_txq_stats(msg, &tidstats->txq_stats,
- NL80211_TID_STATS_TXQ_STATS))
- goto nla_put_failure;
-
- nla_nest_end(msg, tidattr);
- }
-
- nla_nest_end(msg, tidsattr);
- }
-
- nla_nest_end(msg, link_sinfoattr);
- return 0;
-
-nla_put_failure:
- return -EMSGSIZE;
-}
-
static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
u32 seq, int flags,
struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev,
- const u8 *mac_addr, struct station_info *sinfo,
- bool link_stats)
+ const u8 *mac_addr, struct station_info *sinfo)
{
void *hdr;
struct nlattr *sinfoattr, *bss_param;
- struct link_station_info *link_sinfo;
- struct nlattr *links, *link;
- int link_id;
hdr = nl80211hdr_put(msg, portid, seq, flags, cmd);
if (!hdr) {
@@ -8249,40 +8066,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
goto nla_put_failure;
}
- if (link_stats && sinfo->valid_links) {
- links = nla_nest_start(msg, NL80211_ATTR_MLO_LINKS);
- if (!links)
- goto nla_put_failure;
-
- for_each_valid_link(sinfo, link_id) {
- link_sinfo = sinfo->links[link_id];
-
- if (WARN_ON_ONCE(!link_sinfo))
- continue;
-
- if (!is_valid_ether_addr(link_sinfo->addr))
- continue;
-
- link = nla_nest_start(msg, link_id + 1);
- if (!link)
- goto nla_put_failure;
-
- if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
- link_id))
- goto nla_put_failure;
-
- if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
- link_sinfo->addr))
- goto nla_put_failure;
-
- if (nl80211_fill_link_station(msg, rdev, link_sinfo))
- goto nla_put_failure;
-
- nla_nest_end(msg, link);
- }
- nla_nest_end(msg, links);
- }
-
cfg80211_sinfo_release_content(sinfo);
genlmsg_end(msg, hdr);
return 0;
@@ -8540,7 +8323,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
rdev, wdev, mac_addr,
- &sinfo, false) < 0)
+ &sinfo) < 0)
goto out;
sta_idx++;
@@ -8604,7 +8387,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION,
info->snd_portid, info->snd_seq, 0,
- rdev, wdev, mac_addr, &sinfo, false) < 0) {
+ rdev, wdev, mac_addr, &sinfo) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
}
@@ -21626,7 +21409,7 @@ void cfg80211_new_sta(struct wireless_dev *wdev, const u8 *mac_addr,
return;
if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, 0, 0, 0,
- rdev, wdev, mac_addr, sinfo, false) < 0) {
+ rdev, wdev, mac_addr, sinfo) < 0) {
nlmsg_free(msg);
return;
}
@@ -21656,7 +21439,7 @@ void cfg80211_del_sta_sinfo(struct wireless_dev *wdev, const u8 *mac_addr,
}
if (nl80211_send_station(msg, NL80211_CMD_DEL_STATION, 0, 0, 0,
- rdev, wdev, mac_addr, sinfo, false) < 0) {
+ rdev, wdev, mac_addr, sinfo) < 0) {
nlmsg_free(msg);
return;
}
--
2.43.0
next prev parent reply other threads:[~2026-06-07 17:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 17:59 [PATCH wireless-next 0/5] wifi: cfg80211: Add fragmented per-link station stats in MLO P Praneesh
2026-06-07 17:59 ` P Praneesh [this message]
2026-06-08 7:17 ` [PATCH wireless-next 1/5] wifi: cfg80211: Drop unused link stats handling in nl80211_send_station() Johannes Berg
2026-06-08 17:53 ` Praneesh P
2026-06-07 17:59 ` [PATCH wireless-next 2/5] wifi: cfg80211: Add helper to pack station-level STA_INFO P Praneesh
2026-06-07 17:59 ` [PATCH wireless-next 3/5] wifi: cfg80211: Refactor nl80211_dump_station() to prepare for per-link stats P Praneesh
2026-06-08 7:30 ` Johannes Berg
2026-06-08 18:02 ` Praneesh P
2026-06-07 17:59 ` [PATCH wireless-next 4/5] wifi: cfg80211: Fragment per-link station stats in nl80211_dump_station() P Praneesh
2026-06-08 7:42 ` Johannes Berg
2026-06-08 19:01 ` Praneesh P
2026-06-10 10:40 ` Johannes Berg
2026-06-07 17:59 ` [PATCH wireless-next 5/5] wifi: cfg80211: support MAC address filtering in station dump for link stats P Praneesh
2026-06-08 7:16 ` [PATCH wireless-next 0/5] wifi: cfg80211: Add fragmented per-link station stats in MLO Johannes Berg
2026-06-08 17:48 ` Praneesh P
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=20260607175912.2266215-2-praneesh.p@oss.qualcomm.com \
--to=praneesh.p@oss.qualcomm.com \
--cc=ath12k@lists.infradead.org \
--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