components/open-fabrics/libibmad/patches/base.patch
author Boris Chiu <Boris.Chiu@Oracle.COM>
Wed, 29 May 2013 10:00:58 -0700
changeset 1319 e0ba15fa5e97
parent 1216 bd892ba92960
child 1461 5ba0aa89a64a
permissions -rw-r--r--
16842068 diskmon frequently cores when calling ib_node_query_via()
diff -r -u /tmp/libibmad-1.3.7/Makefile.in libibmad-1.3.7/Makefile.in
--- /tmp/libibmad-1.3.7/Makefile.in	Wed Feb 16 02:25:43 2011
+++ libibmad-1.3.7/Makefile.in	Fri Feb 25 03:14:42 2011
@@ -357,8 +357,8 @@
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
 
 uninstall-libLTLIBRARIES:
diff -r -u /tmp/libibmad-1.3.7/include/infiniband/mad.h libibmad-1.3.7/include/infiniband/mad.h
--- /tmp/libibmad-1.3.7/include/infiniband/mad.h	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/include/infiniband/mad.h	Thu Feb 24 11:27:11 2011
@@ -62,6 +62,7 @@
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
 #define IB_BM_BKEY_OFFS		24
@@ -579,7 +580,8 @@
 	/*
 	 * GUIDInfo fields
 	 */
-	IB_GUID_GUID0_F,
+	IB_GUID_GUID0_F, /* Obsolete, kept for compatibility
+			    Use IB_GI_GUID0_F going forward */
 
 	/*
 	 * ClassPortInfo fields
@@ -610,7 +612,8 @@
 	/*
 	 * PortXmitDataSL fields
 	 */
-	IB_PC_XMT_DATA_SL_FIRST_F,
+	IB_PC_XMT_DATA_SL_FIRST_F, /* for PortSelect and CounterSelect, use IB_P
+C_PORT_SELECT_F and IB_PC_COUNTER_SELECT_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,
@@ -632,7 +635,8 @@
 	/*
 	 * PortRcvDataSL fields
 	 */
-	IB_PC_RCV_DATA_SL_FIRST_F,
+	IB_PC_RCV_DATA_SL_FIRST_F, /* for PortSelect and CounterSelect, use IB_P
+C_PORT_SELECT_F and IB_PC_COUNTER_SELECT_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,
@@ -654,6 +658,8 @@
 	/*
 	 * PortXmitDiscardDetails fields
 	 */
+	/* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_C
+OUNTER_SELECT_F */
 	IB_PC_XMT_INACT_DISC_F,
 	IB_PC_XMT_NEIGH_MTU_DISC_F,
 	IB_PC_XMT_SW_LIFE_DISC_F,
@@ -663,6 +669,8 @@
 	/*
 	 * PortRcvErrorDetails fields
 	 */
+	/* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_C
+OUNTER_SELECT_F */
 	IB_PC_RCV_LOCAL_PHY_ERR_F,
 	IB_PC_RCV_MALFORMED_PKT_ERR_F,
 	IB_PC_RCV_BUF_OVR_ERR_F,
@@ -706,6 +714,483 @@
 	IB_PSC_SAMPLES_ONLY_OPT_MASK_F,
 	IB_PSC_LAST_F,
 
