drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qualcomm/ppe/ppe_debugfs.c- Extension
.c- Size
- 22376 bytes
- Lines
- 848
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/bitfield.hlinux/debugfs.hlinux/dev_printk.hlinux/device.hlinux/regmap.hlinux/seq_file.hppe.hppe_config.hppe_debugfs.hppe_regs.h
Detected Declarations
struct ppe_debugfs_entryenum ppe_cnt_size_typeenum ppe_cnt_typefunction ppe_pkt_cnt_getfunction ppe_tbl_pkt_cnt_clearfunction ppe_bm_counter_getfunction ppe_parse_pkt_counter_getfunction ppe_port_rx_counter_getfunction ppe_l2_counter_getfunction ppe_vlan_rx_counter_getfunction ppe_cpu_code_counter_getfunction ppe_vlan_tx_counter_getfunction ppe_port_tx_counter_getfunction ppe_queue_counter_getfunction ppe_packet_counter_showfunction ppe_packet_counter_writefunction ppe_debugfs_setupfunction ppe_debugfs_teardown
Annotated Snippet
struct ppe_debugfs_entry {
const char *name;
enum ppe_cnt_type counter_type;
struct ppe_device *ppe;
};
static const struct ppe_debugfs_entry debugfs_files[] = {
{
.name = "bm",
.counter_type = PPE_CNT_BM,
},
{
.name = "parse",
.counter_type = PPE_CNT_PARSE,
},
{
.name = "port_rx",
.counter_type = PPE_CNT_PORT_RX,
},
{
.name = "vlan_rx",
.counter_type = PPE_CNT_VLAN_RX,
},
{
.name = "l2_forward",
.counter_type = PPE_CNT_L2_FWD,
},
{
.name = "cpu_code",
.counter_type = PPE_CNT_CPU_CODE,
},
{
.name = "vlan_tx",
.counter_type = PPE_CNT_VLAN_TX,
},
{
.name = "port_tx",
.counter_type = PPE_CNT_PORT_TX,
},
{
.name = "qm",
.counter_type = PPE_CNT_QM,
},
};
static int ppe_pkt_cnt_get(struct ppe_device *ppe_dev, u32 reg,
enum ppe_cnt_size_type cnt_type,
u32 *cnt, u32 *drop_cnt)
{
u32 drop_pkt_cnt[PPE_DROP_PKT_CNT_TBL_SIZE];
u32 pkt_cnt[PPE_PKT_CNT_TBL_SIZE];
u32 value;
int ret;
switch (cnt_type) {
case PPE_PKT_CNT_SIZE_1WORD:
ret = regmap_read(ppe_dev->regmap, reg, &value);
if (ret)
return ret;
*cnt = value;
break;
case PPE_PKT_CNT_SIZE_3WORD:
ret = regmap_bulk_read(ppe_dev->regmap, reg,
pkt_cnt, ARRAY_SIZE(pkt_cnt));
if (ret)
return ret;
*cnt = PPE_GET_PKT_CNT(pkt_cnt);
break;
case PPE_PKT_CNT_SIZE_5WORD:
ret = regmap_bulk_read(ppe_dev->regmap, reg,
drop_pkt_cnt, ARRAY_SIZE(drop_pkt_cnt));
if (ret)
return ret;
*cnt = PPE_GET_PKT_CNT(drop_pkt_cnt);
/* Drop counter with low 24 bits. */
value = PPE_GET_DROP_PKT_CNT_LOW(drop_pkt_cnt);
*drop_cnt = FIELD_PREP(GENMASK(23, 0), value);
/* Drop counter with high 8 bits. */
value = PPE_GET_DROP_PKT_CNT_HIGH(drop_pkt_cnt);
*drop_cnt |= FIELD_PREP(GENMASK(31, 24), value);
break;
}
return 0;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/debugfs.h`, `linux/dev_printk.h`, `linux/device.h`, `linux/regmap.h`, `linux/seq_file.h`, `ppe.h`, `ppe_config.h`.
- Detected declarations: `struct ppe_debugfs_entry`, `enum ppe_cnt_size_type`, `enum ppe_cnt_type`, `function ppe_pkt_cnt_get`, `function ppe_tbl_pkt_cnt_clear`, `function ppe_bm_counter_get`, `function ppe_parse_pkt_counter_get`, `function ppe_port_rx_counter_get`, `function ppe_l2_counter_get`, `function ppe_vlan_rx_counter_get`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.