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

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