Skip to content

Commit 207be64

Browse files
Miriam-Racheljmberg-intel
authored andcommitted
wifi: iwlwifi: Don't use valid_links to iterate sta links
This bitmap equals to zero when in a non-MLO mode, and then we won't be iterating on any link. Use for_each_sta_active_link() instead, as it handles also the case of non-MLO mode. Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20230514120631.f32a8c08730a.Ib02248cd0b7f2bc885f91005c3c110dd027f9dcd@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 682b6dc commit 207be64

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

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

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22
/*
3-
* Copyright (C) 2012-2014, 2018-2022 Intel Corporation
3+
* Copyright (C) 2012-2014, 2018-2023 Intel Corporation
44
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55
* Copyright (C) 2016-2017 Intel Deutschland GmbH
66
*/
@@ -3607,7 +3607,8 @@ static bool iwl_mvm_vif_conf_from_sta(struct iwl_mvm *mvm,
36073607
struct ieee80211_vif *vif,
36083608
struct ieee80211_sta *sta)
36093609
{
3610-
unsigned int i;
3610+
struct ieee80211_link_sta *link_sta;
3611+
unsigned int link_id;
36113612

36123613
/* Beacon interval check - firmware will crash if the beacon
36133614
* interval is less than 16. We can't avoid connecting at all,
@@ -3616,14 +3617,11 @@ static bool iwl_mvm_vif_conf_from_sta(struct iwl_mvm *mvm,
36163617
* wpa_s will blocklist the AP...
36173618
*/
36183619

3619-
for_each_set_bit(i, (unsigned long *)&sta->valid_links,
3620-
IEEE80211_MLD_MAX_NUM_LINKS) {
3621-
struct ieee80211_link_sta *link_sta =
3622-
link_sta_dereference_protected(sta, i);
3620+
for_each_sta_active_link(vif, sta, link_sta, link_id) {
36233621
struct ieee80211_bss_conf *link_conf =
3624-
link_conf_dereference_protected(vif, i);
3622+
link_conf_dereference_protected(vif, link_id);
36253623

3626-
if (!link_conf || !link_sta)
3624+
if (!link_conf)
36273625
continue;
36283626

36293627
if (link_conf->beacon_int < IWL_MVM_MIN_BEACON_INTERVAL_TU) {
@@ -3645,24 +3643,23 @@ static void iwl_mvm_vif_set_he_support(struct ieee80211_hw *hw,
36453643
bool is_sta)
36463644
{
36473645
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3648-
unsigned int i;
3646+
struct ieee80211_link_sta *link_sta;
3647+
unsigned int link_id;
36493648

3650-
for_each_set_bit(i, (unsigned long *)&sta->valid_links,
3651-
IEEE80211_MLD_MAX_NUM_LINKS) {
3652-
struct ieee80211_link_sta *link_sta =
3653-
link_sta_dereference_protected(sta, i);
3649+
for_each_sta_active_link(vif, sta, link_sta, link_id) {
36543650
struct ieee80211_bss_conf *link_conf =
3655-
link_conf_dereference_protected(vif, i);
3651+
link_conf_dereference_protected(vif, link_id);
36563652

3657-
if (!link_conf || !link_sta || !mvmvif->link[i])
3653+
if (!link_conf || !mvmvif->link[link_id])
36583654
continue;
36593655

36603656
link_conf->he_support = link_sta->he_cap.has_he;
36613657

36623658
if (is_sta) {
3663-
mvmvif->link[i]->he_ru_2mhz_block = false;
3659+
mvmvif->link[link_id]->he_ru_2mhz_block = false;
36643660
if (link_sta->he_cap.has_he)
3665-
iwl_mvm_check_he_obss_narrow_bw_ru(hw, vif, i,
3661+
iwl_mvm_check_he_obss_narrow_bw_ru(hw, vif,
3662+
link_id,
36663663
link_conf);
36673664
}
36683665
}
@@ -3675,6 +3672,7 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
36753672
struct iwl_mvm_sta_state_ops *callbacks)
36763673
{
36773674
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3675+
struct ieee80211_link_sta *link_sta;
36783676
unsigned int i;
36793677
int ret;
36803678

@@ -3699,15 +3697,9 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
36993697
NL80211_TDLS_SETUP);
37003698
}
37013699

3702-
for (i = 0; i < ARRAY_SIZE(sta->link); i++) {
3703-
struct ieee80211_link_sta *link_sta;
3704-
3705-
link_sta = link_sta_dereference_protected(sta, i);
3706-
if (!link_sta)
3707-
continue;
3708-
3700+
for_each_sta_active_link(vif, sta, link_sta, i)
37093701
link_sta->agg.max_rc_amsdu_len = 1;
3710-
}
3702+
37113703
ieee80211_sta_recalc_aggregates(sta);
37123704

37133705
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
@@ -3725,7 +3717,8 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
37253717
{
37263718
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
37273719
struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3728-
unsigned int i;
3720+
struct ieee80211_link_sta *link_sta;
3721+
unsigned int link_id;
37293722

37303723
lockdep_assert_held(&mvm->mutex);
37313724

@@ -3751,14 +3744,13 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
37513744
if (!mvm->mld_api_is_used)
37523745
goto out;
37533746

3754-
for_each_set_bit(i, (unsigned long *)&sta->valid_links,
3755-
IEEE80211_MLD_MAX_NUM_LINKS) {
3747+
for_each_sta_active_link(vif, sta, link_sta, link_id) {
37563748
struct ieee80211_bss_conf *link_conf =
3757-
link_conf_dereference_protected(vif, i);
3749+
link_conf_dereference_protected(vif, link_id);
37583750

37593751
if (WARN_ON(!link_conf))
37603752
return -EINVAL;
3761-
if (!mvmvif->link[i])
3753+
if (!mvmvif->link[link_id])
37623754
continue;
37633755

37643756
iwl_mvm_link_changed(mvm, vif, link_conf,

0 commit comments

Comments
 (0)