drivers/scsi/lpfc/lpfc_els.c
Source file repositories/reference/linux-study-clean/drivers/scsi/lpfc/lpfc_els.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/lpfc/lpfc_els.c- Extension
.c- Size
- 392414 bytes
- Lines
- 12580
- 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
linux/blkdev.hlinux/pci.hlinux/slab.hlinux/interrupt.hlinux/delay.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_transport_fc.huapi/scsi/fc/fc_fs.huapi/scsi/fc/fc_els.hlpfc_hw4.hlpfc_hw.hlpfc_sli.hlpfc_sli4.hlpfc_nl.hlpfc_disc.hlpfc_scsi.hlpfc.hlpfc_logmsg.hlpfc_crtn.hlpfc_vport.hlpfc_debugfs.h
Detected Declarations
function lpfc_els_chk_lattfunction lpfc_is_els_acc_rspfunction Servicefunction test_bitfunction lpfc_issue_fabric_regloginfunction lpfc_issue_reg_vfifunction test_bitfunction lpfc_issue_unreg_vfifunction lpfc_check_clean_addr_bitfunction lpfc_cmpl_els_flogifunction lpfc_cmpl_els_flogifunction lpfc_cmpl_els_flogi_nportfunction test_bitfunction lpfc_cmpl_els_link_downfunction Loginfunction Loginfunction Loginfunction Discoverfunction lpfc_els_disc_plogifunction lpfc_plogi_confirm_nportfunction Notificationsfunction lpfc_cmpl_els_rrqfunction Loginfunction Loginfunction Loginfunction test_bitfunction lpfc_els_retryfunction Loginfunction Notificationfunction lpfc_adisc_donefunction Discoverfunction lpfc_els_retryfunction Discoverfunction Logoutfunction Logoutfunction Responsefunction NPort_IDfunction Requestfunction Requestfunction nportfunction thisfunction lpfc_issue_els_rdffunction lpfc_els_rcv_rdffunction lpfc_least_capable_settingsfunction Capabilitiesfunction lpfc_format_edc_lft_descfunction lpfc_format_edc_cgn_descfunction lpfc_link_is_lds_capable
Annotated Snippet
switch (elscmd) {
case ELS_CMD_FLOGI:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_FLOGI << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK);
break;
case ELS_CMD_FDISC:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_FDISC << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK);
break;
case ELS_CMD_LOGO:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_LOGO << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK);
break;
}
else
elsiocb->cmd_flag &= ~LPFC_FIP_ELS_ID_MASK;
/* fill in BDEs for command */
/* Allocate buffer for command payload */
pcmd = kmalloc_obj(*pcmd);
if (pcmd)
pcmd->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &pcmd->phys);
if (!pcmd || !pcmd->virt)
goto els_iocb_free_pcmb_exit;
INIT_LIST_HEAD(&pcmd->list);
/* Allocate buffer for response payload */
if (expect_rsp) {
prsp = kmalloc_obj(*prsp);
if (prsp)
prsp->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
&prsp->phys);
if (!prsp || !prsp->virt)
goto els_iocb_free_prsp_exit;
INIT_LIST_HEAD(&prsp->list);
} else {
prsp = NULL;
}
/* Allocate buffer for Buffer ptr list */
pbuflist = kmalloc_obj(*pbuflist);
if (pbuflist)
pbuflist->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
&pbuflist->phys);
if (!pbuflist || !pbuflist->virt)
goto els_iocb_free_pbuf_exit;
INIT_LIST_HEAD(&pbuflist->list);
if (expect_rsp) {
switch (elscmd) {
case ELS_CMD_FLOGI:
timeout = FF_DEF_RATOV * 2;
break;
case ELS_CMD_LOGO:
timeout = phba->fc_ratov;
break;
default:
timeout = phba->fc_ratov * 2;
}
/* Fill SGE for the num bde count */
elsiocb->num_bdes = 2;
}
if (phba->sli_rev == LPFC_SLI_REV4)
bmp = pcmd;
else
bmp = pbuflist;
lpfc_sli_prep_els_req_rsp(phba, elsiocb, vport, bmp, cmd_size, did,
elscmd, timeout, expect_rsp);
bpl = (struct ulp_bde64_le *)pbuflist->virt;
bpl->addr_low = cpu_to_le32(putPaddrLow(pcmd->phys));
bpl->addr_high = cpu_to_le32(putPaddrHigh(pcmd->phys));
bpl->type_size = cpu_to_le32(cmd_size);
bpl->type_size |= cpu_to_le32(ULP_BDE64_TYPE_BDE_64);
if (expect_rsp) {
bpl++;
bpl->addr_low = cpu_to_le32(putPaddrLow(prsp->phys));
bpl->addr_high = cpu_to_le32(putPaddrHigh(prsp->phys));
bpl->type_size = cpu_to_le32(FCELSSIZE);
bpl->type_size |= cpu_to_le32(ULP_BDE64_TYPE_BDE_64);
}
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/pci.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/delay.h`, `scsi/scsi.h`, `scsi/scsi_device.h`, `scsi/scsi_host.h`.
- Detected declarations: `function lpfc_els_chk_latt`, `function lpfc_is_els_acc_rsp`, `function Service`, `function test_bit`, `function lpfc_issue_fabric_reglogin`, `function lpfc_issue_reg_vfi`, `function test_bit`, `function lpfc_issue_unreg_vfi`, `function lpfc_check_clean_addr_bit`, `function lpfc_cmpl_els_flogi`.
- 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.