Commit 97b7cbb7 authored by Pradeep Kumar Chitrapu's avatar Pradeep Kumar Chitrapu Committed by Kalle Valo

wifi: ath12k: support SMPS configuration for 6 GHz

Parse SMPS configuration from IEs and configure. Without this,
SMPS is not enabled for 6 GHz band. This is disabled for
WCN7850 as hardware does not support it.

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: default avatarPradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Acked-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240508173655.22191-7-quic_pradeepc@quicinc.com
parent f0e61dc7
...@@ -926,6 +926,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { ...@@ -926,6 +926,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
.supports_sta_ps = false, .supports_sta_ps = false,
.acpi_guid = NULL, .acpi_guid = NULL,
.supports_dynamic_smps_6ghz = true,
}, },
{ {
.name = "wcn7850 hw2.0", .name = "wcn7850 hw2.0",
...@@ -1001,6 +1002,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { ...@@ -1001,6 +1002,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
.supports_sta_ps = true, .supports_sta_ps = true,
.acpi_guid = &wcn7850_uuid, .acpi_guid = &wcn7850_uuid,
.supports_dynamic_smps_6ghz = false,
}, },
{ {
.name = "qcn9274 hw2.0", .name = "qcn9274 hw2.0",
...@@ -1071,6 +1073,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { ...@@ -1071,6 +1073,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
.supports_sta_ps = false, .supports_sta_ps = false,
.acpi_guid = NULL, .acpi_guid = NULL,
.supports_dynamic_smps_6ghz = true,
}, },
}; };
......
...@@ -215,6 +215,7 @@ struct ath12k_hw_params { ...@@ -215,6 +215,7 @@ struct ath12k_hw_params {
bool supports_sta_ps; bool supports_sta_ps;
const guid_t *acpi_guid; const guid_t *acpi_guid;
bool supports_dynamic_smps_6ghz;
}; };
struct ath12k_hw_ops { struct ath12k_hw_ops {
......
...@@ -2087,12 +2087,17 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar, ...@@ -2087,12 +2087,17 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar,
} }
static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap, static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap,
const struct ieee80211_he_6ghz_capa *he_6ghz_capa,
int *smps) int *smps)
{ {
if (!ht_cap->ht_supported) if (!ht_cap->ht_supported && !he_6ghz_capa->capa)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (ht_cap->ht_supported)
*smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS); *smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS);
else
*smps = le16_get_bits(he_6ghz_capa->capa,
IEEE80211_HE_6GHZ_CAP_SM_PS);
if (*smps >= ARRAY_SIZE(ath12k_smps_map)) if (*smps >= ARRAY_SIZE(ath12k_smps_map))
return -EINVAL; return -EINVAL;
...@@ -2103,10 +2108,11 @@ static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap, ...@@ -2103,10 +2108,11 @@ static int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap,
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_he_6ghz_capa *he_6ghz_capa = &sta->deflink.he_6ghz_capa;
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 (ath12k_get_smps_from_capa(ht_cap, &smps)) if (ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps))
return; return;
switch (smps) { switch (smps) {
...@@ -2580,11 +2586,12 @@ static void ath12k_peer_assoc_prepare(struct ath12k *ar, ...@@ -2580,11 +2586,12 @@ static void ath12k_peer_assoc_prepare(struct ath12k *ar,
static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_vif *arvif, 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,
const struct ieee80211_he_6ghz_capa *he_6ghz_capa)
{ {
int smps, ret = 0; int smps, ret = 0;
ret = ath12k_get_smps_from_capa(ht_cap, &smps); ret = ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2637,7 +2644,8 @@ static void ath12k_bss_assoc(struct ath12k *ar, ...@@ -2637,7 +2644,8 @@ static void ath12k_bss_assoc(struct ath12k *ar,
} }
ret = ath12k_setup_peer_smps(ar, arvif, bss_conf->bssid, ret = ath12k_setup_peer_smps(ar, arvif, bss_conf->bssid,
&ap_sta->deflink.ht_cap); &ap_sta->deflink.ht_cap,
&ap_sta->deflink.he_6ghz_capa);
if (ret) { if (ret) {
ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
arvif->vdev_id, ret); arvif->vdev_id, ret);
...@@ -3944,7 +3952,8 @@ static int ath12k_station_assoc(struct ath12k *ar, ...@@ -3944,7 +3952,8 @@ static int ath12k_station_assoc(struct ath12k *ar,
return 0; return 0;
ret = ath12k_setup_peer_smps(ar, arvif, sta->addr, ret = ath12k_setup_peer_smps(ar, arvif, sta->addr,
&sta->deflink.ht_cap); &sta->deflink.ht_cap,
&sta->deflink.he_6ghz_capa);
if (ret) { if (ret) {
ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
arvif->vdev_id, ret); arvif->vdev_id, ret);
...@@ -8777,7 +8786,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah) ...@@ -8777,7 +8786,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
* for each band for a dual band capable radio. It will be tricky to * for each band for a dual band capable radio. It will be tricky to
* handle it when the ht capability different for each band. * handle it when the ht capability different for each band.
*/ */
if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS) if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS ||
(ar->supports_6ghz && ab->hw_params->supports_dynamic_smps_6ghz))
wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment