public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
@ 2009-11-04 14:42 Hal Rosenstock
       [not found] ` <20091104144219.GA7923-Wuw85uim5zDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Hal Rosenstock @ 2009-11-04 14:42 UTC (permalink / raw)
  To: sashak-smomgflXvOZWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


When --details selected, if PortCounters has transmit discards, then
query PortXmitDiscardDetails. On reset, if --details is selected, then
PortXmitDiscardDetails will also be reset.

Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
which PortXmitDiscardDetails counters are supported so an option was added
for this.

Signed-off-by: Hal Rosenstock <hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
Changes since v1:
Better description

diff --git a/infiniband-diags/man/ibqueryerrors.8 b/infiniband-diags/man/ibqueryerrors.8
index 1352246..d5a499e 100644
--- a/infiniband-diags/man/ibqueryerrors.8
+++ b/infiniband-diags/man/ibqueryerrors.8
@@ -1,4 +1,4 @@
-.TH IBQUERYERRORS 8 "Jan 24, 2008" "OpenIB" "OpenIB Diagnostics"
+.TH IBQUERYERRORS 8 "Oct 30, 2009" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibqueryerrors.pl \- query and report non-zero IB port counters
@@ -58,6 +58,8 @@ 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
+.TP
 \fB\-R\fR  (This option is obsolete and does nothing)
 
 .SH COMMON OPTIONS
diff --git a/infiniband-diags/src/ibqueryerrors.c b/infiniband-diags/src/ibqueryerrors.c
index f83f29e..61a34e4 100644
--- a/infiniband-diags/src/ibqueryerrors.c
+++ b/infiniband-diags/src/ibqueryerrors.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
  * Copyright (c) 2008 Lawrence Livermore National Lab.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -65,7 +66,7 @@ int sup_total = 0;
 enum MAD_FIELDS *suppressed_fields = NULL;
 char *dr_path = NULL;
 uint8_t node_type_to_print = 0;
-unsigned clear_errors = 0, clear_counts = 0;
+unsigned clear_errors = 0, clear_counts = 0, details = 0;
 
 #define PRINT_SWITCH 0x1
 #define PRINT_CA     0x2
@@ -273,10 +274,35 @@ static int query_cap_mask(ib_portid_t *portid, char *node_name, int portnum,
 	return 0;
 }
 
+static void print_xmitdisc_details(ibnd_node_t * node, char * node_name,
+				   uint8_t * pc, int portnum)
+{
+	char buf[1024];
+	char *str = buf;
+	uint32_t val = 0;
+	int n = 0;
+	int i = 0;
+
+	buf[0] = 0;
+	for (n = 0, i = IB_PC_XMT_INACT_DISC_F; i <= IB_PC_XMT_SW_HOL_DISC_F; i++) {
+		mad_decode_field(pc, i, (void *)&val);
+		if (val)
+			n += snprintf(str + n, 1024 - n, " [%s == %d]",
+				      mad_field_name(i), val);
+	}
+	if (n > 0) {
+		printf("   GUID 0x%" PRIx64 " port %d:%s\n", node->guid,
+		       portnum, str);
+		if (port_config)
+			print_port_config(node_name, node, portnum);
+	}
+}
+
 static void 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];
+	uint32_t xmtdisc;
 
 	memset(pc, 0, 1024);
 
@@ -292,6 +318,19 @@ static void print_port(ib_portid_t * portid, uint16_t cap_mask, char *node_name,
 		mad_encode_field(pc, IB_PC_XMT_WAIT_F, &foo);
 	}
 	print_results(node_name, node, pc, portnum, header_printed);
+
+	/* If there are PortXmitDiscards, get details (if supported) */
+	mad_decode_field(pc, IB_PC_XMT_DISCARDS_F, &xmtdisc);
+	if (details && xmtdisc) {
+		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);
+			return;
+		}
+		print_xmitdisc_details(node, node_name, pc, portnum);
+	}
 }
 
 static void clear_port(ib_portid_t * portid, uint16_t cap_mask,
@@ -318,6 +357,13 @@ static void clear_port(ib_portid_t * portid, uint16_t cap_mask,
 				   IB_GSI_PORT_COUNTERS, ibmad_port))
 		IBERROR("Failed to reset errors %s port %d",
 			node_name, port);
+
+	if (details && clear_errors) {
+		mask = 0xF;
+		performance_reset_via(pc, portid, port, mask, ibd_timeout,
+				      IB_GSI_PORT_XMIT_DISCARD_DETAILS,
+				      ibmad_port);
+	}
 }
 
 void print_node(ibnd_node_t * node, void *user_data)
@@ -428,6 +474,9 @@ static int process_opt(void *context, int ch, char *optarg)
 	case 5:
 		node_type_to_print |= PRINT_ROUTER;
 		break;
+	case 6:
+		details = 1;
+		break;
 	case 'G':
 	case 'S':
 		node_guid_str = optarg;
@@ -484,6 +533,7 @@ int main(int argc, char **argv)
 		{"switch", 3, 0, NULL, "print data for switches only"},
 		{"ca", 4, 0, NULL, "print data for CA's only"},
 		{"router", 5, 0, NULL, "print data for routers only"},
+		{"details", 6, 0, NULL, "include transmit discard details"},
 		{"clear-errors", 'k', 0, NULL,
 		 "Clear error counters after read"},
 		{"clear-counts", 'K', 0, NULL,
--
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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
       [not found] ` <20091104144219.GA7923-Wuw85uim5zDR7s880joybQ@public.gmane.org>
