Skip to contentSkip to conversation

infiniband-diags/perfquery.c: Use ib_types.h defines for CapabilityMask

PATCH Applied Hal Rosenstock 3 participants 7 messages Apr 28, 2011 5 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

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

---

src/perfquery.c +6 -6
index ef63da2..d24c3c7 100644
@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4DB97DF4.3020004-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

A message that is not in the archive (sent off-list or not yet received): CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3A02-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#4 lore raw
Quoted 3 lines · Sean
Quoted 1 line

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4DB995CE.8070203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#6 lore raw
Quoted 2 lines

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CF9C39F99A89134C9CF9C4CCB68B8DDF261A1F3AB8-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#8 lore raw
Quoted 6 lines · Sean
Quoted 2 lines

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

Quoted 2 lines

- Sean

Signature · 9 lines
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 1 line · Ira Weiny

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#11 lore raw
In reply to a message not in the archive
Quoted 3 lines · On Thu, 28 Apr 2011 07:47:16 -0700 Hal Rosenstock…

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

Thanks, applied,
Ira

Quoted 59 lines

---

src/perfquery.c +6 -7
index ef63da2..d24c3c7 100644
@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 9 lines
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html