Signed-off-by: Hal Rosenstock <[email protected]>
---
Changes since v1:
Rebased to latest master

 libibnetdisc/include/infiniband/ibnetdisc.h |    1 +
 src/ibdiag_common.c                         |   19 ++++++++++++++++---
 src/iblinkinfo.c                            |   23 +++++++++++++++--------
 3 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/libibnetdisc/include/infiniband/ibnetdisc.h 
b/libibnetdisc/include/infiniband/ibnetdisc.h
index 300094e..0cad93f 100644
--- a/libibnetdisc/include/infiniband/ibnetdisc.h
+++ b/libibnetdisc/include/infiniband/ibnetdisc.h
@@ -109,6 +109,7 @@ typedef struct ibnd_port {
        uint8_t lmc;
        /* use libibmad decoder functions for info */
        uint8_t info[IB_SMP_DATA_SIZE];
+       uint8_t ext_info[IB_SMP_DATA_SIZE];
 
        /* internal use only */
        struct ibnd_port *htnext;
diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
index 74960e1..e6587af 100644
--- a/src/ibdiag_common.c
+++ b/src/ibdiag_common.c
@@ -594,7 +594,7 @@ void get_max_msg(char *width_msg, char *speed_msg, int 
msg_size, ibnd_port_t * p
 {
        char buf[64];
        uint32_t max_speed = 0;
-       uint32_t cap_mask, rem_cap_mask;
+       uint32_t cap_mask, rem_cap_mask, fdr10;
        uint8_t *info;
 
        uint32_t max_width = get_max(mad_get_field(port->info, 0,
@@ -623,7 +623,14 @@ void get_max_msg(char *width_msg, char *speed_msg, int 
msg_size, ibnd_port_t * p
        if (cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
            rem_cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)
                goto check_ext_speed;
-check_speed_supp:
+check_fdr10_supp:
+       fdr10 = (mad_get_field(port->ext_info, 0,
+                              IB_MLNX_EXT_PORT_LINK_SPEED_SUPPORTED_F) & FDR10)
+               && (mad_get_field(port->remoteport->ext_info, 0,
+                                 IB_MLNX_EXT_PORT_LINK_SPEED_SUPPORTED_F) & 
FDR10);
+       if (fdr10)
+               goto check_fdr10_active;
+
        max_speed = get_max(mad_get_field(port->info, 0,
                                          IB_PORT_LINK_SPEED_SUPPORTED_F)
                            & mad_get_field(port->remoteport->info, 0,
@@ -642,7 +649,7 @@ check_ext_speed:
                          IB_PORT_LINK_SPEED_EXT_SUPPORTED_F) == 0 ||
            mad_get_field(port->remoteport->info, 0,
                          IB_PORT_LINK_SPEED_EXT_SUPPORTED_F) == 0)
-               goto check_speed_supp;
+               goto check_fdr10_supp;
        max_speed = get_max(mad_get_field(port->info, 0,
                                          IB_PORT_LINK_SPEED_EXT_SUPPORTED_F)
                            & mad_get_field(port->remoteport->info, 0,
@@ -654,4 +661,10 @@ check_ext_speed:
                snprintf(speed_msg, msg_size, "Could be %s",
                         mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F,
                                      buf, 64, &max_speed));
+       return;
+
+check_fdr10_active:
+       if ((mad_get_field(port->ext_info, 0,
+                          IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F) & FDR10) == 0)
+               snprintf(speed_msg, msg_size, "Could be FDR10");
 }
diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c
index bbdb51d..673ed95 100644
--- a/src/iblinkinfo.c
+++ b/src/iblinkinfo.c
@@ -78,7 +78,6 @@ static int down_links_only = 0;
 static int line_mode = 0;
 static int add_sw_settings = 0;
 
-
 int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port)
 {
        ibnd_node_t *fsw;
@@ -112,7 +111,7 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, 
char *out_prefix)
        char width_msg[256];
        char speed_msg[256];
        char ext_port_str[256];
-       int iwidth, ispeed, espeed, istate, iphystate, cap_mask;
+       int iwidth, ispeed, fdr10, espeed, istate, iphystate, cap_mask;
        int n = 0;
        uint8_t *info;
 
@@ -121,6 +120,8 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, 
char *out_prefix)
 
        iwidth = mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_ACTIVE_F);
        ispeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F);
+       fdr10 = mad_get_field(port->ext_info, 0,
+                             IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F) & FDR10;
 
        if (port->node->type == IB_NODE_SWITCH)
                info = (uint8_t *)&port->node->ports[0]->info;
@@ -150,15 +151,21 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, 
char *out_prefix)
        /* C14-24.2.1 states that a down port allows for invalid data to be
         * returned for all PortInfo components except PortState and
         * PortPhysicalState */
+       if (!espeed) {
+               if (fdr10)
+                       sprintf(speed, "10.0 Gbps (FDR10)");
+               else
+                       mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed,
+                                    64, &ispeed);
+       } else
+               mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed,
+                            64, &espeed);
+
        if (istate != IB_LINK_DOWN) {
-               n = snprintf(link_str, 256, "(%3s %9s %6s/%8s)",
+               n = snprintf(link_str, 256, "(%3s %18s %6s/%8s)",
                     mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64,
                                  &iwidth),
-                    (ispeed != 4 || !espeed) ?
-                       mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed, 64,
-                                    &ispeed) :
-                       mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed, 64,
-                                    &espeed),
+                    speed,
                     mad_dump_val(IB_PORT_STATE_F, state, 64, &istate),
                     mad_dump_val(IB_PORT_PHYS_STATE_F, physstate, 64,
                                  &iphystate));
-- 
1.5.3

--
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