With the current libHBAAPI less implementation it was not possible to display
interface infotmation for NPIV ports, as the sysfs hba implementation assumed a
1:1 mapping of netdevices to FC hosts.

This is the output of fcoeadm -i fcoe0 before reading the host's vport
attributes from sysfs.

   Description:      BCM57840 NetXtreme II 10/20-Gigabit Ethernet
   Revision:         11
   Manufacturer:     Broadcom Corporation
   Serial Number:    6CC2173EA1D0

   Driver:           bnx2x 1.710.51-0
   Number of Ports:  1

       Symbolic Name:     bnx2fc (QLogic BCM57840) v2.4.2 over fcoe0
       OS Device Name:    host1
       Node Name:         0x20006cc2173ea1d1
       Port Name:         0x10006cc2173ea1d1
       FabricName:        0x100000c0dd0ce717
       Speed:             unknown
       Supported Speed:   1 Gbit, 10 Gbit
       MaxFrameSize:      2048 bytes
       FC-ID (Port ID):   0x660710
       State:             Online

This is the same output including the read from sysfs

   Description:      BCM57840 NetXtreme II 10/20-Gigabit Ethernet
   Revision:         11
   Manufacturer:     Broadcom Corporation
   Serial Number:    6CC2173EA1D0
   Driver:           bnx2x 1.710.51-0
   Number of Ports:  1

       Symbolic Name:     bnx2fc (QLogic BCM57840) v2.4.2 over fcoe0
       OS Device Name:    host1
       Node Name:         0x20006cc2173ea1d1
       Port Name:         0x10006cc2173ea1d1
       FabricName:        0x100000c0dd0ce717
       Speed:             unknown
       Supported Speed:   1 Gbit, 10 Gbit
       MaxFrameSize:      2048 bytes
       FC-ID (Port ID):   0x660710
       State:             Online

       Symbolic Name:     bnx2fc (QLogic BCM57840) v2.4.2 over fcoe0
       OS Device Name:    host2
       Node Name:         0x5555666677778888
       Port Name:         0x1111222233334444
       FabricName:        0x100000c0dd0ce717
       Speed:             unknown
       Supported Speed:   1 Gbit, 10 Gbit
       MaxFrameSize:      2048 bytes
       FC-ID (Port ID):   0x660717
       State:             Online

       Symbolic Name:     bnx2fc (QLogic BCM57840) v2.4.2 over fcoe0
       OS Device Name:    host3
       Node Name:         0x1111222233334444
       Port Name:         0x5555666677778888
       FabricName:        0x100000c0dd0ce717
       Speed:             unknown
       Supported Speed:   1 Gbit, 10 Gbit
       MaxFrameSize:      2048 bytes
       FC-ID (Port ID):   0x660718
       State:             Online

Signed-off-by: Johannes Thumshirn <[email protected]>
---
 fcoeadm_display.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index e236629..16ccb6b 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -540,6 +540,44 @@ free_host:
        return rc;
 }
 
+static int get_host_from_vport(struct dirent *dp, void *arg)
+{
+       if (!strncmp(dp->d_name, "host", strlen("host"))) {
+               struct port_attributes *port_attrs;
+
+               port_attrs = get_port_attribs(dp->d_name);
+               if (!port_attrs)
+                       return 0;
+               printf("\n");
+               show_port_info(port_attrs);
+               free(port_attrs);
+       }
+
+       return 0;
+}
+
+static int crawl_vports(struct dirent *dp, void *arg)
+{
+       char *oldpath = arg;
+
+       if (!strncmp(dp->d_name, "vport", strlen("vport"))) {
+               char path[1024];
+
+               snprintf(path, sizeof(path), "%s/%s", oldpath, dp->d_name);
+               sa_dir_read(path, get_host_from_vport, NULL);
+       }
+       return 0;
+}
+
+static void show_host_vports(const char *host)
+{
+       char path[1024];
+
+       snprintf(path, sizeof(path), "%s/%s/device/", SYSFS_HOST_DIR, host);
+       sa_dir_read(path, crawl_vports, path);
+
+}
+
 static enum fcoe_status display_one_adapter_info(char *ifname)
 {
        struct port_attributes *port_attrs;
@@ -569,6 +607,7 @@ static enum fcoe_status display_one_adapter_info(char 
*ifname)
         */
        show_hba_info(hba_info);
        show_port_info(port_attrs);
+       show_host_vports(host);
 
        rc = SUCCESS;
 
-- 
1.8.5.6

_______________________________________________
fcoe-devel mailing list
[email protected]
http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel

Reply via email to