From patchwork Fri Sep 23 06:42:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Knut Omang X-Patchwork-Id: 9347521 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 C82F8607D0 for ; Fri, 23 Sep 2016 06:43:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B830B28EFB for ; Fri, 23 Sep 2016 06:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC5872AA5F; Fri, 23 Sep 2016 06:43:18 +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 1736228EFB for ; Fri, 23 Sep 2016 06:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753578AbcIWGnR (ORCPT ); Fri, 23 Sep 2016 02:43:17 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:36826 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbcIWGnQ (ORCPT ); Fri, 23 Sep 2016 02:43:16 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8N6hDXf028303 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2016 06:43:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8N6hDQw015335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2016 06:43:13 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8N6hCIe022605; Fri, 23 Sep 2016 06:43:12 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Sep 2016 23:43:11 -0700 From: Knut Omang To: Ira Weiny Cc: linux-rdma@vger.kernel.org, Line Holen , Knut Omang , Dag Moxnes Subject: [PATCH infiniband-diags] ibportstate: Fixed peer port probing when using DR routing Date: Fri, 23 Sep 2016 08:42:59 +0200 Message-Id: <430aa17fd12cdcfd735b4215938dc4279e33572d.1474612678.git-series.knut.omang@oracle.com> X-Mailer: git-send-email 2.5.5 X-Source-IP: userv0021.oracle.com [156.151.31.71] 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 When querying a remote port using ibportportstate, queries to the peer port would result in timeouts. The reason for this is that the DR path (or partial DR path was not correctly constructed. Signed-off-by: Dag Moxnes Reviewed-by: Line Holen Signed-off-by: Knut Omang --- src/ibportstate.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) base-commit: 2937cf99350a2e423b705e8b8dd10499796a7b41 diff --git a/src/ibportstate.c b/src/ibportstate.c index cb47aa9..cd0f680 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, 2015, 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,31 @@ 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 = portid.drpath.cnt + 1; + if (peerportid.drpath.cnt == IB_SUBNET_PATH_HOPS_MAX) { + exit(0); + } + peerportid.drpath.p[peerportid.drpath.cnt] = (uint8_t) portnum; + } else { + /* Set DrSLID to local lid */ + if (resolve_portid_str(ibd_ca, ibd_ca_port, &portid, argv[0], + ibd_dest_type, ibd_sm_id, srcport) < 0) + IBEXIT("could not resolve self"); + + peerportid.drpath.cnt = 1; + peerportid.drpath.p[1] = (uint8_t) portnum; + + + /* Use partial LID routing if remote switch */ + if ((portid.lid == selfportid.lid)) { + peerportid.drpath.drslid = 0xffff; + peerportid.drpath.drdlid = 0xffff; + } else { + peerportid.drpath.drslid = selfportid.lid; + peerportid.drpath.drdlid = 0xffff; + } + } /* Get peer port NodeInfo to obtain peer port number */ is_peer_switch = get_node_info(&peerportid, data);