drivers/net/wireless/intel/iwlegacy/debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlegacy/debug.c- Extension
.c- Size
- 38287 bytes
- Lines
- 1380
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/ieee80211.hlinux/export.hnet/mac80211.hcommon.h
Detected Declarations
function Copyrightfunction il_update_statsfunction il_get_mgmt_stringfunction il_get_ctrl_stringfunction il_dbgfs_tx_stats_readfunction il_dbgfs_clear_traffic_stats_writefunction il_dbgfs_rx_stats_readfunction il_dbgfs_sram_readfunction il_dbgfs_sram_writefunction il_dbgfs_stations_readfunction il_dbgfs_nvm_readfunction il_dbgfs_channels_readfunction il_dbgfs_status_readfunction il_dbgfs_interrupt_readfunction il_dbgfs_interrupt_writefunction il_dbgfs_qos_readfunction il_dbgfs_disable_ht40_writefunction il_dbgfs_disable_ht40_readfunction il_dbgfs_tx_queue_readfunction il_dbgfs_rx_queue_readfunction il_dbgfs_ucode_rx_stats_readfunction il_dbgfs_ucode_tx_stats_readfunction il_dbgfs_ucode_general_stats_readfunction il_dbgfs_sensitivity_readfunction il_dbgfs_chain_noise_readfunction il_dbgfs_power_save_status_readfunction il_dbgfs_clear_ucode_stats_writefunction il_dbgfs_rxon_flags_readfunction il_dbgfs_rxon_filter_flags_readfunction il_dbgfs_fh_reg_readfunction il_dbgfs_missed_beacon_readfunction il_dbgfs_missed_beacon_writefunction il_dbgfs_force_reset_readfunction il_dbgfs_force_reset_writefunction il_dbgfs_wd_timeout_writefunction il_dbgfs_registerfunction il_dbgfs_unregisterexport il_update_statsexport il_dbgfs_registerexport il_dbgfs_unregister
Annotated Snippet
static const struct file_operations il_dbgfs_##name##_ops = { \
.read = il_dbgfs_##name##_read, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
#define DEBUGFS_WRITE_FILE_OPS(name) \
DEBUGFS_WRITE_FUNC(name); \
static const struct file_operations il_dbgfs_##name##_ops = { \
.write = il_dbgfs_##name##_write, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
DEBUGFS_READ_FUNC(name); \
DEBUGFS_WRITE_FUNC(name); \
static const struct file_operations il_dbgfs_##name##_ops = { \
.write = il_dbgfs_##name##_write, \
.read = il_dbgfs_##name##_read, \
.open = simple_open, \
.llseek = generic_file_llseek, \
};
static const char *
il_get_mgmt_string(int cmd)
{
switch (cmd) {
IL_CMD(MANAGEMENT_ASSOC_REQ);
IL_CMD(MANAGEMENT_ASSOC_RESP);
IL_CMD(MANAGEMENT_REASSOC_REQ);
IL_CMD(MANAGEMENT_REASSOC_RESP);
IL_CMD(MANAGEMENT_PROBE_REQ);
IL_CMD(MANAGEMENT_PROBE_RESP);
IL_CMD(MANAGEMENT_BEACON);
IL_CMD(MANAGEMENT_ATIM);
IL_CMD(MANAGEMENT_DISASSOC);
IL_CMD(MANAGEMENT_AUTH);
IL_CMD(MANAGEMENT_DEAUTH);
IL_CMD(MANAGEMENT_ACTION);
default:
return "UNKNOWN";
}
}
static const char *
il_get_ctrl_string(int cmd)
{
switch (cmd) {
IL_CMD(CONTROL_BACK_REQ);
IL_CMD(CONTROL_BACK);
IL_CMD(CONTROL_PSPOLL);
IL_CMD(CONTROL_RTS);
IL_CMD(CONTROL_CTS);
IL_CMD(CONTROL_ACK);
IL_CMD(CONTROL_CFEND);
IL_CMD(CONTROL_CFENDACK);
default:
return "UNKNOWN";
}
}
static ssize_t
il_dbgfs_tx_stats_read(struct file *file, char __user *user_buf, size_t count,
loff_t *ppos)
{
struct il_priv *il = file->private_data;
char *buf;
int pos = 0;
int cnt;
ssize_t ret;
const size_t bufsz =
100 + sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
pos +=
scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n",
il_get_mgmt_string(cnt), il->tx_stats.mgmt[cnt]);
}
pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
pos +=
scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n",
Annotation
- Immediate include surface: `linux/ieee80211.h`, `linux/export.h`, `net/mac80211.h`, `common.h`.
- Detected declarations: `function Copyright`, `function il_update_stats`, `function il_get_mgmt_string`, `function il_get_ctrl_string`, `function il_dbgfs_tx_stats_read`, `function il_dbgfs_clear_traffic_stats_write`, `function il_dbgfs_rx_stats_read`, `function il_dbgfs_sram_read`, `function il_dbgfs_sram_write`, `function il_dbgfs_stations_read`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.