OSDN Git Service

wifi: iwlwifi: mvm: adjust smart fifo configuration to MLO
authorGregory Greenman <gregory.greenman@intel.com>
Tue, 28 Mar 2023 07:58:56 +0000 (10:58 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 30 Mar 2023 10:07:54 +0000 (12:07 +0200)
Consider properties of all available links for smart FIFO
configuration.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.870ff175b82c.Iada56a474a0770ae5469b31d635cc05405dbfb87@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sf.c

index 84b750d..7c5f41e 100644 (file)
@@ -98,6 +98,10 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm,
                                    struct ieee80211_sta *sta)
 {
        int i, j, watermark;
+       u8 max_rx_nss = 0;
+       bool is_legacy = true;
+       struct ieee80211_link_sta *link_sta;
+       unsigned int link_id;
 
        sf_cmd->watermark[SF_LONG_DELAY_ON] = cpu_to_le32(SF_W_MARK_SCAN);
 
@@ -106,10 +110,25 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm,
         * capabilities of the AP station, and choose the watermark accordingly.
         */
        if (sta) {
-               if (sta->deflink.ht_cap.ht_supported ||
-                   sta->deflink.vht_cap.vht_supported ||
-                   sta->deflink.he_cap.has_he) {
-                       switch (sta->deflink.rx_nss) {
+               /* find the maximal NSS number among all links (if relevant) */
+               rcu_read_lock();
+               for (link_id = 0; link_id < ARRAY_SIZE(sta->link); link_id++) {
+                       link_sta = rcu_dereference(sta->link[link_id]);
+                       if (!link_sta)
+                               continue;
+
+                       if (link_sta->ht_cap.ht_supported ||
+                           link_sta->vht_cap.vht_supported ||
+                           link_sta->eht_cap.has_eht ||
+                           link_sta->he_cap.has_he) {
+                               is_legacy = false;
+                               max_rx_nss = max(max_rx_nss, link_sta->rx_nss);
+                       }
+               }
+               rcu_read_unlock();
+
+               if (!is_legacy) {
+                       switch (max_rx_nss) {
                        case 1:
                                watermark = SF_W_MARK_SISO;
                                break;
@@ -151,7 +170,6 @@ static void iwl_mvm_fill_sf_command(struct iwl_mvm *mvm,
                memcpy(sf_cmd->full_on_timeouts, sf_full_timeout_def,
                       sizeof(sf_full_timeout_def));
        }
-
 }
 
 static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id,
@@ -275,5 +293,9 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif,
                /* If there are multiple active macs - change to SF_UNINIT */
                new_state = SF_UNINIT;
        }
+
+       /* For MLO it's ok to use deflink->sta_id as it's needed only to get
+        * a pointer to mac80211 sta
+        */
        return iwl_mvm_sf_config(mvm, sta_id, new_state);
 }