[ofa-general] [PATCH v2 3/4] libimad implementation of PortXmtDataSL and PortRcvDataSL

Or Gerlitz ogerlitz at voltaire.com
Sun Mar 1 04:40:32 PST 2009


libimad implementation of PortXmtDataSL (IBA A13.6.5) / PortRcvDataSL (IBA A13.6.6)
reading and resetting

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>

Index: management/libibmad/include/infiniband/mad.h
===================================================================
--- management.orig/libibmad/include/infiniband/mad.h
+++ management/libibmad/include/infiniband/mad.h
@@ -153,7 +153,8 @@ enum GSI_ATTR_ID {
 	IB_GSI_PORT_SAMPLES_RESULT = 0x11,
 	IB_GSI_PORT_COUNTERS = 0x12,
 	IB_GSI_PORT_COUNTERS_EXT = 0x1D,
-
+	IB_GSI_PORT_XMIT_DATA_SL = 0x36,
+	IB_GSI_PORT_RCV_DATA_SL  = 0x37,
 	IB_GSI_ATTR_LAST
 };

@@ -562,6 +563,44 @@ enum MAD_FIELDS {
 	IB_CPI_TRAP_QP_F,
 	IB_CPI_TRAP_QKEY_F,

+	IB_PC_XMT_DATA_SL_FIRST_F,
+	IB_PC_XMT_DATA_SL0_F = IB_PC_XMT_DATA_SL_FIRST_F,
+	IB_PC_XMT_DATA_SL1_F,
+	IB_PC_XMT_DATA_SL2_F,
+	IB_PC_XMT_DATA_SL3_F,
+	IB_PC_XMT_DATA_SL4_F,
+	IB_PC_XMT_DATA_SL5_F,
+	IB_PC_XMT_DATA_SL6_F,
+	IB_PC_XMT_DATA_SL7_F,
+	IB_PC_XMT_DATA_SL8_F,
+	IB_PC_XMT_DATA_SL9_F,
+	IB_PC_XMT_DATA_SL10_F,
+	IB_PC_XMT_DATA_SL11_F,
+	IB_PC_XMT_DATA_SL12_F,
+	IB_PC_XMT_DATA_SL13_F,
+	IB_PC_XMT_DATA_SL14_F,
+	IB_PC_XMT_DATA_SL15_F,
+	IB_PC_XMT_DATA_SL_LAST_F,
+
+	IB_PC_RCV_DATA_SL_FIRST_F,
+	IB_PC_RCV_DATA_SL0_F = IB_PC_RCV_DATA_SL_FIRST_F,
+	IB_PC_RCV_DATA_SL1_F,
+	IB_PC_RCV_DATA_SL2_F,
+	IB_PC_RCV_DATA_SL3_F,
+	IB_PC_RCV_DATA_SL4_F,
+	IB_PC_RCV_DATA_SL5_F,
+	IB_PC_RCV_DATA_SL6_F,
+	IB_PC_RCV_DATA_SL7_F,
+	IB_PC_RCV_DATA_SL8_F,
+	IB_PC_RCV_DATA_SL9_F,
+	IB_PC_RCV_DATA_SL10_F,
+	IB_PC_RCV_DATA_SL11_F,
+	IB_PC_RCV_DATA_SL12_F,
+	IB_PC_RCV_DATA_SL13_F,
+	IB_PC_RCV_DATA_SL14_F,
+	IB_PC_RCV_DATA_SL15_F,
+	IB_PC_RCV_DATA_SL_LAST_F,
+
 	IB_FIELD_LAST_		/* must be last */
 };

@@ -800,7 +839,8 @@ MAD_EXPORT ib_mad_dump_fn
     mad_dump_mtu, mad_dump_vlcap, mad_dump_opervls,
     mad_dump_node_type, mad_dump_sltovl, mad_dump_vlarbitration,
     mad_dump_nodedesc, mad_dump_nodeinfo, mad_dump_portinfo,
-    mad_dump_switchinfo, mad_dump_perfcounters, mad_dump_perfcounters_ext;
+    mad_dump_switchinfo, mad_dump_perfcounters, mad_dump_perfcounters_ext,
+    mad_dump_perfcounters_xmt_sl, mad_dump_perfcounters_rcv_sl;

 extern int ibdebug;

