From patchwork Fri Oct 20 15:22:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 10020529 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 BAF7B60211 for ; Fri, 20 Oct 2017 15:22:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B683C28ED3 for ; Fri, 20 Oct 2017 15:22:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB0DA28F04; Fri, 20 Oct 2017 15:22:52 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 1ACB628ED3 for ; Fri, 20 Oct 2017 15:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752010AbdJTPWv (ORCPT ); Fri, 20 Oct 2017 11:22:51 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:49241 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752009AbdJTPWu (ORCPT ); Fri, 20 Oct 2017 11:22:50 -0400 Received: by mail-qt0-f194.google.com with SMTP id k31so18875122qta.6 for ; Fri, 20 Oct 2017 08:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=KQQj1/zw5C5Hk/EFa/LXWcvWWv+TYKq3k6wE24fV77k=; b=EXU3ONCwCPuWJymOZhP6rqSPfd+QU/8URohLWrzOjSWwUnp194F6S93wdua2sNjJs8 VjR06vb+6Ar4OvbiGzHRtMVlAzFuBDKjKhLFpE0XoKygZQwrNbs/e4bsJatVTBEY9gVn rjp1lQGbQ9kMlsATDI1fSTIcbOBUuE5eTVTMhkLBZbEWbeV69Bpzo/VPt4Pf6Vp2ChhZ pG00Dr3V/LCbQUyTYGD0kZP66MI5uuMB3J2EMscXextOrAeqGX8BhORmz8w6jjBZY7uZ 77eeQg0sZ9MhnwpQbClSOAPbvu5jVW+YXdt/LhxdU6x8UpPnQN4X8PeCw68nZ8YtU5eH wshQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=KQQj1/zw5C5Hk/EFa/LXWcvWWv+TYKq3k6wE24fV77k=; b=dVItHB7+tPy+87PUsQm/v4Y131c+v1nOziRAAuSfk6RFGUDwrewHzWWVHf49Js+9q4 G8TLksSTStDyGg0EetC9ru6n9phYDhaODGh+FKUU7eC8omCiFir27MfT65LaShZSs9UU yb9Z7KiheZhwydV/dQHj6HIq6/9iFShhXzNFwRYz9S42pQ+4QvzOImt+bBKZ7PZmGKXx X/8ZDDvVCPi4RkfSFmlLYqUeB8KQXl2jT6+lbm78imTVi4QhCPqDbN39a8sXo4MBzwMp SRl9dQHoh36yNG/lrsn2I4N9rcZajfTJQLgSMh7/BL1r2X/bC5ZI760fGNPxudHZ4fvt PYcQ== X-Gm-Message-State: AMCzsaX2Lb6BY0kM+P8XIzmE7GzftPAkLECu2eVmVQ3hWU40xWr/YdOu pOXtSui58be1QhyR/ecRAPOv49VT X-Google-Smtp-Source: ABhQp+SIKtVhPoC3SRyFSoPKb+uwMLpg4uJLfmgRM8UM0gtaOXQ47unQes2P6aqwkzTZZd2DAHfENA== X-Received: by 10.200.52.56 with SMTP id u53mr7822818qtb.16.1508512969517; Fri, 20 Oct 2017 08:22:49 -0700 (PDT) Received: from [192.168.1.183] (c-73-182-207-166.hsd1.ma.comcast.net. [73.182.207.166]) by smtp.googlemail.com with ESMTPSA id n4sm703236qkf.49.2017.10.20.08.22.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Oct 2017 08:22:48 -0700 (PDT) To: "Weiny, Ira" Cc: "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags] ibdiag_common.c: In is_port_info_extended_supported, query PortInfo for port 0 when node is a switch Message-ID: <831b3d02-ecc9-b394-88ea-4e371f3a7e72@dev.mellanox.co.il> Date: Fri, 20 Oct 2017 11:22:48 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US 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 to be able to obtain CapabilityMask and CapabilityMask2 as these fields are not used on switch external ports (only on switch port 0) Signed-off-by: Hal Rosenstock --- src/ibdiag_common.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 9245146..c33cacc 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -506,8 +506,18 @@ int is_port_info_extended_supported(ib_portid_t * dest, int port, uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; uint32_t cap_mask; uint16_t cap_mask2; + int type, portnum; - if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport)) + if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) + IBEXIT("node info query failed"); + + mad_decode_field(data, IB_NODE_TYPE_F, &type); + if (type == IB_NODE_SWITCH) + portnum = 0; + else + portnum = port; + + if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) IBEXIT("port info query failed"); mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask);