ibnetdisc.c: Fix partial scan of the fabric.
PATCH 1/1 ibnetdisc.c: Fix partial scan of the fabric.
From: Ira Weiny <[email protected]>
Date: Fri, 30 Jul 2010 14:26:39 -0700
Subject: [PATCH] ibnetdisc.c: Fix partial scan of the fabric.
When max_hops was specified it did not result in a correct limited scan of the fabric.
In addition the -S and -D options of iblinkinfo/ibqueryerrors should by default only scan 1 hop from the node specified to allow for faster processing.
Signed-off-by Ira Weiny <[email protected]>
--- infiniband-diags/libibnetdisc/src/ibnetdisc.c | 17 ++++++++++------- infiniband-diags/src/iblinkinfo.c | 13 ++++++++----- infiniband-diags/src/ibqueryerrors.c | 11 +++++++---- 3 files changed, 25 insertions(+), 16 deletions(-)
infiniband-diags/libibnetdisc/src/ibnetdisc.c +10 -7
@@ -93,7 +93,7 @@ static int extend_dpath(smp_engine_t * engine, ib_portid_t * portid,ibnd_fabric_t *fabric = scan->fabric;if (scan->cfg->max_hops && - fabric->maxhops_discovered >= scan->cfg->max_hops) + fabric->maxhops_discovered > scan->cfg->max_hops)return 0 ;if (portid->lid) {
@@ -449,7 +449,8 @@ void add_to_type_list(ibnd_node_t * node, ibnd_fabric_t * fabric) } } -static int set_config (struct ibnd_config *config,struct ibnd_config *cfg) +static int set_config (struct ibnd_config *config,struct ibnd_config *cfg, +int initial_hops) {if (!config)return (-EINVAL );
@@ -463,6 +464,8 @@ static int set_config(struct ibnd_config *config, struct ibnd_config *cfg) config->timeout_ms =DEFAULT_TIMEOUT ;if (!config->retries) config->retries =DEFAULT_RETRIES ; +if (config->max_hops) + config->max_hops += initial_hops;return (0 ); }
@@ -479,15 +482,15 @@ ibnd_fabric_t *ibnd_discover_fabric(char * ca_name, int ca_port,int nc =2 ;int mc[2 ] = {IB_SMI_CLASS ,IB_SMI_DIRECT_CLASS }; -if (set_config (&config, cfg)) { -IBND_ERROR ("Invalid ibnd_config\n" ); -return NULL ; - } -/* If not specified start from "my" port */ if (!from) from = &my_portid; +if (set_config (&config, cfg, from->drpath.cnt)) { +IBND_ERROR ("Invalid ibnd_config\n" ); +return NULL ; + } + fabric =calloc (1 ,sizeof (*fabric));if (!fabric) {IBND_ERROR ("OOM: failed to calloc ibnd_fabric_t\n" );
infiniband-diags/src/iblinkinfo.c +8 -5
@@ -371,11 +371,14 @@ int main(int argc, char **argv)exit (1 ); } }else { -if (resolved >=0 && - !(fabric = -ibnd_discover_fabric (ibd_ca, ibd_ca_port, &port_id, &config))) -IBWARN ("Single node discover failed;" -" attempting full scan\n" ); +if (resolved >=0 ) { +if (!config.max_hops) + config.max_hops =1 ; +if (!(fabric = +ibnd_discover_fabric (ibd_ca, ibd_ca_port, &port_id, &config))) +IBWARN ("Single node discover failed;" +" attempting full scan\n" ); + }if (!fabric && !(fabric =ibnd_discover_fabric (ibd_ca, ibd_ca_port,NULL , &config))) {
infiniband-diags/src/ibqueryerrors.c +7 -4
@@ -655,11 +655,14 @@ int main(int argc, char **argv)exit (1 ); } } else { - if (resolved >= 0 && - !(fabric = ibnd_discover_fabric(ibd_ca, ibd_ca_port, + if (resolved >= 0) { + if (!config.max_hops) + config.max_hops = 1; + if (!(fabric = ibnd_discover_fabric(ibd_ca, ibd_ca_port, &portid, &config))) - IBWARN("Single node discover failed;" - " attempting full scan"); + IBWARN("Single node discover failed;" + " attempting full scan"); + } if (!fabric && !(fabric = ibnd_discover_fabric(ibd_ca, ibd_ca_port,
Signature · 6 lines
1.5.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html