components/open-fabrics/libibmad/patches/base.patch
author Boris Chiu <Boris.Chiu@Oracle.COM>
Mon, 18 Mar 2013 09:45:29 -0700
changeset 1216 bd892ba92960
parent 1067 0dc41b42eadb
child 1319 e0ba15fa5e97
permissions -rw-r--r--
16448055 libibmad: Add NodeRecord query API
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;
@@ -1036,6 +1524,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 +1555,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 +1564,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
@@ -514,7 +514,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 +521,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	Thu Feb 24 11:27:11 2011
@@ -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);
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 Mar  7 10:27:47 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	Thu Feb 24 11:27:14 2011
@@ -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;
 	}