We can save some amount of MADs by not querying CA/Router ports which is not connected to our fabric. When discovery reaches CA or Router node it will always get PortInfo for a port which was discovered and not others.
Signed-off-by: Sasha Khapyorsky <sas...@voltaire.com> --- infiniband-diags/libibnetdisc/src/ibnetdisc.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index 2ce15b7..51b36e5 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -339,19 +339,18 @@ static int recv_node_info(smp_engine_t * engine, ibnd_smp_t * smp, link_ports(node, port, rem_node, rem_node->ports[rem_port_num]); } - if (!node_is_new) - return 0; - - query_node_desc(engine, &smp->path, node); + if (node_is_new) { + query_node_desc(engine, &smp->path, node); - if (node->type == IB_NODE_SWITCH) - query_switch_info(engine, &smp->path, node); - - /* process all the ports on this node */ - for (i = (node->type == IB_NODE_SWITCH) ? 0 : 1; - i <= node->numports; i++) { - query_port_info(engine, &smp->path, node, i); + if (node->type == IB_NODE_SWITCH) { + query_switch_info(engine, &smp->path, node); + for (i = 0; i <= node->numports; i++) + query_port_info(engine, &smp->path, node, i); + } } + + if (node->type != IB_NODE_SWITCH) + query_port_info(engine, &smp->path, node, port_num); return 0; } -- 1.7.0.4 -- 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