net/mac80211/tests/chan-mode.c
Source file repositories/reference/linux-study-clean/net/mac80211/tests/chan-mode.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/tests/chan-mode.c- Extension
.c- Size
- 9277 bytes
- Lines
- 276
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/cfg80211.hkunit/test.hutil.h
Detected Declarations
function test_determine_chan_mode
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* KUnit tests for channel mode functions
*
* Copyright (C) 2024-2026 Intel Corporation
*/
#include <net/cfg80211.h>
#include <kunit/test.h>
#include "util.h"
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
static const struct determine_chan_mode_case {
const char *desc;
u8 extra_supp_rate;
enum ieee80211_conn_mode conn_mode;
enum ieee80211_conn_mode expected_mode;
bool strict;
u8 userspace_selector;
struct ieee80211_ht_cap ht_capa_mask;
struct ieee80211_vht_cap vht_capa;
struct ieee80211_vht_cap vht_capa_mask;
u8 vht_basic_mcs_1_4_set:1,
vht_basic_mcs_5_8_set:1,
he_basic_mcs_1_4_set:1,
he_basic_mcs_5_8_set:1;
u8 vht_basic_mcs_1_4, vht_basic_mcs_5_8;
u8 he_basic_mcs_1_4, he_basic_mcs_5_8;
u8 eht_mcs7_min_nss;
u16 eht_disabled_subchannels;
u8 eht_bw;
enum ieee80211_conn_bw_limit conn_bw_limit;
enum ieee80211_conn_bw_limit expected_bw_limit;
int error;
} determine_chan_mode_cases[] = {
{
.desc = "Normal case, EHT is working",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.expected_mode = IEEE80211_CONN_MODE_EHT,
}, {
.desc = "Requiring EHT support is fine",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.expected_mode = IEEE80211_CONN_MODE_EHT,
.extra_supp_rate = 0x80 | BSS_MEMBERSHIP_SELECTOR_EHT_PHY,
}, {
.desc = "Lowering the mode limits us",
.conn_mode = IEEE80211_CONN_MODE_VHT,
.expected_mode = IEEE80211_CONN_MODE_VHT,
}, {
.desc = "Requesting a basic rate/selector that we do not support",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.extra_supp_rate = 0x80 | (BSS_MEMBERSHIP_SELECTOR_MIN - 1),
.error = EINVAL,
}, {
.desc = "As before, but userspace says it is taking care of it",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.userspace_selector = BSS_MEMBERSHIP_SELECTOR_MIN - 1,
.extra_supp_rate = 0x80 | (BSS_MEMBERSHIP_SELECTOR_MIN - 1),
.expected_mode = IEEE80211_CONN_MODE_EHT,
}, {
.desc = "Masking out a supported rate in HT capabilities",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.expected_mode = IEEE80211_CONN_MODE_LEGACY,
.ht_capa_mask = {
.mcs.rx_mask[0] = 0xf7,
},
.strict = true,
}, {
.desc = "Masking out a RX rate in VHT capabilities",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.expected_mode = IEEE80211_CONN_MODE_HT,
/* Only one RX stream at MCS 0-7 */
.vht_capa = {
.supp_mcs.rx_mcs_map =
cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_7),
},
.vht_capa_mask = {
.supp_mcs.rx_mcs_map = cpu_to_le16(0xffff),
},
.strict = true,
}, {
.desc = "Masking out a TX rate in VHT capabilities",
.conn_mode = IEEE80211_CONN_MODE_EHT,
.expected_mode = IEEE80211_CONN_MODE_HT,
/* Only one TX stream at MCS 0-7 */
.vht_capa = {
.supp_mcs.tx_mcs_map =
cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_7),
},
Annotation
- Immediate include surface: `net/cfg80211.h`, `kunit/test.h`, `util.h`.
- Detected declarations: `function test_determine_chan_mode`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.