drivers/scsi/qla2xxx/qla_mbx.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_mbx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_mbx.c- Extension
.c- Size
- 184341 bytes
- Lines
- 7257
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qla_def.hqla_target.hlinux/delay.hlinux/gfp.h
Detected Declarations
struct tsk_mgmt_cmdstruct cs84xx_mgmt_cmdfunction is_rom_cmdfunction qla2x00_mailbox_commandfunction test_bitfunction test_bitfunction qla2x00_load_ramfunction qla2x00_execute_fwfunction qla28xx_load_flash_firmwarefunction qla_get_exlogin_statusfunction qla_set_exlogin_mem_cfgfunction qla_get_exchoffld_statusfunction qla_set_exchoffld_mem_cfgfunction qla2x00_get_fw_versionfunction qla2x00_get_fw_optionsfunction qla2x00_set_fw_optionsfunction qla2x00_mbx_reg_testfunction qla2x00_verify_checksumfunction qla2x00_issue_iocb_timeoutfunction qla2x00_issue_iocbfunction qla2x00_abort_commandfunction qla2x00_abort_targetfunction qla2x00_lun_resetfunction qla2x00_get_adapter_idfunction qla2x00_get_retry_cntfunction qla2x00_init_firmwarefunction qla2x00_get_port_databasefunction qla24xx_get_port_databasefunction qla2x00_get_firmware_statefunction qla2x00_get_port_namefunction qla24xx_link_initializefunction qla2x00_lip_resetfunction qla2x00_send_snsfunction qla24xx_login_fabricfunction qla2x00_login_fabricfunction qla2x00_login_local_devicefunction qla24xx_fabric_logoutfunction qla2x00_fabric_logoutfunction qla2x00_full_login_lipfunction qla2x00_get_id_listfunction qla2x00_get_resource_cntsfunction FCALfunction qla2x00_get_link_statusfunction qla24xx_get_isp_statsfunction qla24xx_abort_commandfunction __qla24xx_issue_tmffunction qla24xx_abort_targetfunction qla24xx_lun_reset
Annotated Snippet
struct tsk_mgmt_cmd {
union {
struct tsk_mgmt_entry tsk;
struct sts_entry_24xx sts;
} p;
};
static int
__qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
uint64_t l, int tag)
{
int rval, rval2;
struct tsk_mgmt_cmd *tsk;
struct sts_entry_24xx *sts;
dma_addr_t tsk_dma;
scsi_qla_host_t *vha;
struct qla_hw_data *ha;
struct req_que *req;
struct qla_qpair *qpair;
vha = fcport->vha;
ha = vha->hw;
req = vha->req;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1092,
"Entered %s.\n", __func__);
if (vha->vp_idx && vha->qpair) {
/* NPIV port */
qpair = vha->qpair;
req = qpair->req;
}
tsk = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
if (tsk == NULL) {
ql_log(ql_log_warn, vha, 0x1093,
"Failed to allocate task management IOCB.\n");
return QLA_MEMORY_ALLOC_FAILED;
}
tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE;
tsk->p.tsk.entry_count = 1;
tsk->p.tsk.handle = make_handle(req->id, tsk->p.tsk.handle);
tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id);
tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
tsk->p.tsk.control_flags = cpu_to_le32(type);
tsk->p.tsk.port_id[0] = fcport->d_id.b.al_pa;
tsk->p.tsk.port_id[1] = fcport->d_id.b.area;
tsk->p.tsk.port_id[2] = fcport->d_id.b.domain;
tsk->p.tsk.vp_index = fcport->vha->vp_idx;
if (type == TCF_LUN_RESET) {
int_to_scsilun(l, &tsk->p.tsk.lun);
host_to_fcp_swap((uint8_t *)&tsk->p.tsk.lun,
sizeof(tsk->p.tsk.lun));
}
sts = &tsk->p.sts;
rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0);
if (rval != QLA_SUCCESS) {
ql_dbg(ql_dbg_mbx, vha, 0x1094,
"Failed to issue %s reset IOCB (%x).\n", name, rval);
} else if (sts->entry_status != 0) {
ql_dbg(ql_dbg_mbx, vha, 0x1095,
"Failed to complete IOCB -- error status (%x).\n",
sts->entry_status);
rval = QLA_FUNCTION_FAILED;
} else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) {
ql_dbg(ql_dbg_mbx, vha, 0x1096,
"Failed to complete IOCB -- completion status (%x).\n",
le16_to_cpu(sts->comp_status));
rval = QLA_FUNCTION_FAILED;
} else if (le16_to_cpu(sts->scsi_status) &
SS_RESPONSE_INFO_LEN_VALID) {
if (le32_to_cpu(sts->rsp_data_len) < 4) {
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1097,
"Ignoring inconsistent data length -- not enough "
"response info (%d).\n",
le32_to_cpu(sts->rsp_data_len));
} else if (sts->data[3]) {
ql_dbg(ql_dbg_mbx, vha, 0x1098,
"Failed to complete IOCB -- response (%x).\n",
sts->data[3]);
rval = QLA_FUNCTION_FAILED;
}
}
/* Issue marker IOCB. */
rval2 = qla2x00_marker(vha, ha->base_qpair, fcport->loop_id, l,
type == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID);
if (rval2 != QLA_SUCCESS) {
Annotation
- Immediate include surface: `qla_def.h`, `qla_target.h`, `linux/delay.h`, `linux/gfp.h`.
- Detected declarations: `struct tsk_mgmt_cmd`, `struct cs84xx_mgmt_cmd`, `function is_rom_cmd`, `function qla2x00_mailbox_command`, `function test_bit`, `function test_bit`, `function qla2x00_load_ram`, `function qla2x00_execute_fw`, `function qla28xx_load_flash_firmware`, `function qla_get_exlogin_status`.
- 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.