* [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
@ 2026-03-07 18:45 Lorenzo Bianconi
2026-03-08 7:34 ` Lachlan Hodges
0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2026-03-07 18:45 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Lorenzo Bianconi
Delete stale station links announced in the reconfiguration IE
transmitted by the AP in the beacon frames.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
net/mac80211/mlme.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5ecd3d1b172df70c6e447351c89f956b6d873c20..00ffc6b355b8d9b4cc078a887199c637c8224992 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7058,6 +7058,7 @@ static void ieee80211_ml_reconf_work(struct wiphy *wiphy,
container_of(work, struct ieee80211_sub_if_data,
u.mgd.ml_reconf_work.work);
u16 new_valid_links, new_active_links, new_dormant_links;
+ struct sta_info *sta;
int ret;
if (!sdata->u.mgd.removed_links)
@@ -7093,6 +7094,18 @@ static void ieee80211_ml_reconf_work(struct wiphy *wiphy,
}
}
+ rcu_read_lock();
+ sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
+ if (sta) {
+ unsigned long removed_links = sdata->u.mgd.removed_links;
+ unsigned int link_id;
+
+ for_each_set_bit(link_id, &removed_links,
+ IEEE80211_MLD_MAX_NUM_LINKS)
+ ieee80211_sta_free_link(sta, link_id);
+ }
+ rcu_read_unlock();
+
new_dormant_links = sdata->vif.dormant_links & ~sdata->u.mgd.removed_links;
ret = ieee80211_vif_set_links(sdata, new_valid_links,
---
base-commit: 97492c019da4b62df83255e968b23b81c0315530
change-id: 20260307-mac80211-reconf-remove-sta-link-a47fa95ea7a7
Best regards,
--
Lorenzo Bianconi <lorenzo@kernel.org>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
2026-03-07 18:45 [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work() Lorenzo Bianconi
@ 2026-03-08 7:34 ` Lachlan Hodges
2026-03-08 13:28 ` Lorenzo Bianconi
0 siblings, 1 reply; 6+ messages in thread
From: Lachlan Hodges @ 2026-03-08 7:34 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: Johannes Berg, linux-wireless
> + rcu_read_lock();
> + sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
> + if (sta) {
> + unsigned long removed_links = sdata->u.mgd.removed_links;
> + unsigned int link_id;
> +
> + for_each_set_bit(link_id, &removed_links,
> + IEEE80211_MLD_MAX_NUM_LINKS)
> + ieee80211_sta_free_link(sta, link_id);
> + }
> + rcu_read_unlock();
> +
Could use scoped_guard(rcu) instead?
lachlan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
2026-03-08 7:34 ` Lachlan Hodges
@ 2026-03-08 13:28 ` Lorenzo Bianconi
2026-03-09 7:14 ` Johannes Berg
0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2026-03-08 13:28 UTC (permalink / raw)
To: Lachlan Hodges; +Cc: Johannes Berg, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
> > + rcu_read_lock();
> > + sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
> > + if (sta) {
> > + unsigned long removed_links = sdata->u.mgd.removed_links;
> > + unsigned int link_id;
> > +
> > + for_each_set_bit(link_id, &removed_links,
> > + IEEE80211_MLD_MAX_NUM_LINKS)
> > + ieee80211_sta_free_link(sta, link_id);
> > + }
> > + rcu_read_unlock();
> > +
>
> Could use scoped_guard(rcu) instead?
I do not have a strong opinion here.
@Johannes: Which one do you prefer?
Regards,
Lorenzo
>
> lachlan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
2026-03-08 13:28 ` Lorenzo Bianconi
@ 2026-03-09 7:14 ` Johannes Berg
2026-03-09 8:20 ` Lorenzo Bianconi
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2026-03-09 7:14 UTC (permalink / raw)
To: Lorenzo Bianconi, Lachlan Hodges; +Cc: linux-wireless
On Sun, 2026-03-08 at 14:28 +0100, Lorenzo Bianconi wrote:
> > > + rcu_read_lock();
> > > + sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
> > > + if (sta) {
> > > + unsigned long removed_links = sdata->u.mgd.removed_links;
> > > + unsigned int link_id;
> > > +
> > > + for_each_set_bit(link_id, &removed_links,
> > > + IEEE80211_MLD_MAX_NUM_LINKS)
> > > + ieee80211_sta_free_link(sta, link_id);
> > > + }
> > > + rcu_read_unlock();
> > > +
> >
> > Could use scoped_guard(rcu) instead?
>
> I do not have a strong opinion here.
> @Johannes: Which one do you prefer?
>
To answer the literal question: No strong preference I guess, given that
there's no error path here this seems fine, and the scoped version would
just add another indentation level.
But you really should just remove the rcu_read_lock/unlock anyway, it's
not needed since this holds wiphy mutex, which is sufficient to access
the STA table etc.
Also, I think you need ieee80211_sta_remove_link() to tell the driver?
And I realized another thing - this needs to destroy TDLS stations that
were on the link being removed, but maybe that's a separate commit.
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
2026-03-09 7:14 ` Johannes Berg
@ 2026-03-09 8:20 ` Lorenzo Bianconi
2026-03-09 8:22 ` Johannes Berg
0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2026-03-09 8:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: Lachlan Hodges, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]
On Mar 09, Johannes Berg wrote:
> On Sun, 2026-03-08 at 14:28 +0100, Lorenzo Bianconi wrote:
> > > > + rcu_read_lock();
> > > > + sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
> > > > + if (sta) {
> > > > + unsigned long removed_links = sdata->u.mgd.removed_links;
> > > > + unsigned int link_id;
> > > > +
> > > > + for_each_set_bit(link_id, &removed_links,
> > > > + IEEE80211_MLD_MAX_NUM_LINKS)
> > > > + ieee80211_sta_free_link(sta, link_id);
> > > > + }
> > > > + rcu_read_unlock();
> > > > +
> > >
> > > Could use scoped_guard(rcu) instead?
> >
> > I do not have a strong opinion here.
> > @Johannes: Which one do you prefer?
> >
>
> To answer the literal question: No strong preference I guess, given that
> there's no error path here this seems fine, and the scoped version would
> just add another indentation level.
>
> But you really should just remove the rcu_read_lock/unlock anyway, it's
> not needed since this holds wiphy mutex, which is sufficient to access
> the STA table etc.
ack, I will fix it in v2.
>
> Also, I think you need ieee80211_sta_remove_link() to tell the driver?
I think we already inform the driver running ieee80211_set_active_links() so
ieee80211_sta_remove_link() seems redundant, right?
ieee80211_set_active_links() -> _ieee80211_set_active_links() -> drv_change_sta_links()
>
> And I realized another thing - this needs to destroy TDLS stations that
> were on the link being removed, but maybe that's a separate commit.
Do you mean ieee80211_teardown_tdls_peers()? Is it done in
_ieee80211_set_active_links() too?
Regards,
Lorenzo
>
> johannes
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work()
2026-03-09 8:20 ` Lorenzo Bianconi
@ 2026-03-09 8:22 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2026-03-09 8:22 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: Lachlan Hodges, linux-wireless
On Mon, 2026-03-09 at 09:20 +0100, Lorenzo Bianconi wrote:
> > Also, I think you need ieee80211_sta_remove_link() to tell the driver?
>
> I think we already inform the driver running ieee80211_set_active_links() so
> ieee80211_sta_remove_link() seems redundant, right?
>
> ieee80211_set_active_links() -> _ieee80211_set_active_links() -> drv_change_sta_links()
Oh, hmm, yeah, good point!
> > And I realized another thing - this needs to destroy TDLS stations that
> > were on the link being removed, but maybe that's a separate commit.
>
> Do you mean ieee80211_teardown_tdls_peers()? Is it done in
> _ieee80211_set_active_links() too?
So ... it was all already consistent all along, at least towards the
driver? I totally missed that, sorry. Thanks for checking!
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-09 8:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-07 18:45 [PATCH wireless-next] wifi: mac80211: Remove deleted sta links in ieee80211_ml_reconf_work() Lorenzo Bianconi
2026-03-08 7:34 ` Lachlan Hodges
2026-03-08 13:28 ` Lorenzo Bianconi
2026-03-09 7:14 ` Johannes Berg
2026-03-09 8:20 ` Lorenzo Bianconi
2026-03-09 8:22 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox