Emulex Linux HBA Debugging

 

It is possible to increase the amount of debugging info we can get from the lpfc driver in linux. This is done by setting the lpfc_log_verbose parameter for the lpfc driver.

 

this is the link to to documenation: here

 

The /sys/class/scsi_host/host0/lpfc_log_verbose is “rw” root and hence the value can be echoed into the file or set in /etc/modprobe.conf.

 

I tested it in the lab by echoing 0xfff into /sys/class/scsi_host/host0/lpfc_log_verbose and it throws more messages into /var/log/messages file

 

To turn on / increase logging output:

 

# echo 0xfff > /sys/class/scsi_host/host0/lpfc_log_verbose

 

Sample output from /var/log/messages:

 

Jan 24 15:47:51 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:47:51 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

Jan 24 15:47:56 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:47:56 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

Jan 24 15:48:01 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:48:01 shou18l585g609 kernel: lpfc 0000:08:00.0: 0:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

 

Turn off / decrease logging output:

 

# echo 0x0 > /sys/class/scsi_host/host0/lpfc_log_verbose

 

# echo 0xfff > /sys/class/scsi_host/host1/lpfc_log_verbose

entries in /var/log/messages

Jan 24 15:48:12 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:48:12 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

Jan 24 15:48:32 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:48:32 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

Jan 24 15:48:37 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0309 Mailbox cmd x31 issue Data: x20 x700 x2

Jan 24 15:48:37 shou18l585g609 kernel: lpfc 0000:08:00.1: 1:(0):0307 Mailbox cmd x31 Cmpl xffffffff880fbd20 Data: x123100 x0 x0 x0 x0 x0 x0 x0 x0

 

# echo 0x0 > /sys/class/scsi_host/host1/lpfc_log_verbose

 

 

Temporary Driver Configuration by Read/Write to sysfs


Sysfs is a virtual filesystem that exposes the structure of the system. It also includes interfaces to driver
parameters through which the driver parameters can be viewed and modified. Since these interfaces are
available only after driver load, only those parameters that can be modified dynamically can be changed.
However, all driver parameters can be read through sysfs.
The sysfs filesystem is mounted and available as /sys. You must first identify the scsi_host which
represents the adapter for which you wish to modify the driver parameters. All scsi_hosts bound to the
lpfc driver can be viewed with the following command:
# ls -d /sys/bus/pci/drivers/lpfc/*/host*
Assuming you are interested in adapter scsi_host 7, you can list the driver parameters for this particular
adapter as:
#ls -l /sys/class/scsi_host/host7/lpfc*
An example output is as follows:
-r--r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_ack0
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/
lpfc_fcp_bind_method
-r--r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_fcp_class
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_fdmi_on
-r--r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_link_speed
-rw-r--r-- 1 root root 4096 Feb 28 15:34 /sys/class/scsi_host/host7/lpfc_log_verbose
-r--r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/
lpfc_lun_queue_depth
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_max_luns
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_nodev_tmo
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_scan_down
-r--r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_topology
-rw-r--r-- 1 root root 4096 Feb 28 17:03 /sys/class/scsi_host/host7/lpfc_use_adisc
Notice that the driver parameters are available as files. Reading a file shows the current value of a driver
parameter. If the permissions allow it, you can write a value to the file and it takes effect immediately.
For example:
[root@emulex]# cat /sys/class/scsi_host/host7/lpfc_log_verbose
0
Notice that the current value of lpfc_log_verbose is zero. To set it to 0xffff:
[root@emulex]# echo 0xffff > /sys/class/scsi_host/host7/lpfc_log_verbose
[root@emulex]# cat /sys/class/scsi_host/host7/lpfc_log_verbose
0xffff

 

 

Dynamically Adding LUNs and Targets
The Emulex driver for Linux enables you to dynamically add LUNs and targets without unloading or
reloading the lpfc module and without resetting the adapter.
To rescan an adapter's targets with sysfs given the adapter's host number (in this example 3), type:
echo "- - -" > /sys/class/scsi_host/host3/scan
To limit the rescan to a particular target, given the adapter's host number (in this example 3) and the
target number (in this example 2), type:
echo "- 2 -" > /sys/class/scsi_host/host3/scan
You can also use the Emulex lun_scan script in /usr/sbin/lpfc.