From patchwork Tue Nov 28 22:12:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 10081181 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 29EBD60353 for ; Tue, 28 Nov 2017 22:12:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C9CA2970D for ; Tue, 28 Nov 2017 22:12:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1196929713; Tue, 28 Nov 2017 22:12:24 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 C1DDE2970D for ; Tue, 28 Nov 2017 22:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752224AbdK1WMW (ORCPT ); Tue, 28 Nov 2017 17:12:22 -0500 Received: from mail-qk0-f182.google.com ([209.85.220.182]:38289 "EHLO mail-qk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752202AbdK1WMV (ORCPT ); Tue, 28 Nov 2017 17:12:21 -0500 Received: by mail-qk0-f182.google.com with SMTP id z203so1944747qkb.5 for ; Tue, 28 Nov 2017 14:12:21 -0800 (PST) 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=7dgEWMPEzOeX5Sfmc9pt/LaizR4g+iCGu8rtTe1yPIc=; b=r8PoNYSb3KOJDYpSRebKH2xyniCp7SaVLy2FyH5+5s1O0okbtAo4yngTsyrrXRrgMl Ug4wxb+ncARjLCmTfva5RFPO3RiC7NKRUVM53t3eXa39yqzRfmIXore0n/kkpMuAGu0+ zEe/9FYyp5WQHmBgJ+m+Hzomhl1bOZWnJVJgOH1DjTpphVzfvav+dQ9jN8Swl42beUsC dkCwUgTW9ntTdpQutFB1+otWRTU18dll2ku3sCZAcLC0ddyKWQeXghqhQIe54JRF3tET ILeFOPTC6JJ0okxmw2w0VvQcQ2mA4B9hWkfy9j1lLex4Dwh1fEOlWmKFJFJsyIQdiver JxSw== 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=7dgEWMPEzOeX5Sfmc9pt/LaizR4g+iCGu8rtTe1yPIc=; b=KQlqs9vr7fNESG43r78l4OfuohUqwubtoYqpzW8+5dsdQTGv6ZSKVnX9H+WHgWRUsQ a1zV4J158bUAlRMicobYOa0f/x0ANnFeLb6wDuEhyCS8Yaj8nAwunQRWMiIt8DMr++Og UujfF9IP1WvEaglguCTerO34QlHLdvsQ75/rwuGlTVg5HRGYj7NgOULRyYpS87uptnPA w6tWIACQjkYpzCs0oNJj4OpHZNOKCDnka4hWCfuywkvOCIinAc8RDNC7AJ+APAMrxjD/ qkJl5v0ziGJ9mIapxPhyPaIH9UY4SGtYt+984WhU/Bh4tqxbbByGj/+Ag/RmbWs0MNc4 Uyfw== X-Gm-Message-State: AJaThX7I3ApYI8CHCirRJVYZh9e1X8a/LVgk3Ho+VZRn0Mppdxjw+3bA 1uN1NEblTbWJZkCkBXfNO1Rcb7f9 X-Google-Smtp-Source: AGs4zMZbLNj25MNjrRzLa53ad+s9eTAotgUVKIv7KQ2w3WrBfShdntdojubGd4237VTtCsgQu6mi9w== X-Received: by 10.55.3.130 with SMTP id 124mr1121194qkd.197.1511907140582; Tue, 28 Nov 2017 14:12:20 -0800 (PST) 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 p34sm172523qkh.28.2017.11.28.14.12.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 14:12:20 -0800 (PST) To: "Weiny, Ira" Cc: "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags 6/6] ibdiag_common.c: In is_port_info_extended_supported, query PortInfo for port 0 when node is a switch Message-ID: <372d2c64-ce18-4264-267b-294bac8524be@dev.mellanox.co.il> Date: Tue, 28 Nov 2017 17:12:19 -0500 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 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);