wifi: iwlwifi: tests: check listed PCI IDs have configs

Add a test that checks, for the old pre-CNVI devices, that
PCI IDs listed in the PCI IDs table will also match in the
config table. Newer ones we test against our database of
devices, but the current database doesn't go back that far,
so at least this checks against the PCI IDs the driver has.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250915113137.eb728b270d46.Ie5754f4201b807eb0d55feb339a728fc0b42e8bf@changeid
This commit is contained in:
Johannes Berg
2025-09-15 11:34:28 +03:00
committed by Miri Korenblit
parent 30d47d8fe7
commit ef56bbed4c
2 changed files with 28 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ const struct iwl_mac_cfg iwl_bz_mac_cfg = {
.low_latency_xtal = true,
.ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
};
EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_bz_mac_cfg);
const struct iwl_mac_cfg iwl_gl_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_BZ,

View File

@@ -265,6 +265,32 @@ static void devinfo_api_range(struct kunit *test)
}
}
static void devinfo_pci_ids_config(struct kunit *test)
{
for (int i = 0; iwl_hw_card_ids[i].vendor; i++) {
const struct pci_device_id *s = &iwl_hw_card_ids[i];
const struct iwl_dev_info *di;
if (s->device == PCI_ANY_ID || s->subdevice == PCI_ANY_ID)
continue;
/*
* The check below only works for old (pre-CNVI) devices. Most
* new have subdevice==ANY, so are already skipped, but for some
* Bz platform(s) we list all the RF PCI IDs. Skip those too.
*/
if (s->driver_data == (kernel_ulong_t)&iwl_bz_mac_cfg)
continue;
di = iwl_pci_find_dev_info(s->device, s->subdevice,
0, 0, 0, 0, true);
KUNIT_EXPECT_PTR_NE_MSG(test, di, NULL,
"PCI ID %04x:%04x not found\n",
s->device, s->subdevice);
}
}
static struct kunit_case devinfo_test_cases[] = {
KUNIT_CASE(devinfo_table_order),
KUNIT_CASE(devinfo_discrete_match),
@@ -276,6 +302,7 @@ static struct kunit_case devinfo_test_cases[] = {
KUNIT_CASE(devinfo_pci_ids),
KUNIT_CASE(devinfo_no_mac_cfg_dups),
KUNIT_CASE(devinfo_api_range),
KUNIT_CASE(devinfo_pci_ids_config),
{}
};