drivers/scsi/lpfc/lpfc_attr.c
Source file repositories/reference/linux-study-clean/drivers/scsi/lpfc/lpfc_attr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/lpfc/lpfc_attr.c- Extension
.c- Size
- 229521 bytes
- Lines
- 7589
- 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/ctype.hlinux/delay.hlinux/pci.hlinux/interrupt.hlinux/module.hlinux/aer.hlinux/gfp.hlinux/kernel.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_tcq.hscsi/scsi_transport_fc.hscsi/fc/fc_fs.hlpfc_hw4.hlpfc_hw.hlpfc_sli.hlpfc_sli4.hlpfc_nl.hlpfc_disc.hlpfc.hlpfc_scsi.hlpfc_nvme.hlpfc_logmsg.hlpfc_version.hlpfc_compat.hlpfc_crtn.hlpfc_vport.hlpfc_attr.h
Detected Declarations
function lpfc_jedec_to_asciifunction lpfc_cmf_info_showfunction lpfc_vmid_info_showfunction for_each_possible_cpufunction lpfc_drvr_version_showfunction lpfc_enable_fip_showfunction lpfc_nvme_info_showfunction list_for_each_entryfunction lpfc_scsi_stat_showfunction lpfc_bg_info_showfunction lpfc_bg_guard_err_showfunction lpfc_bg_apptag_err_showfunction lpfc_bg_reftag_err_showfunction lpfc_info_showfunction lpfc_serialnum_showfunction lpfc_temp_sensor_showfunction lpfc_modeldesc_showfunction lpfc_modelname_showfunction lpfc_programtype_showfunction lpfc_vportnum_showfunction lpfc_fwrev_showfunction lpfc_hdw_showfunction lpfc_option_rom_version_showfunction lpfc_link_state_showfunction lpfc_sli4_protocol_showfunction lpfc_oas_supported_showfunction lpfc_link_state_storefunction lpfc_num_discovered_ports_showfunction lpfc_issue_lipfunction lpfc_emptyq_waitfunction lpfc_do_offlinefunction list_for_each_entryfunction lpfc_reset_pci_busfunction lpfc_do_offlinefunction lpfc_selective_resetfunction lpfc_sli4_pdev_status_reg_waitfunction lpfc_sli4_pdev_reg_requestfunction lpfc_nport_evt_cnt_showfunction lpfc_set_trunkingfunction strlenfunction lpfc_xcvr_data_showfunction lpfc_board_mode_showfunction lpfc_board_mode_storefunction lpfc_get_hba_infofunction lpfc_get_hba_infofunction lpfc_get_hba_infofunction lpfc_get_hba_infofunction lpfc_get_hba_info
Annotated Snippet
switch (phba->cmf_active_mode) {
case LPFC_CFG_OFF:
scnprintf(tmp, sizeof(tmp), "Active: Mode:Off\n");
break;
case LPFC_CFG_MANAGED:
scnprintf(tmp, sizeof(tmp), "Active: Mode:Managed\n");
break;
case LPFC_CFG_MONITOR:
scnprintf(tmp, sizeof(tmp), "Active: Mode:Monitor\n");
break;
default:
scnprintf(tmp, sizeof(tmp), "Active: Mode:Unknown\n");
}
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
goto buffer_done;
}
switch (phba->cgn_p.cgn_param_mode) {
case LPFC_CFG_OFF:
scnprintf(tmp, sizeof(tmp), "Config: Mode:Off ");
break;
case LPFC_CFG_MANAGED:
scnprintf(tmp, sizeof(tmp), "Config: Mode:Managed ");
break;
case LPFC_CFG_MONITOR:
scnprintf(tmp, sizeof(tmp), "Config: Mode:Monitor ");
break;
default:
scnprintf(tmp, sizeof(tmp), "Config: Mode:Unknown ");
}
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
goto buffer_done;
total = 0;
rcv = 0;
for_each_present_cpu(cpu) {
cgs = per_cpu_ptr(phba->cmf_stat, cpu);
total += atomic64_read(&cgs->total_bytes);
rcv += atomic64_read(&cgs->rcv_bytes);
}
scnprintf(tmp, sizeof(tmp),
"IObusy:%d Info:%d Bytes: Rcv:x%llx Total:x%llx\n",
atomic_read(&phba->cmf_busy),
phba->cmf_active_info, rcv, total);
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
goto buffer_done;
scnprintf(tmp, sizeof(tmp),
"Port_speed:%d Link_byte_cnt:%ld "
"Max_byte_per_interval:%ld\n",
lpfc_sli_port_speed_get(phba),
(unsigned long)phba->cmf_link_byte_count,
(unsigned long)phba->cmf_max_bytes_per_interval);
strlcat(buf, tmp, PAGE_SIZE);
buffer_done:
len = strnlen(buf, PAGE_SIZE);
if (unlikely(len >= (PAGE_SIZE - 1))) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6312 Catching potential buffer "
"overflow > PAGE_SIZE = %lu bytes\n",
PAGE_SIZE);
strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR),
LPFC_INFO_MORE_STR, sizeof(LPFC_INFO_MORE_STR) + 1);
}
return len;
}
static ssize_t
lpfc_vmid_info_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
struct lpfc_hba *phba = vport->phba;
struct lpfc_vmid *vmp;
int len = 0, i, j, k, cpu;
char hxstr[LPFC_MAX_VMID_SIZE * 3] = {0};
struct timespec64 curr_tm;
struct lpfc_vmid_priority_range *vr;
u64 *lta, rct_acc = 0, max_lta = 0;
struct tm tm_val;
ktime_get_ts64(&curr_tm);
len += scnprintf(buf + len, PAGE_SIZE - len, "Key 'vmid':\n");
/* if enabled continue, else return */
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/delay.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/module.h`, `linux/aer.h`, `linux/gfp.h`, `linux/kernel.h`.
- Detected declarations: `function lpfc_jedec_to_ascii`, `function lpfc_cmf_info_show`, `function lpfc_vmid_info_show`, `function for_each_possible_cpu`, `function lpfc_drvr_version_show`, `function lpfc_enable_fip_show`, `function lpfc_nvme_info_show`, `function list_for_each_entry`, `function lpfc_scsi_stat_show`, `function lpfc_bg_info_show`.
- 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.