* [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station()
@ 2025-08-22 5:02 Sarika Sharma
2025-08-25 8:11 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Sarika Sharma @ 2025-08-22 5:02 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Sarika Sharma
Currently, the buffer size allocated for the get_station command in
nl80211_get_station is NLMSG_DEFAULT_SIZE, which, in some cases, is
insufficient to send complete output to user space and results in
"no buffer space available" error. This is especially evident in
setups with 3 links, where the amount of station info exceeds the
default allocation, leading to underflows and incomplete netlink
messages.
To fix this, increase the buffer size to 4096 bytes. This ensures
that the nl80211_get_station() command can return complete station
information for up to 3 links without allocation failure.
Fixes: 82d7f841d9bd ("wifi: cfg80211: extend to embed link level statistics in NL message")
Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
---
While this static increase is a practical short-term solution, it is
not scalable for configurations with more than 3 links. To address
this, planning to introduce a mechanism where user space can
optionally pass a specific link ID to request link-level statistics.
If no link ID is provided, only MLD-level (Multi-Link devices)
statistics will be returned. If user space requires data for
multiple links, it can invoke the get_station command multiple times,
each time specifying a different link ID. This approach keeps
individual message sizes manageable, avoids excessive memory
allocation, and provides fine-grained control over the data retrieved.
---
net/wireless/nl80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 89519aa52893..042cfff78bb3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7624,7 +7624,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
return err;
}
- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ msg = nlmsg_new(4096, GFP_KERNEL);
if (!msg) {
cfg80211_sinfo_release_content(&sinfo);
return -ENOMEM;
base-commit: d9104cec3e8fe4b458b74709853231385779001f
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station()
2025-08-22 5:02 [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station() Sarika Sharma
@ 2025-08-25 8:11 ` Johannes Berg
2025-08-28 10:53 ` Nithyanantham Paramasivam
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2025-08-25 8:11 UTC (permalink / raw)
To: Sarika Sharma; +Cc: linux-wireless
On Fri, 2025-08-22 at 10:32 +0530, Sarika Sharma wrote:
> Currently, the buffer size allocated for the get_station command in
> nl80211_get_station is NLMSG_DEFAULT_SIZE, which, in some cases, is
> insufficient to send complete output to user space and results in
> "no buffer space available" error. This is especially evident in
> setups with 3 links, where the amount of station info exceeds the
> default allocation, leading to underflows and incomplete netlink
> messages.
>
> To fix this, increase the buffer size to 4096 bytes. This ensures
> that the nl80211_get_station() command can return complete station
> information for up to 3 links without allocation failure.
>
> Fixes: 82d7f841d9bd ("wifi: cfg80211: extend to embed link level statistics in NL message")
> Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
> ---
> While this static increase is a practical short-term solution
We haven't released this code, so we don't really need a short-term
solution? We could even just disable it from 6.17 instead.
So please let's see how big a real fix would be, or maybe we revert
82d7f841d9bd in 6.17 and do some other fixes for 6.18?
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station()
2025-08-25 8:11 ` Johannes Berg
@ 2025-08-28 10:53 ` Nithyanantham Paramasivam
2025-09-03 8:48 ` Nithyanantham Paramasivam
0 siblings, 1 reply; 4+ messages in thread
From: Nithyanantham Paramasivam @ 2025-08-28 10:53 UTC (permalink / raw)
To: Johannes Berg; +Cc: Sarika Sharma, linux-wireless
On Mon, Aug 25, 2025 at 1:41 PM Johannes Berg <johannes@sipsolutions.net> wrote:
>
> On Fri, 2025-08-22 at 10:32 +0530, Sarika Sharma wrote:
> > Currently, the buffer size allocated for the get_station command in
> > nl80211_get_station is NLMSG_DEFAULT_SIZE, which, in some cases, is
> > insufficient to send complete output to user space and results in
> > "no buffer space available" error. This is especially evident in
> > setups with 3 links, where the amount of station info exceeds the
> > default allocation, leading to underflows and incomplete netlink
> > messages.
> >
> > To fix this, increase the buffer size to 4096 bytes. This ensures
> > that the nl80211_get_station() command can return complete station
> > information for up to 3 links without allocation failure.
> >
> > Fixes: 82d7f841d9bd ("wifi: cfg80211: extend to embed link level statistics in NL message")
> > Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
> > ---
> > While this static increase is a practical short-term solution
>
> We haven't released this code, so we don't really need a short-term
> solution? We could even just disable it from 6.17 instead.
>
> So please let's see how big a real fix would be, or maybe we revert
> 82d7f841d9bd in 6.17 and do some other fixes for 6.18?
>
> johannes
>
Sure Johanes. Will allow user space to optionally request link-level statistics.
If this option is provided, we calculate the maximum message size and include
link-specific stats along with the existing station information. Otherwise,
we use the standard message size to return only the default accumulated
station stats.
Best Regards,
Nithy.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station()
2025-08-28 10:53 ` Nithyanantham Paramasivam
@ 2025-09-03 8:48 ` Nithyanantham Paramasivam
0 siblings, 0 replies; 4+ messages in thread
From: Nithyanantham Paramasivam @ 2025-09-03 8:48 UTC (permalink / raw)
To: Johannes Berg; +Cc: Sarika Sharma, linux-wireless
Hi Johannes,
We’re encountering some challenges with memory size when including
per-link information. The size of per-link info or accumulated station
statistics is exceeding 3 KB, and with a station having 3
links(example), the total memory usage becomes approximately (3(link
info) + 1(accumulated station stats)) × 3 KB, i.e., around 12 KB .
Approaches we’ve considered:
Dynamically calculating nlmsg size for all link info
– This introduces a lot of additional code complexity.
Allocating one page (4 KB) per link
– If multiple links are configured, this could result in significant
memory usage.
– It’s also unclear how user space would handle such allocations efficiently.
Given these constraints, I’m planning to explore message
fragmentation, though it may not be trivial and could take time to
implement.
For now, I will modify the code to return only the accumulated station
statistics, excluding per-link stats, when executing the iw station
get <mac_addr> command.
Best Regards,
Nithy.
On Thu, Aug 28, 2025 at 4:23 PM Nithyanantham Paramasivam
<nithyanantham.paramasivam@oss.qualcomm.com> wrote:
>
> On Mon, Aug 25, 2025 at 1:41 PM Johannes Berg <johannes@sipsolutions.net> wrote:
> >
> > On Fri, 2025-08-22 at 10:32 +0530, Sarika Sharma wrote:
> > > Currently, the buffer size allocated for the get_station command in
> > > nl80211_get_station is NLMSG_DEFAULT_SIZE, which, in some cases, is
> > > insufficient to send complete output to user space and results in
> > > "no buffer space available" error. This is especially evident in
> > > setups with 3 links, where the amount of station info exceeds the
> > > default allocation, leading to underflows and incomplete netlink
> > > messages.
> > >
> > > To fix this, increase the buffer size to 4096 bytes. This ensures
> > > that the nl80211_get_station() command can return complete station
> > > information for up to 3 links without allocation failure.
> > >
> > > Fixes: 82d7f841d9bd ("wifi: cfg80211: extend to embed link level statistics in NL message")
> > > Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
> > > ---
> > > While this static increase is a practical short-term solution
> >
> > We haven't released this code, so we don't really need a short-term
> > solution? We could even just disable it from 6.17 instead.
> >
> > So please let's see how big a real fix would be, or maybe we revert
> > 82d7f841d9bd in 6.17 and do some other fixes for 6.18?
> >
> > johannes
> >
>
> Sure Johanes. Will allow user space to optionally request link-level statistics.
> If this option is provided, we calculate the maximum message size and include
> link-specific stats along with the existing station information. Otherwise,
> we use the standard message size to return only the default accumulated
> station stats.
>
> Best Regards,
> Nithy.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-03 8:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 5:02 [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station() Sarika Sharma
2025-08-25 8:11 ` Johannes Berg
2025-08-28 10:53 ` Nithyanantham Paramasivam
2025-09-03 8:48 ` Nithyanantham Paramasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).