drivers/scsi/lpfc/lpfc_hbadisc.c
Source file repositories/reference/linux-study-clean/drivers/scsi/lpfc/lpfc_hbadisc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/lpfc/lpfc_hbadisc.c- Extension
.c- Size
- 215220 bytes
- Lines
- 7226
- 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/delay.hlinux/slab.hlinux/pci.hlinux/kthread.hlinux/interrupt.hlinux/lockdep.hlinux/utsname.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_transport_fc.hscsi/fc/fc_fs.hlpfc_hw4.hlpfc_hw.hlpfc_nl.hlpfc_disc.hlpfc_sli.hlpfc_sli4.hlpfc.hlpfc_scsi.hlpfc_nvme.hlpfc_logmsg.hlpfc_crtn.hlpfc_vport.hlpfc_debugfs.h
Detected Declarations
function lpfc_valid_xpt_nodefunction lpfc_rport_invalidfunction lpfc_terminate_rport_iofunction lpfc_dev_loss_tmo_callbkfunction lpfc_check_inactive_vmid_onefunction lpfc_check_inactive_vmidfunction lpfc_check_nlp_post_devlossfunction lpfc_dev_loss_tmo_handlerfunction lpfc_check_vmid_qfpa_issuefunction lpfc_sli4_post_dev_loss_tmo_handlerfunction lpfc_alloc_fast_evtfunction lpfc_free_fast_evtfunction lpfc_send_fastpath_evtfunction lpfc_work_list_donefunction lpfc_work_donefunction test_bitfunction lpfc_do_workfunction lpfc_workq_post_eventfunction lpfc_cleanup_rpisfunction list_for_each_entry_safefunction lpfc_port_link_failurefunction lpfc_linkdown_portfunction lpfc_linkdownfunction lpfc_linkup_cleanup_nodesfunction list_for_each_entryfunction lpfc_linkup_portfunction lpfc_linkupfunction lpfc_mbx_cmpl_clear_lafunction lpfc_mbx_cmpl_local_config_linkfunction lpfc_sli4_clear_fcf_rr_bmaskfunction lpfc_mbx_cmpl_reg_fcfifunction lpfc_fab_name_matchfunction lpfc_sw_name_matchfunction lpfc_mac_addr_matchfunction lpfc_vlan_id_matchfunction __lpfc_update_fcf_record_prifunction lpfc_copy_fcf_recordfunction __lpfc_update_fcf_recordfunction lpfc_register_fcffunction lpfc_match_fcf_conn_listfunction list_for_each_entryfunction lpfc_check_pending_fcoe_eventfunction lpfc_sli4_new_fcf_random_selectfunction lpfc_sli4_fcf_rec_mbox_parsefunction lpfc_sli4_log_fcf_record_infofunction lpfc_sli4_fcf_record_matchfunction lpfc_sli4_fcf_rr_next_procfunction lpfc_sli4_fcf_pri_list_del
Annotated Snippet
if (ndlp->fc4_xpt_flags & SCSI_XPT_REGD) {
ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD;
/* If NLP_XPT_REGD was cleared in lpfc_nlp_unreg_node,
* unregister calls were made to the scsi and nvme
* transports and refcnt was already decremented. Clear
* the NLP_XPT_REGD flag only if the NVME nrport is
* confirmed unregistered.
*/
if (ndlp->fc4_xpt_flags & NLP_XPT_REGD) {
if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD))
ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD;
spin_unlock_irqrestore(&ndlp->lock, iflags);
/* Release scsi transport reference */
lpfc_nlp_put(ndlp);
} else {
spin_unlock_irqrestore(&ndlp->lock, iflags);
}
} else {
spin_unlock_irqrestore(&ndlp->lock, iflags);
}
if (drop_initial_node_ref)
lpfc_nlp_put(ndlp);
return;
}
if (ndlp->nlp_state == NLP_STE_MAPPED_NODE)
return;
/* Ignore callback for a mismatched (stale) rport */
if (ndlp->rport != rport) {
lpfc_vlog_msg(vport, KERN_WARNING, LOG_NODE,
"6788 fc rport mismatch: d_id x%06x ndlp x%px "
"fc rport x%px node rport x%px state x%x "
"refcnt %u\n",
ndlp->nlp_DID, ndlp, rport, ndlp->rport,
ndlp->nlp_state, kref_read(&ndlp->kref));
return;
}
if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn))
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"6789 rport name %llx != node port name %llx",
rport->port_name,
wwn_to_u64(ndlp->nlp_portname.u.wwn));
evtp = &ndlp->dev_loss_evt;
if (!list_empty(&evtp->evt_listp)) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"6790 rport name %llx dev_loss_evt pending\n",
rport->port_name);
return;
}
set_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
spin_lock_irqsave(&ndlp->lock, iflags);
/* If there is a PLOGI in progress, and we are in a
* NLP_NPR_2B_DISC state, don't turn off the flag.
*/
if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE)
clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
/*
* The backend does not expect any more calls associated with this
* rport. Remove the association between rport and ndlp.
*/
ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD;
((struct lpfc_rport_data *)rport->dd_data)->pnode = NULL;
ndlp->rport = NULL;
spin_unlock_irqrestore(&ndlp->lock, iflags);
if (phba->worker_thread) {
/* We need to hold the node by incrementing the reference
* count until this queued work is done
*/
evtp->evt_arg1 = lpfc_nlp_get(ndlp);
spin_lock_irqsave(&phba->hbalock, iflags);
if (evtp->evt_arg1) {
evtp->evt = LPFC_EVT_DEV_LOSS;
list_add_tail(&evtp->evt_listp, &phba->work_list);
spin_unlock_irqrestore(&phba->hbalock, iflags);
lpfc_worker_wake_up(phba);
return;
}
spin_unlock_irqrestore(&phba->hbalock, iflags);
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/delay.h`, `linux/slab.h`, `linux/pci.h`, `linux/kthread.h`, `linux/interrupt.h`, `linux/lockdep.h`, `linux/utsname.h`.
- Detected declarations: `function lpfc_valid_xpt_node`, `function lpfc_rport_invalid`, `function lpfc_terminate_rport_io`, `function lpfc_dev_loss_tmo_callbk`, `function lpfc_check_inactive_vmid_one`, `function lpfc_check_inactive_vmid`, `function lpfc_check_nlp_post_devloss`, `function lpfc_dev_loss_tmo_handler`, `function lpfc_check_vmid_qfpa_issue`, `function lpfc_sli4_post_dev_loss_tmo_handler`.
- 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.