2024-02-08 16:59:09

by Miri Korenblit

[permalink] [raw]
Subject: [PATCH 01/13] wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory

From: Mukesh Sisodiya <[email protected]>

6 GHz STA supports different power types as LPI, SP, VLP.
and this information is provided by regulatory info.

Add support in driver to parse the power type capability in
regulatory info from FW and set it to the channel flags.

Signed-off-by: Mukesh Sisodiya <[email protected]>
Reviewed-by: Gregory Greenman <[email protected]>
Signed-off-by: Miri Korenblit <[email protected]>
---
.../wireless/intel/iwlwifi/iwl-nvm-parse.c | 33 ++++++++++++++++---
.../wireless/intel/iwlwifi/iwl-nvm-parse.h | 2 +-
.../net/wireless/intel/iwlwifi/mvm/mac80211.c | 3 +-
3 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index d2f133255ee6..baa39a18087a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -156,6 +156,8 @@ static struct ieee80211_rate iwl_cfg80211_rates[] = {
* @NVM_CHANNEL_80MHZ: 80 MHz channel okay
* @NVM_CHANNEL_160MHZ: 160 MHz channel okay
* @NVM_CHANNEL_DC_HIGH: DC HIGH required/allowed (?)
+ * @NVM_CHANNEL_VLP: client support connection to UHB VLP AP
+ * @NVM_CHANNEL_AFC: client support connection to UHB AFC AP
*/
enum iwl_nvm_channel_flags {
NVM_CHANNEL_VALID = BIT(0),
@@ -170,6 +172,8 @@ enum iwl_nvm_channel_flags {
NVM_CHANNEL_80MHZ = BIT(10),
NVM_CHANNEL_160MHZ = BIT(11),
NVM_CHANNEL_DC_HIGH = BIT(12),
+ NVM_CHANNEL_VLP = BIT(13),
+ NVM_CHANNEL_AFC = BIT(14),
};

/**
@@ -309,7 +313,7 @@ static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,

/* Note: already can print up to 101 characters, 110 is the limit! */
IWL_DEBUG_DEV(dev, level,
- "Ch. %d: 0x%x:%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "Ch. %d: 0x%x:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
chan, flags,
CHECK_AND_PRINT_I(VALID),
CHECK_AND_PRINT_I(IBSS),
@@ -322,7 +326,9 @@ static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
CHECK_AND_PRINT_I(40MHZ),
CHECK_AND_PRINT_I(80MHZ),
CHECK_AND_PRINT_I(160MHZ),
- CHECK_AND_PRINT_I(DC_HIGH));
+ CHECK_AND_PRINT_I(DC_HIGH),
+ CHECK_AND_PRINT_I(VLP),
+ CHECK_AND_PRINT_I(AFC));
#undef CHECK_AND_PRINT_I
}

@@ -366,6 +372,12 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, enum nl80211_band band,
(flags & IEEE80211_CHAN_NO_IR))
flags |= IEEE80211_CHAN_IR_CONCURRENT;

+ /* Set the AP type for the UHB case. */
+ if (!(nvm_flags & NVM_CHANNEL_VLP))
+ flags |= IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT;
+ if (!(nvm_flags & NVM_CHANNEL_AFC))
+ flags |= IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT;
+
return flags;
}

@@ -1600,7 +1612,8 @@ IWL_EXPORT_SYMBOL(iwl_parse_nvm_data);
static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
int ch_idx, u16 nvm_flags,
struct iwl_reg_capa reg_capa,
- const struct iwl_cfg *cfg)
+ const struct iwl_cfg *cfg,
+ bool uats_enabled)
{
u32 flags = NL80211_RRF_NO_HT40;

@@ -1645,6 +1658,16 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
flags &= ~NL80211_RRF_NO_IR;
}
}
+
+ /* Set the AP type for the UHB case. */
+ if (uats_enabled) {
+ if (!(nvm_flags & NVM_CHANNEL_VLP))
+ flags |= NL80211_RRF_NO_6GHZ_VLP_CLIENT;
+
+ if (!(nvm_flags & NVM_CHANNEL_AFC))
+ flags |= NL80211_RRF_NO_6GHZ_AFC_CLIENT;
+ }
+
/*
* reg_capa is per regulatory domain so apply it for every channel
*/
@@ -1699,7 +1722,7 @@ static struct iwl_reg_capa iwl_get_reg_capa(u32 flags, u8 resp_ver)
struct ieee80211_regdomain *
iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
int num_of_ch, __le32 *channels, u16 fw_mcc,
- u16 geo_info, u32 cap, u8 resp_ver)
+ u16 geo_info, u32 cap, u8 resp_ver, bool uats_enabled)
{
int ch_idx;
u16 ch_flags;
@@ -1765,7 +1788,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,

reg_rule_flags = iwl_nvm_get_regdom_bw_flags(nvm_chan, ch_idx,
ch_flags, reg_capa,
- cfg);
+ cfg, uats_enabled);

