[ofa-general] [PATCH] libibmad: Add support for PortXmitDiscardDetails

Hal Rosenstock hnrose at comcast.net
Wed Sep 23 05:57:41 PDT 2009


Also, some additional commentary changes to mad.h and fields.c

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index 94b64cf..cfa9105 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -168,6 +168,7 @@ enum GSI_ATTR_ID {
 	IB_GSI_PORT_SAMPLES_CONTROL = 0x10,
 	IB_GSI_PORT_SAMPLES_RESULT = 0x11,
 	IB_GSI_PORT_COUNTERS = 0x12,
+	IB_GSI_PORT_XMIT_DISCARD_DETAILS = 0x16,
 	IB_GSI_PORT_COUNTERS_EXT = 0x1D,
 	IB_GSI_PORT_XMIT_DATA_SL = 0x36,
 	IB_GSI_PORT_RCV_DATA_SL = 0x37,
@@ -604,6 +605,9 @@ enum MAD_FIELDS {
 	IB_CPI_TRAP_QP_F,
 	IB_CPI_TRAP_QKEY_F,
 
+	/*
+	 * PortXmitDataSL fields
+	 */
 	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,
@@ -623,6 +627,9 @@ enum MAD_FIELDS {
 	IB_PC_XMT_DATA_SL15_F,
 	IB_PC_XMT_DATA_SL_LAST_F,
 
+	/*
+	 * PortRcvDataSL fields
+	 */
 	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,
@@ -642,6 +649,15 @@ enum MAD_FIELDS {
 	IB_PC_RCV_DATA_SL15_F,
 	IB_PC_RCV_DATA_SL_LAST_F,
 
+	/*
+	 * PortXmitDiscardDetails fields
+	 */
+	IB_PC_XMT_INACT_DISC_F,
+	IB_PC_XMT_NEIGH_MTU_DISC_F,
+	IB_PC_XMT_SW_LIFE_DISC_F,
+	IB_PC_XMT_SW_HOL_DISC_F,
+	IB_PC_XMT_DISC_LAST_F,
+
 	IB_FIELD_LAST_		/* must be last */
 };
 
@@ -963,7 +979,8 @@ MAD_EXPORT ib_mad_dump_fn
     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_perfcounters_xmt_sl, mad_dump_perfcounters_rcv_sl;
+    mad_dump_perfcounters_xmt_sl, mad_dump_perfcounters_rcv_sl,
+    mad_dump_perfcounters_xmt_disc;
 
 MAD_EXPORT int ibdebug;
 
diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c
index 5151882..48f59ab 100644
--- a/libibmad/src/dump.c
+++ b/libibmad/src/dump.c
@@ -729,6 +729,16 @@ void mad_dump_perfcounters_rcv_sl(char *buf, int bufsz, void *val, int valsz)
 		     IB_PC_RCV_DATA_SL_LAST_F);
 }
 
+void mad_dump_perfcounters_xmt_disc(char *buf, int bufsz, void *val, int valsz)
+{
+	int cnt;
+
+	cnt = _dump_fields(buf, bufsz, val, IB_PC_EXT_PORT_SELECT_F,
+			   IB_PC_EXT_XMT_BYTES_F);
+	_dump_fields(buf + cnt, bufsz - cnt, val, IB_PC_XMT_INACT_DISC_F,
+		     IB_PC_XMT_DISC_LAST_F);
+}
+
 void xdump(FILE * file, char *msg, void *p, int size)
 {
 #define HEX(x)  ((x) < 10 ? '0' + (x) : 'a' + ((x) -10))
diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index 5f30116..f274aff 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -406,6 +406,9 @@ static const ib_field_t ib_mad_f[] = {
 	{BITSOFFS(520, 24), "TrapQP", mad_dump_hex},
 	{544, 32, "TrapQKey", mad_dump_hex},
 
+	/*
+	 * PortXmitDataSL fields
+	 */
 	{32, 32, "XmtDataSL0", mad_dump_uint},
 	{64, 32, "XmtDataSL1", mad_dump_uint},
 	{96, 32, "XmtDataSL2", mad_dump_uint},
@@ -424,6 +427,9 @@ static const ib_field_t ib_mad_f[] = {
 	{512, 32, "XmtDataSL15", mad_dump_uint},
 	{0, 0},			/* IB_PC_XMT_DATA_SL_LAST_F */
 
+	/*
+	 * PortRcvDataSL fields
+	 */
 	{32, 32, "RcvDataSL0", mad_dump_uint},
 	{64, 32, "RcvDataSL1", mad_dump_uint},
 	{96, 32, "RcvDataSL2", mad_dump_uint},
@@ -442,6 +448,15 @@ static const ib_field_t ib_mad_f[] = {
 	{512, 32, "RcvDataSL15", mad_dump_uint},
 	{0, 0},			/* IB_PC_RCV_DATA_SL_LAST_F */
 
+	/*
+	 * PortXmitDiscardDetails fields
+	 */
+	{32, 16, "PortInactiveDiscards", mad_dump_uint},
+	{48, 16, "PortNeighborMTUDiscards", mad_dump_uint},
+	{64, 16, "PortSwLifetimeLimitDiscards", mad_dump_uint},
+	{80, 16, "PortSwHOQLifetimeLimitDiscards", mad_dump_uint},
+	{0, 0},			/* IB_PC_XMT_DISC_LAST_F */
+
 	{0, 0}			/* IB_FIELD_LAST_ */
 
 };
diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map
index b9a890c..2a6a253 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -24,6 +24,7 @@ IBMAD_1.3 {
 		mad_dump_perfcounters_ext;
 		mad_dump_perfcounters_xmt_sl;
 		mad_dump_perfcounters_rcv_sl;
+		mad_dump_perfcounters_xmt_disc;
 		mad_dump_physportstate;
 		mad_dump_portcapmask;
 		mad_dump_portinfo;



More information about the general mailing list