+
+	/*
+	 * GUIDInfo fields
+	 */
+	IB_GI_GUID0_F, /* a duplicate of IB_GUID_GUID0_F for backwards
+			  compatibility */
+	IB_GI_GUID1_F,
+	IB_GI_GUID2_F,
+	IB_GI_GUID3_F,
+	IB_GI_GUID4_F,
+	IB_GI_GUID5_F,
+	IB_GI_GUID6_F,
+	IB_GI_GUID7_F,
+
+	/*
+	 * GUID Info Record
+	 */
+	IB_SA_GIR_LID_F,
+	IB_SA_GIR_BLOCKNUM_F,
+	IB_SA_GIR_GUID0_F,
+	IB_SA_GIR_GUID1_F,
+	IB_SA_GIR_GUID2_F,
+	IB_SA_GIR_GUID3_F,
+	IB_SA_GIR_GUID4_F,
+	IB_SA_GIR_GUID5_F,
+	IB_SA_GIR_GUID6_F,
+	IB_SA_GIR_GUID7_F,
+
+	/*
+	 * More PortInfo fields
+	 */
+	IB_PORT_CAPMASK2_F,
+	IB_PORT_LINK_SPEED_EXT_ACTIVE_F,
+	IB_PORT_LINK_SPEED_EXT_SUPPORTED_F,
+	IB_PORT_LINK_SPEED_EXT_ENABLED_F,
+	IB_PORT_LINK_SPEED_EXT_LAST_F,
+
+	/*
+	 * PortExtendedSpeedsCounters fields
+	 */
+	IB_PESC_PORT_SELECT_F,
+	IB_PESC_COUNTER_SELECT_F,
+	IB_PESC_SYNC_HDR_ERR_CTR_F,
+	IB_PESC_UNK_BLOCK_CTR_F,
+	IB_PESC_ERR_DET_CTR_LANE0_F,
+	IB_PESC_ERR_DET_CTR_LANE1_F,
+	IB_PESC_ERR_DET_CTR_LANE2_F,
+	IB_PESC_ERR_DET_CTR_LANE3_F,
+	IB_PESC_ERR_DET_CTR_LANE4_F,
+	IB_PESC_ERR_DET_CTR_LANE5_F,
+	IB_PESC_ERR_DET_CTR_LANE6_F,
+	IB_PESC_ERR_DET_CTR_LANE7_F,
+	IB_PESC_ERR_DET_CTR_LANE8_F,
+	IB_PESC_ERR_DET_CTR_LANE9_F,
+	IB_PESC_ERR_DET_CTR_LANE10_F,
+	IB_PESC_ERR_DET_CTR_LANE11_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE0_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE1_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE2_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE3_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE4_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE5_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE6_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE7_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE8_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE9_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE10_F,
+	IB_PESC_FEC_CORR_BLOCK_CTR_LANE11_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE0_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE1_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE2_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE3_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE4_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE5_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE6_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE7_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE8_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE9_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE10_F,
+	IB_PESC_FEC_UNCORR_BLOCK_CTR_LANE11_F,
+	IB_PESC_LAST_F,
+
+	/*
+	 * PortOpRcvCounters fields
+	 */
+	IB_PC_PORT_OP_RCV_COUNTERS_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_OP_RCV_PKTS_F = IB_PC_PORT_OP_RCV_COUNTERS_FIRST_F,
+	IB_PC_PORT_OP_RCV_DATA_F,
+	IB_PC_PORT_OP_RCV_COUNTERS_LAST_F,
+
+	/*
+	 * PortFlowCtlCounters fields
+	 */
+	IB_PC_PORT_FLOW_CTL_COUNTERS_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_XMIT_FLOW_PKTS_F = IB_PC_PORT_FLOW_CTL_COUNTERS_FIRST_F,
+	IB_PC_PORT_RCV_FLOW_PKTS_F,
+	IB_PC_PORT_FLOW_CTL_COUNTERS_LAST_F,
+
+	/*
+	 * PortVLOpPackets fields
+	 */
+	IB_PC_PORT_VL_OP_PACKETS_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_VL_OP_PACKETS0_F = IB_PC_PORT_VL_OP_PACKETS_FIRST_F,
+	IB_PC_PORT_VL_OP_PACKETS1_F,
+	IB_PC_PORT_VL_OP_PACKETS2_F,
+	IB_PC_PORT_VL_OP_PACKETS3_F,
+	IB_PC_PORT_VL_OP_PACKETS4_F,
+	IB_PC_PORT_VL_OP_PACKETS5_F,
+	IB_PC_PORT_VL_OP_PACKETS6_F,
+	IB_PC_PORT_VL_OP_PACKETS7_F,
+	IB_PC_PORT_VL_OP_PACKETS8_F,
+	IB_PC_PORT_VL_OP_PACKETS9_F,
+	IB_PC_PORT_VL_OP_PACKETS10_F,
+	IB_PC_PORT_VL_OP_PACKETS11_F,
+	IB_PC_PORT_VL_OP_PACKETS12_F,
+	IB_PC_PORT_VL_OP_PACKETS13_F,
+	IB_PC_PORT_VL_OP_PACKETS14_F,
+	IB_PC_PORT_VL_OP_PACKETS15_F,
+	IB_PC_PORT_VL_OP_PACKETS_LAST_F,
+
+	/*
+	 * PortVLOpData fields
+	 */
+	IB_PC_PORT_VL_OP_DATA_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_VL_OP_DATA0_F = IB_PC_PORT_VL_OP_DATA_FIRST_F,
+	IB_PC_PORT_VL_OP_DATA1_F,
+	IB_PC_PORT_VL_OP_DATA2_F,
+	IB_PC_PORT_VL_OP_DATA3_F,
+	IB_PC_PORT_VL_OP_DATA4_F,
+	IB_PC_PORT_VL_OP_DATA5_F,
+	IB_PC_PORT_VL_OP_DATA6_F,
+	IB_PC_PORT_VL_OP_DATA7_F,
+	IB_PC_PORT_VL_OP_DATA8_F,
+	IB_PC_PORT_VL_OP_DATA9_F,
+	IB_PC_PORT_VL_OP_DATA10_F,
+	IB_PC_PORT_VL_OP_DATA11_F,
+	IB_PC_PORT_VL_OP_DATA12_F,
+	IB_PC_PORT_VL_OP_DATA13_F,
+	IB_PC_PORT_VL_OP_DATA14_F,
+	IB_PC_PORT_VL_OP_DATA15_F,
+	IB_PC_PORT_VL_OP_DATA_LAST_F,
+
+	/*
+	 * PortVLXmitFlowCtlUpdateErrors fields
+	 */
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS0_F = IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_FIRST_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS1_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS2_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS3_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS4_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS5_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS6_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS7_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS8_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS9_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS10_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS11_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS12_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS13_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS14_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS15_F,
+	IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_LAST_F,
+
+	/*
+	 * PortVLXmitWaitCounters fields
+	 */
+	IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_PORT_VL_XMIT_WAIT0_F = IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_FIRST_F,
+	IB_PC_PORT_VL_XMIT_WAIT1_F,
+	IB_PC_PORT_VL_XMIT_WAIT2_F,
+	IB_PC_PORT_VL_XMIT_WAIT3_F,
+	IB_PC_PORT_VL_XMIT_WAIT4_F,
+	IB_PC_PORT_VL_XMIT_WAIT5_F,
+	IB_PC_PORT_VL_XMIT_WAIT6_F,
+	IB_PC_PORT_VL_XMIT_WAIT7_F,
+	IB_PC_PORT_VL_XMIT_WAIT8_F,
+	IB_PC_PORT_VL_XMIT_WAIT9_F,
+	IB_PC_PORT_VL_XMIT_WAIT10_F,
+	IB_PC_PORT_VL_XMIT_WAIT11_F,
+	IB_PC_PORT_VL_XMIT_WAIT12_F,
+	IB_PC_PORT_VL_XMIT_WAIT13_F,
+	IB_PC_PORT_VL_XMIT_WAIT14_F,
+	IB_PC_PORT_VL_XMIT_WAIT15_F,
+	IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_LAST_F,
+
+	/*
+	 * SwPortVLCongestion fields
+	 */
+	IB_PC_SW_PORT_VL_CONGESTION_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_SW_PORT_VL_CONGESTION0_F = IB_PC_SW_PORT_VL_CONGESTION_FIRST_F,
+	IB_PC_SW_PORT_VL_CONGESTION1_F,
+	IB_PC_SW_PORT_VL_CONGESTION2_F,
+	IB_PC_SW_PORT_VL_CONGESTION3_F,
+	IB_PC_SW_PORT_VL_CONGESTION4_F,
+	IB_PC_SW_PORT_VL_CONGESTION5_F,
+	IB_PC_SW_PORT_VL_CONGESTION6_F,
+	IB_PC_SW_PORT_VL_CONGESTION7_F,
+	IB_PC_SW_PORT_VL_CONGESTION8_F,
+	IB_PC_SW_PORT_VL_CONGESTION9_F,
+	IB_PC_SW_PORT_VL_CONGESTION10_F,
+	IB_PC_SW_PORT_VL_CONGESTION11_F,
+	IB_PC_SW_PORT_VL_CONGESTION12_F,
+	IB_PC_SW_PORT_VL_CONGESTION13_F,
+	IB_PC_SW_PORT_VL_CONGESTION14_F,
+	IB_PC_SW_PORT_VL_CONGESTION15_F,
+	IB_PC_SW_PORT_VL_CONGESTION_LAST_F,
+
+	/*
+	 * PortRcvConCtrl fields
+	 */
+	IB_PC_RCV_CON_CTRL_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_RCV_CON_CTRL_PKT_RCV_FECN_F = IB_PC_RCV_CON_CTRL_FIRST_F,
+	IB_PC_RCV_CON_CTRL_PKT_RCV_BECN_F,
+	IB_PC_RCV_CON_CTRL_LAST_F,
+
+	/*
+	 * PortSLRcvFECN fields
+	 */
+	IB_PC_SL_RCV_FECN_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_SL_RCV_FECN0_F = IB_PC_SL_RCV_FECN_FIRST_F,
+	IB_PC_SL_RCV_FECN1_F,
+	IB_PC_SL_RCV_FECN2_F,
+	IB_PC_SL_RCV_FECN3_F,
+	IB_PC_SL_RCV_FECN4_F,
+	IB_PC_SL_RCV_FECN5_F,
+	IB_PC_SL_RCV_FECN6_F,
+	IB_PC_SL_RCV_FECN7_F,
+	IB_PC_SL_RCV_FECN8_F,
+	IB_PC_SL_RCV_FECN9_F,
+	IB_PC_SL_RCV_FECN10_F,
+	IB_PC_SL_RCV_FECN11_F,
+	IB_PC_SL_RCV_FECN12_F,
+	IB_PC_SL_RCV_FECN13_F,
+	IB_PC_SL_RCV_FECN14_F,
+	IB_PC_SL_RCV_FECN15_F,
+	IB_PC_SL_RCV_FECN_LAST_F,
+
+	/*
+	 * PortSLRcvBECN fields
+	 */
+	IB_PC_SL_RCV_BECN_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_SL_RCV_BECN0_F = IB_PC_SL_RCV_BECN_FIRST_F,
+	IB_PC_SL_RCV_BECN1_F,
+	IB_PC_SL_RCV_BECN2_F,
+	IB_PC_SL_RCV_BECN3_F,
+	IB_PC_SL_RCV_BECN4_F,
+	IB_PC_SL_RCV_BECN5_F,
+	IB_PC_SL_RCV_BECN6_F,
+	IB_PC_SL_RCV_BECN7_F,
+	IB_PC_SL_RCV_BECN8_F,
+	IB_PC_SL_RCV_BECN9_F,
+	IB_PC_SL_RCV_BECN10_F,
+	IB_PC_SL_RCV_BECN11_F,
+	IB_PC_SL_RCV_BECN12_F,
+	IB_PC_SL_RCV_BECN13_F,
+	IB_PC_SL_RCV_BECN14_F,
+	IB_PC_SL_RCV_BECN15_F,
+	IB_PC_SL_RCV_BECN_LAST_F,
+
+	/*
+	 * PortXmitConCtrl fields
+	 */
+	IB_PC_XMIT_CON_CTRL_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_XMIT_CON_CTRL_TIME_CONG_F = IB_PC_XMIT_CON_CTRL_FIRST_F,
+	IB_PC_XMIT_CON_CTRL_LAST_F,
+
+	/*
+	 * PortVLXmitTimeCong fields
+	 */
+	IB_PC_VL_XMIT_TIME_CONG_FIRST_F, /* for PortSelect and CounterSelect, use IB_PC_PORT_SELECT_F and IB_PC_COUNTER_SELECT_F */
+	IB_PC_VL_XMIT_TIME_CONG0_F = IB_PC_VL_XMIT_TIME_CONG_FIRST_F,
+	IB_PC_VL_XMIT_TIME_CONG1_F,
+	IB_PC_VL_XMIT_TIME_CONG2_F,
+	IB_PC_VL_XMIT_TIME_CONG3_F,
+	IB_PC_VL_XMIT_TIME_CONG4_F,
+	IB_PC_VL_XMIT_TIME_CONG5_F,
+	IB_PC_VL_XMIT_TIME_CONG6_F,
+	IB_PC_VL_XMIT_TIME_CONG7_F,
+	IB_PC_VL_XMIT_TIME_CONG8_F,
+	IB_PC_VL_XMIT_TIME_CONG9_F,
+	IB_PC_VL_XMIT_TIME_CONG10_F,
+	IB_PC_VL_XMIT_TIME_CONG11_F,
+	IB_PC_VL_XMIT_TIME_CONG12_F,
+	IB_PC_VL_XMIT_TIME_CONG13_F,
+	IB_PC_VL_XMIT_TIME_CONG14_F,
+	IB_PC_VL_XMIT_TIME_CONG_LAST_F,
+
+	/*
+	 * Mellanox ExtendedPortInfo fields
+	 */
+	IB_MLNX_EXT_PORT_STATE_CHG_ENABLE_F,
+	IB_MLNX_EXT_PORT_LINK_SPEED_SUPPORTED_F,
+	IB_MLNX_EXT_PORT_LINK_SPEED_ENABLED_F,
+	IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F,
+	IB_MLNX_EXT_PORT_LAST_F,
+
+	/*
+	 * Congestion Control Mad fields
+	 * bytes 24-31 of congestion control mad
+	 */
+	IB_CC_CCKEY_F,
+
+	/*
+	 * CongestionInfo fields
+	 */
+	IB_CC_CONGESTION_INFO_FIRST_F,
+	IB_CC_CONGESTION_INFO_F = IB_CC_CONGESTION_INFO_FIRST_F,
+	IB_CC_CONGESTION_INFO_CONTROL_TABLE_CAP_F,
+	IB_CC_CONGESTION_INFO_LAST_F,
+
+	/*
+	 * CongestionKeyInfo fields
+	 */
+	IB_CC_CONGESTION_KEY_INFO_FIRST_F,
+	IB_CC_CONGESTION_KEY_INFO_CC_KEY_F = IB_CC_CONGESTION_KEY_INFO_FIRST_F,
+	IB_CC_CONGESTION_KEY_INFO_CC_KEY_PROTECT_BIT_F,
+	IB_CC_CONGESTION_KEY_INFO_CC_KEY_LEASE_PERIOD_F,
+	IB_CC_CONGESTION_KEY_INFO_CC_KEY_VIOLATIONS_F,
+	IB_CC_CONGESTION_KEY_INFO_LAST_F,
+
+	/*
+	 * CongestionLog (common) fields
+	 */
+	IB_CC_CONGESTION_LOG_FIRST_F,
+	IB_CC_CONGESTION_LOG_LOGTYPE_F = IB_CC_CONGESTION_LOG_FIRST_F,
+	IB_CC_CONGESTION_LOG_CONGESTION_FLAGS_F,
+	IB_CC_CONGESTION_LOG_LAST_F,
+
+	/*
+	 * CongestionLog (Switch) fields
+	 */
+	IB_CC_CONGESTION_LOG_SWITCH_FIRST_F,
+	IB_CC_CONGESTION_LOG_SWITCH_LOG_EVENTS_COUNTER_F = IB_CC_CONGESTION_LOG_SWITCH_FIRST_F,
+	IB_CC_CONGESTION_LOG_SWITCH_CURRENT_TIME_STAMP_F,
+	IB_CC_CONGESTION_LOG_SWITCH_PORTMAP_F,
+	IB_CC_CONGESTION_LOG_SWITCH_LAST_F,
+
+	/*
+	 * CongestionLogEvent (Switch) fields
+	 */
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_FIRST_F,
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_SLID_F = IB_CC_CONGESTION_LOG_ENTRY_SWITCH_FIRST_F,
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_DLID_F,
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_SL_F,
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_TIMESTAMP_F,
+	IB_CC_CONGESTION_LOG_ENTRY_SWITCH_LAST_F,
+
+	/*
+	 * CongestionLog (CA) fields
+	 */
+	IB_CC_CONGESTION_LOG_CA_FIRST_F,
+	IB_CC_CONGESTION_LOG_CA_THRESHOLD_EVENT_COUNTER_F = IB_CC_CONGESTION_LOG_CA_FIRST_F,
+	IB_CC_CONGESTION_LOG_CA_THRESHOLD_CONGESTION_EVENT_MAP_F,
+	IB_CC_CONGESTION_LOG_CA_CURRENT_TIMESTAMP_F,
+	IB_CC_CONGESTION_LOG_CA_LAST_F,
+
+	/*
+	 * CongestionLogEvent (CA) fields
+	 */
+	IB_CC_CONGESTION_LOG_ENTRY_CA_FIRST_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_LOCAL_QP_CN_ENTRY_F = IB_CC_CONGESTION_LOG_ENTRY_CA_FIRST_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_SL_CN_ENTRY_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_SERVICE_TYPE_CN_ENTRY_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_REMOTE_QP_NUMBER_CN_ENTRY_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_LOCAL_LID_CN_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_REMOTE_LID_CN_ENTRY_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_TIMESTAMP_CN_ENTRY_F,
+	IB_CC_CONGESTION_LOG_ENTRY_CA_LAST_F,
+
+	/*
+	 * SwitchCongestionSetting fields
+	 */
+	IB_CC_SWITCH_CONGESTION_SETTING_FIRST_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_CONTROL_MAP_F = IB_CC_SWITCH_CONGESTION_SETTING_FIRST_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_VICTIM_MASK_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_CREDIT_MASK_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_THRESHOLD_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_PACKET_SIZE_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_CS_THRESHOLD_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_CS_RETURN_DELAY_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_MARKING_RATE_F,
+	IB_CC_SWITCH_CONGESTION_SETTING_LAST_F,
+
+	/*
+	 * SwitchPortCongestionSettingElement fields
+	 */
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_FIRST_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F = IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_FIRST_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_CONTROL_TYPE_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_THRESHOLD_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_PACKET_SIZE_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_CONG_PARM_MARKING_RATE_F,
+	IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_LAST_F,
+
+	/*
+	 * CACongestionSetting fields
+	 */
+	IB_CC_CA_CONGESTION_SETTING_FIRST_F,
+	IB_CC_CA_CONGESTION_SETTING_PORT_CONTROL_F = IB_CC_CA_CONGESTION_SETTING_FIRST_F,
+	IB_CC_CA_CONGESTION_SETTING_CONTROL_MAP_F,
+	IB_CC_CA_CONGESTION_SETTING_LAST_F,
+
+	/*
+	 * CACongestionEntry fields
+	 */
+	IB_CC_CA_CONGESTION_ENTRY_FIRST_F,
+	IB_CC_CA_CONGESTION_ENTRY_CCTI_TIMER_F = IB_CC_CA_CONGESTION_ENTRY_FIRST_F,
+	IB_CC_CA_CONGESTION_ENTRY_CCTI_INCREASE_F,
+	IB_CC_CA_CONGESTION_ENTRY_TRIGGER_THRESHOLD_F,
+	IB_CC_CA_CONGESTION_ENTRY_CCTI_MIN_F,
+	IB_CC_CA_CONGESTION_ENTRY_LAST_F,
+
+	/*
+	 * CongestionControlTable fields
+	 */
+	IB_CC_CONGESTION_CONTROL_TABLE_FIRST_F,
+	IB_CC_CONGESTION_CONTROL_TABLE_CCTI_LIMIT_F = IB_CC_CONGESTION_CONTROL_TABLE_FIRST_F,
+	IB_CC_CONGESTION_CONTROL_TABLE_LAST_F,
+
+	/*
+	 * CongestionControlTableEntry fields
+	 */
+	IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_FIRST_F,
+	IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_CCT_SHIFT_F = IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_FIRST_F,
+	IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_CCT_MULTIPLIER_F,
+	IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_LAST_F,
+
+	/*
+	 * Timestamp fields
+	 */
+	IB_CC_TIMESTAMP_FIRST_F,
+	IB_CC_TIMESTAMP_F = IB_CC_TIMESTAMP_FIRST_F,
+	IB_CC_TIMESTAMP_LAST_F,
+
+	/*
+	 * Node Record
+	 */
+	IB_SA_NR_FIRST_F,
+	IB_SA_NR_LID_F = IB_SA_NR_FIRST_F,
+	IB_SA_NR_BASEVER_F,
+	IB_SA_NR_CLASSVER_F,
+	IB_SA_NR_TYPE_F,
+	IB_SA_NR_NPORTS_F,
+	IB_SA_NR_SYSTEM_GUID_F,
+	IB_SA_NR_GUID_F,
+	IB_SA_NR_PORT_GUID_F,
+	IB_SA_NR_PARTITION_CAP_F,
+	IB_SA_NR_DEVID_F,
+	IB_SA_NR_REVISION_F,
+	IB_SA_NR_LOCAL_PORT_F,
+	IB_SA_NR_VENDORID_F,
+	IB_SA_NR_NODEDESC_F,
+	IB_SA_NR_LAST_F,
+
+	/*
+	 * PortSamplesResult fields
+	 */
+	IB_PSR_TAG_F,
+	IB_PSR_SAMPLE_STATUS_F,
+	IB_PSR_COUNTER0_F,
+	IB_PSR_COUNTER1_F,
+	IB_PSR_COUNTER2_F,
+	IB_PSR_COUNTER3_F,
+	IB_PSR_COUNTER4_F,
+	IB_PSR_COUNTER5_F,
+	IB_PSR_COUNTER6_F,
+	IB_PSR_COUNTER7_F,
+	IB_PSR_COUNTER8_F,
+	IB_PSR_COUNTER9_F,
+	IB_PSR_COUNTER10_F,
+	IB_PSR_COUNTER11_F,
+	IB_PSR_COUNTER12_F,
+	IB_PSR_COUNTER13_F,
+	IB_PSR_COUNTER14_F,
+	IB_PSR_LAST_F,
+
 	IB_FIELD_LAST_		/* must be last */
 };
 
@@ -974,6 +1459,9 @@
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
@@ -1021,6 +1509,7 @@
     mad_dump_linkwidth, mad_dump_linkwidthsup, mad_dump_linkwidthen,
     mad_dump_linkdowndefstate,
     mad_dump_linkspeed, mad_dump_linkspeedsup, mad_dump_linkspeeden,
+    mad_dump_linkspeedext, mad_dump_linkspeedextsup, mad_dump_linkspeedexten,
     mad_dump_portstate, mad_dump_portstates,
     mad_dump_physportstate, mad_dump_portcapmask,
     mad_dump_mtu, mad_dump_vlcap, mad_dump_opervls,
@@ -1029,7 +1518,21 @@
     mad_dump_switchinfo, mad_dump_perfcounters, mad_dump_perfcounters_ext,
     mad_dump_perfcounters_xmt_sl, mad_dump_perfcounters_rcv_sl,
     mad_dump_perfcounters_xmt_disc, mad_dump_perfcounters_rcv_err,
-    mad_dump_portsamples_control;
+    mad_dump_portsamples_control, mad_dump_port_ext_speeds_counters,
+    mad_dump_perfcounters_port_op_rcv_counters, mad_dump_perfcounters_port_flow_ctl_counters,
+    mad_dump_perfcounters_port_vl_op_packet, mad_dump_perfcounters_port_vl_op_data,
+    mad_dump_perfcounters_port_vl_xmit_flow_ctl_update_errors, mad_dump_perfcounters_port_vl_xmit_wait_counters,
+    mad_dump_perfcounters_sw_port_vl_congestion, mad_dump_perfcounters_rcv_con_ctrl,
+    mad_dump_perfcounters_sl_rcv_fecn, mad_dump_perfcounters_sl_rcv_becn,
+    mad_dump_perfcounters_xmit_con_ctrl, mad_dump_perfcounters_vl_xmit_time_cong,
+    mad_dump_mlnx_ext_port_info, mad_dump_cc_congestioninfo, mad_dump_cc_congestionkeyinfo,
+    mad_dump_cc_congestionlog, mad_dump_cc_congestionlogswitch,
+    mad_dump_cc_congestionlogentryswitch, mad_dump_cc_congestionlogca,
+    mad_dump_cc_congestionlogentryca, mad_dump_cc_switchcongestionsetting,
+    mad_dump_cc_switchportcongestionsettingelement, mad_dump_cc_cacongestionsetting,
+    mad_dump_cc_cacongestionentry, mad_dump_cc_congestioncontroltable,
+    mad_dump_cc_congestioncontroltableentry, mad_dump_cc_timestamp,
+    mad_dump_classportinfo, mad_dump_portsamples_result;
 
 MAD_EXPORT void mad_dump_fields(char *buf, int bufsz, void *val, int valsz,
 				int start, int end);
@@ -1036,6 +1539,10 @@
 
 extern MAD_EXPORT int ibdebug;
 
+#if !(defined(__SVR4) && defined(__sun))
+#include <endian.h>
+#include <byteswap.h>
+
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #ifndef ntohll
 static inline uint64_t ntohll(uint64_t x)
@@ -1063,6 +1570,9 @@
 }
 #endif
 #endif				/* __BYTE_ORDER == __BIG_ENDIAN */
+#else
+#include <infiniband/ofa_solaris.h>
+#endif
 
 /* Misc. macros: */
 /** align value \a l to \a size (ceil) */
@@ -1069,14 +1579,14 @@
 #define ALIGN(l, size) (((l) + ((size) - 1)) / (size) * (size))
 
 /** printf style warning MACRO, includes name of function and pid */
-#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
+#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
 
-#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
+#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
 
-#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
+#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
 
 #define IBPANIC(fmt, ...) do { \
-	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", getpid(), __func__, ## __VA_ARGS__); \
+	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", (int)getpid(), __func__, ## __VA_ARGS__); \
 	exit(-1); \
 } while(0)
 
diff -r -u /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h libibmad-1.3.7/include/infiniband/mad_osd.h
--- /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/include/infiniband/mad_osd.h	Thu Feb 24 11:27:11 2011
@@ -39,7 +39,9 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
+#if !(defined(__SVR4) && defined(__sun))
 #include <byteswap.h>
+#endif
 #include <inttypes.h>
 #include <arpa/inet.h>
 
diff -r -u /tmp/libibmad-1.3.7/src/fields.c libibmad-1.3.7/src/fields.c
--- /tmp/libibmad-1.3.7/src/fields.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/fields.c	Thu Feb 24 13:27:00 2011
@@ -452,21 +452,21 @@
 	/*
 	 * 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},
+	{BITSOFFS(32, 16), "PortInactiveDiscards", mad_dump_uint},
+	{BITSOFFS(48, 16), "PortNeighborMTUDiscards", mad_dump_uint},
+	{BITSOFFS(64, 16), "PortSwLifetimeLimitDiscards", mad_dump_uint},
+	{BITSOFFS(80, 16), "PortSwHOQLifetimeLimitDiscards", mad_dump_uint},
 	{0, 0},			/* IB_PC_XMT_DISC_LAST_F */
 
 	/*
 	 * PortRcvErrorDetails fields
 	 */
-	{32, 16, "PortLocalPhysicalErrors", mad_dump_uint},
-	{48, 16, "PortMalformedPktErrors", mad_dump_uint},
-	{64, 16, "PortBufferOverrunErrors", mad_dump_uint},
-	{80, 16, "PortDLIDMappingErrors", mad_dump_uint},
-	{96, 16, "PortVLMappingErrors", mad_dump_uint},
-	{112, 16, "PortLoopingErrors", mad_dump_uint},
+	{BITSOFFS(32, 16), "PortLocalPhysicalErrors", mad_dump_uint},
+	{BITSOFFS(48, 16), "PortMalformedPktErrors", mad_dump_uint},
+	{BITSOFFS(64, 16), "PortBufferOverrunErrors", mad_dump_uint},
+	{BITSOFFS(80, 16), "PortDLIDMappingErrors", mad_dump_uint},
+	{BITSOFFS(96, 16), "PortVLMappingErrors", mad_dump_uint},
+	{BITSOFFS(112, 16), "PortLoopingErrors", mad_dump_uint},
 	{0, 0},                 /* IB_PC_RCV_ERR_LAST_F */
 
 	/*
@@ -485,25 +485,470 @@
 	{160, 64, "VendorMask", mad_dump_hex},
 	{224, 32, "SampleStart", mad_dump_uint},
 	{256, 32, "SampleInterval", mad_dump_uint},
-	{288, 16, "Tag", mad_dump_hex},
-	{304, 16, "CounterSelect0", mad_dump_hex},
-	{320, 16, "CounterSelect1", mad_dump_hex},
-	{336, 16, "CounterSelect2", mad_dump_hex},
-	{352, 16, "CounterSelect3", mad_dump_hex},
-	{368, 16, "CounterSelect4", mad_dump_hex},
-	{384, 16, "CounterSelect5", mad_dump_hex},
-	{400, 16, "CounterSelect6", mad_dump_hex},
-	{416, 16, "CounterSelect7", mad_dump_hex},
-	{432, 16, "CounterSelect8", mad_dump_hex},
-	{448, 16, "CounterSelect9", mad_dump_hex},
-	{464, 16, "CounterSelect10", mad_dump_hex},
-	{480, 16, "CounterSelect11", mad_dump_hex},
-	{496, 16, "CounterSelect12", mad_dump_hex},
-	{512, 16, "CounterSelect13", mad_dump_hex},
-	{528, 16, "CounterSelect14", mad_dump_hex},
+	{BITSOFFS(288, 16), "Tag", mad_dump_hex},
+	{BITSOFFS(304, 16), "CounterSelect0", mad_dump_hex},
+	{BITSOFFS(320, 16), "CounterSelect1", mad_dump_hex},
+	{BITSOFFS(336, 16), "CounterSelect2", mad_dump_hex},
+	{BITSOFFS(352, 16), "CounterSelect3", mad_dump_hex},
+	{BITSOFFS(368, 16), "CounterSelect4", mad_dump_hex},
+	{BITSOFFS(384, 16), "CounterSelect5", mad_dump_hex},
+	{BITSOFFS(400, 16), "CounterSelect6", mad_dump_hex},
+	{BITSOFFS(416, 16), "CounterSelect7", mad_dump_hex},
+	{BITSOFFS(432, 16), "CounterSelect8", mad_dump_hex},
+	{BITSOFFS(448, 16), "CounterSelect9", mad_dump_hex},
+	{BITSOFFS(464, 16), "CounterSelect10", mad_dump_hex},
+	{BITSOFFS(480, 16), "CounterSelect11", mad_dump_hex},
+	{BITSOFFS(496, 16), "CounterSelect12", mad_dump_hex},
+	{BITSOFFS(512, 16), "CounterSelect13", mad_dump_hex},
+	{BITSOFFS(528, 16), "CounterSelect14", mad_dump_hex},
 	{576, 64, "SamplesOnlyOptionMask", mad_dump_hex},
 	{0, 0},			/* IB_PSC_LAST_F */
 
