wifi: ath12k: Fix missing station power save configuration

Commit afbab6e4e8 ("wifi: ath12k: modify ath12k_mac_op_bss_info_changed()
for MLO") replaced the bss_info_changed() callback with vif_cfg_changed()
and link_info_changed() to support Multi-Link Operation (MLO). As a result,
the station power save configuration is no longer correctly applied in
ath12k_mac_bss_info_changed().

Move the handling of 'BSS_CHANGED_PS' into ath12k_mac_op_vif_cfg_changed()
to align with the updated callback structure introduced for MLO, ensuring
proper power-save behavior for station interfaces.

Tested-on: WCN7850 hw2.0 PCI WLAN.IOE_HMT.1.1-00011-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1

Fixes: afbab6e4e8 ("wifi: ath12k: modify ath12k_mac_op_bss_info_changed() for MLO")
Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250908015025.1301398-1-miaoqing.pan@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Miaoqing Pan 2025-09-08 09:50:25 +08:00 committed by Jeff Johnson
parent d69eb204c2
commit 4b66d18918
1 changed files with 67 additions and 55 deletions

View File

@ -4078,12 +4078,68 @@ static int ath12k_mac_fils_discovery(struct ath12k_link_vif *arvif,
return ret; return ret;
} }
static void ath12k_mac_vif_setup_ps(struct ath12k_link_vif *arvif)
{
struct ath12k *ar = arvif->ar;
struct ieee80211_vif *vif = arvif->ahvif->vif;
struct ieee80211_conf *conf = &ath12k_ar_to_hw(ar)->conf;
enum wmi_sta_powersave_param param;
struct ieee80211_bss_conf *info;
enum wmi_sta_ps_mode psmode;
int ret;
int timeout;
bool enable_ps;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
if (vif->type != NL80211_IFTYPE_STATION)
return;
enable_ps = arvif->ahvif->ps;
if (enable_ps) {
psmode = WMI_STA_PS_MODE_ENABLED;
param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
timeout = conf->dynamic_ps_timeout;
if (timeout == 0) {
info = ath12k_mac_get_link_bss_conf(arvif);
if (!info) {
ath12k_warn(ar->ab, "unable to access bss link conf in setup ps for vif %pM link %u\n",
vif->addr, arvif->link_id);
return;
}
/* firmware doesn't like 0 */
timeout = ieee80211_tu_to_usec(info->beacon_int) / 1000;
}
ret = ath12k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
timeout);
if (ret) {
ath12k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n",
arvif->vdev_id, ret);
return;
}
} else {
psmode = WMI_STA_PS_MODE_DISABLED;
}
ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev %d psmode %s\n",
arvif->vdev_id, psmode ? "enable" : "disable");
ret = ath12k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode);
if (ret)
ath12k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n",
psmode, arvif->vdev_id, ret);
}
static void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw, static void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
u64 changed) u64 changed)
{ {
struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif); struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
unsigned long links = ahvif->links_map; unsigned long links = ahvif->links_map;
struct ieee80211_vif_cfg *vif_cfg;
struct ieee80211_bss_conf *info; struct ieee80211_bss_conf *info;
struct ath12k_link_vif *arvif; struct ath12k_link_vif *arvif;
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
@ -4147,61 +4203,24 @@ static void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw,
} }
} }
} }
}
static void ath12k_mac_vif_setup_ps(struct ath12k_link_vif *arvif) if (changed & BSS_CHANGED_PS) {
{ links = ahvif->links_map;
struct ath12k *ar = arvif->ar; vif_cfg = &vif->cfg;
struct ieee80211_vif *vif = arvif->ahvif->vif;
struct ieee80211_conf *conf = &ath12k_ar_to_hw(ar)->conf;
enum wmi_sta_powersave_param param;
struct ieee80211_bss_conf *info;
enum wmi_sta_ps_mode psmode;
int ret;
int timeout;
bool enable_ps;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]);
if (!arvif || !arvif->ar)
continue;
if (vif->type != NL80211_IFTYPE_STATION) ar = arvif->ar;
return;
enable_ps = arvif->ahvif->ps; if (ar->ab->hw_params->supports_sta_ps) {
if (enable_ps) { ahvif->ps = vif_cfg->ps;
psmode = WMI_STA_PS_MODE_ENABLED; ath12k_mac_vif_setup_ps(arvif);
param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
timeout = conf->dynamic_ps_timeout;
if (timeout == 0) {
info = ath12k_mac_get_link_bss_conf(arvif);
if (!info) {
ath12k_warn(ar->ab, "unable to access bss link conf in setup ps for vif %pM link %u\n",
vif->addr, arvif->link_id);
return;
} }
/* firmware doesn't like 0 */
timeout = ieee80211_tu_to_usec(info->beacon_int) / 1000;
} }
ret = ath12k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
timeout);
if (ret) {
ath12k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n",
arvif->vdev_id, ret);
return;
}
} else {
psmode = WMI_STA_PS_MODE_DISABLED;
} }
ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev %d psmode %s\n",
arvif->vdev_id, psmode ? "enable" : "disable");
ret = ath12k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode);
if (ret)
ath12k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n",
psmode, arvif->vdev_id, ret);
} }
static bool ath12k_mac_supports_tpc(struct ath12k *ar, struct ath12k_vif *ahvif, static bool ath12k_mac_supports_tpc(struct ath12k *ar, struct ath12k_vif *ahvif,
@ -4223,7 +4242,6 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar,
{ {
struct ath12k_vif *ahvif = arvif->ahvif; struct ath12k_vif *ahvif = arvif->ahvif;
struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif); struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
struct ieee80211_vif_cfg *vif_cfg = &vif->cfg;
struct cfg80211_chan_def def; struct cfg80211_chan_def def;
u32 param_id, param_value; u32 param_id, param_value;
enum nl80211_band band; enum nl80211_band band;
@ -4510,12 +4528,6 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar,
} }
ath12k_mac_fils_discovery(arvif, info); ath12k_mac_fils_discovery(arvif, info);
if (changed & BSS_CHANGED_PS &&
ar->ab->hw_params->supports_sta_ps) {
ahvif->ps = vif_cfg->ps;
ath12k_mac_vif_setup_ps(arvif);
}
} }
static struct ath12k_vif_cache *ath12k_ahvif_get_link_cache(struct ath12k_vif *ahvif, static struct ath12k_vif_cache *ath12k_ahvif_get_link_cache(struct ath12k_vif *ahvif,