0029-wifi-ath11k-add-parsing-of-phy-bitmap-for-reg-rules.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From 534c2dd8099a9cc4bad8ea8b3c7fa1f730e10d5d Mon Sep 17 00:00:00 2001
  2. From: Aditya Kumar Singh <[email protected]>
  3. Date: Tue, 10 Oct 2023 10:27:19 +0300
  4. Subject: [PATCH] wifi: ath11k: add parsing of phy bitmap for reg rules
  5. Certain regulatory domains could put restrictions on phy mode operation.
  6. For example, in a few countries HE Operation is not allowed. For such
  7. countries, firmware indicates this via phy bitmap in each reg rule.
  8. Currently, there is no logic to parse this info and then pass it on to the
  9. cfg80211/regulatory.
  10. Add parsing of this phy bitmap from the regulatory channel change event and
  11. then accordingly map it to cfg80211/regulatory flags and pass it on to it.
  12. While at it, correct typo in debug print s/dsf/dfs.
  13. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  14. Signed-off-by: Aditya Kumar Singh <[email protected]>
  15. Acked-by: Jeff Johnson <[email protected]>
  16. Signed-off-by: Kalle Valo <[email protected]>
  17. Link: https://lore.kernel.org/r/[email protected]
  18. ---
  19. drivers/net/wireless/ath/ath11k/reg.c | 11 +++++++++++
  20. drivers/net/wireless/ath/ath11k/reg.h | 3 +++
  21. drivers/net/wireless/ath/ath11k/wmi.c | 5 +++--
  22. 3 files changed, 17 insertions(+), 2 deletions(-)
  23. --- a/drivers/net/wireless/ath/ath11k/reg.c
  24. +++ b/drivers/net/wireless/ath/ath11k/reg.c
  25. @@ -352,6 +352,16 @@ static u32 ath11k_map_fw_reg_flags(u16 r
  26. return flags;
  27. }
  28. +static u32 ath11k_map_fw_phy_flags(u32 phy_flags)
  29. +{
  30. + u32 flags = 0;
  31. +
  32. + if (phy_flags & ATH11K_REG_PHY_BITMAP_NO11AX)
  33. + flags |= NL80211_RRF_NO_HE;
  34. +
  35. + return flags;
  36. +}
  37. +
  38. static bool
  39. ath11k_reg_can_intersect(struct ieee80211_reg_rule *rule1,
  40. struct ieee80211_reg_rule *rule2)
  41. @@ -685,6 +695,7 @@ ath11k_reg_build_regd(struct ath11k_base
  42. }
  43. flags |= ath11k_map_fw_reg_flags(reg_rule->flags);
  44. + flags |= ath11k_map_fw_phy_flags(reg_info->phybitmap);
  45. ath11k_reg_update_rule(tmp_regd->reg_rules + i,
  46. reg_rule->start_freq,
  47. --- a/drivers/net/wireless/ath/ath11k/reg.h
  48. +++ b/drivers/net/wireless/ath/ath11k/reg.h
  49. @@ -24,6 +24,9 @@ enum ath11k_dfs_region {
  50. ATH11K_DFS_REG_UNDEF,
  51. };
  52. +/* Phy bitmaps */
  53. +#define ATH11K_REG_PHY_BITMAP_NO11AX BIT(5)
  54. +
  55. /* ATH11K Regulatory API's */
  56. void ath11k_reg_init(struct ath11k *ar);
  57. void ath11k_reg_free(struct ath11k_base *ab);
  58. --- a/drivers/net/wireless/ath/ath11k/wmi.c
  59. +++ b/drivers/net/wireless/ath/ath11k/wmi.c
  60. @@ -5440,10 +5440,11 @@ static int ath11k_pull_reg_chan_list_ext
  61. }
  62. ath11k_dbg(ab, ATH11K_DBG_WMI,
  63. - "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
  64. + "cc_ext %s dfs %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d phy_bitmap 0x%x",
  65. reg_info->alpha2, reg_info->dfs_region,
  66. reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
  67. - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
  68. + reg_info->min_bw_5ghz, reg_info->max_bw_5ghz,
  69. + reg_info->phybitmap);
  70. ath11k_dbg(ab, ATH11K_DBG_WMI,
  71. "num_2ghz_reg_rules %d num_5ghz_reg_rules %d",