[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Methods to retrieve WWPN and WWNN from FC HBA cards

On Thu, 2007-08-02 at 18:02 +1000, Nikolas Lam wrote: 
> Hi,
> I'm trying to find out ways of retrieving HBA identifying information
> from for Emulex and Qlogic cards on RHEL4 and RHEL5, preferably without
> having to install the vendor-provided drivers (in this case HP's package
> of lpfc and qla2xx).
> On RHEL4 with 2 single-channel Qlogic HBAs, I've found that the files
> in /proc/scsi/qla2xxx/* have everything I need:
> [nik host1 ~]$ grep -A 2 'SCSI Device Information:' /proc/scsi/qla2xxx/*
> /proc/scsi/qla2xxx/0:SCSI Device Information:
> /proc/scsi/qla2xxx/0-scsi-qla0-adapter-node=200000e08b9075e6;
> /proc/scsi/qla2xxx/0-scsi-qla0-adapter-port=210000e08b9075e6;
> --
> /proc/scsi/qla2xxx/1:SCSI Device Information:
> /proc/scsi/qla2xxx/1-scsi-qla1-adapter-node=200000e08b91ba01;
> /proc/scsi/qla2xxx/1-scsi-qla1-adapter-port=210000e08b91ba01;
> This concurs with the output of the adapter_info command that comes with
> the HP-supplied fibreutils RPM.
> [nik host1 ~]$ sudo adapter_info
> /proc/scsi/qla2xxx/1: STATE=READY WWNN=200000e08b91ba01
> WWPN=210000e08b91ba01
> /proc/scsi/qla2xxx/0: STATE=READY WWNN=200000e08b9075e6
> WWPN=210000e08b9075e6
> However, on RHEL4 with 2 single-channel Emulex HBAs, there appears to be
> a discrepancy between what is in /proc/scsi/lpfc/* and what adapter_info
> is telling me:
> [nik host2 ~]$ cat /proc/scsi/lpfc/0
> lpfc0t00 DID 6f0000 WWPN 50:00:1f:e1:50:02:f1:19 WWNN
> 50:00:1f:e1:50:02:f1:10
> lpfc0t01 DID 6f0100 WWPN 50:00:1f:e1:50:02:f1:1d WWNN
> 50:00:1f:e1:50:02:f1:10
> [nik host2 ~]$ cat /proc/scsi/lpfc/1
> lpfc1t00 DID 790000 WWPN 50:00:1f:e1:50:02:f1:1c WWNN
> 50:00:1f:e1:50:02:f1:10
> lpfc1t01 DID 790100 WWPN 50:00:1f:e1:50:02:f1:18 WWNN
> 50:00:1f:e1:50:02:f1:10
> [nik host2 ~]$ sudo adapter_info
> /sys/class/scsi_host/0: STATE=LINKUP WWNN=20000000c95e0709
> WWPN=10000000c95e0709
> /sys/class/scsi_host/1: STATE=LINKUP WWNN=20000000c9561b5b
> WWPN=10000000c9561b5b
> Firstly why is it that there appear to be 2 ports per lpfc device? There
> is only one port per card. 
> Secondly, why does is there no apparent match between the WWNs output
> from /proc and adapter_info?
> Thirdly why are the WWNNs all the same in the /proc output?
> RHEL5 kernels seem to do things quite differently. It seems like the
> info is quite deep somewhere within /sys/class/fc_host/. What's a
> recommended method to retrieve this info on RHEL5? And would the method
> be consistent regardless of which vendor's HBA's card is being used?
> Thanks in advance,
> Nik

Thanks to Karl Heller who was able to point me in the right direction.
Here's summary of what I now know.

On RHEL4, for QLogic FC cards, to determine the WWPNs on the card, use
something like this:

 grep -A 2 'SCSI Device Information:' /proc/scsi/qla2xxx/*

On RHEL4, with Emulex FC cards it's even easier:

 cat /sys/class/scsi_host/host*/port_name


[nik host2 ~]$ ls /sys/class/scsi_host/ 
host0  host1
[nik host2 ~]$ 
[nik host2 ~]$ cat /sys/class/scsi_host/host*/port_name 
[nik deneb ~]$ 

It seems that the stuff in /proc/scsi/lpfc/ (see my original email) actually
refers to the devices at the other end of the fibre. That's where the
discrepancy was coming from.

And it looks like RHEL5 has a consistent /proc filesystem regardless of what
vendor your card is from. Here's an example of retrieving WWPNs from RHEL5 host
with two dual-channel QLogic cards (four ports in total):

[root host3 ~]# cat /sys/class/fc_host/host*/port_name

I've no idea how the order of the ports is defined, although Karl thinks it will
at least be consistent. (N.B. obviously this doesn't mean that it will be
consistent between different versions of RHEL kernels).

Hope this is helpful to someone else.

Nik Lam

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]