+	/* GUIDInfo fields */
+	{0, 64, "GUID0", mad_dump_hex},
+	{64, 64, "GUID1", mad_dump_hex},
+	{128, 64, "GUID2", mad_dump_hex},
+	{192, 64, "GUID3", mad_dump_hex},
+	{256, 64, "GUID4", mad_dump_hex},
+	{320, 64, "GUID5", mad_dump_hex},
+	{384, 64, "GUID6", mad_dump_hex},
+	{448, 64, "GUID7", mad_dump_hex},
+
+	/* GUID Info Record */
+	{BITSOFFS(0, 16), "Lid", mad_dump_uint},
+	{BITSOFFS(16, 8), "BlockNum", mad_dump_uint},
+	{64, 64, "Guid0", mad_dump_hex},
+	{128, 64, "Guid1", mad_dump_hex},
+	{192, 64, "Guid2", mad_dump_hex},
+	{256, 64, "Guid3", mad_dump_hex},
+	{320, 64, "Guid4", mad_dump_hex},
+	{384, 64, "Guid5", mad_dump_hex},
+	{448, 64, "Guid6", mad_dump_hex},
+	{512, 64, "Guid7", mad_dump_hex},
+
+	/*
+	 * More PortInfo fields
+	 */
+	{BITSOFFS(480, 16), "CapabilityMask2", mad_dump_hex},
+	{BITSOFFS(496, 4), "LinkSpeedExtActive", mad_dump_linkspeedext},
+	{BITSOFFS(500, 4), "LinkSpeedExtSupported", mad_dump_linkspeedextsup},
+	{BITSOFFS(507, 5), "LinkSpeedExtEnabled", mad_dump_linkspeedexten},
+	{0, 0},			/* IB_PORT_LINK_SPEED_EXT_LAST_F */
+
+	/*
+	 * PortExtendedSpeedsCounters fields
+	 */
+	{BITSOFFS(8, 8), "PortSelect", mad_dump_uint},
+	{64, 64, "CounterSelect", mad_dump_hex},
+	{BITSOFFS(128, 16), "SyncHeaderErrorCounter", mad_dump_uint},
+	{BITSOFFS(144, 16), "UnknownBlockCounter", mad_dump_uint},
+	{BITSOFFS(160, 16), "ErrorDetectionCounterLane0", mad_dump_uint},
+	{BITSOFFS(176, 16), "ErrorDetectionCounterLane1", mad_dump_uint},
+	{BITSOFFS(192, 16), "ErrorDetectionCounterLane2", mad_dump_uint},
+	{BITSOFFS(208, 16), "ErrorDetectionCounterLane3", mad_dump_uint},
+	{BITSOFFS(224, 16), "ErrorDetectionCounterLane4", mad_dump_uint},
+	{BITSOFFS(240, 16), "ErrorDetectionCounterLane5", mad_dump_uint},
+	{BITSOFFS(256, 16), "ErrorDetectionCounterLane6", mad_dump_uint},
+	{BITSOFFS(272, 16), "ErrorDetectionCounterLane7", mad_dump_uint},
+	{BITSOFFS(288, 16), "ErrorDetectionCounterLane8", mad_dump_uint},
+	{BITSOFFS(304, 16), "ErrorDetectionCounterLane9", mad_dump_uint},
+	{BITSOFFS(320, 16), "ErrorDetectionCounterLane10", mad_dump_uint},
+	{BITSOFFS(336, 16), "ErrorDetectionCounterLane11", mad_dump_uint},
+	{352, 32, "FECCorrectableBlockCtrLane0", mad_dump_uint},
+	{384, 32, "FECCorrectableBlockCtrLane1", mad_dump_uint},
+	{416, 32, "FECCorrectableBlockCtrLane2", mad_dump_uint},
+	{448, 32, "FECCorrectableBlockCtrLane3", mad_dump_uint},
+	{480, 32, "FECCorrectableBlockCtrLane4", mad_dump_uint},
+	{512, 32, "FECCorrectableBlockCtrLane5", mad_dump_uint},
+	{544, 32, "FECCorrectableBlockCtrLane6", mad_dump_uint},
+	{576, 32, "FECCorrectableBlockCtrLane7", mad_dump_uint},
+	{608, 32, "FECCorrectableBlockCtrLane8", mad_dump_uint},
+	{640, 32, "FECCorrectableBlockCtrLane9", mad_dump_uint},
+	{672, 32, "FECCorrectableBlockCtrLane10", mad_dump_uint},
+	{704, 32, "FECCorrectableBlockCtrLane11", mad_dump_uint},
+	{736, 32, "FECUncorrectableBlockCtrLane0", mad_dump_uint},
+	{768, 32, "FECUncorrectableBlockCtrLane1", mad_dump_uint},
+	{800, 32, "FECUncorrectableBlockCtrLane2", mad_dump_uint},
+	{832, 32, "FECUncorrectableBlockCtrLane3", mad_dump_uint},
+	{864, 32, "FECUncorrectableBlockCtrLane4", mad_dump_uint},
+	{896, 32, "FECUncorrectableBlockCtrLane5", mad_dump_uint},
+	{928, 32, "FECUncorrectableBlockCtrLane6", mad_dump_uint},
+	{960, 32, "FECUncorrectableBlockCtrLane7", mad_dump_uint},
+	{992, 32, "FECUncorrectableBlockCtrLane8", mad_dump_uint},
+	{1024, 32, "FECUncorrectableBlockCtrLane9", mad_dump_uint},
+	{1056, 32, "FECUncorrectableBlockCtrLane10", mad_dump_uint},
+	{1088, 32, "FECUncorrectableBlockCtrLane11", mad_dump_uint},
+	{0, 0},			/* IB_PESC_LAST_F */
+
+	/*
+	 * PortOpRcvCounters fields
+	 */
+	{32, 32, "PortOpRcvPkts", mad_dump_uint},
+	{64, 32, "PortOpRcvData", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_OP_RCV_COUNTERS_LAST_F */
+
+	/*
+	 * PortFlowCtlCounters fields
+	 */
+	{32, 32, "PortXmitFlowPkts", mad_dump_uint},
+	{64, 32, "PortRcvFlowPkts", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_FLOW_CTL_COUNTERS_LAST_F */
+
+	/*
+	 * PortVLOpPackets fields
+	 */
+	{BITSOFFS(32, 16), "PortVLOpPackets0", mad_dump_uint},
+	{BITSOFFS(48, 16), "PortVLOpPackets1", mad_dump_uint},
+	{BITSOFFS(64, 16), "PortVLOpPackets2", mad_dump_uint},
+	{BITSOFFS(80, 16), "PortVLOpPackets3", mad_dump_uint},
+	{BITSOFFS(96, 16), "PortVLOpPackets4", mad_dump_uint},
+	{BITSOFFS(112, 16), "PortVLOpPackets5", mad_dump_uint},
+	{BITSOFFS(128, 16), "PortVLOpPackets6", mad_dump_uint},
+	{BITSOFFS(144, 16), "PortVLOpPackets7", mad_dump_uint},
+	{BITSOFFS(160, 16), "PortVLOpPackets8", mad_dump_uint},
+	{BITSOFFS(176, 16), "PortVLOpPackets9", mad_dump_uint},
+	{BITSOFFS(192, 16), "PortVLOpPackets10", mad_dump_uint},
+	{BITSOFFS(208, 16), "PortVLOpPackets11", mad_dump_uint},
+	{BITSOFFS(224, 16), "PortVLOpPackets12", mad_dump_uint},
+	{BITSOFFS(240, 16), "PortVLOpPackets13", mad_dump_uint},
+	{BITSOFFS(256, 16), "PortVLOpPackets14", mad_dump_uint},
+	{BITSOFFS(272, 16), "PortVLOpPackets15", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_VL_OP_PACKETS_LAST_F */
+
+	/*
+	 * PortVLOpData fields
+	 */
+	{32, 32, "PortVLOpData0", mad_dump_uint},
+	{64, 32, "PortVLOpData1", mad_dump_uint},
+	{96, 32, "PortVLOpData2", mad_dump_uint},
+	{128, 32, "PortVLOpData3", mad_dump_uint},
+	{160, 32, "PortVLOpData4", mad_dump_uint},
+	{192, 32, "PortVLOpData5", mad_dump_uint},
+	{224, 32, "PortVLOpData6", mad_dump_uint},
+	{256, 32, "PortVLOpData7", mad_dump_uint},
+	{288, 32, "PortVLOpData8", mad_dump_uint},
+	{320, 32, "PortVLOpData9", mad_dump_uint},
+	{352, 32, "PortVLOpData10", mad_dump_uint},
+	{384, 32, "PortVLOpData11", mad_dump_uint},
+	{416, 32, "PortVLOpData12", mad_dump_uint},
+	{448, 32, "PortVLOpData13", mad_dump_uint},
+	{480, 32, "PortVLOpData14", mad_dump_uint},
+	{512, 32, "PortVLOpData15", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_VL_OP_DATA_LAST_F */
+
+	/*
+	 * PortVLXmitFlowCtlUpdateErrors fields
+	 */
+	{BITSOFFS(32, 2), "PortVLXmitFlowCtlUpdateErrors0", mad_dump_uint},
+	{BITSOFFS(34, 2), "PortVLXmitFlowCtlUpdateErrors1", mad_dump_uint},
+	{BITSOFFS(36, 2), "PortVLXmitFlowCtlUpdateErrors2", mad_dump_uint},
+	{BITSOFFS(38, 2), "PortVLXmitFlowCtlUpdateErrors3", mad_dump_uint},
+	{BITSOFFS(40, 2), "PortVLXmitFlowCtlUpdateErrors4", mad_dump_uint},
+	{BITSOFFS(42, 2), "PortVLXmitFlowCtlUpdateErrors5", mad_dump_uint},
+	{BITSOFFS(44, 2), "PortVLXmitFlowCtlUpdateErrors6", mad_dump_uint},
+	{BITSOFFS(46, 2), "PortVLXmitFlowCtlUpdateErrors7", mad_dump_uint},
+	{BITSOFFS(48, 2), "PortVLXmitFlowCtlUpdateErrors8", mad_dump_uint},
+	{BITSOFFS(50, 2), "PortVLXmitFlowCtlUpdateErrors9", mad_dump_uint},
+	{BITSOFFS(52, 2), "PortVLXmitFlowCtlUpdateErrors10", mad_dump_uint},
+	{BITSOFFS(54, 2), "PortVLXmitFlowCtlUpdateErrors11", mad_dump_uint},
+	{BITSOFFS(56, 2), "PortVLXmitFlowCtlUpdateErrors12", mad_dump_uint},
+	{BITSOFFS(58, 2), "PortVLXmitFlowCtlUpdateErrors13", mad_dump_uint},
+	{BITSOFFS(60, 2), "PortVLXmitFlowCtlUpdateErrors14", mad_dump_uint},
+	{BITSOFFS(62, 2), "PortVLXmitFlowCtlUpdateErrors15", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_VL_XMIT_FLOW_CTL_UPDATE_ERRORS_LAST_F */
+
+	/*
+	 * PortVLXmitWaitCounters fields
+	 */
+	{BITSOFFS(32, 16), "PortVLXmitWait0", mad_dump_uint},
+	{BITSOFFS(48, 16), "PortVLXmitWait1", mad_dump_uint},
+	{BITSOFFS(64, 16), "PortVLXmitWait2", mad_dump_uint},
+	{BITSOFFS(80, 16), "PortVLXmitWait3", mad_dump_uint},
+	{BITSOFFS(96, 16), "PortVLXmitWait4", mad_dump_uint},
+	{BITSOFFS(112, 16), "PortVLXmitWait5", mad_dump_uint},
+	{BITSOFFS(128, 16), "PortVLXmitWait6", mad_dump_uint},
+	{BITSOFFS(144, 16), "PortVLXmitWait7", mad_dump_uint},
+	{BITSOFFS(160, 16), "PortVLXmitWait8", mad_dump_uint},
+	{BITSOFFS(176, 16), "PortVLXmitWait9", mad_dump_uint},
+	{BITSOFFS(192, 16), "PortVLXmitWait10", mad_dump_uint},
+	{BITSOFFS(208, 16), "PortVLXmitWait11", mad_dump_uint},
+	{BITSOFFS(224, 16), "PortVLXmitWait12", mad_dump_uint},
+	{BITSOFFS(240, 16), "PortVLXmitWait13", mad_dump_uint},
+	{BITSOFFS(256, 16), "PortVLXmitWait14", mad_dump_uint},
+	{BITSOFFS(272, 16), "PortVLXmitWait15", mad_dump_uint},
+	{0, 0},			/* IB_PC_PORT_VL_XMIT_WAIT_COUNTERS_LAST_F */
+
+	/*
+	 * SwPortVLCongestion fields
+	 */
+	{BITSOFFS(32, 16), "SWPortVLCongestion0", mad_dump_uint},
+	{BITSOFFS(48, 16), "SWPortVLCongestion1", mad_dump_uint},
+	{BITSOFFS(64, 16), "SWPortVLCongestion2", mad_dump_uint},
+	{BITSOFFS(80, 16), "SWPortVLCongestion3", mad_dump_uint},
+	{BITSOFFS(96, 16), "SWPortVLCongestion4", mad_dump_uint},
+	{BITSOFFS(112, 16), "SWPortVLCongestion5", mad_dump_uint},
+	{BITSOFFS(128, 16), "SWPortVLCongestion6", mad_dump_uint},
+	{BITSOFFS(144, 16), "SWPortVLCongestion7", mad_dump_uint},
+	{BITSOFFS(160, 16), "SWPortVLCongestion8", mad_dump_uint},
+	{BITSOFFS(176, 16), "SWPortVLCongestion9", mad_dump_uint},
+	{BITSOFFS(192, 16), "SWPortVLCongestion10", mad_dump_uint},
+	{BITSOFFS(208, 16), "SWPortVLCongestion11", mad_dump_uint},
+	{BITSOFFS(224, 16), "SWPortVLCongestion12", mad_dump_uint},
+	{BITSOFFS(240, 16), "SWPortVLCongestion13", mad_dump_uint},
+	{BITSOFFS(256, 16), "SWPortVLCongestion14", mad_dump_uint},
+	{BITSOFFS(272, 16), "SWPortVLCongestion15", mad_dump_uint},
+	{0, 0},			/* IB_PC_SW_PORT_VL_CONGESTION_LAST_F */
+
+	/*
+	 * PortRcvConCtrl fields
+	 */
+	{32, 32, "PortPktRcvFECN", mad_dump_uint},
+	{64, 32, "PortPktRcvBECN", mad_dump_uint},
+	{0, 0},			/* IB_PC_RCV_CON_CTRL_LAST_F */
+
+	/*
+	 * PortSLRcvFECN fields
+	 */
+	{32, 32, "PortSLRcvFECN0", mad_dump_uint},
+	{64, 32, "PortSLRcvFECN1", mad_dump_uint},
+	{96, 32, "PortSLRcvFECN2", mad_dump_uint},
+	{128, 32, "PortSLRcvFECN3", mad_dump_uint},
+	{160, 32, "PortSLRcvFECN4", mad_dump_uint},
+	{192, 32, "PortSLRcvFECN5", mad_dump_uint},
+	{224, 32, "PortSLRcvFECN6", mad_dump_uint},
+	{256, 32, "PortSLRcvFECN7", mad_dump_uint},
+	{288, 32, "PortSLRcvFECN8", mad_dump_uint},
+	{320, 32, "PortSLRcvFECN9", mad_dump_uint},
+	{352, 32, "PortSLRcvFECN10", mad_dump_uint},
+	{384, 32, "PortSLRcvFECN11", mad_dump_uint},
+	{416, 32, "PortSLRcvFECN12", mad_dump_uint},
+	{448, 32, "PortSLRcvFECN13", mad_dump_uint},
+	{480, 32, "PortSLRcvFECN14", mad_dump_uint},
+	{512, 32, "PortSLRcvFECN15", mad_dump_uint},
+	{0, 0},			/* IB_PC_SL_RCV_FECN_LAST_F */
+
+	/*
+	 * PortSLRcvBECN fields
+	 */
+	{32, 32, "PortSLRcvBECN0", mad_dump_uint},
+	{64, 32, "PortSLRcvBECN1", mad_dump_uint},
+	{96, 32, "PortSLRcvBECN2", mad_dump_uint},
+	{128, 32, "PortSLRcvBECN3", mad_dump_uint},
+	{160, 32, "PortSLRcvBECN4", mad_dump_uint},
+	{192, 32, "PortSLRcvBECN5", mad_dump_uint},
+	{224, 32, "PortSLRcvBECN6", mad_dump_uint},
+	{256, 32, "PortSLRcvBECN7", mad_dump_uint},
+	{288, 32, "PortSLRcvBECN8", mad_dump_uint},
+	{320, 32, "PortSLRcvBECN9", mad_dump_uint},
+	{352, 32, "PortSLRcvBECN10", mad_dump_uint},
+	{384, 32, "PortSLRcvBECN11", mad_dump_uint},
+	{416, 32, "PortSLRcvBECN12", mad_dump_uint},
+	{448, 32, "PortSLRcvBECN13", mad_dump_uint},
+	{480, 32, "PortSLRcvBECN14", mad_dump_uint},
+	{512, 32, "PortSLRcvBECN15", mad_dump_uint},
+	{0, 0},			/* IB_PC_SL_RCV_BECN_LAST_F */
+
+	/*
+	 * PortXmitConCtrl fields
+	 */
+	{32, 32, "PortXmitTimeCong", mad_dump_uint},
+	{0, 0},			/* IB_PC_XMIT_CON_CTRL_LAST_F */
+
+	/*
+	 * PortVLXmitTimeCong fields
+	 */
+	{32, 32, "PortVLXmitTimeCong0", mad_dump_uint},
+	{64, 32, "PortVLXmitTimeCong1", mad_dump_uint},
+	{96, 32, "PortVLXmitTimeCong2", mad_dump_uint},
+	{128, 32, "PortVLXmitTimeCong3", mad_dump_uint},
+	{160, 32, "PortVLXmitTimeCong4", mad_dump_uint},
+	{192, 32, "PortVLXmitTimeCong5", mad_dump_uint},
+	{224, 32, "PortVLXmitTimeCong6", mad_dump_uint},
+	{256, 32, "PortVLXmitTimeCong7", mad_dump_uint},
+	{288, 32, "PortVLXmitTimeCong8", mad_dump_uint},
+	{320, 32, "PortVLXmitTimeCong9", mad_dump_uint},
+	{352, 32, "PortVLXmitTimeCong10", mad_dump_uint},
+	{384, 32, "PortVLXmitTimeCong11", mad_dump_uint},
+	{416, 32, "PortVLXmitTimeCong12", mad_dump_uint},
+	{448, 32, "PortVLXmitTimeCong13", mad_dump_uint},
+	{480, 32, "PortVLXmitTimeCong14", mad_dump_uint},
+	{0, 0},			/* IB_PC_VL_XMIT_TIME_CONG_LAST_F */
+
+	/*
+	 * Mellanox ExtendedPortInfo fields
+	 */
+	{BITSOFFS(24, 8), "StateChangeEnable", mad_dump_hex},
+	{BITSOFFS(56, 8), "LinkSpeedSupported", mad_dump_hex},
+	{BITSOFFS(88, 8), "LinkSpeedEnabled", mad_dump_hex},
+	{BITSOFFS(120, 8), "LinkSpeedActive", mad_dump_hex},
+	{0, 0},			/* IB_MLNX_EXT_PORT_LAST_F */
+
+	/*
+	 * Congestion Control Mad fields
+	 * bytes 24-31 of congestion control mad
+	 */
+	{192, 64, "CC_Key", mad_dump_hex},	/* IB_CC_CCKEY_F */
+
+	/*
+	 * CongestionInfo fields
+	 */
+	{BITSOFFS(0, 16), "CongestionInfo", mad_dump_hex},
+	{BITSOFFS(16, 8), "ControlTableCap", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_INFO_LAST_F */
+
+	/*
+	 * CongestionKeyInfo fields
+	 */
+	{0, 64, "CC_Key", mad_dump_hex},
+	{BITSOFFS(64, 1), "CC_KeyProtectBit", mad_dump_uint},
+	{BITSOFFS(80, 16), "CC_KeyLeasePeriod", mad_dump_uint},
+	{BITSOFFS(96, 16), "CC_KeyViolations", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_KEY_INFO_LAST_F */
+
+	/*
+	 * CongestionLog (common) fields
+	 */
+	{BITSOFFS(0, 8), "LogType", mad_dump_uint},
+	{BITSOFFS(8, 8), "CongestionFlags", mad_dump_hex},
+	{0, 0},			/* IB_CC_CONGESTION_LOG_LAST_F */
+
+	/*
+	 * CongestionLog (Switch) fields
+	 */
+	{BITSOFFS(16, 16), "LogEventsCounter", mad_dump_uint},
+	{32, 32, "CurrentTimeStamp", mad_dump_uint},
+	{64, 256, "PortMap", mad_dump_array},
+	{0, 0},			/* IB_CC_CONGESTION_LOG_SWITCH_LAST_F */
+
+	/*
+	 * CongestionLogEvent (Switch) fields
+	 */
+	{BITSOFFS(0, 16), "SLID", mad_dump_uint},
+	{BITSOFFS(16, 16), "DLID", mad_dump_uint},
+	{BITSOFFS(32, 4), "SL", mad_dump_uint},
+	{64, 32, "Timestamp", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_LOG_ENTRY_SWITCH_LAST_F */
+
+	/*
+	 * CongestionLog (CA) fields
+	 */
+	{BITSOFFS(16, 16), "ThresholdEventCounter", mad_dump_uint},
+	{BITSOFFS(32, 16), "ThresholdCongestionEventMap", mad_dump_hex},
+	/* XXX: Q3/2010 errata lists offset 48, but that means field is not
+	 * world aligned.  Assume will be aligned to offset 64 later.
+	 */
+	{BITSOFFS(64, 32), "CurrentTimeStamp", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_LOG_CA_LAST_F */
+
+	/*
+	 * CongestionLogEvent (CA) fields
+	 */
+	{BITSOFFS(0, 24), "Local_QP_CN_Entry", mad_dump_uint},
+	{BITSOFFS(24, 4), "SL_CN_Entry", mad_dump_uint},
+	{BITSOFFS(28, 4), "Service_Type_CN_Entry", mad_dump_hex},
+	{BITSOFFS(32, 24), "Remote_QP_Number_CN_Entry", mad_dump_uint},
+	{BITSOFFS(64, 16), "Local_LID_CN", mad_dump_uint},
+	{BITSOFFS(80, 16), "Remote_LID_CN_Entry", mad_dump_uint},
+	{BITSOFFS(96, 32), "Timestamp_CN_Entry", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_LOG_ENTRY_CA_LAST_F */
+
+	/*
+	 * SwitchCongestionSetting fields
+	 */
+	{0, 32, "Control_Map", mad_dump_hex},
+	{32, 256, "Victim_Mask", mad_dump_array},
+	{288, 256, "Credit_Mask", mad_dump_array},
+	{BITSOFFS(544, 4), "Threshold", mad_dump_uint},
+	{BITSOFFS(552, 8), "Packet_Size", mad_dump_uint},
+	{BITSOFFS(560, 4), "CS_Threshold", mad_dump_uint},
+	{BITSOFFS(576, 16), "CS_ReturnDelay", mad_dump_hex}, /* TODO: CCT dump */
+	{BITSOFFS(592, 16), "Marking_Rate", mad_dump_uint},
+	{0, 0},			/* IB_CC_SWITCH_CONGESTION_SETTING_LAST_F */
+
+	/*
+	 * SwitchPortCongestionSettingElement fields
+	 */
+	{BITSOFFS(0, 1), "Valid", mad_dump_uint},
+	{BITSOFFS(1, 1), "Control_Type", mad_dump_uint},
+	{BITSOFFS(4, 4), "Threshold", mad_dump_hex},
+	{BITSOFFS(8, 8), "Packet_Size", mad_dump_uint},
+	{BITSOFFS(16, 16), "Cong_Parm_Marking_Rate", mad_dump_uint},
+	{0, 0},			/* IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_LAST_F */
+
+	/*
+	 * CACongestionSetting fields
+	 */
+	{BITSOFFS(0, 16), "Port_Control", mad_dump_hex},
+	{BITSOFFS(16, 16), "Control_Map", mad_dump_hex},
+	{0, 0},			/* IB_CC_CA_CONGESTION_SETTING_LAST_F */
+
+	/*
+	 * CACongestionEntry fields
+	 */
+	{BITSOFFS(0, 16), "CCTI_Timer", mad_dump_uint},
+	{BITSOFFS(16, 8), "CCTI_Increase", mad_dump_uint},
+	{BITSOFFS(24, 8), "Trigger_Threshold", mad_dump_uint},
+	{BITSOFFS(32, 8), "CCTI_Min", mad_dump_uint},
+	{0, 0},			/* IB_CC_CA_CONGESTION_SETTING_ENTRY_LAST_F */
+
+	/*
+	 * CongestionControlTable fields
+	 */
+	{BITSOFFS(0, 16), "CCTI_Limit", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_CONTROL_TABLE_LAST_F */
+
+	/*
+	 * CongestionControlTableEntry fields
+	 */
+	{BITSOFFS(0, 2), "CCT_Shift", mad_dump_uint},
+	{BITSOFFS(2, 14), "CCT_Multiplier", mad_dump_uint},
+	{0, 0},			/* IB_CC_CONGESTION_CONTROL_TABLE_ENTRY_LAST_F */
+
+	/*
+	 * Timestamp fields
+	 */
+	{0, 32, "Timestamp", mad_dump_uint},
+	{0, 0}, /* IB_CC_TIMESTAMP_LAST_F */
+
+	/* Node Record */
+	{BITSOFFS(0, 16), "Lid", mad_dump_uint},
+	{BITSOFFS(32, 8), "BaseVers", mad_dump_uint},
+	{BITSOFFS(40, 8), "ClassVers", mad_dump_uint},
+	{BITSOFFS(48, 8), "NodeType", mad_dump_node_type},
+	{BITSOFFS(56, 8), "NumPorts", mad_dump_uint},
+	{64, 64, "SystemGuid", mad_dump_hex},
+	{128, 64, "Guid", mad_dump_hex},
+	{192, 64, "PortGuid", mad_dump_hex},
+	{BITSOFFS(256, 16), "PartCap", mad_dump_uint},
+	{BITSOFFS(272, 16), "DevId", mad_dump_hex},
+	{288, 32, "Revision", mad_dump_hex},
+	{BITSOFFS(320, 8), "LocalPort", mad_dump_uint},
+	{BITSOFFS(328, 24), "VendorId", mad_dump_hex},
+	{352, 64 * 8, "NodeDesc", mad_dump_string},
+	{0, 0}, /* IB_SA_NR_LAST_F */
+
+	/*
+	 * PortSamplesResult fields
+	 */
+	{BITSOFFS(0, 16), "Tag", mad_dump_hex},
+	{BITSOFFS(30, 2), "SampleStatus", mad_dump_hex},
+	{32, 32, "Counter0", mad_dump_uint},
+	{64, 32, "Counter1", mad_dump_uint},
+	{96, 32, "Counter2", mad_dump_uint},
+	{128, 32, "Counter3", mad_dump_uint},
+	{160, 32, "Counter4", mad_dump_uint},
+	{192, 32, "Counter5", mad_dump_uint},
+	{224, 32, "Counter6", mad_dump_uint},
+	{256, 32, "Counter7", mad_dump_uint},
+	{288, 32, "Counter8", mad_dump_uint},
+	{320, 32, "Counter9", mad_dump_uint},
+	{352, 32, "Counter10", mad_dump_uint},
+	{384, 32, "Counter11", mad_dump_uint},
+	{416, 32, "Counter12", mad_dump_uint},
+	{448, 32, "Counter13", mad_dump_uint},
+	{480, 32, "Counter14", mad_dump_uint},
+	{0, 0},			/* IB_PSR_LAST_F */
+
 	{0, 0}			/* IB_FIELD_LAST_ */
 
 };
@@ -514,7 +959,7 @@
 	uint64_t nval;
 
 	nval = htonll(val);
-	memcpy((char *)buf + base_offs + f->bitoffs / 8, &nval,
+	memcpy( (void*)((char *)buf + base_offs + f->bitoffs / 8), (void *)&nval,
 	       sizeof(uint64_t));
 }
 
@@ -521,7 +966,7 @@
 static uint64_t _get_field64(void *buf, int base_offs, const ib_field_t * f)
 {
 	uint64_t val;
-	memcpy(&val, ((char *)buf + base_offs + f->bitoffs / 8),
+	memcpy( (void *)&val, (void *)((char *)buf + base_offs + f->bitoffs / 8),
 	       sizeof(uint64_t));
 	return ntohll(val);
 }
diff -r -u /tmp/libibmad-1.3.7/src/mad.c libibmad-1.3.7/src/mad.c
--- /tmp/libibmad-1.3.7/src/mad.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/mad.c	Thu Sep 13 09:31:03 2012
@@ -61,6 +61,7 @@
 		trid = random();
 	}
 	next = ++trid | (base << 32);
+	next &= 0x00ffffffffffffff;
 	return next;
 }
 
diff -r -u /tmp/libibmad-1.3.7/src/resolve.c libibmad-1.3.7/src/resolve.c
--- /tmp/libibmad-1.3.7/src/resolve.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/resolve.c	Mon Oct  1 01:32:21 2012
@@ -40,6 +40,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <arpa/inet.h>
+#include <errno.h>
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
@@ -57,10 +58,18 @@
 
 	memset(sm_id, 0, sizeof(*sm_id));
 
-	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport))
+	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport)) {
+		if (!errno)
+			errno = EIO;
 		return -1;
+	}
 
 	mad_decode_field(portinfo, IB_PORT_SMLID_F, &lid);
+	if (lid == 0) {
+		if (!errno)
+			errno = EIO;
+		return -1;
+	}
 	mad_decode_field(portinfo, IB_PORT_SMSL_F, &sm_id->sl);
 
 	return ib_portid_set(sm_id, lid, 0, 0);
@@ -95,7 +104,7 @@
 			ib_portid_t * sm_id, int timeout,
 			const struct ibmad_port *srcport)
 {
-	ib_portid_t sm_portid;
+	ib_portid_t sm_portid = { 0 };
 	uint8_t buf[IB_SA_DATA_SIZE] = { 0 };
 	ib_portid_t self = { 0 };
 	uint64_t selfguid, prefix;
@@ -102,14 +111,19 @@
 	ibmad_gid_t selfgid;
 	uint8_t nodeinfo[64];
 
-	if (!sm_id) {
+	if (!sm_id)
 		sm_id = &sm_portid;
+
+	if (!sm_id->lid) {
 		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0)
 			return -1;
 	}
 
-	if (!smp_query_via(nodeinfo, &self, IB_ATTR_NODE_INFO, 0, 0, srcport))
+	if (!smp_query_via(nodeinfo, &self, IB_ATTR_NODE_INFO, 0, 0, srcport)) {
+		if (!errno)
+			errno = EIO;
 		return -1;
+	}
 	mad_decode_field(nodeinfo, IB_NODE_PORT_GUID_F, &selfguid);
 	mad_set_field64(selfgid, 0, IB_GID_PREFIX_F, IB_DEFAULT_SUBN_PREFIX);
 	mad_set_field64(selfgid, 0, IB_GID_GUID_F, selfguid);
diff -r -u /tmp/libibmad-1.3.7/src/dump.c libibmad-1.3.7/src/dump.c
--- /tmp/libibmad-1.3.7/src/dump.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/dump.c	Mon May 27 17:23:19 2013
@@ -46,12 +46,24 @@
 
 void mad_dump_int(char *buf, int bufsz, void *val, int valsz)
 {
+	/*
+	 * the val pointer passed to the dump routines are always 32 bit
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
+	 */
 	switch (valsz) {
 	case 1:
-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint8_t *)val) + 3;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%d", *(uint8_t *) val & 0xff);
 		break;
 	case 2:
-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xffff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint16_t *)val) + 1;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%d", *(uint16_t *) val & 0xffff);
 		break;
 	case 3:
 	case 4:
@@ -71,12 +83,24 @@
 
 void mad_dump_uint(char *buf, int bufsz, void *val, int valsz)
 {
+	/*
+	 * the val pointer passed to the dump routines are always 32 bit
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
+	 */
 	switch (valsz) {
 	case 1:
-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint8_t *)val) + 3;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%u", *(uint8_t *) val & 0xff);
 		break;
 	case 2:
-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xffff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint16_t *)val) + 1;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%u", *(uint16_t *) val & 0xffff);
 		break;
 	case 3:
 	case 4:
@@ -96,15 +120,28 @@
 
 void mad_dump_hex(char *buf, int bufsz, void *val, int valsz)
 {
+	/*
+	 * the val pointer passed to the dump routines are always 32 bit
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
+	 */
 	switch (valsz) {
 	case 1:
-		snprintf(buf, bufsz, "0x%02x", *(uint32_t *) val & 0xff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint8_t *)val) + 3;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "0x%02x", *(uint8_t *) val & 0xff);
 		break;
 	case 2:
-		snprintf(buf, bufsz, "0x%04x", *(uint32_t *) val & 0xffff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint16_t *)val) + 1;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "0x%04x", *(uint16_t *) val & 0xffff);
 		break;
 	case 3:
-		snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
+		//snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
+		snprintf(buf, bufsz, "0x%x", *(uint32_t *)val & 0xffffff);
 		break;
 	case 4:
 		snprintf(buf, bufsz, "0x%08x", *(uint32_t *) val);
@@ -132,12 +169,24 @@
 
 void mad_dump_rhex(char *buf, int bufsz, void *val, int valsz)
 {
+	/*
+	 * the val pointer passed to the dump routines are always 32 bit
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
+	 */
 	switch (valsz) {
 	case 1:
-		snprintf(buf, bufsz, "%02x", *(uint32_t *) val & 0xff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint8_t *)val) + 3;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%02x", *(uint8_t *) val & 0xff);
 		break;
 	case 2:
-		snprintf(buf, bufsz, "%04x", *(uint32_t *) val & 0xffff);
+#if defined(_BIG_ENDIAN)
+		val = ((uint16_t *)val) + 1;
+#endif /* _BIG_ENDIAN */
+		snprintf(buf, bufsz, "%04x", *(uint16_t *) val & 0xffff);
 		break;
 	case 3:
 		snprintf(buf, bufsz, "%06x", *(uint32_t *) val & 0xffffff);
@@ -308,6 +357,21 @@
 	dump_linkspeed(buf, bufsz, speed);
 }
 
