[ofa-general] [PATCH] ibnetdiscover: Add link width and speed to topology file output
Hal Rosenstock
halr at voltaire.com
Mon Jun 4 08:46:52 PDT 2007
ibnetdiscover: Add link width and speed to topology file output
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
diff --git a/infiniband-diags/include/ibnetdiscover.h b/infiniband-diags/include/ibnetdiscover.h
index 4c2a6c7..7f2512e 100644
--- a/infiniband-diags/include/ibnetdiscover.h
+++ b/infiniband-diags/include/ibnetdiscover.h
@@ -72,6 +72,8 @@ struct Port {
int lmc;
int state;
int physstate;
+ int linkwidth;
+ int linkspeed;
Node *node;
Port *remoteport; /* null if SMA */
diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8
index 7d9c49c..37a896c 100644
--- a/infiniband-diags/man/ibnetdiscover.8
+++ b/infiniband-diags/man/ibnetdiscover.8
@@ -1,4 +1,4 @@
-.TH IBNETDISCOVER 8 "June 2, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBNETDISCOVER 8 "June 4, 2007" "OpenIB" "OpenIB Diagnostics"
.SH NAME
ibnetdiscover \- discover InfiniBand topology
@@ -131,45 +131,45 @@ devid=0x5a06
sysimgguid=0x5442ba00003000
switchguid=0x5442ba00003080
Switch 24 "S-005442ba00003080" # "ISR9024 Voltaire" base port 0 lid 6 lmc 0
-[22] "H-0008f10403961354"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 4
-[10] "S-0008f10400410015"[1] # "SW-6IB4 Voltaire" lid 3
-[8] "H-0008f10403960558"[2] # "MT23108 InfiniHost Mellanox Technologies" lid 14
-[6] "S-0008f10400410015"[3] # "SW-6IB4 Voltaire" lid 3
-[12] "H-0008f10403960558"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 10
+[22] "H-0008f10403961354"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 4 4xSDR
+[10] "S-0008f10400410015"[1] # "SW-6IB4 Voltaire" lid 3 4xSDR
+[8] "H-0008f10403960558"[2] # "MT23108 InfiniHost Mellanox Technologies" lid 14 4xSDR
+[6] "S-0008f10400410015"[3] # "SW-6IB4 Voltaire" lid 3 4xSDR
+[12] "H-0008f10403960558"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 10 4xSDR
vendid=0x8f1
devid=0x5a05
switchguid=0x8f10400410015
Switch 8 "S-0008f10400410015" # "SW-6IB4 Voltaire" base port 0 lid 3 lmc 0
-[6] "H-0008f10403960984"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 16
-[4] "H-005442b100004900"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 12
-[1] "S-005442ba00003080"[10] # "ISR9024 Voltaire" lid 6
-[3] "S-005442ba00003080"[6] # "ISR9024 Voltaire" lid 6
+[6] "H-0008f10403960984"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 16 4xSDR
+[4] "H-005442b100004900"[1] # "MT23108 InfiniHost Mellanox Technologies" lid 12 4xSDR
+[1] "S-005442ba00003080"[10] # "ISR9024 Voltaire" lid 6 1xSDR
+[3] "S-005442ba00003080"[6] # "ISR9024 Voltaire" lid 6 4xSDR
vendid=0x2c9
devid=0x5a44
caguid=0x8f10403960984
Ca 2 "H-0008f10403960984" # "MT23108 InfiniHost Mellanox Technologies"
-[1] "S-0008f10400410015"[6] # lid 16 lmc 1 "SW-6IB4 Voltaire" lid 3
+[1] "S-0008f10400410015"[6] # lid 16 lmc 1 "SW-6IB4 Voltaire" lid 3 4xSDR
vendid=0x2c9
devid=0x5a44
caguid=0x5442b100004900
Ca 2 "H-005442b100004900" # "MT23108 InfiniHost Mellanox Technologies"
-[1] "S-0008f10400410015"[4] # lid 12 lmc 1 "SW-6IB4 Voltaire" lid 3
+[1] "S-0008f10400410015"[4] # lid 12 lmc 1 "SW-6IB4 Voltaire" lid 3 4xSDR
vendid=0x2c9
devid=0x5a44
caguid=0x8f10403961354
Ca 2 "H-0008f10403961354" # "MT23108 InfiniHost Mellanox Technologies"
-[1] "S-005442ba00003080"[22] # lid 4 lmc 1 "ISR9024 Voltaire" lid 6
+[1] "S-005442ba00003080"[22] # lid 4 lmc 1 "ISR9024 Voltaire" lid 6 4xSDR
vendid=0x2c9
devid=0x5a44
caguid=0x8f10403960558
Ca 2 "H-0008f10403960558" # "MT23108 InfiniHost Mellanox Technologies"
-[2] "S-005442ba00003080"[8] # lid 14 lmc 1 "ISR9024 Voltaire" lid 6
-[1] "S-005442ba00003080"[12] # lid 10 lmc 1 "ISR9024 Voltaire" lid 6
+[2] "S-005442ba00003080"[8] # lid 14 lmc 1 "ISR9024 Voltaire" lid 6 4xSDR
+[1] "S-005442ba00003080"[12] # lid 10 lmc 1 "ISR9024 Voltaire" lid 6 1xSDR
.fi
When grouping is used, IB nodes are organized into chasses which are
diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index 1338913..3dc2173 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -46,7 +46,7 @@
#include <errno.h>
#include <inttypes.h>
-#define __BUILD_VERSION_TAG__ 1.2.2
+#define __BUILD_VERSION_TAG__ 1.2.3
#include <common.h>
#include <umad.h>
#include <mad.h>
@@ -63,6 +63,26 @@ static char *node_type_str[] = {
"iwarp rnic"
};
+static char *linkwidth_str[] = {
+ "??",
+ "1x",
+ "4x",
+ "??",
+ "8x",
+ "??",
+ "??",
+ "??",
+ "12x"
+};
+
+static char *linkspeed_str[] = {
+ "???",
+ "SDR",
+ "???",
+ "DDR",
+ "QDR"
+};
+
static int timeout = 2000; /* ms */
static int dumplevel = 0;
static int verbose;
@@ -80,6 +100,24 @@ int maxhops_discovered = 0;
struct ChassisList *chassis = NULL;
+static char *
+get_linkwidth_str(int linkwidth)
+{
+ if (linkwidth > 8)
+ return linkwidth_str[0];
+ else
+ return linkwidth_str[linkwidth];
+}
+
+static char *
+get_linkspeed_str(int linkspeed)
+{
+ if (linkspeed > 4)
+ return linkspeed_str[0];
+ else
+ return linkspeed_str[linkspeed];
+}
+
int
get_port(Port *port, int portnum, ib_portid_t *portid)
{
@@ -95,9 +133,11 @@ get_port(Port *port, int portnum, ib_por
mad_decode_field(pi, IB_PORT_LMC_F, &port->lmc);
mad_decode_field(pi, IB_PORT_STATE_F, &port->state);
mad_decode_field(pi, IB_PORT_PHYS_STATE_F, &port->physstate);
+ mad_decode_field(pi, IB_PORT_LINK_WIDTH_ACTIVE_F, &port->linkwidth);
+ mad_decode_field(pi, IB_PORT_LINK_SPEED_ACTIVE_F, &port->linkspeed);
- DEBUG("portid %s portnum %d: lid %d state %d physstate %d",
- portid2str(portid), portnum, port->lid, port->state, port->physstate);
+ DEBUG("portid %s portnum %d: lid %d state %d physstate %d %s %s",
+ portid2str(portid), portnum, port->lid, port->state, port->physstate, get_linkwidth_str(port->linkwidth), get_linkspeed_str(port->linkspeed));
return 1;
}
/*
@@ -135,6 +175,8 @@ get_node(Node *node, Port *port, ib_port
mad_decode_field(pi, IB_PORT_LMC_F, &port->lmc);
mad_decode_field(pi, IB_PORT_STATE_F, &port->state);
mad_decode_field(pi, IB_PORT_PHYS_STATE_F, &port->physstate);
+ mad_decode_field(pi, IB_PORT_LINK_WIDTH_ACTIVE_F, &port->linkwidth);
+ mad_decode_field(pi, IB_PORT_LINK_SPEED_ACTIVE_F, &port->linkspeed);
if (node->type != SWITCH_NODE)
return 0;
@@ -571,12 +613,14 @@ out_switch_port(Port *port, int group)
rem_nodename = clean_nodedesc(port->remoteport->node->nodedesc);
ext_port_str = out_ext_port(port->remoteport, group);
- fprintf(f, "\t%s[%d]%s\t\t# \"%s\" lid %d\n",
+ fprintf(f, "\t%s[%d]%s\t\t# \"%s\" lid %d %s%s\n",
node_name(port->remoteport->node),
port->remoteport->portnum,
ext_port_str ? ext_port_str : "",
rem_nodename,
- port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid);
+ port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid,
+ get_linkwidth_str(port->linkwidth),
+ get_linkspeed_str(port->linkspeed));
if (rem_nodename && (port->remoteport->node->type == SWITCH_NODE))
free(rem_nodename);
@@ -601,9 +645,11 @@ out_ca_port(Port *port, int group)
port->remoteport->node->nodedesc);
else
rem_nodename = clean_nodedesc(port->remoteport->node->nodedesc);
- fprintf(f, "\t\t# lid %d lmc %d \"%s\" lid %d\n",
+ fprintf(f, "\t\t# lid %d lmc %d \"%s\" lid %d %s%s\n",
port->lid, port->lmc, rem_nodename,
- port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid);
+ port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid,
+ get_linkwidth_str(port->linkwidth),
+ get_linkspeed_str(port->linkspeed));
if (rem_nodename && (port->remoteport->node->type == SWITCH_NODE))
free(rem_nodename);
}
More information about the general
mailing list