From patchwork Sun Nov 1 20:26:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 56894 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 nA1KQOjm024078 for ; Sun, 1 Nov 2009 20:26:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329AbZKAU0S (ORCPT ); Sun, 1 Nov 2009 15:26:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753383AbZKAU0S (ORCPT ); Sun, 1 Nov 2009 15:26:18 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:33713 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753329AbZKAU0R (ORCPT ); Sun, 1 Nov 2009 15:26:17 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 1 Nov 2009 22:31:44 +0200 Received: from [172.26.237.79] ([172.26.237.79]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 1 Nov 2009 22:26:19 +0200 Message-ID: <4AEDEEEB.8010401@dev.mellanox.co.il> Date: Sun, 01 Nov 2009 22:26:19 +0200 From: Yevgeny Kliteynik Reply-To: kliteyn@dev.mellanox.co.il User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Sasha Khapyorsky CC: Linux RDMA Subject: Re: [PATCH] opensm/osm_sa_mcmember_record.c: optimization in zero mgid comparison References: <4AED56C0.4080006@dev.mellanox.co.il> <20091101160216.GF29434@me> In-Reply-To: <20091101160216.GF29434@me> X-OriginalArrivalTime: 01 Nov 2009 20:26:20.0001 (UTC) FILETIME=[92546510:01CA5B31] 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 45e743f..617f352 100644 --- a/opensm/opensm/osm_sa_mcmember_record.c +++ b/opensm/opensm/osm_sa_mcmember_record.c @@ -731,22 +731,14 @@ 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; uint8_t scope; ib_gid_t *p_mgid; ib_api_status_t status = IB_SUCCESS; ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec; /* copy for modifications */ + boolean_t zero_mgid = !ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid); 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; - } - /* we allocate a new mlid number before we might use it for MGID ...