drivers/scsi/elx/libefc/efc_cmds.c
Source file repositories/reference/linux-study-clean/drivers/scsi/elx/libefc/efc_cmds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/elx/libefc/efc_cmds.c- Extension
.c- Size
- 18595 bytes
- Lines
- 783
- 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.
- 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
efclib.h../libefc_sli/sli4.hefc_cmds.hefc_sm.h
Detected Declarations
function Copyrightfunction efc_nport_get_mbox_statusfunction efc_nport_free_unreg_vpi_cbfunction efc_nport_free_unreg_vpifunction efc_nport_send_evtfunction efc_nport_alloc_init_vpi_cbfunction efc_nport_alloc_init_vpifunction efc_nport_alloc_read_sparm64_cbfunction efc_nport_alloc_read_sparm64function efc_cmd_nport_allocfunction efc_nport_attach_reg_vpi_cbfunction efc_cmd_nport_attachfunction efc_cmd_nport_freefunction efc_domain_get_mbox_statusfunction efc_domain_free_resourcesfunction efc_domain_send_nport_evtfunction efc_domain_alloc_read_sparm64_cbfunction efc_domain_alloc_read_sparm64function efc_domain_alloc_init_vfi_cbfunction efc_domain_alloc_init_vfifunction efc_cmd_domain_allocfunction efc_domain_attach_reg_vfi_cbfunction efc_cmd_domain_attachfunction efc_domain_free_unreg_vfi_cbfunction efc_domain_free_unreg_vfifunction efc_cmd_domain_freefunction efc_cmd_node_allocfunction efc_cmd_node_attach_cbfunction efc_cmd_node_attachfunction efc_node_free_resourcesfunction efc_cmd_node_free_cbfunction efc_cmd_node_detach
Annotated Snippet
if (rnode->attached) {
efc_log_err(efc, "rnode is still attached\n");
return -EIO;
}
if (rnode->indicator != U32_MAX) {
if (sli_resource_free(efc->sli, SLI4_RSRC_RPI,
rnode->indicator)) {
efc_log_err(efc,
"RPI free fail RPI %d addr=%#x\n",
rnode->indicator, rnode->fc_id);
rc = -EIO;
} else {
rnode->indicator = U32_MAX;
rnode->index = U32_MAX;
}
}
}
return rc;
}
static int
efc_cmd_node_free_cb(struct efc *efc, int status, u8 *mqe, void *arg)
{
struct efc_remote_node *rnode = arg;
struct sli4_mbox_command_header *hdr =
(struct sli4_mbox_command_header *)mqe;
int evt = EFC_EVT_NODE_FREE_FAIL;
int rc = 0;
if (status || le16_to_cpu(hdr->status)) {
efc_log_debug(efc, "bad status cqe=%#x mqe=%#x\n", status,
le16_to_cpu(hdr->status));
/*
* In certain cases, a non-zero MQE status is OK (all must be
* true):
* - node is attached
* - status is 0x1400
*/
if (!rnode->attached ||
(le16_to_cpu(hdr->status) != SLI4_MBX_STATUS_RPI_NOT_REG))
rc = -EIO;
}
if (!rc) {
rnode->attached = false;
evt = EFC_EVT_NODE_FREE_OK;
}
efc_remote_node_cb(efc, evt, rnode);
return rc;
}
int
efc_cmd_node_detach(struct efc *efc, struct efc_remote_node *rnode)
{
u8 buf[SLI4_BMBX_SIZE];
int rc = -EIO;
if (!rnode) {
efc_log_err(efc, "bad parameter rnode=%p\n", rnode);
return -EIO;
}
if (rnode->nport) {
if (!rnode->attached)
return -EIO;
rc = -EIO;
if (!sli_cmd_unreg_rpi(efc->sli, buf, rnode->indicator,
SLI4_RSRC_RPI, U32_MAX))
rc = efc->tt.issue_mbox_rqst(efc->base, buf,
efc_cmd_node_free_cb, rnode);
if (rc != 0) {
efc_log_err(efc, "UNREG_RPI failed\n");
rc = -EIO;
}
}
return rc;
}
Annotation
- Immediate include surface: `efclib.h`, `../libefc_sli/sli4.h`, `efc_cmds.h`, `efc_sm.h`.
- Detected declarations: `function Copyright`, `function efc_nport_get_mbox_status`, `function efc_nport_free_unreg_vpi_cb`, `function efc_nport_free_unreg_vpi`, `function efc_nport_send_evt`, `function efc_nport_alloc_init_vpi_cb`, `function efc_nport_alloc_init_vpi`, `function efc_nport_alloc_read_sparm64_cb`, `function efc_nport_alloc_read_sparm64`, `function efc_cmd_nport_alloc`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- 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.