From patchwork Thu Apr 11 14:19:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2428891 X-Patchwork-Delegate: hal@mellanox.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 00E19DF230 for ; Thu, 11 Apr 2013 14:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755684Ab3DKOTk (ORCPT ); Thu, 11 Apr 2013 10:19:40 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:53311 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513Ab3DKOTj (ORCPT ); Thu, 11 Apr 2013 10:19:39 -0400 Received: by mail-wi0-f174.google.com with SMTP id hj8so612064wib.1 for ; Thu, 11 Apr 2013 07:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:content-transfer-encoding:x-gm-message-state; bh=0B5mgcJubDijIjFCfQxpBEiYf4sP/okcEBO4l1LXNhk=; b=UhcyZcDqwdAV6SYuRkMkzIKw/HjolSUthhR2hgbgDN/EkYlhq7dcFTxf7JGNuNmDfo bu+rSpvkpqWZ8nEmlBumWPO0p9/NfTgSTMhWweNjwKrvnDzATImthThXb+1Iyx9+A9XT w8Ab0HmNawVvwqlW/mNM62S6QRrmJ+Mu9tfJGU1PZOfvlGAibTb1vdWU1OQN43lsZ4G0 wyUAD+Vt4U+IaIuP7Rf6uALqWEFYhsyl+cD4RekfTDV8+OVs9BJyMdEvuN5HSsxAk4kC nSMj05Is4kSBfoYnHK2EudfrtKQNT6fwLV8Fnnz6/7OS4Mbvk37vFRQnexCjR9IUb87D 4o3g== X-Received: by 10.194.83.33 with SMTP id n1mr5092727wjy.7.1365689978373; Thu, 11 Apr 2013 07:19:38 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id n2sm3423782wiy.6.2013.04.11.07.19.36 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 07:19:37 -0700 (PDT) Message-ID: <5166C677.8080900@dev.mellanox.co.il> Date: Thu, 11 Apr 2013 10:19:35 -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 Subject: [PATCH opensm] osm_lid_mgr.c: fix duplicate LID assignment after SM port down X-Gm-Message-State: ALoCoQn2Hw5kOnkp2KJzoiGo+IkF5dQG/yT4J3uVePFz/4lljJsa5bryACGGEMFZIPJaCGR+dZPe Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Alex Netes We must discard previous guid2lid db if this is the first master sweep and reassign_lids option is TRUE. If we came out of standby and honor_guid2lid_file option is TRUE, we must restore guid2lid db. Otherwise if honor_guid2lid_file option is FALSE we must discard previous guid2lid db. Signed-off-by: Alex Netes Signed-off-by: Hal Rosenstock --- opensm/osm_lid_mgr.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/opensm/osm_lid_mgr.c b/opensm/osm_lid_mgr.c index f92084a..4289424 100644 --- a/opensm/osm_lid_mgr.c +++ b/opensm/osm_lid_mgr.c @@ -302,11 +302,17 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr) lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1); - /* if we came out of standby we need to discard any previous guid2lid - info we might have. - Do this only if the honor_guid2lid_file option is FALSE. If not, then - need to honor this file. */ - if (p_mgr->p_subn->coming_out_of_standby == TRUE) { + /* We must discard previous guid2lid db if this is the first master + * sweep and reassign_lids option is TRUE. + * If we came out of standby and honor_guid2lid_file option is TRUE, we + * must restore guid2lid db. Otherwise if honor_guid2lid_file option is + * FALSE we must discard previous guid2lid db. + */ + if (p_mgr->p_subn->first_time_master_sweep == TRUE && + p_mgr->p_subn->opt.reassign_lids == TRUE) { + osm_db_clear(p_mgr->p_g2l); + memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids)); + } else if (p_mgr->p_subn->coming_out_of_standby == TRUE) { osm_db_clear(p_mgr->p_g2l); memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids)); if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)