wifi: iwlwifi: cfg: clean up Sc/Dr/Br configs

For now, the WH and PE radios require the same config as
FM, so just add a #define for those instead of copying
the data. Since this is true, Sc/Dr/Br all used the same
configs for all RF types, but that's confusing, so now
use the defined WH/PE names for the correct combinations.

We can also now enable the unit test that ensures we have
no duplicate RF configs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250509104454.2582160-8-miriam.rachel.korenblit@intel.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
This commit is contained in:
Johannes Berg 2025-05-09 13:44:46 +03:00 committed by Miri Korenblit
parent 7225a6a245
commit fe80b0e53d
5 changed files with 22 additions and 75 deletions

View File

@ -14,9 +14,6 @@
/* Lowest firmware API version supported */
#define IWL_DR_UCODE_API_MIN 97
/* NVM versions */
#define IWL_DR_NVM_VERSION 0x0a1d
/* Memory offsets and lengths */
#define IWL_DR_SMEM_OFFSET 0x400000
#define IWL_DR_SMEM_LEN 0xD0000
@ -86,21 +83,6 @@ static const struct iwl_family_base_params iwl_dr_base = {
.ucode_api_min = IWL_DR_UCODE_API_MIN,
};
#define IWL_DEVICE_DR \
.led_mode = IWL_LED_RF_STATE, \
.non_shared_ant = ANT_B, \
.vht_mu_mimo_supported = true, \
.nvm_ver = IWL_DR_NVM_VERSION, \
.nvm_type = IWL_NVM_EXT, \
.uhb_supported = true, \
.num_rbds = IWL_NUM_RBDS_EHT, \
.ht_params = { \
.stbc = true, \
.ldpc = true, \
.ht40_bands = BIT(NL80211_BAND_2GHZ) | \
BIT(NL80211_BAND_5GHZ), \
}
const struct iwl_mac_cfg iwl_dr_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_DR,
.base = &iwl_dr_base,
@ -115,10 +97,6 @@ const struct iwl_mac_cfg iwl_dr_mac_cfg = {
const char iwl_dr_name[] = "Intel(R) TBD Dr device";
const struct iwl_cfg iwl_cfg_dr = {
IWL_DEVICE_DR,
};
const struct iwl_mac_cfg iwl_br_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_DR,
.base = &iwl_dr_base,

View File

@ -93,21 +93,6 @@ static const struct iwl_family_base_params iwl_sc_base = {
.ucode_api_min = IWL_SC_UCODE_API_MIN,
};
#define IWL_DEVICE_SC \
.led_mode = IWL_LED_RF_STATE, \
.non_shared_ant = ANT_B, \
.vht_mu_mimo_supported = true, \
.nvm_ver = IWL_SC_NVM_VERSION, \
.nvm_type = IWL_NVM_EXT, \
.uhb_supported = true, \
.num_rbds = IWL_NUM_RBDS_EHT, \
.ht_params = { \
.stbc = true, \
.ldpc = true, \
.ht40_bands = BIT(NL80211_BAND_2GHZ) | \
BIT(NL80211_BAND_5GHZ), \
}
const struct iwl_mac_cfg iwl_sc_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_SC,
.base = &iwl_sc_base,
@ -123,15 +108,6 @@ const struct iwl_mac_cfg iwl_sc_mac_cfg = {
const char iwl_sp_name[] = "Intel(R) Wi-Fi 7 BE213 160MHz";
const char iwl_pe_name[] = "Intel(R) Wi-Fi 8 BN201";
const struct iwl_cfg iwl_cfg_sc = {
IWL_DEVICE_SC,
};
const struct iwl_cfg iwl_cfg_sc_160mhz = {
IWL_DEVICE_SC,
.bw_limit = 160,
};
IWL_FW_AND_PNVM(IWL_SC_A_FM_B_FW_PRE, IWL_SC_UCODE_API_MAX);
IWL_FW_AND_PNVM(IWL_SC_A_FM_C_FW_PRE, IWL_SC_UCODE_API_MAX);
MODULE_FIRMWARE(IWL_SC_A_HR_A_FW_MODULE_FIRMWARE(IWL_SC_UCODE_API_MAX));

View File

@ -696,10 +696,10 @@ extern const struct iwl_cfg iwl_rf_gf;
#if IS_ENABLED(CONFIG_IWLMLD)
extern const struct iwl_cfg iwl_rf_fm;
extern const struct iwl_cfg iwl_rf_fm_160mhz;
extern const struct iwl_cfg iwl_cfg_sc;
extern const struct iwl_cfg iwl_cfg_sc_160mhz;
extern const struct iwl_cfg iwl_cfg_dr;
#define iwl_rf_wh iwl_rf_fm
#define iwl_rf_wh_160mhz iwl_rf_fm_160mhz
#define iwl_rf_pe iwl_rf_fm
#define iwl_rf_pe_160mhz iwl_rf_fm_160mhz
#endif /* CONFIG_IWLMLD */
#endif /* __IWL_CONFIG_H__ */

View File

@ -1474,33 +1474,34 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {
BW_LIMITED, NO_CDB),
/* Sc */
IWL_DEV_INFO(iwl_cfg_sc, iwl_ax211_name, MAC_TYPE(SC), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_fm_name, MAC_TYPE(SC), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_wh_name, MAC_TYPE(SC), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_gf, iwl_ax211_name, MAC_TYPE(SC), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_rf_fm, iwl_fm_name, MAC_TYPE(SC), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_rf_wh, iwl_wh_name, MAC_TYPE(SC), RF_TYPE(WH),
BW_NOT_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc_160mhz, iwl_sp_name, MAC_TYPE(SC), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_wh_160mhz, iwl_sp_name, MAC_TYPE(SC), RF_TYPE(WH),
BW_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc, iwl_pe_name, MAC_TYPE(SC), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_ax211_name, MAC_TYPE(SC2), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_fm_name, MAC_TYPE(SC2), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_wh_name, MAC_TYPE(SC2), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_pe, iwl_pe_name, MAC_TYPE(SC), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_rf_gf, iwl_ax211_name, MAC_TYPE(SC2), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_rf_fm, iwl_fm_name, MAC_TYPE(SC2), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_rf_wh, iwl_wh_name, MAC_TYPE(SC2), RF_TYPE(WH),
BW_NOT_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc_160mhz, iwl_sp_name, MAC_TYPE(SC2), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_wh_160mhz, iwl_sp_name, MAC_TYPE(SC2), RF_TYPE(WH),
BW_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc, iwl_pe_name, MAC_TYPE(SC2), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_ax211_name, MAC_TYPE(SC2F), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_fm_name, MAC_TYPE(SC2F), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_cfg_sc, iwl_wh_name, MAC_TYPE(SC2F), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_pe, iwl_pe_name, MAC_TYPE(SC2), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_rf_gf, iwl_ax211_name, MAC_TYPE(SC2F), RF_TYPE(GF)),
IWL_DEV_INFO(iwl_rf_fm, iwl_fm_name, MAC_TYPE(SC2F), RF_TYPE(FM)),
IWL_DEV_INFO(iwl_rf_wh, iwl_wh_name, MAC_TYPE(SC2F), RF_TYPE(WH),
BW_NOT_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc_160mhz, iwl_sp_name, MAC_TYPE(SC2F), RF_TYPE(WH),
IWL_DEV_INFO(iwl_rf_wh_160mhz, iwl_sp_name, MAC_TYPE(SC2F), RF_TYPE(WH),
BW_LIMITED),
IWL_DEV_INFO(iwl_cfg_sc, iwl_pe_name, MAC_TYPE(SC2F), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_rf_pe, iwl_pe_name, MAC_TYPE(SC2F), RF_TYPE(PE)),
/* Dr */
IWL_DEV_INFO(iwl_cfg_dr, iwl_dr_name, MAC_TYPE(DR)),
IWL_DEV_INFO(iwl_rf_pe, iwl_dr_name, MAC_TYPE(DR), RF_TYPE(PE)),
IWL_DEV_INFO(iwl_rf_wh, iwl_dr_name, MAC_TYPE(DR), RF_TYPE(WH)),
/* Br */
IWL_DEV_INFO(iwl_cfg_dr, iwl_br_name, MAC_TYPE(BR)),
IWL_DEV_INFO(iwl_rf_pe, iwl_br_name, MAC_TYPE(BR), RF_TYPE(PE)),
#endif /* CONFIG_IWLMLD */
};
EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_dev_info_table);

View File

@ -69,14 +69,6 @@ static void devinfo_no_cfg_dups(struct kunit *test)
if (cfg_i == cfg_j)
continue;
/*
* allow different MAC type to have the same config
* for better maintenance / file split
*/
if (iwl_dev_info_table[i].mac_type !=
iwl_dev_info_table[j].mac_type)
continue;
KUNIT_EXPECT_NE_MSG(test, memcmp(cfg_i, cfg_j,
sizeof(*cfg_i)), 0,
"identical configs: %ps and %ps\n",