From patchwork Wed Feb 3 11:00:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 76687 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 o13AvkEQ008208 for ; Wed, 3 Feb 2010 10:57:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754723Ab0BCK51 (ORCPT ); Wed, 3 Feb 2010 05:57:27 -0500 Received: from ey-out-2122.google.com ([74.125.78.24]:48395 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754498Ab0BCK5S (ORCPT ); Wed, 3 Feb 2010 05:57:18 -0500 Received: by ey-out-2122.google.com with SMTP id d26so261524eyd.19 for ; Wed, 03 Feb 2010 02:57:16 -0800 (PST) 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 :subject:message-id:mime-version:content-type:content-disposition :user-agent; bh=7psrjtw4mfHJS6yd1fgrRkjcQm0ngD5fnHzl/h8x2pE=; b=SsaIV8mnEFFFzUjSeXUfAg8ckkbExHL0R/XcKtP0uVeIBJvPF/iLc+3av9Gx/M4RXi /e/POvT95hQ4YySmIhbBhTOikspDqNzXqKr+oUFoVOySvQX5+H8ssYFIGUJJhUOaFVMQ l2va2+IP4kJ6M3vedHbnvIpTfN4CsVk+qf/N8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=a7vedjCCyUN9IjmhRdfWbCFve7z8y1bXQSs3jPJeaQIcBA5IW3dEHqMM+9BLHw2lCp d1ppkknWp/PQpwqnGCxlcBleEygd8c70kS7p0Lf/duV2qb5Oh4LNnowMSJeeVV7lQFPD wIDjNcDwdOkgyHr98nfZLPcxDJGW69n9gUBW0= Received: by 10.213.103.84 with SMTP id j20mr2000390ebo.3.1265194636777; Wed, 03 Feb 2010 02:57:16 -0800 (PST) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id 10sm1819442eyz.20.2010.02.03.02.57.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Feb 2010 02:57:16 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id 911A412AF9; Wed, 3 Feb 2010 13:00:54 +0200 (IST) Date: Wed, 3 Feb 2010 13:00:54 +0200 From: Sasha Khapyorsky To: linux-rdma Subject: [PATCH] opensm/osm_sa_pkey_record.c: optimize port selection logic Message-ID: <20100203110054.GB26338@me> MIME-Version: 1.0 Content-Disposition: inline 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, 03 Feb 2010 10:57:46 +0000 (UTC) diff --git a/opensm/opensm/osm_sa_pkey_record.c b/opensm/opensm/osm_sa_pkey_record.c index c4c974e..5b1c794 100644 --- a/opensm/opensm/osm_sa_pkey_record.c +++ b/opensm/opensm/osm_sa_pkey_record.c @@ -213,7 +213,6 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data) const ib_pkey_table_t *p_pkey; cl_qlist_t rec_list; osm_pkey_search_ctxt_t context; - ib_api_status_t status = IB_SUCCESS; ib_net64_t comp_mask; osm_physp_t *p_req_physp; @@ -291,23 +290,15 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data) */ if (comp_mask & IB_PKEY_COMPMASK_LID) { p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid); - if (!p_port) { - status = IB_NOT_FOUND; + if (!p_port) OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 460B: " "No port found with LID %u\n", cl_ntoh16(p_rcvd_rec->lid)); - } - } - - if (status == IB_SUCCESS) { - /* if we got a unique port - no need for a port search */ - if (p_port) - /* this does the loop on all the port phys ports */ - sa_pkey_by_comp_mask(sa, p_port, &context); else - cl_qmap_apply_func(&sa->p_subn->port_guid_tbl, - sa_pkey_by_comp_mask_cb, &context); - } + sa_pkey_by_comp_mask(sa, p_port, &context); + } else + cl_qmap_apply_func(&sa->p_subn->port_guid_tbl, + sa_pkey_by_comp_mask_cb, &context); cl_plock_release(sa->p_lock);