From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
To: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 04/5 V2] infiniband-diags: ibqueryerrors --data; show/clear PortCountersExtended when supported
Date: Thu, 28 Apr 2011 14:58:32 -0700 [thread overview]
Message-ID: <20110428145832.ff37efb0.weiny2@llnl.gov> (raw)
In-Reply-To: <4DB97DB2.5010808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Date: Tue, 26 Apr 2011 22:59:15 -0700
Subject: [PATCH 04/5 V2] infiniband-diags: ibqueryerrors --data; show/clear PortCountersExtended when supported
Chages in V2:
Only print/clear Unicast/Multicast fields when IsExtendedWidthSupported is
indicated.
Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
---
src/ibqueryerrors.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 88 insertions(+), 7 deletions(-)
diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c
index 71fb5f6..4445afc 100644
--- a/src/ibqueryerrors.c
+++ b/src/ibqueryerrors.c
@@ -340,7 +340,7 @@ static int query_and_dump(char *buf, size_t size, ib_portid_t * portid,
static int print_results(ib_portid_t * portid, char *node_name,
ibnd_node_t * node, uint8_t * pc, int portnum,
- int *header_printed)
+ int *header_printed, uint8_t *pce, uint16_t cap_mask)
{
char buf[1024];
char *str = buf;
@@ -389,15 +389,29 @@ static int print_results(ib_portid_t * portid, char *node_name,
/* if we found errors. */
if (n != 0) {
- if (data_counters)
- for (i = IB_PC_XMT_BYTES_F; i <= IB_PC_RCV_PKTS_F; i++) {
+ if (data_counters) {
+ uint8_t *pkt = pc;
+ int start_field = IB_PC_XMT_BYTES_F;
+ int end_field = IB_PC_RCV_PKTS_F;
+
+ if (pce) {
+ pkt = pce;
+ start_field = IB_PC_EXT_XMT_BYTES_F;
+ if (cap_mask & IB_PM_EXT_WIDTH_SUPPORTED)
+ end_field = IB_PC_EXT_RCV_MPKTS_F;
+ else
+ end_field = IB_PC_EXT_RCV_PKTS_F;
+ }
+
+ for (i = start_field; i <= end_field; i++) {
uint64_t val64 = 0;
- mad_decode_field(pc, i, (void *)&val64);
+ mad_decode_field(pkt, i, (void *)&val64);
if (val64)
n += snprintf(str + n, 1024 - n,
- " [%s == %" PRIu64 "]",
- mad_field_name(i), val64);
+ " [%s == %" PRIu64 "]",
+ mad_field_name(i), val64);
}
+ }
if (!*header_printed) {
printf("Errors for 0x%" PRIx64 " \"%s\"\n", node->guid,
@@ -445,8 +459,11 @@ static int print_port(ib_portid_t * portid, uint16_t cap_mask, char *node_name,
ibnd_node_t * node, int portnum, int *header_printed)
{
uint8_t pc[1024];
+ uint8_t pce[1024];
+ uint8_t *pc_ext = NULL;
memset(pc, 0, 1024);
+ memset(pce, 0, 1024);
if (!pma_query_via(pc, portid, portnum, ibd_timeout,
IB_GSI_PORT_COUNTERS, ibmad_port)) {
@@ -454,13 +471,62 @@ static int print_port(ib_portid_t * portid, uint16_t cap_mask, char *node_name,
node_name, portid2str(portid), portnum);
return (0);
}
+
+ if (cap_mask & (IB_PM_EXT_WIDTH_SUPPORTED | IB_PM_EXT_WIDTH_NOIETF_SUP)) {
+ if (!pma_query_via(pce, portid, portnum, ibd_timeout,
+ IB_GSI_PORT_COUNTERS_EXT, ibmad_port)) {
+ IBWARN("IB_GSI_PORT_COUNTERS_EXT query failed on %s, %s port %d",
+ node_name, portid2str(portid), portnum);
+ return (0);
+ }
+ pc_ext = pce;
+ }
+
if (!(cap_mask & IB_PM_PC_XMIT_WAIT_SUP)) {
/* if PortCounters:PortXmitWait not supported clear this counter */
uint32_t foo = 0;
mad_encode_field(pc, IB_PC_XMT_WAIT_F, &foo);
}
return (print_results(portid, node_name, node, pc, portnum,
- header_printed));
+ header_printed, pc_ext, cap_mask));
+}
+
+uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t * dest,
+ int port, unsigned mask, unsigned timeout,
+ const struct ibmad_port * srcport)
+{
+ ib_rpc_t rpc = { 0 };
+ int lid = dest->lid;
+
+ DEBUG("lid %u port %d mask 0x%x", lid, port, mask);
+
+ if (lid == -1) {
+ IBWARN("only lid routed is supported");
+ return NULL;
+ }
+
+ if (!mask)
+ mask = ~0;
+
+ rpc.mgtclass = IB_PERFORMANCE_CLASS;
+ rpc.method = IB_MAD_METHOD_SET;
+ rpc.attr.id = IB_GSI_PORT_COUNTERS_EXT;
+
+ memset(rcvbuf, 0, IB_MAD_SIZE);
+
+ /* Same for attribute IDs */
+ mad_set_field(rcvbuf, 0, IB_PC_EXT_PORT_SELECT_F, port);
+ mad_set_field(rcvbuf, 0, IB_PC_EXT_COUNTER_SELECT_F, mask);
+ rpc.attr.mod = 0;
+ rpc.timeout = timeout;
+ rpc.datasz = IB_PC_DATA_SZ;
+ rpc.dataoffs = IB_PC_DATA_OFFS;
+ if (!dest->qp)
+ dest->qp = 1;
+ if (!dest->qkey)
+ dest->qkey = IB_DEFAULT_QP1_QKEY;
+
+ return mad_rpc(srcport, &rpc, dest, rcvbuf, rcvbuf);
}
static void clear_port(ib_portid_t * portid, uint16_t cap_mask,
@@ -497,6 +563,21 @@ static void clear_port(ib_portid_t * portid, uint16_t cap_mask,
IB_GSI_PORT_RCV_ERROR_DETAILS,
ibmad_port);
}
+
+ if (clear_counts &&
+ (cap_mask &
+ (IB_PM_EXT_WIDTH_SUPPORTED | IB_PM_EXT_WIDTH_NOIETF_SUP))) {
+ if (cap_mask & IB_PM_EXT_WIDTH_SUPPORTED)
+ mask = 0xFF;
+ else
+ mask = 0x0F;
+
+ if (!reset_pc_ext(pc, portid, port, mask, ibd_timeout,
+ ibmad_port))
+ IBERROR("Failed to reset extended data counters %s, "
+ "%s port %d", node_name, portid2str(portid),
+ port);
+ }
}
void print_node(ibnd_node_t * node, void *user_data)
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2011-04-28 21:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 1:46 [PATCH 04/5] infiniband-diags: ibqueryerrors --data; show/clear PortCountersExtended when supported Ira Weiny
[not found] ` <20110427184656.797179ed.weiny2-i2BcT+NCU+M@public.gmane.org>
2011-04-28 14:46 ` Hal Rosenstock
[not found] ` <4DB97DB2.5010808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-04-28 16:54 ` Ira Weiny
2011-04-28 21:58 ` Ira Weiny [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110428145832.ff37efb0.weiny2@llnl.gov \
--to=weiny2-i2bct+ncu+m@public.gmane.org \
--cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox