Skip to content

Commit 9737da2

Browse files
benzeajmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: fix active link counting during recovery
During recovery, the chanctx_conf in mac80211 is still non-NULL even though the channel context has not yet been assigned again. In that case, the real count is actually lower. Switch to instead count the phy_ctx assignment and ensure that the assignment is cleared at the start of recovery. Fixes: 12bacfc ("wifi: iwlwifi: handle eSR transitions") Signed-off-by: Benjamin Berg <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20240320232419.55f37339e7d1.I57006568a90ffb7a1232def1b2f3264dea711ba6@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 8598826 commit 9737da2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,13 @@ static void iwl_mvm_mld_mac_remove_interface(struct ieee80211_hw *hw,
189189
mutex_unlock(&mvm->mutex);
190190
}
191191

192-
static unsigned int iwl_mvm_mld_count_active_links(struct ieee80211_vif *vif)
192+
static unsigned int iwl_mvm_mld_count_active_links(struct iwl_mvm_vif *mvmvif)
193193
{
194194
unsigned int n_active = 0;
195195
int i;
196196

197197
for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
198-
struct ieee80211_bss_conf *link_conf;
199-
200-
link_conf = link_conf_dereference_protected(vif, i);
201-
if (link_conf &&
202-
rcu_access_pointer(link_conf->chanctx_conf))
198+
if (mvmvif->link[i] && mvmvif->link[i]->phy_ctxt)
203199
n_active++;
204200
}
205201

@@ -245,18 +241,18 @@ __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
245241
{
246242
u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
247243
struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
248-
unsigned int n_active = iwl_mvm_mld_count_active_links(vif);
249244
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
245+
unsigned int n_active = iwl_mvm_mld_count_active_links(mvmvif);
250246
unsigned int link_id = link_conf->link_id;
251247
int ret;
252248

253-
/* if the assigned one was not counted yet, count it now */
254-
if (!rcu_access_pointer(link_conf->chanctx_conf))
255-
n_active++;
256-
257249
if (WARN_ON_ONCE(!mvmvif->link[link_id]))
258250
return -EINVAL;
259251

252+
/* if the assigned one was not counted yet, count it now */
253+
if (!mvmvif->link[link_id]->phy_ctxt)
254+
n_active++;
255+
260256
/* mac parameters such as HE support can change at this stage
261257
* For sta, need first to configure correct state from drv_sta_state
262258
* and only after that update mac config.
@@ -416,7 +412,7 @@ __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm,
416412

417413
{
418414
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
419-
unsigned int n_active = iwl_mvm_mld_count_active_links(vif);
415+
unsigned int n_active = iwl_mvm_mld_count_active_links(mvmvif);
420416
unsigned int link_id = link_conf->link_id;
421417

422418
/* shouldn't happen, but verify link_id is valid before accessing */

0 commit comments

Comments
 (0)