1
1
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2
2
/*
3
- * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
3
+ * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4
4
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5
5
* Copyright (C) 2016-2017 Intel Deutschland GmbH
6
6
*/
@@ -3607,7 +3607,8 @@ static bool iwl_mvm_vif_conf_from_sta(struct iwl_mvm *mvm,
3607
3607
struct ieee80211_vif * vif ,
3608
3608
struct ieee80211_sta * sta )
3609
3609
{
3610
- unsigned int i ;
3610
+ struct ieee80211_link_sta * link_sta ;
3611
+ unsigned int link_id ;
3611
3612
3612
3613
/* Beacon interval check - firmware will crash if the beacon
3613
3614
* 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,
3616
3617
* wpa_s will blocklist the AP...
3617
3618
*/
3618
3619
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 ) {
3623
3621
struct ieee80211_bss_conf * link_conf =
3624
- link_conf_dereference_protected (vif , i );
3622
+ link_conf_dereference_protected (vif , link_id );
3625
3623
3626
- if (!link_conf || ! link_sta )
3624
+ if (!link_conf )
3627
3625
continue ;
3628
3626
3629
3627
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,
3645
3643
bool is_sta )
3646
3644
{
3647
3645
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 ;
3649
3648
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 ) {
3654
3650
struct ieee80211_bss_conf * link_conf =
3655
- link_conf_dereference_protected (vif , i );
3651
+ link_conf_dereference_protected (vif , link_id );
3656
3652
3657
- if (!link_conf || !link_sta || ! mvmvif -> link [i ])
3653
+ if (!link_conf || !mvmvif -> link [link_id ])
3658
3654
continue ;
3659
3655
3660
3656
link_conf -> he_support = link_sta -> he_cap .has_he ;
3661
3657
3662
3658
if (is_sta ) {
3663
- mvmvif -> link [i ]-> he_ru_2mhz_block = false;
3659
+ mvmvif -> link [link_id ]-> he_ru_2mhz_block = false;
3664
3660
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 ,
3666
3663
link_conf );
3667
3664
}
3668
3665
}
@@ -3675,6 +3672,7 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
3675
3672
struct iwl_mvm_sta_state_ops * callbacks )
3676
3673
{
3677
3674
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
3675
+ struct ieee80211_link_sta * link_sta ;
3678
3676
unsigned int i ;
3679
3677
int ret ;
3680
3678
@@ -3699,15 +3697,9 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,
3699
3697
NL80211_TDLS_SETUP );
3700
3698
}
3701
3699
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 )
3709
3701
link_sta -> agg .max_rc_amsdu_len = 1 ;
3710
- }
3702
+
3711
3703
ieee80211_sta_recalc_aggregates (sta );
3712
3704
3713
3705
if (vif -> type == NL80211_IFTYPE_STATION && !sta -> tdls )
@@ -3725,7 +3717,8 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
3725
3717
{
3726
3718
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
3727
3719
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 ;
3729
3722
3730
3723
lockdep_assert_held (& mvm -> mutex );
3731
3724
@@ -3751,14 +3744,13 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
3751
3744
if (!mvm -> mld_api_is_used )
3752
3745
goto out ;
3753
3746
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 ) {
3756
3748
struct ieee80211_bss_conf * link_conf =
3757
- link_conf_dereference_protected (vif , i );
3749
+ link_conf_dereference_protected (vif , link_id );
3758
3750
3759
3751
if (WARN_ON (!link_conf ))
3760
3752
return - EINVAL ;
3761
- if (!mvmvif -> link [i ])
3753
+ if (!mvmvif -> link [link_id ])
3762
3754
continue ;
3763
3755
3764
3756
iwl_mvm_link_changed (mvm , vif , link_conf ,
0 commit comments