]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mld: fix SMPS W/A
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 9 Mar 2025 05:36:40 +0000 (07:36 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Mar 2025 15:29:24 +0000 (16:29 +0100)
If the user disables power save of a vif that didn't have it enabled
(for example before association), mac80211 will not notify the driver
with BSS_CHANGED_PS. This will cause the driver to not update the
device-level power save to disabled.
Fix this by checking the vif's power save status upon authorization, and
stop considering the vif's power save status on disassociation.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250309073442.1cdeb78b19ba.I58fe02c062524029071b04b093a1b09c5e46f4ef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mld/iface.h
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
drivers/net/wireless/intel/iwlwifi/mld/power.c

index 2c928113f6802b20e32c90da933cc08eb8e08c28..57910660ed186a4f471b3f9942466338a39fade8 100644 (file)
@@ -134,6 +134,7 @@ struct iwl_mld_emlsr {
  * @beacon_inject_active: indicates an active debugfs beacon ie injection
  * @low_latency_causes: bit flags, indicating the causes for low-latency,
  *     see @iwl_mld_low_latency_cause.
+ * @ps_disabled: indicates that PS is disabled for this interface
  * @mld: pointer to the mld structure.
  * @deflink: default link data, for use in non-MLO,
  * @link: reference to link data for each valid link, for use in MLO.
@@ -159,6 +160,7 @@ struct iwl_mld_vif {
                bool beacon_inject_active;
 #endif
                u8 low_latency_causes;
+               bool ps_disabled;
        );
        /* And here fields that survive a fw restart */
        struct iwl_mld *mld;
index d73bd0179f7dc9b46ae953bb74b7c1d156ddcf97..ba149581e25d4f7312baeba9e4880b023ec5b4be 100644 (file)
@@ -1262,6 +1262,23 @@ iwl_mld_mac80211_link_info_changed(struct ieee80211_hw *hw,
                iwl_mld_set_tx_power(mld, link_conf, link_conf->txpower);
 }
 
+static void
+iwl_mld_smps_wa(struct iwl_mld *mld, struct ieee80211_vif *vif, bool enable)
+{
+       struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
+
+       /* Send the device-level power commands since the
+        * firmware checks the POWER_TABLE_CMD's POWER_SAVE_EN bit to
+        * determine SMPS mode.
+        */
+       if (mld_vif->ps_disabled == !enable)
+               return;
+
+       mld_vif->ps_disabled = !enable;
+
+       iwl_mld_update_device_power(mld, false);
+}
+
 static
 void iwl_mld_mac80211_vif_cfg_changed(struct ieee80211_hw *hw,
                                      struct ieee80211_vif *vif,
@@ -1295,11 +1312,7 @@ void iwl_mld_mac80211_vif_cfg_changed(struct ieee80211_hw *hw,
        }
 
        if (changes & BSS_CHANGED_PS) {
-               /* Send both device-level and MAC-level power commands since the
-                * firmware checks the POWER_TABLE_CMD's POWER_SAVE_EN bit to
-                * determine SMPS mode.
-                */
-               iwl_mld_update_device_power(mld, false);
+               iwl_mld_smps_wa(mld, vif, vif->cfg.ps);
                iwl_mld_update_mac_power(mld, vif, false);
        }
 
@@ -1716,6 +1729,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);
                }
 
                /* MFP is set by default before the station is authorized.
@@ -1758,6 +1772,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);
                }
 
                /* once we move into assoc state, need to update the FW to
index ed7c0319f239b5ebd1d816ca138e2b021848e2a2..2f16c174b57e5306f213a1323cfa4945a669c7e3 100644 (file)
@@ -15,11 +15,12 @@ static void iwl_mld_vif_ps_iterator(void *data, u8 *mac,
                                    struct ieee80211_vif *vif)
 {
        bool *ps_enable = (bool *)data;
+       struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
 
        if (vif->type != NL80211_IFTYPE_STATION)
                return;
 
-       *ps_enable &= vif->cfg.ps;
+       *ps_enable &= !mld_vif->ps_disabled;
 }
 
 int iwl_mld_update_device_power(struct iwl_mld *mld, bool d3)