2023-12-04 08:14:05

by Baochen Qiang

[permalink] [raw]
Subject: [PATCH v8 04/12] wifi: ath11k: update regulatory rules when interface added

From: Wen Gong <[email protected]>

There are two power types for 6 GHz regulatory, one is AP, another
is client.

When wlan boot up, WMI_REG_CHAN_LIST_CC_EXT_EVENTID is sent from
firmware at an early stage, the interface mode is not decided at
this point, then ath11k select reg rules of AP type as default.

After interface is created, it is exactly decided the interface
type such as AP/mesh point/station. Then ath11k need to update
reg rules to the exact power type matched to the interface type.

The client power type is used for station interface, and AP power
type is used for AP/mesh point interface.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23

Signed-off-by: Wen Gong <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Baochen Qiang <[email protected]>
---
v8:
no change.
v7:
1. move ath11k_mac_supports_6ghz_cc_ext() to
wmi.c and renamed as ath11k_wmi_supports_6ghz_cc_ext().

drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++
drivers/net/wireless/ath/ath11k/mac.h | 1 -
drivers/net/wireless/ath/ath11k/wmi.c | 6 ++++++
drivers/net/wireless/ath/ath11k/wmi.h | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 7f7b39817773..1e314fcab41b 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -6943,6 +6943,14 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
ret);
}

+ if (ath11k_wmi_supports_6ghz_cc_ext(ar)) {
+ struct cur_regulatory_info *reg_info;
+
+ reg_info = &ab->reg_info_store[ar->pdev_idx];
+ ath11k_dbg(ab, ATH11K_DBG_MAC, "mac interface added to change reg rules\n");
+ ath11k_reg_handle_chan_list(ab, reg_info, IEEE80211_REG_LPI_AP);
+ }
+
mutex_unlock(&ar->conf_mutex);

return 0;
diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h
index 774a9f01c030..498e537cd695 100644
--- a/drivers/net/wireless/ath/ath11k/mac.h
+++ b/drivers/net/wireless/ath/ath11k/mac.h
@@ -156,7 +156,6 @@ struct ath11k_vif *ath11k_mac_get_arvif_by_vdev_id(struct ath11k_base *ab,
u8 ath11k_mac_get_target_pdev_id(struct ath11k *ar);
u8 ath11k_mac_get_target_pdev_id_from_vif(struct ath11k_vif *arvif);
struct ath11k_vif *ath11k_mac_get_vif_up(struct ath11k_base *ab);
-
struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab, u32 vdev_id);
struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id);
void ath11k_mac_drain_tx(struct ath11k *ar);
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 6f0a35fcc9c1..9a0568676a74 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -9858,3 +9858,9 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar,

return ath11k_wmi_cmd_send(wmi, skb, WMI_STA_KEEPALIVE_CMDID);
}
+
+bool ath11k_wmi_supports_6ghz_cc_ext(struct ath11k *ar)
+{
+ return (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT,
+ ar->ab->wmi_ab.svc_map)) && ar->supports_6ghz;
+}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index d46c70704774..fa85e6eb4ab4 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -6485,4 +6485,5 @@ void ath11k_reg_reset_info(struct cur_regulatory_info *reg_info);
int ath11k_reg_handle_chan_list(struct ath11k_base *ab,
struct cur_regulatory_info *reg_info,
enum ieee80211_ap_reg_power power_type);
+bool ath11k_wmi_supports_6ghz_cc_ext(struct ath11k *ar);
#endif
--
2.25.1



2023-12-07 03:16:00

by Aditya Kumar Singh

[permalink] [raw]
Subject: Re: [PATCH v8 04/12] wifi: ath11k: update regulatory rules when interface added

On 12/4/23 13:43, Baochen Qiang wrote:

> --- a/drivers/net/wireless/ath/ath11k/mac.h
> +++ b/drivers/net/wireless/ath/ath11k/mac.h
> @@ -156,7 +156,6 @@ struct ath11k_vif *ath11k_mac_get_arvif_by_vdev_id(struct ath11k_base *ab,
> u8 ath11k_mac_get_target_pdev_id(struct ath11k *ar);
> u8 ath11k_mac_get_target_pdev_id_from_vif(struct ath11k_vif *arvif);
> struct ath11k_vif *ath11k_mac_get_vif_up(struct ath11k_base *ab);
> -

Irrelevant change?

> struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab, u32 vdev_id);
> struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id);
> void ath11k_mac_drain_tx(struct ath11k *ar);
> diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
> index 6f0a35fcc9c1..9a0568676a74 100644
> --- a/drivers/net/wireless/ath/ath11k/wmi.c
> +++ b/drivers/net/wireless/ath/ath11k/wmi.c
> @@ -9858,3 +9858,9 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar,
>
> return ath11k_wmi_cmd_send(wmi, skb, WMI_STA_KEEPALIVE_CMDID);
> }
> +
> +bool ath11k_wmi_supports_6ghz_cc_ext(struct ath11k *ar)
> +{
> + return (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT,
> + ar->ab->wmi_ab.svc_map)) && ar->supports_6ghz;

What is the use of first parenthesis? I don't see a closing one after
ar->supports_6ghz so its just guarding test_bit() which is not required.
I believe intention here was to guard whole expression?

2023-12-11 03:55:52

by Baochen Qiang

[permalink] [raw]
Subject: Re: [PATCH v8 04/12] wifi: ath11k: update regulatory rules when interface added



On 12/7/2023 11:15 AM, Aditya Kumar Singh wrote:
> On 12/4/23 13:43, Baochen Qiang wrote:
>
>> --- a/drivers/net/wireless/ath/ath11k/mac.h
>> +++ b/drivers/net/wireless/ath/ath11k/mac.h
>> @@ -156,7 +156,6 @@ struct ath11k_vif
>> *ath11k_mac_get_arvif_by_vdev_id(struct ath11k_base *ab,
>>   u8 ath11k_mac_get_target_pdev_id(struct ath11k *ar);
>>   u8 ath11k_mac_get_target_pdev_id_from_vif(struct ath11k_vif *arvif);
>>   struct ath11k_vif *ath11k_mac_get_vif_up(struct ath11k_base *ab);
>> -
>
> Irrelevant change?
>
>>   struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab,
>> u32 vdev_id);
>>   struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab,
>> u32 pdev_id);
>>   void ath11k_mac_drain_tx(struct ath11k *ar);
>> diff --git a/drivers/net/wireless/ath/ath11k/wmi.c
>> b/drivers/net/wireless/ath/ath11k/wmi.c
>> index 6f0a35fcc9c1..9a0568676a74 100644
>> --- a/drivers/net/wireless/ath/ath11k/wmi.c
>> +++ b/drivers/net/wireless/ath/ath11k/wmi.c
>> @@ -9858,3 +9858,9 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar,
>>       return ath11k_wmi_cmd_send(wmi, skb, WMI_STA_KEEPALIVE_CMDID);
>>   }
>> +
>> +bool ath11k_wmi_supports_6ghz_cc_ext(struct ath11k *ar)
>> +{
>> +    return (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT,
>> +             ar->ab->wmi_ab.svc_map)) && ar->supports_6ghz;
>
> What is the use of first parenthesis? I don't see a closing one after
> ar->supports_6ghz so its just guarding test_bit() which is not required.
> I believe intention here was to guard whole expression?
I don't see an need to guard the whole expression or the test_bit(), so
will drop extra parenthesis in V9.