+void mad_dump_linkspeedext(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_linkspeedextsup(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_linkspeedexten(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
 void mad_dump_portstate(char *buf, int bufsz, void *val, int valsz)
 {
 	int state = *(int *)val;
@@ -760,6 +824,158 @@
 	_dump_fields(buf, bufsz, val, IB_PSC_OPCODE_F, IB_PSC_LAST_F);
 }
 
+void mad_dump_portsamples_result(char *buf, int bufsz, void *val, int valsz)
+{
+
+	return;
+}
+
+void mad_dump_port_ext_speeds_counters(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_op_rcv_counters(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_flow_ctl_counters(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_vl_op_packet(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_vl_op_data(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_vl_xmit_flow_ctl_update_errors(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_port_vl_xmit_wait_counters(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_sw_port_vl_congestion(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+
+void mad_dump_perfcounters_rcv_con_ctrl(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_sl_rcv_fecn(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_sl_rcv_becn(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_xmit_con_ctrl(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_perfcounters_vl_xmit_time_cong(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_mlnx_ext_port_info(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestioninfo(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionkeyinfo(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionlog(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionlogswitch(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionlogentryswitch(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionlogca(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestionlogentryca(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_switchcongestionsetting(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_switchportcongestionsettingelement(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_cacongestionsetting(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_cacongestionentry(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestioncontroltable(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_congestioncontroltableentry(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_cc_timestamp(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
+void mad_dump_classportinfo(char *buf, int bufsz, void *val, int valsz)
+{
+	return;
+}
+
 void xdump(FILE * file, char *msg, void *p, int size)
 {
 #define HEX(x)  ((x) < 10 ? '0' + (x) : 'a' + ((x) -10))
diff -r -u /tmp/libibmad-1.3.7/src/sa.c libibmad-1.3.7/src/sa.c
--- /tmp/libibmad-1.3.7/src/sa.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/sa.c	Mon Oct  1 01:32:21 2012
@@ -38,6 +38,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include <infiniband/mad.h>
 #include "mad_internal.h"
@@ -56,6 +57,7 @@
 
 	if (portid->lid <= 0) {
 		IBWARN("only lid routes are supported");
+		errno = EIO;
 		return NULL;
 	}
 
@@ -144,4 +146,48 @@
 		  void *buf)
 {
 	return ib_path_query_via(ibmp, srcgid, destgid, sm_id, buf);
+}
+
+/* NodeRecord */
+#define IB_NR_COMPMASK_LID				(1ull<<0)
+#define IB_NR_COMPMASK_RESERVED1			(1ull<<1)
+#define IB_NR_COMPMASK_BASEVERSION			(1ull<<2)
+#define IB_NR_COMPMASK_CLASSVERSION			(1ull<<3)
+#define IB_NR_COMPMASK_NODETYPE				(1ull<<4)
+#define IB_NR_COMPMASK_NUMPORTS				(1ull<<5)
+#define IB_NR_COMPMASK_SYSIMAGEGUID			(1ull<<6)
+#define IB_NR_COMPMASK_NODEGUID				(1ull<<7)
+#define IB_NR_COMPMASK_PORTGUID				(1ull<<8)
+#define IB_NR_COMPMASK_PARTCAP				(1ull<<9)
+#define IB_NR_COMPMASK_DEVID				(1ull<<10)
+#define IB_NR_COMPMASK_REV				(1ull<<11)
+#define IB_NR_COMPMASK_PORTNUM				(1ull<<12)
+#define IB_NR_COMPMASK_VENDID				(1ull<<13)
+#define IB_NR_COMPMASK_NODEDESC				(1ull<<14)
+
+#define IB_NR_DEF_MASK IB_NR_COMPMASK_PORTGUID
+
+int ib_node_query_via(const struct ibmad_port *srcport, uint64_t guid,
+		      ib_portid_t * sm_id, void *buf)
+{
+	ib_sa_call_t sa = { 0 };
+	uint8_t *p;
+
+	memset(&sa, 0, sizeof sa);
+	sa.method = IB_MAD_METHOD_GET;
+	sa.attrid = IB_SA_ATTR_NODERECORD;
+	sa.mask = IB_NR_DEF_MASK;
+	sa.trid = mad_trid();
+
+	memset(buf, 0, IB_SA_NR_RECSZ);
+
+	mad_encode_field(buf, IB_SA_NR_PORT_GUID_F, &guid);
+
+	p = sa_rpc_call(srcport, buf, sm_id, &sa, 0);
+	if (!p) {
+		IBWARN("sa call node_query failed");
+		return -1;
+	}
+
+	return 0;
 }
diff -r -u /tmp/libibmad-1.3.7/src/libibmad.map libibmad-1.3.7/src/libibmad.map
--- /tmp/libibmad-1.3.7/src/libibmad.map	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/libibmad.map	Thu Apr  4 12:02:51 2013
@@ -102,6 +102,7 @@
 		ib_vendor_call_via;
 		smp_query_via;
 		smp_set_via;
+		ib_node_query_via;
 		ib_path_query_via;
 		ib_resolve_smlid_via;
 		ib_resolve_guid_via;
diff -r -u /tmp/libibmad-1.3.7/src/rpc.c libibmad-1.3.7/src/rpc.c
--- /tmp/libibmad-1.3.7/src/rpc.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/rpc.c	Thu Feb 24 11:27:14 2011
@@ -152,7 +152,7 @@
 
 		length = len;
 		if (umad_send(port_id, agentid, sndbuf, length, timeout, 0) < 0) {
-			IBWARN("send failed; %m");
+			IBWARN("send failed; %s", strerror(errno));
 			return -1;
 		}
 
@@ -161,7 +161,7 @@
 		do {
 			length = len;
 			if (umad_recv(port_id, rcvbuf, &length, timeout) < 0) {
-				IBWARN("recv failed: %m");
+				IBWARN("recv failed: %s", strerror(errno));
 				return -1;
 			}
 
@@ -175,6 +175,7 @@
 					 IB_MAD_TRID_F) != trid);
 
 		status = umad_status(rcvbuf);
+		errno = status;
 		if (!status)
 			return length;	/* done */
 		if (status == ENOMEM)
@@ -337,7 +338,7 @@
 		IBPANIC("can't init UMAD library");
 
 	if ((fd = umad_open_port(dev_name, dev_port)) < 0)
-		IBPANIC("can't open UMAD port (%s:%d)", dev_name, dev_port);
+		IBPANIC("can't open UMAD port (%s:%d)", dev_name?dev_name:"(nil)", dev_port);
 
 	if (num_classes >= MAX_CLASS)
 		IBPANIC("too many classes %d requested", num_classes);
diff -r -u /tmp/libibmad-1.3.7/src/serv.c libibmad-1.3.7/src/serv.c
--- /tmp/libibmad-1.3.7/src/serv.c	Wed Feb 16 02:12:53 2011
+++ libibmad-1.3.7/src/serv.c	Tue Mar  5 13:18:51 2013
@@ -38,6 +38,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
@@ -75,7 +76,7 @@
 	if (umad_send(srcport->port_id, srcport->class_agents[rpc->mgtclass],
 		      umad, IB_MAD_SIZE, mad_get_timeout(srcport, rpc->timeout),
 		      0) < 0) {
-		IBWARN("send failed; %m");
+		IBWARN("send failed; %s", strerror(errno));
 		return -1;
 	}
 
@@ -157,7 +158,7 @@
 	if (umad_send
 	    (srcport->port_id, srcport->class_agents[rpc.mgtclass], umad,
 	     IB_MAD_SIZE, mad_get_timeout(srcport, rpc.timeout), 0) < 0) {
-		DEBUG("send failed; %m");
+		DEBUG("send failed; %s", strerror(errno));
 		return -1;
 	}
 
@@ -179,7 +180,7 @@
 			       mad_get_timeout(srcport, timeout))) < 0) {
 		if (!umad)
 			umad_free(mad);
-		DEBUG("recv failed: %m");
+		DEBUG("recv failed: %s", strerror(errno));
 		return 0;
 	}