diff mbox series

[6/6] wifi: ath12k: support SMPS configuration for 6 GHz

Message ID 20240325212304.28241-7-quic_pradeepc@quicinc.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series bug fixes and enhancements to 6 GHz band support | expand

Commit Message

Pradeep Kumar Chitrapu March 25, 2024, 9:23 p.m. UTC
Parse SMPS configuration from IEs and configure. Without this,
SMPS is not enabled for 6 GHz band.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

Comments

Baochen Qiang March 26, 2024, 3:38 a.m. UTC | #1
On 3/26/2024 5:23 AM, Pradeep Kumar Chitrapu wrote:
> Parse SMPS configuration from IEs and configure. Without this,
> SMPS is not enabled for 6 GHz band.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/mac.c | 25 +++++++++++++++++--------
>   1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index b4114dd22bf0..433b8be74997 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -1964,12 +1964,17 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar,
>   }
>   
>   static inline 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)
>   {
> -	if (!ht_cap->ht_supported)
> +	if (!ht_cap->ht_supported && !he_6ghz_capa->capa)
>   		return -EOPNOTSUPP;
>   
> -	*smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS);
> +	if (ht_cap->ht_supported)
> +		*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))
>   		return -EINVAL;
> @@ -1980,10 +1985,11 @@ static inline int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *h
>   static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
>   				     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;
>   	int smps;
>   
> -	if (ath12k_get_smps_from_capa(ht_cap, &smps))
> +	if (ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps))
>   		return;
>   
>   	switch (smps) {
> @@ -2457,11 +2463,12 @@ static void ath12k_peer_assoc_prepare(struct ath12k *ar,
>   
>   static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_vif *arvif,
>   				  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;
>   
> -	ret = ath12k_get_smps_from_capa(ht_cap, &smps);
> +	ret = ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps);
>   	if (ret < 0)
>   		return ret;
>   
> @@ -2514,7 +2521,8 @@ static void ath12k_bss_assoc(struct ath12k *ar,
>   	}
>   
>   	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) {
>   		ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
>   			    arvif->vdev_id, ret);
> @@ -3677,7 +3685,8 @@ static int ath12k_station_assoc(struct ath12k *ar,
>   		return 0;
>   
>   	ret = ath12k_setup_peer_smps(ar, arvif, sta->addr,
> -				     &sta->deflink.ht_cap);
> +				     &sta->deflink.ht_cap,
> +				     &sta->deflink.he_6ghz_capa);
>   	if (ret) {
>   		ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
>   			    arvif->vdev_id, ret);
> @@ -8104,7 +8113,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
>   	 * for each band for a dual band capable radio. It will be tricky to
>   	 * 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)
WCN7850 supports 6 GHz but it does not support feature 
NL80211_FEATURE_DYNAMIC_SMPS. Enabling this for WCN7850 can lead to 
MU-MIMO test failures.

>   		wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
>   
>   	wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
Pradeep Kumar Chitrapu March 26, 2024, 5:37 p.m. UTC | #2
On 3/25/2024 8:38 PM, Baochen Qiang wrote:
> 
> 
> On 3/26/2024 5:23 AM, Pradeep Kumar Chitrapu wrote:
>> Parse SMPS configuration from IEs and configure. Without this,
>> SMPS is not enabled for 6 GHz band.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>
>> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
>> ---
>>   drivers/net/wireless/ath/ath12k/mac.c | 25 +++++++++++++++++--------
>>   1 file changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/mac.c 
>> b/drivers/net/wireless/ath/ath12k/mac.c
>> index b4114dd22bf0..433b8be74997 100644
>> --- a/drivers/net/wireless/ath/ath12k/mac.c
>> +++ b/drivers/net/wireless/ath/ath12k/mac.c
>> @@ -1964,12 +1964,17 @@ static void ath12k_peer_assoc_h_he_6ghz(struct 
>> ath12k *ar,
>>   }
>>   static inline 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)
>>   {
>> -    if (!ht_cap->ht_supported)
>> +    if (!ht_cap->ht_supported && !he_6ghz_capa->capa)
>>           return -EOPNOTSUPP;
>> -    *smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS);
>> +    if (ht_cap->ht_supported)
>> +        *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))
>>           return -EINVAL;
>> @@ -1980,10 +1985,11 @@ static inline int 
>> ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *h
>>   static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
>>                        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;
>>       int smps;
>> -    if (ath12k_get_smps_from_capa(ht_cap, &smps))
>> +    if (ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps))
>>           return;
>>       switch (smps) {
>> @@ -2457,11 +2463,12 @@ static void ath12k_peer_assoc_prepare(struct 
>> ath12k *ar,
>>   static int ath12k_setup_peer_smps(struct ath12k *ar, struct 
>> ath12k_vif *arvif,
>>                     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;
>> -    ret = ath12k_get_smps_from_capa(ht_cap, &smps);
>> +    ret = ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps);
>>       if (ret < 0)
>>           return ret;
>> @@ -2514,7 +2521,8 @@ static void ath12k_bss_assoc(struct ath12k *ar,
>>       }
>>       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) {
>>           ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: 
>> %d\n",
>>                   arvif->vdev_id, ret);
>> @@ -3677,7 +3685,8 @@ static int ath12k_station_assoc(struct ath12k *ar,
>>           return 0;
>>       ret = ath12k_setup_peer_smps(ar, arvif, sta->addr,
>> -                     &sta->deflink.ht_cap);
>> +                     &sta->deflink.ht_cap,
>> +                     &sta->deflink.he_6ghz_capa);
>>       if (ret) {
>>           ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: 
>> %d\n",
>>                   arvif->vdev_id, ret);
>> @@ -8104,7 +8113,7 @@ static int ath12k_mac_hw_register(struct 
>> ath12k_hw *ah)
>>        * for each band for a dual band capable radio. It will be 
>> tricky to
>>        * 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)
> WCN7850 supports 6 GHz but it does not support feature 
> NL80211_FEATURE_DYNAMIC_SMPS. Enabling this for WCN7850 can lead to 
> MU-MIMO test failures.
> 
>>           wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
>>       wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;

Thanks Baochen

will address this in next revision..
can you please let me know if WCN7850 firmware advertises any capability 
flag for this?
If not, I am planning to use hw_params for differentiating feature 
support. I will further look and update in next revision.

Thanks
Pradeep
Jeff Johnson March 29, 2024, 5:54 p.m. UTC | #3
On 3/25/2024 2:23 PM, Pradeep Kumar Chitrapu wrote:
> Parse SMPS configuration from IEs and configure. Without this,
> SMPS is not enabled for 6 GHz band.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
> ---
>  drivers/net/wireless/ath/ath12k/mac.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index b4114dd22bf0..433b8be74997 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -1964,12 +1964,17 @@ static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar,
>  }
>  
>  static inline int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *ht_cap,
> +					    const struct ieee80211_he_6ghz_capa *he_6ghz_capa,

ath12k-check complains:
drivers/net/wireless/ath/ath12k/mac.c:1967: line length of 94 exceeds 90 columns

git blame indicates:
bf5622d2fd27a (Pradeep Kumar Chitrapu 2024-03-25 14:23:04 -0700 1967)              const struct ieee80211_he_6ghz_capa *he_6ghz_capa,

Suggest removing 'inline' to align with:
https://www.kernel.org/doc/html/latest/process/coding-style.html#the-inline-disease
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index b4114dd22bf0..433b8be74997 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1964,12 +1964,17 @@  static void ath12k_peer_assoc_h_he_6ghz(struct ath12k *ar,
 }
 
 static inline 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)
 {
-	if (!ht_cap->ht_supported)
+	if (!ht_cap->ht_supported && !he_6ghz_capa->capa)
 		return -EOPNOTSUPP;
 
-	*smps = u16_get_bits(ht_cap->cap, IEEE80211_HT_CAP_SM_PS);
+	if (ht_cap->ht_supported)
+		*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))
 		return -EINVAL;
@@ -1980,10 +1985,11 @@  static inline int ath12k_get_smps_from_capa(const struct ieee80211_sta_ht_cap *h
 static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
 				     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;
 	int smps;
 
-	if (ath12k_get_smps_from_capa(ht_cap, &smps))
+	if (ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps))
 		return;
 
 	switch (smps) {
@@ -2457,11 +2463,12 @@  static void ath12k_peer_assoc_prepare(struct ath12k *ar,
 
 static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_vif *arvif,
 				  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;
 
-	ret = ath12k_get_smps_from_capa(ht_cap, &smps);
+	ret = ath12k_get_smps_from_capa(ht_cap, he_6ghz_capa, &smps);
 	if (ret < 0)
 		return ret;
 
@@ -2514,7 +2521,8 @@  static void ath12k_bss_assoc(struct ath12k *ar,
 	}
 
 	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) {
 		ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
 			    arvif->vdev_id, ret);
@@ -3677,7 +3685,8 @@  static int ath12k_station_assoc(struct ath12k *ar,
 		return 0;
 
 	ret = ath12k_setup_peer_smps(ar, arvif, sta->addr,
-				     &sta->deflink.ht_cap);
+				     &sta->deflink.ht_cap,
+				     &sta->deflink.he_6ghz_capa);
 	if (ret) {
 		ath12k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n",
 			    arvif->vdev_id, ret);
@@ -8104,7 +8113,7 @@  static int ath12k_mac_hw_register(struct ath12k_hw *ah)
 	 * for each band for a dual band capable radio. It will be tricky to
 	 * 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)
 		wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
 
 	wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;