net/mac80211/rc80211_minstrel_ht_debugfs.c
Source file repositories/reference/linux-study-clean/net/mac80211/rc80211_minstrel_ht_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/rc80211_minstrel_ht_debugfs.c- Extension
.c- Size
- 9185 bytes
- Lines
- 335
- 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.
- 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/netdevice.hlinux/types.hlinux/skbuff.hlinux/debugfs.hlinux/ieee80211.hlinux/export.hnet/mac80211.hrc80211_minstrel_ht.h
Detected Declarations
struct minstrel_debugfs_infofunction minstrel_stats_readfunction minstrel_stats_releasefunction minstrel_ht_is_sample_ratefunction minstrel_ht_stats_dumpfunction minstrel_ht_stats_openfunction minstrel_ht_stats_csv_dumpfunction minstrel_ht_stats_csv_openfunction minstrel_ht_add_sta_debugfs
Annotated Snippet
static const struct file_operations minstrel_ht_stat_fops = {
.owner = THIS_MODULE,
.open = minstrel_ht_stats_open,
.read = minstrel_stats_read,
.release = minstrel_stats_release,
};
static char *
minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
{
const struct mcs_group *mg;
unsigned int j, tp_max, tp_avg, eprob, tx_time;
char htmode = '2';
char gimode = 'L';
u32 gflags;
if (!mi->supported[i])
return p;
mg = &minstrel_mcs_groups[i];
gflags = mg->flags;
if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH)
htmode = '4';
else if (gflags & IEEE80211_TX_RC_80_MHZ_WIDTH)
htmode = '8';
if (gflags & IEEE80211_TX_RC_SHORT_GI)
gimode = 'S';
for (j = 0; j < MCS_GROUP_RATES; j++) {
struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j];
int idx = MI_RATE(i, j);
unsigned int duration;
if (!(mi->supported[i] & BIT(j)))
continue;
if (gflags & IEEE80211_TX_RC_MCS) {
p += sprintf(p, "HT%c0,", htmode);
p += sprintf(p, "%cGI,", gimode);
p += sprintf(p, "%d,", mg->streams);
} else if (gflags & IEEE80211_TX_RC_VHT_MCS) {
p += sprintf(p, "VHT%c0,", htmode);
p += sprintf(p, "%cGI,", gimode);
p += sprintf(p, "%d,", mg->streams);
} else if (i == MINSTREL_OFDM_GROUP) {
p += sprintf(p, "OFDM,,1,");
} else {
p += sprintf(p, "CCK,");
p += sprintf(p, "%cP,", j < 4 ? 'L' : 'S');
p += sprintf(p, "1,");
}
p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[0]) ? "A" : ""));
p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[1]) ? "B" : ""));
p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[2]) ? "C" : ""));
p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[3]) ? "D" : ""));
p += sprintf(p, "%s" ,((idx == mi->max_prob_rate) ? "P" : ""));
p += sprintf(p, "%s", (minstrel_ht_is_sample_rate(mi, idx) ? "S" : ""));
if (gflags & IEEE80211_TX_RC_MCS) {
p += sprintf(p, ",MCS%-2u,", (mg->streams - 1) * 8 + j);
} else if (gflags & IEEE80211_TX_RC_VHT_MCS) {
p += sprintf(p, ",MCS%-1u/%1u,", j, mg->streams);
} else {
int r;
if (i == MINSTREL_OFDM_GROUP)
r = minstrel_ofdm_bitrates[j % 8];
else
r = minstrel_cck_bitrates[j % 4];
p += sprintf(p, ",%2u.%1uM,", r / 10, r % 10);
}
p += sprintf(p, "%u,", idx);
duration = mg->duration[j];
duration <<= mg->shift;
tx_time = DIV_ROUND_CLOSEST(duration, 1000);
p += sprintf(p, "%u,", tx_time);
tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_avg);
eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000);
p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u,"
"%u,%llu,%llu,",
tp_max / 10, tp_max % 10,
tp_avg / 10, tp_avg % 10,
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/types.h`, `linux/skbuff.h`, `linux/debugfs.h`, `linux/ieee80211.h`, `linux/export.h`, `net/mac80211.h`, `rc80211_minstrel_ht.h`.
- Detected declarations: `struct minstrel_debugfs_info`, `function minstrel_stats_read`, `function minstrel_stats_release`, `function minstrel_ht_is_sample_rate`, `function minstrel_ht_stats_dump`, `function minstrel_ht_stats_open`, `function minstrel_ht_stats_csv_dump`, `function minstrel_ht_stats_csv_open`, `function minstrel_ht_add_sta_debugfs`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern implementation candidate.
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.