drivers/scsi/qla2xxx/qla_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_init.c- Extension
.c- Size
- 276702 bytes
- Lines
- 10285
- 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
qla_def.hqla_gbl.hlinux/delay.hlinux/slab.hlinux/vmalloc.hqla_devtbl.hasm/prom.hqla_target.h
Detected Declarations
function qla2x00_sp_timeoutfunction qla2x00_sp_freefunction qla2xxx_rel_done_warningfunction qla2xxx_rel_free_warningfunction qla2x00_get_async_timeoutfunction qla24xx_abort_iocb_timeoutfunction qla24xx_abort_sp_donefunction qla24xx_async_abort_cmdfunction qla2x00_async_iocb_timeoutfunction qla2x00_async_login_sp_donefunction qla2x00_async_loginfunction qla2x00_async_logout_sp_donefunction qla2x00_async_logoutfunction qla2x00_async_prlo_donefunction qla2x00_async_prlo_sp_donefunction qla2x00_async_prlofunction qla24xx_handle_adisc_eventfunction qla_post_els_plogi_workfunction qla2x00_async_adisc_sp_donefunction qla2x00_async_adiscfunction qla2x00_is_reserved_idfunction qla2x00_find_new_loop_idfunction qla2x00_is_reserved_idfunction qla2x00_clear_loop_idfunction qla24xx_handle_gnl_done_eventfunction qla24xx_async_gnl_sp_donefunction list_for_each_entry_safefunction list_for_each_entry_safefunction list_for_each_entry_safefunction qla24xx_async_gnlfunction qla24xx_post_gnl_workfunction qla24xx_async_gpdb_sp_donefunction qla24xx_post_prli_workfunction qla2x00_async_prli_sp_donefunction qla24xx_async_prlifunction qla24xx_post_gpdb_workfunction qla24xx_async_gpdbfunction __qla24xx_handle_gpdb_eventfunction qla_chk_secure_loginfunction qla24xx_handle_gpdb_eventfunction qla_chk_n2n_b4_loginfunction qla24xx_fcport_handle_loginfunction qla24xx_post_newsess_workfunction qla_rscn_gen_tickfunction qla2x00_handle_rscnfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entry
Annotated Snippet
if (qpair->req->outstanding_cmds[handle] == sp) {
qpair->req->outstanding_cmds[handle] = NULL;
sp_found = 1;
qla_put_fw_resources(qpair, &sp->iores);
break;
}
}
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
if (cmdsp_found && sp->cmd_sp) {
/*
* This done function should take care of
* original command ref: INIT
*/
sp->cmd_sp->done(sp->cmd_sp, QLA_OS_TIMER_EXPIRED);
}
if (sp_found) {
abt->u.abt.comp_status = cpu_to_le16(CS_TIMEOUT);
sp->done(sp, QLA_OS_TIMER_EXPIRED);
}
}
static void qla24xx_abort_sp_done(srb_t *sp, int res)
{
struct srb_iocb *abt = &sp->u.iocb_cmd;
srb_t *orig_sp = sp->cmd_sp;
if (orig_sp)
qla_wait_nvme_release_cmd_kref(orig_sp);
if (sp->flags & SRB_WAKEUP_ON_COMP)
complete(&abt->u.abt.comp);
else
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
}
int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
{
scsi_qla_host_t *vha = cmd_sp->vha;
struct srb_iocb *abt_iocb;
srb_t *sp;
int rval = QLA_FUNCTION_FAILED;
/* ref: INIT for ABTS command */
sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport,
GFP_ATOMIC);
if (!sp)
return QLA_MEMORY_ALLOC_FAILED;
qla_vha_mark_busy(vha);
abt_iocb = &sp->u.iocb_cmd;
sp->type = SRB_ABT_CMD;
sp->name = "abort";
sp->qpair = cmd_sp->qpair;
sp->cmd_sp = cmd_sp;
if (wait)
sp->flags = SRB_WAKEUP_ON_COMP;
init_completion(&abt_iocb->u.abt.comp);
/* FW can send 2 x ABTS's timeout/20s */
qla2x00_init_async_sp(sp, 42, qla24xx_abort_sp_done);
sp->u.iocb_cmd.timeout = qla24xx_abort_iocb_timeout;
abt_iocb->u.abt.cmd_hndl = cmd_sp->handle;
abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id);
ql_dbg(ql_dbg_async, vha, 0x507c,
"Abort command issued - hdl=%x, type=%x\n", cmd_sp->handle,
cmd_sp->type);
rval = qla2x00_start_sp(sp);
if (rval != QLA_SUCCESS) {
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
return rval;
}
if (wait) {
wait_for_completion(&abt_iocb->u.abt.comp);
rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ?
QLA_SUCCESS : QLA_ERR_FROM_FW;
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
}
return rval;
}
Annotation
- Immediate include surface: `qla_def.h`, `qla_gbl.h`, `linux/delay.h`, `linux/slab.h`, `linux/vmalloc.h`, `qla_devtbl.h`, `asm/prom.h`, `qla_target.h`.
- Detected declarations: `function qla2x00_sp_timeout`, `function qla2x00_sp_free`, `function qla2xxx_rel_done_warning`, `function qla2xxx_rel_free_warning`, `function qla2x00_get_async_timeout`, `function qla24xx_abort_iocb_timeout`, `function qla24xx_abort_sp_done`, `function qla24xx_async_abort_cmd`, `function qla2x00_async_iocb_timeout`, `function qla2x00_async_login_sp_done`.
- 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.