Skip to content

Commit bda6059

Browse files
committed
Merge tag 'ath-current-20250909' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath
Jeff Johnson says: ================== ath.git update for v6.17-rc6 ================== There's a firmware API alignment fix, and a fix for powersave, both for ath12k. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 parents d69eb20 + 82e2be5 commit bda6059

File tree

2 files changed

+68
-56
lines changed

2 files changed

+68
-56
lines changed

drivers/net/wireless/ath/ath12k/mac.c

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,12 +4078,68 @@ static int ath12k_mac_fils_discovery(struct ath12k_link_vif *arvif,
40784078
return ret;
40794079
}
40804080

4081+
static void ath12k_mac_vif_setup_ps(struct ath12k_link_vif *arvif)
4082+
{
4083+
struct ath12k *ar = arvif->ar;
4084+
struct ieee80211_vif *vif = arvif->ahvif->vif;
4085+
struct ieee80211_conf *conf = &ath12k_ar_to_hw(ar)->conf;
4086+
enum wmi_sta_powersave_param param;
4087+
struct ieee80211_bss_conf *info;
4088+
enum wmi_sta_ps_mode psmode;
4089+
int ret;
4090+
int timeout;
4091+
bool enable_ps;
4092+
4093+
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
4094+
4095+
if (vif->type != NL80211_IFTYPE_STATION)
4096+
return;
4097+
4098+
enable_ps = arvif->ahvif->ps;
4099+
if (enable_ps) {
4100+
psmode = WMI_STA_PS_MODE_ENABLED;
4101+
param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
4102+
4103+
timeout = conf->dynamic_ps_timeout;
4104+
if (timeout == 0) {
4105+
info = ath12k_mac_get_link_bss_conf(arvif);
4106+
if (!info) {
4107+
ath12k_warn(ar->ab, "unable to access bss link conf in setup ps for vif %pM link %u\n",
4108+
vif->addr, arvif->link_id);
4109+
return;
4110+
}
4111+
4112+
/* firmware doesn't like 0 */
4113+
timeout = ieee80211_tu_to_usec(info->beacon_int) / 1000;
4114+
}
4115+
4116+
ret = ath12k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
4117+
timeout);
4118+
if (ret) {
4119+
ath12k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n",
4120+
arvif->vdev_id, ret);
4121+
return;
4122+
}
4123+
} else {
4124+
psmode = WMI_STA_PS_MODE_DISABLED;
4125+
}
4126+
4127+
ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev %d psmode %s\n",
4128+
arvif->vdev_id, psmode ? "enable" : "disable");
4129+
4130+
ret = ath12k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode);
4131+
if (ret)
4132+
ath12k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n",
4133+
psmode, arvif->vdev_id, ret);
4134+
}
4135+
40814136
static void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw,
40824137
struct ieee80211_vif *vif,
40834138
u64 changed)
40844139
{
40854140
struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
40864141
unsigned long links = ahvif->links_map;
4142+
struct ieee80211_vif_cfg *vif_cfg;
40874143
struct ieee80211_bss_conf *info;
40884144
struct ath12k_link_vif *arvif;
40894145
struct ieee80211_sta *sta;
@@ -4147,61 +4203,24 @@ static void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw,
41474203
}
41484204
}
41494205
}
4150-
}
4151-
4152-
static void ath12k_mac_vif_setup_ps(struct ath12k_link_vif *arvif)
4153-
{
4154-
struct ath12k *ar = arvif->ar;
4155-
struct ieee80211_vif *vif = arvif->ahvif->vif;
4156-
struct ieee80211_conf *conf = &ath12k_ar_to_hw(ar)->conf;
4157-
enum wmi_sta_powersave_param param;
4158-
struct ieee80211_bss_conf *info;
4159-
enum wmi_sta_ps_mode psmode;
4160-
int ret;
4161-
int timeout;
4162-
bool enable_ps;
41634206

4164-
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
4207+
if (changed & BSS_CHANGED_PS) {
4208+
links = ahvif->links_map;
4209+
vif_cfg = &vif->cfg;
41654210

4166-
if (vif->type != NL80211_IFTYPE_STATION)
4167-
return;
4211+
for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
4212+
arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]);
4213+
if (!arvif || !arvif->ar)
4214+
continue;
41684215

4169-
enable_ps = arvif->ahvif->ps;
4170-
if (enable_ps) {
4171-
psmode = WMI_STA_PS_MODE_ENABLED;
4172-
param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
4216+
ar = arvif->ar;
41734217

4174-
timeout = conf->dynamic_ps_timeout;
4175-
if (timeout == 0) {
4176-
info = ath12k_mac_get_link_bss_conf(arvif);
4177-
if (!info) {
4178-
ath12k_warn(ar->ab, "unable to access bss link conf in setup ps for vif %pM link %u\n",
4179-
vif->addr, arvif->link_id);
4180-
return;
4218+
if (ar->ab->hw_params->supports_sta_ps) {
4219+
ahvif->ps = vif_cfg->ps;
4220+
ath12k_mac_vif_setup_ps(arvif);
41814221
}
4182-
4183-
/* firmware doesn't like 0 */
4184-
timeout = ieee80211_tu_to_usec(info->beacon_int) / 1000;
41854222
}
4186-
4187-
ret = ath12k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
4188-
timeout);
4189-
if (ret) {
4190-
ath12k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n",
4191-
arvif->vdev_id, ret);
4192-
return;
4193-
}
4194-
} else {
4195-
psmode = WMI_STA_PS_MODE_DISABLED;
41964223
}
4197-
4198-
ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev %d psmode %s\n",
4199-
arvif->vdev_id, psmode ? "enable" : "disable");
4200-
4201-
ret = ath12k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode);
4202-
if (ret)
4203-
ath12k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n",
4204-
psmode, arvif->vdev_id, ret);
42054224
}
42064225

42074226
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,
42234242
{
42244243
struct ath12k_vif *ahvif = arvif->ahvif;
42254244
struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
4226-
struct ieee80211_vif_cfg *vif_cfg = &vif->cfg;
42274245
struct cfg80211_chan_def def;
42284246
u32 param_id, param_value;
42294247
enum nl80211_band band;
@@ -4510,12 +4528,6 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar,
45104528
}
45114529

45124530
ath12k_mac_fils_discovery(arvif, info);
4513-
4514-
if (changed & BSS_CHANGED_PS &&
4515-
ar->ab->hw_params->supports_sta_ps) {
4516-
ahvif->ps = vif_cfg->ps;
4517-
ath12k_mac_vif_setup_ps(arvif);
4518-
}
45194531
}
45204532

45214533
static struct ath12k_vif_cache *ath12k_ahvif_get_link_cache(struct ath12k_vif *ahvif,

drivers/net/wireless/ath/ath12k/wmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ int ath12k_wmi_mgmt_send(struct ath12k_link_vif *arvif, u32 buf_id,
843843
cmd->tx_params_valid = 0;
844844

845845
frame_tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd));
846-
frame_tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_BYTE, buf_len);
846+
frame_tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_BYTE, buf_len_aligned);
847847

848848
memcpy(frame_tlv->value, frame->data, buf_len);
849849

0 commit comments

Comments
 (0)