[PATCH 05/15] ath11k: store cur_regulatory_info for each radio
Kalle Valo
kvalo at kernel.org
Thu Dec 9 09:31:35 PST 2021
Wen Gong <quic_wgong at quicinc.com> writes:
> The regulatory info of WMI_REG_CHAN_LIST_CC_EXT_EVENTID is not saved
> in ath11k now, the info should be saved in ath11k. Save the info for
> each radio and support switch regulatory rules dynamically.
>
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
>
> Signed-off-by: Wen Gong <quic_wgong at quicinc.com>
> ---
> drivers/net/wireless/ath/ath11k/core.c | 9 ++
> drivers/net/wireless/ath/ath11k/core.h | 1 +
> drivers/net/wireless/ath/ath11k/mac.c | 11 +++
> drivers/net/wireless/ath/ath11k/mac.h | 2 +-
> drivers/net/wireless/ath/ath11k/wmi.c | 117 +++++++++++++++++--------
> drivers/net/wireless/ath/ath11k/wmi.h | 6 +-
> 6 files changed, 106 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
> index 66ceef24532d..d8ac26f730db 100644
> --- a/drivers/net/wireless/ath/ath11k/core.c
> +++ b/drivers/net/wireless/ath/ath11k/core.c
> @@ -1115,6 +1115,15 @@ EXPORT_SYMBOL(ath11k_core_deinit);
>
> void ath11k_core_free(struct ath11k_base *ab)
> {
> + if (ab) {
Why this check? Is someone calling ath11k_core_free() with NULL?
> + int i;
> +
> + for (i = 0; i < ab->num_radios; i++)
> + ath11k_reg_reset_info(&ab->reg_info_store[i]);
> +
> + kfree(ab->reg_info_store);
> + }
> +
I would expect ath11k_core_free() to free stuff allocated by
ath11k_core_alloc(), so I'm not sure if this is the right location. What
about ath11k_reg_free()?
> --- a/drivers/net/wireless/ath/ath11k/wmi.c
> +++ b/drivers/net/wireless/ath/ath11k/wmi.c
> @@ -4205,6 +4205,10 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc,
> soc->pdevs[0].pdev_id = 0;
> }
>
> + soc->reg_info_store = kcalloc(soc->num_radios,
> + sizeof(*soc->reg_info_store),
> + GFP_ATOMIC);
What if there are two events from firmware? That means the first
allocation is lost, no? I think there should be some kind of error checking.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
More information about the ath11k
mailing list