summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/tests
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2025-05-02 15:56:20 +0300
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>2025-05-06 22:22:12 +0300
commitac1ee8130a2297593ddee0466f8bfc0e679f8f1b (patch)
treea53e56f4eba37f811f3d6f7782b7fa3d90dd48b0 /drivers/net/wireless/intel/iwlwifi/tests
parent337faf17c973ce1f799ac163bbe105c322302c3b (diff)
wifi: iwlwifi: cfg: clean up BW limit and subdev matching
The BW limit, cores and RF ID are matched in the subdevice ID, so it doesn't really make sense to have both SUBDEV() match and a match on any of those three. In particular, for Killer devices the subdevice ID doesn't even follow the layout, so no matching should be on those three values at all, only with SUBDEV(). Change the logic around the BW limit to have it more like all the other things: only a bw_limit match in the dev_info, and put the actual bandwidth into struct iwl_cfg. This duplicates a number of those values, but that way the logic is clearer. Add a test that checks that the three matches mentioned above are not used in conjunction with SUBDEV(), and check that if the bw_limit is matched, a BW limit is provided in the config. Also check that the "Killer" devices have a SUBDEV() match. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250502155404.a185eac2736c.I87ee87300c92518a1d3296d3eda9fd4163e9085e@changeid
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/tests')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/tests/devinfo.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/tests/devinfo.c b/drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
index de6e3eaca8cd..0da5e255b063 100644
--- a/drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
+++ b/drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
@@ -31,7 +31,7 @@ static void devinfo_table_order(struct kunit *test)
di->mac_type, di->mac_step,
di->rf_type, di->cdb,
di->jacket, di->rf_id,
- di->bw_limit != IWL_CFG_BW_NO_LIM,
+ di->bw_limit,
di->cores, di->rf_step);
if (!ret) {
iwl_pci_print_dev_info("No entry found for: ", di);
@@ -104,6 +104,37 @@ static void devinfo_no_cfg_dups(struct kunit *test)
}
}
+static void devinfo_check_subdev_match(struct kunit *test)
+{
+ for (int i = 0; i < iwl_dev_info_table_size; i++) {
+ const struct iwl_dev_info *di = &iwl_dev_info_table[i];
+
+ /* if BW limit bit is matched then must have a limit */
+ if (di->bw_limit == 1)
+ KUNIT_EXPECT_NE(test, di->cfg->bw_limit, 0);
+
+ if (di->subdevice == (u16)IWL_CFG_ANY)
+ continue;
+
+ KUNIT_EXPECT_EQ(test, di->rf_id, (u8)IWL_CFG_ANY);
+ KUNIT_EXPECT_EQ(test, di->bw_limit, (u8)IWL_CFG_ANY);
+ KUNIT_EXPECT_EQ(test, di->cores, (u8)IWL_CFG_ANY);
+ }
+}
+
+static void devinfo_check_killer_subdev(struct kunit *test)
+{
+ for (int i = 0; i < iwl_dev_info_table_size; i++) {
+ const struct iwl_dev_info *di = &iwl_dev_info_table[i];
+ const char *name = di->name ?: di->cfg->name;
+
+ if (!strstr(name, "Killer"))
+ continue;
+
+ KUNIT_EXPECT_NE(test, di->subdevice, (u16)IWL_CFG_ANY);
+ }
+}
+
static void devinfo_pci_ids(struct kunit *test)
{
struct pci_dev *dev;
@@ -177,6 +208,8 @@ static struct kunit_case devinfo_test_cases[] = {
KUNIT_CASE(devinfo_table_order),
KUNIT_CASE(devinfo_names),
KUNIT_CASE(devinfo_no_cfg_dups),
+ KUNIT_CASE(devinfo_check_subdev_match),
+ KUNIT_CASE(devinfo_check_killer_subdev),
KUNIT_CASE(devinfo_pci_ids),
KUNIT_CASE(devinfo_no_trans_cfg_dups),
{}