From patchwork Wed Aug 1 14:52:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Foraker X-Patchwork-Id: 1264581 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3FBB4DF215 for ; Wed, 1 Aug 2012 14:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755226Ab2HAOxA (ORCPT ); Wed, 1 Aug 2012 10:53:00 -0400 Received: from nspiron-1.llnl.gov ([128.115.41.81]:57070 "EHLO nspiron-1.llnl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755083Ab2HAOw6 (ORCPT ); Wed, 1 Aug 2012 10:52:58 -0400 X-Attachments: Received: from auk75.llnl.gov ([10.253.135.81]) by nspiron-1.llnl.gov with ESMTP; 01 Aug 2012 07:52:54 -0700 From: Jim Foraker To: linux-rdma@vger.kernel.org Cc: weiny2@llnl.gov, alexne@meallanox.com, Jim Foraker Subject: [PATCH 8/9 v2] opensm: Ensure sweep interval/mkey lease are sensibly set Date: Wed, 1 Aug 2012 07:52:34 -0700 Message-Id: <1343832755-26753-8-git-send-email-foraker1@llnl.gov> X-Mailer: git-send-email 1.7.9.2 In-Reply-To: <1343832755-26753-1-git-send-email-foraker1@llnl.gov> References: <1343832537.26423.8.camel@auk75.llnl.gov> <1343832755-26753-1-git-send-email-foraker1@llnl.gov> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org If mkeys are protected, sweep should always be enabled and set to an interval < the lease timeout, to ensure a missed trap doesn't lead to mkey exposure. Signed-off-by: Jim Foraker --- opensm/osm_subnet.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c index 5ae49bb..460582a 100644 --- a/opensm/osm_subnet.c +++ b/opensm/osm_subnet.c @@ -2011,6 +2011,26 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts) "instead\n", p_opts->m_key_protect_bits, 2); p_opts->m_key_protect_bits = 2; } + if (p_opts->m_key_protect_bits && p_opts->m_key_lease_period) { + if (!p_opts->sweep_interval) { + log_report(" Sweep disabled with protected mkey " + "leases in effect; re-enabling sweeping " + "with interval %u\n", + cl_ntoh16(p_opts->m_key_lease_period) - 1); + p_opts->sweep_interval = + cl_ntoh16(p_opts->m_key_lease_period) - 1; + } + if (p_opts->sweep_interval >= + cl_ntoh16(p_opts->m_key_lease_period)) { + log_report(" Sweep interval %u >= mkey lease period " + "%u. Setting lease period to %u\n", + p_opts->sweep_interval, + cl_ntoh16(p_opts->m_key_lease_period), + p_opts->sweep_interval + 1); + p_opts->m_key_lease_period = + cl_hton16(p_opts->sweep_interval + 1); + } + } if (p_opts->root_guid_file != NULL) { FILE *root_file = fopen(p_opts->root_guid_file, "r");