public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
@ 2011-04-28 14:47 Hal Rosenstock
       [not found] ` <4DB97DF4.3020004-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Hal Rosenstock @ 2011-04-28 14:47 UTC (permalink / raw)
  To: Ira Weiny; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

rather than hard coded values now that these have been added to ib_types.h

Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
diff --git a/src/perfquery.c b/src/perfquery.c
index ef63da2..d24c3c7 100644
--- a/src/perfquery.c
+++ b/src/perfquery.c
@@ -46,6 +46,7 @@
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
+#include <infiniband/iba/ib_types.h>
 
 #include "ibdiag_common.h"
 
@@ -293,7 +294,7 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask,
 		if (!pma_query_via(pc, portid, port, timeout,
 				   IB_GSI_PORT_COUNTERS, srcport))
 			IBERROR("perfquery");
-		if (!(cap_mask & 0x1000)) {
+		if (!(cap_mask & IB_PM_PC_XMIT_WAIT_SUP)) {
 			/* if PortCounters:PortXmitWait not supported clear this counter */
 			VERBOSE("PortXmitWait not indicated"
 				" so ignore this counter");
@@ -306,10 +307,10 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask,
 		else
 			mad_dump_fields(buf, sizeof buf, pc, sizeof pc,
 							IB_PC_FIRST_F,
-							(cap_mask & 0x1000)?IB_PC_LAST_F:(IB_PC_RCV_PKTS_F+1));
+							(cap_mask & IB_PM_PC_XMIT_WAIT_SUP)?IB_PC_LAST_F:(IB_PC_RCV_PKTS_F+1));
 
 	} else {
-		if (!(cap_mask & 0x200))	/* 1.2 errata: bit 9 is extended counter support */
+		if (!(cap_mask & IB_PM_EXT_WIDTH_SUPPORTED))	/* 1.2 errata: bit 9 is extended counter support */
 			IBWARN
 			    ("PerfMgt ClassPortInfo 0x%x extended counters not indicated\n",
 			     cap_mask);
@@ -535,8 +536,7 @@ int main(int argc, char **argv)
 		IBERROR("classportinfo query");
 	/* ClassPortInfo should be supported as part of libibmad */
 	memcpy(&cap_mask, pc + 2, sizeof(cap_mask));	/* CapabilityMask */
-	cap_mask = ntohs(cap_mask);
-	if (!(cap_mask & 0x100)) {	/* bit 8 is AllPortSelect */
+	if (!(cap_mask & IB_PM_ALL_PORT_SELECT)) {	/* bit 8 is AllPortSelect */
 		if (!all_ports && port == ALL_PORTS)
 			IBERROR("AllPortSelect not supported");
 		if (all_ports)
@@ -613,7 +613,7 @@ int main(int argc, char **argv)
 		goto done;
 
 do_reset:
-	if (argc <= 2 && !extended && (cap_mask & 0x1000))
+	if (argc <= 2 && !extended && (cap_mask & IB_PM_PC_XMIT_WAIT_SUP))
 		mask |= (1 << 16);	/* reset portxmitwait */
 
 	if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {

--
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] 7+ messages in thread

* RE: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found] ` <4DB97DF4.3020004-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2011-04-28 15:54   ` Hefty, Sean
       [not found]     ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3A02-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2011-04-28 21:13   ` Ira Weiny
  1 sibling, 1 reply; 7+ messages in thread
From: Hefty, Sean @ 2011-04-28 15:54 UTC (permalink / raw)
  To: Hal Rosenstock, Ira Weiny
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

> rather than hard coded values now that these have been added to ib_types.h

I've lost track.  Is ib_types.h still an opensm include file?
--
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] 7+ messages in thread

* Re: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found]     ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3A02-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2011-04-28 16:29       ` Hal Rosenstock
       [not found]         ` <4DB995CE.8070203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Hal Rosenstock @ 2011-04-28 16:29 UTC (permalink / raw)
  To: Hefty, Sean; +Cc: Ira Weiny, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 4/28/2011 11:54 AM, Hefty, Sean wrote:
>> rather than hard coded values now that these have been added to ib_types.h
> 
> I've lost track.  Is ib_types.h still an opensm include file?

Yes.

This patch was mirroring the change Ira proposed to ibqueryerrors.c
yesterday.

Also, there are other infiniband-diags (and library) including
ib_types.h (e.g. saquery and libibnetdisc).

--
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] 7+ messages in thread

* RE: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found]         ` <4DB995CE.8070203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2011-04-28 16:36           ` Hefty, Sean
       [not found]             ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3AB8-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Hefty, Sean @ 2011-04-28 16:36 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Ira Weiny, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

> Also, there are other infiniband-diags (and library) including
> ib_types.h (e.g. saquery and libibnetdisc).

I have a set of patches that I created as part of trying to support AF_IB and ACM that move a lot of the MAD definitions into libibumad include files.  I don't remember if I ever submitted these, since I was waiting on the acceptance of the kernel patches.  It would take me a while to pull them back out and update them, but I can submit those.  They would help eliminate some of the duplicate definitions that exist between the different libraries (such as libibverbs, librdmacm, and ibacm), and should remove ib-diags from depending on opensm.

I know we've discussed this sort of change before, but would these be acceptable to everyone?

- Sean
--
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] 7+ messages in thread

* Re: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found]             ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3AB8-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2011-04-28 17:14               ` Ira Weiny
       [not found]                 ` <20110428101456.8f9ac048.weiny2-i2BcT+NCU+M@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Ira Weiny @ 2011-04-28 17:14 UTC (permalink / raw)
  To: Hefty, Sean, Alex Netes
  Cc: Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Thu, 28 Apr 2011 09:36:49 -0700
"Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:

> > Also, there are other infiniband-diags (and library) including
> > ib_types.h (e.g. saquery and libibnetdisc).
> 
> I have a set of patches that I created as part of trying to support AF_IB and ACM that move a lot of the MAD definitions into libibumad include files.  I don't remember if I ever submitted these, since I was waiting on the acceptance of the kernel patches.  It would take me a while to pull them back out and update them, but I can submit those.  They would help eliminate some of the duplicate definitions that exist between the different libraries (such as libibverbs, librdmacm, and ibacm), and should remove ib-diags from depending on opensm.
> 
> I know we've discussed this sort of change before, but would these be acceptable to everyone?

Oh yes, I was just codeing along and added the define where the others were.  I would very much like the diags to not depend on opensm.  Please do resubmit your patches.

For now I am going to accept this patch which will mark perfquery as something which needs to transition.

Ira

> 
> - Sean


-- 
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
weiny2-i2BcT+NCU+M@public.gmane.org
--
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] 7+ messages in thread

* Re: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found]                 ` <20110428101456.8f9ac048.weiny2-i2BcT+NCU+M@public.gmane.org>
@ 2011-04-28 17:59                   ` Hal Rosenstock
  0 siblings, 0 replies; 7+ messages in thread
From: Hal Rosenstock @ 2011-04-28 17:59 UTC (permalink / raw)
  To: Ira Weiny
  Cc: Hefty, Sean, Alex Netes,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 4/28/2011 1:14 PM, Ira Weiny wrote:
> I would very much like the diags to not depend on opensm

It will take more than ib_types for this to happen. There are other
dependencies but maybe it's one step at a time...

-- Hal
--
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] 7+ messages in thread

* Re: infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask
       [not found] ` <4DB97DF4.3020004-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  2011-04-28 15:54   ` Hefty, Sean
