Skip to content

Commit

Permalink
wifi: mac80211: fix idle calculation with multi-link
Browse files Browse the repository at this point in the history
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 <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Apr 19, 2024
1 parent 6a94cf9 commit 8988445
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions net/mac80211/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
struct ieee80211_local *local = sdata->local;
struct ieee80211_chanctx_conf *conf;
struct ieee80211_chanctx *curr_ctx = NULL;
bool new_idle;
int ret = 0;

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

sdata->vif.cfg.idle = !conf;

if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) {
ieee80211_recalc_chanctx_chantype(local, curr_ctx);
ieee80211_recalc_smps_chanctx(local, curr_ctx);
Expand All @@ -843,9 +842,27 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL);
}

if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
sdata->vif.type != NL80211_IFTYPE_MONITOR)
ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE);
if (conf) {
new_idle = false;
} else {
struct ieee80211_link_data *tmp;

new_idle = true;
for_each_sdata_link(local, tmp) {
if (rcu_access_pointer(tmp->conf->chanctx_conf)) {
new_idle = false;
break;
}
}
}

if (new_idle != sdata->vif.cfg.idle) {
sdata->vif.cfg.idle = new_idle;

if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
sdata->vif.type != NL80211_IFTYPE_MONITOR)
ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE);
}

ieee80211_check_fast_xmit_iface(sdata);

Expand Down

0 comments on commit 8988445

Please sign in to comment.