From patchwork Thu Nov 21 00:08:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3216041 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 816E49F3A0 for ; Thu, 21 Nov 2013 00:08:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B30020780 for ; Thu, 21 Nov 2013 00:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 061682076A for ; Thu, 21 Nov 2013 00:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755252Ab3KUAIH (ORCPT ); Wed, 20 Nov 2013 19:08:07 -0500 Received: from mail-wg0-f47.google.com ([74.125.82.47]:34487 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754916Ab3KUAIG (ORCPT ); Wed, 20 Nov 2013 19:08:06 -0500 Received: by mail-wg0-f47.google.com with SMTP id y10so9694422wgg.2 for ; Wed, 20 Nov 2013 16:08:04 -0800 (PST) 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=BUCGWz0sbEtG/tZtKgX/YTvo9MCd3VqiV7bx5VQiCjE=; b=Tpe3gSINykhc1+MgEm6sCrA17F+dEPOZrJNQsomWcs8gerCHkrTEQ7pmMD3v2u1y2W hoaMu3+HdQAM0xGsKw9ISib61to+F4WkfVzoCM3WjvFgR6XfPtkeSRtyfNS0OtTGFs3w p33ZUACy2scjIMjnBVJMt4E5v7d5IJohJ3J792YqDao/1y2c+crf0o1NK+r/n9n+RkHW QCw+8ri4J+rernT6I55+webTI1yOzZ9kEeK7RpN7xaDWvEhxAQqUmHHh8SsI3bOLQXSo 4UNTbgZdsgYyVTSyX605DUld06CQsvSFdieIiHmZ/MUOg/9T2OaddpJsewVbk+zoYQrE qXlA== X-Gm-Message-State: ALoCoQlgKsDdwJxZ3rQF2AUttk3wTYuSSxifw2smnOpJZqPW4S1kTYTMFYxdoGgx/dIlW2hnRnP7 X-Received: by 10.180.182.47 with SMTP id eb15mr3365654wic.51.1384992484480; Wed, 20 Nov 2013 16:08:04 -0800 (PST) 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 hv5sm562419wib.2.2013.11.20.16.08.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 16:08:03 -0800 (PST) Message-ID: <528D4EE0.9020300@dev.mellanox.co.il> Date: Wed, 20 Nov 2013 19:08:00 -0500 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] Fix minhop population in fabric with duplicate lids Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.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 Sometimes SET PortInfo from the lid_mgr can fail and a port will remain with it previous lid. In that case we might have more than one port with same lid. ucast_build_matrices calculate min hop tables from the lid stored in the physp.port_info object resulting a wrong calculation. This patch zeros the physp.port_info.base_lid field before sending lid update to a port. In case SET fails, lid for that port will remain 0 and won't affect min_hop calculation. Signed-off-by: Alex Netes --- include/opensm/osm_port.h | 30 ++++++++++++++++++++++++++++++ opensm/osm_lid_mgr.c | 8 +++++++- 2 files changed, 37 insertions(+), 1 deletions(-) diff --git a/include/opensm/osm_port.h b/include/opensm/osm_port.h index f4b7efd..e9e59c3 100644 --- a/include/opensm/osm_port.h +++ b/include/opensm/osm_port.h @@ -546,6 +546,36 @@ void osm_physp_set_port_info(IN osm_physp_t * p_physp, * Port, Physical Port *********/ +/****f* OpenSM: Physical Port/osm_physp_set_base_lid +* NAME +* osm_physp_set_base_lid +* +* DESCRIPTION +* Sets the base lid for this Physical Port. +* +* SYNOPSIS +*/ +static inline void osm_physp_set_base_lid(IN osm_physp_t * p_physp, + IN ib_net16_t base_lid) +{ + CL_ASSERT(p_physp); + CL_ASSERT(osm_physp_is_valid(p_physp)); + p_physp->port_info.base_lid = base_lid; +} + +/* +* PARAMETERS +* p_physp +* [in] Pointer to an osm_physp_t object. +* +* base_lid +* [in] Lid to set. +* +* NOTES +* +* SEE ALSO +*********/ + /****f* OpenSM: Physical Port/osm_physp_set_pkey_tbl * NAME * osm_physp_set_pkey_tbl diff --git a/opensm/osm_lid_mgr.c b/opensm/osm_lid_mgr.c index 8473514..9531a09 100644 --- a/opensm/osm_lid_mgr.c +++ b/opensm/osm_lid_mgr.c @@ -885,8 +885,14 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr, p_port->lid = lid; p_pi->base_lid = lid; if (memcmp(&p_pi->base_lid, &p_old_pi->base_lid, - sizeof(p_pi->base_lid))) + sizeof(p_pi->base_lid))) { + /* + * Reset stored base_lid. + * On successful send, we'll update it when we'll get a reply. + */ + osm_physp_set_base_lid(p_physp, 0); send_set = TRUE; + } /* we are updating the ports with our local sm_base_lid */ p_pi->master_sm_base_lid = p_mgr->p_subn->sm_base_lid;