Skip to content

Commit cb9716e

Browse files
Miriam-Racheljmberg-intel
authored andcommitted
wifi: iwlwifi: mld: fix SMPS W/A
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 <[email protected]> Link: https://patch.msgid.link/20250309073442.1cdeb78b19ba.I58fe02c062524029071b04b093a1b09c5e46f4ef@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 834bfc6 commit cb9716e

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

drivers/net/wireless/intel/iwlwifi/mld/iface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct iwl_mld_emlsr {
134134
* @beacon_inject_active: indicates an active debugfs beacon ie injection
135135
* @low_latency_causes: bit flags, indicating the causes for low-latency,
136136
* see @iwl_mld_low_latency_cause.
137+
* @ps_disabled: indicates that PS is disabled for this interface
137138
* @mld: pointer to the mld structure.
138139
* @deflink: default link data, for use in non-MLO,
139140
* @link: reference to link data for each valid link, for use in MLO.
@@ -159,6 +160,7 @@ struct iwl_mld_vif {
159160
bool beacon_inject_active;
160161
#endif
161162
u8 low_latency_causes;
163+
bool ps_disabled;
162164
);
163165
/* And here fields that survive a fw restart */
164166
struct iwl_mld *mld;

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,23 @@ iwl_mld_mac80211_link_info_changed(struct ieee80211_hw *hw,
12621262
iwl_mld_set_tx_power(mld, link_conf, link_conf->txpower);
12631263
}
12641264

1265+
static void
1266+
iwl_mld_smps_wa(struct iwl_mld *mld, struct ieee80211_vif *vif, bool enable)
1267+
{
1268+
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
1269+
1270+
/* Send the device-level power commands since the
1271+
* firmware checks the POWER_TABLE_CMD's POWER_SAVE_EN bit to
1272+
* determine SMPS mode.
1273+
*/
1274+
if (mld_vif->ps_disabled == !enable)
1275+
return;
1276+
1277+
mld_vif->ps_disabled = !enable;
1278+
1279+
iwl_mld_update_device_power(mld, false);
1280+
}
1281+
12651282
static
12661283
void iwl_mld_mac80211_vif_cfg_changed(struct ieee80211_hw *hw,
12671284
struct ieee80211_vif *vif,
@@ -1295,11 +1312,7 @@ void iwl_mld_mac80211_vif_cfg_changed(struct ieee80211_hw *hw,
12951312
}
12961313

12971314
if (changes & BSS_CHANGED_PS) {
1298-
/* Send both device-level and MAC-level power commands since the
1299-
* firmware checks the POWER_TABLE_CMD's POWER_SAVE_EN bit to
1300-
* determine SMPS mode.
1301-
*/
1302-
iwl_mld_update_device_power(mld, false);
1315+
iwl_mld_smps_wa(mld, vif, vif->cfg.ps);
13031316
iwl_mld_update_mac_power(mld, vif, false);
13041317
}
13051318

@@ -1716,6 +1729,7 @@ static int iwl_mld_move_sta_state_up(struct iwl_mld *mld,
17161729
FW_CTXT_ACTION_MODIFY);
17171730
if (ret)
17181731
return ret;
1732+
iwl_mld_smps_wa(mld, vif, vif->cfg.ps);
17191733
}
17201734

17211735
/* 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,
17581772
&mld_vif->emlsr.check_tpt_wk);
17591773

17601774
iwl_mld_reset_cca_40mhz_workaround(mld, vif);
1775+
iwl_mld_smps_wa(mld, vif, true);
17611776
}
17621777

17631778
/* once we move into assoc state, need to update the FW to

drivers/net/wireless/intel/iwlwifi/mld/power.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ static void iwl_mld_vif_ps_iterator(void *data, u8 *mac,
1515
struct ieee80211_vif *vif)
1616
{
1717
bool *ps_enable = (bool *)data;
18+
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
1819

1920
if (vif->type != NL80211_IFTYPE_STATION)
2021
return;
2122

22-
*ps_enable &= vif->cfg.ps;
23+
*ps_enable &= !mld_vif->ps_disabled;
2324
}
2425

2526
int iwl_mld_update_device_power(struct iwl_mld *mld, bool d3)

0 commit comments

Comments
 (0)