@ 2011-04-28 21:13   ` Ira Weiny
  1 sibling, 0 replies; 7+ messages in thread
From: Ira Weiny @ 2011-04-28 21:13 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Thu, 28 Apr 2011 07:47:16 -0700
Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:

> rather than hard coded values now that these have been added to ib_types.h
> 
> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Thanks, applied,
Ira

> ---
> diff --git a/src/perfquery.c b/src/perfquery.c
> index ef63da2..d24c3c7 100644
> --- a/src/perfquery.c
> +++ b/src/perfquery.c
> @@ -46,6 +46,7 @@
>  
>  #include <infiniband/umad.h>
>  #include <infiniband/mad.h>
> +#include <infiniband/iba/ib_types.h>
>  
>  #include "ibdiag_common.h"
>  
> @@ -293,7 +294,7 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask,
>  		if (!pma_query_via(pc, portid, port, timeout,
>  				   IB_GSI_PORT_COUNTERS, srcport))
>  			IBERROR("perfquery");
> -		if (!(cap_mask & 0x1000)) {
> +		if (!(cap_mask & IB_PM_PC_XMIT_WAIT_SUP)) {
>  			/* if PortCounters:PortXmitWait not supported clear this counter */
>  			VERBOSE("PortXmitWait not indicated"
>  				" so ignore this counter");
> @@ -306,10 +307,10 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask,
>  		else
>  			mad_dump_fields(buf, sizeof buf, pc, sizeof pc,
>  							IB_PC_FIRST_F,
> -							(cap_mask & 0x1000)?IB_PC_LAST_F:(IB_PC_RCV_PKTS_F+1));
> +							(cap_mask & IB_PM_PC_XMIT_WAIT_SUP)?IB_PC_LAST_F:(IB_PC_RCV_PKTS_F+1));
>  
>  	} else {
> -		if (!(cap_mask & 0x200))	/* 1.2 errata: bit 9 is extended counter support */
> +		if (!(cap_mask & IB_PM_EXT_WIDTH_SUPPORTED))	/* 1.2 errata: bit 9 is extended counter support */
>  			IBWARN
>  			    ("PerfMgt ClassPortInfo 0x%x extended counters not indicated\n",
>  			     cap_mask);
> @@ -535,8 +536,7 @@ int main(int argc, char **argv)
>  		IBERROR("classportinfo query");
>  	/* ClassPortInfo should be supported as part of libibmad */
>  	memcpy(&cap_mask, pc + 2, sizeof(cap_mask));	/* CapabilityMask */
> -	cap_mask = ntohs(cap_mask);
> -	if (!(cap_mask & 0x100)) {	/* bit 8 is AllPortSelect */
> +	if (!(cap_mask & IB_PM_ALL_PORT_SELECT)) {	/* bit 8 is AllPortSelect */
>  		if (!all_ports && port == ALL_PORTS)
>  			IBERROR("AllPortSelect not supported");
>  		if (all_ports)
> @@ -613,7 +613,7 @@ int main(int argc, char **argv)
>  		goto done;
>  
>  do_reset:
> -	if (argc <= 2 && !extended && (cap_mask & 0x1000))
> +	if (argc <= 2 && !extended && (cap_mask & IB_PM_PC_XMIT_WAIT_SUP))
>  		mask |= (1 << 16);	/* reset portxmitwait */
>  
>  	if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
> 
> --
> 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


-- 
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
weiny2-i2BcT+NCU+M@public.gmane.org
--
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] 7+ messages in thread

end of thread, other threads:[~2011-04-28 21:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28 14:47 infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask Hal Rosenstock
     [not found] ` <4DB97DF4.3020004-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-04-28 15:54   ` Hefty, Sean
     [not found]     ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3A02-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-04-28 16:29       ` Hal Rosenstock
     [not found]         ` <4DB995CE.8070203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-04-28 16:36           ` Hefty, Sean
     [not found]             ` <CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3AB8-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-04-28 17:14               ` Ira Weiny
     [not found]                 ` <20110428101456.8f9ac048.weiny2-i2BcT+NCU+M@public.gmane.org>
2011-04-28 17:59                   ` Hal Rosenstock
2011-04-28 21:13   ` Ira Weiny

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