[ofa-general] [PATCH 1/2] libibmad: add PortXmtDataSL / PortRcvDataSL support

Or Gerlitz ogerlitz at voltaire.com
Thu Feb 26 04:38:09 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
 };

@@ -421,6 +422,28 @@ enum MAD_FIELDS {
 	IB_PC_XMT_WAIT_F,
 	IB_PC_LAST_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_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_SL_LAST_F,
+
 	/*
 	 * SMInfo
 	 */
@@ -793,6 +816,16 @@ MAD_EXPORT uint8_t *port_performance_ext
 MAD_EXPORT uint8_t *port_performance_ext_reset(void *rcvbuf, ib_portid_t * dest,
 					       int port, unsigned mask,
 					       unsigned timeout);
+MAD_EXPORT uint8_t *port_performance_xmt_sl_query(void *rcvbuf, ib_portid_t * dest,
+					       int port, unsigned timeout);
+MAD_EXPORT uint8_t *port_performance_rcv_sl_query(void *rcvbuf, ib_portid_t * dest,
+					       int port, unsigned timeout);
+MAD_EXPORT uint8_t *port_performance_xmt_sl_reset(void *rcvbuf, ib_portid_t * dest,
+					       int port, unsigned mask,
+					       unsigned timeout);
+MAD_EXPORT uint8_t *port_performance_rcv_sl_reset(void *rcvbuf, ib_portid_t * dest,
+					       int port, unsigned mask,
+					       unsigned timeout);
 MAD_EXPORT uint8_t *port_samples_control_query(void *rcvbuf, ib_portid_t * dest,
 					       int port, unsigned timeout);
 MAD_EXPORT uint8_t *port_samples_result_query(void *rcvbuf, ib_portid_t * dest,
@@ -830,7 +863,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
@@ -262,6 +262,26 @@ static const ib_field_t ib_mad_f[] = {
 	{320, 32, "XmtWait", mad_dump_uint},
 	{0, 0},			/* IB_PC_LAST_F */

+	{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},
+	{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},
+	{0, 0},			/* IB_PC_RCV_DATA_SL_LAST_F */
+
 	/*
 	 * SMInfo
 	 */
Index: management/libibmad/src/gs.c
===================================================================
--- management.orig/libibmad/src/gs.c
+++ management/libibmad/src/gs.c
@@ -193,6 +193,18 @@ uint8_t *port_performance_ext_query(void
 	return pma_query(rcvbuf, dest, port, timeout, IB_GSI_PORT_COUNTERS_EXT);
 }

+uint8_t *port_performance_xmt_sl_query(void *rcvbuf, ib_portid_t * dest, int port,
+					unsigned timeout)
+{
+	return pma_query(rcvbuf, dest, port, timeout, IB_GSI_PORT_XMIT_DATA_SL);
+}
+
+uint8_t *port_performance_rcv_sl_query(void *rcvbuf, ib_portid_t * dest, int port,
+					unsigned timeout)
+{
+	return pma_query(rcvbuf, dest, port, timeout, IB_GSI_PORT_RCV_DATA_SL);
+}
+
 uint8_t *port_performance_ext_reset_via(void *rcvbuf, ib_portid_t * dest,
 					int port, unsigned mask,
 					unsigned timeout, const void *srcport)
@@ -208,6 +220,20 @@ uint8_t *port_performance_ext_reset(void
 				 IB_GSI_PORT_COUNTERS_EXT);
 }

+uint8_t *port_performance_xmt_sl_reset(void *rcvbuf, ib_portid_t * dest, int port,
+				    unsigned mask, unsigned timeout)
+{
+	return performance_reset(rcvbuf, dest, port, mask, timeout,
+				 IB_GSI_PORT_XMIT_DATA_SL);
+}
+
+uint8_t *port_performance_rcv_sl_reset(void *rcvbuf, ib_portid_t * dest, int port,
+				    unsigned mask, unsigned timeout)
+{
+	return performance_reset(rcvbuf, dest, port, mask, timeout,
+				 IB_GSI_PORT_RCV_DATA_SL);
+}
+
 uint8_t *port_samples_control_query_via(void *rcvbuf, ib_portid_t * dest,
 					int port, unsigned timeout,
 					const void *srcport)
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;
@@ -45,6 +47,10 @@ IBMAD_1.3 {
 		port_performance_reset;
 		port_performance_ext_query;
 		port_performance_ext_reset;
+		port_performance_xmt_sl_query;
+		port_performance_rcv_sl_query;
+		port_performance_xmt_sl_reset;
+		port_performance_rcv_sl_reset;
 		port_samples_control_query;
 		port_samples_result_query;
 		mad_build_pkt;
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))



More information about the general mailing list