wifi: iwlwifi: mvm: don't track used links separately
authorJohannes Berg <johannes.berg@intel.com>
Sun, 12 May 2024 04:31:07 +0000 (07:31 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 08:53:03 +0000 (10:53 +0200)
We track which link is using which FW link ID, so there
really isn't a need to separately track which link IDs
are in use. Remove that code and check the table when
looking for a new link ID to use.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240512072733.1a67d8af815f.Ie642c12dce3ab55c688abd9a25918569e83e558a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/link.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index e7f5978ef2d71950e2d8bf9a006c054fe910a3b9..8198451d70a2cfa522af2ec901fa16a6bca9908d 100644 (file)
@@ -1499,8 +1499,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        for (i = 0; i < IWL_MVM_FW_MAX_LINK_ID + 1; i++)
                RCU_INIT_POINTER(mvm->link_id_to_link_conf[i], NULL);
 
-       memset(&mvm->fw_link_ids_map, 0, sizeof(mvm->fw_link_ids_map));
-
        mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
 
        /* reset quota debouncing buffer - 0xff will yield invalid data */
index 6ec9a8e21a34ee024f2475b19cc91f2f191ffa05..14dab617c0bdfc0959f3ee7e0a1016145326ea1c 100644 (file)
@@ -50,26 +50,15 @@ static void iwl_mvm_print_esr_state(struct iwl_mvm *mvm, u32 mask)
 static u32 iwl_mvm_get_free_fw_link_id(struct iwl_mvm *mvm,
                                       struct iwl_mvm_vif *mvm_vif)
 {
-       u32 link_id;
+       u32 i;
 
        lockdep_assert_held(&mvm->mutex);
 
-       link_id = ffz(mvm->fw_link_ids_map);
+       for (i = 0; i < ARRAY_SIZE(mvm->link_id_to_link_conf); i++)
+               if (!rcu_access_pointer(mvm->link_id_to_link_conf[i]))
+                       return i;
 
-       /* this case can happen if there're deactivated but not removed links */
-       if (link_id > IWL_MVM_FW_MAX_LINK_ID)
-               return IWL_MVM_FW_LINK_ID_INVALID;
-
-       mvm->fw_link_ids_map |= BIT(link_id);
-       return link_id;
-}
-
-static void iwl_mvm_release_fw_link_id(struct iwl_mvm *mvm, u32 link_id)
-{
-       lockdep_assert_held(&mvm->mutex);
-
-       if (!WARN_ON(link_id > IWL_MVM_FW_MAX_LINK_ID))
-               mvm->fw_link_ids_map &= ~BIT(link_id);
+       return IWL_MVM_FW_LINK_ID_INVALID;
 }
 
 static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm,
@@ -380,7 +369,6 @@ int iwl_mvm_unset_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
        RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id],
                         NULL);
-       iwl_mvm_release_fw_link_id(mvm, link_info->fw_link_id);
        return 0;
 }
 
index ca1c5944da670329db04b5b52fe763a15b89bbb3..d732780aae5f147bdb3cef80eb5f88d22e586c8f 100644 (file)
@@ -1043,7 +1043,6 @@ struct iwl_mvm {
        struct iwl_rx_phy_info last_phy_info;
        struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT_MAX];
        struct ieee80211_link_sta __rcu *fw_id_to_link_sta[IWL_MVM_STATION_COUNT_MAX];
-       unsigned long fw_link_ids_map;
        u8 rx_ba_sessions;
 
        /* configured by mac80211 */