From patchwork Wed Apr 14 09:59:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 92362 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3E9wbvM013425 for ; Wed, 14 Apr 2010 09:59:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754886Ab0DNJ7e (ORCPT ); Wed, 14 Apr 2010 05:59:34 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:36212 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754850Ab0DNJ7d (ORCPT ); Wed, 14 Apr 2010 05:59:33 -0400 Received: by wyf19 with SMTP id 19so648093wyf.19 for ; Wed, 14 Apr 2010 02:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=09LC4LRDUvmbjOUBebZedsw4fEm+bUHStjFbHbbSyz4=; b=su7QQ1/KgK7AUJTxzNphmKiMiI/NATk4lBaMveE94paVjdjMwJqBhRM63E+5jKqFnH YfQt6QSucoD94EonU/SJ+6CCoOxoKhcN0V8Pe0v/771nxJDcmarnRCsudQ0brDu+gGeR iLgecqCcEHMflZieO1EGPAy0fp7tutzKT8liE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ToD1Y3kwp4LObX0+KbBxn5hI95lf9FHpCmPiyw476fO2hL66xLLxR+YVnJ6sULT3sW g9e43BHnBv1R9jU/qWjU0t+VeYD/OZ+yi8nOC/N51KLgNoOfn/vDRZ9bD2bG00v6JhiA oSeqe8Jvg55EYicsJD8ScMz23pSa/McH12j7A= Received: by 10.216.157.129 with SMTP id o1mr4935183wek.197.1271239172196; Wed, 14 Apr 2010 02:59:32 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id z3sm1335094wbs.22.2010.04.14.02.59.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 14 Apr 2010 02:59:31 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id EBDB511F31; Wed, 14 Apr 2010 12:59:46 +0300 (IDT) Date: Wed, 14 Apr 2010 12:59:46 +0300 From: Sasha Khapyorsky To: Ira Weiny Cc: "linux-rdma@vger.kernel.org" , Hal Rosenstock Subject: [PATCH] libibnetdisc: don't query CA ports not connected to a fabric Message-ID: <20100414095946.GS10830@me> References: <20100218124933.c018a23d.weiny2@llnl.gov> <20100413104658.GA10830@me> <20100413171824.GP10830@me> <20100413112412.de66586d.weiny2@llnl.gov> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100413112412.de66586d.weiny2@llnl.gov> User-Agent: Mutt/1.5.20 (2009-06-14) 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 (demeter.kernel.org [140.211.167.41]); Wed, 14 Apr 2010 09:59:56 +0000 (UTC) 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; }