You are here

How to get ALL then FC info you need (and more!)

Here's the cheet sheet to using native FC tools and drivers (tested on rhel5):

pWWN = cat /sys/class/fc_host/host[0-9]/port_name
WWN = cat /sys/class/fc_host/host[0-9]/node_name
online? = cat /sys/class/fc_host/host[0-9]/port_state
Speed = cat /sys/class/fc_host/host[0-9]/speed
HBA overview = cat /sys/class/fc_host/host[0-9]/symbolic_name
/sys/class/fc_host/host[0-9]/device/scsi_host\:host[0-9] is same as /sys/class/scsi_host/host[0-9]
HBA make = cat /sys/class/scsi_host/host[0-9]/model_desc
HBA model = cat /sys/class/scsi_host/host[0-9]/model_name
Firmware rev = cat /sys/class/scsi_host/host[0-9]/fw_version
Driver version = cat /sys/class/scsi_host/host[0-9]/driver_version
rescan scsi bus (use VERY wisely) = echo "- - -" > /sys/class/scsi_host/host[0-9]/scan
issue lip (use even MORE wisely) = echo 1 > /sys/class/fc_host/host[0-9]/issue_lip

It's a good cheet sheet, but you'll need more understanding to make this useful for your troubleshooting. Read on.

First, here is where the basic info is at:

ls -AF /sys/class/fc_host/host[0-9]
/sys/class/fc_host/host2:
device@ issue_lip port_id port_state speed subsystem@ supported_speeds system_hostname uevent
fabric_name node_name port_name port_type statistics/ supported_classes symbolic_name tgtid_bind_type

/sys/class/fc_host/host3:
device@ issue_lip port_id port_state speed subsystem@ supported_speeds system_hostname uevent
fabric_name node_name port_name port_type statistics/ supported_classes symbolic_name tgtid_bind_type

Notice: I did `ls -AF`, with which A=almost all (no . and ..) and F=classify, which adds *, /, =, >, @ or | to the end of the entries to describe what type of file it is. @ is a symlink and let me show you what one of those looks like.

lrwxrwxrwx 1 root root 0 Jul 2 16:44 device -> ../../../devices/pci0000:00/0000:00:09.0/0000:08:00.0/host3/

This is handy info - see how it matches this line from lspci {note that I'm just using one of the cards as a sample in the next two examples}.

lspci | grep 08:00
08:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)

Here's a sample of the info you find in dmesg:

ACPI: PCI Interrupt 0000:08:00.0[A] -> GSI 32 (level, low) -> IRQ 51
qla2xxx 0000:08:00.0: Found an ISP2532, irq 51, iobase 0xffffc200100aa000
qla2xxx 0000:08:00.0: Configuring PCI space...
PCI: Setting latency timer of device 0000:08:00.0 to 64
qla2xxx 0000:08:00.0: Configure NVRAM parameters...
qla2xxx 0000:08:00.0: Verifying loaded RISC code...
qla2xxx 0000:08:00.0: Allocated (64 KB) for EFT...
qla2xxx 0000:08:00.0: Allocated (1414 KB) for firmware dump...
scsi3 : qla2xxx
qla2xxx 0000:0b:00.0: LIP reset occured (f7f7).
qla2xxx 0000:08:00.0:
QLogic Fibre Channel HBA Driver: 8.03.07.03.05.07-k
QLogic HPAK344A - HP 8Gb Single Channel PCI-e 2.0 FC HBA
ISP2532: PCIe (2.5Gb/s x8) @ 0000:08:00.0 hdma+, host#=3, fw=5.03.16 (95)
qla2xxx 0000:0b:00.0: LOOP UP detected (8 Gbps).
Vendor: SUN Model: ZFS Storage 7420 Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 05

What if you want to find that model number or more about the current runing config? You can find that in both the fc_host directory and the scsi_host directory. Since we're already in the fc_host tree, just follow the symlink.

ls -AF /sys/class/fc_host/host[0-9]/device/
/sys/class/fc_host/host2/device/:
ct edc edc_status els fc_host:host2@ fw_dump nvram optrom optrom_ctl power/ reset rport-2:0-0/ rport-2:0-1/ scsi_host:host2@ sfp uevent vpd

/sys/class/fc_host/host3/device/:
ct edc edc_status els fc_host:host3@ fw_dump nvram optrom optrom_ctl power/ reset rport-3:0-0/ rport-3:0-1/ scsi_host:host3@ sfp uevent vpd

See the "scsi_host" symlink? That's a way to hop into where more of the info you need is at.

ls /sys/class/fc_host/host[0-9]/device/scsi_host\:host[0-9]/
/sys/class/fc_host/host2/device/scsi_host:host2/:
84xx_fw_version fabric_param isp_id mpi_version optrom_fw_version serial_num uevent vport_create
beacon flash_block_size isp_name npiv_vports_inuse pci_info sg_tablesize unchecked_isa_dma vport_delete
cmd_per_lun fw_state max_npiv_vports optrom_bios_version phy_version state unique_id zio
device fw_version model_desc optrom_efi_version proc_name subsystem vlan_id zio_timer
driver_version host_busy model_name optrom_fcode_version scan total_isp_aborts vn_port_mac_address

/sys/class/fc_host/host3/device/scsi_host:host3/:
84xx_fw_version fabric_param isp_id mpi_version optrom_fw_version serial_num uevent vport_create
beacon flash_block_size isp_name npiv_vports_inuse pci_info sg_tablesize unchecked_isa_dma vport_delete
cmd_per_lun fw_state max_npiv_vports optrom_bios_version phy_version state unique_id zio
device fw_version model_desc optrom_efi_version proc_name subsystem vlan_id zio_timer
driver_version host_busy model_name optrom_fcode_version scan total_isp_aborts vn_port_mac_address

With the above info, you should have enough to be able to accurately trackdown almost everything you need and make the cheet sheet above useful. Not everything is just a file (everything's a file in unix). Some of those files are functions. How do you see changes to the FC fabric (such as when you update zoning)?

echo 1 > /sys/class/fc_host/host[0-9]/issue_lip

And here is what you do if you have the zones in place, but you have added luns that need to be seen.

echo "- - -" > /sys/class/scsi_host/host[0-9]/scan

I hope this is helpful for you. The next hurdle after this is using the native linux multipathing. I'll add my cheet sheet for that sometime.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer