drivers/scsi/lpfc/lpfc_ct.c
Source file repositories/reference/linux-study-clean/drivers/scsi/lpfc/lpfc_ct.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/lpfc/lpfc_ct.c- Extension
.c- Size
- 110281 bytes
- Lines
- 3835
- 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/interrupt.hlinux/slab.hlinux/utsname.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_transport_fc.hscsi/fc/fc_fs.hlpfc_hw4.hlpfc_hw.hlpfc_sli.hlpfc_sli4.hlpfc_nl.hlpfc_disc.hlpfc.hlpfc_scsi.hlpfc_logmsg.hlpfc_crtn.hlpfc_version.hlpfc_vport.hlpfc_debugfs.h
Detected Declarations
function lpfc_ct_ignore_hbq_bufferfunction lpfc_ct_unsol_bufferfunction lpfc_ct_unsol_cmplfunction lpfc_ct_reject_eventfunction lpfc_ct_handle_mibreqfunction lpfc_ct_unsol_eventfunction list_for_each_entryfunction list_for_each_entryfunction lpfc_ct_handle_unsol_abortfunction lpfc_free_ct_rspfunction list_for_each_entry_safefunction lpfc_alloc_ct_rspfunction lpfc_ct_free_iocbfunction lpfc_gen_reqfunction lpfc_ct_cmdfunction lpfc_find_vport_by_didfunction lpfc_prep_node_fc4typefunction lpfc_ns_rsp_audit_didfunction list_for_each_entryfunction lpfc_ns_rspfunction list_for_each_entryfunction lpfc_cmpl_ct_cmd_gid_ftfunction lpfc_cmpl_ct_cmd_gid_ptfunction lpfc_cmpl_ct_cmd_gff_idfunction lpfc_cmpl_ct_cmd_gft_idfunction lpfc_cmpl_ctfunction lpfc_cmpl_ct_cmd_rft_idfunction lpfc_cmpl_ct_cmd_rnn_idfunction lpfc_cmpl_ct_cmd_rspn_idfunction lpfc_cmpl_ct_cmd_rsnn_nnfunction lpfc_cmpl_ct_cmd_rspni_pnifunction lpfc_cmpl_ct_cmd_da_idfunction lpfc_cmpl_ct_cmd_rff_idfunction lpfc_vport_symbolic_port_namefunction lpfc_vport_symbolic_node_namefunction lpfc_find_map_nodefunction lpfc_get_gidft_typefunction lpfc_ns_cmdfunction NVMEfunction lpfc_fdmi_rprt_deferfunction lpfc_cmpl_ct_disc_fdmifunction lpfc_fdmi_change_checkfunction lpfc_fdmi_set_attr_u32function lpfc_fdmi_set_attr_wwnfunction lpfc_fdmi_set_attr_fullwwnfunction lpfc_fdmi_set_attr_stringfunction lpfc_fdmi_set_attr_fc4typesfunction lpfc_fdmi_hba_attr_wwnn
Annotated Snippet
list_for_each_entry(iocb, &head, list) {
if (phba->sli_rev == LPFC_SLI_REV4)
bde_count = iocb->wcqe_cmpl.word3;
else
bde_count = iocb->iocb.ulpBdeCount;
if (!bde_count)
continue;
bdeBuf1 = iocb->cmd_dmabuf;
iocb->cmd_dmabuf = NULL;
if (phba->sli_rev == LPFC_SLI_REV4)
size = iocb->wqe.gen_req.bde.tus.f.bdeSize;
else
size = iocb->iocb.un.cont64[0].tus.f.bdeSize;
lpfc_ct_unsol_buffer(phba, ctiocbq, bdeBuf1, size);
lpfc_in_buf_free(phba, bdeBuf1);
if (bde_count == 2) {
bdeBuf2 = iocb->bpl_dmabuf;
iocb->bpl_dmabuf = NULL;
if (phba->sli_rev == LPFC_SLI_REV4)
size = iocb->unsol_rcv_len;
else
size = iocb->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize;
lpfc_ct_unsol_buffer(phba, ctiocbq, bdeBuf2,
size);
lpfc_in_buf_free(phba, bdeBuf2);
}
}
list_del(&head);
} else {
INIT_LIST_HEAD(&head);
list_add_tail(&head, &ctiocbq->list);
list_for_each_entry(iocbq, &head, list) {
icmd = &iocbq->iocb;
if (icmd->ulpBdeCount == 0)
lpfc_ct_unsol_buffer(phba, iocbq, NULL, 0);
for (i = 0; i < icmd->ulpBdeCount; i++) {
dma_addr = getPaddr(icmd->un.cont64[i].addrHigh,
icmd->un.cont64[i].addrLow);
mp = lpfc_sli_ringpostbuf_get(phba, pring,
dma_addr);
size = icmd->un.cont64[i].tus.f.bdeSize;
lpfc_ct_unsol_buffer(phba, iocbq, mp, size);
lpfc_in_buf_free(phba, mp);
}
lpfc_sli3_post_buffer(phba, pring, i);
}
list_del(&head);
}
}
/**
* lpfc_ct_handle_unsol_abort - ct upper level protocol abort handler
* @phba: Pointer to HBA context object.
* @dmabuf: pointer to a dmabuf that describes the FC sequence
*
* This function serves as the upper level protocol abort handler for CT
* protocol.
*
* Return 1 if abort has been handled, 0 otherwise.
**/
int
lpfc_ct_handle_unsol_abort(struct lpfc_hba *phba, struct hbq_dmabuf *dmabuf)
{
int handled;
/* CT upper level goes through BSG */
handled = lpfc_bsg_ct_unsol_abort(phba, dmabuf);
return handled;
}
static void
lpfc_free_ct_rsp(struct lpfc_hba *phba, struct lpfc_dmabuf *mlist)
{
struct lpfc_dmabuf *mlast, *next_mlast;
list_for_each_entry_safe(mlast, next_mlast, &mlist->list, list) {
list_del(&mlast->list);
lpfc_mbuf_free(phba, mlast->virt, mlast->phys);
kfree(mlast);
}
lpfc_mbuf_free(phba, mlist->virt, mlist->phys);
kfree(mlist);
return;
}
static struct lpfc_dmabuf *
lpfc_alloc_ct_rsp(struct lpfc_hba *phba, __be16 cmdcode, struct ulp_bde64 *bpl,
uint32_t size, int *entries)
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/slab.h`, `linux/utsname.h`, `scsi/scsi.h`, `scsi/scsi_device.h`, `scsi/scsi_host.h`.
- Detected declarations: `function lpfc_ct_ignore_hbq_buffer`, `function lpfc_ct_unsol_buffer`, `function lpfc_ct_unsol_cmpl`, `function lpfc_ct_reject_event`, `function lpfc_ct_handle_mibreq`, `function lpfc_ct_unsol_event`, `function list_for_each_entry`, `function list_for_each_entry`, `function lpfc_ct_handle_unsol_abort`, `function lpfc_free_ct_rsp`.
- 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.