From patchwork Tue Aug 27 12:58:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2850180 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 931C4BF546 for ; Tue, 27 Aug 2013 12:58:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEF8B20483 for ; Tue, 27 Aug 2013 12:58:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AB2F2046B for ; Tue, 27 Aug 2013 12:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180Ab3H0M6g (ORCPT ); Tue, 27 Aug 2013 08:58:36 -0400 Received: from mail-bk0-f54.google.com ([209.85.214.54]:54307 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753097Ab3H0M6g (ORCPT ); Tue, 27 Aug 2013 08:58:36 -0400 Received: by mail-bk0-f54.google.com with SMTP id mz12so1653450bkb.13 for ; Tue, 27 Aug 2013 05:58:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=9lgzke0FKEcEp8qCfHqjuZsYxVauf+dGbPrTpBw0ojY=; b=JfYMxvPftWHjcfHmXRuZYOMngwOEOBfhRaX41F3FSW8HqUKkBYvdeYHW3yV1tgEMet 6ueOXMxTprwtNBMRzpkgcrtXrvDK4Obbhvt2f04JIWhHdjd6AgAJWri7xNCD3XOXRpS1 X+DureDdHZY+kU0acds4a/J9M3EVkMWpevMTEvqVeyo5dqMFMZ6gsHIfItA+PxLoD5G0 6N8hpS6RUMDL7RLExVriZ83YexTdSWMWOpubGEFiJX9JukV91T6i7nGNZMhBEF98dOSV 5KP3PA8h8TYfvQP6iwaF7tNnWSBNceAGpc3Hgix/cvsEol3hq0RuWl8vP95xBxNKynVA jl/g== X-Gm-Message-State: ALoCoQmJ8EEjoW6c+zrvHWAOxSfEQ457v3Vba1VTpxPtWrkpl1lKEgUOvNj6zvI5DXdzcCTUP7Jj X-Received: by 10.204.238.136 with SMTP id ks8mr1389215bkb.32.1377608313850; Tue, 27 Aug 2013 05:58:33 -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 w9sm4402960bkn.12.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Aug 2013 05:58:32 -0700 (PDT) Message-ID: <521CA275.9070006@dev.mellanox.co.il> Date: Tue, 27 Aug 2013 08:58:29 -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: Alex Netes , Vladimir Koushnir Subject: [PATCH 1/2 opensm] Add option to disable M_Key lookup Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Alex Netes M_Key lookup can be time consuming. This patch adds an option to disable M_Key lookup upon SMP send. Signed-off-by: Alex Netes Signed-off-by: Hal Rosenstock --- include/opensm/osm_subnet.h | 1 + opensm/osm_req.c | 6 ++++-- opensm/osm_subnet.c | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/opensm/osm_subnet.h b/include/opensm/osm_subnet.h index 0256230..4042f9b 100644 --- a/include/opensm/osm_subnet.h +++ b/include/opensm/osm_subnet.h @@ -251,6 +251,7 @@ typedef struct osm_subn_opt { ib_net64_t subnet_prefix; ib_net16_t m_key_lease_period; uint8_t m_key_protect_bits; + boolean_t m_key_lookup; uint32_t sweep_interval; uint32_t max_wire_smps; uint32_t max_wire_smps2; diff --git a/opensm/osm_req.c b/opensm/osm_req.c index fe62aab..7b68411 100644 --- a/opensm/osm_req.c +++ b/opensm/osm_req.c @@ -192,7 +192,8 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path, tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) & (uint64_t)(0xFFFFFFFF)); - m_key = req_determine_mkey(sm, p_path); + m_key = (sm->p_subn->opt.m_key_lookup == TRUE) ? + req_determine_mkey(sm, p_path) : sm->p_subn->opt.m_key; OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 @@ -268,7 +269,8 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) & (uint64_t)(0xFFFFFFFF)); - m_key = req_determine_mkey(sm, p_path); + m_key = (sm->p_subn->opt.m_key_lookup == TRUE) ? + req_determine_mkey(sm, p_path) : sm->p_subn->opt.m_key; OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c index 3971e96..a0c9dc4 100644 --- a/opensm/osm_subnet.c +++ b/opensm/osm_subnet.c @@ -764,6 +764,7 @@ static const opt_rec_t opt_tbl[] = { { "subnet_prefix", OPT_OFFSET(subnet_prefix), opts_parse_net64, NULL, 1 }, { "m_key_lease_period", OPT_OFFSET(m_key_lease_period), opts_parse_net16, NULL, 1 }, { "m_key_protection_level", OPT_OFFSET(m_key_protect_bits), opts_parse_uint8, NULL, 1 }, + { "m_key_lookup", OPT_OFFSET(m_key_lookup), opts_parse_boolean, NULL, 1 }, { "sweep_interval", OPT_OFFSET(sweep_interval), opts_parse_uint32, NULL, 1 }, { "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 }, { "max_wire_smps2", OPT_OFFSET(max_wire_smps2), opts_parse_uint32, NULL, 1 }, @@ -1644,6 +1645,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX; p_opt->m_key_lease_period = 0; p_opt->m_key_protect_bits = 0; + p_opt->m_key_lookup = TRUE; p_opt->sweep_interval = OSM_DEFAULT_SWEEP_INTERVAL_SECS; p_opt->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE; p_opt->max_wire_smps2 = p_opt->max_wire_smps; @@ -2614,6 +2616,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) "m_key_lease_period %u\n\n" "# The protection level used for the M_Key on this subnet\n" "m_key_protection_level %u\n\n" + "# If FALSE, SM won't try to determine the m_key of unknown ports\n" + "m_key_lookup %s\n\n" "# SM_Key value of the SM used for SM authentication\n" "sm_key 0x%016" PRIx64 "\n\n" "# SM_Key value to qualify rcv SA queries as 'trusted'\n" @@ -2696,6 +2700,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) cl_ntoh64(p_opts->m_key), cl_ntoh16(p_opts->m_key_lease_period), p_opts->m_key_protect_bits, + p_opts->m_key_lookup ? "TRUE" : "FALSE", cl_ntoh64(p_opts->sm_key), cl_ntoh64(p_opts->sa_key), cl_ntoh64(p_opts->subnet_prefix),