net/mac80211/sta_info.c
Source file repositories/reference/linux-study-clean/net/mac80211/sta_info.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/sta_info.c- Extension
.c- Size
- 107681 bytes
- Lines
- 3821
- 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/module.hlinux/init.hlinux/etherdevice.hlinux/netdevice.hlinux/types.hlinux/slab.hlinux/skbuff.hlinux/if_arp.hlinux/timer.hlinux/rtnetlink.hnet/mac80211.hieee80211_i.hdriver-ops.hrate.hsta_info.hdebugfs_sta.hmesh.hwme.h
Detected Declarations
struct sta_link_allocfunction sta_info_hash_delfunction link_sta_info_hash_addfunction link_sta_info_hash_delfunction ieee80211_purge_sta_txqsfunction __cleanup_single_stafunction cleanup_single_stafunction link_sta_info_get_bssfunction ieee80211_find_sta_by_link_addrsfunction for_each_link_sta_infofunction for_each_sta_infofunction list_for_each_entry_rcufunction sta_info_free_linkfunction sta_accumulate_removed_link_statsfunction sta_remove_linkfunction sta_info_allocfunction sta_info_pre_move_statefunction sta_info_hash_addfunction sta_deliver_ps_framesfunction sta_prepare_rate_controlfunction sta_info_alloc_linkfunction Causefunction sta_info_add_linkfunction __sta_info_allocfunction sta_info_insert_checkfunction sta_info_insert_drv_statefunction ieee80211_recalc_p2p_go_ps_allowedfunction sta_info_insert_finishfunction sta_info_insert_rcufunction sta_info_insertfunction __bss_tim_setfunction __bss_tim_clearfunction __bss_tim_getfunction ieee80211_tids_for_acfunction __sta_info_recalc_timfunction sta_info_recalc_timfunction sta_info_buffer_expiredfunction sta_info_cleanup_expire_buffered_acfunction sta_info_cleanup_expire_bufferedfunction __sta_info_destroy_part1function list_for_each_entry_safefunction _sta_info_move_statefunction test_sta_flagfunction sta_info_move_statefunction __sta_info_destroy_part2function __sta_info_destroyfunction sta_info_destroy_addrfunction sta_info_destroy_addr_bss
Annotated Snippet
struct sta_link_alloc {
struct link_sta_info info;
struct ieee80211_link_sta sta;
struct rcu_head rcu_head;
};
static const struct rhashtable_params sta_rht_params = {
.nelem_hint = 3, /* start small */
.automatic_shrinking = true,
.head_offset = offsetof(struct sta_info, hash_node),
.key_offset = offsetof(struct sta_info, addr),
.key_len = ETH_ALEN,
.max_size = CONFIG_MAC80211_STA_HASH_MAX_SIZE,
};
static const struct rhashtable_params link_sta_rht_params = {
.nelem_hint = 3, /* start small */
.automatic_shrinking = true,
.head_offset = offsetof(struct link_sta_info, link_hash_node),
.key_offset = offsetof(struct link_sta_info, addr),
.key_len = ETH_ALEN,
.max_size = CONFIG_MAC80211_STA_HASH_MAX_SIZE,
};
static int sta_info_hash_del(struct ieee80211_local *local,
struct sta_info *sta)
{
return rhltable_remove(&local->sta_hash, &sta->hash_node,
sta_rht_params);
}
static int link_sta_info_hash_add(struct ieee80211_local *local,
struct link_sta_info *link_sta)
{
lockdep_assert_wiphy(local->hw.wiphy);
return rhltable_insert(&local->link_sta_hash,
&link_sta->link_hash_node, link_sta_rht_params);
}
static int link_sta_info_hash_del(struct ieee80211_local *local,
struct link_sta_info *link_sta)
{
lockdep_assert_wiphy(local->hw.wiphy);
return rhltable_remove(&local->link_sta_hash,
&link_sta->link_hash_node, link_sta_rht_params);
}
void ieee80211_purge_sta_txqs(struct sta_info *sta)
{
struct ieee80211_local *local = sta->sdata->local;
int i;
for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
struct txq_info *txqi;
if (!sta->sta.txq[i])
continue;
txqi = to_txq_info(sta->sta.txq[i]);
ieee80211_txq_purge(local, txqi);
}
}
static void __cleanup_single_sta(struct sta_info *sta)
{
int ac, i;
struct tid_ampdu_tx *tid_tx;
struct ieee80211_sub_if_data *sdata = sta->sdata;
struct ieee80211_local *local = sdata->local;
struct ps_data *ps;
if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
ps = &sdata->bss->ps;
else if (ieee80211_vif_is_mesh(&sdata->vif))
ps = &sdata->u.mesh.ps;
else
return;
clear_sta_flag(sta, WLAN_STA_PS_STA);
clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
atomic_dec(&ps->num_sta_ps);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/etherdevice.h`, `linux/netdevice.h`, `linux/types.h`, `linux/slab.h`, `linux/skbuff.h`, `linux/if_arp.h`.
- Detected declarations: `struct sta_link_alloc`, `function sta_info_hash_del`, `function link_sta_info_hash_add`, `function link_sta_info_hash_del`, `function ieee80211_purge_sta_txqs`, `function __cleanup_single_sta`, `function cleanup_single_sta`, `function link_sta_info_get_bss`, `function ieee80211_find_sta_by_link_addrs`, `function for_each_link_sta_info`.
- 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.