net/mac80211/chan.c
Source file repositories/reference/linux-study-clean/net/mac80211/chan.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/chan.c- Extension
.c- Size
- 68118 bytes
- Lines
- 2554
- 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.
- 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
linux/nl80211.hlinux/export.hlinux/rtnetlink.hnet/cfg80211.hieee80211_i.hdriver-ops.hrate.h
Detected Declarations
struct ieee80211_chanctx_user_iterenum ieee80211_chanctx_iter_typefunction ieee80211_chanctx_user_iter_next_nan_channelfunction ieee80211_chanctx_user_iter_next_linkfunction ieee80211_chanctx_user_iter_nextfunction ieee80211_chanctx_user_iter_nextfunction ieee80211_chanctx_num_reservedfunction ieee80211_chanctx_refcountfunction ieee80211_num_chanctxfunction list_for_each_entryfunction ieee80211_can_create_new_chanctxfunction ieee80211_link_get_chanctxfunction ieee80211_chanreq_identicalfunction ieee80211_chanreq_compatiblefunction cfg80211_chandef_compatiblefunction chanctxfunction for_each_chanctx_user_allfunction ieee80211_chanctx_compatiblefunction ieee80211_chanctx_reserved_chanreqfunction for_each_chanctx_user_reservedfunction ieee80211_chanctx_non_reserved_chandeffunction for_each_chanctx_user_assignedfunction ieee80211_chanctx_can_reservefunction ieee80211_find_reservation_chanctxfunction list_for_each_entryfunction ieee80211_get_sta_bwfunction ieee80211_get_max_required_bwfunction list_for_each_entryfunction ieee80211_get_width_of_linkfunction ieee80211_get_width_of_chanctx_userfunction ieee80211_get_chanctx_max_required_bwfunction for_each_chanctx_user_reservedfunction __ieee80211_recalc_chanctx_min_deffunction ieee80211_chan_bw_changefunction _ieee80211_recalc_chanctx_min_deffunction ieee80211_recalc_chanctx_min_deffunction ieee80211_chanctx_update_npca_linksfunction for_each_chanctx_user_assignedfunction _ieee80211_change_chanctxfunction ieee80211_change_chanctxfunction ieee80211_find_chanctxfunction list_for_each_entryfunction ieee80211_is_radar_requiredfunction for_each_sdata_linkfunction ieee80211_chanctx_radar_requiredfunction for_each_chanctx_user_assignedfunction ieee80211_alloc_chanctxfunction ieee80211_add_chanctx
Annotated Snippet
struct ieee80211_chanctx_user_iter {
struct ieee80211_chan_req *chanreq;
struct ieee80211_sub_if_data *sdata;
struct ieee80211_link_data *link;
struct ieee80211_nan_channel *nan_channel;
int nan_channel_next_idx;
enum nl80211_iftype iftype;
bool reserved, radar_required, done;
enum {
CHANCTX_ITER_POS_ASSIGNED,
CHANCTX_ITER_POS_RESERVED,
CHANCTX_ITER_POS_DONE,
} per_link;
};
enum ieee80211_chanctx_iter_type {
CHANCTX_ITER_ALL,
CHANCTX_ITER_RESERVED,
CHANCTX_ITER_ASSIGNED,
};
static bool
ieee80211_chanctx_user_iter_next_nan_channel(struct ieee80211_chanctx *ctx,
struct ieee80211_chanctx_user_iter *iter)
{
/* Start from the next index after current position */
for (int i = iter->nan_channel_next_idx;
i < ARRAY_SIZE(iter->sdata->vif.cfg.nan_sched.channels); i++) {
struct ieee80211_nan_channel *nan_channel =
&iter->sdata->vif.cfg.nan_sched.channels[i];
if (!nan_channel->chanreq.oper.chan)
continue;
if (nan_channel->chanctx_conf != &ctx->conf)
continue;
iter->nan_channel = nan_channel;
iter->nan_channel_next_idx = i + 1;
iter->chanreq = &nan_channel->chanreq;
iter->link = NULL;
iter->reserved = false;
iter->radar_required = false;
return true;
}
return false;
}
static bool
ieee80211_chanctx_user_iter_next_link(struct ieee80211_chanctx *ctx,
struct ieee80211_chanctx_user_iter *iter,
enum ieee80211_chanctx_iter_type type)
{
for (int link_id = iter->link ? iter->link->link_id : 0;
link_id < ARRAY_SIZE(iter->sdata->link);
link_id++) {
struct ieee80211_link_data *link;
link = sdata_dereference(iter->sdata->link[link_id],
iter->sdata);
if (!link)
continue;
switch (iter->per_link) {
case CHANCTX_ITER_POS_ASSIGNED:
iter->per_link = CHANCTX_ITER_POS_RESERVED;
if (type != CHANCTX_ITER_RESERVED &&
rcu_access_pointer(link->conf->chanctx_conf) == &ctx->conf) {
iter->link = link;
iter->reserved = false;
iter->radar_required = link->radar_required;
iter->chanreq = &link->conf->chanreq;
return true;
}
fallthrough;
case CHANCTX_ITER_POS_RESERVED:
iter->per_link = CHANCTX_ITER_POS_DONE;
if (type != CHANCTX_ITER_ASSIGNED &&
link->reserved_chanctx == ctx) {
iter->link = link;
iter->reserved = true;
iter->radar_required =
link->reserved_radar_required;
iter->chanreq = &link->reserved;
return true;
}
fallthrough;
case CHANCTX_ITER_POS_DONE:
iter->per_link = CHANCTX_ITER_POS_ASSIGNED;
Annotation
- Immediate include surface: `linux/nl80211.h`, `linux/export.h`, `linux/rtnetlink.h`, `net/cfg80211.h`, `ieee80211_i.h`, `driver-ops.h`, `rate.h`.
- Detected declarations: `struct ieee80211_chanctx_user_iter`, `enum ieee80211_chanctx_iter_type`, `function ieee80211_chanctx_user_iter_next_nan_channel`, `function ieee80211_chanctx_user_iter_next_link`, `function ieee80211_chanctx_user_iter_next`, `function ieee80211_chanctx_user_iter_next`, `function ieee80211_chanctx_num_reserved`, `function ieee80211_chanctx_refcount`, `function ieee80211_num_chanctx`, `function list_for_each_entry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.