Index: management/libibmad/src/fields.c
===================================================================
--- management.orig/libibmad/src/fields.c
+++ management/libibmad/src/fields.c
@@ -402,6 +402,42 @@ static const ib_field_t ib_mad_f[] = {
 	{BITSOFFS(520, 24), "TrapQP", mad_dump_hex},
 	{544, 32, "TrapQKey", mad_dump_hex},

+	{32,  32, "XmtDataSL0", mad_dump_uint},
+	{64,  32, "XmtDataSL1", mad_dump_uint},
+	{96,  32, "XmtDataSL2", mad_dump_uint},
+	{128, 32, "XmtDataSL3", mad_dump_uint},
+	{160, 32, "XmtDataSL4", mad_dump_uint},
+	{196, 32, "XmtDataSL5", mad_dump_uint},
+	{224, 32, "XmtDataSL6", mad_dump_uint},
+	{256, 32, "XmtDataSL7", mad_dump_uint},
+	{288, 32, "XmtDataSL8", mad_dump_uint},
+	{320, 32, "XmtDataSL9", mad_dump_uint},
+	{352, 32, "XmtDataSL10", mad_dump_uint},
+	{384, 32, "XmtDataSL11", mad_dump_uint},
+	{416, 32, "XmtDataSL12", mad_dump_uint},
+	{448, 32, "XmtDataSL13", mad_dump_uint},
+	{480, 32, "XmtDataSL14", mad_dump_uint},
+	{512, 32, "XmtDataSL15", mad_dump_uint},
+	{0, 0},			/* IB_PC_XMT_DATA_SL_LAST_F */
+
+	{32,  32, "RcvDataSL0", mad_dump_uint},
+	{64,  32, "RcvDataSL1", mad_dump_uint},
+	{96,  32, "RcvDataSL2", mad_dump_uint},
+	{128, 32, "RcvDataSL3", mad_dump_uint},
+	{160, 32, "RcvDataSL4", mad_dump_uint},
+	{196, 32, "RcvDataSL5", mad_dump_uint},
+	{224, 32, "RcvDataSL6", mad_dump_uint},
+	{256, 32, "RcvDataSL7", mad_dump_uint},
+	{288, 32, "RcvDataSL8", mad_dump_uint},
+	{320, 32, "RcvDataSL9", mad_dump_uint},
+	{352, 32, "RcvDataSL10", mad_dump_uint},
+	{384, 32, "RcvDataSL11", mad_dump_uint},
+	{416, 32, "RcvDataSL12", mad_dump_uint},
+	{448, 32, "RcvDataSL13", mad_dump_uint},
+	{480, 32, "RcvDataSL14", mad_dump_uint},
+	{512, 32, "RcvDataSL15", mad_dump_uint},
+	{0, 0},			/* IB_PC_RCV_DATA_SL_LAST_F */
+
 	{0, 0}			/* IB_FIELD_LAST_ */

 };
Index: management/libibmad/src/dump.c
===================================================================
--- management.orig/libibmad/src/dump.c
+++ management/libibmad/src/dump.c
@@ -699,6 +699,16 @@ void mad_dump_perfcounters_ext(char *buf
 	_dump_fields(buf, bufsz, val, IB_PC_EXT_FIRST_F, IB_PC_EXT_LAST_F);
 }

+void mad_dump_perfcounters_xmt_sl(char *buf, int bufsz, void *val, int valsz)
+{
+	_dump_fields(buf, bufsz, val, IB_PC_XMT_DATA_SL_FIRST_F, IB_PC_XMT_DATA_SL_LAST_F);
+}
+
+void mad_dump_perfcounters_rcv_sl(char *buf, int bufsz, void *val, int valsz)
+{
+	_dump_fields(buf, bufsz, val, IB_PC_RCV_DATA_SL_FIRST_F, IB_PC_RCV_DATA_SL_LAST_F);
+}
+
 void xdump(FILE * file, char *msg, void *p, int size)
 {
 #define HEX(x)  ((x) < 10 ? '0' + (x) : 'a' + ((x) -10))
Index: management/libibmad/src/libibmad.map
===================================================================
--- management.orig/libibmad/src/libibmad.map
+++ management/libibmad/src/libibmad.map
@@ -22,6 +22,8 @@ IBMAD_1.3 {
 		mad_dump_opervls;
 		mad_dump_perfcounters;
 		mad_dump_perfcounters_ext;
+		mad_dump_perfcounters_xmt_sl;
+		mad_dump_perfcounters_rcv_sl;
 		mad_dump_physportstate;
 		mad_dump_portcapmask;
 		mad_dump_portinfo;



More information about the general mailing list