net/wireless/util.c
Source file repositories/reference/linux-study-clean/net/wireless/util.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/util.c- Extension
.c- Size
- 76975 bytes
- Lines
- 3086
- 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/export.hlinux/bitops.hlinux/etherdevice.hlinux/slab.hlinux/ieee80211.hnet/cfg80211.hnet/ip.hnet/dsfield.hlinux/if_vlan.hlinux/mpls.hlinux/gcd.hlinux/bitfield.hlinux/nospec.hcore.hrdev-ops.h
Detected Declarations
struct iapp_layer2_updatefunction Copyrightfunction ieee80211_mandatory_ratesfunction ieee80211_channel_to_freq_khzfunction ieee80211_freq_khz_to_channelfunction set_mandatory_flags_bandfunction ieee80211_set_bitrate_flagsfunction cfg80211_supported_cipher_suitefunction cfg80211_igtk_cipher_supportedfunction cfg80211_valid_key_idxfunction cfg80211_validate_key_settingsfunction ieee80211_hdrlenfunction ieee80211_get_hdrlen_from_skbfunction __ieee80211_get_mesh_hdrlenfunction ieee80211_get_mesh_hdrlenfunction ieee80211_get_8023_tunnel_protofunction ieee80211_strip_8023_mesh_hdrfunction ieee80211_data_to_8023_exthdrfunction __frame_add_fragfunction __ieee80211_amsdu_copy_fragfunction __ieee80211_amsdu_copyfunction ieee80211_amsdu_subframe_lengthfunction ieee80211_is_valid_amsdufunction is_amsdu_aggregation_attackfunction ieee80211_amsdu_to_8023sfunction cfg80211_classify8021dfunction cfg80211_upload_connect_keysfunction cfg80211_process_wdev_eventsfunction cfg80211_process_rdev_eventsfunction cfg80211_change_ifacefunction cfg80211_calculate_bitrate_htfunction cfg80211_calculate_bitrate_dmgfunction cfg80211_calculate_bitrate_extended_sc_dmgfunction cfg80211_calculate_bitrate_edmgfunction cfg80211_calculate_bitrate_vhtfunction cfg80211_calculate_bitrate_hefunction _cfg80211_calculate_bitrate_eht_uhrfunction cfg80211_calculate_bitrate_ehtfunction cfg80211_calculate_bitrate_uhrfunction cfg80211_calculate_bitrate_s1gfunction cfg80211_calculate_bitratefunction cfg80211_get_p2p_attrfunction ieee80211_id_in_listfunction skip_iefunction ieee80211_ie_split_ricfunction ieee80211_fragment_elementfunction ieee80211_operating_class_to_bandfunction ieee80211_operating_class_to_chandef
Annotated Snippet
struct iapp_layer2_update {
u8 da[ETH_ALEN]; /* broadcast */
u8 sa[ETH_ALEN]; /* STA addr */
__be16 len; /* 6 */
u8 dsap; /* 0 */
u8 ssap; /* 0 */
u8 control;
u8 xid_info[3];
} __packed;
void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr)
{
struct iapp_layer2_update *msg;
struct sk_buff *skb;
/* Send Level 2 Update Frame to update forwarding tables in layer 2
* bridge devices */
skb = dev_alloc_skb(sizeof(*msg));
if (!skb)
return;
msg = skb_put(skb, sizeof(*msg));
/* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
* Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
eth_broadcast_addr(msg->da);
ether_addr_copy(msg->sa, addr);
msg->len = htons(6);
msg->dsap = 0;
msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
msg->control = 0xaf; /* XID response lsb.1111F101.
* F=0 (no poll command; unsolicited frame) */
msg->xid_info[0] = 0x81; /* XID format identifier */
msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb);
}
EXPORT_SYMBOL(cfg80211_send_layer2_update);
int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,
enum ieee80211_vht_chanwidth bw,
int mcs, bool ext_nss_bw_capable,
unsigned int max_vht_nss)
{
u16 map = le16_to_cpu(cap->supp_mcs.rx_mcs_map);
int ext_nss_bw;
int supp_width;
int i, mcs_encoding;
if (map == 0xffff)
return 0;
if (WARN_ON(mcs > 9 || max_vht_nss > 8))
return 0;
if (mcs <= 7)
mcs_encoding = 0;
else if (mcs == 8)
mcs_encoding = 1;
else
mcs_encoding = 2;
if (!max_vht_nss) {
/* find max_vht_nss for the given MCS */
for (i = 7; i >= 0; i--) {
int supp = (map >> (2 * i)) & 3;
if (supp == 3)
continue;
if (supp >= mcs_encoding) {
max_vht_nss = i + 1;
break;
}
}
}
if (!(cap->supp_mcs.tx_mcs_map &
cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE)))
return max_vht_nss;
ext_nss_bw = le32_get_bits(cap->vht_cap_info,
IEEE80211_VHT_CAP_EXT_NSS_BW_MASK);
supp_width = le32_get_bits(cap->vht_cap_info,
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK);
Annotation
- Immediate include surface: `linux/export.h`, `linux/bitops.h`, `linux/etherdevice.h`, `linux/slab.h`, `linux/ieee80211.h`, `net/cfg80211.h`, `net/ip.h`, `net/dsfield.h`.
- Detected declarations: `struct iapp_layer2_update`, `function Copyright`, `function ieee80211_mandatory_rates`, `function ieee80211_channel_to_freq_khz`, `function ieee80211_freq_khz_to_channel`, `function set_mandatory_flags_band`, `function ieee80211_set_bitrate_flags`, `function cfg80211_supported_cipher_suite`, `function cfg80211_igtk_cipher_supported`, `function cfg80211_valid_key_idx`.
- 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.