2023-06-07 10:04:25

by Wen Gong

[permalink] [raw]
Subject: [PATCH v4 0/5] fix wrong TX power and frequency in regdomain by dynamic switch 6 GHz reg rules of LPI/SP/VLP for station mode

Currently when wlan load up, station always use the 6 GHz reg rules of
AP mode by commit 91fa00fa6922 ("wifi: ath11k: add support to parse new
WMI event for 6 GHz"), then the tx power and frequency are not correct,
so fix it by dynamic switch to client mode LPI/SP/VLP for station after
interface added and connected for station.

v4: (NOT depends to any patch now).
1. removed patches which depends on
wifi: cfg80211: save Power Spectral Density (PSD) of the regulatory rule
https://lore.kernel.org/linux-wireless/[email protected]/
removed:
[v3,08/15] wifi: ath11k: save power spectral density(psd) of regulatory rule
[v3,09/15] wifi: ath11k: add parse of transmit power envelope element
[v3,10/15] wifi: ath11k: save max tx power in vdev start response event from firmware
[v3,11/15] wifi: ath11k: fill parameters for vdev_set_tpc_power wmi command
[v3,12/15] wifi: ath11k: add WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT service bit
[v3,13/15] wifi: ath11k: discard BSS_CHANGED_TXPOWER when EXT_TPC_REG_SUPPORT for 6 GHz
[v3,14/15] wifi: ath11k: add handler for WMI_VDEV_SET_TPC_POWER_CMDID
[v3,15/15] wifi: ath11k: send TPC power to firmware for 6 GHz station

2. rebased to ath.git ath-202304281700

3. deleted "wifi: ath11k: Add support to parse new wmi event for 6 GHz regulatory" which is alreay upstream.

link of v3:
[v3,00/15] wifi: ath11k: add support for 6 GHz station for various modes : LPI, SP and VLP
https://patchwork.kernel.org/project/linux-wireless/cover/[email protected]/

v3:
1. added "ath11k: fix a possible dead lock caused by ab->base_lock".
3. deleted "ath11k: add support for extended wmi service bit" which is alreay upstream.

v2:
1. change some minor comments by Kalle.
2. rebased to ath.git ath-202112220603

Baochen Qiang (1):
wifi: ath11k: fix a possible dead lock caused by ab->base_lock

Wen Gong (4):
wifi: ath11k: add support to select 6 GHz Regulatory type
wifi: ath11k: store cur_regulatory_info for each radio
wifi: ath11k: update regulatory rules when interface added
wifi: ath11k: update regulatory rules when connect to AP on 6 GHz band
for station

drivers/net/wireless/ath/ath11k/core.h | 1 +
drivers/net/wireless/ath/ath11k/hw.c | 6 ++
drivers/net/wireless/ath/ath11k/hw.h | 2 +
drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++
drivers/net/wireless/ath/ath11k/mac.h | 2 +-
drivers/net/wireless/ath/ath11k/reg.c | 72 +++++++++++---
drivers/net/wireless/ath/ath11k/reg.h | 6 +-
drivers/net/wireless/ath/ath11k/wmi.c | 131 +++++++++++++++++--------
drivers/net/wireless/ath/ath11k/wmi.h | 5 +
9 files changed, 198 insertions(+), 60 deletions(-)


base-commit: 0a00db612b6df1fad80485e3642529d1f28ea084
--
2.40.1



2023-06-07 10:04:31

by Wen Gong

[permalink] [raw]
Subject: [PATCH v4 4/5] wifi: ath11k: update regulatory rules when interface added

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 mode as default.

After interface is created, it is exactly decided AP/station mode,
then ath11k need to update reg rules to the exact one.

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]>
---
drivers/net/wireless/ath/ath11k/hw.c | 6 ++++++
drivers/net/wireless/ath/ath11k/hw.h | 2 ++
drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++
3 files changed, 16 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/ath/ath11k/hw.c
index eb995f9cf0fa..15006bb67a5a 100644
--- a/drivers/net/wireless/ath/ath11k/hw.c
+++ b/drivers/net/wireless/ath/ath11k/hw.c
@@ -897,6 +897,12 @@ static u32 ath11k_hw_wcn6750_get_tcl_ring_selector(struct sk_buff *skb)
return skb_get_hash(skb);
}

+bool ath11k_hw_supports_6g_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;
+}
+
const struct ath11k_hw_ops ipq8074_ops = {
.get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id,
.wmi_init_config = ath11k_init_wmi_config_ipq8074,
diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h
index 6a5dd2dbdb3a..00fe1c5edd06 100644
--- a/drivers/net/wireless/ath/ath11k/hw.h
+++ b/drivers/net/wireless/ath/ath11k/hw.h
@@ -319,6 +319,8 @@ static inline int ath11k_hw_mac_id_to_srng_id(struct ath11k_hw_params *hw,
return 0;
}

+bool ath11k_hw_supports_6g_cc_ext(struct ath11k *ar);
+
struct ath11k_fw_ie {
__le32 id;
__le32 len;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 75843af7bac7..f586b37336b0 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -6639,6 +6639,14 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
ret);
}

+ if (ath11k_hw_supports_6g_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;
--
2.40.1


2023-06-07 10:04:31

by Wen Gong

[permalink] [raw]
Subject: [PATCH v4 5/5] wifi: ath11k: update regulatory rules when connect to AP on 6 GHz band for station

When station connect to AP on 6 GHz band, it need switch the regulatory
rules according to the regulatory info subfield in HE operation element.
Swith to the power type of AP for station mode.

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]>
---
drivers/net/wireless/ath/ath11k/mac.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index f586b37336b0..a67fa7c1a6aa 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -7287,6 +7287,8 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ath11k_vif *arvif = (void *)vif->drv_priv;
int ret;
struct peer_create_params param;
+ struct cur_regulatory_info *reg_info;
+ enum ieee80211_ap_reg_power power_type;

mutex_lock(&ar->conf_mutex);

@@ -7294,6 +7296,18 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
"mac chanctx assign ptr %pK vdev_id %i\n",
ctx, arvif->vdev_id);

+ if (ath11k_hw_supports_6g_cc_ext(ar) &&
+ ctx->def.chan->band == NL80211_BAND_6GHZ &&
+ arvif->vdev_type == WMI_VDEV_TYPE_STA) {
+ reg_info = &ab->reg_info_store[ar->pdev_idx];
+ power_type = vif->bss_conf.power_type;
+ ath11k_dbg(ab, ATH11K_DBG_MAC, "mac chanctx power type %d\n",
+ power_type);
+ if (power_type == IEEE80211_REG_UNSET_AP)
+ power_type = IEEE80211_REG_LPI_AP;
+ ath11k_reg_handle_chan_list(ab, reg_info, power_type);
+ }
+
/* for QCA6390 bss peer must be created before vdev_start */
if (ab->hw_params.vdev_start_delay &&
arvif->vdev_type != WMI_VDEV_TYPE_AP &&
--
2.40.1


2023-08-02 12:04:29

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v4 4/5] wifi: ath11k: update regulatory rules when interface added

Wen Gong <[email protected]> writes:

> 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 mode as default.
>
> After interface is created, it is exactly decided AP/station mode,
> then ath11k need to update reg rules to the exact one.
>
> 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]>

[...]

> --- a/drivers/net/wireless/ath/ath11k/hw.c
> +++ b/drivers/net/wireless/ath/ath11k/hw.c
> @@ -897,6 +897,12 @@ static u32 ath11k_hw_wcn6750_get_tcl_ring_selector(struct sk_buff *skb)
> return skb_get_hash(skb);
> }
>
> +bool ath11k_hw_supports_6g_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;
> +}

This is more like a firmware feature, maybe move to mac.c?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2023-08-02 12:16:27

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v4 4/5] wifi: ath11k: update regulatory rules when interface added

Wen Gong <[email protected]> writes:

> 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 mode as default.
>
> After interface is created, it is exactly decided AP/station mode,
> then ath11k need to update reg rules to the exact one.
>
> Tested-on: WCN6855 hw2.0 PCI
> WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23

What about mesh mode? The commit log mentions nothing about that.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches