0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. From e238e62ba8868a784e485eb94451c87cd1b85cee Mon Sep 17 00:00:00 2001
  2. From: Aditya Kumar Singh <quic_adisi@quicinc.com>
  3. Date: Wed, 1 Mar 2023 16:20:59 +0200
  4. Subject: [PATCH] wifi: ath11k: add debug prints in regulatory WMI event
  5. processing
  6. Add some more debug prints in processing regulatory WMI event in order to
  7. increase more debuggability.
  8. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  9. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  10. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
  11. Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
  12. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  13. Link: https://lore.kernel.org/r/20230110121024.14051-4-quic_adisi@quicinc.com
  14. ---
  15. drivers/net/wireless/ath/ath11k/reg.c | 2 +-
  16. drivers/net/wireless/ath/ath11k/wmi.c | 207 ++++++++++++++++++--------
  17. drivers/net/wireless/ath/ath11k/wmi.h | 142 ++++++++++++++++++
  18. 3 files changed, 291 insertions(+), 60 deletions(-)
  19. --- a/drivers/net/wireless/ath/ath11k/reg.c
  20. +++ b/drivers/net/wireless/ath/ath11k/reg.c
  21. @@ -646,7 +646,7 @@ ath11k_reg_build_regd(struct ath11k_base
  22. tmp_regd->dfs_region = ath11k_map_fw_dfs_region(reg_info->dfs_region);
  23. ath11k_dbg(ab, ATH11K_DBG_REG,
  24. - "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
  25. + "Country %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
  26. alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region),
  27. reg_info->dfs_region, num_rules);
  28. /* Update reg_rules[] below. Firmware is expected to
  29. --- a/drivers/net/wireless/ath/ath11k/wmi.c
  30. +++ b/drivers/net/wireless/ath/ath11k/wmi.c
  31. @@ -4925,6 +4925,26 @@ static int ath11k_pull_vdev_start_resp_t
  32. return 0;
  33. }
  34. +static void ath11k_print_reg_rule(struct ath11k_base *ab, const char *band,
  35. + u32 num_reg_rules,
  36. + struct cur_reg_rule *reg_rule_ptr)
  37. +{
  38. + struct cur_reg_rule *reg_rule = reg_rule_ptr;
  39. + u32 count;
  40. +
  41. + ath11k_dbg(ab, ATH11K_DBG_WMI, "number of reg rules in %s band: %d\n",
  42. + band, num_reg_rules);
  43. +
  44. + for (count = 0; count < num_reg_rules; count++) {
  45. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  46. + "reg rule %d: (%d - %d @ %d) (%d, %d) (FLAGS %d)\n",
  47. + count + 1, reg_rule->start_freq, reg_rule->end_freq,
  48. + reg_rule->max_bw, reg_rule->ant_gain,
  49. + reg_rule->reg_power, reg_rule->flags);
  50. + reg_rule++;
  51. + }
  52. +}
  53. +
  54. static struct cur_reg_rule
  55. *create_reg_rules_from_wmi(u32 num_reg_rules,
  56. struct wmi_regulatory_rule_struct *wmi_reg_rule)
  57. @@ -5006,6 +5026,10 @@ static int ath11k_pull_reg_chan_list_upd
  58. reg_info->ctry_code = chan_list_event_hdr->country_id;
  59. reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
  60. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  61. + "status_code %s",
  62. + ath11k_cc_status_to_str(reg_info->status_code));
  63. +
  64. reg_info->status_code =
  65. ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code);
  66. @@ -5020,13 +5044,13 @@ static int ath11k_pull_reg_chan_list_upd
  67. num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules;
  68. ath11k_dbg(ab, ATH11K_DBG_WMI,
  69. - "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
  70. - __func__, reg_info->alpha2, reg_info->dfs_region,
  71. + "cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
  72. + reg_info->alpha2, reg_info->dfs_region,
  73. reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
  74. reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
  75. ath11k_dbg(ab, ATH11K_DBG_WMI,
  76. - "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__,
  77. + "num_2ghz_reg_rules %d num_5ghz_reg_rules %d",
  78. num_2ghz_reg_rules, num_5ghz_reg_rules);
  79. wmi_reg_rule =
  80. @@ -5043,6 +5067,10 @@ static int ath11k_pull_reg_chan_list_upd
  81. ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
  82. return -ENOMEM;
  83. }
  84. +
  85. + ath11k_print_reg_rule(ab, "2 GHz",
  86. + num_2ghz_reg_rules,
  87. + reg_info->reg_rules_2ghz_ptr);
  88. }
  89. if (num_5ghz_reg_rules) {
  90. @@ -5055,6 +5083,10 @@ static int ath11k_pull_reg_chan_list_upd
  91. ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
  92. return -ENOMEM;
  93. }
  94. +
  95. + ath11k_print_reg_rule(ab, "5 GHz",
  96. + num_5ghz_reg_rules,
  97. + reg_info->reg_rules_5ghz_ptr);
  98. }
  99. ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory channel list\n");
  100. @@ -5128,7 +5160,7 @@ static int ath11k_pull_reg_chan_list_ext
  101. struct cur_regulatory_info *reg_info)
  102. {
  103. const void **tb;
  104. - const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr;
  105. + const struct wmi_reg_chan_list_cc_ext_event *ev;
  106. struct wmi_regulatory_ext_rule *ext_wmi_reg_rule;
  107. u32 num_2ghz_reg_rules, num_5ghz_reg_rules;
  108. u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
  109. @@ -5145,31 +5177,29 @@ static int ath11k_pull_reg_chan_list_ext
  110. return ret;
  111. }
  112. - ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
  113. - if (!ext_chan_list_event_hdr) {
  114. + ev = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
  115. + if (!ev) {
  116. ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n");
  117. kfree(tb);
  118. return -EPROTO;
  119. }
  120. - reg_info->num_2ghz_reg_rules =
  121. - ext_chan_list_event_hdr->num_2ghz_reg_rules;
  122. - reg_info->num_5ghz_reg_rules =
  123. - ext_chan_list_event_hdr->num_5ghz_reg_rules;
  124. + reg_info->num_2ghz_reg_rules = ev->num_2ghz_reg_rules;
  125. + reg_info->num_5ghz_reg_rules = ev->num_5ghz_reg_rules;
  126. reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] =
  127. - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi;
  128. + ev->num_6ghz_reg_rules_ap_lpi;
  129. reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] =
  130. - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp;
  131. + ev->num_6ghz_reg_rules_ap_sp;
  132. reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] =
  133. - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp;
  134. + ev->num_6ghz_reg_rules_ap_vlp;
  135. for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
  136. reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] =
  137. - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i];
  138. + ev->num_6ghz_reg_rules_client_lpi[i];
  139. reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] =
  140. - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i];
  141. + ev->num_6ghz_reg_rules_client_sp[i];
  142. reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] =
  143. - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i];
  144. + ev->num_6ghz_reg_rules_client_vlp[i];
  145. }
  146. num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules;
  147. @@ -5231,57 +5261,79 @@ static int ath11k_pull_reg_chan_list_ext
  148. return -EINVAL;
  149. }
  150. - memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2,
  151. - REG_ALPHA2_LEN);
  152. + memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN);
  153. +
  154. + reg_info->dfs_region = ev->dfs_region;
  155. + reg_info->phybitmap = ev->phybitmap;
  156. + reg_info->num_phy = ev->num_phy;
  157. + reg_info->phy_id = ev->phy_id;
  158. + reg_info->ctry_code = ev->country_id;
  159. + reg_info->reg_dmn_pair = ev->domain_code;
  160. - reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region;
  161. - reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap;
  162. - reg_info->num_phy = ext_chan_list_event_hdr->num_phy;
  163. - reg_info->phy_id = ext_chan_list_event_hdr->phy_id;
  164. - reg_info->ctry_code = ext_chan_list_event_hdr->country_id;
  165. - reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code;
  166. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  167. + "status_code %s",
  168. + ath11k_cc_status_to_str(reg_info->status_code));
  169. reg_info->status_code =
  170. - ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code);
  171. + ath11k_wmi_cc_setting_code_to_reg(ev->status_code);
  172. reg_info->is_ext_reg_event = true;
  173. - reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz;
  174. - reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz;
  175. - reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz;
  176. - reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz;
  177. + reg_info->min_bw_2ghz = ev->min_bw_2ghz;
  178. + reg_info->max_bw_2ghz = ev->max_bw_2ghz;
  179. + reg_info->min_bw_5ghz = ev->min_bw_5ghz;
  180. + reg_info->max_bw_5ghz = ev->max_bw_5ghz;
  181. reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
  182. - ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi;
  183. + ev->min_bw_6ghz_ap_lpi;
  184. reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
  185. - ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi;
  186. + ev->max_bw_6ghz_ap_lpi;
  187. reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
  188. - ext_chan_list_event_hdr->min_bw_6ghz_ap_sp;
  189. + ev->min_bw_6ghz_ap_sp;
  190. reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
  191. - ext_chan_list_event_hdr->max_bw_6ghz_ap_sp;
  192. + ev->max_bw_6ghz_ap_sp;
  193. reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
  194. - ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp;
  195. + ev->min_bw_6ghz_ap_vlp;
  196. reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
  197. - ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp;
  198. + ev->max_bw_6ghz_ap_vlp;
  199. +
  200. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  201. + "6 GHz AP BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
  202. + reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP],
  203. + reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP],
  204. + reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
  205. + reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
  206. + reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP],
  207. + reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP]);
  208. for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
  209. reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
  210. - ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i];
  211. + ev->min_bw_6ghz_client_lpi[i];
  212. reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
  213. - ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i];
  214. + ev->max_bw_6ghz_client_lpi[i];
  215. reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
  216. - ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i];
  217. + ev->min_bw_6ghz_client_sp[i];
  218. reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
  219. - ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i];
  220. + ev->max_bw_6ghz_client_sp[i];
  221. reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
  222. - ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i];
  223. + ev->min_bw_6ghz_client_vlp[i];
  224. reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
  225. - ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i];
  226. + ev->max_bw_6ghz_client_vlp[i];
  227. +
  228. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  229. + "6 GHz %s BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
  230. + ath11k_6ghz_client_type_to_str(i),
  231. + reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
  232. + reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
  233. + reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
  234. + reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
  235. + reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i],
  236. + reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]);
  237. }
  238. ath11k_dbg(ab, ATH11K_DBG_WMI,
  239. - "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
  240. - __func__, reg_info->alpha2, reg_info->dfs_region,
  241. + "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
  242. + reg_info->alpha2, reg_info->dfs_region,
  243. reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
  244. reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
  245. @@ -5310,9 +5362,8 @@ static int ath11k_pull_reg_chan_list_ext
  246. num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]);
  247. ext_wmi_reg_rule =
  248. - (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr
  249. - + sizeof(*ext_chan_list_event_hdr)
  250. - + sizeof(struct wmi_tlv));
  251. + (struct wmi_regulatory_ext_rule *)((u8 *)ev + sizeof(*ev) +
  252. + sizeof(struct wmi_tlv));
  253. if (num_2ghz_reg_rules) {
  254. reg_info->reg_rules_2ghz_ptr =
  255. create_ext_reg_rules_from_wmi(num_2ghz_reg_rules,
  256. @@ -5323,6 +5374,10 @@ static int ath11k_pull_reg_chan_list_ext
  257. ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
  258. return -ENOMEM;
  259. }
  260. +
  261. + ath11k_print_reg_rule(ab, "2 GHz",
  262. + num_2ghz_reg_rules,
  263. + reg_info->reg_rules_2ghz_ptr);
  264. }
  265. ext_wmi_reg_rule += num_2ghz_reg_rules;
  266. @@ -5358,6 +5413,10 @@ static int ath11k_pull_reg_chan_list_ext
  267. ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
  268. return -ENOMEM;
  269. }
  270. +
  271. + ath11k_print_reg_rule(ab, "5 GHz",
  272. + num_5ghz_reg_rules,
  273. + reg_info->reg_rules_5ghz_ptr);
  274. }
  275. /* We have adjusted the number of 5 GHz reg rules above. But still those
  276. @@ -5378,10 +5437,17 @@ static int ath11k_pull_reg_chan_list_ext
  277. return -ENOMEM;
  278. }
  279. + ath11k_print_reg_rule(ab, ath11k_6ghz_ap_type_to_str(i),
  280. + num_6ghz_reg_rules_ap[i],
  281. + reg_info->reg_rules_6ghz_ap_ptr[i]);
  282. +
  283. ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i];
  284. }
  285. for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) {
  286. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  287. + "6 GHz AP type %s", ath11k_6ghz_ap_type_to_str(j));
  288. +
  289. for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
  290. reg_info->reg_rules_6ghz_client_ptr[j][i] =
  291. create_ext_reg_rules_from_wmi(num_6ghz_client[j][i],
  292. @@ -5393,35 +5459,58 @@ static int ath11k_pull_reg_chan_list_ext
  293. return -ENOMEM;
  294. }
  295. + ath11k_print_reg_rule(ab,
  296. + ath11k_6ghz_client_type_to_str(i),
  297. + num_6ghz_client[j][i],
  298. + reg_info->reg_rules_6ghz_client_ptr[j][i]);
  299. +
  300. ext_wmi_reg_rule += num_6ghz_client[j][i];
  301. }
  302. }
  303. - reg_info->client_type = ext_chan_list_event_hdr->client_type;
  304. - reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable;
  305. + reg_info->client_type = ev->client_type;
  306. + reg_info->rnr_tpe_usable = ev->rnr_tpe_usable;
  307. reg_info->unspecified_ap_usable =
  308. - ext_chan_list_event_hdr->unspecified_ap_usable;
  309. + ev->unspecified_ap_usable;
  310. reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] =
  311. - ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi;
  312. + ev->domain_code_6ghz_ap_lpi;
  313. reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
  314. - ext_chan_list_event_hdr->domain_code_6ghz_ap_sp;
  315. + ev->domain_code_6ghz_ap_sp;
  316. reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
  317. - ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp;
  318. + ev->domain_code_6ghz_ap_vlp;
  319. +
  320. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  321. + "6 GHz reg info client type %s rnr_tpe_usable %d unspecified_ap_usable %d AP sub domain: lpi %s, sp %s, vlp %s\n",
  322. + ath11k_6ghz_client_type_to_str(reg_info->client_type),
  323. + reg_info->rnr_tpe_usable,
  324. + reg_info->unspecified_ap_usable,
  325. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_lpi),
  326. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_sp),
  327. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_vlp));
  328. for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
  329. reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] =
  330. - ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i];
  331. + ev->domain_code_6ghz_client_lpi[i];
  332. reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
  333. - ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i];
  334. + ev->domain_code_6ghz_client_sp[i];
  335. reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
  336. - ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i];
  337. + ev->domain_code_6ghz_client_vlp[i];
  338. +
  339. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  340. + "6 GHz client type %s client sub domain: lpi %s, sp %s, vlp %s\n",
  341. + ath11k_6ghz_client_type_to_str(i),
  342. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_lpi[i]),
  343. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_sp[i]),
  344. + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_vlp[i])
  345. + );
  346. }
  347. - reg_info->domain_code_6ghz_super_id =
  348. - ext_chan_list_event_hdr->domain_code_6ghz_super_id;
  349. + reg_info->domain_code_6ghz_super_id = ev->domain_code_6ghz_super_id;
  350. - ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d",
  351. - reg_info->client_type, reg_info->domain_code_6ghz_super_id);
  352. + ath11k_dbg(ab, ATH11K_DBG_WMI,
  353. + "6 GHz client_type %s 6 GHz super domain %s",
  354. + ath11k_6ghz_client_type_to_str(reg_info->client_type),
  355. + ath11k_super_reg_6ghz_to_str(reg_info->domain_code_6ghz_super_id));
  356. ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n");
  357. --- a/drivers/net/wireless/ath/ath11k/wmi.h
  358. +++ b/drivers/net/wireless/ath/ath11k/wmi.h
  359. @@ -4139,6 +4139,7 @@ enum cc_setting_code {
  360. /* add new setting code above, update in
  361. * @enum wmi_reg_cc_setting_code as well.
  362. + * Also handle it in ath11k_cc_status_to_str()
  363. */
  364. };
  365. @@ -4163,21 +4164,162 @@ ath11k_wmi_cc_setting_code_to_reg(enum w
  366. return REG_SET_CC_STATUS_FAIL;
  367. }
  368. +static inline const char *ath11k_cc_status_to_str(enum cc_setting_code code)
  369. +{
  370. + switch (code) {
  371. + case REG_SET_CC_STATUS_PASS:
  372. + return "REG_SET_CC_STATUS_PASS";
  373. + case REG_CURRENT_ALPHA2_NOT_FOUND:
  374. + return "REG_CURRENT_ALPHA2_NOT_FOUND";
  375. + case REG_INIT_ALPHA2_NOT_FOUND:
  376. + return "REG_INIT_ALPHA2_NOT_FOUND";
  377. + case REG_SET_CC_CHANGE_NOT_ALLOWED:
  378. + return "REG_SET_CC_CHANGE_NOT_ALLOWED";
  379. + case REG_SET_CC_STATUS_NO_MEMORY:
  380. + return "REG_SET_CC_STATUS_NO_MEMORY";
  381. + case REG_SET_CC_STATUS_FAIL:
  382. + return "REG_SET_CC_STATUS_FAIL";
  383. + }
  384. +
  385. + return "Unknown CC status";
  386. +}
  387. +
  388. enum wmi_reg_6ghz_ap_type {
  389. WMI_REG_INDOOR_AP = 0,
  390. WMI_REG_STANDARD_POWER_AP = 1,
  391. WMI_REG_VERY_LOW_POWER_AP = 2,
  392. + /* add AP type above, handle in ath11k_6ghz_ap_type_to_str()
  393. + */
  394. WMI_REG_CURRENT_MAX_AP_TYPE,
  395. WMI_REG_MAX_AP_TYPE = 7,
  396. };
  397. +static inline const char *
  398. +ath11k_6ghz_ap_type_to_str(enum wmi_reg_6ghz_ap_type type)
  399. +{
  400. + switch (type) {
  401. + case WMI_REG_INDOOR_AP:
  402. + return "INDOOR AP";
  403. + case WMI_REG_STANDARD_POWER_AP:
  404. + return "STANDARD POWER AP";
  405. + case WMI_REG_VERY_LOW_POWER_AP:
  406. + return "VERY LOW POWER AP";
  407. + case WMI_REG_CURRENT_MAX_AP_TYPE:
  408. + return "CURRENT_MAX_AP_TYPE";
  409. + case WMI_REG_MAX_AP_TYPE:
  410. + return "MAX_AP_TYPE";
  411. + }
  412. +
  413. + return "unknown 6 GHz AP type";
  414. +}
  415. +
  416. enum wmi_reg_6ghz_client_type {
  417. WMI_REG_DEFAULT_CLIENT = 0,
  418. WMI_REG_SUBORDINATE_CLIENT = 1,
  419. WMI_REG_MAX_CLIENT_TYPE = 2,
  420. +
  421. + /* add client type above, handle it in
  422. + * ath11k_6ghz_client_type_to_str()
  423. + */
  424. +};
  425. +
  426. +static inline const char *
  427. +ath11k_6ghz_client_type_to_str(enum wmi_reg_6ghz_client_type type)
  428. +{
  429. + switch (type) {
  430. + case WMI_REG_DEFAULT_CLIENT:
  431. + return "DEFAULT CLIENT";
  432. + case WMI_REG_SUBORDINATE_CLIENT:
  433. + return "SUBORDINATE CLIENT";
  434. + case WMI_REG_MAX_CLIENT_TYPE:
  435. + return "MAX_CLIENT_TYPE";
  436. + }
  437. +
  438. + return "unknown 6 GHz client type";
  439. +}
  440. +
  441. +enum reg_subdomains_6ghz {
  442. + EMPTY_6GHZ = 0x0,
  443. + FCC1_CLIENT_LPI_REGULAR_6GHZ = 0x01,
  444. + FCC1_CLIENT_SP_6GHZ = 0x02,
  445. + FCC1_AP_LPI_6GHZ = 0x03,
  446. + FCC1_CLIENT_LPI_SUBORDINATE = FCC1_AP_LPI_6GHZ,
  447. + FCC1_AP_SP_6GHZ = 0x04,
  448. + ETSI1_LPI_6GHZ = 0x10,
  449. + ETSI1_VLP_6GHZ = 0x11,
  450. + ETSI2_LPI_6GHZ = 0x12,
  451. + ETSI2_VLP_6GHZ = 0x13,
  452. + APL1_LPI_6GHZ = 0x20,
  453. + APL1_VLP_6GHZ = 0x21,
  454. +
  455. + /* add sub-domain above, handle it in
  456. + * ath11k_sub_reg_6ghz_to_str()
  457. + */
  458. +};
  459. +
  460. +static inline const char *
  461. +ath11k_sub_reg_6ghz_to_str(enum reg_subdomains_6ghz sub_id)
  462. +{
  463. + switch (sub_id) {
  464. + case EMPTY_6GHZ:
  465. + return "N/A";
  466. + case FCC1_CLIENT_LPI_REGULAR_6GHZ:
  467. + return "FCC1_CLIENT_LPI_REGULAR_6GHZ";
  468. + case FCC1_CLIENT_SP_6GHZ:
  469. + return "FCC1_CLIENT_SP_6GHZ";
  470. + case FCC1_AP_LPI_6GHZ:
  471. + return "FCC1_AP_LPI_6GHZ/FCC1_CLIENT_LPI_SUBORDINATE";
  472. + case FCC1_AP_SP_6GHZ:
  473. + return "FCC1_AP_SP_6GHZ";
  474. + case ETSI1_LPI_6GHZ:
  475. + return "ETSI1_LPI_6GHZ";
  476. + case ETSI1_VLP_6GHZ:
  477. + return "ETSI1_VLP_6GHZ";
  478. + case ETSI2_LPI_6GHZ:
  479. + return "ETSI2_LPI_6GHZ";
  480. + case ETSI2_VLP_6GHZ:
  481. + return "ETSI2_VLP_6GHZ";
  482. + case APL1_LPI_6GHZ:
  483. + return "APL1_LPI_6GHZ";
  484. + case APL1_VLP_6GHZ:
  485. + return "APL1_VLP_6GHZ";
  486. + }
  487. +
  488. + return "unknown sub reg id";
  489. +}
  490. +
  491. +enum reg_super_domain_6ghz {
  492. + FCC1_6GHZ = 0x01,
  493. + ETSI1_6GHZ = 0x02,
  494. + ETSI2_6GHZ = 0x03,
  495. + APL1_6GHZ = 0x04,
  496. + FCC1_6GHZ_CL = 0x05,
  497. +
  498. + /* add super domain above, handle it in
  499. + * ath11k_super_reg_6ghz_to_str()
  500. + */
  501. };
  502. +static inline const char *
  503. +ath11k_super_reg_6ghz_to_str(enum reg_super_domain_6ghz domain_id)
  504. +{
  505. + switch (domain_id) {
  506. + case FCC1_6GHZ:
  507. + return "FCC1_6GHZ";
  508. + case ETSI1_6GHZ:
  509. + return "ETSI1_6GHZ";
  510. + case ETSI2_6GHZ:
  511. + return "ETSI2_6GHZ";
  512. + case APL1_6GHZ:
  513. + return "APL1_6GHZ";
  514. + case FCC1_6GHZ_CL:
  515. + return "FCC1_6GHZ_CL";
  516. + }
  517. +
  518. + return "unknown domain id";
  519. +}
  520. +
  521. struct cur_reg_rule {
  522. u16 start_freq;
  523. u16 end_freq;