/* we can't continue the same rule */
if (ch_idx == 0 || prev_reg_rule_flags != reg_rule_flags ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
index 651ed25b683b..fd9c3bed9407 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
@@ -50,7 +50,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
struct ieee80211_regdomain *
iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
int num_of_ch, __le32 *channels, u16 fw_mcc,
- u16 geo_info, u32 cap, u8 resp_ver);
+ u16 geo_info, u32 cap, u8 resp_ver, bool uats_enabled);

/**
* struct iwl_nvm_section - describes an NVM section in memory.
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index a051e0c955d5..4a6b4f82eab4 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -138,7 +138,8 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
resp->channels,
__le16_to_cpu(resp->mcc),
__le16_to_cpu(resp->geo_info),
- le32_to_cpu(resp->cap), resp_ver);
+ le32_to_cpu(resp->cap), resp_ver,
+ mvm->fwrt.uats_enabled);
/* Store the return source id */
src_id = resp->source_id;
if (IS_ERR_OR_NULL(regd)) {
--
2.34.1



2024-02-09 03:40:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 01/13] wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory

Hi Miri,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.8-rc3 next-20240208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Miri-Korenblit/wifi-iwlwifi-nvm-parse-the-VLP-AFC-bit-from-regulatory/20240209-010143
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link: https://lore.kernel.org/r/20240208185302.9c6a4acabdb3.I501de5c0d86b9702bf61158a2e91c954a1da9a2a%40changeid
patch subject: [PATCH 01/13] wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240209/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240209/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c: In function 'iwl_get_channel_flags':
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:377:26: error: 'IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT' undeclared (first use in this function); did you mean 'IEEE80211_CHAN_NO_UHB_VLP_CLIENT'?
377 | flags |= IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| IEEE80211_CHAN_NO_UHB_VLP_CLIENT
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:377:26: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:379:26: error: 'IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT' undeclared (first use in this function); did you mean 'IEEE80211_CHAN_NO_UHB_AFC_CLIENT'?
379 | flags |= IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| IEEE80211_CHAN_NO_UHB_AFC_CLIENT
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c: In function 'iwl_nvm_get_regdom_bw_flags':
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:1665:34: error: 'NL80211_RRF_NO_6GHZ_VLP_CLIENT' undeclared (first use in this function); did you mean 'NL80211_RRF_NO_UHB_VLP_CLIENT'?
1665 | flags |= NL80211_RRF_NO_6GHZ_VLP_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NL80211_RRF_NO_UHB_VLP_CLIENT
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:1668:34: error: 'NL80211_RRF_NO_6GHZ_AFC_CLIENT' undeclared (first use in this function); did you mean 'NL80211_RRF_NO_UHB_AFC_CLIENT'?
1668 | flags |= NL80211_RRF_NO_6GHZ_AFC_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NL80211_RRF_NO_UHB_AFC_CLIENT


vim +377 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

334
335 static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, enum nl80211_band band,
336 u32 nvm_flags, const struct iwl_cfg *cfg)
337 {
338 u32 flags = IEEE80211_CHAN_NO_HT40;
339
340 if (band == NL80211_BAND_2GHZ && (nvm_flags & NVM_CHANNEL_40MHZ)) {
341 if (ch_num <= LAST_2GHZ_HT_PLUS)
342 flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
343 if (ch_num >= FIRST_2GHZ_HT_MINUS)
344 flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
345 } else if (nvm_flags & NVM_CHANNEL_40MHZ) {
346 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
347 flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
348 else
349 flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
350 }
351 if (!(nvm_flags & NVM_CHANNEL_80MHZ))
352 flags |= IEEE80211_CHAN_NO_80MHZ;
353 if (!(nvm_flags & NVM_CHANNEL_160MHZ))
354 flags |= IEEE80211_CHAN_NO_160MHZ;
355
356 if (!(nvm_flags & NVM_CHANNEL_IBSS))
357 flags |= IEEE80211_CHAN_NO_IR;
358
359 if (!(nvm_flags & NVM_CHANNEL_ACTIVE))
360 flags |= IEEE80211_CHAN_NO_IR;
361
362 if (nvm_flags & NVM_CHANNEL_RADAR)
363 flags |= IEEE80211_CHAN_RADAR;
364
365 if (nvm_flags & NVM_CHANNEL_INDOOR_ONLY)
366 flags |= IEEE80211_CHAN_INDOOR_ONLY;
367
368 /* Set the GO concurrent flag only in case that NO_IR is set.
369 * Otherwise it is meaningless
370 */
371 if ((nvm_flags & NVM_CHANNEL_GO_CONCURRENT) &&
372 (flags & IEEE80211_CHAN_NO_IR))
373 flags |= IEEE80211_CHAN_IR_CONCURRENT;
374
375 /* Set the AP type for the UHB case. */
376 if (!(nvm_flags & NVM_CHANNEL_VLP))
> 377 flags |= IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT;
378 if (!(nvm_flags & NVM_CHANNEL_AFC))
> 379 flags |= IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT;
380
381 return flags;
382 }
383

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-02-10 13:44:53

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 01/13] wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory

Hi Miri,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.8-rc3 next-20240209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Miri-Korenblit/wifi-iwlwifi-nvm-parse-the-VLP-AFC-bit-from-regulatory/20240209-010143
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link: https://lore.kernel.org/r/20240208185302.9c6a4acabdb3.I501de5c0d86b9702bf61158a2e91c954a1da9a2a%40changeid
patch subject: [PATCH 01/13] wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240210/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 7dd790db8b77c4a833c06632e903dc4f13877a64)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240210/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:377:12: error: use of undeclared identifier 'IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT'; did you mean 'IEEE80211_CHAN_NO_UHB_VLP_CLIENT'?
377 | flags |= IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| IEEE80211_CHAN_NO_UHB_VLP_CLIENT
include/net/cfg80211.h:149:2: note: 'IEEE80211_CHAN_NO_UHB_VLP_CLIENT' declared here
149 | IEEE80211_CHAN_NO_UHB_VLP_CLIENT= 1<<22,
| ^
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:379:12: error: use of undeclared identifier 'IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT'; did you mean 'IEEE80211_CHAN_NO_UHB_AFC_CLIENT'?
379 | flags |= IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| IEEE80211_CHAN_NO_UHB_AFC_CLIENT
include/net/cfg80211.h:150:2: note: 'IEEE80211_CHAN_NO_UHB_AFC_CLIENT' declared here
150 | IEEE80211_CHAN_NO_UHB_AFC_CLIENT= 1<<23,
| ^
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:1665:13: error: use of undeclared identifier 'NL80211_RRF_NO_6GHZ_VLP_CLIENT'; did you mean 'NL80211_RRF_NO_UHB_VLP_CLIENT'?
1665 | flags |= NL80211_RRF_NO_6GHZ_VLP_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NL80211_RRF_NO_UHB_VLP_CLIENT
include/uapi/linux/nl80211.h:4543:2: note: 'NL80211_RRF_NO_UHB_VLP_CLIENT' declared here
4543 | NL80211_RRF_NO_UHB_VLP_CLIENT = 1<<22,
| ^
>> drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c:1668:13: error: use of undeclared identifier 'NL80211_RRF_NO_6GHZ_AFC_CLIENT'; did you mean 'NL80211_RRF_NO_UHB_AFC_CLIENT'?
1668 | flags |= NL80211_RRF_NO_6GHZ_AFC_CLIENT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| NL80211_RRF_NO_UHB_AFC_CLIENT
include/uapi/linux/nl80211.h:4544:2: note: 'NL80211_RRF_NO_UHB_AFC_CLIENT' declared here
4544 | NL80211_RRF_NO_UHB_AFC_CLIENT = 1<<23,
| ^
4 errors generated.


vim +377 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

334
335 static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, enum nl80211_band band,
336 u32 nvm_flags, const struct iwl_cfg *cfg)
337 {
338 u32 flags = IEEE80211_CHAN_NO_HT40;
339
340 if (band == NL80211_BAND_2GHZ && (nvm_flags & NVM_CHANNEL_40MHZ)) {
341 if (ch_num <= LAST_2GHZ_HT_PLUS)
342 flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
343 if (ch_num >= FIRST_2GHZ_HT_MINUS)
344 flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
345 } else if (nvm_flags & NVM_CHANNEL_40MHZ) {
346 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0)
347 flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
348 else
349 flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
350 }
351 if (!(nvm_flags & NVM_CHANNEL_80MHZ))
352 flags |= IEEE80211_CHAN_NO_80MHZ;
353 if (!(nvm_flags & NVM_CHANNEL_160MHZ))
354 flags |= IEEE80211_CHAN_NO_160MHZ;
355
356 if (!(nvm_flags & NVM_CHANNEL_IBSS))
357 flags |= IEEE80211_CHAN_NO_IR;
358
359 if (!(nvm_flags & NVM_CHANNEL_ACTIVE))
360 flags |= IEEE80211_CHAN_NO_IR;
361
362 if (nvm_flags & NVM_CHANNEL_RADAR)
363 flags |= IEEE80211_CHAN_RADAR;
364
365 if (nvm_flags & NVM_CHANNEL_INDOOR_ONLY)
366 flags |= IEEE80211_CHAN_INDOOR_ONLY;
367
368 /* Set the GO concurrent flag only in case that NO_IR is set.
369 * Otherwise it is meaningless
370 */
371 if ((nvm_flags & NVM_CHANNEL_GO_CONCURRENT) &&
372 (flags & IEEE80211_CHAN_NO_IR))
373 flags |= IEEE80211_CHAN_IR_CONCURRENT;
374
375 /* Set the AP type for the UHB case. */
376 if (!(nvm_flags & NVM_CHANNEL_VLP))
> 377 flags |= IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT;
378 if (!(nvm_flags & NVM_CHANNEL_AFC))
> 379 flags |= IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT;
380
381 return flags;
382 }
383

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki