drivers/scsi/qedf/qedf_main.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedf/qedf_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedf/qedf_main.c- Extension
.c- Size
- 116036 bytes
- Lines
- 4236
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/init.hlinux/kernel.hlinux/module.hlinux/pci.hlinux/device.hlinux/highmem.hlinux/crc32.hlinux/interrupt.hlinux/list.hlinux/kthread.hlinux/phylink.hscsi/libfc.hscsi/scsi_host.hscsi/fc_frame.hlinux/if_ether.hlinux/if_vlan.hlinux/cpu.hqedf.hqedf_dbg.huapi/linux/pci_regs.h
Detected Declarations
function qedf_set_vlan_idfunction qedf_initiate_fipvlan_reqfunction qedf_handle_link_updatefunction qedf_set_data_src_addrfunction qedf_flogi_respfunction qedf_send_flogifunction qedf_link_recoveryfunction qedf_update_link_speedfunction qedf_bw_updatefunction qedf_link_updatefunction qedf_dcbx_handlerfunction qedf_get_login_failuresfunction qedf_eh_abortfunction qedf_eh_target_resetfunction qedf_eh_device_resetfunction qedf_wait_for_uploadfunction qedf_ctx_soft_resetfunction qedf_eh_host_resetfunction qedf_sdev_configurefunction qedf_get_paged_crc_eoffunction qedf_xmit_l2_framefunction qedf_xmitfunction list_for_each_entryfunction qedf_alloc_sqfunction qedf_free_sqfunction qedf_offload_connectionfunction qedf_upload_connectionfunction qedf_cleanup_fcportfunction qedf_rport_event_handlerfunction qedf_abort_iofunction qedf_fcoe_ctlr_setupfunction qedf_setup_fdmifunction qedf_lport_setupfunction qedf_vport_libfc_configfunction qedf_vport_createfunction qedf_vport_destroyfunction qedf_vport_disablefunction qedf_wait_for_vport_destroyfunction qedf_fcoe_resetfunction qedf_get_host_port_idfunction qedf_fp_has_workfunction qedf_process_completionsfunction qedf_msix_handlerfunction qedf_simd_int_handlerfunction qedf_sync_free_irqsfunction qedf_request_msix_irqfunction qedf_setup_intfunction qedf_recv_frame
Annotated Snippet
static struct pci_driver qedf_pci_driver = {
.name = QEDF_MODULE_NAME,
.id_table = qedf_pci_tbl,
.probe = qedf_probe,
.remove = qedf_remove,
.shutdown = qedf_shutdown,
.suspend = qedf_suspend,
};
static int __qedf_probe(struct pci_dev *pdev, int mode)
{
int rc = -EINVAL;
struct fc_lport *lport;
struct qedf_ctx *qedf = NULL;
struct Scsi_Host *host;
bool is_vf = false;
struct qed_ll2_params params;
char host_buf[20];
struct qed_link_params link_params;
int status;
void *task_start, *task_end;
struct qed_slowpath_params slowpath_params;
struct qed_probe_params qed_params;
u16 retry_cnt = 10;
/*
* When doing error recovery we didn't reap the lport so don't try
* to reallocate it.
*/
retry_probe:
if (mode == QEDF_MODE_RECOVERY)
msleep(2000);
if (mode != QEDF_MODE_RECOVERY) {
lport = libfc_host_alloc(&qedf_host_template,
sizeof(struct qedf_ctx));
if (!lport) {
QEDF_ERR(NULL, "Could not allocate lport.\n");
rc = -ENOMEM;
goto err0;
}
fc_disc_init(lport);
/* Initialize qedf_ctx */
qedf = lport_priv(lport);
set_bit(QEDF_PROBING, &qedf->flags);
qedf->lport = lport;
qedf->ctlr.lp = lport;
qedf->pdev = pdev;
qedf->dbg_ctx.pdev = pdev;
qedf->dbg_ctx.host_no = lport->host->host_no;
spin_lock_init(&qedf->hba_lock);
INIT_LIST_HEAD(&qedf->fcports);
qedf->curr_conn_id = QEDF_MAX_SESSIONS - 1;
atomic_set(&qedf->num_offloads, 0);
qedf->stop_io_on_error = false;
pci_set_drvdata(pdev, qedf);
init_completion(&qedf->fipvlan_compl);
mutex_init(&qedf->stats_mutex);
mutex_init(&qedf->flush_mutex);
qedf->flogi_pending = 0;
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO,
"QLogic FastLinQ FCoE Module qedf %s, "
"FW %d.%d.%d.%d\n", QEDF_VERSION,
FW_MAJOR_VERSION, FW_MINOR_VERSION, FW_REVISION_VERSION,
FW_ENGINEERING_VERSION);
} else {
/* Init pointers during recovery */
qedf = pci_get_drvdata(pdev);
set_bit(QEDF_PROBING, &qedf->flags);
lport = qedf->lport;
}
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe started.\n");
host = lport->host;
/* Allocate mempool for qedf_io_work structs */
qedf->io_mempool = mempool_create_slab_pool(QEDF_IO_WORK_MIN,
qedf_io_work_cache);
if (qedf->io_mempool == NULL) {
QEDF_ERR(&(qedf->dbg_ctx), "qedf->io_mempool is NULL.\n");
goto err1;
}
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n",
qedf->io_mempool);
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/device.h`, `linux/highmem.h`, `linux/crc32.h`, `linux/interrupt.h`.
- Detected declarations: `function qedf_set_vlan_id`, `function qedf_initiate_fipvlan_req`, `function qedf_handle_link_update`, `function qedf_set_data_src_addr`, `function qedf_flogi_resp`, `function qedf_send_flogi`, `function qedf_link_recovery`, `function qedf_update_link_speed`, `function qedf_bw_update`, `function qedf_link_update`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.