From patchwork Tue Sep 29 11:02:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 50533 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8TB0vhi028979 for ; Tue, 29 Sep 2009 11:00:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbZI2LAw (ORCPT ); Tue, 29 Sep 2009 07:00:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753237AbZI2LAw (ORCPT ); Tue, 29 Sep 2009 07:00:52 -0400 Received: from mail-bw0-f210.google.com ([209.85.218.210]:56517 "EHLO mail-bw0-f210.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbZI2LAw (ORCPT ); Tue, 29 Sep 2009 07:00:52 -0400 Received: by bwz6 with SMTP id 6so1896712bwz.37 for ; Tue, 29 Sep 2009 04:00:55 -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=scK9GQsVHQYny/BkLp/BVscfkBsraZwK8RKS8SqFGVk=; b=WUFSOdE9PTvX3vlI9JJ6DzRRISDPPNrushs8tXbyH9Um0mSImBqttNhVy5JlDDubR1 bno3Q36DxFOK5/14H4roAMl+t5sLHbf5pARE/CKzoAFdr9J3E+rrW/uWxE3yPGGaDBkT 7an9Izr4Hs45UV4burBVn6WSpPUsZUmlErbt8= 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=TFsZO+v9ED28YOkZvzAGA/nMJrFobSqq/sQKnCoD8P4KKkFtIlkzkg4dKp0URZLMxE 5S+TALsbTEC9r7PQ4QNq55HEcRMqjKusvtHTehz8RLr4UKBRCne6fPZmnsvsF9Dhom/3 OZq/93Mj8nYiopI/oNk5yT/qk64AHPq72btos= Received: by 10.204.154.203 with SMTP id p11mr4014221bkw.180.1254222055128; Tue, 29 Sep 2009 04:00:55 -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 k29sm1531766fkk.27.2009.09.29.04.00.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 29 Sep 2009 04:00:54 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 26466418E8; Tue, 29 Sep 2009 13:02:44 +0200 (IST) Date: Tue, 29 Sep 2009 13:02:44 +0200 From: Sasha Khapyorsky To: OpenIB , linux-rdma Cc: Hal Rosenstock Subject: [PATCH] opensm/osm_get_port_by_lid(): speedup a port lookup Message-ID: <20090929110244.GL26931@me> References: <20090929110215.GK26931@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090929110215.GK26931@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 Speedup a port lookup over LMC array - it is not necessary to match LMC exactly for found port because base lid should be equal to requested lid masked value, so '<=' comparison should be enough and we don't need to loop up to an actual port's lmc value match. Signed-off-by: Sasha Khapyorsky --- opensm/opensm/osm_subnet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c index 67bc7e1..30f8af5 100644 --- a/opensm/opensm/osm_subnet.c +++ b/opensm/opensm/osm_subnet.c @@ -661,7 +661,7 @@ osm_port_t *osm_get_port_by_lid(IN osm_subn_t const * subn, IN ib_net16_t lid) port = cl_ptr_vector_get(&subn->port_lid_tbl, base_lid); /* Determine if base LID "tested" is the real base LID */ /* This is true if the LMC "tested" is the port's actual LMC */ - if (port && lmc == osm_port_get_lmc(port)) + if (port && lmc <= osm_port_get_lmc(port)) return port; }