drivers/net/wireless/ath/ath12k/debugfs_sta.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/debugfs_sta.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/debugfs_sta.c- Extension
.c- Size
- 9676 bytes
- Lines
- 324
- 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/vmalloc.hdebugfs_sta.hcore.hpeer.hdebug.hdebugfs_htt_stats.hdebugfs.hdp_cmn.h
Detected Declarations
function Copyrightfunction ath12k_dbg_sta_dump_rx_statsfunction ath12k_dbg_sta_reset_rx_statsfunction ath12k_debugfs_link_sta_op_addexport ath12k_debugfs_link_sta_op_add
Annotated Snippet
static const struct file_operations fops_rx_stats = {
.read = ath12k_dbg_sta_dump_rx_stats,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t ath12k_dbg_sta_reset_rx_stats(struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
{
struct ieee80211_link_sta *link_sta = file->private_data;
struct ath12k_sta *ahsta = ath12k_sta_to_ahsta(link_sta->sta);
struct ath12k_hw *ah = ahsta->ahvif->ah;
u8 link_id = link_sta->link_id;
struct ath12k_link_sta *arsta;
struct ath12k_dp *dp;
bool reset;
int ret;
ret = kstrtobool_from_user(buf, count, &reset);
if (ret)
return ret;
if (!reset)
return -EINVAL;
wiphy_lock(ah->hw->wiphy);
if (!(BIT(link_id) & ahsta->links_map)) {
ret = -ENOENT;
goto out;
}
arsta = wiphy_dereference(ah->hw->wiphy, ahsta->link[link_id]);
if (!arsta || !arsta->arvif->ar) {
ret = -ENOENT;
goto out;
}
dp = ath12k_ab_to_dp(arsta->arvif->ar->ab);
ath12k_dp_link_peer_reset_rx_stats(dp, arsta->addr);
ret = count;
out:
wiphy_unlock(ah->hw->wiphy);
return ret;
}
static const struct file_operations fops_reset_rx_stats = {
.write = ath12k_dbg_sta_reset_rx_stats,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
void ath12k_debugfs_link_sta_op_add(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta,
struct dentry *dir)
{
struct ath12k *ar;
lockdep_assert_wiphy(hw->wiphy);
ar = ath12k_get_ar_by_vif(hw, vif, link_sta->link_id);
if (!ar)
return;
if (ath12k_debugfs_is_extd_rx_stats_enabled(ar)) {
debugfs_create_file("rx_stats", 0400, dir, link_sta,
&fops_rx_stats);
debugfs_create_file("reset_rx_stats", 0200, dir, link_sta,
&fops_reset_rx_stats);
}
}
EXPORT_SYMBOL(ath12k_debugfs_link_sta_op_add);
Annotation
- Immediate include surface: `linux/vmalloc.h`, `debugfs_sta.h`, `core.h`, `peer.h`, `debug.h`, `debugfs_htt_stats.h`, `debugfs.h`, `dp_cmn.h`.
- Detected declarations: `function Copyright`, `function ath12k_dbg_sta_dump_rx_stats`, `function ath12k_dbg_sta_reset_rx_stats`, `function ath12k_debugfs_link_sta_op_add`, `export ath12k_debugfs_link_sta_op_add`.
- 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.