From patchwork Fri Jul 4 15:24:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4481791 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 3FB53BEEAA for ; Fri, 4 Jul 2014 15:24:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED48F20304 for ; Fri, 4 Jul 2014 15:24:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87248202F2 for ; Fri, 4 Jul 2014 15:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753159AbaGDPYm (ORCPT ); Fri, 4 Jul 2014 11:24:42 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:50468 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbaGDPYl (ORCPT ); Fri, 4 Jul 2014 11:24:41 -0400 Received: by mail-wi0-f173.google.com with SMTP id cc10so13176697wib.0 for ; Fri, 04 Jul 2014 08:24:39 -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=nuzkgFNAp1feM+QHfspw/CDdJP+P6TOe1n5zhTU5IoQ=; b=e+wYlGqyXY5lI2dpHD/eZsG1YmnbzxB16yij9f8JL9DEious/hQL0Tbo5dM7I1mtvV xX1R5GSqw6E7iU8m7e8Dmo/yJcGTaYMfyy3Q5lcgsFak6apsmKf/SrcGkHQIAA7NG68l /NaHtr0q68gNLeHh3FKk8FppX17l6CC6ZkzxA9J+9InwTr/+7Ea7AYeD2Rh4N/jc6zef swOONC5LtEc9VHEopA+eSeiXkTyandfZ052YfkLZi4Xk9zz3pk+prFUu2Lr88DdEG5ck 84iF05rkYASU/EzySdr4pvC/+nyvHmq6ZJ/wRdq8kVrp7Y8HAsmnp1i0NFCv9iYKs0ED 4TzA== X-Gm-Message-State: ALoCoQl5OkFSyVRSU0+DTAeSFkMIHRLqlD4rEjQMGI8P33YWe5KkrZyfMqm5pa4kBnek2q52J/g5 X-Received: by 10.180.189.79 with SMTP id gg15mr4735627wic.0.1404487479056; Fri, 04 Jul 2014 08:24:39 -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 fu7sm12078567wib.2.2014.07.04.08.24.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Jul 2014 08:24:38 -0700 (PDT) Message-ID: <53B6C72B.1090702@dev.mellanox.co.il> Date: Fri, 04 Jul 2014 11:24:27 -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 1/2 opensm] Shorten long lines while calculating SA 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_port_info_rcv.c | 5 +++-- opensm/osm_sa_mcmember_record.c | 15 ++++++++++----- opensm/osm_sa_multipath_record.c | 23 ++++++++++++----------- opensm/osm_sa_path_record.c | 23 ++++++++++++----------- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c index 9707496..4d42470 100644 --- a/opensm/osm_port_info_rcv.c +++ b/opensm/osm_port_info_rcv.c @@ -85,6 +85,7 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp, osm_madw_context_t context; ib_api_status_t status; ib_net64_t port_guid; + int extended; uint8_t rate, mtu, mpb; unsigned data_vls; cl_qmap_t *p_sm_tbl; @@ -106,8 +107,8 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp, sm->p_subn->min_ca_mtu = mtu; } - rate = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; + rate = ib_port_info_compute_rate(p_pi, extended); if (rate < sm->p_subn->min_ca_rate) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal rate to:%u defined by port:0x%" diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c index afc795f..7e18e46 100644 --- a/opensm/osm_sa_mcmember_record.c +++ b/opensm/osm_sa_mcmember_record.c @@ -334,6 +334,7 @@ static boolean_t validate_port_caps(osm_log_t * p_log, uint8_t mtu_mgrp; uint8_t rate_required; uint8_t rate_mgrp; + int extended; mtu_required = ib_port_info_get_mtu_cap(&p_physp->port_info); mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F); @@ -345,8 +346,8 @@ static boolean_t validate_port_caps(osm_log_t * p_log, } p_pi = &p_physp->port_info; - rate_required = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; + rate_required = ib_port_info_compute_rate(p_pi, extended); rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F); if (ib_path_compare_rates(rate_required, rate_mgrp) < 0) { OSM_LOG(p_log, OSM_LOG_VERBOSE, @@ -652,6 +653,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, uint8_t rate_required, rate, port_rate; const ib_port_info_t *p_pi; osm_log_t *p_log = sa->p_log; + int extended; OSM_LOG_ENTER(sa->p_log); @@ -715,9 +717,12 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, } p_mcm_rec->mtu = (mtu_sel << 6) | mtu; - port_rate = - p_physp ? ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) : 0; + if (p_physp) { + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; + port_rate = ib_port_info_compute_rate(p_pi, extended); + } else + port_rate = 0; + if (!(comp_mask & IB_MCR_COMPMASK_RATE) || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL) || (rate_sel = (p_mcm_rec->rate >> 6)) == 3) diff --git a/opensm/osm_sa_multipath_record.c b/opensm/osm_sa_multipath_record.c index 1f7ee86..1804943 100644 --- a/opensm/osm_sa_multipath_record.c +++ b/opensm/osm_sa_multipath_record.c @@ -165,6 +165,7 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, uint8_t i; osm_qos_level_t *p_qos_level = NULL; uint16_t valid_sl_mask = 0xffff; + int extended, p0_extended; OSM_LOG_ENTER(sa->p_log); @@ -176,8 +177,8 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, p_pi = &p_physp->port_info; mtu = ib_port_info_get_mtu_cap(p_pi); - rate = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; + rate = ib_port_info_compute_rate(p_pi, extended); /* Mellanox Tavor device performance is better using 1K MTU. @@ -353,11 +354,11 @@ 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, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + p0_extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, p0_extended); /* Continue with the egress port on this switch. @@ -381,11 +382,11 @@ 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, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + p0_extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, p0_extended); if (sa->p_subn->opt.qos) { /* @@ -417,11 +418,11 @@ 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); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, extended); 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 0d8a867..42af2b9 100644 --- a/opensm/osm_sa_path_record.c +++ b/opensm/osm_sa_path_record.c @@ -175,6 +175,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, osm_qos_level_t *p_qos_level = NULL; uint16_t valid_sl_mask = 0xffff; int hops = 0; + int extended, p0_extended; OSM_LOG_ENTER(sa->p_log); @@ -188,8 +189,8 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_re = p_osm->routing_engine_used; mtu = ib_port_info_get_mtu_cap(p_pi); - rate = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; + rate = ib_port_info_compute_rate(p_pi, extended); /* Mellanox Tavor device performance is better using 1K MTU. @@ -347,11 +348,11 @@ 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, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + p0_extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, p0_extended); /* Continue with the egress port on this switch. @@ -375,11 +376,11 @@ 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, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + p0_extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, p0_extended); if (sa->p_subn->opt.qos) { /* @@ -431,11 +432,11 @@ static ib_api_status_t pr_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); + extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0) - rate = ib_port_info_compute_rate(p_pi, - p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS); + extended)) > 0) + rate = ib_port_info_compute_rate(p_pi, extended); OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Path min MTU = %u, min rate = %u\n", mtu, rate);