• James Bottomley's avatar
    SCSI: Add FC transport host attributes · 85175168
    James Bottomley authored
    From: 	James.Smart@Emulex.Com
    
    This patch updates the fc_transport with attributes for local FC ports
    (e.g. Hosts).  The port attributes are defined per HBAAPI v2.0 definitions.
    
    This patch results in the following in /sys/class:
    -----------------------------------------------------
    
    [jsmart@elxware class]$ cd /sys/class
    [jsmart@elxware class]$ ls
    fc_host       graphics  misc     pci_bus       scsi_host  usb_host
    fc_transport  input     net      scsi_device   tty        vc
    firmware      mem       netlink  scsi_generic  usb
    [jsmart@elxware class]$ cd fc_host
    [jsmart@elxware fc_host]$ ls
    host4
    
    [jsmart@elxware fc_host]$ cd host4
    [jsmart@elxware host4]$ ls
    device                 host_port_maxframe_size      host_port_supported_speeds
    host_fabric_name       host_port_name               host_port_symbolic_name
    host_link_down_tmo     host_port_speed              host_port_type
    host_node_name         host_port_state              host_tgtid_bind_type
    host_port_active_fc4s  host_port_supported_classes  statistics
    host_port_id           host_port_supported_fc4s
    [jsmart@elxware host4]$ ls -ld *
    lrwxrwxrwx  1 root root    0 Oct 13 18:24 device -> ../../../devices/platform/host4
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_fabric_name
    -rw-r--r--  1 root root 4096 Oct 13 18:24 host_link_down_tmo
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_node_name
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_active_fc4s
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_id
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_maxframe_size
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_name
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_speed
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_state
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_supported_classes
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_supported_fc4s
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_supported_speeds
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_symbolic_name
    -r--r--r--  1 root root 4096 Oct 13 18:24 host_port_type
    -rw-r--r--  1 root root 4096 Oct 13 18:24 host_tgtid_bind_type
    drwxr-xr-x  2 root root    0 Oct 13 18:24 statistics
    
    
    Using the following script (/tmp/show_attributes):
        #!/bin/sh
        FILES=`ls *`
        for file in $FILES; do
          if [ -f $file ] ; then
            echo "$file : " `cat $file`
          fi
        done
    
    Here's a sample of querying the attributes:
    
    [jsmart@elxware /]$ cd /sys/class/fc_host/host4
    [jsmart@elxware host4]$ /tmp/show_attributes
    host_fabric_name :  0x33334444ffeeddcc
    host_link_down_tmo :  30
    host_node_name :  0x78563412aabbccdd
    host_port_active_fc4s :  hex: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
    host_port_id :  0x789abc
    host_port_maxframe_size :  2511 bytes
    host_port_name :  0xefcdab9011223344
    host_port_speed :  2 Gbit
    host_port_state :  Online
    host_port_supported_classes :  Class 2, Class 3
    host_port_supported_fc4s :  hex: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f
    host_port_supported_speeds :  2 Gbit, 4 Gbit, 10 Gbit
    host_port_symbolic_name :  LP9052 Dual Port Adapter
    host_port_type :  NPort (fabric via point-to-point)
    host_tgtid_bind_type :  wwpn (World Wide Port Name)
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
    85175168
scsi_transport_fc.h 9.92 KB