linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
@ 2025-08-22  5:32 Sarika Sharma
  2025-09-03  8:01 ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Sarika Sharma @ 2025-08-22  5:32 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Sarika Sharma

Currently, sta_set_sinfo() fails to populate link-level station info
when sinfo->valid_links is initially 0 and sta->sta.valid_links has
bits set for links other than link 0. This typically occurs when
association happens on a non-zero link or link 0 deleted dynamically.
In such cases, the for_each_valid_link(sinfo, link_id) loop only
executes for link 0 and terminates early, since sinfo->valid_links
remains 0. As a result, only MLD-level information is reported to
userspace.

Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links
before entering the loop to ensure loop executes for each valid link.
During iteration, mask out invalid links from sinfo->valid_links if
any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id]
are not present, to report only valid link information.

Fixes: 505991fba9ec ("wifi: mac80211: extend support to fill link level sinfo structure")
Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
---
 net/mac80211/sta_info.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 8c550aab9bdc..d6854dd9549a 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -3205,6 +3205,10 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 		struct ieee80211_link_data *link;
 		struct link_sta_info *link_sta;
 
+		/* currently assigning all valid links to sinfo in order
+		 * to iterate over all possible links
+		 */
+		sinfo->valid_links = sta->sta.valid_links;
 		ether_addr_copy(sinfo->mld_addr, sta->addr);
 		for_each_valid_link(sinfo, link_id) {
 			link_sta = wiphy_dereference(sta->local->hw.wiphy,
@@ -3212,10 +3216,10 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
 			link = wiphy_dereference(sdata->local->hw.wiphy,
 						 sdata->link[link_id]);
 
-			if (!link_sta || !sinfo->links[link_id] || !link)
+			if (!link_sta || !sinfo->links[link_id] || !link) {
+				sinfo->valid_links &= ~BIT(link_id);
 				continue;
-
-			sinfo->valid_links = sta->sta.valid_links;
+			}
 			sta_set_link_sinfo(sta, sinfo->links[link_id],
 					   link, tidstats);
 		}

base-commit: d9104cec3e8fe4b458b74709853231385779001f
-- 
2.34.1


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

* Re: [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
  2025-08-22  5:32 [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo() Sarika Sharma
@ 2025-09-03  8:01 ` Johannes Berg
  2025-09-03 14:22   ` Jeff Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2025-09-03  8:01 UTC (permalink / raw)
  To: Sarika Sharma; +Cc: linux-wireless

On Fri, 2025-08-22 at 11:02 +0530, Sarika Sharma wrote:
> Currently, sta_set_sinfo() fails to populate link-level station info
> when sinfo->valid_links is initially 0 and sta->sta.valid_links has
> bits set for links other than link 0. This typically occurs when
> association happens on a non-zero link or link 0 deleted dynamically.
> In such cases, the for_each_valid_link(sinfo, link_id) loop only
> executes for link 0 and terminates early, since sinfo->valid_links
> remains 0. As a result, only MLD-level information is reported to
> userspace.
> 
> Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links
> before entering the loop to ensure loop executes for each valid link.
> During iteration, mask out invalid links from sinfo->valid_links if
> any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id]
> are not present, to report only valid link information.
> 
> Fixes: 505991fba9ec ("wifi: mac80211: extend support to fill link level sinfo structure")

With a Fixes: tag for a commit in 6.17-rc, why should this not also go
to wireless for 6.17?

johannes

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

* Re: [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
  2025-09-03  8:01 ` Johannes Berg
@ 2025-09-03 14:22   ` Jeff Johnson
  2025-09-03 14:57     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Johnson @ 2025-09-03 14:22 UTC (permalink / raw)
  To: Johannes Berg, Sarika Sharma; +Cc: linux-wireless

On 9/3/2025 1:01 AM, Johannes Berg wrote:
> On Fri, 2025-08-22 at 11:02 +0530, Sarika Sharma wrote:
>> Currently, sta_set_sinfo() fails to populate link-level station info
>> when sinfo->valid_links is initially 0 and sta->sta.valid_links has
>> bits set for links other than link 0. This typically occurs when
>> association happens on a non-zero link or link 0 deleted dynamically.
>> In such cases, the for_each_valid_link(sinfo, link_id) loop only
>> executes for link 0 and terminates early, since sinfo->valid_links
>> remains 0. As a result, only MLD-level information is reported to
>> userspace.
>>
>> Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links
>> before entering the loop to ensure loop executes for each valid link.
>> During iteration, mask out invalid links from sinfo->valid_links if
>> any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id]
>> are not present, to report only valid link information.
>>
>> Fixes: 505991fba9ec ("wifi: mac80211: extend support to fill link level sinfo structure")
> 
> With a Fixes: tag for a commit in 6.17-rc, why should this not also go
> to wireless for 6.17?

Concur this should go through wireless instead of wireless-next. That was a
miss on my part during internal review.

/jeff

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

* Re: [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
  2025-09-03 14:22   ` Jeff Johnson
@ 2025-09-03 14:57     ` Johannes Berg
  2025-09-04 10:24       ` Sarika Sharma
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2025-09-03 14:57 UTC (permalink / raw)
  To: Jeff Johnson, Sarika Sharma; +Cc: linux-wireless

On Wed, 2025-09-03 at 07:22 -0700, Jeff Johnson wrote:
> On 9/3/2025 1:01 AM, Johannes Berg wrote:
> > On Fri, 2025-08-22 at 11:02 +0530, Sarika Sharma wrote:
> > > Currently, sta_set_sinfo() fails to populate link-level station info
> > > when sinfo->valid_links is initially 0 and sta->sta.valid_links has
> > > bits set for links other than link 0. This typically occurs when
> > > association happens on a non-zero link or link 0 deleted dynamically.
> > > In such cases, the for_each_valid_link(sinfo, link_id) loop only
> > > executes for link 0 and terminates early, since sinfo->valid_links
> > > remains 0. As a result, only MLD-level information is reported to
> > > userspace.
> > > 
> > > Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links
> > > before entering the loop to ensure loop executes for each valid link.
> > > During iteration, mask out invalid links from sinfo->valid_links if
> > > any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id]
> > > are not present, to report only valid link information.
> > > 
> > > Fixes: 505991fba9ec ("wifi: mac80211: extend support to fill link level sinfo structure")
> > 
> > With a Fixes: tag for a commit in 6.17-rc, why should this not also go
> > to wireless for 6.17?
> 
> Concur this should go through wireless instead of wireless-next. That was a
> miss on my part during internal review.

Sounds good. Hopefully I'll remember when I apply patches after wireless
gets pulled, maybe resend if you want to make sure :)

johannes

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

* Re: [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
  2025-09-03 14:57     ` Johannes Berg
@ 2025-09-04 10:24       ` Sarika Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Sarika Sharma @ 2025-09-04 10:24 UTC (permalink / raw)
  To: Johannes Berg, Jeff Johnson; +Cc: linux-wireless

On 9/3/2025 8:27 PM, Johannes Berg wrote:
> On Wed, 2025-09-03 at 07:22 -0700, Jeff Johnson wrote:
>> On 9/3/2025 1:01 AM, Johannes Berg wrote:
>>> On Fri, 2025-08-22 at 11:02 +0530, Sarika Sharma wrote:
>>>> Currently, sta_set_sinfo() fails to populate link-level station info
>>>> when sinfo->valid_links is initially 0 and sta->sta.valid_links has
>>>> bits set for links other than link 0. This typically occurs when
>>>> association happens on a non-zero link or link 0 deleted dynamically.
>>>> In such cases, the for_each_valid_link(sinfo, link_id) loop only
>>>> executes for link 0 and terminates early, since sinfo->valid_links
>>>> remains 0. As a result, only MLD-level information is reported to
>>>> userspace.
>>>>
>>>> Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links
>>>> before entering the loop to ensure loop executes for each valid link.
>>>> During iteration, mask out invalid links from sinfo->valid_links if
>>>> any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id]
>>>> are not present, to report only valid link information.
>>>>
>>>> Fixes: 505991fba9ec ("wifi: mac80211: extend support to fill link level sinfo structure")
>>>
>>> With a Fixes: tag for a commit in 6.17-rc, why should this not also go
>>> to wireless for 6.17?
>>
>> Concur this should go through wireless instead of wireless-next. That was a
>> miss on my part during internal review.
> 
> Sounds good. Hopefully I'll remember when I apply patches after wireless
> gets pulled, maybe resend if you want to make sure :)

Sure, let me resend for wireless.

> 
> johannes


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

end of thread, other threads:[~2025-09-04 10:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22  5:32 [PATCH wireless-next] wifi: mac80211: fix reporting of all valid links in sta_set_sinfo() Sarika Sharma
2025-09-03  8:01 ` Johannes Berg
2025-09-03 14:22   ` Jeff Johnson
2025-09-03 14:57     ` Johannes Berg
2025-09-04 10:24       ` Sarika Sharma

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).