drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c- Extension
.c- Size
- 275863 bytes
- Lines
- 6442
- 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/vmalloc.hcore.hdebug.hdebugfs_htt_stats.hdp_tx.hdp_rx.h
Detected Declarations
function Copyrightfunction print_array_to_buffunction print_array_to_buf_s8function ath12k_tx_ru_size_to_strfunction htt_print_tx_pdev_stats_cmn_tlvfunction htt_print_tx_pdev_stats_urrn_tlvfunction htt_print_tx_pdev_stats_flush_tlvfunction htt_print_tx_pdev_stats_sifs_tlvfunction htt_print_tx_pdev_mu_ppdu_dist_stats_tlvfunction htt_print_tx_pdev_stats_sifs_hist_tlvfunction htt_print_pdev_ctrl_path_tx_stats_tlvfunction ath12k_htt_print_stats_tx_sched_cmn_tlvfunction ath12k_htt_print_tx_pdev_stats_sched_per_txq_tlvfunction ath12k_htt_print_sched_txq_cmd_posted_tlvfunction ath12k_htt_print_sched_txq_cmd_reaped_tlvfunction ath12k_htt_print_sched_txq_sched_order_su_tlvfunction ath12k_htt_print_sched_txq_sched_ineligibility_tlvfunction ath12k_htt_print_sched_txq_supercycle_trigger_tlvfunction ath12k_htt_print_hw_stats_pdev_errs_tlvfunction ath12k_htt_print_hw_stats_intr_misc_tlvfunction ath12k_htt_print_hw_stats_whal_tx_tlvfunction ath12k_htt_print_hw_war_tlvfunction ath12k_htt_print_tx_tqm_cmn_stats_tlvfunction ath12k_htt_print_tx_tqm_error_stats_tlvfunction ath12k_htt_print_tx_tqm_gen_mpdu_stats_tlvfunction ath12k_htt_print_tx_tqm_list_mpdu_stats_tlvfunction ath12k_htt_print_tx_tqm_list_mpdu_cnt_tlvfunction ath12k_htt_print_tx_tqm_pdev_stats_tlvfunction ath12k_htt_print_tx_de_cmn_stats_tlvfunction ath12k_htt_print_tx_de_eapol_packets_stats_tlvfunction ath12k_htt_print_tx_de_classify_stats_tlvfunction ath12k_htt_print_tx_de_classify_failed_stats_tlvfunction ath12k_htt_print_tx_de_classify_status_stats_tlvfunction ath12k_htt_print_tx_de_enqueue_packets_stats_tlvfunction ath12k_htt_print_tx_de_enqueue_discard_stats_tlvfunction ath12k_htt_print_tx_de_compl_stats_tlvfunction ath12k_htt_print_tx_selfgen_cmn_stats_tlvfunction ath12k_htt_print_tx_selfgen_ac_stats_tlvfunction ath12k_htt_print_tx_selfgen_ax_stats_tlvfunction ath12k_htt_print_tx_selfgen_be_stats_tlvfunction ath12k_htt_print_tx_selfgen_ac_err_stats_tlvfunction ath12k_htt_print_tx_selfgen_ax_err_stats_tlvfunction ath12k_htt_print_tx_selfgen_be_err_stats_tlvfunction ath12k_htt_print_tx_selfgen_ac_sched_status_stats_tlvfunction ath12k_htt_print_tx_selfgen_ax_sched_status_stats_tlvfunction ath12k_htt_print_tx_selfgen_be_sched_status_stats_tlvfunction ath12k_htt_print_stats_string_tlvfunction ath12k_htt_print_sring_stats_tlv
Annotated Snippet
static const struct file_operations fops_htt_stats_type = {
.read = ath12k_read_htt_stats_type,
.write = ath12k_write_htt_stats_type,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static int ath12k_debugfs_htt_stats_req(struct ath12k *ar)
{
struct debug_htt_stats_req *stats_req = ar->debug.htt_stats.stats_req;
enum ath12k_dbg_htt_ext_stats_type type = stats_req->type;
u64 cookie;
int ret, pdev_id;
struct htt_ext_stats_cfg_params cfg_params = {};
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
init_completion(&stats_req->htt_stats_rcvd);
pdev_id = ath12k_mac_get_target_pdev_id(ar);
stats_req->done = false;
stats_req->pdev_id = pdev_id;
cookie = u64_encode_bits(ATH12K_HTT_STATS_MAGIC_VALUE,
ATH12K_HTT_STATS_COOKIE_MSB);
cookie |= u64_encode_bits(pdev_id, ATH12K_HTT_STATS_COOKIE_LSB);
if (stats_req->override_cfg_param) {
cfg_params.cfg0 = stats_req->cfg_param[0];
cfg_params.cfg1 = stats_req->cfg_param[1];
cfg_params.cfg2 = stats_req->cfg_param[2];
cfg_params.cfg3 = stats_req->cfg_param[3];
}
ret = ath12k_dp_tx_htt_h2t_ext_stats_req(ar, type, &cfg_params, cookie);
if (ret) {
ath12k_warn(ar->ab, "failed to send htt stats request: %d\n", ret);
return ret;
}
if (!wait_for_completion_timeout(&stats_req->htt_stats_rcvd, 3 * HZ)) {
spin_lock_bh(&ar->data_lock);
if (!stats_req->done) {
stats_req->done = true;
spin_unlock_bh(&ar->data_lock);
ath12k_warn(ar->ab, "stats request timed out\n");
return -ETIMEDOUT;
}
spin_unlock_bh(&ar->data_lock);
}
return 0;
}
static int ath12k_open_htt_stats(struct inode *inode,
struct file *file)
{
struct ath12k *ar = inode->i_private;
struct debug_htt_stats_req *stats_req;
enum ath12k_dbg_htt_ext_stats_type type = ar->debug.htt_stats.type;
struct ath12k_hw *ah = ath12k_ar_to_ah(ar);
int ret;
if (type == ATH12K_DBG_HTT_EXT_STATS_RESET)
return -EPERM;
wiphy_lock(ath12k_ar_to_hw(ar)->wiphy);
if (ah->state != ATH12K_HW_STATE_ON) {
ret = -ENETDOWN;
goto err_unlock;
}
if (ar->debug.htt_stats.stats_req) {
ret = -EAGAIN;
goto err_unlock;
}
stats_req = kzalloc(sizeof(*stats_req) + ATH12K_HTT_STATS_BUF_SIZE, GFP_KERNEL);
if (!stats_req) {
ret = -ENOMEM;
goto err_unlock;
}
ar->debug.htt_stats.stats_req = stats_req;
stats_req->type = type;
stats_req->cfg_param[0] = ar->debug.htt_stats.cfg_param[0];
stats_req->cfg_param[1] = ar->debug.htt_stats.cfg_param[1];
stats_req->cfg_param[2] = ar->debug.htt_stats.cfg_param[2];
stats_req->cfg_param[3] = ar->debug.htt_stats.cfg_param[3];
Annotation
- Immediate include surface: `linux/vmalloc.h`, `core.h`, `debug.h`, `debugfs_htt_stats.h`, `dp_tx.h`, `dp_rx.h`.
- Detected declarations: `function Copyright`, `function print_array_to_buf`, `function print_array_to_buf_s8`, `function ath12k_tx_ru_size_to_str`, `function htt_print_tx_pdev_stats_cmn_tlv`, `function htt_print_tx_pdev_stats_urrn_tlv`, `function htt_print_tx_pdev_stats_flush_tlv`, `function htt_print_tx_pdev_stats_sifs_tlv`, `function htt_print_tx_pdev_mu_ppdu_dist_stats_tlv`, `function htt_print_tx_pdev_stats_sifs_hist_tlv`.
- 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.