From patchwork Sun Nov 1 09:37:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 56836 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 nA19WKd6014025 for ; Sun, 1 Nov 2009 09:32:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751915AbZKAJcO (ORCPT ); Sun, 1 Nov 2009 04:32:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751920AbZKAJcO (ORCPT ); Sun, 1 Nov 2009 04:32:14 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:49013 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751915AbZKAJcO (ORCPT ); Sun, 1 Nov 2009 04:32:14 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 1 Nov 2009 11:37:38 +0200 Received: from [10.4.1.29] ([10.4.1.29]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 1 Nov 2009 11:32:16 +0200 Message-ID: <4AED56C0.4080006@dev.mellanox.co.il> Date: Sun, 01 Nov 2009 11:37:04 +0200 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky CC: Linux RDMA Subject: [PATCH] opensm/osm_sa_mcmember_record.c: optimization in zero mgid comparison X-OriginalArrivalTime: 01 Nov 2009 09:32:16.0960 (UTC) FILETIME=[33A78C00:01CA5AD6] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c index dd01eed..18dc22c 100644 --- a/opensm/opensm/osm_sa_mcmember_record.c +++ b/opensm/opensm/osm_sa_mcmember_record.c @@ -731,7 +731,7 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa, OUT osm_mgrp_t ** pp_mgrp) { ib_net16_t mlid; - unsigned zero_mgid, i; + unsigned zero_mgid = 1; uint8_t scope; ib_gid_t *p_mgid; ib_api_status_t status = IB_SUCCESS; @@ -740,12 +740,9 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa, OSM_LOG_ENTER(sa->p_log); /* but what if the given MGID was not 0 ? */ - zero_mgid = 1; - for (i = 0; i < sizeof(p_recvd_mcmember_rec->mgid); i++) - if (p_recvd_mcmember_rec->mgid.raw[i] != 0) { - zero_mgid = 0; - break; - } + if (p_recvd_mcmember_rec->mgid.unicast.prefix != 0 || + p_recvd_mcmember_rec->mgid.unicast.interface_id != 0) + zero_mgid = 0; /* we allocate a new mlid number before we might use it