From patchwork Mon Oct 4 10:12:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eli Dorfman (Voltaire)" X-Patchwork-Id: 228151 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o94ABQep030621 for ; Mon, 4 Oct 2010 10:11:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750Ab0JDKL0 (ORCPT ); Mon, 4 Oct 2010 06:11:26 -0400 Received: from fwil.voltaire.com ([193.47.165.2]:53797 "EHLO exil.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754333Ab0JDKLZ (ORCPT ); Mon, 4 Oct 2010 06:11:25 -0400 Received: from [172.25.1.69] ([172.25.1.69]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Oct 2010 12:11:22 +0200 Message-ID: <4CA9A875.4050604@gmail.com> Date: Mon, 04 Oct 2010 12:12:05 +0200 From: "Eli Dorfman (Voltaire)" User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Sasha Khapyorsky CC: linux-rdma Subject: [PATCH] ibnetdiscover: fix error when discovery started on node with more that one port X-OriginalArrivalTime: 04 Oct 2010 10:11:22.0962 (UTC) FILETIME=[7F30CB20:01CB63AC] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Oct 2010 10:11:33 +0000 (UTC) diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index cfd3bbe..fe953e6 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -149,6 +149,7 @@ typedef struct ibnd_fabric { * or by default the node you ar running on */ ibnd_node_t *from_node; + int from_port; /* NULL term list of all nodes in the fabric */ ibnd_node_t *nodes; /* NULL terminated list of all chassis found in the fabric */ diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index f525d71..64e1c60 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -199,7 +199,7 @@ static int recv_port_info(smp_engine_t * engine, ibnd_smp_t * smp, if (port_num && mad_get_field(port->info, 0, IB_PORT_PHYS_STATE_F) == IB_PORT_PHYS_STATE_LINKUP && ((node->type == IB_NODE_SWITCH && port_num != local_port) || - (node == fabric->from_node && port_num == local_port))) { + (node == fabric->from_node && port_num == fabric->from_port))) { ib_portid_t path = smp->path; if (extend_dpath(engine, &path, port_num) > 0) query_node_info(engine, &path, node); @@ -324,9 +324,10 @@ static int recv_node_info(smp_engine_t * engine, ibnd_smp_t * smp, dump_endnode(&smp->path, node_is_new ? "new" : "known", node, port); - if (rem_node == NULL) /* this is the start node */ + if (rem_node == NULL) { /* this is the start node */ fabric->from_node = node; - else { + fabric->from_port = port_num; + } else { /* link ports... */ int rem_port_num = get_last_port(&smp->path);