drivers/net/wireless/intel/iwlwifi/tests/nvm_parse.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/tests/nvm_parse.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/tests/nvm_parse.c- Extension
.c- Size
- 1973 bytes
- Lines
- 73
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/static_stub.hkunit/test.hiwl-nvm-parse.h
Detected Declarations
function test_nvm_flags
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* KUnit tests for NVM parse
*
* Copyright (C) 2025 Intel Corporation
*/
#include <kunit/static_stub.h>
#include <kunit/test.h>
#include <iwl-nvm-parse.h>
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
static const struct nvm_flag_case {
const char *desc;
u16 nvm_flags;
u32 reg_rule_flags;
u32 set_reg_rule_flags;
u32 clear_reg_rule_flags;
} nvm_flag_cases[] = {
{
.desc = "Restricting VLP client and AP access",
.nvm_flags = 0,
.set_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT,
.clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP,
},
{
.desc = "Allow VLP client and AP access",
.nvm_flags = NVM_CHANNEL_VLP,
.set_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP,
.clear_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT,
},
{
.desc = "Allow VLP client access, while restricting AP access",
.nvm_flags = NVM_CHANNEL_VLP | NVM_CHANNEL_VLP_AP_NOT_ALLOWED,
.set_reg_rule_flags = 0,
.clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP |
NL80211_RRF_NO_6GHZ_VLP_CLIENT,
},
};
KUNIT_ARRAY_PARAM_DESC(nvm_flag, nvm_flag_cases, desc)
static void test_nvm_flags(struct kunit *test)
{
const struct nvm_flag_case *params = test->param_value;
struct iwl_reg_capa reg_capa = {};
u32 flags = 0;
flags = iwl_nvm_get_regdom_bw_flags(NULL, 0, params->nvm_flags,
reg_capa);
if ((params->set_reg_rule_flags & flags) != params->set_reg_rule_flags)
KUNIT_FAIL(test, "Expected set bits:0x%08x flags:0x%08x\n",
params->set_reg_rule_flags, flags);
if (params->clear_reg_rule_flags & flags)
KUNIT_FAIL(test, "Expected clear bits:0x%08x flags:0x%08x\n",
params->clear_reg_rule_flags, flags);
}
static struct kunit_case nvm_flags_test_cases[] = {
KUNIT_CASE_PARAM(test_nvm_flags,
nvm_flag_gen_params),
{},
};
static struct kunit_suite nvm_flags_suite = {
.name = "iwlwifi-nvm_flags",
.test_cases = nvm_flags_test_cases,
};
kunit_test_suite(nvm_flags_suite);
Annotation
- Immediate include surface: `kunit/static_stub.h`, `kunit/test.h`, `iwl-nvm-parse.h`.
- Detected declarations: `function test_nvm_flags`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.