Linux Storage - HBA sysfs attributes
Linux Storage Solution · Config document · referenced from Linux HBA and SCSI inventory
The ls and cat command set that reads the SCSI host and Fibre Channel host attributes of the first HBA port on HV01 straight out of sysfs: which SCSI hosts exist, which of them are FC hosts, and what the kernel knows about the port host1. Every command ran as root on HV01 and reads only; nothing is written.
| Item | Value |
|---|---|
| Paths | /sys/class/scsi_host/host/ and /sys/class/fc_host/, the attributes of host1 under /sys/class/scsi_host/host1/ and /sys/class/scsi_host/host1/device/fc_host:host1/ |
| On which host | HV01, the first blade (HP BL660c Gen8) |
| Run as | root |
| HBA | QLogic QMH2572, PCI function 0000:03:00.0, driver qla2xxx 8.05.00.03.55.6-k, firmware 5.09.00 |
| Date in the listings | Dec 9 01:50 directory times in the ls -ld output; year and run time not in the notes |
| The second port | host2 was not read with cat; the notes read both ports with systool, see systool fc_host |
The commands
The notes say that the HBAs are usually the last two SCSI hosts, here host1 for the first port and host2 for the second. The first command lists every SCSI host in the system.
$ ls -ld /sys/class/scsi_host/host*/
output 3 lines
drwxr-xr-x 3 root root 0 Dec 9 01:50 /sys/class/scsi_host/host0/ drwxr-xr-x 3 root root 0 Dec 9 01:50 /sys/class/scsi_host/host1/ drwxr-xr-x 3 root root 0 Dec 9 01:50 /sys/class/scsi_host/host2/
The second lists only the FC SCSI hosts, the HBA ports.
$ ls -ld /sys/class/fc_host/*
output 2 lines
drwxr-xr-x 4 root root 0 Dec 9 01:50 /sys/class/fc_host/host1 drwxr-xr-x 4 root root 0 Dec 9 01:50 /sys/class/fc_host/host2
The description of the HBA.
$ cat /sys/class/scsi_host/host1/model_desc
output 1 line
PCI-Express Dual Channel 8Gb Fibre Channel Mezzanine HBA, NFF
The model name, that is the type of the device.
$ cat /sys/class/scsi_host/host1/model_name
output 1 line
QMH2572
The mode, initiator or target.
$ cat /sys/class/scsi_host/host1/active_mode
output 1 line
Initiator
The state of the link and the type of port the HBA is attached to.
$ cat /sys/class/scsi_host/host1/link_state
output 1 line
Link Up - F_Port
The first port's address. The author's note beside it gives the colon form: 0x50014380123456c0 is 50:01:43:80:12:34:56:c0.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/port_name
output 1 line
0x50014380123456c0
The first port's state.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/port_state
output 1 line
Online
The first port's type.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/port_type
output 1 line
NPort (fabric via point-to-point)
The first port's speed.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/speed
output 1 line
8 Gbit
The FC classes the first port supports.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/supported_classes
output 1 line
Class 3
The speeds the first port supports.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/supported_speeds
output 1 line
1 Gbit, 2 Gbit, 4 Gbit, 8 Gbit
The card type and the firmware version of the first port.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/symbolic_name
output 1 line
QMH2572 FW:v5.09.00 DVR:v8.05.00.03.55.6-k
What Linux knows about the HBA port: the physical address, the bus and the driver.
$ cat /sys/class/scsi_host/host1/device/fc_host:host1/uevent
output 3 lines
PHYSDEVPATH=/devices/pci0000:00/0000:00:02.0/0000:03:00.0 PHYSDEVBUS=pci PHYSDEVDRIVER=qla2xxx
The attributes
| Attribute | Value on host1 | What it tells |
|---|---|---|
model_desc | PCI-Express Dual Channel 8Gb Fibre Channel Mezzanine HBA, NFF | the vendor's description of the card; a dual-channel mezzanine card for a blade |
model_name | QMH2572 | the model |
active_mode | Initiator | the port acts as a SCSI initiator, not as a target |
link_state | Link Up - F_Port | the link is up and the port on the other side is a switch F_Port |
port_name | 0x50014380123456c0 | the World Wide Port Name (WWPN), the identity the switch sees in its flogi database and that the FC alias HV01 is built from |
port_state | Online | the port is logged into the fabric |
port_type | NPort (fabric via point-to-point) | an N_Port on a fabric, not a loop |
speed | 8 Gbit | the negotiated speed |
supported_classes | Class 3 | the FC service class the port supports |
supported_speeds | 1 Gbit, 2 Gbit, 4 Gbit, 8 Gbit | the speeds the port can negotiate |
symbolic_name | QMH2572 FW:v5.09.00 DVR:v8.05.00.03.55.6-k | model, firmware and driver version in one string |
uevent | three PHYSDEV… lines | the PCI path 0000:03:00.0, the bus pci and the driver qla2xxx |
The first four attributes live directly under /sys/class/scsi_host/host1/: model_name, model_desc and link_state are added by the qla2xxx driver, active_mode belongs to every SCSI host. The FC attributes live one level down in device/fc_host:host1/, which is the same object as /sys/class/fc_host/host1. That the two paths meet in one object is my understanding of sysfs, the notes only use both paths.
Checked against Linux 7.2 and RHEL 10.2
| As built | Today |
|---|---|
fc_host attributes port_name, node_name, port_state, port_type, speed, supported_speeds, supported_classes, symbolic_name | All still defined by the FC transport class, with the same names and the same strings; the class also exports manufacturer, serial_number, model, model_description, driver_version, firmware_version and others, which the notes did not read, so model and versions do not have to be parsed out of symbolic_name |
scsi_host attributes model_name, model_desc, link_state | Still exported by qla2xxx, link_state with the same Link Up - F_Port string; active_mode is a generic SCSI host attribute and is also unchanged |
reading the files with cat | Still how Red Hat documents it: the RHEL 10 storage guide lists /sys/class/fc_host/hostH/ with port_id, node_name, port_name and issue_lip, and the same for fc_remote_ports and fc_transport. There is no kernel ABI document for these attributes; their names live only in the driver source |
speed 8 Gbit, supported_speeds up to 8 Gbit | 8GFC dates from 2008; 64GFC has shipped since 2020 and 128GFC since 2024, each speed backward compatible with at least two generations |
supported_classes Class 3 | Still the default: the current qla2xxx enables Class 2 only when asked (ql2xenableclass2, default 0) |
driver 8.05.00.03.55.6-k, firmware 5.09.00 | In-kernel qla2xxx 10.02.10.100-k in Linux 7.0 to 7.2, 12.00.00.2607b2 in the development tree; the QMH2572's chip (ISP2532) is still in its PCI table and its firmware file ql2500_fw.bin is at 8.08.207 in linux-firmware |
The commands would run unchanged on a current kernel; only the card and the blade it sits in are long out of support.