drivers/scsi/qla2xxx/qla_nvme.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_nvme.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_nvme.c- Extension
.c- Size
- 36343 bytes
- Lines
- 1329
- 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.
- 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_nvme.hlinux/scatterlist.hlinux/delay.hlinux/nvme.hlinux/nvme-fc.hlinux/blk-mq.h
Detected Declarations
struct qla_nvme_unsol_ctxfunction qla_nvme_register_remotefunction qla_nvme_alloc_queuefunction qla_nvme_release_fcp_cmd_kreffunction qla_nvme_release_ls_cmd_kreffunction qla_nvme_ls_completefunction qla_nvme_sp_ls_donefunction qla_nvme_release_lsrsp_cmd_kreffunction qla_nvme_lsrsp_completefunction qla_nvme_sp_lsrsp_donefunction qla_nvme_sp_donefunction qla_nvme_abort_workfunction qla_nvme_xmt_ls_rspfunction qla_nvme_ls_abortfunction qla_nvme_ls_reqfunction qla_nvme_fcp_abortfunction qla2x00_start_nvme_mqfunction qla_nvme_post_cmdfunction qla_nvme_map_queuesfunction qla_nvme_localport_deletefunction qla_nvme_remoteport_deletefunction qla_nvme_unregister_remote_portfunction qla_nvme_deletefunction qla_nvme_register_hbafunction qla_nvme_abort_set_optionfunction qla_nvme_abort_process_comp_statusfunction qla_wait_nvme_release_cmd_kreffunction qla_nvme_fc_format_rjtfunction qla_nvme_lsrjt_pt_iocbfunction qla_nvme_ls_reject_iocbfunction qla2xxx_process_purls_pktfunction qla2xxx_get_vha_from_vp_idxfunction qla2xxx_process_purls_iocb
Annotated Snippet
struct qla_nvme_unsol_ctx {
struct list_head elem;
struct scsi_qla_host *vha;
struct fc_port *fcport;
struct srb *sp;
struct nvmefc_ls_rsp lsrsp;
struct nvmefc_ls_rsp *fd_rsp;
struct work_struct lsrsp_work;
struct work_struct abort_work;
__le32 exchange_address;
__le16 nport_handle;
__le16 ox_id;
int comp_status;
spinlock_t cmd_lock;
};
int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
{
struct qla_nvme_rport *rport;
struct nvme_fc_port_info req;
int ret;
if (!IS_ENABLED(CONFIG_NVME_FC))
return 0;
if (!vha->flags.nvme_enabled) {
ql_log(ql_log_info, vha, 0x2100,
"%s: Not registering target since Host NVME is not enabled\n",
__func__);
return 0;
}
if (qla_nvme_register_hba(vha))
return 0;
if (!vha->nvme_local_port)
return 0;
if (!(fcport->nvme_prli_service_param &
(NVME_PRLI_SP_TARGET | NVME_PRLI_SP_DISCOVERY)) ||
(fcport->nvme_flag & NVME_FLAG_REGISTERED))
return 0;
fcport->nvme_flag &= ~NVME_FLAG_RESETTING;
memset(&req, 0, sizeof(struct nvme_fc_port_info));
req.port_name = wwn_to_u64(fcport->port_name);
req.node_name = wwn_to_u64(fcport->node_name);
req.port_role = 0;
req.dev_loss_tmo = fcport->dev_loss_tmo;
if (fcport->nvme_prli_service_param & NVME_PRLI_SP_INITIATOR)
req.port_role = FC_PORT_ROLE_NVME_INITIATOR;
if (fcport->nvme_prli_service_param & NVME_PRLI_SP_TARGET)
req.port_role |= FC_PORT_ROLE_NVME_TARGET;
if (fcport->nvme_prli_service_param & NVME_PRLI_SP_DISCOVERY)
req.port_role |= FC_PORT_ROLE_NVME_DISCOVERY;
req.port_id = fcport->d_id.b24;
ql_log(ql_log_info, vha, 0x2102,
"%s: traddr=nn-0x%016llx:pn-0x%016llx PortID:%06x\n",
__func__, req.node_name, req.port_name,
req.port_id);
ret = nvme_fc_register_remoteport(vha->nvme_local_port, &req,
&fcport->nvme_remote_port);
if (ret) {
ql_log(ql_log_warn, vha, 0x212e,
"Failed to register remote port. Transport returned %d\n",
ret);
return ret;
}
nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port,
fcport->dev_loss_tmo);
if (fcport->nvme_prli_service_param & NVME_PRLI_SP_SLER)
ql_log(ql_log_info, vha, 0x212a,
"PortID:%06x Supports SLER\n", req.port_id);
if (fcport->nvme_prli_service_param & NVME_PRLI_SP_PI_CTRL)
ql_log(ql_log_info, vha, 0x212b,
"PortID:%06x Supports PI control\n", req.port_id);
rport = fcport->nvme_remote_port->private;
rport->fcport = fcport;
Annotation
- Immediate include surface: `qla_nvme.h`, `linux/scatterlist.h`, `linux/delay.h`, `linux/nvme.h`, `linux/nvme-fc.h`, `linux/blk-mq.h`.
- Detected declarations: `struct qla_nvme_unsol_ctx`, `function qla_nvme_register_remote`, `function qla_nvme_alloc_queue`, `function qla_nvme_release_fcp_cmd_kref`, `function qla_nvme_release_ls_cmd_kref`, `function qla_nvme_ls_complete`, `function qla_nvme_sp_ls_done`, `function qla_nvme_release_lsrsp_cmd_kref`, `function qla_nvme_lsrsp_complete`, `function qla_nvme_sp_lsrsp_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.
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.