From patchwork Thu Dec 31 19:10:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 70419 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 nBVJEEwk005684 for ; Thu, 31 Dec 2009 19:14:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753117AbZLaTOO (ORCPT ); Thu, 31 Dec 2009 14:14:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753130AbZLaTOO (ORCPT ); Thu, 31 Dec 2009 14:14:14 -0500 Received: from qmta04.westchester.pa.mail.comcast.net ([76.96.62.40]:39075 "EHLO QMTA04.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117AbZLaTON (ORCPT ); Thu, 31 Dec 2009 14:14:13 -0500 Received: from OMTA06.westchester.pa.mail.comcast.net ([76.96.62.51]) by QMTA04.westchester.pa.mail.comcast.net with comcast id Pt4J1d00B16LCl054vED6k; Thu, 31 Dec 2009 19:14:13 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA06.westchester.pa.mail.comcast.net with comcast id PvEC1d00D0hNrtn3SvEDsp; Thu, 31 Dec 2009 19:14:13 +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 nBVJBSUn027911; Thu, 31 Dec 2009 14:11:32 -0500 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id nBVJAsGE027879; Thu, 31 Dec 2009 14:10:54 -0500 Date: Thu, 31 Dec 2009 14:10:54 -0500 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] infiniband-diags/ibqueryerrors: Add support for optional PortRcvErrorDetails counter Message-ID: <20091231191054.GA27874@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/ibqueryerrors.8 b/infiniband-diags/man/ibqueryerrors.8 index 83a2b5a..e7feea8 100644 --- a/infiniband-diags/man/ibqueryerrors.8 +++ b/infiniband-diags/man/ibqueryerrors.8 @@ -1,4 +1,4 @@ -.TH IBQUERYERRORS 8 "Oct 30, 2009" "OpenIB" "OpenIB Diagnostics" +.TH IBQUERYERRORS 8 "Dec 31, 2009" "OpenIB" "OpenIB Diagnostics" .SH NAME ibqueryerrors \- query and report non-zero IB port counters @@ -58,7 +58,7 @@ printed or not. This is because data counters are only \fBprinted\fR on ports which have errors. This means if a port has 0 errors and the \-K option is specified the data counters will be cleared without any printed output. .TP -\fB\-\-details\fR include transmit discard details +\fB\-\-details\fR include receive error and transmit discard details .TP \fB\-R\fR (This option is obsolete and does nothing) diff --git a/infiniband-diags/src/ibqueryerrors.c b/infiniband-diags/src/ibqueryerrors.c index 47bd2af..ceacc58 100644 --- a/infiniband-diags/src/ibqueryerrors.c +++ b/infiniband-diags/src/ibqueryerrors.c @@ -205,24 +205,31 @@ static void report_suppressed(void) printf("\n"); } -static int print_xmitdisc_details(char *buf, size_t size, ib_portid_t * portid, - ibnd_node_t * node, char *node_name, - int portnum) +static int print_details(char *buf, size_t size, ib_portid_t * portid, + ibnd_node_t * node, char *node_name, int portnum, + int j) { uint8_t pc[1024]; uint32_t val = 0; int i, n; + if (j != IB_PC_ERR_RCV_F && j!= IB_PC_XMT_DISCARDS_F) + return 0; + memset(pc, 0, 1024); if (!pma_query_via(pc, portid, portnum, ibd_timeout, - IB_GSI_PORT_XMIT_DISCARD_DETAILS, ibmad_port)) { - IBWARN("IB_GSI_PORT_XMIT_DISCARD_DETAILS query failed on %s, " - "%s port %d", node_name, portid2str(portid), portnum); + (j == IB_PC_ERR_RCV_F ? IB_GSI_PORT_RCV_ERROR_DETAILS : IB_GSI_PORT_XMIT_DISCARD_DETAILS), + ibmad_port)) { + IBWARN("%s query failed on %s, %s port %d", + (j == IB_PC_ERR_RCV_F ? "IB_GSI_PORT_RCV_ERROR_DETAILS" : "IB_GSI_PORT_XMIT_DISCARD_DETAILS"), + node_name, portid2str(portid), portnum); return 0; } - for (n = 0, i = IB_PC_XMT_INACT_DISC_F; i <= IB_PC_XMT_SW_HOL_DISC_F; + for (n = 0, + i = (j == IB_PC_ERR_RCV_F ? IB_PC_RCV_LOCAL_PHY_ERR_F : IB_PC_XMT_INACT_DISC_F); + i <= (j == IB_PC_ERR_RCV_F ? IB_PC_RCV_LOOPING_ERR_F : IB_PC_XMT_SW_HOL_DISC_F); i++) { mad_decode_field(pc, i, (void *)&val); if (val) @@ -254,10 +261,14 @@ static void print_results(ib_portid_t * portid, char *node_name, n += snprintf(str + n, 1024 - n, " [%s == %u]", mad_field_name(i), val); + /* If there are PortRcvErrors, get details (if supported) */ + if (i == IB_PC_ERR_RCV_F && details && val) { + n += print_details(str + n, 1024 - n, portid, + node, node_name, portnum, i); /* If there are PortXmitDiscards, get details (if supported) */ - if (i == IB_PC_XMT_DISCARDS_F && details && val) { - n += print_xmitdisc_details(str + n, 1024 - n, portid, - node, node_name, portnum); + } else if (i == IB_PC_XMT_DISCARDS_F && details && val) { + n += print_details(str + n, 1024 - n, portid, + node, node_name, portnum, i); } } @@ -364,6 +375,10 @@ static void clear_port(ib_portid_t * portid, uint16_t cap_mask, performance_reset_via(pc, portid, port, mask, ibd_timeout, IB_GSI_PORT_XMIT_DISCARD_DETAILS, ibmad_port); + mask = 0x3F; + performance_reset_via(pc, portid, port, mask, ibd_timeout, + IB_GSI_PORT_RCV_ERROR_DETAILS, + ibmad_port); } }