From patchwork Thu Jun 22 14:37:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 9804545 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 ACBA560386 for ; Thu, 22 Jun 2017 14:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CFF1286A4 for ; Thu, 22 Jun 2017 14:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91C88286B0; Thu, 22 Jun 2017 14:37:19 +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 D88E7286A4 for ; Thu, 22 Jun 2017 14:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbdFVOhR (ORCPT ); Thu, 22 Jun 2017 10:37:17 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34753 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbdFVOhP (ORCPT ); Thu, 22 Jun 2017 10:37:15 -0400 Received: by mail-wr0-f195.google.com with SMTP id k67so5126297wrc.1 for ; Thu, 22 Jun 2017 07:37:14 -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=Bi4eBKMaHR6bp6f1HmTJlELIQBQHvryxHzqHtOdtk7Y=; b=IMxXUsS5LHfB/aYSQttkPVUc5WL2itGcQNTlEs8/d832Y+UCKxQjfxr0lj+DBi4QJm eWQduKDTByQOyUK7CQaYIs4PQ2PxHaZ30xXLdKkzhqDf3bUFuuJvrg0YlQDs2RNYEi1n bZSq9mX6ZCkqoeheqDY0Hq2Y2EmDf+Vf0/XxYcLmAOOxKPemhEiUMofXYYhCZZZS1N6C i/KuCRj1zZAqCt+JEVR6WuAx2bQe15+nhnOZSmB1lL7TMAbsV5M58Ic4P4WSRAtIMNc/ nMnEU7Mpj0Sd/f+aM0Syt6yyaWQ1BqAse4aiD6xttiNRiTEPU/osQjyTfBMXBEl5+ewA y91w== 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=Bi4eBKMaHR6bp6f1HmTJlELIQBQHvryxHzqHtOdtk7Y=; b=GAytqeWD1Gok5A+XchrSmU9W+PNxZSnsTbgobyfEjL+CNySpZlr7uMoHW2rj+Xpo8N SiBXQ2m6WinHumfQ6o/yMlhNz84Naiqw0Ac19lQ9iZViPvVP8MBgPRRIkAutWpB2WF8G 43vE3reYVu/baQNpFUIZ1Qk7MwBH5oGrWgF/t8vMzvNFsFSc7KlQMFX1D2FMxMJrsaOY o28/Al+hKbLqQQCH9SOQODa6Ypb8snvqq3LNaPflOQ2/cdwPEfKqHROASP5MlIXqfmFc IwvTCtD+YCUfb1aAfosFuP+eMWYdSJLbryKFkKG1tiELNmAi07XRIeuN4cAn6OWfPflw safQ== X-Gm-Message-State: AKS2vOzBf6CeYcc81+tpsdDEk1ZXBTIzAbHTKbWz53kGFuQbdssTEJoj 64pIWx4C2icpdVzxx3Y= X-Received: by 10.223.135.29 with SMTP id a29mr2451916wra.138.1498142228687; Thu, 22 Jun 2017 07:37:08 -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 197sm1261266wmm.23.2017.06.22.07.37.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 07:37:08 -0700 (PDT) To: "Weiny, Ira" Cc: "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags 2/3] libibmad: Support the decode of PortInfo:CapabilityMask2 Message-ID: Date: Thu, 22 Jun 2017 10:37:06 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.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 IsSetNodeDescriptionSupported and IsPortInfoExtendedSupported are part of IBA 1.3 IsVirtualizationSupported was added by Annex A18: Virtualization IsSwitchPortStateTableSupported was added by MgtWG erratum #9316 IsLinkWidth2xSupported was added by MgtWG erratum #9309 Signed-off-by: Hal Rosenstock --- libibmad/include/infiniband/mad.h | 2 +- libibmad/src/dump.c | 21 +++++++++++++++++++++ libibmad/src/fields.c | 2 +- libibmad/src/libibmad.map | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h index 9bd6e20..50c5bc5 100644 --- a/libibmad/include/infiniband/mad.h +++ b/libibmad/include/infiniband/mad.h @@ -1651,7 +1651,7 @@ MAD_EXPORT ib_mad_dump_fn mad_dump_linkspeed, mad_dump_linkspeedsup, mad_dump_linkspeeden, mad_dump_linkspeedext, mad_dump_linkspeedextsup, mad_dump_linkspeedexten, mad_dump_portstate, mad_dump_portstates, - mad_dump_physportstate, mad_dump_portcapmask, + mad_dump_physportstate, mad_dump_portcapmask, mad_dump_portcapmask2, mad_dump_mtu, mad_dump_vlcap, mad_dump_opervls, mad_dump_node_type, mad_dump_sltovl, mad_dump_vlarbitration, mad_dump_nodedesc, mad_dump_nodeinfo, mad_dump_portinfo, diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c index 8e1f5d1..24878a6 100644 --- a/libibmad/src/dump.c +++ b/libibmad/src/dump.c @@ -616,6 +616,27 @@ void mad_dump_portcapmask(char *buf, int bufsz, void *val, int valsz) *(--s) = 0; } +void mad_dump_portcapmask2(char *buf, int bufsz, void *val, int valsz) +{ + int mask = *(int *)val; + char *s = buf; + + s += sprintf(s, "0x%x\n", mask); + if (mask & (1 << 0)) + s += sprintf(s, "\t\t\t\tIsSetNodeDescriptionSupported\n"); + if (mask & (1 << 1)) + s += sprintf(s, "\t\t\t\tIsPortInfoExtendedSupported\n"); + if (mask & (1 << 2)) + s += sprintf(s, "\t\t\t\tIsVirtualizationSupported\n"); + if (mask & (1 << 3)) + s += sprintf(s, "\t\t\t\tIsSwitchPortStateTableSupported\n"); + if (mask & (1 << 4)) + s += sprintf(s, "\t\t\t\tIsLinkWidth2xSupported\n"); + + if (s != buf) + *(--s) = 0; +} + void mad_dump_bitfield(char *buf, int bufsz, void *val, int valsz) { snprintf(buf, bufsz, "0x%x", *(uint32_t *) val); diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c index 8273f97..b8a5302 100644 --- a/libibmad/src/fields.c +++ b/libibmad/src/fields.c @@ -529,7 +529,7 @@ static const ib_field_t ib_mad_f[] = { /* * More PortInfo fields */ - {BITSOFFS(480, 16), "CapabilityMask2", mad_dump_hex}, + {BITSOFFS(480, 16), "CapabilityMask2", mad_dump_portcapmask2}, {BITSOFFS(496, 4), "LinkSpeedExtActive", mad_dump_linkspeedext}, {BITSOFFS(500, 4), "LinkSpeedExtSupported", mad_dump_linkspeedextsup}, {BITSOFFS(507, 5), "LinkSpeedExtEnabled", mad_dump_linkspeedexten}, diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map index 3240a7b..454e37c 100644 --- a/libibmad/src/libibmad.map +++ b/libibmad/src/libibmad.map @@ -34,6 +34,7 @@ IBMAD_1.3 { mad_dump_perfcounters_rcv_err; mad_dump_physportstate; mad_dump_portcapmask; + mad_dump_portcapmask2; mad_dump_portinfo; mad_dump_portsamples_control; mad_dump_portsamples_result;