Portstatus checks were performed on ports regardless of them being
down or active.  This could lead to confusing output from the console
portstatus command.

Signed-off-by: Albert Chu <[email protected]>
---
 opensm/osm_console.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index 7f9a963..e3f27a2 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -770,6 +770,22 @@ static void __get_stats(cl_map_item_t * const p_map_item, 
void *context)
                port_state = ib_port_info_get_port_state(pi);
                port_phys_state = ib_port_info_get_port_phys_state(pi);
 
+               if (port_state == IB_LINK_DOWN)
+                       fs->ports_down++;
+               else if (port_state == IB_LINK_ACTIVE)
+                       fs->ports_active++;
+               if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {
+                       __tag_port_report(&(fs->disabled_ports),
+                                         cl_ntoh64(node->node_info.node_guid),
+                                         port, node->print_desc);
+                       fs->ports_disabled++;
+               }
+
+               fs->total_ports++;
+
+               if (port_state == IB_LINK_DOWN)
+                       continue;
+
                if (!(active_width & enabled_width)) {
                        __tag_port_report(&(fs->unenabled_width_ports),
                                          cl_ntoh64(node->node_info.node_guid),
@@ -872,18 +888,6 @@ static void __get_stats(cl_map_item_t * const p_map_item, 
void *context)
                        fs->ports_unknown_width++;
                        break;
                }
-               if (port_state == IB_LINK_DOWN)
-                       fs->ports_down++;
-               else if (port_state == IB_LINK_ACTIVE)
-                       fs->ports_active++;
-               if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {
-                       __tag_port_report(&(fs->disabled_ports),
-                                         cl_ntoh64(node->node_info.node_guid),
-                                         port, node->print_desc);
-                       fs->ports_disabled++;
-               }
-
-               fs->total_ports++;
        }
 }
 
-- 
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to