From patchwork Tue Jul 26 16:24:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 1008882 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 p6QGOsWJ009285 for ; Tue, 26 Jul 2011 16:24:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753789Ab1GZQYx (ORCPT ); Tue, 26 Jul 2011 12:24:53 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:40324 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753797Ab1GZQYw (ORCPT ); Tue, 26 Jul 2011 12:24:52 -0400 Received: by wwe5 with SMTP id 5so720919wwe.1 for ; Tue, 26 Jul 2011 09:24:51 -0700 (PDT) Received: by 10.217.3.17 with SMTP id q17mr1701826wes.107.1311697491061; Tue, 26 Jul 2011 09:24:51 -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 fx12sm568521wbb.8.2011.07.26.09.24.48 (version=SSLv3 cipher=OTHER); Tue, 26 Jul 2011 09:24:50 -0700 (PDT) Message-ID: <4E2EEA4F.1010604@dev.mellanox.co.il> Date: Tue, 26 Jul 2011 12:24:47 -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 4/3] opensm/osm_sa_multipath_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 16:24:55 +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_multipath_record.c b/opensm/osm_sa_multipath_record.c index c45ca06..7924cc3 100644 --- a/opensm/osm_sa_multipath_record.c +++ b/opensm/osm_sa_multipath_record.c @@ -361,7 +361,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, if (mtu > ib_port_info_get_mtu_cap(p_pi)) mtu = ib_port_info_get_mtu_cap(p_pi); - if (rate > ib_port_info_compute_rate(p_pi, 0)) + if (ib_path_compare_rates(rate, + ib_port_info_compute_rate(p_pi, 0)) > 0) rate = ib_port_info_compute_rate(p_pi, 0); /* @@ -384,7 +385,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, if (mtu > ib_port_info_get_mtu_cap(p_pi)) mtu = ib_port_info_get_mtu_cap(p_pi); - if (rate > ib_port_info_compute_rate(p_pi, 0)) + if (ib_path_compare_rates(rate, + ib_port_info_compute_rate(p_pi, 0)) > 0) rate = ib_port_info_compute_rate(p_pi, 0); if (sa->p_subn->opt.qos) { @@ -417,7 +419,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, if (mtu > ib_port_info_get_mtu_cap(p_pi)) mtu = ib_port_info_get_mtu_cap(p_pi); - if (rate > ib_port_info_compute_rate(p_pi, 0)) + if (ib_path_compare_rates(rate, + ib_port_info_compute_rate(p_pi, 0)) > 0) rate = ib_port_info_compute_rate(p_pi, 0); OSM_LOG(sa->p_log, OSM_LOG_DEBUG, @@ -443,7 +446,7 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, mtu = p_qos_level->mtu_limit; if (p_qos_level->rate_limit_set - && (rate > p_qos_level->rate_limit)) + && (ib_path_compare_rates(rate, p_qos_level->rate_limit) > 0)) rate = p_qos_level->rate_limit; if (p_qos_level->sl_set) { @@ -507,23 +510,22 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, required_rate = ib_multipath_rec_rate(p_mpr); switch (ib_multipath_rec_rate_sel(p_mpr)) { case 0: /* must be greater than */ - if (rate <= required_rate) + if (ib_path_compare_rates(rate, required_rate) <= 0) status = IB_NOT_FOUND; break; case 1: /* must be less than */ - if (rate >= required_rate) { + if (ib_path_compare_rates(rate, required_rate) >= 0) { /* adjust the rate to use the highest rate lower then the required one */ - if (required_rate > 2) - rate = required_rate - 1; - else + rate = ib_path_rate_get_prev(required_rate); + if (!rate) status = IB_NOT_FOUND; } break; case 2: /* exact match */ - if (rate < required_rate) + if (ib_path_compare_rates(rate, required_rate)) status = IB_NOT_FOUND; else rate = required_rate;