mbox series

[v6,00/13] wifi: ath11k: add support for 6 GHz station for various modes : LPI, SP and VLP

Message ID 20230920082349.29111-1-quic_wgong@quicinc.com
Headers show
Series wifi: ath11k: add support for 6 GHz station for various modes : LPI, SP and VLP | expand

Message

Wen Gong Sept. 20, 2023, 8:23 a.m. UTC
This introduced some new concept:
power type of AP(STANDARD_POWER_AP, INDOOR_AP, VERY_LOW_POWER_AP)
power type of STATION(DEFAULT_CLIENT, SUBORDINATE_CLIENT)
power spectral density(psd)

This patchset is to implement the new rules for 6 GHz band in
ath11k.

ath11k parsed the reg rules from new WMI event
WMI_REG_CHAN_LIST_CC_EXT_EVENTID and parse the
transmit power envelope element in beacon of AP
and then set new WMI command WMI_VDEV_SET_TPC_POWER_CMDID
to firmware when connect to 6G AP, also support backward
compatibility with firmware which not support new wmi
cmd WMI_VDEV_SET_TPC_POWER_CMDID.

v6: (NOT depends to any patch now)
   1. The dependent patch "wifi: cfg80211: save power spectral density(psd) of regulatory rule"
      has upstream to wireless-next https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/commit/?id=ddd7f45c899f7524bdbe6a32fe4906cde8b07b9b
      The prerequisite-patch is cherry-pick from wireless-next
      So add back the other patches in v3 since no dependency to cfg80211 public patch above now.
      [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. rename some "6g" to "6ghz"
   3. remove "static" for ath11k_reg_ap_pwr_convert()
   4. add 20 Mhz check in ath11k_mac_get_eirp_power()
   5. remove min_t() in ath11k_mac_fill_reg_tpc_info() for not is_tpe_present
   6. rebased to ath-202309051328

   link of v5:
   [PATCH v5 0/5] fix wrong TX power and frequency in regdomain by dynamic switch 6 GHz reg rules of LPI/SP/VLP for station mode
   https://lore.kernel.org/linux-wireless/20230803071701.15084-1-quic_wgong@quicinc.com/

v5: change per Kalle and rebased to ath.git ath-202306211808
   1. ath11k_ieee80211_ap_pwr_type_convert() to ath11k_reg_ap_pwr_convert()
   2. used list_first_entry_or_null() and add comments
   3. ath11k_dbg() to ath11k_warn()
   4. ath11k_hw_supports_6g_cc_ext() to ath11k_mac_supports_6g_cc_ext()
   5. add mesh in commit log

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/20230315132904.31779-3-quic_adisi@quicinc.com/
      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/20220913051518.23051-1-quic_wgong@quicinc.com/

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 (12):
  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
  wifi: ath11k: save power spectral density(psd) of regulatory rule
  wifi: ath11k: add parse of transmit power envelope element
  wifi: ath11k: save max tx power in vdev start response event from
    firmware
  wifi: ath11k: fill parameters for vdev set tpc power WMI command
  wifi: ath11k: add WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT service bit
  wifi: ath11k: discard BSS_CHANGED_TXPOWER when EXT_TPC_REG_SUPPORT for
    6 GHz
  wifi: ath11k: add handler for WMI_VDEV_SET_TPC_POWER_CMDID
  wifi: ath11k: send TPC power to firmware for 6 GHz station

 drivers/net/wireless/ath/ath11k/core.h |  40 ++
 drivers/net/wireless/ath/ath11k/mac.c  | 518 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/mac.h  |   6 +-
 drivers/net/wireless/ath/ath11k/reg.c  |  89 ++++-
 drivers/net/wireless/ath/ath11k/reg.h  |   6 +-
 drivers/net/wireless/ath/ath11k/wmi.c  | 216 ++++++++---
 drivers/net/wireless/ath/ath11k/wmi.h  |  68 ++++
 7 files changed, 872 insertions(+), 71 deletions(-)


base-commit: 0263687f4441d5a5eab8074d56b4693c8f0acf85
prerequisite-patch-id: f2d377ca3641f71aea67b168e3f1ec9cdf196d8f

Comments

Wen Gong Sept. 25, 2023, 10:43 a.m. UTC | #1
On 9/22/2023 9:18 PM, Aditya Kumar Singh wrote:
> On 9/22/23 15:32, Wen Gong wrote:
>> On 9/22/2023 5:39 PM, Aditya Kumar Singh wrote:
>>> On 9/20/23 13:53, Wen Gong wrote:
>>>
>>>> +    if (ath11k_mac_supports_6ghz_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;
>>> Why having _UNSET_ power type in vif->bss_conf.power_type is fine? 
>>> Typically, during association, we would be setting this from the 
>>> beacon/association response frame's HE 6 GHz Operation Info Field. 
>>> So is it fine if the field is carrying some info which we don't know 
>>> (or may be don't support it yet)? Why are we masking it with _LPI_ 
>>> mode?
>>>
>>> Also, I see that currently mac80211 only sets LPI or SP. So let's 
>>> say STA is trying to connect to VLP AP, mac80211 will set it as 
>>> _UNSET_. And then here, we will be treating it as LPI AP. Is that fine?
>>
>> Currently only SP/LPI are defined in "Table E-12—Regulatory Info 
>> subfield encoding in the United States" of IEEE Std 802.11ax™‐2021.
>>
>> So maybe I need to set power_type to VLP when it is UNSET here.
> Yeah, or may be deny association if we don't support that mode? I 
> would let others comment on this.
Do you know how to check which mode support by ath11k?
Wen Gong Sept. 25, 2023, 10:57 a.m. UTC | #2
On 9/25/2023 6:52 PM, Aditya Kumar Singh wrote:
> On 9/25/23 16:13, Wen Gong wrote:
>> On 9/22/2023 9:18 PM, Aditya Kumar Singh wrote:
>>> On 9/22/23 15:32, Wen Gong wrote:
>>>> On 9/22/2023 5:39 PM, Aditya Kumar Singh wrote:
>>>>> On 9/20/23 13:53, Wen Gong wrote:
>>>>>
>>>>>> +    if (ath11k_mac_supports_6ghz_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;
>>>>> Why having _UNSET_ power type in vif->bss_conf.power_type is fine? 
>>>>> Typically, during association, we would be setting this from the 
>>>>> beacon/association response frame's HE 6 GHz Operation Info Field. 
>>>>> So is it fine if the field is carrying some info which we don't 
>>>>> know (or may be don't support it yet)? Why are we masking it with 
>>>>> _LPI_ mode?
>>>>>
>>>>> Also, I see that currently mac80211 only sets LPI or SP. So let's 
>>>>> say STA is trying to connect to VLP AP, mac80211 will set it as 
>>>>> _UNSET_. And then here, we will be treating it as LPI AP. Is that 
>>>>> fine?
>>>>
>>>> Currently only SP/LPI are defined in "Table E-12—Regulatory Info 
>>>> subfield encoding in the United States" of IEEE Std 802.11ax™‐2021.
>>>>
>>>> So maybe I need to set power_type to VLP when it is UNSET here.
>>> Yeah, or may be deny association if we don't support that mode? I 
>>> would let others comment on this.
>> Do you know how to check which mode support by ath11k?
> IMHO we should not maintain two different supported modes, one in 
> driver and another in mac80211. I mean w.r.t mac80211 we should try to 
> match it as far as possible. In this case, we can return error from 
> mac80211 itself when a non-supported mode (as in VLP) is trying to 
> associate? Since as you have quoted, VLP is not yet defined in spec 
> IEEE Std 802.11ax‐2021 so why to mask the mode and continue in 
> mac80211 itself?
>
> If we do like this, then mac80211 will not simply set _UNSET_ for 6 
> GHz client interface and in driver if we see its still _UNSET_ then we 
> can be sure that something has gone wrong and we can take steps 
> accordingly.
Yes, I will change to return fail for _UNSET_.