wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/832-003-wifi-ath12k-add-parsing-of-phy-bitmap-for-reg-rules.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

98 lines
3.6 KiB
Diff

From 59dbb644d048926b534713b532bb149fe58455e6 Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Wed, 6 Sep 2023 10:15:31 +0530
Subject: [PATCH] wifi: ath12k: add parsing of phy bitmap for reg rules
Certain regulatory domains could put restrictions on phy mode operation.
For example, in a few countries EHT Operation is not allowed. For such
countries, firmware indicates this via phy bitmap in each reg rule.
Currently, there is no logic to parse this info and then pass it on to the
cfg80211/regulatory.
Add parsing of this phy bitmap from the regulatory channel change event and
then accordingly map it to cfg80211/regulatory flags and pass it on to it.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
drivers/net/wireless/ath/ath12k/reg.c | 14 ++++++++++++++
drivers/net/wireless/ath/ath12k/reg.h | 11 +++++++++++
drivers/net/wireless/ath/ath12k/wmi.c | 5 +++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c
index 92c808628a27..5ac1b2f9c8bf 100644
--- a/drivers/net/wireless/ath/ath12k/reg.c
+++ b/drivers/net/wireless/ath/ath12k/reg.c
@@ -580,6 +580,19 @@ static u32 ath12k_map_fw_reg_flags(u16 reg_flags)
return flags;
}
+static u32 ath12k_map_fw_phy_flags(u32 phy_flags)
+{
+ u32 flags = 0;
+
+ if (phy_flags & ATH12K_REG_PHY_BITMAP_NO11AX)
+ flags |= NL80211_RRF_NO_HE;
+
+ if (phy_flags & ATH12K_REG_PHY_BITMAP_NO11BE)
+ flags |= NL80211_RRF_NO_EHT;
+
+ return flags;
+}
+
/* TODO: API ath12k_reg_can_intersect() to handle whether two
* ieee80211_reg_rules can intersect or not based on their
* frequency range and power mode. */
@@ -841,6 +854,7 @@ ath12k_reg_build_regd(struct ath12k_base *ab,
}
flags |= ath12k_map_fw_reg_flags(reg_rule->flags);
+ flags |= ath12k_map_fw_phy_flags(reg_info->phybitmap);
ath12k_reg_update_rule(new_regd->reg_rules + i,
reg_rule->start_freq,
diff --git a/drivers/net/wireless/ath/ath12k/reg.h b/drivers/net/wireless/ath/ath12k/reg.h
index 43edd7158077..9d9e4eb2e76e 100644
--- a/drivers/net/wireless/ath/ath12k/reg.h
+++ b/drivers/net/wireless/ath/ath12k/reg.h
@@ -25,6 +25,17 @@ enum ath12k_dfs_region {
ATH12K_DFS_REG_UNDEF,
};
+/* Phybitmap supported in Firmware */
+enum ath12k_reg_phy_bitmap {
+ ATH12K_REG_PHY_BITMAP_NO11A = 0x0001,
+ ATH12K_REG_PHY_BITMAP_NO11B = 0x0002,
+ ATH12K_REG_PHY_BITMAP_NO11G = 0x0004,
+ ATH12K_REG_PHY_BITMAP_NO11N = 0x0008,
+ ATH12K_REG_PHY_BITMAP_NO11AC = 0x0010,
+ ATH12K_REG_PHY_BITMAP_NO11AX = 0x0020,
+ ATH12K_REG_PHY_BITMAP_NO11BE = 0x0040,
+};
+
/* ATH12K Regulatory API's */
void ath12k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request);
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 7be216a4d739..5cb1cb85b0b9 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -6687,10 +6687,11 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab,
ath12k_cc_status_to_str(reg_info->status_code));
ath12k_dbg(ab, ATH12K_DBG_WMI,
- "%s:cc_ext %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d",
+ "%s:cc_ext %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d phy_bitmap: 0x%x",
__func__, reg_info->alpha2, reg_info->dfs_region,
reg_info->min_bw_2g, reg_info->max_bw_2g,
- reg_info->min_bw_5g, reg_info->max_bw_5g);
+ reg_info->min_bw_5g, reg_info->max_bw_5g,
+ reg_info->phybitmap);
ath12k_dbg(ab, ATH12K_DBG_WMI,
"num_2g_reg_rules %d num_5g_reg_rules %d",
--
2.17.1