From patchwork Mon Oct 24 15:38: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: 9392377 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 3E6B46077A for ; Mon, 24 Oct 2016 15:38:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E1E22917B for ; Mon, 24 Oct 2016 15:38:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2303129145; Mon, 24 Oct 2016 15:38:58 +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 5AEC229046 for ; Mon, 24 Oct 2016 15:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935002AbcJXPi4 (ORCPT ); Mon, 24 Oct 2016 11:38:56 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:46397 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935768AbcJXPi4 (ORCPT ); Mon, 24 Oct 2016 11:38:56 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9OFcs4m020454 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Oct 2016 15:38:54 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u9OFcsxA032380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Oct 2016 15:38:54 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id u9OFcrx5022598; Mon, 24 Oct 2016 15:38:54 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Oct 2016 08:38:53 -0700 From: Knut Omang To: Ira Weiny Cc: linux-rdma@vger.kernel.org, Line Holen , Knut Omang , Dag Moxnes Subject: [PATCH infiniband-diags v4] ibportstate: Fixed switch peer port probing when using DR routing Date: Mon, 24 Oct 2016 17:38:45 +0200 Message-Id: X-Mailer: git-send-email 2.5.5 X-Source-IP: userv0022.oracle.com [156.151.31.74] 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 | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) base-commit: 17e03b4738913365a3f947719c4897fcb92df32c diff --git a/src/ibportstate.c b/src/ibportstate.c index cfb8be7..df50469 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 = (uint16_t) 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);