drivers/net/wireless/ath/ath9k/common-debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/common-debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/common-debug.c- Extension
.c- Size
- 7718 bytes
- Lines
- 264
- 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.
- 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.hcommon.h
Detected Declarations
function Copyrightfunction ath9k_cmn_debug_modal_eepromfunction read_file_base_eepromfunction ath9k_cmn_debug_base_eepromfunction ath9k_cmn_debug_stat_rxfunction read_file_recvfunction ath9k_cmn_debug_recvfunction read_file_phy_errfunction ath9k_cmn_debug_phy_errexport ath9k_cmn_debug_modal_eepromexport ath9k_cmn_debug_base_eepromexport ath9k_cmn_debug_stat_rxexport ath9k_cmn_debug_recvexport ath9k_cmn_debug_phy_err
Annotated Snippet
static const struct file_operations fops_modal_eeprom = {
.read = read_file_modal_eeprom,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy,
struct ath_hw *ah)
{
debugfs_create_file("modal_eeprom", 0400, debugfs_phy, ah,
&fops_modal_eeprom);
}
EXPORT_SYMBOL(ath9k_cmn_debug_modal_eeprom);
static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_hw *ah = file->private_data;
u32 len = 0, size = 1500;
ssize_t retval = 0;
char *buf;
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size);
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
}
static const struct file_operations fops_base_eeprom = {
.read = read_file_base_eeprom,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy,
struct ath_hw *ah)
{
debugfs_create_file("base_eeprom", 0400, debugfs_phy, ah,
&fops_base_eeprom);
}
EXPORT_SYMBOL(ath9k_cmn_debug_base_eeprom);
void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats,
struct ath_rx_status *rs)
{
#define RX_PHY_ERR_INC(c) rxstats->phy_err_stats[c]++
#define RX_CMN_STAT_INC(c) (rxstats->c++)
RX_CMN_STAT_INC(rx_pkts_all);
rxstats->rx_bytes_all += rs->rs_datalen;
if (rs->rs_status & ATH9K_RXERR_CRC)
RX_CMN_STAT_INC(crc_err);
if (rs->rs_status & ATH9K_RXERR_DECRYPT)
RX_CMN_STAT_INC(decrypt_crc_err);
if (rs->rs_status & ATH9K_RXERR_MIC)
RX_CMN_STAT_INC(mic_err);
if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE)
RX_CMN_STAT_INC(pre_delim_crc_err);
if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST)
RX_CMN_STAT_INC(post_delim_crc_err);
if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY)
RX_CMN_STAT_INC(decrypt_busy_err);
if (rs->rs_status & ATH9K_RXERR_PHY) {
RX_CMN_STAT_INC(phy_err);
if (rs->rs_phyerr < ATH9K_PHYERR_MAX)
RX_PHY_ERR_INC(rs->rs_phyerr);
}
#undef RX_CMN_STAT_INC
#undef RX_PHY_ERR_INC
}
EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx);
static ssize_t read_file_recv(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
#define RXS_ERR(s, e) \
do { \
len += scnprintf(buf + len, size - len, \
Annotation
- Immediate include surface: `linux/export.h`, `common.h`.
- Detected declarations: `function Copyright`, `function ath9k_cmn_debug_modal_eeprom`, `function read_file_base_eeprom`, `function ath9k_cmn_debug_base_eeprom`, `function ath9k_cmn_debug_stat_rx`, `function read_file_recv`, `function ath9k_cmn_debug_recv`, `function read_file_phy_err`, `function ath9k_cmn_debug_phy_err`, `export ath9k_cmn_debug_modal_eeprom`.
- Atlas domain: Driver Families / drivers/net.
- 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.