From patchwork Wed Aug 25 18:08:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 132651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7PIHvkG021029 for ; Wed, 25 Aug 2010 18:17:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751859Ab0HYSR4 (ORCPT ); Wed, 25 Aug 2010 14:17:56 -0400 Received: from qmta02.westchester.pa.mail.comcast.net ([76.96.62.24]:59525 "EHLO qmta02.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819Ab0HYSR4 (ORCPT ); Wed, 25 Aug 2010 14:17:56 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 25 Aug 2010 18:17:57 +0000 (UTC) X-Greylist: delayed 355 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Aug 2010 14:17:55 EDT Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta02.westchester.pa.mail.comcast.net with comcast id ybLM1e0030cZkys52iC023; Wed, 25 Aug 2010 18:12:00 +0000 Received: from hal.comcast.net ([75.69.247.31]) by omta10.westchester.pa.mail.comcast.net with comcast id yiC01e0020hNrtn3WiC0UY; Wed, 25 Aug 2010 18:12:00 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id o7PI8LWY012226; Wed, 25 Aug 2010 14:08:25 -0400 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id o7PI83D2012195; Wed, 25 Aug 2010 14:08:03 -0400 Date: Wed, 25 Aug 2010 14:08:02 -0400 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] infiniband-diags/ibnetdiscover: Fix handling of CA ports in recv_port_info Message-ID: <20100825180802.GA12192@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h index cfd3bbe..935e427 100644 --- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h +++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2008 Lawrence Livermore National Lab. All rights reserved. + * Copyright (c) 2010 Mellanox Technologies LTD. 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 @@ -149,6 +150,8 @@ typedef struct ibnd_fabric { * or by default the node you ar running on */ ibnd_node_t *from_node; + int from_portnum; + /* 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..79dd98e 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved. * Copyright (c) 2007 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2008 Lawrence Livermore National Laboratory + * Copyright (c) 2010 Mellanox Technologies LTD. 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 @@ -199,7 +200,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_portnum))) { ib_portid_t path = smp->path; if (extend_dpath(engine, &path, port_num) > 0) query_node_info(engine, &path, node); @@ -324,9 +325,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_portnum = port_num; + } else { /* link ports... */ int rem_port_num = get_last_port(&smp->path);