@ 2009-11-06 16:59   ` Sasha Khapyorsky
  2009-11-12 20:38     ` Sasha Khapyorsky
  0 siblings, 1 reply; 8+ messages in thread
From: Sasha Khapyorsky @ 2009-11-06 16:59 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 09:42 Wed 04 Nov     , Hal Rosenstock wrote:
> 
> When --details selected, if PortCounters has transmit discards, then
> query PortXmitDiscardDetails. On reset, if --details is selected, then
> PortXmitDiscardDetails will also be reset.
> 
> Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
> which PortXmitDiscardDetails counters are supported so an option was added
> for this.

Interesting... Why so? Is it any bug in existing hw? Which one?

> Signed-off-by: Hal Rosenstock <hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied. Thanks.

Sasha
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
  2009-11-06 16:59   ` Sasha Khapyorsky
@ 2009-11-12 20:38     ` Sasha Khapyorsky
  2009-11-13 14:43       ` Hal Rosenstock
  0 siblings, 1 reply; 8+ messages in thread
From: Sasha Khapyorsky @ 2009-11-12 20:38 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 18:59 Fri 06 Nov     , Sasha Khapyorsky wrote:
> On 09:42 Wed 04 Nov     , Hal Rosenstock wrote:
> > 
> > When --details selected, if PortCounters has transmit discards, then
> > query PortXmitDiscardDetails. On reset, if --details is selected, then
> > PortXmitDiscardDetails will also be reset.
> > 
> > Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
> > which PortXmitDiscardDetails counters are supported so an option was added
> > for this.
> 
> Interesting... Why so? Is it any bug in existing hw? Which one?

Could you elaborate?

Sasha
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
  2009-11-12 20:38     ` Sasha Khapyorsky
@ 2009-11-13 14:43       ` Hal Rosenstock
       [not found]         ` <f0e08f230911130643l788ef2e5n538c123912300d42-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Hal Rosenstock @ 2009-11-13 14:43 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Thu, Nov 12, 2009 at 3:38 PM, Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org> wrote:
> On 18:59 Fri 06 Nov     , Sasha Khapyorsky wrote:
>> On 09:42 Wed 04 Nov     , Hal Rosenstock wrote:
>> >
>> > When --details selected, if PortCounters has transmit discards, then
>> > query PortXmitDiscardDetails. On reset, if --details is selected, then
>> > PortXmitDiscardDetails will also be reset.
>> >
>> > Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
>> > which PortXmitDiscardDetails counters are supported so an option was added
>> > for this.
>>
>> Interesting... Why so? Is it any bug in existing hw? Which one?
>
> Could you elaborate?

I don't think this is the forum to discuss vendor bugs.

-- Hal

>
> Sasha
> --
> 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
>
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
       [not found]         ` <f0e08f230911130643l788ef2e5n538c123912300d42-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-11-13 14:59           ` Sasha Khapyorsky
  2009-11-13 15:11             ` Hal Rosenstock
  2009-11-15  5:52             ` Or Gerlitz
  0 siblings, 2 replies; 8+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 14:59 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 09:43 Fri 13 Nov     , Hal Rosenstock wrote:
> On Thu, Nov 12, 2009 at 3:38 PM, Sasha Khapyorsky <sashak-smomgflXvObQFizaE/u3fw@public.gmane.orgm> wrote:
> > On 18:59 Fri 06 Nov     , Sasha Khapyorsky wrote:
> >> On 09:42 Wed 04 Nov     , Hal Rosenstock wrote:
> >> >
> >> > When --details selected, if PortCounters has transmit discards, then
> >> > query PortXmitDiscardDetails. On reset, if --details is selected, then
> >> > PortXmitDiscardDetails will also be reset.
> >> >
> >> > Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
> >> > which PortXmitDiscardDetails counters are supported so an option was added
> >> > for this.
> >>
> >> Interesting... Why so? Is it any bug in existing hw? Which one?
> >
> > Could you elaborate?
> 
> I don't think this is the forum to discuss vendor bugs.

Really? If so why did you post patch here which workarounds something
that you don't want to describe?

I think that it is important for developers to be aware about existing
bugs which may require workarounds. Guess that this is also important
for vendors since they likely want to have working products.

Anyway don't expect that next time I will apply things blindly.

Sasha
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
  2009-11-13 14:59           ` Sasha Khapyorsky
@ 2009-11-13 15:11             ` Hal Rosenstock
  2009-11-15  5:52             ` Or Gerlitz
  1 sibling, 0 replies; 8+ messages in thread
From: Hal Rosenstock @ 2009-11-13 15:11 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Fri, Nov 13, 2009 at 9:59 AM, Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org> wrote:
> On 09:43 Fri 13 Nov     , Hal Rosenstock wrote:
>> On Thu, Nov 12, 2009 at 3:38 PM, Sasha Khapyorsky <sashak@voltaire.com> wrote:
>> > On 18:59 Fri 06 Nov     , Sasha Khapyorsky wrote:
>> >> On 09:42 Wed 04 Nov     , Hal Rosenstock wrote:
>> >> >
>> >> > When --details selected, if PortCounters has transmit discards, then
>> >> > query PortXmitDiscardDetails. On reset, if --details is selected, then
>> >> > PortXmitDiscardDetails will also be reset.
>> >> >
>> >> > Unfortunately, PortSamplesControl:OptionMask can't be trusted to determine
>> >> > which PortXmitDiscardDetails counters are supported so an option was added
>> >> > for this.
>> >>
>> >> Interesting... Why so? Is it any bug in existing hw? Which one?
>> >
>> > Could you elaborate?
>>
>> I don't think this is the forum to discuss vendor bugs.
>
> Really? If so why did you post patch here which workarounds something
> that you don't want to describe?

I wanted to answer why it wasn't done differently (without the vendor
specifics).

> I think that it is important for developers to be aware about existing
> bugs which may require workarounds. Guess that this is also important
> for vendors since they likely want to have working products.
>
> Anyway don't expect that next time I will apply things blindly.

Didn't seem to me that anything has been applied blindly.

-- Hal

> Sasha
>
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
  2009-11-13 14:59           ` Sasha Khapyorsky
  2009-11-13 15:11             ` Hal Rosenstock
@ 2009-11-15  5:52             ` Or Gerlitz
       [not found]               ` <4AFF9714.1040708-smomgflXvOZWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Or Gerlitz @ 2009-11-15  5:52 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: Sasha Khapyorsky, linux-rdma-u79uwXL29TY76Z2rM5mHXA

Sasha Khapyorsky wrote:
>> I don't think this is the forum to discuss vendor bugs.
>>     
no way we can commit here a fix for undocumented bug

Or.

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails
       [not found]               ` <4AFF9714.1040708-smomgflXvOZWk0Htik3J/w@public.gmane.org>
@ 2009-11-16 15:38                 ` Hal Rosenstock
  0 siblings, 0 replies; 8+ messages in thread
From: Hal Rosenstock @ 2009-11-16 15:38 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: Sasha Khapyorsky, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Sun, Nov 15, 2009 at 12:52 AM, Or Gerlitz <ogerlitz-smomgflXvOZWk0Htik3J/w@public.gmane.org> wrote:
> Sasha Khapyorsky wrote:
>>>
>>> I don't think this is the forum to discuss vendor bugs.
>>>
>
> no way we can commit here a fix for undocumented bug

The bug is documented. What is broken is indicated in the patch
description. The only thing omitted is the vendor/device. I think it
violates vendor confidentiality to go further and I'm not in a
position to do that.

-- Hal

>
> Or.
>
>
--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-11-16 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 14:42 [PATCHv2] infiniband-diags/ibqueryerrors: Add support for PortXmitDiscardDetails Hal Rosenstock
     [not found] ` <20091104144219.GA7923-Wuw85uim5zDR7s880joybQ@public.gmane.org>
2009-11-06 16:59   ` Sasha Khapyorsky
2009-11-12 20:38     ` Sasha Khapyorsky
2009-11-13 14:43       ` Hal Rosenstock
     [not found]         ` <f0e08f230911130643l788ef2e5n538c123912300d42-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-13 14:59           ` Sasha Khapyorsky
2009-11-13 15:11             ` Hal Rosenstock
2009-11-15  5:52             ` Or Gerlitz
     [not found]               ` <4AFF9714.1040708-smomgflXvOZWk0Htik3J/w@public.gmane.org>
2009-11-16 15:38                 ` Hal Rosenstock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox