wifi: ath12k: add parsing of phy bitmap for reg rules
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 10 Oct 2023 07:27:19 +0000 (10:27 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 12 Oct 2023 16:05:38 +0000 (19:05 +0300)
Certain regulatory domains could put restrictions on phy mode operation.
For example, in a few countries HE/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.

While at it, correct typo in debug print: s/dsf/dfs.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231004092818.25130-1-quic_adisi@quicinc.com
drivers/net/wireless/ath/ath12k/reg.c
drivers/net/wireless/ath/ath12k/reg.h
drivers/net/wireless/ath/ath12k/wmi.c

index 6ede91ebc8e169782047a82baf04b7299efe9dd8..5c006256c82ad16ad8c1045629e97987da59aae3 100644 (file)
@@ -314,6 +314,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;
+}
+
 static bool
 ath12k_reg_can_intersect(struct ieee80211_reg_rule *rule1,
                         struct ieee80211_reg_rule *rule2)
@@ -638,6 +651,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(tmp_regd->reg_rules + i,
                                       reg_rule->start_freq,
index 56d009a472343910078abb8abab806c66a76334b..35569f03042d3dd7d59731b4cf7782fcb9ffc0e8 100644 (file)
@@ -83,6 +83,12 @@ struct ath12k_reg_info {
                [WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
 };
 
+/* Phy bitmaps */
+enum ath12k_reg_phy_bitmap {
+       ATH12K_REG_PHY_BITMAP_NO11AX    = BIT(5),
+       ATH12K_REG_PHY_BITMAP_NO11BE    = BIT(6),
+};
+
 void ath12k_reg_init(struct ath12k *ar);
 void ath12k_reg_free(struct ath12k_base *ab);
 void ath12k_regd_update_work(struct work_struct *work);
index 80b3d51387b87362d4de694a6856eceeeae676a1..1cac0135a1bc2f0e8a0f55ef3a6aee4bc424953f 100644 (file)
@@ -4611,10 +4611,11 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab,
        }
 
        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 dfs %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",