drivers/scsi/qedf/qedf_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedf/qedf_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedf/qedf_debugfs.c- Extension
.c- Size
- 12951 bytes
- Lines
- 495
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- 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/uaccess.hlinux/debugfs.hlinux/module.hlinux/vmalloc.hqedf.hqedf_dbg.h
Detected Declarations
function qedf_dbg_host_initfunction qedf_dbg_host_exitfunction qedf_dbg_initfunction qedf_dbg_exitfunction qedf_dbg_fp_int_cmd_readfunction qedf_dbg_fp_int_cmd_writefunction qedf_dbg_debug_cmd_readfunction qedf_dbg_debug_cmd_writefunction qedf_dbg_stop_io_on_error_cmd_readfunction qedf_dbg_stop_io_on_error_cmd_writefunction qedf_io_trace_showfunction qedf_dbg_io_trace_openfunction qedf_driver_stats_showfunction qedf_dbg_driver_stats_openfunction qedf_dbg_clear_stats_cmd_readfunction qedf_dbg_clear_stats_cmd_writefunction qedf_offload_stats_showfunction qedf_dbg_offload_stats_open
Annotated Snippet
const struct file_operations *fops)
{
char host_dirname[32];
QEDF_INFO(qedf, QEDF_LOG_DEBUGFS, "Creating debugfs host node\n");
/* create pf dir */
sprintf(host_dirname, "host%u", qedf->host_no);
qedf->bdf_dentry = debugfs_create_dir(host_dirname, qedf_dbg_root);
/* create debugfs files */
while (dops) {
if (!(dops->name))
break;
debugfs_create_file(dops->name, 0600, qedf->bdf_dentry, qedf,
fops);
dops++;
fops++;
}
}
/*
* qedf_dbg_host_exit - clear out the pf's debugfs entries
*/
void
qedf_dbg_host_exit(struct qedf_dbg_ctx *qedf_dbg)
{
QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "Destroying debugfs host "
"entry\n");
/* remove debugfs entries of this PF */
debugfs_remove_recursive(qedf_dbg->bdf_dentry);
qedf_dbg->bdf_dentry = NULL;
}
/*
* qedf_dbg_init - start up debugfs for the driver
*/
void
qedf_dbg_init(char *drv_name)
{
QEDF_INFO(NULL, QEDF_LOG_DEBUGFS, "Creating debugfs root node\n");
/* create qed dir in root of debugfs. NULL means debugfs root */
qedf_dbg_root = debugfs_create_dir(drv_name, NULL);
}
/*
* qedf_dbg_exit - clean out the driver's debugfs entries
*/
void
qedf_dbg_exit(void)
{
QEDF_INFO(NULL, QEDF_LOG_DEBUGFS, "Destroying debugfs root "
"entry\n");
/* remove qed dir in root of debugfs */
debugfs_remove_recursive(qedf_dbg_root);
qedf_dbg_root = NULL;
}
const struct qedf_debugfs_ops qedf_debugfs_ops[] = {
{ "fp_int", NULL },
{ "io_trace", NULL },
{ "debug", NULL },
{ "stop_io_on_error", NULL},
{ "driver_stats", NULL},
{ "clear_stats", NULL},
{ "offload_stats", NULL},
/* This must be last */
{ NULL, NULL }
};
DECLARE_PER_CPU(struct qedf_percpu_iothread_s, qedf_percpu_iothreads);
static ssize_t
qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count,
loff_t *ppos)
{
ssize_t ret;
size_t cnt = 0;
char *cbuf;
int id;
struct qedf_fastpath *fp = NULL;
struct qedf_dbg_ctx *qedf_dbg =
(struct qedf_dbg_ctx *)filp->private_data;
struct qedf_ctx *qedf = container_of(qedf_dbg,
struct qedf_ctx, dbg_ctx);
QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "entered\n");
Annotation
- Immediate include surface: `linux/uaccess.h`, `linux/debugfs.h`, `linux/module.h`, `linux/vmalloc.h`, `qedf.h`, `qedf_dbg.h`.
- Detected declarations: `function qedf_dbg_host_init`, `function qedf_dbg_host_exit`, `function qedf_dbg_init`, `function qedf_dbg_exit`, `function qedf_dbg_fp_int_cmd_read`, `function qedf_dbg_fp_int_cmd_write`, `function qedf_dbg_debug_cmd_read`, `function qedf_dbg_debug_cmd_write`, `function qedf_dbg_stop_io_on_error_cmd_read`, `function qedf_dbg_stop_io_on_error_cmd_write`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.