Skip to content

Commit 8988445

Browse files
committed
wifi: mac80211: fix idle calculation with multi-link
The vif's idle state doesn't automatically go to true when any link removes the channel context, it's only idle when _all_ links no longer have a channel context. Fix that. Reviewed-by: Miriam Rachel Korenblit <[email protected]> Link: https://msgid.link/20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 6a94cf9 commit 8988445

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

net/mac80211/chan.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
797797
struct ieee80211_local *local = sdata->local;
798798
struct ieee80211_chanctx_conf *conf;
799799
struct ieee80211_chanctx *curr_ctx = NULL;
800+
bool new_idle;
800801
int ret = 0;
801802

802803
if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN))
@@ -829,8 +830,6 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
829830
out:
830831
rcu_assign_pointer(link->conf->chanctx_conf, conf);
831832

832-
sdata->vif.cfg.idle = !conf;
833-
834833
if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) {
835834
ieee80211_recalc_chanctx_chantype(local, curr_ctx);
836835
ieee80211_recalc_smps_chanctx(local, curr_ctx);
@@ -843,9 +842,27 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
843842
ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL);
844843
}
845844

846-
if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
847-
sdata->vif.type != NL80211_IFTYPE_MONITOR)
848-
ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE);
845+
if (conf) {
846+
new_idle = false;
847+
} else {
848+
struct ieee80211_link_data *tmp;
849+
850+
new_idle = true;
851+
for_each_sdata_link(local, tmp) {
852+
if (rcu_access_pointer(tmp->conf->chanctx_conf)) {
853+
new_idle = false;
854+
break;
855+
}
856+
}
857+
}
858+
859+
if (new_idle != sdata->vif.cfg.idle) {
860+
sdata->vif.cfg.idle = new_idle;
861+
862+
if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
863+
sdata->vif.type != NL80211_IFTYPE_MONITOR)
864+
ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE);
865+
}
849866

850867
ieee80211_check_fast_xmit_iface(sdata);
851868

0 commit comments

Comments
 (0)