From patchwork Fri Jul 4 15:24:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4481801 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 25A62BEEAA for ; Fri, 4 Jul 2014 15:25:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3467620304 for ; Fri, 4 Jul 2014 15:25:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3416A202F2 for ; Fri, 4 Jul 2014 15:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752742AbaGDPY7 (ORCPT ); Fri, 4 Jul 2014 11:24:59 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:62041 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbaGDPY7 (ORCPT ); Fri, 4 Jul 2014 11:24:59 -0400 Received: by mail-wi0-f171.google.com with SMTP id n15so13254604wiw.16 for ; Fri, 04 Jul 2014 08:24:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=B113A1lVKaE5uiblFGGnllQ1BgoteXaTXLEVoXozY6E=; b=luHa3dkKyhZZHjejEURvoqYwixzugQK0NVtp+JIv6rb64/E+H8PE+IuC9mUcKrVTdC up/S/A0JRinivOlWW4Tax6h1iLeY1Qjl2Sy92HpRWbRxL9z376+UPDlPoCNM6L8A8SiV 0PmMV2PZPVYxVfyrwYft12RbUaA4jgsxVbWciIU75Pw8+/M7YS/HdAniW4K/8eqpeN6W xgp6wA93EYs8zPCluH+P00koXNQmt2ubofM7nzBbu4nqbjNwqit0n2gcpNY7c71obhYB ++jJG66I34sPOMVdyaGovJ/RX+eOjlABdwvzDvGa9o52QhNJaiBldocWLCvjKi7khe80 djcg== X-Gm-Message-State: ALoCoQmTFfgm6wiT+tJQoAde8xwea7DfifzHfXHqbyIDjGq6KzyKPojds/PeVm4wdzIzB95fLgBL X-Received: by 10.194.158.101 with SMTP id wt5mr3618287wjb.136.1404487497591; Fri, 04 Jul 2014 08:24:57 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id fc7sm69631994wjc.37.2014.07.04.08.24.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Jul 2014 08:24:57 -0700 (PDT) Message-ID: <53B6C746.6070302@dev.mellanox.co.il> Date: Fri, 04 Jul 2014 11:24:54 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Shlomi Nimrodi Subject: [PATCH 2/2 opensm] Eliminate redundant calls to ib_port_info_compute_rate Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shlomi Nimrodi Signed-off-by: Shlomi Nimrodi Signed-off-by: Hal Rosenstock --- opensm/osm_sa_multipath_record.c | 23 ++++++++++------------- opensm/osm_sa_path_record.c | 23 ++++++++++------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/opensm/osm_sa_multipath_record.c b/opensm/osm_sa_multipath_record.c index 1804943..e63a489 100644 --- a/opensm/osm_sa_multipath_record.c +++ b/opensm/osm_sa_multipath_record.c @@ -152,7 +152,7 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, ib_slvl_table_t *p_slvl_tbl; ib_api_status_t status = IB_SUCCESS; uint8_t mtu; - uint8_t rate; + uint8_t rate, p0_extended_rate, dest_rate; uint8_t pkt_life; uint8_t required_mtu; uint8_t required_rate; @@ -355,10 +355,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - p0_extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, p0_extended); + p0_extended_rate = ib_port_info_compute_rate(p_pi, p0_extended); + if (ib_path_compare_rates(rate, p0_extended_rate) > 0) + rate = p0_extended_rate; /* Continue with the egress port on this switch. @@ -383,10 +382,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - p0_extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, p0_extended); + p0_extended_rate = ib_port_info_compute_rate(p_pi, p0_extended); + if (ib_path_compare_rates(rate, p0_extended_rate) > 0) + rate = p0_extended_rate; if (sa->p_subn->opt.qos) { /* @@ -419,10 +417,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, mtu = ib_port_info_get_mtu_cap(p_pi); extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, extended); + dest_rate = ib_port_info_compute_rate(p_pi, extended); + if (ib_path_compare_rates(rate, dest_rate) > 0) + rate = dest_rate; OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Path min MTU = %u, min rate = %u\n", mtu, rate); diff --git a/opensm/osm_sa_path_record.c b/opensm/osm_sa_path_record.c index 42af2b9..499ed8d 100644 --- a/opensm/osm_sa_path_record.c +++ b/opensm/osm_sa_path_record.c @@ -162,7 +162,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, ib_api_status_t status = IB_SUCCESS; ib_net16_t pkey; uint8_t mtu; - uint8_t rate; + uint8_t rate, p0_extended_rate, dest_rate; uint8_t pkt_life; uint8_t required_mtu; uint8_t required_rate; @@ -349,10 +349,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - p0_extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, p0_extended); + p0_extended_rate = ib_port_info_compute_rate(p_pi, p0_extended); + if (ib_path_compare_rates(rate, p0_extended_rate) > 0) + rate = p0_extended_rate; /* Continue with the egress port on this switch. @@ -377,10 +376,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - p0_extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, p0_extended); + p0_extended_rate = ib_port_info_compute_rate(p_pi, p0_extended); + if (ib_path_compare_rates(rate, p0_extended_rate) > 0) + rate = p0_extended_rate; if (sa->p_subn->opt.qos) { /* @@ -433,10 +431,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, mtu = ib_port_info_get_mtu_cap(p_pi); extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; - if (ib_path_compare_rates(rate, - ib_port_info_compute_rate(p_pi, - extended)) > 0) - rate = ib_port_info_compute_rate(p_pi, extended); + dest_rate = ib_port_info_compute_rate(p_pi, extended); + if (ib_path_compare_rates(rate, dest_rate) > 0) + rate = dest_rate; OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Path min MTU = %u, min rate = %u\n", mtu, rate);