From patchwork Mon Oct 10 08:50:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Knut Omang X-Patchwork-Id: 9369155 X-Patchwork-Delegate: ira.weiny@intel.com 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 51475607D2 for ; Mon, 10 Oct 2016 08:51:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434F829391 for ; Mon, 10 Oct 2016 08:51:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38069293A7; Mon, 10 Oct 2016 08:51:00 +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 BB86329391 for ; Mon, 10 Oct 2016 08:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751008AbcJJIu7 (ORCPT ); Mon, 10 Oct 2016 04:50:59 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:42608 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbcJJIu6 (ORCPT ); Mon, 10 Oct 2016 04:50:58 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9A8otiJ028545 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Oct 2016 08:50:56 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u9A8otAZ010262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Oct 2016 08:50:55 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u9A8otCN009090; Mon, 10 Oct 2016 08:50:55 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Oct 2016 01:50:55 -0700 From: Knut Omang To: Ira Weiny Cc: linux-rdma@vger.kernel.org, Line Holen , Knut Omang , Dag Moxnes Subject: [PATCH infiniband-diags v2] ibportstate: Fixed switch peer port probing when using DR routing Date: Mon, 10 Oct 2016 10:50:45 +0200 Message-Id: <8d3851995d389220a979543740862bd8884cacac.1476089300.git-series.knut.omang@oracle.com> X-Mailer: git-send-email 2.5.5 X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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 Reviewed-by: Hal Rosenstock --- src/ibportstate.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) base-commit: 2937cf99350a2e423b705e8b8dd10499796a7b41 diff --git a/src/ibportstate.c b/src/ibportstate.c index cb47aa9..7046f47 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -1,6 +1,8 @@ /* * 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 +657,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, argv[0], + &selfportid, 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);