drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c- Extension
.c- Size
- 19746 bytes
- Lines
- 679
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/pci.hlinux/rtnetlink.hlinux/seq_file.hfbnic.hfbnic_txrx.h
Detected Declarations
function fbnic_dbg_desc_breakfunction fbnic_dbg_ring_showfunction fbnic_dbg_twd_desc_seq_showfunction fbnic_dbg_twq_desc_seq_showfunction fbnic_dbg_tcq_desc_seq_showfunction fbnic_dbg_bdq_desc_seq_showfunction fbnic_dbg_rcd_desc_seq_showfunction fbnic_dbg_rcq_desc_seq_showfunction fbnic_dbg_desc_openfunction fbnic_dbg_nv_initfunction fbnic_dbg_nv_exitfunction fbnic_dbg_mac_addr_showfunction fbnic_dbg_tce_tcam_showfunction fbnic_dbg_act_tcam_showfunction fbnic_dbg_ip_addr_showfunction fbnic_dbg_ip_src_showfunction fbnic_dbg_ip_dst_showfunction fbnic_dbg_ipo_src_showfunction fbnic_dbg_ipo_dst_showfunction fbnic_dbg_fw_mbx_displayfunction fbnic_dbg_fw_mbx_showfunction fbnic_dbg_fw_log_showfunction list_for_each_entry_reversefunction fbnic_dbg_pcie_stats_showfunction fbnic_dbg_fbd_initfunction fbnic_dbg_fbd_exitfunction fbnic_dbg_initfunction fbnic_dbg_exit
Annotated Snippet
static const struct file_operations fbnic_dbg_desc_fops = {
.owner = THIS_MODULE,
.open = fbnic_dbg_desc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void fbnic_dbg_nv_init(struct fbnic_napi_vector *nv)
{
struct fbnic_dev *fbd = nv->fbd;
char name[16];
int i, j;
/* Generate a folder for each napi vector */
snprintf(name, sizeof(name), "nv.%03d", nv->v_idx);
nv->dbg_nv = debugfs_create_dir(name, fbd->dbg_fbd);
/* Generate a file for each Tx ring in the napi vector */
for (i = 0; i < nv->txt_count; i++) {
struct fbnic_q_triad *qt = &nv->qt[i];
unsigned int hw_idx;
hw_idx = fbnic_ring_csr_base(&qt->cmpl) -
&fbd->uc_addr0[FBNIC_QUEUE(0)];
hw_idx /= FBNIC_QUEUE_STRIDE;
snprintf(name, sizeof(name), "twq0.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub0,
&fbnic_dbg_desc_fops);
snprintf(name, sizeof(name), "twq1.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub1,
&fbnic_dbg_desc_fops);
snprintf(name, sizeof(name), "tcq.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->cmpl,
&fbnic_dbg_desc_fops);
}
/* Generate a file for each Rx ring in the napi vector */
for (j = 0; j < nv->rxt_count; j++, i++) {
struct fbnic_q_triad *qt = &nv->qt[i];
unsigned int hw_idx;
hw_idx = fbnic_ring_csr_base(&qt->cmpl) -
&fbd->uc_addr0[FBNIC_QUEUE(0)];
hw_idx /= FBNIC_QUEUE_STRIDE;
snprintf(name, sizeof(name), "hpq.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub0,
&fbnic_dbg_desc_fops);
snprintf(name, sizeof(name), "ppq.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub1,
&fbnic_dbg_desc_fops);
snprintf(name, sizeof(name), "rcq.%03d", hw_idx);
debugfs_create_file(name, 0400, nv->dbg_nv, &qt->cmpl,
&fbnic_dbg_desc_fops);
}
}
void fbnic_dbg_nv_exit(struct fbnic_napi_vector *nv)
{
debugfs_remove_recursive(nv->dbg_nv);
nv->dbg_nv = NULL;
}
static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v)
{
struct fbnic_dev *fbd = s->private;
char hdr[80];
int i;
/* Generate Header */
snprintf(hdr, sizeof(hdr), "%3s %s %-17s %s\n",
"Idx", "S", "TCAM Bitmap", "Addr/Mask");
seq_puts(s, hdr);
fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));
for (i = 0; i < FBNIC_RPC_TCAM_MACDA_NUM_ENTRIES; i++) {
struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
seq_printf(s, "%02d %d %64pb %pm\n",
i, mac_addr->state, mac_addr->act_tcam,
mac_addr->value.addr8);
seq_printf(s, " %pm\n",
mac_addr->mask.addr8);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/pci.h`, `linux/rtnetlink.h`, `linux/seq_file.h`, `fbnic.h`, `fbnic_txrx.h`.
- Detected declarations: `function fbnic_dbg_desc_break`, `function fbnic_dbg_ring_show`, `function fbnic_dbg_twd_desc_seq_show`, `function fbnic_dbg_twq_desc_seq_show`, `function fbnic_dbg_tcq_desc_seq_show`, `function fbnic_dbg_bdq_desc_seq_show`, `function fbnic_dbg_rcd_desc_seq_show`, `function fbnic_dbg_rcq_desc_seq_show`, `function fbnic_dbg_desc_open`, `function fbnic_dbg_nv_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.