net/mac80211/iface.c
Source file repositories/reference/linux-study-clean/net/mac80211/iface.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/iface.c- Extension
.c- Size
- 69616 bytes
- Lines
- 2563
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/slab.hlinux/kernel.hlinux/if_arp.hlinux/netdevice.hlinux/rtnetlink.hlinux/kcov.hnet/mac80211.hnet/ieee80211_radiotap.hieee80211_i.hsta_info.hdebugfs_netdev.hmesh.hled.hdriver-ops.hwme.hrate.h
Detected Declarations
function __ieee80211_recalc_txpowerfunction ieee80211_recalc_txpowerfunction __ieee80211_idle_offfunction __ieee80211_idle_onfunction __ieee80211_recalc_idlefunction list_for_each_entryfunction ieee80211_idle_offfunction ieee80211_recalc_idlefunction ieee80211_verify_macfunction list_for_each_entryfunction ieee80211_can_powered_addr_changefunction _ieee80211_change_macfunction ieee80211_change_macfunction identical_mac_addr_allowedfunction ieee80211_check_concurrent_ifacefunction for_each_link_datafunction ieee80211_check_queuesfunction ieee80211_openfunction ieee80211_do_stopfunction skb_queue_walk_safefunction list_for_each_entryfunction idr_for_each_entryfunction skb_queue_walk_safefunction ieee80211_stop_mbssidfunction for_each_sdata_linkfunction ieee80211_stopfunction ieee80211_set_multicast_listfunction ieee80211_teardown_sdatafunction ieee80211_uninitfunction ieee80211_netdev_setup_tcfunction ieee80211_monitor_select_queuefunction ieee80211_netdev_fill_forward_pathfunction ieee80211_iftype_supports_hdr_offloadfunction ieee80211_set_sdata_offload_flagsfunction ieee80211_set_vif_encap_opsfunction ieee80211_recalc_sdata_offloadfunction list_for_each_entryfunction ieee80211_recalc_offloadfunction list_for_each_entryfunction ieee80211_adjust_monitor_flagsfunction ieee80211_set_default_queuesfunction ieee80211_sdata_initfunction ieee80211_add_virtual_monitorfunction list_for_each_entry_rcufunction ieee80211_del_virtual_monitorfunction ieee80211_do_openfunction for_each_link_datafunction ieee80211_if_setup
Annotated Snippet
static const struct net_device_ops ieee80211_dataif_ops = {
.ndo_open = ieee80211_open,
.ndo_stop = ieee80211_stop,
.ndo_uninit = ieee80211_uninit,
.ndo_start_xmit = ieee80211_subif_start_xmit,
.ndo_set_rx_mode = ieee80211_set_multicast_list,
.ndo_set_mac_address = ieee80211_change_mac,
.ndo_setup_tc = ieee80211_netdev_setup_tc,
};
static u16 ieee80211_monitor_select_queue(struct net_device *dev,
struct sk_buff *skb,
struct net_device *sb_dev)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr;
int len_rthdr;
if (local->hw.queues < IEEE80211_NUM_ACS)
return 0;
/* reset flags and info before parsing radiotap header */
memset(info, 0, sizeof(*info));
if (!ieee80211_parse_tx_radiotap(skb, dev))
return 0; /* doesn't matter, frame will be dropped */
len_rthdr = ieee80211_get_radiotap_len(skb->data);
hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
if (skb->len < len_rthdr + 2 ||
skb->len < len_rthdr + ieee80211_hdrlen(hdr->frame_control))
return 0; /* doesn't matter, frame will be dropped */
return ieee80211_select_queue_80211(sdata, skb, hdr);
}
static const struct net_device_ops ieee80211_monitorif_ops = {
.ndo_open = ieee80211_open,
.ndo_stop = ieee80211_stop,
.ndo_uninit = ieee80211_uninit,
.ndo_start_xmit = ieee80211_monitor_start_xmit,
.ndo_set_rx_mode = ieee80211_set_multicast_list,
.ndo_set_mac_address = ieee80211_change_mac,
.ndo_select_queue = ieee80211_monitor_select_queue,
};
static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
struct net_device_path *path)
{
struct ieee80211_sub_if_data *sdata;
struct ieee80211_local *local;
struct sta_info *sta;
int ret = -ENOENT;
sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev);
local = sdata->local;
if (!local->ops->net_fill_forward_path)
return -EOPNOTSUPP;
rcu_read_lock();
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP_VLAN:
sta = rcu_dereference(sdata->u.vlan.sta);
if (sta)
break;
if (sdata->wdev.use_4addr)
goto out;
if (is_multicast_ether_addr(ctx->daddr))
goto out;
sta = sta_info_get_bss(sdata, ctx->daddr);
break;
case NL80211_IFTYPE_AP:
if (is_multicast_ether_addr(ctx->daddr))
goto out;
sta = sta_info_get(sdata, ctx->daddr);
break;
case NL80211_IFTYPE_STATION:
if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
sta = sta_info_get(sdata, ctx->daddr);
if (sta && test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
goto out;
break;
}
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/rtnetlink.h`, `linux/kcov.h`, `net/mac80211.h`, `net/ieee80211_radiotap.h`.
- Detected declarations: `function __ieee80211_recalc_txpower`, `function ieee80211_recalc_txpower`, `function __ieee80211_idle_off`, `function __ieee80211_idle_on`, `function __ieee80211_recalc_idle`, `function list_for_each_entry`, `function ieee80211_idle_off`, `function ieee80211_recalc_idle`, `function ieee80211_verify_mac`, `function list_for_each_entry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.