drivers/net/wireless/ath/ath10k/debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/debug.c- Extension
.c- Size
- 65412 bytes
- Lines
- 2710
- 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/module.hlinux/debugfs.hlinux/export.hlinux/vmalloc.hlinux/crc32.hlinux/firmware.hlinux/kstrtox.hcore.hdebug.hhif.hwmi-ops.h
Detected Declarations
function Copyrightfunction ath10k_debug_print_hwfw_infofunction ath10k_debug_print_board_infofunction ath10k_debug_print_boot_infofunction ath10k_print_driver_infofunction ath10k_errfunction ath10k_warnfunction ath10k_read_wmi_servicesfunction ath10k_fw_stats_pdevs_freefunction list_for_each_entry_safefunction ath10k_fw_stats_vdevs_freefunction list_for_each_entry_safefunction ath10k_fw_stats_peers_freefunction list_for_each_entry_safefunction ath10k_fw_extd_stats_peers_freefunction list_for_each_entry_safefunction ath10k_debug_fw_stats_resetfunction ath10k_debug_fw_stats_processfunction ath10k_debug_fw_stats_requestfunction ath10k_fw_stats_openfunction ath10k_fw_stats_releasefunction ath10k_fw_stats_readfunction ath10k_debug_fw_reset_stats_readfunction ath10k_debug_fw_assertfunction ath10k_read_simulate_fw_crashfunction ath10k_write_simulate_fw_crashfunction ath10k_read_chip_idfunction ath10k_reg_addr_readfunction ath10k_reg_addr_writefunction ath10k_reg_value_readfunction ath10k_reg_value_writefunction ath10k_mem_value_readfunction ath10k_mem_value_writefunction ath10k_debug_htt_stats_reqfunction ath10k_debug_htt_stats_dworkfunction ath10k_read_htt_stats_maskfunction ath10k_write_htt_stats_maskfunction ath10k_read_htt_max_amsdu_ampdufunction ath10k_write_htt_max_amsdu_ampdufunction ath10k_read_fw_dbglogfunction ath10k_write_fw_dbglogfunction ath10k_debug_get_et_stringsfunction ath10k_debug_get_et_sset_countfunction ath10k_debug_get_et_statsfunction ath10k_debug_cal_data_fetchfunction ath10k_debug_cal_data_openfunction ath10k_debug_cal_data_readfunction ath10k_write_ani_enable
Annotated Snippet
static const struct file_operations fops_wmi_services = {
.read = ath10k_read_wmi_services,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static void ath10k_fw_stats_pdevs_free(struct list_head *head)
{
struct ath10k_fw_stats_pdev *i, *tmp;
list_for_each_entry_safe(i, tmp, head, list) {
list_del(&i->list);
kfree(i);
}
}
static void ath10k_fw_stats_vdevs_free(struct list_head *head)
{
struct ath10k_fw_stats_vdev *i, *tmp;
list_for_each_entry_safe(i, tmp, head, list) {
list_del(&i->list);
kfree(i);
}
}
static void ath10k_fw_stats_peers_free(struct list_head *head)
{
struct ath10k_fw_stats_peer *i, *tmp;
list_for_each_entry_safe(i, tmp, head, list) {
list_del(&i->list);
kfree(i);
}
}
static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
{
struct ath10k_fw_extd_stats_peer *i, *tmp;
list_for_each_entry_safe(i, tmp, head, list) {
list_del(&i->list);
kfree(i);
}
}
static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
{
spin_lock_bh(&ar->data_lock);
ar->debug.fw_stats_done = false;
ar->debug.fw_stats.extended = false;
ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd);
spin_unlock_bh(&ar->data_lock);
}
void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
{
struct ath10k_fw_stats stats = {};
bool is_start, is_started, is_end;
size_t num_peers;
size_t num_vdevs;
int ret;
INIT_LIST_HEAD(&stats.pdevs);
INIT_LIST_HEAD(&stats.vdevs);
INIT_LIST_HEAD(&stats.peers);
INIT_LIST_HEAD(&stats.peers_extd);
spin_lock_bh(&ar->data_lock);
ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats);
if (ret) {
ath10k_warn(ar, "failed to pull fw stats: %d\n", ret);
goto free;
}
/* Stat data may exceed htc-wmi buffer limit. In such case firmware
* splits the stats data and delivers it in a ping-pong fashion of
* request cmd-update event.
*
* However there is no explicit end-of-data. Instead start-of-data is
* used as an implicit one. This works as follows:
* a) discard stat update events until one with pdev stats is
* delivered - this skips session started at end of (b)
* b) consume stat update events until another one with pdev stats is
* delivered which is treated as end-of-data and is itself discarded
*/
Annotation
- Immediate include surface: `linux/module.h`, `linux/debugfs.h`, `linux/export.h`, `linux/vmalloc.h`, `linux/crc32.h`, `linux/firmware.h`, `linux/kstrtox.h`, `core.h`.
- Detected declarations: `function Copyright`, `function ath10k_debug_print_hwfw_info`, `function ath10k_debug_print_board_info`, `function ath10k_debug_print_boot_info`, `function ath10k_print_driver_info`, `function ath10k_err`, `function ath10k_warn`, `function ath10k_read_wmi_services`, `function ath10k_fw_stats_pdevs_free`, `function list_for_each_entry_safe`.
- 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.