From patchwork Tue Jul 26 15:23:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 1008472 X-Patchwork-Delegate: alexne@voltaire.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6QFNkQQ009759 for ; Tue, 26 Jul 2011 15:23:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421Ab1GZPX4 (ORCPT ); Tue, 26 Jul 2011 11:23:56 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:57325 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753079Ab1GZPXz (ORCPT ); Tue, 26 Jul 2011 11:23:55 -0400 Received: by mail-wy0-f174.google.com with SMTP id 8so245106wyg.19 for ; Tue, 26 Jul 2011 08:23:55 -0700 (PDT) Received: by 10.216.132.134 with SMTP id o6mr1876053wei.45.1311693834974; Tue, 26 Jul 2011 08:23:54 -0700 (PDT) Received: from [192.168.1.102] (c-71-192-10-85.hsd1.ma.comcast.net [71.192.10.85]) by mx.google.com with ESMTPS id n18sm523010wbh.6.2011.07.26.08.23.52 (version=SSLv3 cipher=OTHER); Tue, 26 Jul 2011 08:23:54 -0700 (PDT) Message-ID: <4E2EDC07.3050408@dev.mellanox.co.il> Date: Tue, 26 Jul 2011 11:23:51 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Alex Netes CC: "linux-rdma@vger.kernel.org" Subject: [PATCH 3/3] opensm/osm_sa_mcmember_record.c: Proper rate comparison and selection 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 26 Jul 2011 15:23:56 +0000 (UTC) Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c index 61d3e34..16e6dbd 100644 --- a/opensm/osm_sa_mcmember_record.c +++ b/opensm/osm_sa_mcmember_record.c @@ -285,7 +285,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F); switch (rate_sel) { case 0: /* Greater than RATE specified */ - if (rate_mgrp <= rate_required) { + if (ib_path_compare_rates(rate_mgrp, rate_required) <= 0) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not greater than %x\n", @@ -294,7 +294,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, } break; case 1: /* Less than RATE specified */ - if (rate_mgrp >= rate_required) { + if (ib_path_compare_rates(rate_mgrp, rate_required) >= 0) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not less than %x\n", @@ -303,7 +303,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, } break; case 2: /* Exactly RATE specified */ - if (rate_mgrp != rate_required) { + if (ib_path_compare_rates(rate_mgrp, rate_required)) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not equal to %x\n", @@ -343,7 +343,7 @@ static boolean_t validate_port_caps(osm_log_t * p_log, rate_required = ib_port_info_compute_rate(&p_physp->port_info, 0); rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F); - if (rate_required < rate_mgrp) { + if (ib_path_compare_rates(rate_required, rate_mgrp) < 0) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Port's RATE %x is less than %x\n", rate_required, rate_mgrp); @@ -689,7 +689,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, default: break; } - /* make sure it still be in the range */ + /* make sure it still is in the range */ if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Calculated MTU %x is out of range\n", mtu); @@ -709,7 +709,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, rate = rate_required; switch (rate_sel) { case 0: /* Greater than RATE specified */ - if (port_rate && rate_required >= port_rate) { + if (ib_path_compare_rates(rate_required, port_rate) >= 0) { OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested RATE %x >= the port\'s rate:%x\n", rate_required, port_rate); @@ -718,19 +718,20 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, /* we provide the largest RATE possible if we can */ if (port_rate) rate = port_rate; - else if (rate_required < sa->p_subn->min_ca_rate) + else if (ib_path_compare_rates(rate_required, + sa->p_subn->min_ca_rate) < 0) rate = sa->p_subn->min_ca_rate; else - rate++; + rate = ib_path_rate_get_next(rate); break; case 1: /* Less than RATE specified */ /* use the smaller of the two: a. one lower then the required b. the rate of the requesting port (if exists) */ - if (port_rate && rate_required > port_rate) + if (ib_path_compare_rates(rate_required, port_rate) > 0) rate = port_rate; else - rate--; + rate = ib_path_rate_get_prev(rate); break; case 2: /* Exactly RATE specified */ default: