From patchwork Tue Mar 28 14:56:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 9649899 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 CC70560113 for ; Tue, 28 Mar 2017 14:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF45120453 for ; Tue, 28 Mar 2017 14:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C5D2654B; Tue, 28 Mar 2017 14:56:59 +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 58BA027F54 for ; Tue, 28 Mar 2017 14:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754071AbdC1O4l (ORCPT ); Tue, 28 Mar 2017 10:56:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34594 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754013AbdC1O4k (ORCPT ); Tue, 28 Mar 2017 10:56:40 -0400 Received: by mail-wm0-f66.google.com with SMTP id u132so162804wmg.1 for ; Tue, 28 Mar 2017 07:56:38 -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-transfer-encoding; bh=dWZiSOvIV0YoK7vF2G663dtBPl5/GYaRLt35zu9eEro=; b=0F1Nd7xCi4FDMf0xjBIMHYay7eEcUXUjseFy3Xx2gwAr89PwOk5uakFVUdQoVMweKl GOrLEkbEh9OlDPu5CEvg31/tqFpooRw3SeprEwFE8PUAf1tgzD6ZU5fXxm2Bf5+TV5y6 raXWG1n/GQHkG1Q9djaHqdjyrcyxCfYHAgWojQbj0km1eXIxrzTjZioqj6JgkfoTUS5A eAUNHDrPxcRyHsP7TpSQfJ1/GN/KPi7C46dOi0cS77JKHBvAQnVr9yTJ9/MnvxKgjrzH dacvIZBruH7S0dvyKhHmfk00plQvGODA4iO5TGoNCcbKYvqgiStQRlZ7o+aurmJRAUnh wTng== 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-transfer-encoding; bh=dWZiSOvIV0YoK7vF2G663dtBPl5/GYaRLt35zu9eEro=; b=mPJrufS30jORe8aImeRAiNE7UIAsCC04tnBndyKAKZ5Y4N1ONCLw0TpsXmVwqx3vgT LVZcBIhUK+86NWqVLErwBc0hMo4bOQXtZ0EEd16ldviG2Ju9Cp5nuEqlHJTcpUTyV0aZ N9QJPJdARy40owq2t0O2CGeD1rAYuSsAMVphe3WoGVd5/jBTNlsEcD5VXYrB5Z+cBU// sR6ye7t5TLBidjVEdqJTPClDnerV5egR1F4wy+hnKnIrknDi4PXkf4eNtAsQo23O+AHw FdCW90Bgdd4jXuHdDZ/VQMTUT35cFBbtu+G+INdUzOUuL3MXTGQw1pHae3H4Ghl/EHDH m72A== X-Gm-Message-State: AFeK/H1Cfoh5a/Qg7xUYk5e4xuzU3pEsJghzlhUceq/oMAV1CWK9ELr52YuCYB6SL2XH0Q== X-Received: by 10.28.86.68 with SMTP id k65mr14881137wmb.112.1490712983973; Tue, 28 Mar 2017 07:56:23 -0700 (PDT) Received: from [192.168.1.183] (c-67-189-170-197.hsd1.ma.comcast.net. [67.189.170.197]) by smtp.googlemail.com with ESMTPSA id q4sm3988410wme.17.2017.03.28.07.56.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 07:56:23 -0700 (PDT) To: "Weiny, Ira" Cc: Oded Nissan , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH RESEND infiniband-diags 2/3] perfquery.c: Add support for additional counters in PortCountersExtended Message-ID: Date: Tue, 28 Mar 2017 10:56:20 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 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: Oded Nissan Support aggregation when AllPortSelect is not supported and reset of those counters. Signed-off-by: Oded Nissan Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index 587dcfe..08bbf6b 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -81,6 +81,15 @@ extern char *ibd_nd_format; #define IS_PM_RSFEC_COUNTERS_SUP (CL_HTON16(((uint16_t)1)<<14)) #endif +#ifndef IB_PM_IS_QP1_DROP_SUP +#define IB_PM_IS_QP1_DROP_SUP (CL_HTON16(((uint16_t)1)<<15)) +#endif + +/* PM ClassPortInfo CapabilityMask2 Bits */ +#ifndef IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP +#define IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP (CL_HTON32(((uint32_t)1)<<1)) +#endif + /* SM PortInfo CapabilityMask2 Bits */ #ifndef IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED #define IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED (CL_HTON16(0x0002)) diff --git a/src/perfquery.c b/src/perfquery.c index 948ce52..bc3dbf4 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -85,13 +85,30 @@ struct perf_count_ext { uint64_t portunicastrcvpkts; uint64_t portmulticastxmitpkits; uint64_t portmulticastrcvpkts; + + uint32_t counterSelect2; + uint64_t symbolErrorCounter; + uint64_t linkErrorRecoveryCounter; + uint64_t linkDownedCounter; + uint64_t portRcvErrors; + uint64_t portRcvRemotePhysicalErrors; + uint64_t portRcvSwitchRelayErrors; + uint64_t portXmitDiscards; + uint64_t portXmitConstraintErrors; + uint64_t portRcvConstraintErrors; + uint64_t localLinkIntegrityErrors; + uint64_t excessiveBufferOverrunErrors; + uint64_t VL15Dropped; + uint64_t portXmitWait; + uint64_t QP1Dropped; }; static uint8_t pc[1024]; struct perf_count perf_count = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -struct perf_count_ext perf_count_ext = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +struct perf_count_ext perf_count_ext = + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #define ALL_PORTS 0xFF #define MAX_PORTS 255 @@ -228,7 +245,7 @@ static void output_aggregate_perfcounters(ib_portid_t * portid, portid2str(portid), ALL_PORTS, ntohs(cap_mask), buf); } -static void aggregate_perfcounters_ext(uint16_t cap_mask) +static void aggregate_perfcounters_ext(uint16_t cap_mask, uint32_t cap_mask2) { uint32_t val; uint64_t val64; @@ -256,10 +273,43 @@ static void aggregate_perfcounters_ext(uint16_t cap_mask) mad_decode_field(pc, IB_PC_EXT_RCV_MPKTS_F, &val64); aggregate_64bit(&perf_count_ext.portmulticastrcvpkts, val64); } + + if (htonl(cap_mask2) & IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP) { + mad_decode_field(pc, IB_PC_EXT_COUNTER_SELECT2_F, &val); + perf_count_ext.counterSelect2 = val; + mad_decode_field(pc, IB_PC_EXT_ERR_SYM_F, &val64); + aggregate_64bit(&perf_count_ext.symbolErrorCounter, val64); + mad_decode_field(pc, IB_PC_EXT_LINK_RECOVERS_F, &val64); + aggregate_64bit(&perf_count_ext.linkErrorRecoveryCounter, val64); + mad_decode_field(pc, IB_PC_EXT_LINK_DOWNED_F, &val64); + aggregate_64bit(&perf_count_ext.linkDownedCounter, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_RCV_F, &val64); + aggregate_64bit(&perf_count_ext.portRcvErrors, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_PHYSRCV_F, &val64); + aggregate_64bit(&perf_count_ext.portRcvRemotePhysicalErrors, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_SWITCH_REL_F, &val64); + aggregate_64bit(&perf_count_ext.portRcvSwitchRelayErrors, val64); + mad_decode_field(pc, IB_PC_EXT_XMT_DISCARDS_F, &val64); + aggregate_64bit(&perf_count_ext.portXmitDiscards, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_XMTCONSTR_F, &val64); + aggregate_64bit(&perf_count_ext.portXmitConstraintErrors, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_RCVCONSTR_F, &val64); + aggregate_64bit(&perf_count_ext.portRcvConstraintErrors, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_LOCALINTEG_F, &val64); + aggregate_64bit(&perf_count_ext.localLinkIntegrityErrors, val64); + mad_decode_field(pc, IB_PC_EXT_ERR_EXCESS_OVR_F, &val64); + aggregate_64bit(&perf_count_ext.excessiveBufferOverrunErrors, val64); + mad_decode_field(pc, IB_PC_EXT_VL15_DROPPED_F, &val64); + aggregate_64bit(&perf_count_ext.VL15Dropped, val64); + mad_decode_field(pc, IB_PC_EXT_XMT_WAIT_F, &val64); + aggregate_64bit(&perf_count_ext.portXmitWait, val64); + mad_decode_field(pc, IB_PC_EXT_QP1_DROP_F, &val64); + aggregate_64bit(&perf_count_ext.QP1Dropped, val64); + } } static void output_aggregate_perfcounters_ext(ib_portid_t * portid, - uint16_t cap_mask) + uint16_t cap_mask, uint32_t cap_mask2) { char buf[1024]; uint32_t val = ALL_PORTS; @@ -289,10 +339,43 @@ static void output_aggregate_perfcounters_ext(ib_portid_t * portid, &perf_count_ext.portmulticastrcvpkts); } + if (htonl(cap_mask2) & IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP) { + mad_encode_field(pc, IB_PC_EXT_COUNTER_SELECT2_F, + &perf_count_ext.counterSelect2); + mad_encode_field(pc, IB_PC_EXT_ERR_SYM_F, + &perf_count_ext.symbolErrorCounter); + mad_encode_field(pc, IB_PC_EXT_LINK_RECOVERS_F, + &perf_count_ext.linkErrorRecoveryCounter); + mad_encode_field(pc, IB_PC_EXT_LINK_DOWNED_F, + &perf_count_ext.linkDownedCounter); + mad_encode_field(pc, IB_PC_EXT_ERR_RCV_F, + &perf_count_ext.portRcvErrors); + mad_encode_field(pc, IB_PC_EXT_ERR_PHYSRCV_F, + &perf_count_ext.portRcvRemotePhysicalErrors); + mad_encode_field(pc, IB_PC_EXT_ERR_SWITCH_REL_F, + &perf_count_ext.portRcvSwitchRelayErrors); + mad_encode_field(pc, IB_PC_EXT_XMT_DISCARDS_F, + &perf_count_ext.portXmitDiscards); + mad_encode_field(pc, IB_PC_EXT_ERR_XMTCONSTR_F, + &perf_count_ext.portXmitConstraintErrors); + mad_encode_field(pc, IB_PC_EXT_ERR_RCVCONSTR_F, + &perf_count_ext.portRcvConstraintErrors); + mad_encode_field(pc, IB_PC_EXT_ERR_LOCALINTEG_F, + &perf_count_ext.localLinkIntegrityErrors); + mad_encode_field(pc, IB_PC_EXT_ERR_EXCESS_OVR_F, + &perf_count_ext.excessiveBufferOverrunErrors); + mad_encode_field(pc, IB_PC_EXT_VL15_DROPPED_F, + &perf_count_ext.VL15Dropped); + mad_encode_field(pc, IB_PC_EXT_XMT_WAIT_F, + &perf_count_ext.portXmitWait); + mad_encode_field(pc, IB_PC_EXT_QP1_DROP_F, + &perf_count_ext.QP1Dropped); + } + mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc); - printf("# Port extended counters: %s port %d (CapMask: 0x%02X)\n%s", - portid2str(portid), ALL_PORTS, ntohs(cap_mask), buf); + printf("# Port extended counters: %s port %d (CapMask: 0x%02X CapMask2: 0x%07X)\n%s", + portid2str(portid), ALL_PORTS, ntohs(cap_mask), cap_mask2, buf); } static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask, @@ -336,7 +419,7 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask, IB_GSI_PORT_COUNTERS_EXT, srcport)) IBEXIT("perfextquery"); if (aggregate) - aggregate_perfcounters_ext(cap_mask); + aggregate_perfcounters_ext(cap_mask, cap_mask2); else mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc); @@ -958,7 +1041,7 @@ int main(int argc, char **argv) cap_mask); else output_aggregate_perfcounters_ext(&portid, - cap_mask); + cap_mask, cap_mask2); } } else if (ports_count > 1) { for (i = 0; i < ports_count; i++) @@ -971,7 +1054,7 @@ int main(int argc, char **argv) cap_mask); else output_aggregate_perfcounters_ext(&portid, - cap_mask); + cap_mask, cap_mask2); } } else dump_perfcounters(extended, ibd_timeout, cap_mask, cap_mask2, @@ -984,6 +1067,14 @@ do_reset: if (argc <= 2 && !extended && (cap_mask & IB_PM_PC_XMIT_WAIT_SUP)) mask |= (1 << 16); /* reset portxmitwait */ + if (extended) { + mask |= 0xfff0000; + if (cap_mask & IB_PM_PC_XMIT_WAIT_SUP) + mask |= (1 << 28); + if (cap_mask & IB_PM_IS_QP1_DROP_SUP) + mask |= (1 << 29); + } + if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { for (i = start_port; i <= num_ports; i++) reset_counters(extended, ibd_timeout, mask, &portid, i);