1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

wifi: ath12k: refactor SMPS configuration

Move fetching SMPS value to a new function and use u16_get_bits
to extract it from capabilities. This will help in extending the
functionality when SMPS support in 6 GHz band gets added in
subsequent patches.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240508173655.22191-6-quic_pradeepc@quicinc.com
This commit is contained in:
Pradeep Kumar Chitrapu 2024-05-08 10:36:54 -07:00 committed by Kalle Valo
parent 112dbc6af8
commit f0e61dc7ec

View file

@ -2086,18 +2086,29 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar,
ampdu_factor)) - 1; ampdu_factor)) - 1;
} }
static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap,
int *smps)
{
if (!ht_cap->ht_supported)
return -EOPNOTSUPP;
*smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS);
if (*smps >= ARRAY_SIZE(ath12k_smps_map))
return -EINVAL;
return 0;
}
static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta, static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg) struct ath12k_wmi_peer_assoc_arg *arg)
{ {
const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap;
int smps; int smps;
if (!ht_cap->ht_supported) if (ath12k_get_smps_from_capa(ht_cap, &smps))
return; return;
smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS;
smps >>= IEEE80211_HT_CAP_SM_PS_SHIFT;
switch (smps) { switch (smps) {
case WLAN_HT_CAP_SM_PS_STATIC: case WLAN_HT_CAP_SM_PS_STATIC:
arg->static_mimops_flag = true; arg->static_mimops_flag = true;
@ -2571,16 +2582,11 @@ static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_vif *arvif,
const u8 *addr, const u8 *addr,
const struct ieee80211_sta_ht_cap *ht_cap) const struct ieee80211_sta_ht_cap *ht_cap)
{ {
int smps; int smps, ret = 0;
if (!ht_cap->ht_supported) ret = ath12k_get_smps_from_capa(ht_cap, &smps);
return 0; if (ret < 0)
return ret;
smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS;
smps >>= IEEE80211_HT_CAP_SM_PS_SHIFT;
if (smps >= ARRAY_SIZE(ath12k_smps_map))
return -EINVAL;
return ath12k_wmi_set_peer_param(ar, addr, arvif->vdev_id, return ath12k_wmi_set_peer_param(ar, addr, arvif->vdev_id,
WMI_PEER_MIMO_PS_STATE, WMI_PEER_MIMO_PS_STATE,