net/mac80211/debugfs_sta.c
Source file repositories/reference/linux-study-clean/net/mac80211/debugfs_sta.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/debugfs_sta.c- Extension
.c- Size
- 42559 bytes
- Lines
- 1363
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/debugfs.hlinux/ieee80211.hieee80211_i.hdebugfs.hdebugfs_sta.hsta_info.hdriver-ops.h
Detected Declarations
function sta_flags_readfunction sta_num_ps_buf_frames_readfunction sta_last_seq_ctrl_readfunction sta_aqm_readfunction sta_airtime_readfunction sta_airtime_writefunction sta_aql_readfunction sta_aql_writefunction sta_agg_status_do_readfunction sta_agg_status_readfunction sta_agg_status_do_writefunction sta_agg_status_writefunction link_sta_addr_readfunction link_sta_ht_capa_readfunction link_sta_vht_capa_readfunction link_sta_he_capa_readfunction link_sta_eht_capa_readfunction ieee80211_sta_debugfs_addfunction ieee80211_sta_debugfs_removefunction ieee80211_link_sta_debugfs_addfunction ieee80211_link_sta_debugfs_removefunction ieee80211_link_sta_debugfs_drv_addfunction ieee80211_link_sta_debugfs_drv_remove
Annotated Snippet
if (le16_to_cpu(htc->mcs.rx_highest)) {
p += scnprintf(p, bufsz + buf - p,
"MCS rx highest: %d Mbps\n",
le16_to_cpu(htc->mcs.rx_highest));
}
p += scnprintf(p, bufsz + buf - p, "MCS tx params: %x\n",
htc->mcs.tx_params);
}
ret = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
kfree(buf);
return ret;
}
LINK_STA_OPS(ht_capa);
static ssize_t link_sta_vht_capa_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
char *buf, *p;
struct link_sta_info *link_sta = file->private_data;
struct ieee80211_sta_vht_cap *vhtc = &link_sta->pub->vht_cap;
ssize_t ret;
ssize_t bufsz = 512;
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
p = buf;
p += scnprintf(p, bufsz + buf - p, "VHT %ssupported\n",
vhtc->vht_supported ? "" : "not ");
if (vhtc->vht_supported) {
p += scnprintf(p, bufsz + buf - p, "cap: %#.8x\n",
vhtc->cap);
#define PFLAG(a, b) \
do { \
if (vhtc->cap & IEEE80211_VHT_CAP_ ## a) \
p += scnprintf(p, bufsz + buf - p, \
"\t\t%s\n", b); \
} while (0)
switch (vhtc->cap & 0x3) {
case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895:
p += scnprintf(p, bufsz + buf - p,
"\t\tMAX-MPDU-3895\n");
break;
case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991:
p += scnprintf(p, bufsz + buf - p,
"\t\tMAX-MPDU-7991\n");
break;
case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
p += scnprintf(p, bufsz + buf - p,
"\t\tMAX-MPDU-11454\n");
break;
default:
p += scnprintf(p, bufsz + buf - p,
"\t\tMAX-MPDU-UNKNOWN\n");
}
switch (vhtc->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
case 0:
p += scnprintf(p, bufsz + buf - p,
"\t\t80Mhz\n");
break;
case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
p += scnprintf(p, bufsz + buf - p,
"\t\t160Mhz\n");
break;
case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ:
p += scnprintf(p, bufsz + buf - p,
"\t\t80+80Mhz\n");
break;
default:
p += scnprintf(p, bufsz + buf - p,
"\t\tUNKNOWN-MHZ: 0x%x\n",
(vhtc->cap >> 2) & 0x3);
}
PFLAG(RXLDPC, "RXLDPC");
PFLAG(SHORT_GI_80, "SHORT-GI-80");
PFLAG(SHORT_GI_160, "SHORT-GI-160");
PFLAG(TXSTBC, "TXSTBC");
p += scnprintf(p, bufsz + buf - p,
"\t\tRXSTBC_%d\n", (vhtc->cap >> 8) & 0x7);
PFLAG(SU_BEAMFORMER_CAPABLE, "SU-BEAMFORMER-CAPABLE");
PFLAG(SU_BEAMFORMEE_CAPABLE, "SU-BEAMFORMEE-CAPABLE");
p += scnprintf(p, bufsz + buf - p,
"\t\tBEAMFORMEE-STS: 0x%x\n",
(vhtc->cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK) >>
IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
p += scnprintf(p, bufsz + buf - p,
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/ieee80211.h`, `ieee80211_i.h`, `debugfs.h`, `debugfs_sta.h`, `sta_info.h`, `driver-ops.h`.
- Detected declarations: `function sta_flags_read`, `function sta_num_ps_buf_frames_read`, `function sta_last_seq_ctrl_read`, `function sta_aqm_read`, `function sta_airtime_read`, `function sta_airtime_write`, `function sta_aql_read`, `function sta_aql_write`, `function sta_agg_status_do_read`, `function sta_agg_status_read`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.