drivers/scsi/csiostor/csio_lnode.c
Source file repositories/reference/linux-study-clean/drivers/scsi/csiostor/csio_lnode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/csiostor/csio_lnode.c- Extension
.c- Size
- 55114 bytes
- Lines
- 2152
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/kernel.hlinux/delay.hlinux/slab.hlinux/utsname.hscsi/scsi_device.hscsi/scsi_transport_fc.hlinux/unaligned.hscsi/fc/fc_els.hscsi/fc/fc_fs.hscsi/fc/fc_gs.hscsi/fc/fc_ms.hcsio_hw.hcsio_mb.hcsio_lnode.hcsio_rnode.h
Detected Declarations
function csio_ln_lookup_by_portidfunction csio_ln_lookup_by_vnpifunction list_for_eachfunction csio_lnode_lookup_by_wwpnfunction list_for_eachfunction csio_fill_ct_iufunction csio_hostnamefunction csio_osnamefunction csio_append_attribfunction csio_ln_fdmi_donefunction csio_ln_fdmi_rhba_cbfnfunction csio_ln_fdmi_dprt_cbfnfunction csio_ln_fdmi_dhba_cbfnfunction csio_ln_fdmi_startfunction csio_ln_vnp_read_cbfnfunction csio_ln_vnp_readfunction csio_fcoe_enable_linkfunction csio_ln_read_fcf_cbfnfunction csio_ln_read_fcf_entryfunction csio_handle_link_upfunction csio_post_event_rnsfunction list_for_each_safefunction csio_cleanup_rnsfunction list_for_each_safefunction csio_post_event_lnsfunction csio_ln_downfunction csio_handle_link_downfunction csio_is_lnode_readyfunction csio_lns_uninitfunction csio_lns_onlinefunction csio_lns_readyfunction csio_lns_offlinefunction csio_free_fcfinfofunction csio_lnode_state_to_strfunction csio_get_phy_port_statsfunction csio_ln_mgmt_wr_handlerfunction csio_fcoe_fwevt_handlerfunction FCOE_LINKfunction csio_lnode_stopfunction csio_lnode_closefunction csio_ln_prep_ecwrfunction csio_ln_mgmt_submit_wrfunction csio_ln_mgmt_submit_reqfunction csio_ln_fdmi_initfunction csio_ln_fdmi_exitfunction csio_scan_donefunction csio_notify_lnodesfunction csio_disable_lnodes
Annotated Snippet
list_for_each(tmp2, &sln->cln_head) {
cln = (struct csio_lnode *) tmp2;
if (cln->vnp_flowid == vnp_id)
return cln;
}
}
CSIO_INC_STATS(hw, n_lnlkup_miss);
return NULL;
}
/**
* csio_lnode_lookup_by_wwpn - Lookup lnode using given wwpn.
* @hw: HW module.
* @wwpn: WWPN.
*
* If found, returns lnode matching given wwpn, returns NULL otherwise.
*/
struct csio_lnode *
csio_lnode_lookup_by_wwpn(struct csio_hw *hw, uint8_t *wwpn)
{
struct list_head *tmp1, *tmp2;
struct csio_lnode *sln = NULL, *cln = NULL;
if (list_empty(&hw->sln_head)) {
CSIO_INC_STATS(hw, n_lnlkup_miss);
return NULL;
}
/* Traverse sibling lnodes */
list_for_each(tmp1, &hw->sln_head) {
sln = (struct csio_lnode *) tmp1;
/* Match sibling lnode */
if (!memcmp(csio_ln_wwpn(sln), wwpn, 8))
return sln;
if (list_empty(&sln->cln_head))
continue;
/* Traverse children lnodes */
list_for_each(tmp2, &sln->cln_head) {
cln = (struct csio_lnode *) tmp2;
if (!memcmp(csio_ln_wwpn(cln), wwpn, 8))
return cln;
}
}
return NULL;
}
/* FDMI */
static void
csio_fill_ct_iu(void *buf, uint8_t type, uint8_t sub_type, uint16_t op)
{
struct fc_ct_hdr *cmd = (struct fc_ct_hdr *)buf;
cmd->ct_rev = FC_CT_REV;
cmd->ct_fs_type = type;
cmd->ct_fs_subtype = sub_type;
cmd->ct_cmd = htons(op);
}
static int
csio_hostname(uint8_t *buf, size_t buf_len)
{
if (snprintf(buf, buf_len, "%s", init_utsname()->nodename) > 0)
return 0;
return -1;
}
static int
csio_osname(uint8_t *buf, size_t buf_len)
{
if (snprintf(buf, buf_len, "%s %s %s",
init_utsname()->sysname,
init_utsname()->release,
init_utsname()->version) > 0)
return 0;
return -1;
}
static inline void
csio_append_attrib(uint8_t **ptr, uint16_t type, void *val, size_t val_len)
{
uint16_t len;
struct fc_fdmi_attr_entry *ae = (struct fc_fdmi_attr_entry *)*ptr;
if (WARN_ON(val_len > U16_MAX))
return;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/delay.h`, `linux/slab.h`, `linux/utsname.h`, `scsi/scsi_device.h`, `scsi/scsi_transport_fc.h`, `linux/unaligned.h`, `scsi/fc/fc_els.h`.
- Detected declarations: `function csio_ln_lookup_by_portid`, `function csio_ln_lookup_by_vnpi`, `function list_for_each`, `function csio_lnode_lookup_by_wwpn`, `function list_for_each`, `function csio_fill_ct_iu`, `function csio_hostname`, `function csio_osname`, `function csio_append_attrib`, `function csio_ln_fdmi_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.
- 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.