]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mld: support iwl_mac_power_cmd version 2
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 30 Apr 2025 12:57:17 +0000 (15:57 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 6 May 2025 17:23:31 +0000 (20:23 +0300)
This version fixes the issue that was worked around by
iwl_mld_smps_wa. So for FWs with the new version don't do the
workaround, and set new bit added in this version when appropriate.
While at it, rename iwl_mld_smps_wa to iwl_mld_smps_workaround.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20250430155443.77fdb18d1ee0.I93688612ac4f6ec99da9bc54bee16554ef40a40b@changeid
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
drivers/net/wireless/intel/iwlwifi/mld/power.c

index 6710dcacecd30c5761565d4de7aad8b65878ff2a..ef976e4d700fd8785245d90ef9c8b2a6f365400e 100644 (file)
@@ -1248,9 +1248,14 @@ iwl_mld_mac80211_link_info_changed(struct ieee80211_hw *hw,
 }
 
 static void
-iwl_mld_smps_wa(struct iwl_mld *mld, struct ieee80211_vif *vif, bool enable)
+iwl_mld_smps_workaround(struct iwl_mld *mld, struct ieee80211_vif *vif, bool enable)
 {
        struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
+       bool workaround_required =
+               iwl_fw_lookup_cmd_ver(mld->fw, MAC_PM_POWER_TABLE, 0) < 2;
+
+       if (!workaround_required)
+               return;
 
        /* Send the device-level power commands since the
         * firmware checks the POWER_TABLE_CMD's POWER_SAVE_EN bit to
@@ -1297,7 +1302,7 @@ void iwl_mld_mac80211_vif_cfg_changed(struct ieee80211_hw *hw,
        }
 
        if (changes & BSS_CHANGED_PS) {
-               iwl_mld_smps_wa(mld, vif, vif->cfg.ps);
+               iwl_mld_smps_workaround(mld, vif, vif->cfg.ps);
                iwl_mld_update_mac_power(mld, vif, false);
        }
 
@@ -1710,7 +1715,7 @@ static int iwl_mld_move_sta_state_up(struct iwl_mld *mld,
                                                    FW_CTXT_ACTION_MODIFY);
                        if (ret)
                                return ret;
-                       iwl_mld_smps_wa(mld, vif, vif->cfg.ps);
+                       iwl_mld_smps_workaround(mld, vif, vif->cfg.ps);
                }
 
                /* MFP is set by default before the station is authorized.
@@ -1753,7 +1758,7 @@ static int iwl_mld_move_sta_state_down(struct iwl_mld *mld,
                                                  &mld_vif->emlsr.check_tpt_wk);
 
                        iwl_mld_reset_cca_40mhz_workaround(mld, vif);
-                       iwl_mld_smps_wa(mld, vif, true);
+                       iwl_mld_smps_workaround(mld, vif, true);
                }
 
                /* once we move into assoc state, need to update the FW to
index 2f16c174b57e5306f213a1323cfa4945a669c7e3..8cc276041360ee27c80624f5bf4b378d467488b1 100644 (file)
@@ -253,6 +253,9 @@ static void iwl_mld_power_build_cmd(struct iwl_mld *mld,
 
        cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK);
 
+       if (iwl_fw_lookup_cmd_ver(mld->fw, MAC_PM_POWER_TABLE, 0) >= 2)
+               cmd->flags |= cpu_to_le16(POWER_FLAGS_ENABLE_SMPS_MSK);
+
        /* firmware supports LPRX for beacons at rate 1 Mbps or 6 Mbps only */
        if (link_conf->beacon_rate &&
            (link_conf->beacon_rate->bitrate == 10 ||