From patchwork Sat Apr 10 00:57:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 91836 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 o3A0tkwx013022 for ; Sat, 10 Apr 2010 00:57:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251Ab0DJA5G (ORCPT ); Fri, 9 Apr 2010 20:57:06 -0400 Received: from mail-bw0-f209.google.com ([209.85.218.209]:38537 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135Ab0DJA5D (ORCPT ); Fri, 9 Apr 2010 20:57:03 -0400 Received: by bwz1 with SMTP id 1so2893191bwz.21 for ; Fri, 09 Apr 2010 17:57:02 -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=4PZ0FZGg6lLxgkXtXGV8LeEjYzzxO+GE03tmBzsPU0s=; b=iLjXm0Cat01Du5eN5Nl0ml3+SDKUs16PJyrE7rsJndl9PccaM/Dh1iJ9XDQoxWZv2c fo1UszsXd26VeAC18c3HoxA2MzUNZJWuBQ0KsSv/MGREE1Z6MJyvNH8JuADIzdMxYAu5 wZHJRM2bh3whs2gMqFyv8lkJMpV5350oXm/RY= 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=vccxw2ZrP0YVJ5zfjcOKtbCEXPTZ6pCDToIe4/fAcaSTANDSPLH7kpcafZVFFKYk4O IPYKHN28yIzIBoUwuAs42+gJXb51ZDM3yOmaDmRxq8FFoAGnhlec7ntDEU7wb6Bk8ULx v0KHYl8dmxO024h/o+JqeWTqTRDgLuPV0GAB8= Received: by 10.204.155.68 with SMTP id r4mr830028bkw.208.1270861020826; Fri, 09 Apr 2010 17:57:00 -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 d5sm14108063bkd.19.2010.04.09.17.57.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 09 Apr 2010 17:57:00 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 75E0011F34; Sat, 10 Apr 2010 03:57:11 +0300 (IDT) Date: Sat, 10 Apr 2010 03:57:11 +0300 From: Sasha Khapyorsky To: Ira Weiny Cc: "linux-rdma@vger.kernel.org" , Hal Rosenstock Subject: [PATCH] libibnetdisc: restore hops limited discovery Message-ID: <20100410005711.GK4808@me> References: <20100218124931.4d6ef34b.weiny2@llnl.gov> <20100410005245.GH4808@me> <20100410005536.GI4808@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100410005536.GI4808@me> 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]); Sat, 10 Apr 2010 00:57:07 +0000 (UTC) diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c index b438d4f..4012eff 100644 --- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c @@ -96,6 +96,9 @@ static int extend_dpath(smp_engine_t * engine, ib_portid_t * portid, ibnd_scan_t *scan = engine->user_data; ibnd_fabric_t *fabric = scan->fabric; + if (scan->max_hops && fabric->maxhops_discovered >= scan->max_hops) + return 0; + if (portid->lid) { /* If we were LID routed we need to set up the drslid */ if (!scan->selfportid.lid) @@ -198,7 +201,7 @@ static int recv_port_info(smp_engine_t * engine, ibnd_smp_t * smp, == IB_PORT_PHYS_STATE_LINKUP && (node->type == IB_NODE_SWITCH || node == fabric->from_node)) { ib_portid_t path = smp->path; - if (extend_dpath(engine, &path, port_num) != -1) + if (extend_dpath(engine, &path, port_num) > 0) query_node_info(engine, &path, node); } @@ -471,17 +474,12 @@ ibnd_fabric_t *ibnd_discover_fabric(struct ibmad_port * ibmad_port, { ibnd_fabric_t *fabric = NULL; ib_portid_t my_portid = { 0 }; - int max_hops = MAXHOPS - 1; /* default find everything */ smp_engine_t engine; ibnd_scan_t scan; if (_check_ibmad_port(ibmad_port) < 0) return NULL; - /* if not everything how much? */ - if (hops >= 0) - max_hops = hops; - /* If not specified start from "my" port */ if (!from) from = &my_portid; @@ -496,6 +494,8 @@ ibnd_fabric_t *ibnd_discover_fabric(struct ibmad_port * ibmad_port, memset(&scan.selfportid, 0, sizeof(scan.selfportid)); scan.fabric = fabric; + if (hops >= 0) + scan.max_hops = hops; smp_engine_init(&engine, ibmad_port, &scan, max_smps_on_wire); diff --git a/infiniband-diags/libibnetdisc/src/internal.h b/infiniband-diags/libibnetdisc/src/internal.h index 179eac6..05e254d 100644 --- a/infiniband-diags/libibnetdisc/src/internal.h +++ b/infiniband-diags/libibnetdisc/src/internal.h @@ -58,6 +58,7 @@ typedef struct ibnd_scan { ib_portid_t selfportid; ibnd_fabric_t *fabric; + unsigned max_hops; } ibnd_scan_t; typedef struct ibnd_smp ibnd_smp_t;