net/wireless/chan.c
Source file repositories/reference/linux-study-clean/net/wireless/chan.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/chan.c- Extension
.c- Size
- 48024 bytes
- Lines
- 1880
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/bitfield.hnet/cfg80211.hcore.hrdev-ops.h
Detected Declarations
struct cfg80211_per_bw_puncturing_valuesfunction cfg80211_valid_60g_freqfunction cfg80211_chandef_createfunction cfg80211_get_start_freqfunction cfg80211_get_end_freqfunction valid_puncturing_bitmapfunction cfg80211_edmg_chandef_validfunction nl80211_chan_width_to_mhzfunction cfg80211_valid_center_freqfunction cfg80211_chandef_valid_control_freqfunction cfg80211_chandef_validfunction cfg80211_chandef_primaryfunction cfg80211_chandef_npca_validfunction cfg80211_chandef_add_npcafunction cfg80211_chandef_add_dbefunction check_chandef_primary_compatfunction _cfg80211_chandef_compatiblefunction cfg80211_chandef_compatiblefunction cfg80211_set_dfs_statefunction for_each_subchanfunction cfg80211_set_cac_statefunction for_each_subchanfunction cfg80211_dfs_permissive_check_wdevfunction for_each_valid_linkfunction cfg80211_dfs_permissive_chanfunction cfg80211_get_chans_dfs_requiredfunction for_each_subchanfunction cfg80211_chandef_dfs_requiredfunction cfg80211_chandef_dfs_usablefunction channelsfunction cfg80211_is_sub_chanfunction cfg80211_beaconing_iface_activefunction cfg80211_wdev_on_sub_chanfunction cfg80211_is_wiphy_oper_chanfunction list_for_each_entryfunction cfg80211_offchan_chain_is_activefunction cfg80211_any_wiphy_oper_chanfunction for_each_rdevfunction cfg80211_chandef_dfs_availablefunction cfg80211_chandef_dfs_cac_timefunction for_each_subchanfunction cfg80211_edmg_usablefunction cfg80211_s1g_usablefunction for_each_s1g_subchanfunction _cfg80211_chandef_usablefunction for_each_sband_iftype_datafunction for_each_subchanfunction cfg80211_chandef_usable
Annotated Snippet
struct cfg80211_per_bw_puncturing_values {
u8 len;
const u16 *valid_values;
};
static const u16 puncturing_values_80mhz[] = {
0x8, 0x4, 0x2, 0x1
};
static const u16 puncturing_values_160mhz[] = {
0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, 0xc0, 0x30, 0xc, 0x3
};
static const u16 puncturing_values_320mhz[] = {
0xc000, 0x3000, 0xc00, 0x300, 0xc0, 0x30, 0xc, 0x3, 0xf000, 0xf00,
0xf0, 0xf, 0xfc00, 0xf300, 0xf0c0, 0xf030, 0xf00c, 0xf003, 0xc00f,
0x300f, 0xc0f, 0x30f, 0xcf, 0x3f
};
#define CFG80211_PER_BW_VALID_PUNCTURING_VALUES(_bw) \
{ \
.len = ARRAY_SIZE(puncturing_values_ ## _bw ## mhz), \
.valid_values = puncturing_values_ ## _bw ## mhz \
}
static const struct cfg80211_per_bw_puncturing_values per_bw_puncturing[] = {
CFG80211_PER_BW_VALID_PUNCTURING_VALUES(80),
CFG80211_PER_BW_VALID_PUNCTURING_VALUES(160),
CFG80211_PER_BW_VALID_PUNCTURING_VALUES(320)
};
static bool valid_puncturing_bitmap(const struct cfg80211_chan_def *chandef,
u32 primary_center, u32 punctured)
{
u32 idx, i, start_freq;
switch (chandef->width) {
case NL80211_CHAN_WIDTH_80:
idx = 0;
start_freq = chandef->center_freq1 - 40;
break;
case NL80211_CHAN_WIDTH_160:
idx = 1;
start_freq = chandef->center_freq1 - 80;
break;
case NL80211_CHAN_WIDTH_320:
idx = 2;
start_freq = chandef->center_freq1 - 160;
break;
default:
return punctured == 0;
}
if (!punctured)
return true;
/* check if primary channel is punctured */
if (punctured & (u16)BIT((primary_center - start_freq) / 20))
return false;
for (i = 0; i < per_bw_puncturing[idx].len; i++) {
if (per_bw_puncturing[idx].valid_values[i] == punctured)
return true;
}
return false;
}
static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef)
{
int max_contiguous = 0;
int num_of_enabled = 0;
int contiguous = 0;
int i;
if (!chandef->edmg.channels || !chandef->edmg.bw_config)
return false;
if (!cfg80211_valid_60g_freq(chandef->chan->center_freq))
return false;
for (i = 0; i < 6; i++) {
if (chandef->edmg.channels & BIT(i)) {
contiguous++;
num_of_enabled++;
} else {
contiguous = 0;
}
max_contiguous = max(contiguous, max_contiguous);
Annotation
- Immediate include surface: `linux/export.h`, `linux/bitfield.h`, `net/cfg80211.h`, `core.h`, `rdev-ops.h`.
- Detected declarations: `struct cfg80211_per_bw_puncturing_values`, `function cfg80211_valid_60g_freq`, `function cfg80211_chandef_create`, `function cfg80211_get_start_freq`, `function cfg80211_get_end_freq`, `function valid_puncturing_bitmap`, `function cfg80211_edmg_chandef_valid`, `function nl80211_chan_width_to_mhz`, `function cfg80211_valid_center_freq`, `function cfg80211_chandef_valid_control_freq`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.