[PATCH] infiniband-diags/src/perfquery.c: Fix all_ports corner case
if AllPortSelect is not supported and --all_ports is specified, it should only emulate AllPortSelect if no port is specified or the all ports port number (255) is specified. Signed-off-by: Albert Chu ch...@llnl.gov --- src/perfquery.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/perfquery.c b/src/perfquery.c index 27ec4f7..605ece9 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -783,7 +783,7 @@ int main(int argc, char **argv) if (!(cap_mask IB_PM_ALL_PORT_SELECT)) { /* bit 8 is AllPortSelect */ if (!all_ports port == ALL_PORTS) IBERROR(AllPortSelect not supported); - if (all_ports) + if (all_ports port == ALL_PORTS) all_ports_loop = 1; } -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[infiniband-diags] [1/4] add --diff support to iblinkinfo
Hi Sasha, Similar to ibnetdiscover, this patch support a --diff option in iblinkinfo. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8 |8 ++ infiniband-diags/src/iblinkinfo.c | 221 +--- 2 files changed, 210 insertions(+), 19 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index f184edf..b91afbd 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -50,6 +50,14 @@ fabrics or a previous state of a fabric. Cannot be used if user specifies a directo route path. See .B ibnetdiscover for information on caching ibnetdiscover output. +.TP +\fB\-\-diff\fR filename +Load cached ibnetdiscover data and do a diff comparison to the current +network or another cache. A special diff output for iblinkinfo +output will be displayed showing differences between the old and current +fabric links. See +.B ibnetdiscover +for information on caching ibnetdiscover output. .SH AUTHOR .TP diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index 029573f..c6092f9 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -53,9 +53,16 @@ #include ibdiag_common.h +#define DIFF_FLAG_PORT_CONNECTION 0x01 +#define DIFF_FLAG_PORT_STATE 0x02 + +#define DIFF_FLAG_DEFAULT (DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE) + static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; static char *load_cache_file = NULL; +static char *diff_cache_file = NULL; +static unsigned diffcheck_flags = DIFF_FLAG_DEFAULT; static uint64_t guid = 0; static char *guid_str = NULL; @@ -107,7 +114,7 @@ void get_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * port) buf, 64, max_speed)); } -void print_port(ibnd_node_t * node, ibnd_port_t * port) +void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) { char width[64], speed[64], state[64], physstate[64]; char remote_guid_str[256]; @@ -204,21 +211,35 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port) if (line_mode) { char *remap = remap_node_name(node_name_map, node-guid, node-nodedesc); - printf(0x%016 PRIx64 \%30s\ , node-guid, remap); + printf(%s0x%016 PRIx64 \%30s\ , + out_prefix ? out_prefix : , + node-guid, remap); free(remap); } else - printf( ); + printf(%s , out_prefix ? out_prefix : ); printf(%6d %4d[%2s] ==%s== %s, node-smalid, port-portnum, ext_port_str, link_str, remote_str); } +void print_switch_header(ibnd_node_t *node, int *out_header_flag, char *out_prefix) +{ + if (!(*out_header_flag) !line_mode) { + char *remap = + remap_node_name(node_name_map, node-guid, node-nodedesc); + printf(%sSwitch 0x%016 PRIx64 %s:\n, + out_prefix ? out_prefix : , + node-guid, remap); + (*out_header_flag)++; + free(remap); + } +} + void print_switch(ibnd_node_t * node, void *user_data) { int i = 0; int head_print = 0; - char *remap = - remap_node_name(node_name_map, node-guid, node-nodedesc); + char *out_prefix = (char *)user_data; for (i = 1; i = node-numports; i++) { ibnd_port_t *port = node-ports[i]; @@ -227,15 +248,153 @@ void print_switch(ibnd_node_t * node, void *user_data) if (!down_links_only || mad_get_field(port-info, 0, IB_PORT_STATE_F) == IB_LINK_DOWN) { - if (!head_print !line_mode) { - printf(Switch 0x%016 PRIx64 %s:\n, - node-guid, remap); - head_print = 1; - } - print_port(node, port); + print_switch_header(node, head_print, out_prefix); + print_port(node, port, out_prefix); + } + } +} + +struct iter_diff_data { +uint32_t diff_flags; +ibnd_fabric_t *fabric1; +ibnd_fabric_t *fabric2; +char *fabric1_prefix; +char *fabric2_prefix; +}; + +void diff_switch_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, + int *head_print, struct iter_diff_data *data) +{ + int i = 0; + + for (i = 1; i = fabric1_node-numports; i++) { + ibnd_port_t *fabric1_port, *fabric2_port; + int
[infiniband-diags] [2/4] support --diffcheck in iblinkinfo
Hi Sasha, Similar to ibnetdiscover, this patch support a --diffcheck option in iblinkinfo. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8 |5 + infiniband-diags/src/iblinkinfo.c | 20 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index b91afbd..431ab0e 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -58,6 +58,11 @@ output will be displayed showing differences between the old and current fabric links. See .B ibnetdiscover for information on caching ibnetdiscover output. +.TP +\fB\-\-diffcheck\fR key(s) +Specify what diff checks should be done in the \fB\-\-diff\fR option above. +Comma separate multiple diff check key(s). The available diff checks +are:\fIport\fR = port connections, \fIstate\fR = port state. .SH AUTHOR .TP diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index c6092f9..a4a8e49 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -400,6 +400,8 @@ int diff_switch(ibnd_node_t * node, ibnd_fabric_t * orig_fabric, static int process_opt(void *context, int ch, char *optarg) { struct ibnd_config *cfg = context; + char *p; + switch (ch) { case 1: node_name_map_file = strdup(optarg); @@ -410,6 +412,22 @@ static int process_opt(void *context, int ch, char *optarg) case 3: diff_cache_file = strdup(optarg); break; + case 4: + diffcheck_flags = 0; + p = strtok(optarg, ,); + while (p) { + if (!strcasecmp(p, port)) + diffcheck_flags |= DIFF_FLAG_PORT_CONNECTION; + else if (!strcasecmp(p, state)) + diffcheck_flags |= DIFF_FLAG_PORT_STATE; + else { + fprintf(stderr, invalid diff check key: %s\n, + p); + return -1; + } + p = strtok(NULL, ,); + } + break; case 'S': guid_str = optarg; guid = (uint64_t) strtoull(guid_str, 0, 0); @@ -480,6 +498,8 @@ int main(int argc, char **argv) filename of ibnetdiscover cache to load}, {diff, 3, 1, file, filename of ibnetdiscover cache to diff}, + {diffcheck, 4, 1, key(s), +specify checks to execute for --diff}, {outstanding_smps, 'o', 1, NULL, specify the number of outstanding SMP's which should be issued during the scan}, -- 1.5.4.5 ---End Message---
[infiniband-diags] [3/4] Add lid and node description diff options for --diffcheck in iblinkinfo
Hi Sasha, This patch supports additional lid and node description diffing options in iblinkinfo. This is similar to the lid and nodescription --diffcheck options in ibnetdiscover. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8 |7 +++- infiniband-diags/src/iblinkinfo.c | 53 - 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index 431ab0e..65ea919 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -55,14 +55,17 @@ for information on caching ibnetdiscover output. Load cached ibnetdiscover data and do a diff comparison to the current network or another cache. A special diff output for iblinkinfo output will be displayed showing differences between the old and current -fabric links. See +fabric links. Be default, the following are compared for differences: +port connections and port state. See .B ibnetdiscover for information on caching ibnetdiscover output. .TP \fB\-\-diffcheck\fR key(s) Specify what diff checks should be done in the \fB\-\-diff\fR option above. Comma separate multiple diff check key(s). The available diff checks -are:\fIport\fR = port connections, \fIstate\fR = port state. +are:\fIport\fR = port connections, \fIstate\fR = port state, \fIlid\fR = lids, +\fInodedesc\fR = node descriptions. If \fIport\fR is specified alongside \fIlid\fR +or \fInodedesc\fR, remote port lids and node descriptions will also be compared. .SH AUTHOR .TP diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index a4a8e49..19adc20 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -55,6 +55,8 @@ #define DIFF_FLAG_PORT_CONNECTION 0x01 #define DIFF_FLAG_PORT_STATE 0x02 +#define DIFF_FLAG_LID 0x04 +#define DIFF_FLAG_NODE_DESCRIPTION 0x08 #define DIFF_FLAG_DEFAULT (DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE) @@ -224,7 +226,7 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) void print_switch_header(ibnd_node_t *node, int *out_header_flag, char *out_prefix) { - if (!(*out_header_flag) !line_mode) { + if ((!out_header_flag || !(*out_header_flag)) !line_mode) { char *remap = remap_node_name(node_name_map, node-guid, node-nodedesc); printf(%sSwitch 0x%016 PRIx64 %s:\n, @@ -308,9 +310,25 @@ void diff_switch_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, output_diff++; } + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_LID +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +fabric1_port-remoteport-base_lid != fabric2_port-remoteport-base_lid) + output_diff++; + + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_NODE_DESCRIPTION +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +memcmp(fabric1_port-remoteport-node-nodedesc, + fabric2_port-remoteport-node-nodedesc, + IB_SMP_DATA_SIZE)) + output_diff++; + if (output_diff fabric1_port) { print_switch_header(fabric1_node, - head_print, + head_print, NULL); print_port(fabric1_node, fabric1_port, @@ -319,7 +337,7 @@ void diff_switch_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, if (output_diff fabric2_port) { print_switch_header(fabric1_node, - head_print, + head_print, NULL); print_port(fabric2_node, fabric2_port, @@ -340,7 +358,22 @@ void diff_switch_iter(ibnd_node_t * fabric1_node, void *iter_user_data) if (!fabric2_node) print_switch(fabric1_node, data-fabric1_prefix); else if (data-diff_flags -(DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE)) { +(DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE + | DIFF_FLAG_LID | DIFF_FLAG_NODE_DESCRIPTION)) { + + if ((data-diff_flags DIFF_FLAG_LID +
[infiniband-diags] [4/4] support --filterdownports in iblinkinfo
Hi Sasha, This patch supports a new option called --filterdownports. The option will remove downports from the output if they were previously listed as down in a cache. This option is useful for clusters that have unpopulated switch ports. Many system administrators look for the word Down in the iblinkinfo output, however, that ability is limited when so many of the ports are down all the time b/c of unpopulated ports. This option attempts to remove that limitation for clusters with unpopulated ports. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8 |9 infiniband-diags/src/iblinkinfo.c | 40 + 2 files changed, 49 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index 65ea919..940d008 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -66,6 +66,15 @@ Comma separate multiple diff check key(s). The available diff checks are:\fIport\fR = port connections, \fIstate\fR = port state, \fIlid\fR = lids, \fInodedesc\fR = node descriptions. If \fIport\fR is specified alongside \fIlid\fR or \fInodedesc\fR, remote port lids and node descriptions will also be compared. +.TP +\fB\-\-filterdownports\fR filename +Filter downports indicated in a ibnetdiscover cache. If a port was previously +indicated as down in the specified cache, and is still down, do not output it in the +resulting output. This option may be particularly useful for environments +where switches are not fully populated, thus much of the default iblinkinfo +info is considered unuseful. See +.B ibnetdiscover +for information on caching ibnetdiscover output. .SH AUTHOR .TP diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index 19adc20..4b8616e 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -65,6 +65,8 @@ static nn_map_t *node_name_map = NULL; static char *load_cache_file = NULL; static char *diff_cache_file = NULL; static unsigned diffcheck_flags = DIFF_FLAG_DEFAULT; +static char *filterdownports_cache_file = NULL; +static ibnd_fabric_t *filterdownports_fabric = NULL; static uint64_t guid = 0; static char *guid_str = NULL; @@ -116,6 +118,30 @@ void get_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * port) buf, 64, max_speed)); } +int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port) +{ + ibnd_node_t *fsw; + ibnd_port_t *fport; + int fistate; + + fsw = ibnd_find_node_guid(filterdownports_fabric, node-guid); + + if (!fsw) + return 0; + + if (port-portnum fsw-numports) + return 0; + + fport = fsw-ports[port-portnum]; + + if (!fport) + return 0; + + fistate = mad_get_field(fport-info, 0, IB_PORT_STATE_F); + + return (fistate == IB_LINK_DOWN) ? 1 : 0; +} + void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) { char width[64], speed[64], state[64], physstate[64]; @@ -142,6 +168,11 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) width_msg[0] = '\0'; speed_msg[0] = '\0'; + if (istate == IB_LINK_DOWN +filterdownports_fabric +filterdownport_check(node,port)) + return; + /* C14-24.2.1 states that a down port allows for invalid data to be * returned for all PortInfo components except PortState and * PortPhysicalState */ @@ -467,6 +498,9 @@ static int process_opt(void *context, int ch, char *optarg) p = strtok(NULL, ,); } break; + case 5: + filterdownports_cache_file = strdup(optarg); + break; case 'S': guid_str = optarg; guid = (uint64_t) strtoull(guid_str, 0, 0); @@ -539,6 +573,8 @@ int main(int argc, char **argv) filename of ibnetdiscover cache to diff}, {diffcheck, 4, 1, key(s), specify checks to execute for --diff}, + {filterdownports, 5, 1, file, +filename of ibnetdiscover cache to filter downports}, {outstanding_smps, 'o', 1, NULL, specify the number of outstanding SMP's which should be issued during the scan}, @@ -591,6 +627,10 @@ int main(int argc, char **argv) !(diff_fabric = ibnd_load_fabric(diff_cache_file, 0))) IBERROR(loading cached fabric for diff failed\n); + if (filterdownports_cache_file + !(filterdownports_fabric = ibnd_load_fabric(filterdownports_cache_file, 0))) + IBERROR(loading
Re: [infiniband-diags] support diffing lids and nodedesc on remoteports in ibnetdiscover
Hey Sasha, A slight tweak to the patch. Support diffing lids and node descriptions on remote ports (previously it diffed only local lids and node descriptions). Also add appropriate manpage notes. Al On Tue, 2010-04-20 at 15:30 -0700, Al Chu wrote: Hey Sasha, This patch supports diffing node descriptions on remote ports (previously diffing of just the local node description was supported). Al email message attachment Forwarded Message From: Albert Chu ch...@llnl.gov Subject: [PATCH] support diffing nodedesc on remoteports in ibnetdiscover Date: Tue, 20 Apr 2010 15:09:59 -0700 Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/src/ibnetdiscover.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 57f9625..eeb1b9f 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -720,6 +720,17 @@ static void diff_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, fabric2_out++; } + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_NODE_DESCRIPTION +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +memcmp(fabric1_port-remoteport-node-nodedesc, + fabric2_port-remoteport-node-nodedesc, + IB_SMP_DATA_SIZE)) { + fabric1_out++; + fabric2_out++; + } + if (fabric1_out) { diff_iter_out_header(fabric1_node, data, out_header_flag); -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 |5 - infiniband-diags/src/ibnetdiscover.c | 20 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index 76cfbc8..3beb70b 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -71,7 +71,10 @@ are: \fIsw\fR = switches, \fIca\fR = channel adapters, \fIrouter\fR = routers, \fIport\fR = port connections, \fIlid\fR = lids, \fInodedesc\fR = node descriptions. Note that \fIport\fR, \fIlid\fR, and \fInodedesc\fR are checked only for the node types that are specified (e.g. \fIsw\fR, -\fIca\fR, \fIrouter\fR). +\fIca\fR, \fIrouter\fR). If \fIport\fR is specified alongside \fIlid\fR +or \fInodedesc\fR, remote port lids and node descriptions will also be compared. + + .TP \fB\-p\fR, \fB\-\-ports\fR Obtain a ports report which is a diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 57f9625..23e6dd4 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -720,6 +720,26 @@ static void diff_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, fabric2_out++; } + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_NODE_DESCRIPTION +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +memcmp(fabric1_port-remoteport-node-nodedesc, + fabric2_port-remoteport-node-nodedesc, + IB_SMP_DATA_SIZE)) { + fabric1_out++; + fabric2_out++; + } + + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_LID +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +fabric1_port-remoteport-base_lid != fabric2_port-remoteport-base_lid) { + fabric1_out++; + fabric2_out++; + } + if (fabric1_out) { diff_iter_out_header(fabric1_node, data, out_header_flag); -- 1.5.4.5 ---End Message---
[infiniband-diags] support diffing nodedesc on remoteports in ibnetdiscover
Hey Sasha, This patch supports diffing node descriptions on remote ports (previously diffing of just the local node description was supported). Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/src/ibnetdiscover.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 57f9625..eeb1b9f 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -720,6 +720,17 @@ static void diff_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node, fabric2_out++; } + if (data-diff_flags DIFF_FLAG_PORT_CONNECTION +data-diff_flags DIFF_FLAG_NODE_DESCRIPTION +fabric1_port fabric2_port +fabric1_port-remoteport fabric2_port-remoteport +memcmp(fabric1_port-remoteport-node-nodedesc, + fabric2_port-remoteport-node-nodedesc, + IB_SMP_DATA_SIZE)) { + fabric1_out++; + fabric2_out++; + } + if (fabric1_out) { diff_iter_out_header(fabric1_node, data, out_header_flag); -- 1.5.4.5 ---End Message---
[infiniband-diags] [2/3] support libibnetdisc caching no-overwrite flag
Hey Sasha, This patch adds a flag to support a no-overwrite caching flag for libibnetdisc. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|3 +++ .../libibnetdisc/src/ibnetdisc_cache.c | 16 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 136282c..865c1e0 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -181,6 +181,9 @@ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric); MAD_EXPORT ibnd_fabric_t *ibnd_load_fabric(const char *file, unsigned int flags); +#define IBND_CACHE_FABRIC_FLAG_DEFAULT 0x +#define IBND_CACHE_FABRIC_FLAG_NO_OVERWRITE 0x0001 + MAD_EXPORT int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file, unsigned int flags); diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c index e05ce99..56b59fb 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -888,10 +888,18 @@ int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file, return -1; } - if (!stat(file, statbuf)) { - if (unlink(file) 0) { - IBND_DEBUG(error removing '%s': %s\n, - file, strerror(errno)); + if (!(flags IBND_CACHE_FABRIC_FLAG_NO_OVERWRITE)) { + if (!stat(file, statbuf)) { + if (unlink(file) 0) { + IBND_DEBUG(error removing '%s': %s\n, + file, strerror(errno)); + return -1; + } + } + } + else { + if (!stat(file, statbuf)) { + IBND_DEBUG(file '%s' already exists\n, file); return -1; } } -- 1.5.4.5 ---End Message---
[infiniband-diags] [3/3] add ibcacheedit tool
Hey Sasha, This patch adds a new ibcacheedit tool to infiniband-diags. As the name suggests, it offers users options to edit a stored cache. This tool is primarily necessary to allow system administrators to update caches as they make minor modifications to a cluster (e.g. node dies, thus HCA is replaced) rather than regularly regenerating a new cache. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/Makefile.am |6 +- infiniband-diags/man/ibcacheedit.8 | 57 ++ infiniband-diags/src/ibcacheedit.c | 356 3 files changed, 417 insertions(+), 2 deletions(-) create mode 100644 infiniband-diags/man/ibcacheedit.8 create mode 100644 infiniband-diags/src/ibcacheedit.c diff --git a/infiniband-diags/Makefile.am b/infiniband-diags/Makefile.am index 1cdb60e..af90b05 100644 --- a/infiniband-diags/Makefile.am +++ b/infiniband-diags/Makefile.am @@ -13,7 +13,7 @@ sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \ src/ibroute src/ibstat src/ibsysstat src/ibtracert \ src/perfquery src/sminfo src/smpdump src/smpquery \ src/saquery src/vendstat src/iblinkinfo \ - src/ibqueryerrors + src/ibqueryerrors src/ibcacheedit if ENABLE_TEST_UTILS sbin_PROGRAMS += src/ibsendtrap src/mcm_rereg_test @@ -62,6 +62,8 @@ src_iblinkinfo_SOURCES = src/iblinkinfo.c src_iblinkinfo_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc src_ibqueryerrors_SOURCES = src/ibqueryerrors.c src_ibqueryerrors_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc +src_ibcacheedit_SOURCES = src/ibcacheedit.c +src_ibcacheedit_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \ man/ibchecknet.8 man/ibchecknode.8 man/ibcheckport.8 \ @@ -76,7 +78,7 @@ man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \ man/ibprintswitch.8 man/ibprintca.8 man/ibfindnodesusing.8 \ man/ibdatacounts.8 man/ibdatacounters.8 \ man/ibrouters.8 man/ibprintrt.8 man/ibidsverify.8 \ - man/check_lft_balance.8 + man/check_lft_balance.8 man/ibcacheedit.8 BUILT_SOURCES = ibdiag_version ibdiag_version: diff --git a/infiniband-diags/man/ibcacheedit.8 b/infiniband-diags/man/ibcacheedit.8 new file mode 100644 index 000..b977827 --- /dev/null +++ b/infiniband-diags/man/ibcacheedit.8 @@ -0,0 +1,57 @@ +.TH IBCACHEEDIT 8 Apr 15, 2010 OpenIB OpenIB Diagnostics + +.SH NAME +ibcacheedit \- edit an ibnetdiscover cache + +.SH SYNOPSIS +.B ibcacheedit +[\-\-switchguid BEFOREGUID:AFTERGUID] [\-\-caguid BEFORE:AFTER] +[\-\-sysimgguid BEFOREGUID:AFTERGUID] [\-\-portguid NODEGUID:BEFOREGUID:AFTERGUID] +[\-h(elp)] orig.cache new.cache + +.SH DESCRIPTION +.PP +ibcacheedit allows users to edit an ibnetdiscover cache created through the +\fB\-\-cache\fR option in +.B ibnetdiscover(8). + +.SH OPTIONS + +.PP +.TP +\fB\-\-switchguid\fR BEFOREGUID:AFTERGUID +Specify a switchguid that should be changed. The before and after guid +should be separated by a colon. On switches, port guids are identical +to the switch guid, so port guids will be adjusted as well on switches. +.TP +\fB\-\-caguid\fR BEFOREGUID:AFTERGUID +Specify a caguid that should be changed. The before and after guid +should be separated by a colon. +.TP +\fB\-\-sysimgguid\fR BEFOREGUID:AFTERGUID +Specify a sysimgguid that should be changed. The before and after guid +should be spearated by a colon. +.TP +\fB\-\-portguid\fR NODEGUID:BEFOREGUID:AFTERGUID +Specify a portguid that should be changed. The nodeguid of the port +(e.g. switchguid or caguid) should be specified first, followed by a +colon, the before port guid, another colon, then the after port guid. +On switches, port guids are identical to the switch guid, so the +switch guid will be adjusted as well on switches. + +.SH COMMON OPTIONS + +Most OpenIB diagnostics take the following common flags. The exact list of +supported flags per utility can be found in the usage message and can be shown +using the util_name -h syntax. + +# Debugging flags +.PP +\-h show the usage message +.PP +\-V show the version info. + +.SH AUTHORS +.TP +Albert Chu +.RI ch...@llnl.gov diff --git a/infiniband-diags/src/ibcacheedit.c b/infiniband-diags/src/ibcacheedit.c new file mode 100644 index 000..28b8b21 --- /dev/null +++ b/infiniband-diags/src/ibcacheedit.c @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2010 Lawrence Livermore National Lab. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD
[infiniband-diags] [1/2] support libibnetdisc caching overwrite flag
Hi Sasha, This patch supports a flag in the libibnetdisc caching code to overwrite a previous cache. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|3 +++ .../libibnetdisc/src/ibnetdisc_cache.c | 17 ++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 136282c..c83bd0b 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -181,6 +181,9 @@ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric); MAD_EXPORT ibnd_fabric_t *ibnd_load_fabric(const char *file, unsigned int flags); +#define IBND_CACHE_FABRIC_FLAG_DEFAULT 0x +#define IBND_CACHE_FABRIC_FLAG_OVERWRITE 0x0001 + MAD_EXPORT int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file, unsigned int flags); diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c index 480a0a2..6cf7d4d 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -876,9 +876,20 @@ int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char *file, return -1; } - if (!stat(file, statbuf)) { - IBND_DEBUG(file '%s' already exists\n, file); - return -1; + if (flags IBND_CACHE_FABRIC_FLAG_OVERWRITE) { + if (!stat(file, statbuf)) { + if (unlink(file) 0) { + IBND_DEBUG(error removing '%s': %s\n, + file, strerror(errno)); + return -1; + } + } + } + else { + if (!stat(file, statbuf)) { + IBND_DEBUG(file '%s' already exists\n, file); + return -1; + } } if ((fd = open(file, O_CREAT | O_EXCL | O_WRONLY, 0644)) 0) { -- 1.5.4.5 ---End Message---
[infiniband-diags] [2/2] add ibcacheedit tool
Hey Sasha, This patch adds a new ibcacheedit tool to infiniband-diags. As the name suggests, it offers users options to edit a stored cache. This tool is primarily necessary to allow system administrators to update caches as they make minor modifications to a cluster (e.g. node dies, thus HCA is replaced) rather than regularly regenerating a new cache. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/Makefile.am |6 +- infiniband-diags/man/ibcacheedit.8 | 57 ++ infiniband-diags/src/ibcacheedit.c | 361 3 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 infiniband-diags/man/ibcacheedit.8 create mode 100644 infiniband-diags/src/ibcacheedit.c diff --git a/infiniband-diags/Makefile.am b/infiniband-diags/Makefile.am index 1cdb60e..af90b05 100644 --- a/infiniband-diags/Makefile.am +++ b/infiniband-diags/Makefile.am @@ -13,7 +13,7 @@ sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \ src/ibroute src/ibstat src/ibsysstat src/ibtracert \ src/perfquery src/sminfo src/smpdump src/smpquery \ src/saquery src/vendstat src/iblinkinfo \ - src/ibqueryerrors + src/ibqueryerrors src/ibcacheedit if ENABLE_TEST_UTILS sbin_PROGRAMS += src/ibsendtrap src/mcm_rereg_test @@ -62,6 +62,8 @@ src_iblinkinfo_SOURCES = src/iblinkinfo.c src_iblinkinfo_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc src_ibqueryerrors_SOURCES = src/ibqueryerrors.c src_ibqueryerrors_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc +src_ibcacheedit_SOURCES = src/ibcacheedit.c +src_ibcacheedit_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \ man/ibchecknet.8 man/ibchecknode.8 man/ibcheckport.8 \ @@ -76,7 +78,7 @@ man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \ man/ibprintswitch.8 man/ibprintca.8 man/ibfindnodesusing.8 \ man/ibdatacounts.8 man/ibdatacounters.8 \ man/ibrouters.8 man/ibprintrt.8 man/ibidsverify.8 \ - man/check_lft_balance.8 + man/check_lft_balance.8 man/ibcacheedit.8 BUILT_SOURCES = ibdiag_version ibdiag_version: diff --git a/infiniband-diags/man/ibcacheedit.8 b/infiniband-diags/man/ibcacheedit.8 new file mode 100644 index 000..b977827 --- /dev/null +++ b/infiniband-diags/man/ibcacheedit.8 @@ -0,0 +1,57 @@ +.TH IBCACHEEDIT 8 Apr 15, 2010 OpenIB OpenIB Diagnostics + +.SH NAME +ibcacheedit \- edit an ibnetdiscover cache + +.SH SYNOPSIS +.B ibcacheedit +[\-\-switchguid BEFOREGUID:AFTERGUID] [\-\-caguid BEFORE:AFTER] +[\-\-sysimgguid BEFOREGUID:AFTERGUID] [\-\-portguid NODEGUID:BEFOREGUID:AFTERGUID] +[\-h(elp)] orig.cache new.cache + +.SH DESCRIPTION +.PP +ibcacheedit allows users to edit an ibnetdiscover cache created through the +\fB\-\-cache\fR option in +.B ibnetdiscover(8). + +.SH OPTIONS + +.PP +.TP +\fB\-\-switchguid\fR BEFOREGUID:AFTERGUID +Specify a switchguid that should be changed. The before and after guid +should be separated by a colon. On switches, port guids are identical +to the switch guid, so port guids will be adjusted as well on switches. +.TP +\fB\-\-caguid\fR BEFOREGUID:AFTERGUID +Specify a caguid that should be changed. The before and after guid +should be separated by a colon. +.TP +\fB\-\-sysimgguid\fR BEFOREGUID:AFTERGUID +Specify a sysimgguid that should be changed. The before and after guid +should be spearated by a colon. +.TP +\fB\-\-portguid\fR NODEGUID:BEFOREGUID:AFTERGUID +Specify a portguid that should be changed. The nodeguid of the port +(e.g. switchguid or caguid) should be specified first, followed by a +colon, the before port guid, another colon, then the after port guid. +On switches, port guids are identical to the switch guid, so the +switch guid will be adjusted as well on switches. + +.SH COMMON OPTIONS + +Most OpenIB diagnostics take the following common flags. The exact list of +supported flags per utility can be found in the usage message and can be shown +using the util_name -h syntax. + +# Debugging flags +.PP +\-h show the usage message +.PP +\-V show the version info. + +.SH AUTHORS +.TP +Albert Chu +.RI ch...@llnl.gov diff --git a/infiniband-diags/src/ibcacheedit.c b/infiniband-diags/src/ibcacheedit.c new file mode 100644 index 000..1f2558b --- /dev/null +++ b/infiniband-diags/src/ibcacheedit.c @@ -0,0 +1,361 @@ +/* + * Copyright (c) 2010 Lawrence Livermore National Lab. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD
[infiniband-diags] fix libibnetdisc portguid hashing corner case
Hey Sasha, This patch fixes a corner case in libibnetdisc that was storing portguids w/ a guid of 0. This bug was relatively innoucuous for ibnetdiscover b/c ibnetdiscover does not output these ports. However, it became a problem for me in the caching library as I attempted to reconstruct a fabric, and multiple ports were identifying themselves with identical guids [1]. Al [1] - The fact the caching code assumes duplicate guids can't exist is also a bug. But that's for another patch. This is a bug by itself. -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/libibnetdisc/src/ibnetdisc.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index c895de9..6010a28 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -173,6 +173,7 @@ static int recv_port_info(smp_engine_t * engine, ibnd_smp_t * smp, IBND_ERROR(Failed to allocate port\n); return -1; } + port-guid = mad_get_field64(node-info, 0, IB_NODE_PORT_GUID_F); } memcpy(port-info, port_info, sizeof(port-info)); -- 1.5.4.5 ---End Message---
[infiniband-diags] [1/2] fix libibnetdisc cache error path memleak
Hey Sasha, This patch fixes a mem-leak through error paths in the libibnetdisc cache loading. If some data had not yet been copied over to the fabric struct and an error occurred, that memory would be leaked. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/libibnetdisc/src/ibnetdisc.c |2 +- .../libibnetdisc/src/ibnetdisc_cache.c | 13 +++-- infiniband-diags/libibnetdisc/src/internal.h |2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index c895de9..dfd7dce 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -510,7 +510,7 @@ error: return NULL; } -static void destroy_node(ibnd_node_t * node) +void destroy_node(ibnd_node_t * node) { int p = 0; diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c index 480a0a2..2ec353d 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -113,6 +113,7 @@ typedef struct ibnd_node_cache { ibnd_port_cache_key_t *port_cache_keys; struct ibnd_node_cache *next; struct ibnd_node_cache *htnext; + int node_stored_to_fabric; } ibnd_node_cache_t; typedef struct ibnd_port_cache { @@ -122,6 +123,7 @@ typedef struct ibnd_port_cache { ibnd_port_cache_key_t remoteport_cache_key; struct ibnd_port_cache *next; struct ibnd_port_cache *htnext; + int port_stored_to_fabric; } ibnd_port_cache_t; typedef struct ibnd_fabric_cache { @@ -257,6 +259,9 @@ static int _load_header_info(int fd, ibnd_fabric_cache_t * fabric_cache, static void _destroy_ibnd_node_cache(ibnd_node_cache_t * node_cache) { free(node_cache-port_cache_keys); + if (!node_cache-node_stored_to_fabric +node_cache-node) + destroy_node(node_cache-node); free(node_cache); } @@ -283,6 +288,9 @@ static void _destroy_ibnd_fabric_cache(ibnd_fabric_cache_t * fabric_cache) while (port_cache) { port_cache_next = port_cache-next; + if (!port_cache-port_stored_to_fabric +port_cache-port) + free(port_cache-port); free(port_cache); port_cache = port_cache_next; @@ -387,8 +395,6 @@ static int _load_node(int fd, ibnd_fabric_cache_t * fabric_cache) return 0; cleanup: - /* note, no need to destroy node through destroy_node(), nothing else malloced */ - free(node); _destroy_ibnd_node_cache(node_cache); return -1; } @@ -500,6 +506,7 @@ static int _fill_port(ibnd_fabric_cache_t * fabric_cache, ibnd_node_t * node, } node-ports[port_cache-port-portnum] = port_cache-port; + port_cache-port_stored_to_fabric++; /* achu: needed if user wishes to re-cache a loaded fabric. * Otherwise, mostly unnecessary to do this. @@ -532,6 +539,8 @@ static int _rebuild_nodes(ibnd_fabric_cache_t * fabric_cache) add_to_type_list(node_cache-node, fabric_cache-fabric); + node_cache-node_stored_to_fabric++; + /* Rebuild node ports array */ if (!(node-ports = diff --git a/infiniband-diags/libibnetdisc/src/internal.h b/infiniband-diags/libibnetdisc/src/internal.h index 57034f9..32d567e 100644 --- a/infiniband-diags/libibnetdisc/src/internal.h +++ b/infiniband-diags/libibnetdisc/src/internal.h @@ -98,4 +98,6 @@ void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]); void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric); +void destroy_node(ibnd_node_t * node); + #endif /* _INTERNAL_H_ */ -- 1.5.4.5 ---End Message---
[infiniband-diags] fix libibnetdisc corner case when user tries to re-cache a loaded cache
Hey Sasha, Noticed this corner case. If I load a ibnetdiscover cache, then try to re-cache it, the cache doesn't store things properly b/c I didn't reconstruct one fabric data structure properly. This fixes that bug. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/src/ibnetdisc_cache.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c index d94b85a..9cd5981 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -501,6 +501,10 @@ static int _fill_port(ibnd_fabric_cache_t * fabric_cache, ibnd_node_t * node, node-ports[port_cache-port-portnum] = port_cache-port; + /* achu: needed if user wishes to re-cache a loaded fabric. +* Otherwise, mostly unnecessary to do this. +*/ + add_to_portguid_hash(port_cache-port, fabric_cache-fabric-portstbl); return 0; } -- 1.5.4.5 ---End Message---
[infiniband-diags] [0/3] support --diff and --diffcheck in ibnetdiscover
Hey Sasha, The following sets of patches implement a --diff and --diffcheck options in ibnetdiscover to let users diff an ibnetdiscover state to a previous ibnetdiscover state. The goal of this option is to help system administrators isolate/determine changes in the network quickly compared to a previous state. Here's an example: # ./ibnetdiscover --diff=orig.cache vendid=0x8f1 devid=0x5a30 sysimgguid=0x8f10400411f57 switchguid=0x8f10400411f56(8f10400411f56) Switch 24 S-0008f10400411f56 # ISR9024D Voltaire base port 0 lid 11 lmc 0 [14] H-0002c90200219ef0[1](2c90200219ef1) # wopr0 lid 64 4xDDR [19] H-0002c903ff7c[1](2c903ff7d) # wopr9 lid 48 4xDDR [20] H-0002c903ff7c[1](2c903ff7d) # wopr9 lid 4 4xDDR vendid=0x2c9 devid=0x6282 sysimgguid=0x2c90200219ef3 caguid=0x2c90200219ef0 Ca2 H-0002c90200219ef0 # wopr0 [1](2c90200219ef1)S-0008f10400411f56[14]# lid 64 lmc 2 ISR9024D Voltaire lid 11 4xDDR In this particular example, port 14 on the switch (which is connected to node 'wopr0') was up before but is now down (and the associated CA is noted too). In addition, 'wopr9' is connected to port 20 instead of port 19 on the switch. By default --diff checks switches, cas, routers, and port connections. The --diffcheck option allows the user to specify which diff options they want done, and also adds other diff checks for lids and/or node descriptions. More diff checks could be added later as needed. For example, the following only checks for differences of lids on switches. # ./ibnetdiscover --diff=orig.cache --diffcheck=sw,lid vendid=0x8f1 devid=0x5a30 sysimgguid=0x8f10400411f57 switchguid=0x8f10400411f56(8f10400411f56) Switch24 S-0008f10400411f56 # ISR9024D Voltaire base port 0 lid 11 lmc 0 Switch24 S-0008f10400411f56 # ISR9024D Voltaire base port 0 lid 3 lmc 0 [13] H-0002c90200219e64[1](2c90200219e65) # wopri lid 4 4xDDR [13] H-0002c90200219e64[1](2c90200219e65) # wopri lid 1 4xDDR Others on the list may wonder how this is different than just using the normal 'diff' tool. The differences I can think of are: 1) This checks differences in the network, not text. This is particularly important when lids, lmc, etc. are changed. Otherwise there are many differences in a normal diff output that aren't necessary. 2) This provides the appropriate context in the diff output, showing the appropriate system ids to allow a system administrator to identify ports on what switch have changed. Under normal diff output, you may not get that appropriate context of information. The system administrator can of course use options like --context in diff, but the goal is to make the diff output clear and concise, not outputting unnecessary junk. 3) As parallelization has been added into ibnetdisocver/libibnetdiscover this becomes more critical as output in ibnetdiscover/libibnetdiscover can be re-ordered. So a normal diff suddenly is non-functional. There's probably other minor advantages. Even if minor output tweaks happen to ibnetdiscover in the future, this can still work against old cache files. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[infiniband-diags] [1/3] support --diff in ibnetdiscover
Hi Sasha, This patch adds the default --diff support in ibnetdiscover. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 |7 + infiniband-diags/src/ibnetdiscover.c | 246 + 2 files changed, 223 insertions(+), 30 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index 082a8e4..975b999 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -57,6 +57,13 @@ Load and use the cached ibnetdiscover data stored in the specified filename. May be useful for outputting and learning about other fabrics or a previous state of a fabric. .TP +\fB\-\-diff\fR filename +Load cached ibnetdiscover data and do a diff comparison to the current +network or another cache. A special diff output for ibnetdiscover +output will be displayed showing differences between the old and current +fabric. By default, the following are compared for differences: switches, +channel adapters, routers, and port connections. +.TP \fB\-p\fR, \fB\-\-ports\fR Obtain a ports report which is a list of connected ports with relevant information (like LID, portnum, diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 651bafd..4da09ce 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -57,6 +57,16 @@ #define LIST_SWITCH_NODE (1 IB_NODE_SWITCH) #define LIST_ROUTER_NODE (1 IB_NODE_ROUTER) +#define DIFF_FLAG_SWITCH 0x0001 +#define DIFF_FLAG_CA 0x0002 +#define DIFF_FLAG_ROUTER 0x0004 +#define DIFF_FLAG_PORT_CONNECTION 0x0008 + +#define DIFF_FLAG_DEFAULT (DIFF_FLAG_SWITCH \ + | DIFF_FLAG_CA \ + | DIFF_FLAG_ROUTER \ + | DIFF_FLAG_PORT_CONNECTION) + struct ibmad_port *srcport; static FILE *f; @@ -65,6 +75,7 @@ static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; static char *cache_file = NULL; static char *load_cache_file = NULL; +static char *diff_cache_file = NULL; static int report_max_hops = 0; @@ -183,16 +194,20 @@ void list_nodes(ibnd_fabric_t * fabric, int list) ibnd_iter_nodes_type(fabric, list_node, IB_NODE_ROUTER, NULL); } -void out_ids(ibnd_node_t * node, int group, char *chname) +void out_ids(ibnd_node_t * node, int group, char *chname, char *out_prefix) { uint64_t sysimgguid = mad_get_field64(node-info, 0, IB_NODE_SYSTEM_GUID_F); - fprintf(f, \nvendid=0x%x\ndevid=0x%x\n, - mad_get_field(node-info, 0, IB_NODE_VENDORID_F), + fprintf(f, \n%svendid=0x%x\n, + out_prefix ? out_prefix : , + mad_get_field(node-info, 0, IB_NODE_VENDORID_F)); + fprintf(f, %sdevid=0x%x\n, + out_prefix ? out_prefix : , mad_get_field(node-info, 0, IB_NODE_DEVID_F)); if (sysimgguid) - fprintf(f, sysimgguid=0x% PRIx64, sysimgguid); + fprintf(f, %ssysimgguid=0x% PRIx64, + out_prefix ? out_prefix : , sysimgguid); if (group node-chassis node-chassis-chassisnum) { fprintf(f, \t\t# Chassis %d, node-chassis-chassisnum); if (chname) @@ -217,14 +232,15 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum) return guid; } -void out_switch(ibnd_node_t * node, int group, char *chname) +void out_switch(ibnd_node_t * node, int group, char *chname, char *out_prefix) { char *str; char str2[256]; char *nodename = NULL; - out_ids(node, group, chname); - fprintf(f, switchguid=0x% PRIx64, node-guid); + out_ids(node, group, chname, out_prefix); + fprintf(f, %sswitchguid=0x% PRIx64, + out_prefix ? out_prefix : , node-guid); fprintf(f, (% PRIx64 ), mad_get_field64(node-info, 0, IB_NODE_PORT_GUID_F)); if (group) { @@ -239,7 +255,8 @@ void out_switch(ibnd_node_t * node, int group, char *chname) nodename = remap_node_name(node_name_map, node-guid, node-nodedesc); - fprintf(f, \nSwitch\t%d %s\t\t# \%s\ %s port 0 lid %d lmc %d\n, + fprintf(f, \n%sSwitch\t%d %s\t\t# \%s\ %s port 0 lid %d lmc %d\n, + out_prefix ? out_prefix : , node-numports, node_name(node), nodename, node-smaenhsp0 ? enhanced : base, node-smalid, node-smalmc); @@ -247,12 +264,12 @@ void out_switch(ibnd_node_t * node, int group, char *chname) free(nodename); } -void out_ca(ibnd_node_t * node, int group, char *chname) +void out_ca(ibnd_node_t * node, int group, char *chname, char *out_prefix) { char
[infiniband-diags] [3/3] support lid and nodedesc diffchecks in ibnetdiscover
Hi Sasha, This patch adds lid and node description diff options for --diffcheck in ibnetdiscover. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 |3 +- infiniband-diags/src/ibnetdiscover.c | 211 -- 2 files changed, 154 insertions(+), 60 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index e122736..76cfbc8 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -68,7 +68,8 @@ channel adapters, routers, and port connections. Specify what diff checks should be done in the \fB\-\-diff\fR option above. Comma separate multiple diff check key(s). The available diff checks are: \fIsw\fR = switches, \fIca\fR = channel adapters, \fIrouter\fR = routers, -\fIport\fR = port connections descriptions. Note that \fIport\fR is +\fIport\fR = port connections, \fIlid\fR = lids, \fInodedesc\fR = node +descriptions. Note that \fIport\fR, \fIlid\fR, and \fInodedesc\fR are checked only for the node types that are specified (e.g. \fIsw\fR, \fIca\fR, \fIrouter\fR). .TP diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 4435ade..770c589 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -61,6 +61,8 @@ #define DIFF_FLAG_CA 0x0002 #define DIFF_FLAG_ROUTER 0x0004 #define DIFF_FLAG_PORT_CONNECTION 0x0008 +#define DIFF_FLAG_LID 0x0010 +#define DIFF_FLAG_NODE_DESCRIPTION 0x0020 #define DIFF_FLAG_DEFAULT (DIFF_FLAG_SWITCH \ | DIFF_FLAG_CA \ @@ -233,15 +235,29 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum) return guid; } -void out_switch(ibnd_node_t * node, int group, char *chname, char *out_prefix) +void out_switch_detail(ibnd_node_t * node, char *sw_prefix) +{ + char *nodename = NULL; + + nodename = remap_node_name(node_name_map, node-guid, node-nodedesc); + + fprintf(f, %sSwitch\t%d %s\t\t# \%s\ %s port 0 lid %d lmc %d, + sw_prefix ? sw_prefix : , + node-numports, node_name(node), nodename, + node-smaenhsp0 ? enhanced : base, + node-smalid, node-smalmc); + + free(nodename); +} + +void out_switch(ibnd_node_t * node, int group, char *chname, char *id_prefix, char *sw_prefix) { char *str; char str2[256]; - char *nodename = NULL; - out_ids(node, group, chname, out_prefix); + out_ids(node, group, chname, id_prefix); fprintf(f, %sswitchguid=0x% PRIx64, - out_prefix ? out_prefix : , node-guid); + id_prefix ? id_prefix : , node-guid); fprintf(f, (% PRIx64 ), mad_get_field64(node-info, 0, IB_NODE_PORT_GUID_F)); if (group) { @@ -253,45 +269,54 @@ void out_switch(ibnd_node_t * node, int group, char *chname, char *out_prefix) if (str) fprintf(f, %s, str); } + fprintf(f, \n); - nodename = remap_node_name(node_name_map, node-guid, node-nodedesc); + out_switch_detail(node, sw_prefix); + fprintf(f, \n); +} - fprintf(f, \n%sSwitch\t%d %s\t\t# \%s\ %s port 0 lid %d lmc %d\n, - out_prefix ? out_prefix : , - node-numports, node_name(node), nodename, - node-smaenhsp0 ? enhanced : base, - node-smalid, node-smalmc); +void out_ca_detail(ibnd_node_t * node, char *ca_prefix) +{ + char *node_type; - free(nodename); + switch (node-type) { + case IB_NODE_CA: + node_type = Ca; + break; + case IB_NODE_ROUTER: + node_type = Rt; + break; + default: + node_type = ???; + break; + } + + fprintf(f, %s%s\t%d %s\t\t# \%s\, + ca_prefix ? ca_prefix : , + node_type, node-numports, node_name(node), + clean_nodedesc(node-nodedesc)); } -void out_ca(ibnd_node_t * node, int group, char *chname, char *out_prefix) +void out_ca(ibnd_node_t * node, int group, char *chname, char *id_prefix, char *ca_prefix) { char *node_type; - char *node_type2; - out_ids(node, group, chname, out_prefix); + out_ids(node, group, chname, id_prefix); switch (node-type) { case IB_NODE_CA: node_type = ca; - node_type2 = Ca; break; case IB_NODE_ROUTER: node_type = rt; - node_type2 = Rt; break; default: node_type = ???; - node_type2 = ???; break; }
[infiniband-diags] [2/3] support --diffcheck in ibnetdiscover
Hi Sasha, This patch adds basic --diffcheck support in ibnetdiscover, allowing configuration of the diff checks done in the default --diff option. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ---BeginMessage--- Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 |8 + infiniband-diags/src/ibnetdiscover.c | 50 +- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index 975b999..e122736 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -64,6 +64,14 @@ output will be displayed showing differences between the old and current fabric. By default, the following are compared for differences: switches, channel adapters, routers, and port connections. .TP +\fB\-\-diffcheck\fR key(s) +Specify what diff checks should be done in the \fB\-\-diff\fR option above. +Comma separate multiple diff check key(s). The available diff checks +are: \fIsw\fR = switches, \fIca\fR = channel adapters, \fIrouter\fR = routers, +\fIport\fR = port connections descriptions. Note that \fIport\fR is +checked only for the node types that are specified (e.g. \fIsw\fR, +\fIca\fR, \fIrouter\fR). +.TP \fB\-p\fR, \fB\-\-ports\fR Obtain a ports report which is a list of connected ports with relevant information (like LID, portnum, diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index 4da09ce..4435ade 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -57,10 +57,10 @@ #define LIST_SWITCH_NODE (1 IB_NODE_SWITCH) #define LIST_ROUTER_NODE (1 IB_NODE_ROUTER) -#define DIFF_FLAG_SWITCH 0x0001 -#define DIFF_FLAG_CA 0x0002 -#define DIFF_FLAG_ROUTER 0x0004 -#define DIFF_FLAG_PORT_CONNECTION 0x0008 +#define DIFF_FLAG_SWITCH 0x0001 +#define DIFF_FLAG_CA 0x0002 +#define DIFF_FLAG_ROUTER 0x0004 +#define DIFF_FLAG_PORT_CONNECTION 0x0008 #define DIFF_FLAG_DEFAULT (DIFF_FLAG_SWITCH \ | DIFF_FLAG_CA \ @@ -76,6 +76,7 @@ static nn_map_t *node_name_map = NULL; static char *cache_file = NULL; static char *load_cache_file = NULL; static char *diff_cache_file = NULL; +static uint32_t diffcheck_flags = DIFF_FLAG_DEFAULT; static int report_max_hops = 0; @@ -735,7 +736,9 @@ static int diff_common(ibnd_fabric_t * orig_fabric, * in new_fabric but not in orig_fabric. * * In this diff, we don't need to check port connections, -* since it has already been done before. +* lids, or node descriptions since it has already been + * done (i.e. checks are only done when guid exists on both +* orig and new). */ iter_diff_data.diff_flags = diff_flags ~DIFF_FLAG_PORT_CONNECTION; iter_diff_data.fabric1 = new_fabric; @@ -752,29 +755,27 @@ static int diff_common(ibnd_fabric_t * orig_fabric, int diff(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric) { - uint32_t diff_flags = DIFF_FLAG_DEFAULT; - - if (diff_flags DIFF_FLAG_SWITCH) + if (diffcheck_flags DIFF_FLAG_SWITCH) diff_common(orig_fabric, new_fabric, IB_NODE_SWITCH, - diff_flags, + diffcheck_flags, out_switch, out_switch_port); - if (diff_flags DIFF_FLAG_CA) + if (diffcheck_flags DIFF_FLAG_CA) diff_common(orig_fabric, new_fabric, IB_NODE_CA, - diff_flags, + diffcheck_flags, out_ca, out_ca_port); - if (diff_flags DIFF_FLAG_ROUTER) + if (diffcheck_flags DIFF_FLAG_ROUTER) diff_common(orig_fabric, new_fabric, IB_NODE_ROUTER, - diff_flags, + diffcheck_flags, out_ca, out_ca_port); @@ -786,6 +787,8 @@ static int list, group, ports_report; static int process_opt(void *context, int ch, char *optarg) { + char *p; + switch (ch) { case 1: node_name_map_file = strdup(optarg); @@ -799,6 +802,25 @@ static int process_opt(void *context, int ch, char *optarg) case 4: diff_cache_file = strdup(optarg); break; + case 5: + diffcheck_flags = 0; + p = strtok(optarg, ,); + while (p) { + if
Re: how to force opensmd to recalculate all paths?
Hi Kovlensky, I'm unsure of what version of Opensm this was added in, but the opensm console (see opensm manpage for console info), there is a resweep [heavy|light] command. Running resweep heavy should do exactly what you need. Al On Fri, 2010-02-19 at 12:42 +0100, kovlen...@interia.pl wrote: Hi, My case is simple - opensm does not recalculate paths unless necessary, i.e. one of physical links on the way disappears. I just introduced significant topology changes and need opensm to take them into consideration. New links were added, a lot of them. Is there any way of telling opensm to recalculate all paths? At the moment all new links are happily ignored and i can find no way of doing that live. My vendor has bad habit of asking me to add ib link here and there to nullify bottleneck identified and, well, while all new paths are up, I can find no way of rebalancing paths, so they stay unused. I'm running OFED-1.3.2-20090119-0501, so all ideas for this version or a newer one are welcome. Regards, kovlensky -- Szybkie i niedrogie... Tylko dla mezczyzn! Sprawdz http://*link.interia.pl/f25a7 -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://*vger.kernel.org/majordomo-info.html -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [infiniband-diags] [UPDATED PATCH] [3/3] support --load-cache in iblinkinfo and ibqueryerrors
Hey Sasha, Here's an updated patch with the cleanup changes as we discussed. Al On Sat, 2010-01-16 at 16:28 +0200, Sasha Khapyorsky wrote: On 10:23 Fri 15 Jan , Al Chu wrote: Hi Sasha, This adds the --load-cache options to iblinkinfo and ibqueryerrors. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 10 Dec 2009 11:22:50 -0800 Subject: [PATCH] support --load-cache in iblinkinfo and ibqueryerrors Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8| 11 ++- infiniband-diags/man/ibqueryerrors.8 | 10 ++- infiniband-diags/src/iblinkinfo.c| 52 +--- infiniband-diags/src/ibqueryerrors.c | 53 ++--- 4 files changed, 99 insertions(+), 27 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index 0f53b00..f184edf 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -6,7 +6,7 @@ iblinkinfo \- report link info for all links in the fabric .SH SYNOPSIS .B iblinkinfo [-hcdl -C ca_name -P ca_port -v lt,hoq,vlstall -S guid --D direct_route] +-D direct_route \-\-load\-cache filename] .SH DESCRIPTION .PP @@ -42,7 +42,14 @@ Print port capabilities (enabled and supported values) \fB\-P ca_port\fRuse the specified ca_port for the search. .TP \fB\-R\fR (This option is obsolete and does nothing) - +.TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. Cannot be used if user +specifies a directo route path. See +.B ibnetdiscover +for information on caching ibnetdiscover output. .SH AUTHOR .TP diff --git a/infiniband-diags/man/ibqueryerrors.8 b/infiniband-diags/man/ibqueryerrors.8 index 83a2b5a..56a0d67 100644 --- a/infiniband-diags/man/ibqueryerrors.8 +++ b/infiniband-diags/man/ibqueryerrors.8 @@ -6,7 +6,7 @@ ibqueryerrors \- query and report non-zero IB port counters .SH SYNOPSIS .B ibqueryerrors [-s err1,err2,... -c -r -C ca_name -P ca_port -G node_guid --D direct_route -d -k -K] +-D direct_route -d -k -K \-\-load\-cache filename] .SH DESCRIPTION .PP @@ -60,6 +60,14 @@ specified the data counters will be cleared without any printed output. .TP \fB\-\-details\fR include transmit discard details .TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. Cannot be used if user +specifies a directo route path. See +.B ibnetdiscover +for information on caching ibnetdiscover output. +.TP \fB\-R\fR (This option is obsolete and does nothing) .SH COMMON OPTIONS diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index 21b31bb..10e3ad5 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -55,6 +55,7 @@ static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; +static char *load_cache_file = NULL; static uint64_t guid = 0; static char *guid_str = NULL; @@ -230,6 +231,9 @@ static int process_opt(void *context, int ch, char *optarg) case 1: node_name_map_file = strdup(optarg); break; + case 2: + load_cache_file = strdup(optarg); + break; case 'S': guid_str = optarg; guid = (uint64_t) strtoull(guid_str, 0, 0); @@ -291,6 +295,7 @@ int main(int argc, char **argv) print additional switch settings (PktLifeTime, HoqLife, VLStallCount)}, {portguids, 'g', 0, NULL, print port guids instead of node guids}, + {load-cache, 2, 1, file, filename of ibnetdiscover cache to load}, {GNDN, 'R', 0, NULL, (This option is obsolete and does nothing)}, {0} @@ -317,6 +322,11 @@ int main(int argc, char **argv) mad_rpc_set_timeout(ibmad_port, ibd_timeout); node_name_map = open_node_name_map(node_name_map_file); + + if (dr_path load_cache_file) { + fprintf(stderr, Cannot specify cache and direct route path\n); + exit(1); + } Why is this limitation needed really? if (dr_path) { /* only scan part of the fabric */ @@ -334,19 +344,37 @@ int main(int argc, char **argv) guid_str); } - if (resolved = 0) - if ((fabric = ibnd_discover_fabric(ibmad_port, port_id
Re: [infiniband-diags] [UPDATED PATCH] [3/3] support --load-cache in iblinkinfo and ibqueryerrors
Hey Sasha, answers inlined below On Sat, 2010-01-16 at 16:28 +0200, Sasha Khapyorsky wrote: On 10:23 Fri 15 Jan , Al Chu wrote: Hi Sasha, This adds the --load-cache options to iblinkinfo and ibqueryerrors. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 10 Dec 2009 11:22:50 -0800 Subject: [PATCH] support --load-cache in iblinkinfo and ibqueryerrors Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8| 11 ++- infiniband-diags/man/ibqueryerrors.8 | 10 ++- infiniband-diags/src/iblinkinfo.c| 52 +--- infiniband-diags/src/ibqueryerrors.c | 53 ++--- 4 files changed, 99 insertions(+), 27 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index 0f53b00..f184edf 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -6,7 +6,7 @@ iblinkinfo \- report link info for all links in the fabric .SH SYNOPSIS .B iblinkinfo [-hcdl -C ca_name -P ca_port -v lt,hoq,vlstall -S guid --D direct_route] +-D direct_route \-\-load\-cache filename] .SH DESCRIPTION .PP @@ -42,7 +42,14 @@ Print port capabilities (enabled and supported values) \fB\-P ca_port\fRuse the specified ca_port for the search. .TP \fB\-R\fR (This option is obsolete and does nothing) - +.TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. Cannot be used if user +specifies a directo route path. See +.B ibnetdiscover +for information on caching ibnetdiscover output. .SH AUTHOR .TP diff --git a/infiniband-diags/man/ibqueryerrors.8 b/infiniband-diags/man/ibqueryerrors.8 index 83a2b5a..56a0d67 100644 --- a/infiniband-diags/man/ibqueryerrors.8 +++ b/infiniband-diags/man/ibqueryerrors.8 @@ -6,7 +6,7 @@ ibqueryerrors \- query and report non-zero IB port counters .SH SYNOPSIS .B ibqueryerrors [-s err1,err2,... -c -r -C ca_name -P ca_port -G node_guid --D direct_route -d -k -K] +-D direct_route -d -k -K \-\-load\-cache filename] .SH DESCRIPTION .PP @@ -60,6 +60,14 @@ specified the data counters will be cleared without any printed output. .TP \fB\-\-details\fR include transmit discard details .TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. Cannot be used if user +specifies a directo route path. See +.B ibnetdiscover +for information on caching ibnetdiscover output. +.TP \fB\-R\fR (This option is obsolete and does nothing) .SH COMMON OPTIONS diff --git a/infiniband-diags/src/iblinkinfo.c b/infiniband-diags/src/iblinkinfo.c index 21b31bb..10e3ad5 100644 --- a/infiniband-diags/src/iblinkinfo.c +++ b/infiniband-diags/src/iblinkinfo.c @@ -55,6 +55,7 @@ static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; +static char *load_cache_file = NULL; static uint64_t guid = 0; static char *guid_str = NULL; @@ -230,6 +231,9 @@ static int process_opt(void *context, int ch, char *optarg) case 1: node_name_map_file = strdup(optarg); break; + case 2: + load_cache_file = strdup(optarg); + break; case 'S': guid_str = optarg; guid = (uint64_t) strtoull(guid_str, 0, 0); @@ -291,6 +295,7 @@ int main(int argc, char **argv) print additional switch settings (PktLifeTime, HoqLife, VLStallCount)}, {portguids, 'g', 0, NULL, print port guids instead of node guids}, + {load-cache, 2, 1, file, filename of ibnetdiscover cache to load}, {GNDN, 'R', 0, NULL, (This option is obsolete and does nothing)}, {0} @@ -317,6 +322,11 @@ int main(int argc, char **argv) mad_rpc_set_timeout(ibmad_port, ibd_timeout); node_name_map = open_node_name_map(node_name_map_file); + + if (dr_path load_cache_file) { + fprintf(stderr, Cannot specify cache and direct route path\n); + exit(1); + } Why is this limitation needed really? I spoke to Ira about it awhile ago. I think what we decided was that while technically you can do a DR path, b/c you can load a cache from anywhere in the cluster, you won't know if the DR path is legal or correct at point A vs point B. In contrast, the node_guid input is valid anywhere you are on the cluster. I suppose we
[infiniband-diags] [UPDATED PATCH] [2/3] support --cache and --load-cache options in ibnetdiscover
Hi Sasha, This adds the --cache and --load-cache options to ibnetdiscover. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Wed, 9 Dec 2009 15:19:47 -0800 Subject: [PATCH] support --cache and --load-cache options in ibnetdiscover Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 | 12 +++- infiniband-diags/src/ibnetdiscover.c | 26 -- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index abf3588..082a8e4 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -8,7 +8,8 @@ ibnetdiscover \- discover InfiniBand topology [\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-s(how)] [\-l(ist)] [\-g(rouping)] [\-H(ca_list)] [\-S(witch_list)] [\-R(outer_list)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] -[\--node-name-map node-name-map] [\-p(orts)] [\-m(ax_hops)] +[\--node-name-map node-name-map] [\-\-cache filename] +[\-\-load\-cache filename] [\-p(orts)] [\-m(ax_hops)] [\-h(elp)] [topology-file] .SH DESCRIPTION @@ -47,6 +48,15 @@ Show progress information during discovery. Specify a node name map. The node name map file maps GUIDs to more user friendly names. See file format below. .TP +\fB\-\-cache\fR filename +Cache the ibnetdiscover network data in the specified filename. This +cache may be used by other tools for later analysis. +.TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. +.TP \fB\-p\fR, \fB\-\-ports\fR Obtain a ports report which is a list of connected ports with relevant information (like LID, portnum, diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index e081a36..e87f42e 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -63,6 +63,8 @@ static FILE *f; static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; +static char *cache_file = NULL; +static char *load_cache_file = NULL; static int report_max_hops = 0; @@ -616,6 +618,12 @@ static int process_opt(void *context, int ch, char *optarg) case 1: node_name_map_file = strdup(optarg); break; + case 2: + cache_file = strdup(optarg); + break; + case 3: + load_cache_file = strdup(optarg); + break; case 's': ibnd_show_progress(1); break; @@ -662,6 +670,8 @@ int main(int argc, char **argv) {Switch_list, 'S', 0, NULL, list of connected switches}, {Router_list, 'R', 0, NULL, list of connected routers}, {node-name-map, 1, 1, file, node name map file}, + {cache, 2, 1, file, filename to cache ibnetdiscover data to}, + {load-cache, 3, 1, file, filename of ibnetdiscover cache to load}, {ports, 'p', 0, NULL, obtain a ports report}, {max_hops, 'm', 0, NULL, report max hops discovered by the library}, @@ -692,8 +702,14 @@ int main(int argc, char **argv) node_name_map = open_node_name_map(node_name_map_file); - if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL) - IBERROR(discover failed\n); + if (load_cache_file) { + if ((fabric = ibnd_load_fabric(load_cache_file, 0)) == NULL) + IBERROR(loading cached fabric failed\n); + } + else { + if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL) + IBERROR(discover failed\n); + } if (ports_report) ibnd_iter_nodes(fabric, dump_ports_report, NULL); @@ -702,6 +718,12 @@ int main(int argc, char **argv) else dump_topology(group, fabric); + if (cache_file) + if (ibnd_cache_fabric(fabric, + cache_file, + 0) 0) + IBERROR(caching ibnetdiscover data failed\n); + ibnd_destroy_fabric(fabric); close_node_name_map(node_name_map); mad_rpc_close_port(ibmad_port); -- 1.5.4.5
[infiniband-diags] [UPDATED PATCH] [1/3] add libibnetdisc caching to libibnetdiscover
Hi Sahsa, This patch adds caching functionality to libibnetdisc through the new functions ibnd_cache_fabric() and ibnd_load_fabric(). Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Wed, 9 Dec 2009 15:19:24 -0800 Subject: [PATCH] add libibnetdisc caching to libibnetdiscover Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/libibnetdisc/Makefile.am |3 +- .../libibnetdisc/include/infiniband/ibnetdisc.h|6 + infiniband-diags/libibnetdisc/src/ibnetdisc.c |6 +- .../libibnetdisc/src/ibnetdisc_cache.c | 909 infiniband-diags/libibnetdisc/src/internal.h |6 + infiniband-diags/libibnetdisc/src/libibnetdisc.map |2 + 6 files changed, 928 insertions(+), 4 deletions(-) create mode 100644 infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c diff --git a/infiniband-diags/libibnetdisc/Makefile.am b/infiniband-diags/libibnetdisc/Makefile.am index 636d142..a46dbc8 100644 --- a/infiniband-diags/libibnetdisc/Makefile.am +++ b/infiniband-diags/libibnetdisc/Makefile.am @@ -22,7 +22,8 @@ else libibnetdisc_version_script = endif -libibnetdisc_la_SOURCES = src/ibnetdisc.c src/chassis.c src/chassis.h src/internal.h +libibnetdisc_la_SOURCES = src/ibnetdisc.c src/ibnetdisc_cache.c src/chassis.c \ + src/chassis.h src/internal.h libibnetdisc_la_CFLAGS = -Wall $(DBGFLAGS) libibnetdisc_la_LDFLAGS = -version-info $(ibnetdisc_api_version) \ -export-dynamic $(libibnetdisc_version_script) \ diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 8d5ac39..38ca2fb 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -170,6 +170,12 @@ MAD_EXPORT ibnd_fabric_t *ibnd_discover_fabric(struct ibmad_port *ibmad_port, */ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric); +MAD_EXPORT ibnd_fabric_t *ibnd_load_fabric(const char *file, + unsigned int flags); + +MAD_EXPORT int ibnd_cache_fabric(ibnd_fabric_t *fabric, const char *file, +unsigned int flags); + /** = * Node operations */ diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index 9367337..9b24931 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -286,7 +286,7 @@ ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t * fabric, char *dr_str) return rc; } -static void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) +void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) { int hash_idx = HASHGUID(node-guid) % HTSZ; @@ -294,7 +294,7 @@ static void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) hash[hash_idx] = node; } -static void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) +void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) { int hash_idx = HASHGUID(port-guid) % HTSZ; @@ -302,7 +302,7 @@ static void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) hash[hash_idx] = port; } -static void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) +void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) { switch (node-type) { case IB_NODE_CA: diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c new file mode 100644 index 000..403c053 --- /dev/null +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -0,0 +1,909 @@ +/* + * Copyright (c) 2004-2007 Voltaire Inc. All rights reserved. + * Copyright (c) 2007 Xsigo Systems Inc. All rights reserved. + * Copyright (c) 2008 Lawrence Livermore National Laboratory + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * + * - Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *
[infiniband-diags] [UPDATED PATCH] [0/3] Support libibnetdiscover caching
Hi Sasha, [This is a repost w/ updates and updated patches from my posts Dec 09, I assume the patches fell off your list :-)] I've added two new functions into libibnetdisc, ibnd_cache_fabric() and ibnd_load_fabric(). As the names suggest, these functions allow the user to store the ibnd_fabric_t fabric to disk and read it back later on. The patches add the functions and the base functionality to ibnetdiscover, iblinkinfo, and ibqueryerrors. Some of the current and future benefits of this are: - Give users the option to have IB diag tools load the cached version of the fabric instead of scanning the IB fabric. Not only does this make the tools faster, it allows users to debug, analyze, play, etc. with a fabric state that existed in the past. Or a fabric that they don't even have access to (e.g. send the current fabric to support staff). - Support new debug/analysis features into IB diag tools. One example is a diff type of debug/analysis feature that allows users to compare how the current fabric state is different than a previous time. Another idea is a filter type of option. Some users who have a number of unpopulated switch ports have said they'd like to limit the output of the diag tools. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[infiniband-diags] [PATCH] correct manpages for tools that are no longer scripts
Hey Sasha, Another set of typos I found. Nothing fancy. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 10 Dec 2009 13:21:02 -0800 Subject: [PATCH] correct manpages for tools that are no longer scripts Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/iblinkinfo.8|6 +++--- infiniband-diags/man/ibqueryerrors.8 |6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/infiniband-diags/man/iblinkinfo.8 b/infiniband-diags/man/iblinkinfo.8 index de8676a..0f53b00 100644 --- a/infiniband-diags/man/iblinkinfo.8 +++ b/infiniband-diags/man/iblinkinfo.8 @@ -1,16 +1,16 @@ .TH IBLINKINFO 8 Jan 24, 2008 OpenIB OpenIB Diagnostics .SH NAME -iblinkinfo.pl \- report link info for all links in the fabric +iblinkinfo \- report link info for all links in the fabric .SH SYNOPSIS -.B iblinkinfo.pl +.B iblinkinfo [-hcdl -C ca_name -P ca_port -v lt,hoq,vlstall -S guid -D direct_route] .SH DESCRIPTION .PP -iblinkinfo.pl reports the link info for each port of each switch active in the +iblinkinfo reports the link info for each port of each switch active in the IB fabric. .SH OPTIONS diff --git a/infiniband-diags/man/ibqueryerrors.8 b/infiniband-diags/man/ibqueryerrors.8 index d5a499e..83a2b5a 100644 --- a/infiniband-diags/man/ibqueryerrors.8 +++ b/infiniband-diags/man/ibqueryerrors.8 @@ -1,16 +1,16 @@ .TH IBQUERYERRORS 8 Oct 30, 2009 OpenIB OpenIB Diagnostics .SH NAME -ibqueryerrors.pl \- query and report non-zero IB port counters +ibqueryerrors \- query and report non-zero IB port counters .SH SYNOPSIS -.B ibqueryerrors.pl +.B ibqueryerrors [-s err1,err2,... -c -r -C ca_name -P ca_port -G node_guid -D direct_route -d -k -K] .SH DESCRIPTION .PP -ibqueryerrors.pl reports port counters. This is similar to ibcheckerrors with +ibqueryerrors reports port counters. This is similar to ibcheckerrors with the additional ability to filter out selected errors, include the optional transmit and receive data counters, and report full link information for the link reported. -- 1.5.4.5
[infiniband-diags] [PATCH] [0/2] Support libibnetdiscover caching
Hi Sasha, I've added two new functions into libibnetdisc, ibnd_cache_fabric() and ibnd_load_fabric(). As the names suggest, these functions allow the user to store the ibnd_fabric_t fabric to disk and read it back later on. The patches add the functions and the base functionality to ibnetdiscover. These 2 patches don't show how these functions could be useful right now, but hopefully the usefulness can be seen for later features and/or additions. Some ideas I've had: - Give users the option to have IB diag tools load the cached version of the fabric instead of scanning the IB fabric. Not only does this make the tools much faster, it allows users to debug, analyze, play, etc. with a fabric state that existed in the past. Or a fabric that they don't even have access to (e.g. send the current fabric to support staff). - Support new debug/analysis features into IB diag tools. One example is a diff type of debug/analysis feature that allows users to compare how the current fabric state is different than a previous time. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[infiniband-diags] [PATCH] [1/2] add libibnetdisc caching to libibnetdiscover
Hi Sahsa, This patch adds caching functionality to libibnetdisc through the new functions ibnd_cache_fabric() and ibnd_load_fabric(). Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Wed, 9 Dec 2009 15:19:24 -0800 Subject: [PATCH] add libibnetdisc caching to libibnetdiscover Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/libibnetdisc/Makefile.am |3 +- .../libibnetdisc/include/infiniband/ibnetdisc.h|6 + infiniband-diags/libibnetdisc/src/ibnetdisc.c |6 +- .../libibnetdisc/src/ibnetdisc_cache.c | 909 infiniband-diags/libibnetdisc/src/internal.h |6 + infiniband-diags/libibnetdisc/src/libibnetdisc.map |2 + 6 files changed, 928 insertions(+), 4 deletions(-) create mode 100644 infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c diff --git a/infiniband-diags/libibnetdisc/Makefile.am b/infiniband-diags/libibnetdisc/Makefile.am index 636d142..a46dbc8 100644 --- a/infiniband-diags/libibnetdisc/Makefile.am +++ b/infiniband-diags/libibnetdisc/Makefile.am @@ -22,7 +22,8 @@ else libibnetdisc_version_script = endif -libibnetdisc_la_SOURCES = src/ibnetdisc.c src/chassis.c src/chassis.h src/internal.h +libibnetdisc_la_SOURCES = src/ibnetdisc.c src/ibnetdisc_cache.c src/chassis.c \ + src/chassis.h src/internal.h libibnetdisc_la_CFLAGS = -Wall $(DBGFLAGS) libibnetdisc_la_LDFLAGS = -version-info $(ibnetdisc_api_version) \ -export-dynamic $(libibnetdisc_version_script) \ diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 8d5ac39..38ca2fb 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -170,6 +170,12 @@ MAD_EXPORT ibnd_fabric_t *ibnd_discover_fabric(struct ibmad_port *ibmad_port, */ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric); +MAD_EXPORT ibnd_fabric_t *ibnd_load_fabric(const char *file, + unsigned int flags); + +MAD_EXPORT int ibnd_cache_fabric(ibnd_fabric_t *fabric, const char *file, +unsigned int flags); + /** = * Node operations */ diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index 9367337..9b24931 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -286,7 +286,7 @@ ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t * fabric, char *dr_str) return rc; } -static void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) +void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) { int hash_idx = HASHGUID(node-guid) % HTSZ; @@ -294,7 +294,7 @@ static void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) hash[hash_idx] = node; } -static void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) +void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) { int hash_idx = HASHGUID(port-guid) % HTSZ; @@ -302,7 +302,7 @@ static void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) hash[hash_idx] = port; } -static void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) +void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) { switch (node-type) { case IB_NODE_CA: diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c new file mode 100644 index 000..403c053 --- /dev/null +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c @@ -0,0 +1,909 @@ +/* + * Copyright (c) 2004-2007 Voltaire Inc. All rights reserved. + * Copyright (c) 2007 Xsigo Systems Inc. All rights reserved. + * Copyright (c) 2008 Lawrence Livermore National Laboratory + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * + * - Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *
[infiniband-diags] [PATCH] [2/2] support --cache and --load-cache options in ibnetdiscover
Hi Sasha, This adds the --cache and --load-cache options to ibnetdiscover. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Wed, 9 Dec 2009 15:19:47 -0800 Subject: [PATCH] support --cache and --load-cache options in ibnetdiscover Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/man/ibnetdiscover.8 | 12 +++- infiniband-diags/src/ibnetdiscover.c | 26 -- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8 index abf3588..082a8e4 100644 --- a/infiniband-diags/man/ibnetdiscover.8 +++ b/infiniband-diags/man/ibnetdiscover.8 @@ -8,7 +8,8 @@ ibnetdiscover \- discover InfiniBand topology [\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-s(how)] [\-l(ist)] [\-g(rouping)] [\-H(ca_list)] [\-S(witch_list)] [\-R(outer_list)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] -[\--node-name-map node-name-map] [\-p(orts)] [\-m(ax_hops)] +[\--node-name-map node-name-map] [\-\-cache filename] +[\-\-load\-cache filename] [\-p(orts)] [\-m(ax_hops)] [\-h(elp)] [topology-file] .SH DESCRIPTION @@ -47,6 +48,15 @@ Show progress information during discovery. Specify a node name map. The node name map file maps GUIDs to more user friendly names. See file format below. .TP +\fB\-\-cache\fR filename +Cache the ibnetdiscover network data in the specified filename. This +cache may be used by other tools for later analysis. +.TP +\fB\-\-load\-cache\fR filename +Load and use the cached ibnetdiscover data stored in the specified +filename. May be useful for outputting and learning about other +fabrics or a previous state of a fabric. +.TP \fB\-p\fR, \fB\-\-ports\fR Obtain a ports report which is a list of connected ports with relevant information (like LID, portnum, diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c index e081a36..e87f42e 100644 --- a/infiniband-diags/src/ibnetdiscover.c +++ b/infiniband-diags/src/ibnetdiscover.c @@ -63,6 +63,8 @@ static FILE *f; static char *node_name_map_file = NULL; static nn_map_t *node_name_map = NULL; +static char *cache_file = NULL; +static char *load_cache_file = NULL; static int report_max_hops = 0; @@ -616,6 +618,12 @@ static int process_opt(void *context, int ch, char *optarg) case 1: node_name_map_file = strdup(optarg); break; + case 2: + cache_file = strdup(optarg); + break; + case 3: + load_cache_file = strdup(optarg); + break; case 's': ibnd_show_progress(1); break; @@ -662,6 +670,8 @@ int main(int argc, char **argv) {Switch_list, 'S', 0, NULL, list of connected switches}, {Router_list, 'R', 0, NULL, list of connected routers}, {node-name-map, 1, 1, file, node name map file}, + {cache, 2, 1, file, filename to cache ibnetdiscover data to}, + {load-cache, 3, 1, file, filename of ibnetdiscover cache to load}, {ports, 'p', 0, NULL, obtain a ports report}, {max_hops, 'm', 0, NULL, report max hops discovered by the library}, @@ -692,8 +702,14 @@ int main(int argc, char **argv) node_name_map = open_node_name_map(node_name_map_file); - if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL) - IBERROR(discover failed\n); + if (load_cache_file) { + if ((fabric = ibnd_load_fabric(load_cache_file, 0)) == NULL) + IBERROR(loading cached fabric failed\n); + } + else { + if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL) + IBERROR(discover failed\n); + } if (ports_report) ibnd_iter_nodes(fabric, dump_ports_report, NULL); @@ -702,6 +718,12 @@ int main(int argc, char **argv) else dump_topology(group, fabric); + if (cache_file) + if (ibnd_cache_fabric(fabric, + cache_file, + 0) 0) + IBERROR(caching ibnetdiscover data failed\n); + ibnd_destroy_fabric(fabric); close_node_name_map(node_name_map); mad_rpc_close_port(ibmad_port); -- 1.5.4.5
[infiniband-diags] [PATCH] remove unused headers in libibnetdiscover
Hey Sasha, Just noticed it. Left over/cut and pasted from the original ibnetdiscover tool code or no longer necessary due to recent changes. This patch is independent of the other patches I recently posted. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Tue, 3 Nov 2009 10:33:08 -0800 Subject: [PATCH] remove unused headers Signed-off-by: Albert Chu ch...@llnl.gov --- infiniband-diags/libibnetdisc/src/ibnetdisc.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index ebc45ba..bd28ba7 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -41,10 +41,7 @@ #include stdio.h #include stdlib.h #include unistd.h -#include stdarg.h -#include time.h #include string.h -#include getopt.h #include errno.h #include inttypes.h -- 1.5.4.5
[infiniband-diags] [PATCH] [1/2] remove ibnd_update_node
Hey Sasha, After talking to Ira about it, we think it's best remove ibnd_update_node. A) It's not being used. B) It probably not implemented properly C) Some of Ira's original plans for its use require more API functions to be added, which of course isn't done right now. So for now, it seems best to just remove it since it's an additional API function that can lead to confusion. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 29 Oct 2009 18:56:32 -0700 Subject: [PATCH] remove ibnd_update_node Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|3 - infiniband-diags/libibnetdisc/src/ibnetdisc.c | 55 2 files changed, 0 insertions(+), 58 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index bb5df02..6120453 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -172,9 +172,6 @@ MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t * fabric); MAD_EXPORT ibnd_node_t *ibnd_find_node_guid(ibnd_fabric_t * fabric, uint64_t guid); MAD_EXPORT ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t * fabric, char *dr_str); -MAD_EXPORT ibnd_node_t *ibnd_update_node(struct ibmad_port *ibmad_port, -ibnd_fabric_t * fabric, -ibnd_node_t * node); typedef void (*ibnd_iter_node_func_t) (ibnd_node_t * node, void *user_data); MAD_EXPORT void ibnd_iter_nodes(ibnd_fabric_t * fabric, diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index ebc45ba..ffa35e4 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -264,61 +264,6 @@ static int _check_ibmad_port(struct ibmad_port *ibmad_port) return 0; } -ibnd_node_t *ibnd_update_node(struct ibmad_port * ibmad_port, - ibnd_fabric_t * fabric, ibnd_node_t * node) -{ - char portinfo_port0[IB_SMP_DATA_SIZE]; - void *nd = node-nodedesc; - int p = 0; - - if (_check_ibmad_port(ibmad_port) 0) - return NULL; - - if (!fabric) { - IBND_DEBUG(fabric parameter NULL\n); - return NULL; - } - - if (!node) { - IBND_DEBUG(node parameter NULL\n); - return NULL; - } - - if (query_node_info(ibmad_port, fabric, node, (node-path_portid))) - return NULL; - - if (!smp_query_via(nd, (node-path_portid), IB_ATTR_NODE_DESC, 0, 0, - ibmad_port)) - return NULL; - - /* update all the port info's */ - for (p = 1; p = node-numports; p++) { - get_port_info(ibmad_port, fabric, node-ports[p], - p, (node-path_portid)); - } - - if (node-type != IB_NODE_SWITCH) - goto done; - - if (!smp_query_via - (portinfo_port0, (node-path_portid), IB_ATTR_PORT_INFO, 0, 0, -ibmad_port)) - return NULL; - - node-smalid = mad_get_field(portinfo_port0, 0, IB_PORT_LID_F); - node-smalmc = mad_get_field(portinfo_port0, 0, IB_PORT_LMC_F); - - if (!smp_query_via(node-switchinfo, (node-path_portid), - IB_ATTR_SWITCH_INFO, 0, 0, ibmad_port)) - node-smaenhsp0 = 0;/* assume base SP0 */ - else - mad_decode_field(node-switchinfo, IB_SW_ENHANCED_PORT0_F, -node-smaenhsp0); - -done: - return node; -} - ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t * fabric, char *dr_str) { int i = 0; -- 1.5.4.5
[infiniband-diags] [PATCH] [2/2] split out scan specific data from ibnd_node_t
Hey Sasha, This splits out some scan specific data from ibnd_node_t that doesn't need to be in the public struct. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 29 Oct 2009 18:59:26 -0700 Subject: [PATCH] split out scan specific data from ibnd_node_t Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|2 - infiniband-diags/libibnetdisc/src/chassis.c| 18 -- infiniband-diags/libibnetdisc/src/ibnetdisc.c | 32 +++ infiniband-diags/libibnetdisc/src/internal.h |8 - 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 6120453..f1cb00c 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -48,7 +48,6 @@ struct ibnd_port; /* forward declare */ typedef struct ibnd_node { struct ibnd_node *next; /* all node list in fabric */ - ib_portid_t path_portid;/* path from from_node */ int smalid; int smalmc; @@ -81,7 +80,6 @@ typedef struct ibnd_node { /* internal use only */ unsigned char ch_found; struct ibnd_node *htnext; /* hash table list */ - struct ibnd_node *dnext;/* nodesdist next */ struct ibnd_node *type_next;/* next based on type */ } ibnd_node_t; diff --git a/infiniband-diags/libibnetdisc/src/chassis.c b/infiniband-diags/libibnetdisc/src/chassis.c index 15c17d2..3bd0108 100644 --- a/infiniband-diags/libibnetdisc/src/chassis.c +++ b/infiniband-diags/libibnetdisc/src/chassis.c @@ -822,6 +822,7 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) int chassisnum = 0; ibnd_chassis_t *chassis; ibnd_chassis_t *ch, *ch_next; + ibnd_node_scan_t *node_scan; scan-first_chassis = NULL; scan-current_chassis = NULL; @@ -832,16 +833,21 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* according to internal connectivity */ /* not very efficient but clear code so... */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID fill_voltaire_chassis_record(node)) goto cleanup; + } /* separate every Voltaire chassis from each other and build linked list of them */ /* algorithm: catch spine and find all surrounding nodes */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) != VTR_VENDOR_ID) continue; @@ -859,7 +865,9 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* now make pass on nodes for chassis which are not Voltaire */ /* grouped by common SystemImageGUID */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID) continue; @@ -885,7 +893,9 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* now, make another pass to see which nodes are part of chassis */ /* (defined as chassis-nodecount 1) */ for (dist = 0; dist = MAXHOPS;) { - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID) continue; diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index ffa35e4..283584b 100644 ---
Re: [infiniband-diags] [PATCH] [2/2] split out scan specific data from ibnd_node_t
Hi Sasha, Oops. I forgot to free the newly created memory. Here's a new patch. Al On Mon, 2009-11-02 at 11:33 -0800, Al Chu wrote: Hey Sasha, This splits out some scan specific data from ibnd_node_t that doesn't need to be in the public struct. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Thu, 29 Oct 2009 18:59:26 -0700 Subject: [PATCH] split out scan specific data from ibnd_node_t Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|2 - infiniband-diags/libibnetdisc/src/chassis.c| 18 +-- infiniband-diags/libibnetdisc/src/ibnetdisc.c | 51 +--- infiniband-diags/libibnetdisc/src/internal.h |8 +++- 4 files changed, 65 insertions(+), 14 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 6120453..f1cb00c 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -48,7 +48,6 @@ struct ibnd_port; /* forward declare */ typedef struct ibnd_node { struct ibnd_node *next; /* all node list in fabric */ - ib_portid_t path_portid;/* path from from_node */ int smalid; int smalmc; @@ -81,7 +80,6 @@ typedef struct ibnd_node { /* internal use only */ unsigned char ch_found; struct ibnd_node *htnext; /* hash table list */ - struct ibnd_node *dnext;/* nodesdist next */ struct ibnd_node *type_next;/* next based on type */ } ibnd_node_t; diff --git a/infiniband-diags/libibnetdisc/src/chassis.c b/infiniband-diags/libibnetdisc/src/chassis.c index 15c17d2..3bd0108 100644 --- a/infiniband-diags/libibnetdisc/src/chassis.c +++ b/infiniband-diags/libibnetdisc/src/chassis.c @@ -822,6 +822,7 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) int chassisnum = 0; ibnd_chassis_t *chassis; ibnd_chassis_t *ch, *ch_next; + ibnd_node_scan_t *node_scan; scan-first_chassis = NULL; scan-current_chassis = NULL; @@ -832,16 +833,21 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* according to internal connectivity */ /* not very efficient but clear code so... */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID fill_voltaire_chassis_record(node)) goto cleanup; + } /* separate every Voltaire chassis from each other and build linked list of them */ /* algorithm: catch spine and find all surrounding nodes */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) != VTR_VENDOR_ID) continue; @@ -859,7 +865,9 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* now make pass on nodes for chassis which are not Voltaire */ /* grouped by common SystemImageGUID */ for (dist = 0; dist = fabric-maxhops_discovered; dist++) - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID) continue; @@ -885,7 +893,9 @@ int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *scan) /* now, make another pass to see which nodes are part of chassis */ /* (defined as chassis-nodecount 1) */ for (dist = 0; dist = MAXHOPS;) { - for (node = scan-nodesdist[dist]; node; node = node-dnext) { + for (node_scan = scan-nodesdist[dist]; node_scan; node_scan = node_scan-dnext) { + node = node_scan-node; + if (mad_get_field(node-info, 0, IB_NODE_VENDORID_F) == VTR_VENDOR_ID) continue; diff --git
[infiniband-diags] [PATCH] [2/2] remove 'dist' field from ibnd_node_t, which was virtually not used
Remove the 'dist' field from the ibnd_node_t struct and rearch code appropriately. It ends up this field was only used to pass a value from create_node() to add_to_nodedist(), of which create_node() is the only function that calls add_to_nodedist(). In other words, it served pretty much no purpose. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Wed, 28 Oct 2009 16:18:39 -0700 Subject: [PATCH] remove 'dist' field from ibnd_node_t, which was virtually not used Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|1 - infiniband-diags/libibnetdisc/src/ibnetdisc.c |6 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index 8303175..a8d290c 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -48,7 +48,6 @@ typedef struct ibnd_node { struct ibnd_node *next; /* all node list in fabric */ ib_portid_t path_portid;/* path from from_node */ - int dist; /* num of hops from from_node */ int smalid; int smalmc; diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index b25c3d0..047b705 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -387,9 +387,8 @@ static void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) } } -static void add_to_nodedist(ibnd_node_t * node, ibnd_scan_t * ibnd_scan) +static void add_to_nodedist(ibnd_node_t * node, ibnd_scan_t * ibnd_scan, int dist) { - int dist = node-dist; if (node-type != IB_NODE_SWITCH) dist = MAXHOPS; /* special Ca list */ @@ -410,7 +409,6 @@ static ibnd_node_t *create_node(ibnd_fabric_t * fabric, ibnd_scan_t * ibnd_scan, } memcpy(node, temp, sizeof(*node)); - node-dist = dist; node-path_portid = *path; add_to_nodeguid_hash(node, fabric-nodestbl); @@ -420,7 +418,7 @@ static ibnd_node_t *create_node(ibnd_fabric_t * fabric, ibnd_scan_t * ibnd_scan, fabric-nodes = (ibnd_node_t *) node; add_to_type_list(node, fabric); - add_to_nodedist(node, ibnd_scan); + add_to_nodedist(node, ibnd_scan, dist); return node; } -- 1.5.4.5
[infiniband-diags] [PATCH] [1/2] split out ibnd_fabric_t fields that are only used during a scan
Split out public parameters from ibnd_fabric_t that are useless b/c they are only used during the ibnetdiscover scan. Note that this patch has similarities to a previous patch from Ira, however it is separate and independent of that patch series. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory From: Albert Chu ch...@llnl.gov Date: Tue, 27 Oct 2009 16:16:14 -0700 Subject: [PATCH] split out ibnd_fabric_t fields that are only used during a scan Signed-off-by: Albert Chu ch...@llnl.gov --- .../libibnetdisc/include/infiniband/ibnetdisc.h|6 -- infiniband-diags/libibnetdisc/src/chassis.c| 68 infiniband-diags/libibnetdisc/src/chassis.h|2 +- infiniband-diags/libibnetdisc/src/ibnetdisc.c | 60 + infiniband-diags/libibnetdisc/src/internal.h | 10 +++ 5 files changed, 83 insertions(+), 63 deletions(-) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index c55ce00..8303175 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -124,7 +124,6 @@ typedef struct ibnd_chassis { } ibnd_chassis_t; #define HTSZ 137 -#define MAXHOPS63 /** = * Fabric @@ -145,14 +144,9 @@ typedef struct ibnd_fabric { /* internal use only */ ibnd_node_t *nodestbl[HTSZ]; ibnd_port_t *portstbl[HTSZ]; - ibnd_node_t *nodesdist[MAXHOPS + 1]; - ibnd_chassis_t *first_chassis; - ibnd_chassis_t *current_chassis; - ibnd_chassis_t *last_chassis; ibnd_node_t *switches; ibnd_node_t *ch_adapters; ibnd_node_t *routers; - ib_portid_t selfportid; } ibnd_fabric_t; /** = diff --git a/infiniband-diags/libibnetdisc/src/chassis.c b/infiniband-diags/libibnetdisc/src/chassis.c index 4886cfc..5043f42 100644 --- a/infiniband-diags/libibnetdisc/src/chassis.c +++ b/infiniband-diags/libibnetdisc/src/chassis.c @@ -96,7 +96,7 @@ static ibnd_chassis_t *find_chassisnum(ibnd_fabric_t * fabric, { ibnd_chassis_t *current; - for (current = fabric-first_chassis; current; current = current-next) { + for (current = fabric-chassis; current; current = current-next) { if (current-chassisnum == chassisnum) return current; } @@ -214,7 +214,7 @@ static ibnd_chassis_t *find_chassisguid(ibnd_fabric_t * fabric, uint64_t chguid; chguid = get_chassisguid(node); - for (current = fabric-first_chassis; current; current = current-next) { + for (current = fabric-chassis; current; current = current-next) { if (current-chassisguid == chguid) return current; } @@ -782,19 +782,19 @@ static void voltaire_portmap(ibnd_port_t * port) port-ext_portnum = int2ext_map_slb8[chipnum][portnum]; } -static int add_chassis(ibnd_fabric_t * fabric) +static int add_chassis(ibnd_scan_t *ibnd_scan) { - if (!(fabric-current_chassis = calloc(1, sizeof(ibnd_chassis_t { + if (!(ibnd_scan-current_chassis = calloc(1, sizeof(ibnd_chassis_t { IBND_ERROR(OOM: failed to allocate chassis object\n); return (-1); } - if (fabric-first_chassis == NULL) { - fabric-first_chassis = fabric-current_chassis; - fabric-last_chassis = fabric-current_chassis; + if (ibnd_scan-first_chassis == NULL) { + ibnd_scan-first_chassis = ibnd_scan-current_chassis; + ibnd_scan-last_chassis = ibnd_scan-current_chassis; } else { - fabric-last_chassis-next = fabric-current_chassis; - fabric-last_chassis = fabric-current_chassis; + ibnd_scan-last_chassis-next = ibnd_scan-current_chassis; + ibnd_scan-last_chassis = ibnd_scan-current_chassis; } return (0); } @@ -818,33 +818,35 @@ static void add_node_to_chassis(ibnd_chassis_t * chassis, ibnd_node_t * node) Returns: 0 on success, -1 on failure */ -int group_nodes(ibnd_fabric_t * fabric) +int group_nodes(ibnd_fabric_t * fabric, ibnd_scan_t *ibnd_scan) { ibnd_node_t *node; int dist; int chassisnum = 0; ibnd_chassis_t *chassis; + ibnd_chassis_t *ch, *ch_next; - fabric-first_chassis = NULL; - fabric-current_chassis = NULL; + ibnd_scan-first_chassis = NULL; + ibnd_scan-current_chassis = NULL; + ibnd_scan-last_chassis = NULL; /* first pass on switches and build for every Voltaire node */ /* an appropriate chassis record (slotnum and position) */