From patchwork Mon Mar 27 15: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: 9647063 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 13ECF602D6 for ; Mon, 27 Mar 2017 15:46:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03A3428450 for ; Mon, 27 Mar 2017 15:46:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBBE22845F; Mon, 27 Mar 2017 15:46:05 +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 2A6A528450 for ; Mon, 27 Mar 2017 15:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753091AbdC0PqE (ORCPT ); Mon, 27 Mar 2017 11:46:04 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36510 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbdC0PqE (ORCPT ); Mon, 27 Mar 2017 11:46:04 -0400 Received: by mail-wr0-f193.google.com with SMTP id u1so14456477wra.3 for ; Mon, 27 Mar 2017 08:46:02 -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=BRvMDnBjvXBTkueoGQy0IK5BKeMik557oTE9BngRZCM=; b=icHinh1r7CaDfVLL4EUxdoWF3+LFCYW7UteTbMLHxUi6UtUNmnPT0zmy25wCnMxDzB ue5pRh7v28ufbPKEcPMYbzjZwtaeo/6NTuMdMy3kJg/k0m7VdGEfyj32cKjYotKpYy+g FjOqxRZd8tCeBxiySHTWI5XoaSbRzgy9+OFcr0+us5TTUxfTHkvXRxUjSyCqWr4Li5sU +8AOkSN+jX7kg/FbWHrpcX/Gh2+LjvdP87qilxIO7NsrxcWNm4E5isoM6lkUU6G7Ms/O dEpIdMMqdWwTWVeaXwZItlH/AWfKNIScS5Z6XohB2pv+VzS5EO0SiXXBe3FIRyo+kPa6 yHgQ== 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=BRvMDnBjvXBTkueoGQy0IK5BKeMik557oTE9BngRZCM=; b=FjC3H2IDF3dNa3T5CIm+mpDoWvyLZ8JkGfE9cSFL2EBdqLqVUUUSVIeApnoJh2RD9+ JrBJJ7hU3gttzRAJ0rYFqZm83MR4PH+35BA+1zabIvNs+EEeJgWzMDQLj2b1ZQ8cb8hj HLkgmvA8n4jJnA50Opu/yQRVIrRdsZUhEmmGokQhvmJ94gYmBLT2vklATDOGjDWjYbDd cJPpIU8bt5utIm3FxtC/4Oz0BRa75UHpkUJfdDreIRI0oY7/n0VHqqa58LcVqCql1Gsb ZKosKxAFlEBKwq5cKyxdz2ID4NW3ukECvdY2clMwfuqujgW/UQtQ7U4klQySDJRsLuJh I/sQ== X-Gm-Message-State: AFeK/H1zJBMNnaqOcu5VZXn91P6nlR9Id12o3NfA/wCSC6J5b09y6Z6Zn0aenTi4pElclQ== X-Received: by 10.223.171.239 with SMTP id s102mr20413627wrc.23.1490629029499; Mon, 27 Mar 2017 08:37:09 -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 y107sm1168740wrc.35.2017.03.27.08.37.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Mar 2017 08:37:08 -0700 (PDT) To: "Weiny, Ira" Cc: Oded Nissan , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags 2/3] perfquery.c: Add support for additional counters in PortCountersExtended Message-ID: Date: Mon, 27 Mar 2017 11:37:06 -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);