From patchwork Thu Jan 14 14:13:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 72837 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0EEJMWS030823 for ; Thu, 14 Jan 2010 14:19:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669Ab0ANOTW (ORCPT ); Thu, 14 Jan 2010 09:19:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751621Ab0ANOTW (ORCPT ); Thu, 14 Jan 2010 09:19:22 -0500 Received: from qmta04.westchester.pa.mail.comcast.net ([76.96.62.40]:56440 "EHLO qmta04.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476Ab0ANOTV (ORCPT ); Thu, 14 Jan 2010 09:19:21 -0500 Received: from omta05.westchester.pa.mail.comcast.net ([76.96.62.43]) by qmta04.westchester.pa.mail.comcast.net with comcast id VQPo1d0020vyq2s54SKMCA; Thu, 14 Jan 2010 14:19:21 +0000 Received: from hal.comcast.net ([75.69.247.31]) by omta05.westchester.pa.mail.comcast.net with comcast id VSKL1d00A0hNrtn3RSKLEt; Thu, 14 Jan 2010 14:19:21 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id o0EEEiua012222; Thu, 14 Jan 2010 09:14:49 -0500 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id o0EEDOsO012192; Thu, 14 Jan 2010 09:13:24 -0500 Date: Thu, 14 Jan 2010 09:13:24 -0500 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] infiniband-diags/perfquery: Add support for PortSamplesControl counter Message-ID: <20100114141324.GB12180@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/infiniband-diags/man/perfquery.8 b/infiniband-diags/man/perfquery.8 index 56615b9..7e9636e 100644 --- a/infiniband-diags/man/perfquery.8 +++ b/infiniband-diags/man/perfquery.8 @@ -6,7 +6,7 @@ perfquery \- query InfiniBand port counters .SH SYNOPSIS .B perfquery [\-d(ebug)] [\-G(uid)] [\-x|\-\-extended] [\-X|\-\-xmtsl] [\-S|\-\-rcvsl] -[\-D|\-\-xmtdisc] [\-E|\-\-rcverr] +[\-D|\-\-xmtdisc] [\-E|\-\-rcverr] [\-c|\-\-smplctl] [-a(ll_ports)] [-l(oop_ports)] [-r(eset_after_read)] [-R(eset_only)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)] [ [[port] [reset_mask]]] @@ -45,6 +45,12 @@ show transmit discard details. This is an optional counter. \fB\-E\fR, \fB\-\-rcverr\fR show receive error details. This is an optional counter. .TP +\fB\-D\fR, \fB\-\-xmtdisc\fR +show transmit discard details. This is an optional counter. +.TP +\fB\-c\fR, \fB\-\-smplctl\fR +show port samples control. +.TP \fB\-a\fR, \fB\-\-all_ports\fR show aggregated counters for all ports of the destination lid or reset all counters for all ports. If the destination lid diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c index 2a48c6f..9937e30 100644 --- a/infiniband-diags/src/perfquery.c +++ b/infiniband-diags/src/perfquery.c @@ -344,7 +344,7 @@ static void reset_counters(int extended, int timeout, int mask, } static int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl, - rcv_sl, xmt_disc, rcv_err; + rcv_sl, xmt_disc, rcv_err, smpl_ctl; static void common_func(ib_portid_t *portid, int port_num, int mask, unsigned query, unsigned reset, @@ -397,6 +397,19 @@ static void rcv_err_query(ib_portid_t * portid, int port, int mask) mad_dump_perfcounters_rcv_err); } +void dump_portsamples_control(ib_portid_t * portid, int port) +{ + char buf[1024]; + + if (!pma_query_via(pc, portid, port, ibd_timeout, + IB_GSI_PORT_SAMPLES_CONTROL, srcport)) + IBERROR("sampctlquery"); + + mad_dump_portsamples_control(buf, sizeof buf, pc, sizeof pc); + printf("# PortSamplesControl: %s port %d\n%s", portid2str(portid), + port, buf); +} + static int process_opt(void *context, int ch, char *optarg) { switch (ch) { @@ -415,6 +428,9 @@ static int process_opt(void *context, int ch, char *optarg) case 'E': rcv_err = 1; break; + case 'c': + smpl_ctl = 1; + break; case 'a': all_ports++; port = ALL_PORTS; @@ -455,6 +471,7 @@ int main(int argc, char **argv) {"rcvsl", 'S', 0, NULL, "show Rcv SL port counters"}, {"xmtdisc", 'D', 0, NULL, "show Xmt Discard Details"}, {"rcverr", 'E', 0, NULL, "show Rcv Error Details"}, + {"smplctl", 'c', 0, NULL, "show samples control"}, {"all_ports", 'a', 0, NULL, "show aggregated counters"}, {"loop_ports", 'l', 0, NULL, "iterate through each port"}, {"reset_after_read", 'r', 0, NULL, "reset counters after read"}, @@ -535,6 +552,11 @@ int main(int argc, char **argv) goto done; } + if (smpl_ctl) { + dump_portsamples_control(&portid, port); + goto done; + } + if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0, srcport) < 0)