drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c- Extension
.c- Size
- 126740 bytes
- Lines
- 4061
- 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/fs.hlinux/debugfs.hlinux/module.hlinux/pci.hrvu_struct.hrvu_reg.hrvu.hcgx.hlmac_common.hnpc.hrvu_npc_hash.hmcs.hcn20k/reg.hcn20k/debugfs.hcn20k/npc.h
Detected Declarations
enum cpt_eng_typefunction rvu_dbg_mcs_port_stats_displayfunction rvu_dbg_mcs_rx_port_stats_displayfunction rvu_dbg_mcs_tx_port_stats_displayfunction rvu_dbg_mcs_sa_stats_displayfunction for_each_set_bitfunction rvu_dbg_mcs_rx_sa_stats_displayfunction rvu_dbg_mcs_tx_sa_stats_displayfunction rvu_dbg_mcs_tx_sc_stats_displayfunction rvu_dbg_mcs_rx_sc_stats_displayfunction rvu_dbg_mcs_flowid_stats_displayfunction rvu_dbg_mcs_tx_flowid_stats_displayfunction rvu_dbg_mcs_rx_flowid_stats_displayfunction rvu_dbg_mcs_tx_secy_stats_displayfunction rvu_dbg_mcs_rx_secy_stats_displayfunction rvu_dbg_mcs_initfunction rvu_dbg_lmtst_map_table_displayfunction get_lf_str_listfunction for_each_set_bitfunction get_max_column_widthfunction rvu_dbg_rsrc_attach_statusfunction rvu_dbg_rvu_pf_cgx_map_displayfunction rvu_dbg_rvu_fwdata_displayfunction rvu_dbg_is_valid_lffunction print_npa_qsizefunction rvu_dbg_qsize_displayfunction rvu_dbg_qsize_writefunction rvu_dbg_npa_qsize_writefunction rvu_dbg_npa_qsize_displayfunction print_npa_aura_ctxfunction print_npa_pool_ctxfunction rvu_dbg_npa_ctx_displayfunction write_npa_ctxfunction parse_cmd_buffer_ctxfunction rvu_dbg_npa_ctx_writefunction rvu_dbg_npa_aura_ctx_writefunction rvu_dbg_npa_aura_ctx_displayfunction rvu_dbg_npa_pool_ctx_writefunction rvu_dbg_npa_pool_ctx_displayfunction ndc_cache_statsfunction ndc_blk_cache_statsfunction rvu_dbg_npa_ndc_cache_displayfunction ndc_blk_hits_miss_statsfunction rvu_dbg_nix_ndc_rx_cache_displayfunction rvu_dbg_nix_ndc_tx_cache_displayfunction rvu_dbg_npa_ndc_hits_miss_displayfunction rvu_dbg_nix_ndc_rx_hits_miss_displayfunction rvu_dbg_nix_ndc_tx_hits_miss_display
Annotated Snippet
static const struct file_operations rvu_dbg_##name##_fops = { \
.owner = THIS_MODULE, \
.open = rvu_dbg_open_##name, \
.read = seq_read, \
.write = rvu_dbg_##write_op, \
.llseek = seq_lseek, \
.release = single_release, \
}
#define RVU_DEBUG_FOPS(name, read_op, write_op) \
static const struct file_operations rvu_dbg_##name##_fops = { \
.owner = THIS_MODULE, \
.open = simple_open, \
.read = rvu_dbg_##read_op, \
.write = rvu_dbg_##write_op \
}
static void print_nix_qsize(struct seq_file *filp, struct rvu_pfvf *pfvf);
static int rvu_dbg_mcs_port_stats_display(struct seq_file *filp, void *unused, int dir)
{
struct mcs *mcs = filp->private;
struct mcs_port_stats stats;
int lmac;
seq_puts(filp, "\n port stats\n");
mutex_lock(&mcs->stats_lock);
for_each_set_bit(lmac, &mcs->hw->lmac_bmap, mcs->hw->lmac_cnt) {
mcs_get_port_stats(mcs, &stats, lmac, dir);
seq_printf(filp, "port%d: Tcam Miss: %lld\n", lmac, stats.tcam_miss_cnt);
seq_printf(filp, "port%d: Parser errors: %lld\n", lmac, stats.parser_err_cnt);
if (dir == MCS_RX && mcs->hw->mcs_blks > 1)
seq_printf(filp, "port%d: Preempt error: %lld\n", lmac,
stats.preempt_err_cnt);
if (dir == MCS_TX)
seq_printf(filp, "port%d: Sectag insert error: %lld\n", lmac,
stats.sectag_insert_err_cnt);
}
mutex_unlock(&mcs->stats_lock);
return 0;
}
static int rvu_dbg_mcs_rx_port_stats_display(struct seq_file *filp, void *unused)
{
return rvu_dbg_mcs_port_stats_display(filp, unused, MCS_RX);
}
RVU_DEBUG_SEQ_FOPS(mcs_rx_port_stats, mcs_rx_port_stats_display, NULL);
static int rvu_dbg_mcs_tx_port_stats_display(struct seq_file *filp, void *unused)
{
return rvu_dbg_mcs_port_stats_display(filp, unused, MCS_TX);
}
RVU_DEBUG_SEQ_FOPS(mcs_tx_port_stats, mcs_tx_port_stats_display, NULL);
static int rvu_dbg_mcs_sa_stats_display(struct seq_file *filp, void *unused, int dir)
{
struct mcs *mcs = filp->private;
struct mcs_sa_stats stats;
struct rsrc_bmap *map;
int sa_id;
if (dir == MCS_TX) {
map = &mcs->tx.sa;
mutex_lock(&mcs->stats_lock);
for_each_set_bit(sa_id, map->bmap, mcs->hw->sa_entries) {
seq_puts(filp, "\n TX SA stats\n");
mcs_get_sa_stats(mcs, &stats, sa_id, MCS_TX);
seq_printf(filp, "sa%d: Pkts encrypted: %lld\n", sa_id,
stats.pkt_encrypt_cnt);
seq_printf(filp, "sa%d: Pkts protected: %lld\n", sa_id,
stats.pkt_protected_cnt);
}
mutex_unlock(&mcs->stats_lock);
return 0;
}
/* RX stats */
map = &mcs->rx.sa;
mutex_lock(&mcs->stats_lock);
for_each_set_bit(sa_id, map->bmap, mcs->hw->sa_entries) {
seq_puts(filp, "\n RX SA stats\n");
mcs_get_sa_stats(mcs, &stats, sa_id, MCS_RX);
seq_printf(filp, "sa%d: Invalid pkts: %lld\n", sa_id, stats.pkt_invalid_cnt);
seq_printf(filp, "sa%d: Pkts no sa error: %lld\n", sa_id, stats.pkt_nosaerror_cnt);
seq_printf(filp, "sa%d: Pkts not valid: %lld\n", sa_id, stats.pkt_notvalid_cnt);
seq_printf(filp, "sa%d: Pkts ok: %lld\n", sa_id, stats.pkt_ok_cnt);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/debugfs.h`, `linux/module.h`, `linux/pci.h`, `rvu_struct.h`, `rvu_reg.h`, `rvu.h`, `cgx.h`.
- Detected declarations: `enum cpt_eng_type`, `function rvu_dbg_mcs_port_stats_display`, `function rvu_dbg_mcs_rx_port_stats_display`, `function rvu_dbg_mcs_tx_port_stats_display`, `function rvu_dbg_mcs_sa_stats_display`, `function for_each_set_bit`, `function rvu_dbg_mcs_rx_sa_stats_display`, `function rvu_dbg_mcs_tx_sa_stats_display`, `function rvu_dbg_mcs_tx_sc_stats_display`, `function rvu_dbg_mcs_rx_sc_stats_display`.
- 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.