From patchwork Mon Dec 3 15:25:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 1834261 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 A99BDDF2F9 for ; Mon, 3 Dec 2012 15:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754591Ab2LCPZQ (ORCPT ); Mon, 3 Dec 2012 10:25:16 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:40738 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752713Ab2LCPZP (ORCPT ); Mon, 3 Dec 2012 10:25:15 -0500 Received: by mail-la0-f46.google.com with SMTP id p5so2365349lag.19 for ; Mon, 03 Dec 2012 07:25:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=knI01JxDWeJE2Bam/PMHVnQ2h9mf1pAAeyAEXpZnbe0=; b=OqZQuiuc74y0+n/0sZI0PLuTgitOHrHMvzjsFF6BfQ7vzZRlbmXEHvMYJtERA8tuNy gShcpbcJGIcN5aQs1hxnMbX0liuooAFap0Z+FFvuY9zocT+Pz5WYp0loGzt/D/qyat21 fk8q/3jERAgYFAQl98O5kY6f8NK1m3yLrVTUbBeTuuSwhJSqrE/YO+iVuDoUjzWjZ9CN 0ZU+62o/tm3IQkPLBqdQ8pzTv2VWdo712NoFB+G+h2Hgg4MuZ86FdlOnV4JbNROJGlKD M2pIYiqOJcAetWgLrshor/SNjC4I5PoHwheuet09WcMWsN4n/2CXJQvpw+PURlHIK+s7 E5rA== Received: by 10.152.110.74 with SMTP id hy10mr9863748lab.54.1354548314979; Mon, 03 Dec 2012 07:25:14 -0800 (PST) Received: from [192.168.1.102] (c-71-192-10-85.hsd1.ma.comcast.net. [71.192.10.85]) by mx.google.com with ESMTPS id ly18sm5465040lab.15.2012.12.03.07.25.13 (version=SSLv3 cipher=OTHER); Mon, 03 Dec 2012 07:25:14 -0800 (PST) Message-ID: <50BCC458.1030305@dev.mellanox.co.il> Date: Mon, 03 Dec 2012 10:25:12 -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: Alex Netes CC: "linux-rdma (linux-rdma@vger.kernel.org)" , Jim Foraker , Vladimir Koushnir Subject: [PATCH 1/2] opensm/osm_req.c: In req_determine_mkey, fix DR algorithm X-Gm-Message-State: ALoCoQnWYrxSzNfIOAINCSXc2BanIMINGGh5nNOeoOp2c+jNGs7P8j42P34cm8MaVJYuBDJc+LM8 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org so that it works regardless of SM port type Now works on switch port 0 as well as CA and router ports Signed-off-by: Hal Rosenstock --- opensm/osm_req.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/opensm/osm_req.c b/opensm/osm_req.c index 1f5db3f..b48be48 100644 --- a/opensm/osm_req.c +++ b/opensm/osm_req.c @@ -87,16 +87,20 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm, goto Remote_Guid; } - if (p_sm_port) + if (p_sm_port) { + /* get the node for the SM */ + p_node = p_sm_port->p_node; p_physp = p_sm_port->p_physp; + } - /* hop_count == 1: outgoing physp is SM physp */ - for (hop = 2; p_physp && hop <= p_path->hop_count; hop++) { + for (hop = 1; p_physp && hop <= p_path->hop_count; hop++) { + p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]); + if (!p_physp) + break; p_physp = p_physp->p_remote_physp; if (!p_physp) break; p_node = p_physp->p_node; - p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]); } /* At this point, p_physp points at the outgoing physp on the