From patchwork Mon Oct 24 13:34:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Knut Omang X-Patchwork-Id: 9392085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 185A260762 for ; Mon, 24 Oct 2016 13:34:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0953E2902D for ; Mon, 24 Oct 2016 13:34:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F22072907F; Mon, 24 Oct 2016 13:34:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E032902D for ; Mon, 24 Oct 2016 13:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936362AbcJXNeo (ORCPT ); Mon, 24 Oct 2016 09:34:44 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:39354 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934973AbcJXNen (ORCPT ); Mon, 24 Oct 2016 09:34:43 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9ODYfqt002766 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Oct 2016 13:34:41 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u9ODYfFE019808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Oct 2016 13:34:41 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u9ODYdL9018705; Mon, 24 Oct 2016 13:34:40 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Oct 2016 06:34:39 -0700 From: Knut Omang To: Ira Weiny Cc: linux-rdma@vger.kernel.org, Line Holen , Knut Omang , Dag Moxnes Subject: [PATCH infiniband-diags v3] ibportstate: Fixed switch peer port probing when using DR routing Date: Mon, 24 Oct 2016 15:34:22 +0200 Message-Id: <22b5963c36776d0b03eb0f6706323b4ba4bafac9.1477315879.git-series.knut.omang@oracle.com> X-Mailer: git-send-email 2.5.5 X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dag Moxnes ibportstate queries to a remote peer port on a switch using direct routing would result in timeouts. The reason for this is that the DR path was not correctly constructed. Signed-off-by: Dag Moxnes Reviewed-by: Line Holen Signed-off-by: Knut Omang --- src/ibportstate.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) base-commit: 17e03b4738913365a3f947719c4897fcb92df32c diff --git a/src/ibportstate.c b/src/ibportstate.c index cfb8be7..82cbcc2 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2004-2009 Voltaire Inc. All rights reserved. * Copyright (c) 2010,2011 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2011,2016 Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -655,15 +656,22 @@ int main(int argc, char **argv) /* Setup portid for peer port */ memcpy(&peerportid, &portid, sizeof(peerportid)); - peerportid.drpath.cnt = 1; - peerportid.drpath.p[1] = (uint8_t) portnum; - - /* Set DrSLID to local lid */ - if (resolve_self(ibd_ca, ibd_ca_port, &selfportid, - &selfport, 0) < 0) - IBEXIT("could not resolve self"); - peerportid.drpath.drslid = (uint16_t) selfportid.lid; - peerportid.drpath.drdlid = 0xffff; + if (portid.lid == 0) { + peerportid.drpath.cnt++; + if (peerportid.drpath.cnt == IB_SUBNET_PATH_HOPS_MAX) { + IBEXIT("Too many hops"); + } + } else { + peerportid.drpath.cnt = 1; + + /* Set DrSLID to local lid */ + if (resolve_self(ibd_ca, ibd_ca_port, &selfportid, + &selfport, 0) < 0) + IBEXIT("could not resolve self"); + peerportid.drpath.drslid = selfportid.lid; + peerportid.drpath.drdlid = 0xffff; + } + peerportid.drpath.p[peerportid.drpath.cnt] = (uint8_t) portnum; /* Get peer port NodeInfo to obtain peer port number */ is_peer_switch = get_node_info(&peerportid, data);