drivers/scsi/qedf/qedf_io.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedf/qedf_io.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedf/qedf_io.c- Extension
.c- Size
- 73061 bytes
- Lines
- 2592
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- 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/spinlock.hlinux/vmalloc.hqedf.hscsi/scsi_tcq.h
Detected Declarations
function Copyrightfunction qedf_cmd_timeoutfunction qedf_cmd_mgr_freefunction qedf_handle_rrqfunction qedf_free_mp_rescfunction qedf_release_cmdfunction qedf_map_sgfunction scsi_for_each_sgfunction qedf_build_bd_list_from_sgfunction qedf_build_fcp_cmndfunction qedf_init_taskfunction qedf_init_mp_taskfunction qedf_get_sqe_idxfunction qedf_ring_doorbellfunction qedf_trace_iofunction qedf_post_io_reqfunction qedf_queuecommandfunction qedf_parse_fcp_rspfunction qedf_unmap_sg_listfunction qedf_scsi_completionfunction qedf_scsi_donefunction qedf_process_warning_complfunction qedf_process_error_detectfunction qedf_flush_els_reqfunction qedf_flush_active_iosfunction qedf_initiate_abtsfunction test_bitfunction qedf_process_abts_complfunction test_bitfunction qedf_init_mp_reqfunction qedf_drain_requestfunction qedf_initiate_cleanupfunction qedf_process_cleanup_complfunction qedf_execute_tmffunction qedf_initiate_tmffunction qedf_process_tmf_complfunction qedf_process_unsol_compl
Annotated Snippet
if (qedf == NULL) {
QEDF_INFO(NULL, QEDF_LOG_IO,
"qedf is NULL for ABTS xid=0x%x.\n",
io_req->xid);
return;
}
QEDF_ERR((&qedf->dbg_ctx), "ABTS timeout, xid=0x%x.\n",
io_req->xid);
/* Cleanup timed out ABTS */
qedf_initiate_cleanup(io_req, true);
complete(&io_req->abts_done);
/*
* Need to call kref_put for reference taken when initiate_abts
* was called since abts_compl won't be called now that we've
* cleaned up the task.
*/
kref_put(&io_req->refcount, qedf_release_cmd);
/* Clear in abort bit now that we're done with the command */
clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
/*
* Now that the original I/O and the ABTS are complete see
* if we need to reconnect to the target.
*/
qedf_restart_rport(fcport);
break;
case QEDF_ELS:
if (!qedf) {
QEDF_INFO(NULL, QEDF_LOG_IO,
"qedf is NULL for ELS xid=0x%x.\n",
io_req->xid);
return;
}
/* ELS request no longer outstanding since it timed out */
clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
kref_get(&io_req->refcount);
/*
* Don't attempt to clean an ELS timeout as any subseqeunt
* ABTS or cleanup requests just hang. For now just free
* the resources of the original I/O and the RRQ
*/
QEDF_ERR(&(qedf->dbg_ctx), "ELS timeout, xid=0x%x.\n",
io_req->xid);
qedf_initiate_cleanup(io_req, true);
io_req->event = QEDF_IOREQ_EV_ELS_TMO;
/* Call callback function to complete command */
if (io_req->cb_func && io_req->cb_arg) {
io_req->cb_func(io_req->cb_arg);
io_req->cb_arg = NULL;
}
kref_put(&io_req->refcount, qedf_release_cmd);
break;
case QEDF_SEQ_CLEANUP:
QEDF_ERR(&(qedf->dbg_ctx), "Sequence cleanup timeout, "
"xid=0x%x.\n", io_req->xid);
qedf_initiate_cleanup(io_req, true);
io_req->event = QEDF_IOREQ_EV_ELS_TMO;
qedf_process_seq_cleanup_compl(qedf, NULL, io_req);
break;
default:
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
"Hit default case, xid=0x%x.\n", io_req->xid);
break;
}
}
void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr)
{
struct io_bdt *bdt_info;
struct qedf_ctx *qedf = cmgr->qedf;
size_t bd_tbl_sz;
u16 min_xid = 0;
u16 max_xid = (FCOE_PARAMS_NUM_TASKS - 1);
int num_ios;
int i;
struct qedf_ioreq *io_req;
num_ios = max_xid - min_xid + 1;
/* Free fcoe_bdt_ctx structures */
if (!cmgr->io_bdt_pool) {
QEDF_ERR(&qedf->dbg_ctx, "io_bdt_pool is NULL.\n");
goto free_cmd_pool;
}
bd_tbl_sz = QEDF_MAX_BDS_PER_CMD * sizeof(struct scsi_sge);
Annotation
- Immediate include surface: `linux/spinlock.h`, `linux/vmalloc.h`, `qedf.h`, `scsi/scsi_tcq.h`.
- Detected declarations: `function Copyright`, `function qedf_cmd_timeout`, `function qedf_cmd_mgr_free`, `function qedf_handle_rrq`, `function qedf_free_mp_resc`, `function qedf_release_cmd`, `function qedf_map_sg`, `function scsi_for_each_sg`, `function qedf_build_bd_list_from_sg`, `function qedf_build_fcp_cmnd`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source 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.