drivers/net/wireless/intel/iwlwifi/mld/tests/chan_load_thresh.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mld/tests/chan_load_thresh.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mld/tests/chan_load_thresh.c
Extension
.c
Size
3446 bytes
Lines
140
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct test_chan_load_case {
	const char *desc;
	u32 load;
	enum iwl_mld_link_chan_load_level old_lvl;
	enum iwl_mld_link_chan_load_level expected_lvl;
	bool expected_scan_trig;
};

static const struct test_chan_load_case test_chan_load_thresh_cases[] = {
	/* Level-up transitions */
	{
		.desc = "Transition NONE->NONE",
		.load = 20,
		.old_lvl = LINK_CHAN_LOAD_LVL_NONE,
		.expected_lvl = LINK_CHAN_LOAD_LVL_NONE,
		.expected_scan_trig = false,
	},
	{
		.desc = "Transition NONE->LVL1",
		.load = 50,
		.old_lvl = LINK_CHAN_LOAD_LVL_NONE,
		.expected_lvl = LINK_CHAN_LOAD_LVL1,
		.expected_scan_trig = true,
	},
	{
		.desc = "Transition LVL1->LVL2",
		.load = 75,
		.old_lvl = LINK_CHAN_LOAD_LVL1,
		.expected_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_scan_trig = true,
	},
	{
		.desc = "Transition LVL2->LVL3",
		.load = 90,
		.old_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_lvl = LINK_CHAN_LOAD_LVL3,
		.expected_scan_trig = true,
	},

	/* Level-down transitions */
	{
		.desc = "Transition LVL1->NONE",
		.load = 30,
		.old_lvl = LINK_CHAN_LOAD_LVL1,
		.expected_lvl = LINK_CHAN_LOAD_LVL_NONE,
		.expected_scan_trig = false,
	},
	{
		.desc = "Transition LVL2->LVL1",
		.load = 60,
		.old_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_lvl = LINK_CHAN_LOAD_LVL1,
		.expected_scan_trig = false,
	},
	{
		.desc = "Transition LVL3->LVL2",
		.load = 70,
		.old_lvl = LINK_CHAN_LOAD_LVL3,
		.expected_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_scan_trig = false,
	},

	/* No change */
	{
		.desc = "Transition LVL2->LVL2",
		.load = 72,
		.old_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_lvl = LINK_CHAN_LOAD_LVL2,
		.expected_scan_trig = false,
	},
};

KUNIT_ARRAY_PARAM_DESC(test_chan_load_thresh_cases,
		       test_chan_load_thresh_cases, desc);

static void test_chan_load_thresholds(struct kunit *test)
{
	const struct test_chan_load_case *tc = test->param_value;
	struct iwl_mld *mld = test->priv;
	struct ieee80211_vif *vif;
	struct iwl_mld_vif *mld_vif;
	struct ieee80211_bss_conf *link_conf;
	struct iwl_mld_link *mld_link;
	struct iwl_mld_kunit_link assoc_link = {
		.id = 0,
		.chandef = &chandef_6ghz_160mhz,
	};
	bool scan_trig;
	u32 chan_load;

Annotation

Implementation Notes