diff mbox

[infiniband-diags,3/6] libibmad: Add support for HDRFECMode fields in PortInfoExtended attribute

Message ID fc3566ee-d24d-73ec-054d-8eb18fcf5214@dev.mellanox.co.il (mailing list archive)
State Accepted, archived
Delegated to: Ira Weiny
Headers show

Commit Message

Hal Rosenstock Nov. 28, 2017, 10:11 p.m. UTC
Per MgtWG comment #9367

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 libibmad/include/infiniband/mad.h |  7 +++++++
 libibmad/src/dump.c               | 12 ++++++++++--
 libibmad/src/fields.c             |  7 +++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index 7f6b886..da82636 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -1315,6 +1315,13 @@  enum MAD_FIELDS {
 	 */
 	IB_PC_QP1_DROP_F,
 
+	/*
+	 * More PortInfoExtended fields
+	 */
+	IB_PORT_EXT_HDR_FEC_MODE_SUPPORTED_F,
+	IB_PORT_EXT_HDR_FEC_MODE_ENABLED_F,
+	IB_PORT_EXT_HDR_FEC_MODE_LAST_F,
+
 	IB_FIELD_LAST_		/* must be last */
 };
 
diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c
index 98d5a34..d71c529 100644
--- a/libibmad/src/dump.c
+++ b/libibmad/src/dump.c
@@ -1183,8 +1183,16 @@  void mad_dump_classportinfo(char *buf, int bufsz, void *val, int valsz)
 
 void mad_dump_portinfo_ext(char *buf, int bufsz, void *val, int valsz)
 {
-	_dump_fields(buf, bufsz, val, IB_PORT_EXT_FIRST_F,
-		     IB_PORT_EXT_LAST_F);
+	int cnt;
+
+	cnt = _dump_fields(buf, bufsz, val, IB_PORT_EXT_FIRST_F,
+			   IB_PORT_EXT_LAST_F);
+	if (cnt < 0)
+		return;
+
+	_dump_fields(buf + cnt, bufsz - cnt, val,
+		     IB_PORT_EXT_HDR_FEC_MODE_SUPPORTED_F,
+		     IB_PORT_EXT_HDR_FEC_MODE_LAST_F);
 }
 
 void xdump(FILE * file, char *msg, void *p, int size)
diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index bf48689..61fd540 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -1009,6 +1009,13 @@  static const ib_field_t ib_mad_f[] = {
 	 */
 	{160, 16, "QP1Dropped", mad_dump_uint},
 
+	/*
+	 * More PortInfoExtended fields
+	 */
+	{112, 16, "HDRFECModeSupported", mad_dump_hex},
+	{128, 16, "HDRFECModeEnabled", mad_dump_hex},
+	{0, 0},			/* IB_PORT_EXT_HDR_FEC_MODE_LAST_F */
+
 	{0, 0}			/* IB_FIELD_LAST_ */
 };