PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
authorboris.chiu@oracle.com
Fri, 01 Apr 2016 15:20:17 -0700
changeset 5708 49b43e37ce26
parent 5707 a2b8fbf04d15
child 5709 42ebc732084b
PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates 21132063 Solaris OFUV tools/libs should handle EDR/FDR speed based cards properly 21845415 OFUV mad utilities and libraries need to be upgraded to OFED 3.18 21850735 OFUV verbs and mlx4 libraries need to be upgraded to OFED 3.18 21850928 OFUV librdmacm need to be upgraded to OFED 3.18 22213636 problem in UTILITY/OFUV_TOOLS 22219198 librdmacm: cmtime gets segmentation fault when given invalid argument with -b 22271413 ibnetdiscover has segmentation fault when link state is at 2 22641297 shared pd and fmr in solaris should be in sync with those in uek 22642557 Upgrading to OFED 3.18 requires bumping Solaris ABI version number 22652208 qperf needs to be upgraded to latest(0.4.9) 22689609 qperf returns failed to receive results: timed out for ud_bw tests 22826204 PSID ID string size in uverbs_ioctl.h should reflect kernel sizes (userland) 22912559 libsif needs to support OFED 3.18 22947813 test_verbs TEST_VERB_SRQ failed on PSIF
components/open-fabrics/Makefile
components/open-fabrics/ibutils.license
components/open-fabrics/ibutils/Makefile
components/open-fabrics/ibutils/patches/001-ibutils-solaris_port.patch
components/open-fabrics/ibutils/patches/002-ibutils-CVE-2013-2561-fix.patch
components/open-fabrics/ibutils/patches/base.patch
components/open-fabrics/infiniband-diags.license
components/open-fabrics/infiniband-diags/Makefile
components/open-fabrics/infiniband-diags/patches/001-infiniband-diags-solaris_port.patch
components/open-fabrics/infiniband-diags/patches/002-infiniband-diags-coredump_due_to_timeout.patch
components/open-fabrics/infiniband-diags/patches/base.patch
components/open-fabrics/infiniband-diags/solaris_set_nodedesc.c
components/open-fabrics/libibmad.license
components/open-fabrics/libibmad/Makefile
components/open-fabrics/libibmad/patches/001-libibmad-solaris_port.patch
components/open-fabrics/libibmad/patches/base.patch
components/open-fabrics/libibumad.license
components/open-fabrics/libibumad/Makefile
components/open-fabrics/libibumad/patches/001-libibumad-solaris_port.patch
components/open-fabrics/libibumad/patches/base.patch
components/open-fabrics/libibverbs.license
components/open-fabrics/libibverbs/Makefile
components/open-fabrics/libibverbs/patches/001-libibverbs-solaris_port.patch
components/open-fabrics/libibverbs/patches/002-libibverbs-shpd_fmr.patch
components/open-fabrics/libibverbs/patches/003-libibverbs-SMGID-events.patch
components/open-fabrics/libibverbs/patches/004-libibverbs-man-changes-for-no-xrc.patch
components/open-fabrics/libibverbs/patches/base.patch
components/open-fabrics/libibverbs/solaris_compatibility.c
components/open-fabrics/libmlx4.license
components/open-fabrics/libmlx4/Makefile
components/open-fabrics/libmlx4/patches/001-libmlx4-solaris_port.patch
components/open-fabrics/libmlx4/patches/002-libmlx4-shpd_fmr.patch
components/open-fabrics/libmlx4/patches/003-libmlx4-uek-shpd-fmr-merge.patch
components/open-fabrics/libmlx4/patches/004-libmlx4-remove-xrc.patch
components/open-fabrics/libmlx4/patches/base.patch
components/open-fabrics/librdmacm.license
components/open-fabrics/librdmacm/Makefile
components/open-fabrics/librdmacm/patches/001-librdmacm-disable-rsockets.patch
components/open-fabrics/librdmacm/patches/002-librdmacm-solaris_port.patch
components/open-fabrics/librdmacm/patches/003-librdmacm-22219198-cmtime-handle-invalid-address-for-bind-addr.patch
components/open-fabrics/librdmacm/patches/004-librdmacm-remove-comments-for-XRC-support-from-man-pages.patch
components/open-fabrics/librdmacm/patches/005-librdmacm-fix-core-dump-in-rping-client-without-running-server.patch
components/open-fabrics/librdmacm/patches/base.patch
components/open-fabrics/libsdp.license
components/open-fabrics/libsdp/Makefile
components/open-fabrics/libsdp/patches/001-libsdp-solaris_port.patch
components/open-fabrics/libsdp/patches/base.patch
components/open-fabrics/libsif/Makefile
components/open-fabrics/libsif/patches/001-libsif-config.patch
components/open-fabrics/libsif/patches/002-libsif-src.patch
components/open-fabrics/ofed-component.mk
components/open-fabrics/open-fabrics.license
components/open-fabrics/open-fabrics.p5m
components/open-fabrics/opensm.license
components/open-fabrics/opensm/Makefile
components/open-fabrics/opensm/patches/001-opensm-solaris_port.patch
components/open-fabrics/opensm/patches/base.patch
components/open-fabrics/perftest.license
components/open-fabrics/perftest/patches/001-perftest-solaris_port.patch
components/open-fabrics/perftest/patches/base.patch
components/open-fabrics/qperf.license
components/open-fabrics/qperf/Makefile
components/open-fabrics/qperf/patches/001-qperf-solaris_port.patch
components/open-fabrics/qperf/patches/002-qperf-free_pd_before_mr.patch
components/open-fabrics/qperf/patches/003-qperf-ud_bw_timeout.patch
components/open-fabrics/qperf/patches/base.patch
components/open-fabrics/rds-tools.license
components/open-fabrics/rds-tools/patches/001-rds-tools-solaris_port.patch
components/open-fabrics/rds-tools/patches/base.patch
--- a/components/open-fabrics/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -27,24 +27,23 @@
 LD_Z_IGNORE =
 
 COMPONENT_NAME=	open-fabrics
-COMPONENT_VERSION=1.5.3
+COMPONENT_VERSION=3.18
 COMPONENT_SRC=
 
 COMPONENT_PROJECT_URL=	http://www.openfabrics.org/
 COMPONENT_BUGDB=	library/ofuv_lib
 
-TPNO_OPEN_FABRICS=	3369
-TPNO_IBUTILS=		5084
-TPNO_INFINIBAND_DIAGS=	5085
-TPNO_LIBIBMAD=		5086
-TPNO_LIBIBUMAD=		5087
-TPNO_LIBIBVERBS=	5082
-TPNO_LIBMLX4=		5088
-TPNO_LIBRDMACM=		5089
+TPNO_IBUTILS=		24918   
+TPNO_INFINIBAND_DIAGS=	24917   
+TPNO_LIBIBMAD=		24856   
+TPNO_LIBIBUMAD=		24914   
+TPNO_LIBIBVERBS=	25232   
+TPNO_LIBMLX4=		25233
+TPNO_LIBRDMACM=		25227   
+TPNO_OPENSM=		24915
+TPNO_QPERF=		24916
 TPNO_LIBSDP=		5080
-TPNO_OPENSM=		5091
 TPNO_PERFTEST=		5081
-TPNO_QPERF=		5083
 TPNO_RDS_TOOLS=		5092
 
 # sensitive to kernel interface changes.
@@ -99,7 +98,7 @@
 librdmacm:		libibverbs
 libmlx4:		libibverbs
 rds-tools:		libibverbs
-perftest:		libibverbs librdmacm libibverbs
+perftest:		libibverbs librdmacm
 qperf:			libibverbs librdmacm
 libibumad:		libibverbs
 libibmad:		libibumad
@@ -110,6 +109,7 @@
 
 FORCE:
 
+REQUIRED_PACKAGES += library/glib2
 REQUIRED_PACKAGES += runtime/perl-512
 REQUIRED_PACKAGES += runtime/perl-520
 REQUIRED_PACKAGES += runtime/tcl-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ibutils.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,59 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license ibutils-1.5.7-0.2 under the OpenIB.org BSD license.
+
+Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
+
+Portions Copyright (c) 1995-1998
+The University of Utah and The Regents of the University of California.
+
+This software is available to you under a choice of one of two licenses. 
+You may choose to be licensed under the terms of the GNU General Public 
+License (GPL) Version 2, available from the file COPYING in the main 
+directory of this source tree, or the
+
+OpenIB.org BSD license below:
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+- Redistributions of source code must retain the above copyright notice, 
+this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright 
+notice, this list of conditions and the following disclaimer in the 
+documentation and/or other materials provided with the distribution.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
--- a/components/open-fabrics/ibutils/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/ibutils/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,20 +22,21 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		ibutils
 COMPONENT_VERSION=	1.5.7
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.2.gbd7e502.tar.gz
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:8db2fcb20102c37e7037826c58b899092df034aac870d3d50a13263746f17f18
+    sha256:67a3b417c8d0820400045dd7143674824086c6793a40ded333be50e498d9a703
 COMPONENT_BUGDB=	utility/ofuv_tools
 
 include ../ofed-component.mk
 
 LIBS +=	-lopensm -losmvendor -losmcomp -libumad -libmad
 
-LDFLAGS.64 +=	-L $(PROTOUSRLIBDIR64)
+LDFLAGS += -L$(PROTOUSRLIBDIR64)
 
 # we want to use the libcheck here
 DISABLE_LIBCHECK=
@@ -45,6 +46,7 @@
 CONFIGURE_BINDIR.64= $(USRSBINDIR)
 CONFIGURE_OPTIONS +=	CXXFLAGS="$(CC_BITS)"
 CONFIGURE_OPTIONS +=	--with-osm=$(PROTOUSRDIR)
+CONFIGURE_OPTIONS +=	--with-osm-libs=$(PROTOUSRLIBDIR64)
 
 CLEANUP_FILES =\
 	$(PROTOUSRLIBDIR)/libibdm.la\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ibutils/patches/001-ibutils-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1327 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  01104fa59c22a3fdd1e4e52ed903205a69a5dd9d
+
+diff -r 01104fa59c22 Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,7 +54,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 config/osm.m4
+--- a/config/osm.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/config/osm.m4	Fri Nov 13 06:47:32 2015 -0800
+@@ -179,7 +179,7 @@
+       osm_debug_flags=
+    fi
+ 
+-   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
++   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
+ else
+    dnl dummy values
+    with_osm=disabled
+diff -r 01104fa59c22 configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Fri Nov 13 06:47:32 2015 -0800
+@@ -1858,7 +1858,7 @@
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+ $as_echo_n "checking whether build environment is sane... " >&6; }
+@@ -2483,7 +2483,7 @@
+       osm_debug_flags=
+    fi
+ 
+-   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
++   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
+ else
+       with_osm=disabled
+    OSM_CLFAGS=disabled
+diff -r 01104fa59c22 ibdiag/Makefile.in
+--- a/ibdiag/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,7 +54,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdiag/configure
+--- a/ibdiag/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/configure	Fri Nov 13 06:47:32 2015 -0800
+@@ -1845,7 +1845,7 @@
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+ $as_echo_n "checking whether build environment is sane... " >&6; }
+diff -r 01104fa59c22 ibdiag/doc/Makefile.in
+--- a/ibdiag/doc/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/doc/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -52,7 +52,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdiag/doc/ibdiagnet.pod
+--- a/ibdiag/doc/ibdiagnet.pod	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/doc/ibdiagnet.pod	Fri Nov 13 06:47:32 2015 -0800
+@@ -122,7 +122,6 @@
+ 
+ =over
+ 
+-=item
+ Min number of packets to be sent across each link (default = 10)
+ 
+ =back
+@@ -131,7 +130,6 @@
+ 
+ =over
+ 
+-=item
+ Enable verbose mode
+ 
+ =back
+@@ -140,7 +138,6 @@
+ 
+ =over
+ 
+-=item
+ Provides a report of the fabric qualities
+ 
+ =back
+@@ -149,7 +146,6 @@
+ 
+ =over
+ 
+-=item
+ Credit loop check based on UpDown rules
+ 
+ =back
+@@ -158,8 +154,7 @@
+ 
+ =over
+ 
+-=item
+-Specifies the topology file name
++Specifies the topology file name.  The system name (-s) must also be specified if this option is used.
+ 
+ =back
+ 
+@@ -167,7 +162,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the local system name. Meaningful only if a topology file is specified
+ 
+ =back
+@@ -176,7 +170,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the index of the device of the port used to connect to the IB fabric (in case of multiple devices on the local system)
+ 
+ =back
+@@ -185,7 +178,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the local device's port num used to connect to the IB fabric
+ 
+ =back
+@@ -194,7 +186,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the directory where the output files will be placed (default = /tmp)
+ 
+ =back
+@@ -203,7 +194,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the expected link width
+ 
+ =back
+@@ -212,7 +202,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the expected link speed
+ 
+ =back
+@@ -221,7 +210,6 @@
+ 
+ =over
+ 
+-=item
+ Dump all the fabric links, pm Counters into ibdiagnet.pm
+ 
+ =back
+@@ -230,7 +218,6 @@
+ 
+ =over
+ 
+-=item
+ Reset all the fabric links pmCounters
+ 
+ =back
+@@ -239,7 +226,6 @@
+ 
+ =over
+ 
+-=item
+ If any of the provided pm is greater then its provided value, print it to screen
+ 
+ =back
+@@ -248,7 +234,6 @@
+ 
+ =over
+ 
+-=item
+ Skip the executions of the selected checks.
+ Skip options (one or more can be specified) : dup_guids  zero_guids pm logical_state part ipoib all
+ 
+@@ -258,7 +243,6 @@
+ 
+ =over
+ 
+-=item
+ Write out the discovered topology into the given file. This flag is useful if you later want to check for changes from the current state of the fabric.
+ A directory named ibdiag_ibnl is also created by this option, and holds the IBNL files required to load this topology. To use these files you will need to set the environment variable named IBDM_IBNL_PATH to that directory. The directory is located in /tmp or in the output directory provided by the -o flag.
+ 
+@@ -268,7 +252,6 @@
+ 
+ =over
+ 
+-=item
+ Load subnet data from the given .db file, and skip subnet discovery stage.
+ Note: Some of the checks require actual subnet discovery, and therefore would not run when load_db is specified. These checks are
+ : Duplicated/zero guids, link state, SMs status.
+@@ -279,7 +262,6 @@
+ 
+ =over
+ 
+-=item
+ VL based Routing - provide this option to create the paths SL file (psl), SL2VL file (slvl)
+ and use them in credit loops check (if -r option is provided).
+ 
+@@ -291,7 +273,6 @@
+ 
+ =over
+ 
+-=item
+ Prints the help page information
+ 
+ =back
+@@ -300,7 +281,6 @@
+ 
+ =over
+ 
+-=item
+ Prints the version of the tool
+ 
+ =back
+@@ -309,7 +289,6 @@
+ 
+ =over
+ 
+-=item
+ Prints the tool's environment variables and their values
+ 
+ =back
+diff -r 01104fa59c22 ibdiag/doc/ibdiagnet.txt
+--- a/ibdiag/doc/ibdiagnet.txt	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/doc/ibdiagnet.txt	Fri Nov 13 06:47:32 2015 -0800
+@@ -39,7 +39,8 @@
+                   (default = 10)
+   -v            : Instructs the tool to run in verbose mode
+   -r            : Provides a report of the fabric qualities
+-  -t <topo-file>: Specifies the topology file name
++  -t <topo-file>: Specifies the topology file name.  The system name (-s) must
++                  also be specified if this option is used.
+   -s <sys-name> : Specifies the local system name. Meaningful only if a topology
+                   file is specified
+   -i <dev-index>: Specifies the index of the device of the port used to connect
+diff -r 01104fa59c22 ibdiag/src/Makefile.in
+--- a/ibdiag/src/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/src/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+@@ -244,7 +244,7 @@
+ 	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ 	     test -z "$$files" || { \
+ 	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+-	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
++	       $(INSTALL_SCRIPT) -m 755 $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ 	     } \
+ 	; done
+ 
+@@ -426,12 +426,14 @@
+ 	sed -e 's=%ibdiag_libdir%='$(DESTDIR)$(libdir)'=' \
+ 	    -e 's=%with_ibdm_lib%='$(with_ibdm_lib)'=' \
+ 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
++	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
+ 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagnet.in > ibdiagnet
+ 
+ ibdiagpath: ibdiagpath.in
+ 	sed -e 's=%ibdiag_libdir%='$(DESTDIR)$(libdir)'=' \
+ 	    -e 's=%with_ibdm_lib%='$(with_ibdm_lib)'=' \
+ 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
++	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
+ 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagpath.in > ibdiagpath
+ 
+ ibdiagui: ibdiagui.in
+@@ -440,6 +442,7 @@
+ 	    -e 's=%with_tk_lib%='$(with_tk_lib)'=' \
+ 	    -e 's=%with_graphviz_lib%='$(with_graphviz_lib)'=' \
+ 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
++	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
+ 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagui.in > ibdiagui
+ 
+ clean:
+diff -r 01104fa59c22 ibdiag/src/ibdebug.tcl
+--- a/ibdiag/src/ibdebug.tcl	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/src/ibdebug.tcl	Fri Nov 13 06:47:32 2015 -0800
+@@ -352,13 +352,16 @@
+     if {[file exists $ibisOutDir/$ibisLogFile] && (![file writable $ibisOutDir/$ibisLogFile])} {
+ 	set ibisLogFile $ibisLogFile.[pid]
+     }
++
++    ## Check if the file exists. If it does delete it. The log file is opened with the 'w' access
++    ## mode which truncates the file to zero length, so the contents are not preserved. Deleting
++    ## the file prevents any softlink based system file clobbering issues.
+     if {[file exists $ibisOutDir/$ibisLogFile]} {
+-	if {![file writable $ibisOutDir/$ibisLogFile]} {
+-	    if {![file writable $ibisOutDir/$ibisLogFile]} {
+-		catch {set ibisLogFd [open $ibisOutDir/$ibisLogFile w]} errMsg
+-		inform "-E-ibis:file.not.writable" -value $ibisOutDir/$ibisLogFile -errMsg $errMsg
+-	    }
+-	}
++        ## Since we have already verified the directory is writable and open with 'w' option
++        ## truncates the file, it is safe to delete the file if it exists.
++        if {[catch {file delete $ibisOutDir/$ibisLogFile} errMsg]} {
++            inform "-E-ibis:could.not.delete.file" -value $ibisOutDir/$ibisLogFile
++        }
+     }
+     inform "-V-ibis.ibis.log.file" -value $ibisOutDir/$ibisLogFile
+ 
+@@ -5123,6 +5126,16 @@
+         return 1
+     }
+ 
++    ## If the file exists delete the file to prevent any symlink
++    ## system file clobbering. The file is about to be opened with
++    ## the access mode of 'w', which will truncate the file to zero
++    ## length anyway. So, it is safe to delete the file now.
++    if {[file exists $G(outfiles,.db)]} {
++        if {[catch {file delete $G(outfiles,.db)} errMsg]} {
++           return 1
++        }
++    }
++
+     set FileID [InitializeOutputFile $G(var:tool.name).db]
+ 
+     foreach {array_name data} {G data* Neighbor *} {
+diff -r 01104fa59c22 ibdiag/src/ibdebug_if.tcl
+--- a/ibdiag/src/ibdebug_if.tcl	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdiag/src/ibdebug_if.tcl	Fri Nov 13 06:47:32 2015 -0800
+@@ -675,6 +675,16 @@
+     }
+ 
+     ## Command line check - Test5.0: log file
++
++    ## The directory has been verified to be writable, delete the file if it exists since
++    ## we anyway open it with 'w' which will truncate it to zero length. Deleting the file
++    ## will prevent symlink based system file clobbering.
++    if {[file exists $G(outfiles,.log)]} {
++        if {[catch {file delete $G(outfiles,.log)} errMsg]} {
++            ## Print the delete failure error message and exit
++            inform "-E-loading:cannot.delete.file" $G(outfiles,.log) -fn $G(outfiles,.log) -errMsg $errMsg
++        }
++    }
+     if {[catch {set G(logFileID) [open $G(outfiles,.log) w]} errMsg]} {
+ 	 inform "-E-loading:cannot.open.file" $G(outfiles,.log) -fn $G(outfiles,.log) -errMsg $errMsg
+     }
+@@ -1229,6 +1239,10 @@
+ 	    append msgText "IBIS: The following file is write protected: $msgF(value)%n"
+ 	    append msgText "Error message: \"$msgF(errMsg)\""
+ 	}
++	"-E-ibis:could.not.delete.file" {
++	    append msgText "IBIS: Could not delete the file : $msgF(value)%n"
++	    append msgText "Error message: \"$msgF(errMsg)\""
++	}
+ 	"-V-ibis:ibis_get_local_ports_info" {
+ 	    append msgText "IBIS: ibis_get_local_ports_info:%n$msgF(value)"
+ 	}
+@@ -1260,6 +1274,10 @@
+ 	    append msgText "Failed to load ibdiag external DB from: $msgF(fn)%n"
+ 	    append msgText "Error message: \"$msgF(errMsg)\""
+ 	}
++	"-E-loading:cannot.delete.file" {
++	    append msgText "Could not delete the file : $msgF(fn)%n"
++	    append msgText "Error message: \"$msgF(errMsg)\""
++	}
+         "-W-loading:old.osm.version" {
+ 	    append msgText "OSM: The current OSM version is not up-to-date"
+ 	}
+diff -r 01104fa59c22 ibdm/Clusters/Makefile.in
+--- a/ibdm/Clusters/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/Clusters/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdm/Makefile.in
+--- a/ibdm/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,7 +54,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdm/aclocal.m4
+--- a/ibdm/aclocal.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/aclocal.m4	Fri Nov 13 06:47:32 2015 -0800
+@@ -1389,7 +1389,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+@@ -2601,6 +2601,23 @@
+   hardcode_into_libs=yes
+   # ldd complains unless libraries are executable
+   postinstall_cmds='chmod +x $lib'
++  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
++    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
++    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
++
++    solaris_arch=`uname -p`
++    if [ $solaris_arch = "i386" ]; then
++      lib64=amd64
++    else
++      lib64=sparcv9
++    fi
++
++    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
++      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
++      solaris_lib64path="$solaris_lib64path""$lib64"/
++      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
++    fi
++  fi
+   ;;
+ 
+ sunos4*)
+diff -r 01104fa59c22 ibdm/configure
+--- a/ibdm/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/configure	Fri Nov 13 06:47:32 2015 -0800
+@@ -2799,7 +2799,7 @@
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+ $as_echo_n "checking whether build environment is sane... " >&6; }
+@@ -6668,7 +6668,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+@@ -10350,6 +10350,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -11268,6 +11269,24 @@
+   hardcode_into_libs=yes
+   # ldd complains unless libraries are executable
+   postinstall_cmds='chmod +x $lib'
++
++  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
++    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
++    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
++
++    solaris_arch=`uname -p`
++    if [ $solaris_arch = "i386" ]; then
++      lib64=amd64
++    else
++      lib64=sparcv9
++    fi
++
++    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
++      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
++      solaris_lib64path="$solaris_lib64path""$lib64"/
++      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
++    fi
++  fi
+   ;;
+ 
+ sunos4*)
+@@ -13211,6 +13230,7 @@
+ 	    fi
+ 	    ;;
+         esac
++	hardcode_libdir_flag_spec_CXX=
+         ;;
+ 
+     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+@@ -14724,6 +14744,24 @@
+   hardcode_into_libs=yes
+   # ldd complains unless libraries are executable
+   postinstall_cmds='chmod +x $lib'
++
++  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
++    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
++    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
++
++    solaris_arch=`uname -p`
++    if [ $solaris_arch = "i386" ]; then
++      lib64=amd64
++    else
++      lib64=sparcv9
++    fi
++
++    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
++      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
++      solaris_lib64path="$solaris_lib64path""$lib64"/
++      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
++    fi
++  fi
+   ;;
+ 
+ sunos4*)
+diff -r 01104fa59c22 ibdm/doc/Makefile.in
+--- a/ibdm/doc/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/doc/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -52,7 +52,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdm/ibdm/Fabric.cpp
+--- a/ibdm/ibdm/Fabric.cpp	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/Fabric.cpp	Fri Nov 13 06:47:32 2015 -0800
+@@ -1954,6 +1954,7 @@
+         }*/
+     }
+     f.close();
++    f.clear();
+ 
+     // Make second pass and build the tables
+     f.open(fn.c_str(),ifstream::in);
+diff -r 01104fa59c22 ibdm/ibdm/Fabric.h
+--- a/ibdm/ibdm/Fabric.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/Fabric.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,6 +54,7 @@
+ #include <iostream>
+ #include <sstream>
+ #include <string>
++#include <cstring>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -69,7 +70,7 @@
+ 
+ #if __WORDSIZE == 64
+ #define PRIx64 "lx"
+-#else
++#elseif !defined(__SVR4) || !defined(__sun)
+ #define PRIx64 "llx"
+ #endif
+ using namespace std;
+diff -r 01104fa59c22 ibdm/ibdm/Makefile.in
+--- a/ibdm/ibdm/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -55,7 +55,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+@@ -316,7 +316,7 @@
+ AM_CFLAGS = $(DBG) $(IBNL_PATH) $(TCL_CFLAGS)
+ lib_LTLIBRARIES = libibdmcom.la libibdm.la
+ libibdmcom_la_SOURCES = $(common_SOURCES)
+-libibdmcom_la_LIBADD = 
++libibdmcom_la_LIBADD = $(TCL_LIBS)
+ libibdmcom_la_LDFLAGS = -version-info $(LIB_VER_TRIPLET)
+ libibdm_la_SOURCES = ibdm_wrap.cpp ibdm.i $(common_SOURCES)
+ libibdm_la_LIBADD = $(TCL_LIBS) 
+diff -r 01104fa59c22 ibdm/ibdm/TopoMatch.cpp
+--- a/ibdm/ibdm/TopoMatch.cpp	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/TopoMatch.cpp	Fri Nov 13 06:47:32 2015 -0800
+@@ -57,6 +57,9 @@
+ #include "Regexp.h"
+ #include <iomanip>
+ #include <sstream>
++#if defined(__SVR4) && defined(__sun)
++#include <strings.h>
++#endif
+ 
+ 
+ //////////////////////////////////////////////////////////////////////////////
+diff -r 01104fa59c22 ibdm/ibdm/ibdm_wrap.cpp
+--- a/ibdm/ibdm/ibdm_wrap.cpp	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/ibdm_wrap.cpp	Fri Nov 13 06:47:32 2015 -0800
+@@ -23,6 +23,9 @@
+ #include INCLUDE_TCL
+ #include <string.h>
+ #include <stdlib.h>
++#if defined(__SVR4) && defined(__sun)
++#include <strings.h>
++#endif
+ #define SWIGTCL
+ #define SWIGTCL8
+ /*
+diff -r 01104fa59c22 ibdm/ibdm/ibdmsh_wrap.cpp
+--- a/ibdm/ibdm/ibdmsh_wrap.cpp	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibdm/ibdmsh_wrap.cpp	Fri Nov 13 06:47:32 2015 -0800
+@@ -22,6 +22,9 @@
+ #define INCLUDE_TK     <tk.h>
+ #include INCLUDE_TCL
+ #include <string.h>
++#if defined(__SVR4) && defined(__sun)
++#include <strings.h>
++#endif
+ #include <stdlib.h>
+ #define SWIGTCL
+ #define SWIGTCL8
+diff -r 01104fa59c22 ibdm/ibnl/Makefile.in
+--- a/ibdm/ibnl/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/ibnl/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdm/scripts/Makefile.in
+--- a/ibdm/scripts/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/scripts/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibdm/src/Makefile.in
+--- a/ibdm/src/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibdm/src/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -57,7 +57,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibis/Makefile.in
+--- a/ibis/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,7 +54,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibis/aclocal.m4
+--- a/ibis/aclocal.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/aclocal.m4	Fri Nov 13 06:47:32 2015 -0800
+@@ -1389,7 +1389,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+diff -r 01104fa59c22 ibis/configure
+--- a/ibis/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/configure	Fri Nov 13 06:47:32 2015 -0800
+@@ -2798,7 +2798,7 @@
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+ $as_echo_n "checking whether build environment is sane... " >&6; }
+@@ -6430,7 +6430,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+@@ -10113,6 +10113,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -12974,6 +12975,7 @@
+ 	    fi
+ 	    ;;
+         esac
++	  hardcode_libdir_flag_spec_CXX=
+         ;;
+ 
+     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+@@ -15288,8 +15290,8 @@
+       else
+          osm_lib_dir=lib
+       fi
++      with_osm_libs=$with_osm/$osm_lib_dir
+    fi
+-   with_osm_libs=$with_osm/$osm_lib_dir
+ 
+       if test -d $with_osm/include/infiniband; then
+       OSM_BUILD=openib
+@@ -15299,7 +15301,7 @@
+    { $as_echo "$as_me:${as_lineno-$LINENO}: OSM: build type $OSM_BUILD" >&5
+ $as_echo "$as_me: OSM: build type $OSM_BUILD" >&6;}
+ 
+-   OSM_LDFLAGS="-Wl,-rpath -Wl,$with_osm_libs -L$with_osm_libs"
++   OSM_LDFLAGS="-L$with_osm_libs"
+          if test $OSM_BUILD = openib; then
+             osm_include_dir="$with_osm/include/infiniband"
+       osm_extra_includes="-I$with_osm/include"
+@@ -15381,7 +15383,7 @@
+       osm_debug_flags=
+    fi
+ 
+-   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
++   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
+ else
+       with_osm=disabled
+    OSM_CLFAGS=disabled
+diff -r 01104fa59c22 ibis/doc/Makefile.in
+--- a/ibis/doc/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/doc/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -52,7 +52,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibis/src/Makefile.in
+--- a/ibis/src/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -55,7 +55,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibis/src/ibbbm_base.h
+--- a/ibis/src/ibbbm_base.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibbbm_base.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -30,11 +30,14 @@
+  * SOFTWARE.
+  *
+  */
+-
+ #ifndef _IBBBM_BASE_H_
+ #define _IBBBM_BASE_H_
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #define BBM_CLASS         0x05
+ #define BBM_ATTR_BKEYINFO 0x10
+diff -r 01104fa59c22 ibis/src/ibcr_base.h
+--- a/ibis/src/ibcr_base.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibcr_base.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -34,7 +34,11 @@
+ #ifndef _IBCR_BASE_H_
+ #define _IBCR_BASE_H_
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #define CR_CLASS        0x09
+ #define CR_ATTR_50      0x50
+diff -r 01104fa59c22 ibis/src/ibis_base.h
+--- a/ibis/src/ibis_base.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibis_base.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -64,7 +64,7 @@
+ #define IBIS_FILE_PATH_MAX	PATH_MAX
+ #endif
+ 
+-#define MAX_LOCAL_IBPORTS 32
++#define MAX_LOCAL_IBPORTS MAX_PORTS
+ #define DISP_HANDLE_MAX 32
+ 
+ END_C_DECLS
+diff -r 01104fa59c22 ibis/src/ibis_wrap.c
+--- a/ibis/src/ibis_wrap.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibis_wrap.c	Fri Nov 13 06:47:32 2015 -0800
+@@ -2722,18 +2722,18 @@
+   typedef ib_mad_notice_attr_t  smNotice;
+ 
+   /* these are the globals to be used for set/get */
+-  ib_node_info_t          ibsm_node_info_obj;
+-  ib_port_info_t          ibsm_port_info_obj;
+-  ib_switch_info_t        ibsm_switch_info_obj;
+-  ibsm_lft_block_t        ibsm_lft_block_obj;
+-  ibsm_mft_block_t        ibsm_mft_block_obj;
+-  ib_guid_info_t          ibsm_guid_info_obj;
+-  ib_pkey_table_t         ibsm_pkey_table_obj;
+-  ib_slvl_table_t         ibsm_slvl_table_obj;
+-  ib_vl_arb_table_t       ibsm_vl_arb_table_obj;
+-  ib_node_desc_t          ibsm_node_desc_obj;
+-  ib_sm_info_t            ibsm_sm_info_obj;
+-  ib_mad_notice_attr_t    ibsm_notice_obj;
++  ib_node_info_t          ibsm_node_info_obj	__attribute__((aligned));
++  ib_port_info_t          ibsm_port_info_obj	__attribute__((aligned));
++  ib_switch_info_t        ibsm_switch_info_obj	__attribute__((aligned));
++  ibsm_lft_block_t        ibsm_lft_block_obj	__attribute__((aligned));
++  ibsm_mft_block_t        ibsm_mft_block_obj	__attribute__((aligned));
++  ib_guid_info_t          ibsm_guid_info_obj	__attribute__((aligned));
++  ib_pkey_table_t         ibsm_pkey_table_obj	__attribute__((aligned));
++  ib_slvl_table_t         ibsm_slvl_table_obj	__attribute__((aligned));
++  ib_vl_arb_table_t       ibsm_vl_arb_table_obj	__attribute__((aligned));
++  ib_node_desc_t          ibsm_node_desc_obj	__attribute__((aligned));
++  ib_sm_info_t            ibsm_sm_info_obj	__attribute__((aligned));
++  ib_mad_notice_attr_t    ibsm_notice_obj	__attribute__((aligned));
+ 
+   /* TODO - define a Vendor Specific CR Read/Write attributes to use VL15 */
+ 
+@@ -35181,7 +35181,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_sys_guid_set(_swigobj,_swigval)  _ibsm_node_info_sys_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_sys_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->sys_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->sys_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_sys_guid_set(_swigobj,_swigval) (_swigobj->sys_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_sys_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35239,7 +35250,17 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_sys_guid_get(_swigobj)  _ibsm_node_info_sys_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_sys_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->sys_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->sys_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_sys_guid_get(_swigobj) (&_swigobj->sys_guid)
++#endif
+ static int _wrap_smNodeInfo_sys_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35291,7 +35312,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_node_guid_set(_swigobj,_swigval)  _ibsm_node_info_node_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_node_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->node_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->node_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_node_guid_set(_swigobj,_swigval) (_swigobj->node_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_node_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35349,7 +35381,17 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_node_guid_get(_swigobj)  _ibsm_node_info_node_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_node_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->node_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->node_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_node_guid_get(_swigobj) (&_swigobj->node_guid)
++#endif
+ static int _wrap_smNodeInfo_node_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35401,7 +35443,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_port_guid_set(_swigobj,_swigval)  _ibsm_node_info_port_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_port_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->port_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->port_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_port_guid_set(_swigobj,_swigval) (_swigobj->port_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_port_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35459,7 +35512,17 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_port_guid_get(_swigobj)  _ibsm_node_info_port_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_port_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->port_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->port_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_port_guid_get(_swigobj) (&_swigobj->port_guid)
++#endif
+ static int _wrap_smNodeInfo_port_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+diff -r 01104fa59c22 ibis/src/ibissh_wrap.cpp
+--- a/ibis/src/ibissh_wrap.cpp	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibissh_wrap.cpp	Fri Nov 13 06:47:32 2015 -0800
+@@ -13,6 +13,11 @@
+  * Do not make changes to this file--changes will be lost!
+  *
+  */
++#if defined(__SVR4) && defined(__sun)
++#include <sys/types.h>
++#define	TRUE	_B_TRUE
++#define	FALSE 	_B_FALSE
++#endif
+ 
+ 
+ #define SWIGCODE
+@@ -823,7 +828,11 @@
+ 	  // Write response - no data
+ 	  // Note: The trailing space here is important !
+ 	  sprintf(buff, "ACK ");
++#if defined(__SVR4) && defined(__sun)
++	  space_in_resp = (boolean_t)0;
++#else
+ 	  space_in_resp = 0;
++#endif
+       }
+ 
+       if (is_multi && space_in_resp)
+@@ -2722,18 +2731,18 @@
+   typedef ib_mad_notice_attr_t  smNotice;
+ 
+   /* these are the globals to be used for set/get */
+-  ib_node_info_t          ibsm_node_info_obj;
+-  ib_port_info_t          ibsm_port_info_obj;
+-  ib_switch_info_t        ibsm_switch_info_obj;
+-  ibsm_lft_block_t        ibsm_lft_block_obj;
+-  ibsm_mft_block_t        ibsm_mft_block_obj;
+-  ib_guid_info_t          ibsm_guid_info_obj;
+-  ib_pkey_table_t         ibsm_pkey_table_obj;
+-  ib_slvl_table_t         ibsm_slvl_table_obj;
+-  ib_vl_arb_table_t       ibsm_vl_arb_table_obj;
+-  ib_node_desc_t          ibsm_node_desc_obj;
+-  ib_sm_info_t            ibsm_sm_info_obj;
+-  ib_mad_notice_attr_t    ibsm_notice_obj;
++  ib_node_info_t          ibsm_node_info_obj	__attribute__((aligned));
++  ib_port_info_t          ibsm_port_info_obj	__attribute__((aligned));
++  ib_switch_info_t        ibsm_switch_info_obj	__attribute__((aligned));
++  ibsm_lft_block_t        ibsm_lft_block_obj	__attribute__((aligned));
++  ibsm_mft_block_t        ibsm_mft_block_obj	__attribute__((aligned));
++  ib_guid_info_t          ibsm_guid_info_obj	__attribute__((aligned));
++  ib_pkey_table_t         ibsm_pkey_table_obj	__attribute__((aligned));
++  ib_slvl_table_t         ibsm_slvl_table_obj	__attribute__((aligned));
++  ib_vl_arb_table_t       ibsm_vl_arb_table_obj	__attribute__((aligned));
++  ib_node_desc_t          ibsm_node_desc_obj	__attribute__((aligned));
++  ib_sm_info_t            ibsm_sm_info_obj	__attribute__((aligned));
++  ib_mad_notice_attr_t    ibsm_notice_obj	__attribute__((aligned));
+ 
+   /* TODO - define a Vendor Specific CR Read/Write attributes to use VL15 */
+ 
+@@ -35243,7 +35252,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_sys_guid_set(_swigobj,_swigval)  _ibsm_node_info_sys_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_sys_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->sys_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->sys_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_sys_guid_set(_swigobj,_swigval) (_swigobj->sys_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_sys_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35301,7 +35321,18 @@
+ }
+     return TCL_OK;
+ }
++
++#ifdef __sparc
++#define _ibsm_node_info_sys_guid_get(_swigobj)  _ibsm_node_info_sys_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_sys_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->sys_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->sys_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_sys_guid_get(_swigobj) (&_swigobj->sys_guid)
++#endif
+ static int _wrap_smNodeInfo_sys_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35341,6 +35372,7 @@
+   ibis_tcl_error = 0;
+       _result = (ib_net64_t *)_ibsm_node_info_sys_guid_get(_arg0);
+ ;
++
+   if (ibis_tcl_error) {
+ 	 Tcl_SetStringObj(Tcl_GetObjResult(interp), ibis_tcl_error_msg, -1);
+ 	 return TCL_ERROR;
+@@ -35353,7 +35385,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_node_guid_set(_swigobj,_swigval)  _ibsm_node_info_node_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_node_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->node_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->node_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_node_guid_set(_swigobj,_swigval) (_swigobj->node_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_node_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35411,7 +35454,17 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_node_guid_get(_swigobj)  _ibsm_node_info_node_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_node_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->node_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->node_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_node_guid_get(_swigobj) (&_swigobj->node_guid)
++#endif
+ static int _wrap_smNodeInfo_node_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35463,7 +35516,18 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_port_guid_set(_swigobj,_swigval)  _ibsm_node_info_port_guid_set_64(_swigobj, _swigval)
++static inline ib_net64_t *
++_ibsm_node_info_port_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
++{
++        *(ib_net32_t *)&(_swigobj->port_guid) = *((ib_net32_t *)swigval);
++        *((ib_net32_t *)&(_swigobj->port_guid) + 1) = *((ib_net32_t *)swigval +1);
++        return ((ib_net64_t *)swigval);
++}
++#else
+ #define _ibsm_node_info_port_guid_set(_swigobj,_swigval) (_swigobj->port_guid = *(_swigval),_swigval)
++#endif
+ static int _wrap_smNodeInfo_port_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+@@ -35521,7 +35585,17 @@
+ }
+     return TCL_OK;
+ }
++#ifdef __sparc
++#define _ibsm_node_info_port_guid_get(_swigobj)  _ibsm_node_info_port_guid_get_64(_swigobj)
++static inline ib_net64_t * _ibsm_node_info_port_guid_get_64(smNodeInfo *_swigobj){
++	static uint32_t	val[2];
++	val[0] = *(ib_net32_t *)&(_swigobj->port_guid);
++	val[1] = *((ib_net32_t *)&(_swigobj->port_guid) + 1);
++	return ((ib_net64_t *)&val);
++}
++#else
+ #define _ibsm_node_info_port_guid_get(_swigobj) (&_swigobj->port_guid)
++#endif
+ static int _wrap_smNodeInfo_port_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ 
+     ib_net64_t * _result;
+diff -r 01104fa59c22 ibis/src/ibpm_base.h
+--- a/ibis/src/ibpm_base.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibpm_base.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -34,7 +34,11 @@
+ #ifndef _IBPM_BASE_H_
+ #define _IBPM_BASE_H_
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #define PERF_CLASS      0x04
+ #define PERF_CLASS_PORT_INFO 0x01
+diff -r 01104fa59c22 ibis/src/ibvs_base.h
+--- a/ibis/src/ibvs_base.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/ibvs_base.h	Fri Nov 13 06:47:32 2015 -0800
+@@ -34,7 +34,11 @@
+ #ifndef _IBVS_BASE_H_
+ #define _IBVS_BASE_H_
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #define VS_CLASS             0x0a
+ #define VS_CLASS_PORT_INFO   0x01
+diff -r 01104fa59c22 ibis/src/swig_extended_obj.c
+--- a/ibis/src/swig_extended_obj.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/src/swig_extended_obj.c	Fri Nov 13 06:47:32 2015 -0800
+@@ -30,6 +30,9 @@
+  * SOFTWARE.
+  *
+  */
++#if defined(__SVR4) && defined(__sun)
++#include <strings.h>
++#endif
+ 
+ /*--------------------------------------------------------------------
+  * This file holds an extended implementation for SWIG TCL Objects.
+diff -r 01104fa59c22 ibis/tests/Makefile.in
+--- a/ibis/tests/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibis/tests/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibmgtsim/Makefile.in
+--- a/ibmgtsim/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -54,7 +54,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibmgtsim/aclocal.m4
+--- a/ibmgtsim/aclocal.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/aclocal.m4	Fri Nov 13 06:47:32 2015 -0800
+@@ -1389,7 +1389,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+diff -r 01104fa59c22 ibmgtsim/configure
+--- a/ibmgtsim/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/configure	Fri Nov 13 06:47:32 2015 -0800
+@@ -2803,7 +2803,7 @@
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+ 
+-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+ $as_echo_n "checking whether build environment is sane... " >&6; }
+@@ -6472,7 +6472,7 @@
+ 
+ # Determine commands to create old-style static archives.
+ old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+-old_postinstall_cmds='chmod 644 $oldlib'
++old_postinstall_cmds='chmod 744 $oldlib'
+ old_postuninstall_cmds=
+ 
+ if test -n "$RANLIB"; then
+@@ -15362,7 +15362,7 @@
+       osm_debug_flags=
+    fi
+ 
+-   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
++   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
+ else
+       with_osm=disabled
+    OSM_CLFAGS=disabled
+diff -r 01104fa59c22 ibmgtsim/doc/Makefile.in
+--- a/ibmgtsim/doc/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/doc/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -52,7 +52,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibmgtsim/src/Makefile.in
+--- a/ibmgtsim/src/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/src/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -55,7 +55,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibmgtsim/tests/Makefile.in
+--- a/ibmgtsim/tests/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/tests/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+diff -r 01104fa59c22 ibmgtsim/utils/Makefile.in
+--- a/ibmgtsim/utils/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/ibmgtsim/utils/Makefile.in	Fri Nov 13 06:47:32 2015 -0800
+@@ -53,7 +53,7 @@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkglibexecdir = $(libexecdir)/@PACKAGE@
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+-install_sh_DATA = $(install_sh) -c -m 644
++install_sh_DATA = $(install_sh) -c -m 744
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ibutils/patches/002-ibutils-CVE-2013-2561-fix.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,561 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  d152462d834972011a3adb91cfcda352fe36b076
+22213636 Solaris OFED ibutils-1.5.7-0.2.gbd7e502.0.1 needs fix for CVE-2013-2561
+
+ibutils: Fix for CVE-2013-2561 (use /var/cache/ibutils not /tmp)
+Apps should use /var/cache/ibutils instead of /tmp
+
+CVE: 2013-2561
+
+Signed-off-by: Mukesh Kacker <[email protected]>
+---
+
+diff -r d152462d8349 ibdiag/demo/sm-single-master.tcl
+--- a/ibdiag/demo/sm-single-master.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/demo/sm-single-master.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -132,7 +132,7 @@
+ 	gets stdin
+ 	puts "   h. Make one of teh SMs sweep: kill -HUP %2."
+    puts "      Now one of the SMs gets to standby mode"
+-	puts "   i. Run ibdiagnet again to see the info about the SMs in /tmp/ibdiagnet.sm"
++	puts "   i. Run ibdiagnet again to see the info about the SMs in /var/cache/ibutils/ibdiagnet.sm"
+ 	puts " "
+ 	puts " press Enter when done"
+ 	gets stdin
+diff -r d152462d8349 ibdiag/doc/ibdiag_release_notes.txt
+--- a/ibdiag/doc/ibdiag_release_notes.txt	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/doc/ibdiag_release_notes.txt	Sat Nov 14 23:02:51 2015 -0800
+@@ -61,7 +61,7 @@
+ 
+ + Load subnet database from file:
+   Ibdiagnet dumps its internal database, which contains the subnet structure,
+-  to a file (/tmp/ibdiagnet.db by default). This file can be loaded in later
++  to a file (/var/cache/ibutils/ibdiagnet.db by default). This file can be loaded in later
+   ibdiagnet runs (using the -load_db <db file> option). When this option is set,
+   ibdiagnet loads the subnet data from the file and skips the discovery stage.
+   Using this option can save the subnet discovery time for large cluster.
+@@ -221,11 +221,11 @@
+ ===============================================================================
+ 3. Reports
+ ===============================================================================
+-The default directory for all generated report files is /tmp .
++The default directory for all generated report files is /var/cache/ibutils .
+ 
+ Both utilities collect summary information regarding all the fabric SM's
+ during the run, and then output that information at end of the run in file
+-/tmp/ibdiagnet.sm.
++/var/cache/ibutils/ibdiagnet.sm.
+ 
+ Each report message includes:
+    - Device Type
+diff -r d152462d8349 ibdiag/doc/ibdiagnet.pod
+--- a/ibdiag/doc/ibdiagnet.pod	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/doc/ibdiagnet.pod	Sat Nov 14 23:02:51 2015 -0800
+@@ -244,7 +244,7 @@
+ =over
+ 
+ Write out the discovered topology into the given file. This flag is useful if you later want to check for changes from the current state of the fabric.
+-A directory named ibdiag_ibnl is also created by this option, and holds the IBNL files required to load this topology. To use these files you will need to set the environment variable named IBDM_IBNL_PATH to that directory. The directory is located in /tmp or in the output directory provided by the -o flag.
++A directory named ibdiag_ibnl is also created by this option, and holds the IBNL files required to load this topology. To use these files you will need to set the environment variable named IBDM_IBNL_PATH to that directory. The directory is located in /var/cache/ibutils or in the output directory provided by the -o flag.
+ 
+ =back
+ 
+diff -r d152462d8349 ibdiag/doc/ibdiagnet.txt
+--- a/ibdiag/doc/ibdiagnet.txt	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/doc/ibdiagnet.txt	Sat Nov 14 23:02:51 2015 -0800
+@@ -49,7 +49,7 @@
+   -p <port-num> : Specifies the local device's port number used to connect to
+                   the IB fabric
+   -o <out-dir>  : Specifies the directory where the output files will be placed
+-                  (default = /tmp/ez)
++                  (default = /var/cache/ibutils)
+ 
+   -h|--help     : Prints this help information
+   -V|--version  : Prints the version of the tool
+diff -r d152462d8349 ibdiag/doc/ibdiagpath.pod
+--- a/ibdiag/doc/ibdiagpath.pod	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/doc/ibdiagpath.pod	Sat Nov 14 23:02:51 2015 -0800
+@@ -135,7 +135,8 @@
+ =over
+ 
+ =item
+-Specifies the directory where the output files will be placed (default = /tmp)
++Specifies the directory where the output files will be placed (default =
++/var/cache/ibutils)
+ 
+ =back
+ 
+diff -r d152462d8349 ibdiag/src/ibdebug_if.tcl
+--- a/ibdiag/src/ibdebug_if.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/src/ibdebug_if.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -170,7 +170,7 @@
+ 	-n,error "-E-argv:bad.node.name"
+ 
+ 	-o,name  "out.dir"
+-	-o,default  "/tmp"
++	-o,default  "/var/cache/ibutils"
+ 	-o,param "out-dir"
+ 	-o,desc  "Specifies the directory where the output files will be placed"
+ 
+diff -r d152462d8349 ibdiag/src/ibdiagui.tcl
+--- a/ibdiag/src/ibdiagui.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdiag/src/ibdiagui.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -2141,7 +2141,7 @@
+       close $f
+       set lstFile [file join $testModeDir ibdiagnet.lst]
+    } else {
+-      set lstFile /tmp/ibdiagnet.lst
++      set lstFile /var/cache/ibutils/ibdiagnet.lst
+       set r ""
+       LogAppend "-I-Invoking ibdiagnet ...."
+       # puts "-I- Invoking ibdiagnet ...."
+diff -r d152462d8349 ibdm/README
+--- a/ibdm/README	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/README	Sat Nov 14 23:02:51 2015 -0800
+@@ -39,7 +39,7 @@
+ 
+   Description:
+    After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the
+-   subnet and FDB tables into the files /tmp/subnet.lst and /tmp/osm.fdbs.
++   subnet and FDB tables into the files /var/cache/ibutils/subnet.lst and /var/cache/ibutils/osm.fdbs.
+    Based on these files the utility checks all CA to CA connectivity. Further analysis
+    for credit deadlock potential is performed and reported.
+    In case of an LMC > 0 it reports histograms for how many systems and nodes
+@@ -50,11 +50,11 @@
+   Options:
+   -v|--verbose = verbsoe mode
+   -h|--help = provide this help message
+-  -s|--subnet <file> = OpenSM subnet.lst file (default is /tmp/subnet.lst)
++  -s|--subnet <file> = OpenSM subnet.lst file (default is /var/cache/ibutils/subnet.lst)
+   -f|--fdb <file> = OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it.
+-     (default is /tmp/osm.fdbs).
++     (default is /var/cache/ibutils/osm.fdbs).
+   -m|--mcfdb <file> = OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it.
+-     (default is /tmp/osm.mcfdbs).
++     (default is /var/cache/ibutils/osm.mcfdbs).
+   -r|--roots <roots file> = a file holding all root nodes guids (one per line).
+ 
+ 
+diff -r d152462d8349 ibdm/doc/ibdmchk.1
+--- a/ibdm/doc/ibdmchk.1	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/doc/ibdmchk.1	Sat Nov 14 23:02:51 2015 -0800
+@@ -186,7 +186,7 @@
+ .IX Item "-r|--roots <roots file> A file with all the roots node names (one on each line)."
+ .SH "VERIFICATION MODE DESCRIPTION"
+ .IX Header "VERIFICATION MODE DESCRIPTION"
+-After the cluster is built and OpenSM is run (using flag \-D 0x43) it reports the subnet and \s-1FDB\s0 tables into the files osm\-subnet.lst, osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /tmp in older OpenSM versions). ibdiagnet is also producing the same files in its output directory.
++After the cluster is built and OpenSM is run (using flag \-D 0x43) it reports the subnet and \s-1FDB\s0 tables into the files osm\-subnet.lst, osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /var/cache/ibutils in older OpenSM versions). ibdiagnet is also producing the same files in its output directory.
+ Based on these files the utility checks all \s-1CA\s0 to \s-1CA\s0 connectivity. Further analysis for credit deadlock potential is performed and reported.
+ In case of an \s-1LMC\s0 > 0 it reports histograms for how many systems and nodes are common between the different paths for the same port pairs.
+ .SH "ARGUMENTS"
+@@ -208,15 +208,15 @@
+ .RE
+ .IP "\-s|\-\-subnet <file>"
+ .IX Item "-s|--subnet <file>"
+-OpenSM subnet.lst file (default is /var/log/osm\-subnet.lst or /tmp/subnet.lst)
++OpenSM subnet.lst file (default is /var/log/osm\-subnet.lst or /var/cache/ibutils/subnet.lst)
+ .RE
+ .IP "\-f|\-\-fdb <file>"
+ .IX Item "-f|--fdb <file>"
+-OpenSM dump of Ucast \s-1LFDB\s0. Use \-D 0x41 to generate it (default is /var/log/osm.fdbs or /tmp/osm.fdbs).
++OpenSM dump of Ucast \s-1LFDB\s0. Use \-D 0x41 to generate it (default is /var/log/osm.fdbs or /var/cache/ibutils/osm.fdbs).
+ .RE
+ .IP "\-m|\-\-mcfdb <file>"
+ .IX Item "-m|--mcfdb <file>"
+-OpenSM dump of Multicast \s-1LFDB\s0. Use \-D 0x41 to generate it (default is /var/log/osm.mcfdbs or /tmp/osm.mcfdbs).
++OpenSM dump of Multicast \s-1LFDB\s0. Use \-D 0x41 to generate it (default is /var/log/osm.mcfdbs or /var/cache/ibutils/osm.mcfdbs).
+ .RE
+ .IP "\-c|\-\-psl <file>"
+ .IX Item "-c|--psl <file>"
+diff -r d152462d8349 ibdm/doc/ibdmchk.pod
+--- a/ibdm/doc/ibdmchk.pod	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/doc/ibdmchk.pod	Sat Nov 14 23:02:51 2015 -0800
+@@ -59,7 +59,7 @@
+ 
+ =head1 VERIFICATION MODE DESCRIPTION
+ 
+-After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the subnet and FDB tables into the files osm-subnet.lst, osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /tmp in older OpenSM versions). ibdiagnet is also producing the same files in its output directory.
++After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the subnet and FDB tables into the files osm-subnet.lst, osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /var/cache/ibutils in older OpenSM versions). ibdiagnet is also producing the same files in its output directory.
+ Based on these files the utility checks all CA to CA connectivity. Further analysis for credit deadlock potential is performed and reported.
+ In case of an LMC > 0 it reports histograms for how many systems and nodes are common between the different paths for the same port pairs.
+ 
+@@ -81,15 +81,15 @@
+ 
+ =item -s|--subnet <file>
+ 
+-OpenSM subnet.lst file (default is /var/log/osm-subnet.lst or /tmp/subnet.lst)
++OpenSM subnet.lst file (default is /var/log/osm-subnet.lst or /var/cache/ibutils/subnet.lst)
+ 
+ =item -f|--fdb <file>
+ 
+-OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.fdbs or /tmp/osm.fdbs).
++OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.fdbs or /var/cache/ibutils/osm.fdbs).
+ 
+ =item -m|--mcfdb <file>
+ 
+-OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.mcfdbs or /tmp/osm.mcfdbs).
++OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.mcfdbs or /var/cache/ibutils/osm.mcfdbs).
+ 
+ =item -c|--psl <file>
+ 
+diff -r d152462d8349 ibdm/ibdm/LinkCover.cpp
+--- a/ibdm/ibdm/LinkCover.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/ibdm/LinkCover.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -302,7 +302,7 @@
+   set< string > vars;
+   int numLinks = 0;
+   IBNode *p_node;
+-  ofstream linProgram("/tmp/ibdmchk.lp");
++  ofstream linProgram("/var/cache/ibutils/ibdmchk.lp");
+ 
+   // we need a doubel path - first collect all in ports and
+   // dump out the target - maximize number of links covered
+@@ -890,8 +890,8 @@
+   // iteration only.
+   map_pnode_p_sint outPortUsedMap;
+   cout << "-I- Generating non blocking full link coverage plan into:"
+-       << "/tmp/ibdmchk.non_block_all_links" << endl;
+-  ofstream linkProgram("/tmp/ibdmchk.non_block_all_links");
++       << "/var/cache/ibutils/ibdmchk.non_block_all_links" << endl;
++  ofstream linkProgram("/var/cache/ibutils/ibdmchk.non_block_all_links");
+ 
+   // initialize the data structures
+   if (initFdbForwardPortLidTables(
+diff -r d152462d8349 ibdm/ibdm/SubnMgt.cpp
+--- a/ibdm/ibdm/SubnMgt.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/ibdm/SubnMgt.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -1104,7 +1104,7 @@
+ #if DO_CA_TO_CA_NUM_PATHS_HIST
+     // report the link over subscription histogram and dump out the
+     // num paths per switch out port
+-    ofstream linkUsage("/tmp/ibdmchk.sw_out_port_num_paths");
++    ofstream linkUsage("/var/cache/ibutils/ibdmchk.sw_out_port_num_paths");
+     linkUsage << "# NUM-PATHS PORT-NAME " << endl;
+     vec_int linkSubscriptionHist(maxLinkSubscriptions + 1,0);
+     for (map_pnode_vec_int::iterator nI = switchPathsPerOutPort.begin();
+@@ -1127,7 +1127,7 @@
+     cout << "all the CA to CA paths. Ports driving CAs are ignored (as they must" << endl;
+     cout << "have = Nca - 1). If the fabric is routed correctly the histogram" << endl;
+     cout << "should be narrow for all ports on same level of the tree." << endl;
+-    cout << "A detailed report is provided in /tmp/ibdmchk.sw_out_port_num_paths.\n" << endl;
++    cout << "A detailed report is provided in /var/cache/ibutils/ibdmchk.sw_out_port_num_paths.\n" << endl;
+     cout << "NUM-PATHS NUM-SWITCH-PORTS" << endl;
+     for (int b = 0; b <= maxLinkSubscriptions; b++)
+         if (linkSubscriptionHist[b])
+@@ -1136,7 +1136,7 @@
+ #endif
+ 
+     // now do the DLID per out port:
+-    ofstream portDlidsUsage("/tmp/ibdmchk.sw_out_port_num_dlids");
++    ofstream portDlidsUsage("/var/cache/ibutils/ibdmchk.sw_out_port_num_dlids");
+     portDlidsUsage << "# NUM-DLIDS PORT-NAME " << endl;
+     vec_int dlidsSubscriptionHist(maxDlidPerOutPort + 1,0);
+     for (map_pnode_vec_int::iterator nI = switchDLidsPerOutPort.begin();
+@@ -1159,7 +1159,7 @@
+     cout << "all the CA to CA paths. Ports driving CAs are ignored (as they must" << endl;
+     cout << "have = Nca - 1). If the fabric is routed correctly the histogram" << endl;
+     cout << "should be narrow for all ports on same level of the tree." << endl;
+-    cout << "A detailed report is provided in /tmp/ibdmchk.sw_out_port_num_dlids.\n" << endl;
++    cout << "A detailed report is provided in /var/cache/ibutils/ibdmchk.sw_out_port_num_dlids.\n" << endl;
+     cout << "NUM-DLIDS NUM-SWITCH-PORTS" << endl;
+     for (int b = 0; b <= maxDlidPerOutPort; b++)
+         if (dlidsSubscriptionHist[b])
+diff -r d152462d8349 ibdm/src/lst2ibnl
+--- a/ibdm/src/lst2ibnl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/src/lst2ibnl	Sat Nov 14 23:02:51 2015 -0800
+@@ -70,8 +70,8 @@
+ ARGUMENTS (required)
+       -l <lst file>
+           Input fabric link listing file as generated by OpenSM
+-          (/tmp/subnet.lst or /var/log/osm.lst depending on the version) or
+-          ibdiagnet (/tmp/ibdiagnet.lst)
++          (/var/cache/ibutils/subnet.lst or /var/log/osm.lst depending on the version) or
++          ibdiagnet (/var/cache/ibutils/ibdiagnet.lst)
+ 
+       -p <port-name>
+           The name of the switch system front panel port connected to the
+@@ -96,8 +96,8 @@
+ 
+       0. Make sure the file Gnu.lst does not exist
+       1. Connect an HCA in machine we call "host" to FPP L1/P1
+-      2. Run ibdiagnet on the "host" machine (will create /tmp/ibdiagnet.lst)
+-      3. Run lst2ibnl -l /tmp/ibdiagnet.lst -s Gnu -p L1/P1
++      2. Run ibdiagnet on the "host" machine (will create /var/cache/ibutils/ibdiagnet.lst)
++      3. Run lst2ibnl -l /var/cache/ibutils/ibdiagnet.lst -s Gnu -p L1/P1
+       4. Perform steps 1..3 by connecting the "host" to each one of the
+          front panel ports and providing its name on the subsequent call to
+          lst2ibnl
+diff -r d152462d8349 ibdm/src/osm_check.cpp
+--- a/ibdm/src/osm_check.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibdm/src/osm_check.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -86,7 +86,7 @@
+     << "  Description:\n"
+     << "   After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the\n"
+     << "   subnet and FDB tables into the files osm-subnet.lst, osm.fdbs and osm.fdbs in\n"
+-    << "   /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /tmp in older versions).\n"
++    << "   /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /var/cache/ibutils in older versions).\n"
+     << "   If more than one SL is known to be used additional file holding CAxCA->SL mapping \n"
+     << "   is generated (format: 0xsrc_guid dlid sl) . In this case the SL2VL mapping is \n"
+     << "   optionally supplied in an additional file (format: 0xsw_guid inport outport 0x(sl0)(sl1),\n"
+@@ -102,11 +102,11 @@
+     << "  Options:\n"
+     << "  -v|--verbose = verbose mode\n"
+     << "  -h|--help = provide this help message\n"
+-    << "  -s|--subnet <file> = OpenSM subnet.lst file (/var/log/osm-subnet.lst or /tmp/subnet.lst)\n"
++    << "  -s|--subnet <file> = OpenSM subnet.lst file (/var/log/osm-subnet.lst or /var/cache/ibutils/subnet.lst)\n"
+     << "  -f|--fdb <file> = OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it.\n"
+-    << "     (default is /var/log/osm.fdbs or /tmp/osm.fdbs).\n"
++    << "     (default is /var/log/osm.fdbs or /var/cache/ibutils/osm.fdbs).\n"
+     << "  -m|--mcfdb <file> = OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it.\n"
+-    << "     (default is /var/log/osm.mcfdbs or /tmp/osm.mcfdbs).\n"
++    << "     (default is /var/log/osm.mcfdbs or /var/cache/ibutils/osm.mcfdbs).\n"
+     << "  -c|--psl <file> = CAxCA->SL mapping. Each line holds: srcguid dlid sl \n"
+     << "  -d|--slvl <file> = SL2VL mapping. Each line holds: swguid iport oport 0x(sl0)(sl1) 0x(sl2)(sl3)...\n"
+     << "  -r|--roots <roots file> = a file holding all root nodes guids (one per line).\n"
+@@ -465,20 +465,20 @@
+ 	  if (fdbFile.size() == 0) {
+ 		  if (access("/var/log/osm.fdbs",R_OK) == 0)
+ 			  fdbFile = string("/var/log/osm.fdbs");
+-		  else if (access("/tmp/osm.fdbs",R_OK) == 0)
+-			  fdbFile = string("/tmp/osm.fdbs");
++		  else if (access("/var/cache/ibutils/osm.fdbs",R_OK) == 0)
++			  fdbFile = string("/var/cache/ibutils/osm.fdbs");
+ 		  else {
+-			  cout << "-E- Could not find a readble osm.fdbs in /var/log or  /tmp" << endl;
++			  cout << "-E- Could not find a readble osm.fdbs in /var/log or  /var/cache/ibutils" << endl;
+ 			  anyMissingFile = 1;
+ 		  }
+ 	  }
+ 	  if (mcFdbFile.size() == 0) {
+ 		  if (access("/var/log/osm.mcfdbs",R_OK) == 0)
+ 			  mcFdbFile = string("/var/log/osm.mcfdbs");
+-		  else if (access("/tmp/osm.mcfdbs",R_OK) == 0)
+-			  mcFdbFile = string("/tmp/osm.mcfdbs");
++		  else if (access("/var/cache/ibutils/osm.mcfdbs",R_OK) == 0)
++			  mcFdbFile = string("/var/cache/ibutils/osm.mcfdbs");
+ 		  else {
+-			  cout << "-E- Could not find a readble osm.mcfdbs in /var/log or  /tmp" << endl;
++			  cout << "-E- Could not find a readble osm.mcfdbs in /var/log or  /var/cache/ibutils" << endl;
+ 			  anyMissingFile = 1;
+ 		  }
+ 	  }
+@@ -486,10 +486,10 @@
+ 	  if (subnetFile.size() == 0) {
+ 		  if (access("/var/log/osm-subnet.lst",R_OK) == 0)
+ 			  subnetFile = string("/var/log/osm-subnet.lst");
+-		  else if (access("/tmp/subnet.lst",R_OK) == 0)
+-			  subnetFile = string("/tmp/subnet.lst");
++		  else if (access("/var/cache/ibutils/subnet.lst",R_OK) == 0)
++			  subnetFile = string("/var/cache/ibutils/subnet.lst");
+ 		  else {
+-			  cout << "-E- Could not find a readble /var/log/osm-subnet.lst or /tmp/subnet.lst" << endl;
++			  cout << "-E- Could not find a readble /var/log/osm-subnet.lst or /var/cache/ibutils/subnet.lst" << endl;
+ 			  anyMissingFile = 1;
+ 		  }
+ 	  }
+@@ -587,7 +587,7 @@
+     // rank the fabric by these roots
+     map_pnode_int nodesRank;
+     SubnRankFabricNodesByRootNodes(&fabric, rootNodes, nodesRank);
+-    ofstream rankFile("/tmp/ibdmchk.node_ranking");
++    ofstream rankFile("/var/cache/ibutils/ibdmchk.node_ranking");
+     rankFile << "-I- Node Ranking:" << endl;
+     for(map_pnode_int::iterator nI = nodesRank.begin();
+         nI != nodesRank.end(); nI++)
+diff -r d152462d8349 ibis/src/ibis.i
+--- a/ibis/src/ibis.i	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibis/src/ibis.i	Sat Nov 14 23:02:51 2015 -0800
+@@ -564,7 +564,7 @@
+       IbisOpts.m_key = 0;
+       IbisOpts.v_key = 0;
+       IbisOpts.log_flags = OSM_LOG_ERROR;
+-      strcpy(IbisOpts.log_file,"/tmp/ibis.log");
++      strcpy(IbisOpts.log_file,"/var/cache/ibutils/ibis.log");
+ 
+ 
+       /* we want all exists to cleanup */
+diff -r d152462d8349 ibis/src/ibis_wrap.c
+--- a/ibis/src/ibis_wrap.c	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibis/src/ibis_wrap.c	Sat Nov 14 23:02:51 2015 -0800
+@@ -75130,7 +75130,7 @@
+       IbisOpts.m_key = 0;
+       IbisOpts.v_key = 0;
+       IbisOpts.log_flags = OSM_LOG_ERROR;
+-      strcpy(IbisOpts.log_file,"/tmp/ibis.log");
++      strcpy(IbisOpts.log_file,"/var/cache/ibutils/ibis.log");
+ 
+ 
+       /* we want all exists to cleanup */
+diff -r d152462d8349 ibis/src/ibissh_wrap.cpp
+--- a/ibis/src/ibissh_wrap.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibis/src/ibissh_wrap.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -75203,7 +75203,7 @@
+       IbisOpts.m_key = 0;
+       IbisOpts.v_key = 0;
+       IbisOpts.log_flags = OSM_LOG_ERROR;
+-      strcpy(IbisOpts.log_file,"/tmp/ibis.log");
++      strcpy(IbisOpts.log_file,"/var/cache/ibutils/ibis.log");
+ 
+ 
+       /* we want all exists to cleanup */
+diff -r d152462d8349 ibis/tests/ibcr_test.tcl
+--- a/ibis/tests/ibcr_test.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibis/tests/ibcr_test.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -132,7 +132,7 @@
+ #
+ package require ibis
+ ibis_set_verbosity 0xff
+-ibis_opts configure -log_file /tmp/ibcr_test.log
++ibis_opts configure -log_file /var/cache/ibutils/ibcr_test.log
+ ibis_init
+ 
+ set availPorts [ibis_get_local_ports_info]
+diff -r d152462d8349 ibmgtsim/doc/IBMgtSim.1
+--- a/ibmgtsim/doc/IBMgtSim.1	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/doc/IBMgtSim.1	Sat Nov 14 23:02:51 2015 -0800
+@@ -158,7 +158,7 @@
+ .RE
+ .IP "\-l log-file"
+ .IX Item "-l log-file"
+-Set the log file of the simulator (default is /tmp/ibsim.log)
++Set the log file of the simulator (default is /var/cache/ibutils/ibsim.log)
+ .RE
+ .IP "\-p server-port"
+ .IX Item "-p server-port"
+diff -r d152462d8349 ibmgtsim/doc/IBMgtSim.pod
+--- a/ibmgtsim/doc/IBMgtSim.pod	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/doc/IBMgtSim.pod	Sat Nov 14 23:02:51 2015 -0800
+@@ -30,7 +30,7 @@
+ 
+ =item -l log-file
+ 
+-Set the log file of the simulator (default is /tmp/ibsim.log)
++Set the log file of the simulator (default is /var/cache/ibutils/ibsim.log)
+ 
+ =item -p server-port
+ 
+diff -r d152462d8349 ibmgtsim/src/client.cpp
+--- a/ibmgtsim/src/client.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/src/client.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -158,7 +158,7 @@
+     if (getenv("IBMGTSIM_DIR"))
+         simDir = getenv("IBMGTSIM_DIR");
+     else
+-        simDir = "/tmp/ibmgtsim";
++        simDir = "/var/cache/ibutils/ibmgtsim";
+ 
+     std::string serverFileName = simDir + "/ibmgtsim.server";
+ 
+diff -r d152462d8349 ibmgtsim/src/sim.cpp
+--- a/ibmgtsim/src/sim.cpp	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/src/sim.cpp	Sat Nov 14 23:02:51 2015 -0800
+@@ -50,8 +50,8 @@
+     if (!getenv("IBMGTSIM_DIR")) {
+         printf("-W- Environment variable: IBMGTSIM_DIR does not exist.\n");
+         printf("    Please create one used by the simulator.\n");
+-        printf("    Using /tmp/ibmgtsim as default.\n");
+-        return "/tmp/ibmgtsim";
++        printf("    Using /var/cache/ibutils/ibmgtsim as default.\n");
++        return "/var/cache/ibutils/ibmgtsim";
+     }
+     return getenv("IBMGTSIM_DIR");
+ }
+diff -r d152462d8349 ibmgtsim/tests/FatTree.check.tcl
+--- a/ibmgtsim/tests/FatTree.check.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/tests/FatTree.check.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -44,7 +44,7 @@
+    puts "-I- Starting: $osmPath -R ftree -d2 -V -g $osmPortGuid ..."
+    #set osmPid [exec $osmPath -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+    set osmPid [exec $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+-   #set osmPid [exec valgrind --tool=memcheck -v --log-file-exactly=/tmp/kliteyn/osm.valgrind.log $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
++   #set osmPid [exec valgrind --tool=memcheck -v --log-file-exactly=/var/cache/ibutils/osm.valgrind.log $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+ 
+    # start a tracker on the log file and process:
+    startOsmLogAnalyzer $osmLog
+diff -r d152462d8349 ibmgtsim/tests/FatTreeFails.check.tcl
+--- a/ibmgtsim/tests/FatTreeFails.check.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/tests/FatTreeFails.check.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -44,7 +44,7 @@
+    puts "-I- Starting: $osmPath -R ftree -d2 -V -g $osmPortGuid ..."
+    #set osmPid [exec $osmPath -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+    set osmPid [exec $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+-   #set osmPid [exec valgrind --tool=memcheck -v --log-file-exactly=/tmp/kliteyn/osm.valgrind.log $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
++   #set osmPid [exec valgrind --tool=memcheck -v --log-file-exactly=/var/cache/ibutils/osm.valgrind.log $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
+ 
+    # start a tracker on the log file and process:
+    startOsmLogAnalyzer $osmLog
+diff -r d152462d8349 ibmgtsim/tests/init.test.tcl
+--- a/ibmgtsim/tests/init.test.tcl	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/tests/init.test.tcl	Sat Nov 14 23:02:51 2015 -0800
+@@ -30,7 +30,7 @@
+ # SOFTWARE.
+ #--
+ 
+-MsgMgr setLogFile "/tmp/sim.log"
++MsgMgr setLogFile "/var/cache/ibutils/sim.log"
+ MsgMgr setVerbLevel $MsgShowAll
+ IBMgtSimulator init /home/eitan/SW/cvsroot/IBADM/ibdm/Clusters/RhinoBased512.topo 46517 5
+ puts [IBMgtSimulator getFabric]
+@@ -42,7 +42,7 @@
+ set mcm [madMcMemberRec]
+ madMcMemberRec_send_set $mcm simnode:1:SL2-2/spine1/U2 1 1 0
+ 
+-MsgMgr setLogFile "/tmp/sim.log"
++MsgMgr setLogFile "/var/cache/ibutils/sim.log"
+ MsgMgr setVerbLevel $MsgShowAll
+ IBMgtSimulator init /home/eitan/SW/cvsroot/IBADM/ibdm/Clusters/FullGnu.topo 46517 5
+ source /home/eitan/SW/SVN/osm/branches/main2_0/osm/test/osmMulticastRoutingTest.sim.tcl
+@@ -60,7 +60,7 @@
+    }
+ }
+ 
+-MsgMgr setLogFile "/tmp/sim.log"
++MsgMgr setLogFile "/var/cache/ibutils/sim.log"
+ MsgMgr setVerbLevel $MsgShowAll
+ IBMgtSimulator init /usr/share/ibmgtsim/Gnu16NodeOsmTest.topo 46517 1
+ set f [IBMgtSimulator getFabric]
+@@ -72,7 +72,7 @@
+    activateNodePorts [lindex $nodeNameNPtr 1]
+ }
+ 
+-MsgMgr setLogFile "/tmp/sim.log"
++MsgMgr setLogFile "/var/cache/ibutils/sim.log"
+ MsgMgr setVerbLevel $MsgShowAll
+ IBMgtSimulator init test.topo 46517 1
+ set f [IBMgtSimulator getFabric]
+diff -r d152462d8349 ibmgtsim/utils/IBMgtSim
+--- a/ibmgtsim/utils/IBMgtSim	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/utils/IBMgtSim	Sat Nov 14 23:02:51 2015 -0800
+@@ -73,7 +73,7 @@
+  Command Line Options:
+    -s seed = the seed to be used for random number generation.
+    -f flow-tcl-file = a tcl file to be sourced after the fabric is setup.
+-   -l log-file = set the log file of the simulator (default is /tmp/ibsim.log)
++   -l log-file = set the log file of the simulator (default is /var/cache/ibutils/ibsim.log)
+    -p server-port = set the port number the server attaches to (default 46517)
+    -w num-threads = the number of threads processing the mads
+    -V <module-verbosity-pair-list> = Provides a fine grain control over
+@@ -375,7 +375,7 @@
+ #
+ 
+ set moduleVerbosityList {top 0xA7}
+-set logFileName /tmp/ibsim.log
++set logFileName /var/cache/ibutils/ibsim.log
+ set numWorkerThreads 1
+ set serverPortNum 46517
+ set simulationFlowFile ""
+diff -r d152462d8349 ibmgtsim/utils/RunSimTest
+--- a/ibmgtsim/utils/RunSimTest	Fri Nov 13 06:48:21 2015 -0800
++++ b/ibmgtsim/utils/RunSimTest	Sat Nov 14 23:02:51 2015 -0800
+@@ -775,7 +775,7 @@
+ set osmTrackerPipes {}
+ 
+ # define tmp directory to use:
+-set tmpDir /tmp
++set tmpDir /var/cache/ibutils
+ 
+ # Define the temporary directory:
+ set simDir [file join $tmpDir ibmgtsim.$pid]
--- a/components/open-fabrics/ibutils/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1322 +0,0 @@
-diff -r -u /tmp/ibutils-1.5.7/config/osm.m4 ibutils-1.5.7/config/osm.m4
---- /tmp/ibutils-1.5.7/config/osm.m4	Thu Feb 18 03:31:34 2010
-+++ ibutils-1.5.7/config/osm.m4	Thu Feb 24 16:51:16 2011
-@@ -179,7 +179,7 @@
-       osm_debug_flags=
-    fi
- 
--   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
-+   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
- else
-    dnl dummy values
-    with_osm=disabled
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/doc/ibdiagnet.pod ibutils-1.5.7/ibdiag/doc/ibdiagnet.pod
---- /tmp/ibutils-1.5.7/ibdiag/doc/ibdiagnet.pod	Mon Nov  1 16:03:43 2010
-+++ ibutils-1.5.7/ibdiag/doc/ibdiagnet.pod	Thu Jun  2 12:30:13 2011
-@@ -122,7 +122,6 @@
- 
- =over
- 
--=item
- Min number of packets to be sent across each link (default = 10)
- 
- =back
-@@ -131,7 +130,6 @@
- 
- =over
- 
--=item
- Enable verbose mode
- 
- =back
-@@ -140,7 +138,6 @@
- 
- =over
- 
--=item
- Provides a report of the fabric qualities
- 
- =back
-@@ -149,7 +146,6 @@
- 
- =over
- 
--=item
- Credit loop check based on UpDown rules
- 
- =back
-@@ -158,8 +154,7 @@
- 
- =over
- 
--=item
--Specifies the topology file name
-+Specifies the topology file name.  The system name (-s) must also be specified if this option is used.
- 
- =back
- 
-@@ -167,7 +162,6 @@
- 
- =over
- 
--=item
- Specifies the local system name. Meaningful only if a topology file is specified
- 
- =back
-@@ -176,7 +170,6 @@
- 
- =over
- 
--=item
- Specifies the index of the device of the port used to connect to the IB fabric (in case of multiple devices on the local system)
- 
- =back
-@@ -185,7 +178,6 @@
- 
- =over
- 
--=item
- Specifies the local device's port num used to connect to the IB fabric
- 
- =back
-@@ -194,7 +186,6 @@
- 
- =over
- 
--=item
- Specifies the directory where the output files will be placed (default = /tmp)
- 
- =back
-@@ -203,7 +194,6 @@
- 
- =over
- 
--=item
- Specifies the expected link width
- 
- =back
-@@ -212,7 +202,6 @@
- 
- =over
- 
--=item
- Specifies the expected link speed
- 
- =back
-@@ -221,7 +210,6 @@
- 
- =over
- 
--=item
- Dump all the fabric links, pm Counters into ibdiagnet.pm
- 
- =back
-@@ -230,7 +218,6 @@
- 
- =over
- 
--=item
- Reset all the fabric links pmCounters
- 
- =back
-@@ -239,7 +226,6 @@
- 
- =over
- 
--=item
- If any of the provided pm is greater then its provided value, print it to screen
- 
- =back
-@@ -248,7 +234,6 @@
- 
- =over
- 
--=item
- Skip the executions of the selected checks.
- Skip options (one or more can be specified) : dup_guids  zero_guids pm logical_state part ipoib all
- 
-@@ -258,7 +243,6 @@
- 
- =over
- 
--=item
- Write out the discovered topology into the given file. This flag is useful if you later want to check for changes from the current state of the fabric.
- A directory named ibdiag_ibnl is also created by this option, and holds the IBNL files required to load this topology. To use these files you will need to set the environment variable named IBDM_IBNL_PATH to that directory. The directory is located in /tmp or in the output directory provided by the -o flag.
- 
-@@ -268,7 +252,6 @@
- 
- =over
- 
--=item
- Load subnet data from the given .db file, and skip subnet discovery stage.
- Note: Some of the checks require actual subnet discovery, and therefore would not run when load_db is specified. These checks are
- : Duplicated/zero guids, link state, SMs status.
-@@ -279,7 +262,6 @@
- 
- =over
- 
--=item
- VL based Routing - provide this option to create the paths SL file (psl), SL2VL file (slvl)
- and use them in credit loops check (if -r option is provided).
- 
-@@ -291,7 +273,6 @@
- 
- =over
- 
--=item
- Prints the help page information
- 
- =back
-@@ -300,7 +281,6 @@
- 
- =over
- 
--=item
- Prints the version of the tool
- 
- =back
-@@ -309,7 +289,6 @@
- 
- =over
- 
--=item
- Prints the tool's environment variables and their values
- 
- =back
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/doc/ibdiagnet.txt ibutils-1.5.7/ibdiag/doc/ibdiagnet.txt
---- /tmp/ibutils-1.5.7/ibdiag/doc/ibdiagnet.txt	Sun Jun 15 07:37:31 2008
-+++ ibutils-1.5.7/ibdiag/doc/ibdiagnet.txt	Wed Nov 13 09:02:35 2013
-@@ -39,7 +39,8 @@
-                   (default = 10)
-   -v            : Instructs the tool to run in verbose mode
-   -r            : Provides a report of the fabric qualities
--  -t <topo-file>: Specifies the topology file name
-+  -t <topo-file>: Specifies the topology file name.  The system name (-s) must
-+                  also be specified if this option is used.
-   -s <sys-name> : Specifies the local system name. Meaningful only if a topology
-                   file is specified
-   -i <dev-index>: Specifies the index of the device of the port used to connect
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/doc/Makefile.in ibutils-1.5.7/ibdiag/doc/Makefile.in
---- /tmp/ibutils-1.5.7/ibdiag/doc/Makefile.in	Tue Mar  8 03:09:32 2011
-+++ ibutils-1.5.7/ibdiag/doc/Makefile.in	Thu Feb 24 16:51:16 2011
-@@ -52,7 +52,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/src/ibdebug.tcl ibutils-1.5.7/ibdiag/src/ibdebug.tcl
---- /tmp/ibutils-1.5.7/ibdiag/src/ibdebug.tcl	Tue Mar  8 03:08:02 2011
-+++ ibutils-1.5.7/ibdiag/src/ibdebug.tcl	Thu Jun 27 22:46:57 2013
-@@ -352,13 +352,16 @@
-     if {[file exists $ibisOutDir/$ibisLogFile] && (![file writable $ibisOutDir/$ibisLogFile])} {
- 	set ibisLogFile $ibisLogFile.[pid]
-     }
-+
-+    ## Check if the file exists. If it does delete it. The log file is opened with the 'w' access
-+    ## mode which truncates the file to zero length, so the contents are not preserved. Deleting
-+    ## the file prevents any softlink based system file clobbering issues.
-     if {[file exists $ibisOutDir/$ibisLogFile]} {
--	if {![file writable $ibisOutDir/$ibisLogFile]} {
--	    if {![file writable $ibisOutDir/$ibisLogFile]} {
--		catch {set ibisLogFd [open $ibisOutDir/$ibisLogFile w]} errMsg
--		inform "-E-ibis:file.not.writable" -value $ibisOutDir/$ibisLogFile -errMsg $errMsg
--	    }
--	}
-+        ## Since we have already verified the directory is writable and open with 'w' option
-+        ## truncates the file, it is safe to delete the file if it exists.
-+        if {[catch {file delete $ibisOutDir/$ibisLogFile} errMsg]} {
-+            inform "-E-ibis:could.not.delete.file" -value $ibisOutDir/$ibisLogFile
-+        }
-     }
-     inform "-V-ibis.ibis.log.file" -value $ibisOutDir/$ibisLogFile
- 
-@@ -5123,6 +5126,16 @@
-         return 1
-     }
- 
-+    ## If the file exists delete the file to prevent any symlink
-+    ## system file clobbering. The file is about to be opened with
-+    ## the access mode of 'w', which will truncate the file to zero
-+    ## length anyway. So, it is safe to delete the file now.
-+    if {[file exists $G(outfiles,.db)]} {
-+        if {[catch {file delete $G(outfiles,.db)} errMsg]} {
-+           return 1
-+        }
-+    }
-+
-     set FileID [InitializeOutputFile $G(var:tool.name).db]
- 
-     foreach {array_name data} {G data* Neighbor *} {
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/src/ibdebug_if.tcl ibutils-1.5.7/ibdiag/src/ibdebug_if.tcl
---- /tmp/ibutils-1.5.7/ibdiag/src/ibdebug_if.tcl	Thu Oct  7 07:29:56 2010
-+++ ibutils-1.5.7/ibdiag/src/ibdebug_if.tcl	Wed Jun 19 07:43:17 2013
-@@ -675,6 +675,16 @@
-     }
- 
-     ## Command line check - Test5.0: log file
-+
-+    ## The directory has been verified to be writable, delete the file if it exists since
-+    ## we anyway open it with 'w' which will truncate it to zero length. Deleting the file
-+    ## will prevent symlink based system file clobbering.
-+    if {[file exists $G(outfiles,.log)]} {
-+        if {[catch {file delete $G(outfiles,.log)} errMsg]} {
-+            ## Print the delete failure error message and exit
-+            inform "-E-loading:cannot.delete.file" $G(outfiles,.log) -fn $G(outfiles,.log) -errMsg $errMsg
-+        }
-+    }
-     if {[catch {set G(logFileID) [open $G(outfiles,.log) w]} errMsg]} {
- 	 inform "-E-loading:cannot.open.file" $G(outfiles,.log) -fn $G(outfiles,.log) -errMsg $errMsg
-     }
-@@ -1229,6 +1239,10 @@
- 	    append msgText "IBIS: The following file is write protected: $msgF(value)%n"
- 	    append msgText "Error message: \"$msgF(errMsg)\""
- 	}
-+	"-E-ibis:could.not.delete.file" {
-+	    append msgText "IBIS: Could not delete the file : $msgF(value)%n"
-+	    append msgText "Error message: \"$msgF(errMsg)\""
-+	}
- 	"-V-ibis:ibis_get_local_ports_info" {
- 	    append msgText "IBIS: ibis_get_local_ports_info:%n$msgF(value)"
- 	}
-@@ -1260,6 +1274,10 @@
- 	    append msgText "Failed to load ibdiag external DB from: $msgF(fn)%n"
- 	    append msgText "Error message: \"$msgF(errMsg)\""
- 	}
-+	"-E-loading:cannot.delete.file" {
-+	    append msgText "Could not delete the file : $msgF(fn)%n"
-+	    append msgText "Error message: \"$msgF(errMsg)\""
-+	}
-         "-W-loading:old.osm.version" {
- 	    append msgText "OSM: The current OSM version is not up-to-date"
- 	}
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/src/Makefile.in ibutils-1.5.7/ibdiag/src/Makefile.in
---- /tmp/ibutils-1.5.7/ibdiag/src/Makefile.in	Tue Mar  8 03:09:32 2011
-+++ ibutils-1.5.7/ibdiag/src/Makefile.in	Thu Feb 24 16:51:16 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-@@ -244,7 +244,7 @@
- 	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- 	     test -z "$$files" || { \
- 	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
--	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-+	       $(INSTALL_SCRIPT) -m 755 $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
- 	     } \
- 	; done
- 
-@@ -426,6 +426,7 @@
- 	sed -e 's=%ibdiag_libdir%='$(DESTDIR)$(libdir)'=' \
- 	    -e 's=%with_ibdm_lib%='$(with_ibdm_lib)'=' \
- 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
-+	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
- 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagnet.in > ibdiagnet
- 
- ibdiagpath: ibdiagpath.in
-@@ -432,6 +433,7 @@
- 	sed -e 's=%ibdiag_libdir%='$(DESTDIR)$(libdir)'=' \
- 	    -e 's=%with_ibdm_lib%='$(with_ibdm_lib)'=' \
- 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
-+	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
- 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagpath.in > ibdiagpath
- 
- ibdiagui: ibdiagui.in
-@@ -440,6 +442,7 @@
- 	    -e 's=%with_tk_lib%='$(with_tk_lib)'=' \
- 	    -e 's=%with_graphviz_lib%='$(with_graphviz_lib)'=' \
- 	    -e 's=%with_ibis_bindir%='$(DESTDIR)$(bindir)'=' \
-+	    -e 's=%with_ibis_sbindir%='$(DESTDIR)$(sbindir)'=' \
- 	    -e 's=%with_ibis%='$(with_ibis)'=' $(srcdir)/ibdiagui.in > ibdiagui
- 
- clean:
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/Makefile.in ibutils-1.5.7/ibdiag/Makefile.in
---- /tmp/ibutils-1.5.7/ibdiag/Makefile.in	Tue Mar  8 03:09:32 2011
-+++ ibutils-1.5.7/ibdiag/Makefile.in	Thu Feb 24 16:51:16 2011
-@@ -54,7 +54,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdiag/configure ibutils-1.5.7/ibdiag/configure
---- /tmp/ibutils-1.5.7/ibdiag/configure	Tue Mar  8 03:09:33 2011
-+++ ibutils-1.5.7/ibdiag/configure	Thu Mar 10 18:33:24 2011
-@@ -1811,7 +1811,7 @@
- 
- test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
- 
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
- $as_echo_n "checking whether build environment is sane... " >&6; }
-diff -r -u /tmp/ibutils-1.5.7/ibdm/Clusters/Makefile.in ibutils-1.5.7/ibdm/Clusters/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/Clusters/Makefile.in	Tue Mar  8 03:09:40 2011
-+++ ibutils-1.5.7/ibdm/Clusters/Makefile.in	Thu Feb 24 16:51:16 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/aclocal.m4 ibutils-1.5.7/ibdm/aclocal.m4
---- /tmp/ibutils-1.5.7/ibdm/aclocal.m4	Tue Mar  8 03:09:38 2011
-+++ ibutils-1.5.7/ibdm/aclocal.m4	Thu Feb 24 16:51:16 2011
-@@ -1389,7 +1389,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-@@ -2610,6 +2610,23 @@
-   hardcode_into_libs=yes
-   # ldd complains unless libraries are executable
-   postinstall_cmds='chmod +x $lib'
-+  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
-+    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-+
-+    solaris_arch=`uname -p`
-+    if [ $solaris_arch = "i386" ]; then
-+      lib64=amd64
-+    else
-+      lib64=sparcv9
-+    fi
-+
-+    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
-+      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
-+      solaris_lib64path="$solaris_lib64path""$lib64"/
-+      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
-+    fi
-+  fi
-   ;;
- 
- sunos4*)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/doc/Makefile.in ibutils-1.5.7/ibdm/doc/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/doc/Makefile.in	Tue Mar  8 03:09:41 2011
-+++ ibutils-1.5.7/ibdm/doc/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -52,7 +52,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibnl/Makefile.in ibutils-1.5.7/ibdm/ibnl/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/ibnl/Makefile.in	Tue Mar  8 03:09:41 2011
-+++ ibutils-1.5.7/ibdm/ibnl/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/src/Makefile.in ibutils-1.5.7/ibdm/src/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/src/Makefile.in	Tue Mar  8 03:09:41 2011
-+++ ibutils-1.5.7/ibdm/src/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -57,7 +57,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/Makefile.in ibutils-1.5.7/ibdm/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/Makefile.in	Tue Mar  8 03:09:42 2011
-+++ ibutils-1.5.7/ibdm/Makefile.in	Thu Feb 24 16:51:16 2011
-@@ -54,7 +54,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/scripts/Makefile.in ibutils-1.5.7/ibdm/scripts/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/scripts/Makefile.in	Tue Mar  8 03:09:41 2011
-+++ ibutils-1.5.7/ibdm/scripts/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/Fabric.cpp ibutils-1.5.7/ibdm/ibdm/Fabric.cpp
---- /tmp/ibutils-1.5.7/ibdm/ibdm/Fabric.cpp	Thu Oct  7 07:29:56 2010
-+++ ibutils-1.5.7/ibdm/ibdm/Fabric.cpp	Mon Sep 19 12:03:07 2011
-@@ -1954,6 +1954,7 @@
-         }*/
-     }
-     f.close();
-+    f.clear();
- 
-     // Make second pass and build the tables
-     f.open(fn.c_str(),ifstream::in);
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/Fabric.h ibutils-1.5.7/ibdm/ibdm/Fabric.h
---- /tmp/ibutils-1.5.7/ibdm/ibdm/Fabric.h	Thu Oct  7 07:29:56 2010
-+++ ibutils-1.5.7/ibdm/ibdm/Fabric.h	Thu Feb 24 16:51:17 2011
-@@ -54,6 +54,7 @@
- #include <iostream>
- #include <sstream>
- #include <string>
-+#include <cstring>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -69,7 +70,7 @@
- 
- #if __WORDSIZE == 64
- #define PRIx64 "lx"
--#else
-+#elseif !defined(__SVR4) || !defined(__sun)
- #define PRIx64 "llx"
- #endif
- using namespace std;
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/TopoMatch.cpp ibutils-1.5.7/ibdm/ibdm/TopoMatch.cpp
---- /tmp/ibutils-1.5.7/ibdm/ibdm/TopoMatch.cpp	Mon Nov  1 16:03:44 2010
-+++ ibutils-1.5.7/ibdm/ibdm/TopoMatch.cpp	Thu Feb 24 16:51:17 2011
-@@ -57,6 +57,9 @@
- #include "Regexp.h"
- #include <iomanip>
- #include <sstream>
-+#if defined(__SVR4) && defined(__sun)
-+#include <strings.h>
-+#endif
- 
- 
- //////////////////////////////////////////////////////////////////////////////
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/Makefile.in ibutils-1.5.7/ibdm/ibdm/Makefile.in
---- /tmp/ibutils-1.5.7/ibdm/ibdm/Makefile.in	Tue Mar  8 03:09:41 2011
-+++ ibutils-1.5.7/ibdm/ibdm/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -55,7 +55,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-@@ -316,7 +316,7 @@
- AM_CFLAGS = $(DBG) $(IBNL_PATH) $(TCL_CFLAGS)
- lib_LTLIBRARIES = libibdmcom.la libibdm.la
- libibdmcom_la_SOURCES = $(common_SOURCES)
--libibdmcom_la_LIBADD = 
-+libibdmcom_la_LIBADD = $(TCL_LIBS)
- libibdmcom_la_LDFLAGS = -version-info $(LIB_VER_TRIPLET)
- libibdm_la_SOURCES = ibdm_wrap.cpp ibdm.i $(common_SOURCES)
- libibdm_la_LIBADD = $(TCL_LIBS) 
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/ibdm_wrap.cpp ibutils-1.5.7/ibdm/ibdm/ibdm_wrap.cpp
---- /tmp/ibutils-1.5.7/ibdm/ibdm/ibdm_wrap.cpp	Thu Oct  7 07:28:58 2010
-+++ ibutils-1.5.7/ibdm/ibdm/ibdm_wrap.cpp	Thu Feb 24 16:51:17 2011
-@@ -23,6 +23,9 @@
- #include INCLUDE_TCL
- #include <string.h>
- #include <stdlib.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <strings.h>
-+#endif
- #define SWIGTCL
- #define SWIGTCL8
- /*
-diff -r -u /tmp/ibutils-1.5.7/ibdm/ibdm/ibdmsh_wrap.cpp ibutils-1.5.7/ibdm/ibdm/ibdmsh_wrap.cpp
---- /tmp/ibutils-1.5.7/ibdm/ibdm/ibdmsh_wrap.cpp	Thu Oct  7 07:28:58 2010
-+++ ibutils-1.5.7/ibdm/ibdm/ibdmsh_wrap.cpp	Thu Feb 24 16:51:17 2011
-@@ -22,6 +22,9 @@
- #define INCLUDE_TK     <tk.h>
- #include INCLUDE_TCL
- #include <string.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <strings.h>
-+#endif
- #include <stdlib.h>
- #define SWIGTCL
- #define SWIGTCL8
-diff -r -u /tmp/ibutils-1.5.7/ibdm/configure ibutils-1.5.7/ibdm/configure
---- /tmp/ibutils-1.5.7/ibdm/configure	Tue Mar  8 03:09:43 2011
-+++ ibutils-1.5.7/ibdm/configure	Thu Mar 10 18:33:25 2011
-@@ -2764,7 +2764,7 @@
- 
- test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
- 
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
- $as_echo_n "checking whether build environment is sane... " >&6; }
-@@ -6633,7 +6633,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-@@ -10321,6 +10321,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-@@ -11248,6 +11249,24 @@
-   hardcode_into_libs=yes
-   # ldd complains unless libraries are executable
-   postinstall_cmds='chmod +x $lib'
-+
-+  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
-+    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-+
-+    solaris_arch=`uname -p`
-+    if [ $solaris_arch = "i386" ]; then
-+      lib64=amd64
-+    else
-+      lib64=sparcv9
-+    fi
-+
-+    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
-+      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
-+      solaris_lib64path="$solaris_lib64path""$lib64"/
-+      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
-+    fi
-+  fi
-   ;;
- 
- sunos4*)
-@@ -13191,6 +13210,7 @@
- 	    fi
- 	    ;;
-         esac
-+	hardcode_libdir_flag_spec_CXX=
-         ;;
- 
-     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-@@ -14716,6 +14736,24 @@
-   hardcode_into_libs=yes
-   # ldd complains unless libraries are executable
-   postinstall_cmds='chmod +x $lib'
-+
-+  if echo "$CFLAGS" | grep '\-m64' >/dev/null ; then
-+    sys_lib_search_path_spec=`$CC -m64 -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-+
-+    solaris_arch=`uname -p`
-+    if [ $solaris_arch = "i386" ]; then
-+      lib64=amd64
-+    else
-+      lib64=sparcv9
-+    fi
-+
-+    if ! echo "$sys_lib_search_path_spec" | grep $lib64 >/dev/null  ; then
-+      solaris_lib64path=`echo "$sys_lib_search_path_spec" | $SED  -e "s/ /$lib64\/ /g" | cut -d " " -f2-`
-+      solaris_lib64path="$solaris_lib64path""$lib64"/
-+      sys_lib_search_path_spec="$solaris_lib64path $sys_lib_search_path_spec"
-+    fi
-+  fi
-   ;;
- 
- sunos4*)
-diff -r -u /tmp/ibutils-1.5.7/ibis/aclocal.m4 ibutils-1.5.7/ibis/aclocal.m4
---- /tmp/ibutils-1.5.7/ibis/aclocal.m4	Tue Mar  8 03:09:48 2011
-+++ ibutils-1.5.7/ibis/aclocal.m4	Thu Feb 24 16:51:17 2011
-@@ -1389,7 +1389,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-diff -r -u /tmp/ibutils-1.5.7/ibis/doc/Makefile.in ibutils-1.5.7/ibis/doc/Makefile.in
---- /tmp/ibutils-1.5.7/ibis/doc/Makefile.in	Tue Mar  8 03:09:51 2011
-+++ ibutils-1.5.7/ibis/doc/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -52,7 +52,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/Makefile.in ibutils-1.5.7/ibis/src/Makefile.in
---- /tmp/ibutils-1.5.7/ibis/src/Makefile.in	Tue Mar  8 03:09:51 2011
-+++ ibutils-1.5.7/ibis/src/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -55,7 +55,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibbbm_base.h ibutils-1.5.7/ibis/src/ibbbm_base.h
---- /tmp/ibutils-1.5.7/ibis/src/ibbbm_base.h	Wed Feb 24 02:09:25 2010
-+++ ibutils-1.5.7/ibis/src/ibbbm_base.h	Thu Feb 24 16:51:18 2011
-@@ -30,11 +30,14 @@
-  * SOFTWARE.
-  *
-  */
--
- #ifndef _IBBBM_BASE_H_
- #define _IBBBM_BASE_H_
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #define BBM_CLASS         0x05
- #define BBM_ATTR_BKEYINFO 0x10
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibcr_base.h ibutils-1.5.7/ibis/src/ibcr_base.h
---- /tmp/ibutils-1.5.7/ibis/src/ibcr_base.h	Wed Feb 24 02:09:25 2010
-+++ ibutils-1.5.7/ibis/src/ibcr_base.h	Thu Feb 24 16:51:18 2011
-@@ -34,7 +34,11 @@
- #ifndef _IBCR_BASE_H_
- #define _IBCR_BASE_H_
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #define CR_CLASS        0x09
- #define CR_ATTR_50      0x50
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibis_base.h ibutils-1.5.7/ibis/src/ibis_base.h
---- /tmp/ibutils-1.5.7/ibis/src/ibis_base.h	Wed Feb 24 02:09:25 2010
-+++ ibutils-1.5.7/ibis/src/ibis_base.h	Mon Mar 24 15:09:53 2014
-@@ -64,7 +64,7 @@
- #define IBIS_FILE_PATH_MAX	PATH_MAX
- #endif
- 
--#define MAX_LOCAL_IBPORTS 32
-+#define MAX_LOCAL_IBPORTS MAX_PORTS
- #define DISP_HANDLE_MAX 32
- 
- END_C_DECLS
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibis_wrap.c ibutils-1.5.7/ibis/src/ibis_wrap.c
---- /tmp/ibutils-1.5.7/ibis/src/ibis_wrap.c	Mon Nov  1 16:03:44 2010
-+++ ibutils-1.5.7/ibis/src/ibis_wrap.c	Mon Jun  6 15:35:52 2011
-@@ -2722,18 +2722,18 @@
-   typedef ib_mad_notice_attr_t  smNotice;
- 
-   /* these are the globals to be used for set/get */
--  ib_node_info_t          ibsm_node_info_obj;
--  ib_port_info_t          ibsm_port_info_obj;
--  ib_switch_info_t        ibsm_switch_info_obj;
--  ibsm_lft_block_t        ibsm_lft_block_obj;
--  ibsm_mft_block_t        ibsm_mft_block_obj;
--  ib_guid_info_t          ibsm_guid_info_obj;
--  ib_pkey_table_t         ibsm_pkey_table_obj;
--  ib_slvl_table_t         ibsm_slvl_table_obj;
--  ib_vl_arb_table_t       ibsm_vl_arb_table_obj;
--  ib_node_desc_t          ibsm_node_desc_obj;
--  ib_sm_info_t            ibsm_sm_info_obj;
--  ib_mad_notice_attr_t    ibsm_notice_obj;
-+  ib_node_info_t          ibsm_node_info_obj	__attribute__((aligned));
-+  ib_port_info_t          ibsm_port_info_obj	__attribute__((aligned));
-+  ib_switch_info_t        ibsm_switch_info_obj	__attribute__((aligned));
-+  ibsm_lft_block_t        ibsm_lft_block_obj	__attribute__((aligned));
-+  ibsm_mft_block_t        ibsm_mft_block_obj	__attribute__((aligned));
-+  ib_guid_info_t          ibsm_guid_info_obj	__attribute__((aligned));
-+  ib_pkey_table_t         ibsm_pkey_table_obj	__attribute__((aligned));
-+  ib_slvl_table_t         ibsm_slvl_table_obj	__attribute__((aligned));
-+  ib_vl_arb_table_t       ibsm_vl_arb_table_obj	__attribute__((aligned));
-+  ib_node_desc_t          ibsm_node_desc_obj	__attribute__((aligned));
-+  ib_sm_info_t            ibsm_sm_info_obj	__attribute__((aligned));
-+  ib_mad_notice_attr_t    ibsm_notice_obj	__attribute__((aligned));
- 
-   /* TODO - define a Vendor Specific CR Read/Write attributes to use VL15 */
- 
-@@ -35180,7 +35180,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_sys_guid_set(_swigobj,_swigval)  _ibsm_node_info_sys_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_sys_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->sys_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->sys_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_sys_guid_set(_swigobj,_swigval) (_swigobj->sys_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_sys_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35238,7 +35249,17 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_sys_guid_get(_swigobj)  _ibsm_node_info_sys_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_sys_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->sys_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->sys_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_sys_guid_get(_swigobj) (&_swigobj->sys_guid)
-+#endif
- static int _wrap_smNodeInfo_sys_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35290,7 +35311,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_node_guid_set(_swigobj,_swigval)  _ibsm_node_info_node_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_node_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->node_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->node_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_node_guid_set(_swigobj,_swigval) (_swigobj->node_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_node_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35348,7 +35380,17 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_node_guid_get(_swigobj)  _ibsm_node_info_node_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_node_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->node_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->node_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_node_guid_get(_swigobj) (&_swigobj->node_guid)
-+#endif
- static int _wrap_smNodeInfo_node_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35400,7 +35442,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_port_guid_set(_swigobj,_swigval)  _ibsm_node_info_port_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_port_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->port_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->port_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_port_guid_set(_swigobj,_swigval) (_swigobj->port_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_port_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35458,7 +35511,17 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_port_guid_get(_swigobj)  _ibsm_node_info_port_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_port_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->port_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->port_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_port_guid_get(_swigobj) (&_swigobj->port_guid)
-+#endif
- static int _wrap_smNodeInfo_port_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibpm_base.h ibutils-1.5.7/ibis/src/ibpm_base.h
---- /tmp/ibutils-1.5.7/ibis/src/ibpm_base.h	Wed Feb 24 02:09:25 2010
-+++ ibutils-1.5.7/ibis/src/ibpm_base.h	Thu Feb 24 16:51:18 2011
-@@ -34,7 +34,11 @@
- #ifndef _IBPM_BASE_H_
- #define _IBPM_BASE_H_
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #define PERF_CLASS      0x04
- #define PERF_CLASS_PORT_INFO 0x01
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibvs_base.h ibutils-1.5.7/ibis/src/ibvs_base.h
---- /tmp/ibutils-1.5.7/ibis/src/ibvs_base.h	Wed Feb 24 02:09:25 2010
-+++ ibutils-1.5.7/ibis/src/ibvs_base.h	Thu Feb 24 16:51:18 2011
-@@ -34,7 +34,11 @@
- #ifndef _IBVS_BASE_H_
- #define _IBVS_BASE_H_
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #define VS_CLASS             0x0a
- #define VS_CLASS_PORT_INFO   0x01
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/swig_extended_obj.c ibutils-1.5.7/ibis/src/swig_extended_obj.c
---- /tmp/ibutils-1.5.7/ibis/src/swig_extended_obj.c	Tue Mar 23 02:21:00 2010
-+++ ibutils-1.5.7/ibis/src/swig_extended_obj.c	Thu Feb 24 16:51:18 2011
-@@ -30,6 +30,9 @@
-  * SOFTWARE.
-  *
-  */
-+#if defined(__SVR4) && defined(__sun)
-+#include <strings.h>
-+#endif
- 
- /*--------------------------------------------------------------------
-  * This file holds an extended implementation for SWIG TCL Objects.
-diff -r -u /tmp/ibutils-1.5.7/ibis/src/ibissh_wrap.cpp ibutils-1.5.7/ibis/src/ibissh_wrap.cpp
---- /tmp/ibutils-1.5.7/ibis/src/ibissh_wrap.cpp	Mon Nov  1 16:03:44 2010
-+++ ibutils-1.5.7/ibis/src/ibissh_wrap.cpp	Thu Feb 24 16:51:18 2011
-@@ -13,6 +13,11 @@
-  * Do not make changes to this file--changes will be lost!
-  *
-  */
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/types.h>
-+#define	TRUE	_B_TRUE
-+#define	FALSE 	_B_FALSE
-+#endif
- 
- 
- #define SWIGCODE
-@@ -823,7 +828,11 @@
- 	  // Write response - no data
- 	  // Note: The trailing space here is important !
- 	  sprintf(buff, "ACK ");
-+#if defined(__SVR4) && defined(__sun)
-+	  space_in_resp = (boolean_t)0;
-+#else
- 	  space_in_resp = 0;
-+#endif
-       }
- 
-       if (is_multi && space_in_resp)
-@@ -2722,18 +2731,18 @@
-   typedef ib_mad_notice_attr_t  smNotice;
- 
-   /* these are the globals to be used for set/get */
--  ib_node_info_t          ibsm_node_info_obj;
--  ib_port_info_t          ibsm_port_info_obj;
--  ib_switch_info_t        ibsm_switch_info_obj;
--  ibsm_lft_block_t        ibsm_lft_block_obj;
--  ibsm_mft_block_t        ibsm_mft_block_obj;
--  ib_guid_info_t          ibsm_guid_info_obj;
--  ib_pkey_table_t         ibsm_pkey_table_obj;
--  ib_slvl_table_t         ibsm_slvl_table_obj;
--  ib_vl_arb_table_t       ibsm_vl_arb_table_obj;
--  ib_node_desc_t          ibsm_node_desc_obj;
--  ib_sm_info_t            ibsm_sm_info_obj;
--  ib_mad_notice_attr_t    ibsm_notice_obj;
-+  ib_node_info_t          ibsm_node_info_obj	__attribute__((aligned));
-+  ib_port_info_t          ibsm_port_info_obj	__attribute__((aligned));
-+  ib_switch_info_t        ibsm_switch_info_obj	__attribute__((aligned));
-+  ibsm_lft_block_t        ibsm_lft_block_obj	__attribute__((aligned));
-+  ibsm_mft_block_t        ibsm_mft_block_obj	__attribute__((aligned));
-+  ib_guid_info_t          ibsm_guid_info_obj	__attribute__((aligned));
-+  ib_pkey_table_t         ibsm_pkey_table_obj	__attribute__((aligned));
-+  ib_slvl_table_t         ibsm_slvl_table_obj	__attribute__((aligned));
-+  ib_vl_arb_table_t       ibsm_vl_arb_table_obj	__attribute__((aligned));
-+  ib_node_desc_t          ibsm_node_desc_obj	__attribute__((aligned));
-+  ib_sm_info_t            ibsm_sm_info_obj	__attribute__((aligned));
-+  ib_mad_notice_attr_t    ibsm_notice_obj	__attribute__((aligned));
- 
-   /* TODO - define a Vendor Specific CR Read/Write attributes to use VL15 */
- 
-@@ -35242,7 +35251,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_sys_guid_set(_swigobj,_swigval)  _ibsm_node_info_sys_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_sys_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->sys_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->sys_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_sys_guid_set(_swigobj,_swigval) (_swigobj->sys_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_sys_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35300,7 +35320,18 @@
- }
-     return TCL_OK;
- }
-+
-+#ifdef __sparcv9
-+#define _ibsm_node_info_sys_guid_get(_swigobj)  _ibsm_node_info_sys_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_sys_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->sys_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->sys_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_sys_guid_get(_swigobj) (&_swigobj->sys_guid)
-+#endif
- static int _wrap_smNodeInfo_sys_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35340,6 +35371,7 @@
-   ibis_tcl_error = 0;
-       _result = (ib_net64_t *)_ibsm_node_info_sys_guid_get(_arg0);
- ;
-+
-   if (ibis_tcl_error) {
- 	 Tcl_SetStringObj(Tcl_GetObjResult(interp), ibis_tcl_error_msg, -1);
- 	 return TCL_ERROR;
-@@ -35352,7 +35384,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_node_guid_set(_swigobj,_swigval)  _ibsm_node_info_node_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_node_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->node_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->node_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_node_guid_set(_swigobj,_swigval) (_swigobj->node_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_node_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35410,7 +35453,17 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_node_guid_get(_swigobj)  _ibsm_node_info_node_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_node_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->node_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->node_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_node_guid_get(_swigobj) (&_swigobj->node_guid)
-+#endif
- static int _wrap_smNodeInfo_node_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35462,7 +35515,18 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_port_guid_set(_swigobj,_swigval)  _ibsm_node_info_port_guid_set_64(_swigobj, _swigval)
-+static inline ib_net64_t *
-+_ibsm_node_info_port_guid_set_64(smNodeInfo *_swigobj, ib_net64_t *swigval)
-+{
-+        *(ib_net32_t *)&(_swigobj->port_guid) = *((ib_net32_t *)swigval);
-+        *((ib_net32_t *)&(_swigobj->port_guid) + 1) = *((ib_net32_t *)swigval +1);
-+        return ((ib_net64_t *)swigval);
-+}
-+#else
- #define _ibsm_node_info_port_guid_set(_swigobj,_swigval) (_swigobj->port_guid = *(_swigval),_swigval)
-+#endif
- static int _wrap_smNodeInfo_port_guid_set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-@@ -35520,7 +35584,17 @@
- }
-     return TCL_OK;
- }
-+#ifdef __sparcv9
-+#define _ibsm_node_info_port_guid_get(_swigobj)  _ibsm_node_info_port_guid_get_64(_swigobj)
-+static inline ib_net64_t * _ibsm_node_info_port_guid_get_64(smNodeInfo *_swigobj){
-+	static uint32_t	val[2];
-+	val[0] = *(ib_net32_t *)&(_swigobj->port_guid);
-+	val[1] = *((ib_net32_t *)&(_swigobj->port_guid) + 1);
-+	return ((ib_net64_t *)&val);
-+}
-+#else
- #define _ibsm_node_info_port_guid_get(_swigobj) (&_swigobj->port_guid)
-+#endif
- static int _wrap_smNodeInfo_port_guid_get(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
- 
-     ib_net64_t * _result;
-diff -r -u /tmp/ibutils-1.5.7/ibis/tests/Makefile.in ibutils-1.5.7/ibis/tests/Makefile.in
---- /tmp/ibutils-1.5.7/ibis/tests/Makefile.in	Tue Mar  8 03:09:51 2011
-+++ ibutils-1.5.7/ibis/tests/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibis/Makefile.in ibutils-1.5.7/ibis/Makefile.in
---- /tmp/ibutils-1.5.7/ibis/Makefile.in	Tue Mar  8 03:09:51 2011
-+++ ibutils-1.5.7/ibis/Makefile.in	Thu Feb 24 16:51:17 2011
-@@ -54,7 +54,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibis/configure ibutils-1.5.7/ibis/configure
---- /tmp/ibutils-1.5.7/ibis/configure	Tue Mar  8 03:09:53 2011
-+++ ibutils-1.5.7/ibis/configure	Thu Mar 10 18:33:26 2011
-@@ -2764,7 +2764,7 @@
- 
- test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
- 
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
- $as_echo_n "checking whether build environment is sane... " >&6; }
-@@ -6398,7 +6398,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-@@ -10087,6 +10087,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-@@ -12957,6 +12958,7 @@
- 	    fi
- 	    ;;
-         esac
-+	  hardcode_libdir_flag_spec_CXX=
-         ;;
- 
-     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-@@ -15284,8 +15286,8 @@
-       else
-          osm_lib_dir=lib
-       fi
-+      with_osm_libs=$with_osm/$osm_lib_dir
-    fi
--   with_osm_libs=$with_osm/$osm_lib_dir
- 
-       if test -d $with_osm/include/infiniband; then
-       OSM_BUILD=openib
-@@ -15295,7 +15297,7 @@
-    { $as_echo "$as_me:${as_lineno-$LINENO}: OSM: build type $OSM_BUILD" >&5
- $as_echo "$as_me: OSM: build type $OSM_BUILD" >&6;}
- 
--   OSM_LDFLAGS="-Wl,-rpath -Wl,$with_osm_libs -L$with_osm_libs"
-+   OSM_LDFLAGS="-L$with_osm_libs"
-          if test $OSM_BUILD = openib; then
-             osm_include_dir="$with_osm/include/infiniband"
-       osm_extra_includes="-I$with_osm/include"
-@@ -15378,7 +15380,7 @@
-       osm_debug_flags=
-    fi
- 
--   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
-+   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
- else
-       with_osm=disabled
-    OSM_CLFAGS=disabled
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/aclocal.m4 ibutils-1.5.7/ibmgtsim/aclocal.m4
---- /tmp/ibutils-1.5.7/ibmgtsim/aclocal.m4	Tue Mar  8 03:09:58 2011
-+++ ibutils-1.5.7/ibmgtsim/aclocal.m4	Thu Feb 24 16:51:18 2011
-@@ -1389,7 +1389,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/doc/Makefile.in ibutils-1.5.7/ibmgtsim/doc/Makefile.in
---- /tmp/ibutils-1.5.7/ibmgtsim/doc/Makefile.in	Tue Mar  8 03:10:01 2011
-+++ ibutils-1.5.7/ibmgtsim/doc/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -52,7 +52,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/src/Makefile.in ibutils-1.5.7/ibmgtsim/src/Makefile.in
---- /tmp/ibutils-1.5.7/ibmgtsim/src/Makefile.in	Tue Mar  8 03:10:01 2011
-+++ ibutils-1.5.7/ibmgtsim/src/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -55,7 +55,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/tests/Makefile.in ibutils-1.5.7/ibmgtsim/tests/Makefile.in
---- /tmp/ibutils-1.5.7/ibmgtsim/tests/Makefile.in	Tue Mar  8 03:10:01 2011
-+++ ibutils-1.5.7/ibmgtsim/tests/Makefile.in	Thu Feb 24 16:51:19 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/utils/Makefile.in ibutils-1.5.7/ibmgtsim/utils/Makefile.in
---- /tmp/ibutils-1.5.7/ibmgtsim/utils/Makefile.in	Tue Mar  8 03:10:02 2011
-+++ ibutils-1.5.7/ibmgtsim/utils/Makefile.in	Thu Feb 24 16:51:19 2011
-@@ -53,7 +53,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/Makefile.in ibutils-1.5.7/ibmgtsim/Makefile.in
---- /tmp/ibutils-1.5.7/ibmgtsim/Makefile.in	Tue Mar  8 03:10:02 2011
-+++ ibutils-1.5.7/ibmgtsim/Makefile.in	Thu Feb 24 16:51:18 2011
-@@ -54,7 +54,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/ibmgtsim/configure ibutils-1.5.7/ibmgtsim/configure
---- /tmp/ibutils-1.5.7/ibmgtsim/configure	Tue Mar  8 03:10:03 2011
-+++ ibutils-1.5.7/ibmgtsim/configure	Thu Mar 10 18:33:27 2011
-@@ -2769,7 +2769,7 @@
- 
- test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
- 
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
- $as_echo_n "checking whether build environment is sane... " >&6; }
-@@ -6440,7 +6440,7 @@
- 
- # Determine commands to create old-style static archives.
- old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
--old_postinstall_cmds='chmod 644 $oldlib'
-+old_postinstall_cmds='chmod 744 $oldlib'
- old_postuninstall_cmds=
- 
- if test -n "$RANLIB"; then
-@@ -15360,7 +15360,7 @@
-       osm_debug_flags=
-    fi
- 
--   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
-+   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
- else
-       with_osm=disabled
-    OSM_CLFAGS=disabled
-diff -r -u /tmp/ibutils-1.5.7/Makefile.in ibutils-1.5.7/Makefile.in
---- /tmp/ibutils-1.5.7/Makefile.in	Tue Mar  8 03:09:29 2011
-+++ ibutils-1.5.7/Makefile.in	Thu Mar 10 18:33:24 2011
-@@ -54,7 +54,7 @@
- pkglibdir = $(libdir)/@PACKAGE@
- pkglibexecdir = $(libexecdir)/@PACKAGE@
- am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
-+install_sh_DATA = $(install_sh) -c -m 744
- install_sh_PROGRAM = $(install_sh) -c
- install_sh_SCRIPT = $(install_sh) -c
- INSTALL_HEADER = $(INSTALL_DATA)
-diff -r -u /tmp/ibutils-1.5.7/configure ibutils-1.5.7/configure
---- /tmp/ibutils-1.5.7/configure	Tue Mar  8 03:09:29 2011
-+++ ibutils-1.5.7/configure	Wed Apr  1 01:47:48 2015
-@@ -1824,7 +1824,7 @@
- 
- test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
- 
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 744'
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
- $as_echo_n "checking whether build environment is sane... " >&6; }
-@@ -2450,7 +2450,7 @@
-       osm_debug_flags=
-    fi
- 
--   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
-+   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_BSD_SOURCE=1"
- else
-       with_osm=disabled
-    OSM_CLFAGS=disabled
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,428 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license infiniband-diags-1.6.5 under the OpenIB.org BSD license.
+
+Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2010 Lawrence Livermore National Lab.  All rights reserved.
+Copyright (c) 2009 Mellanox Technologies LTD.  All rights reserved.
+Copyright (c) 2009 HNR Consulting.  All rights reserved.
+Copyright (c) 2009 Lawrence Livermore National Security
+Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
+Copyright (c) 2008 Lawrence Livermore National Lab.  All rights reserved.
+Copyright (c) 2008 Lawrence Livermore National Security
+Copyright (c) 2007-2008 Voltaire, Inc. All rights reserved.
+Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
+Copyright (c) 2006,2007 The Regents of the University of California.
+Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
+Copyright (C) 2001-2003 The Regents of the University of California.
+Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+
+This software with the exception of OpenSM is available to you
+under a choice of one of two licenses. You may chose to be
+licensed under the terms of the the OpenIB.org BSD license or
+the GNU General Public License (GPL) Version 2, both included
+below.
+
+OpenSM is licensed under either GNU General Public License (GPL)
+Version 2, or Intel BSD + Patent license. See OpenSM for the
+specific language for the latter licensing terms.
+
+
+=============================================================
+
+OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License. (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code. (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year> <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
--- a/components/open-fabrics/infiniband-diags/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/infiniband-diags/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		infiniband-diags
-COMPONENT_VERSION=	1.5.8
+COMPONENT_VERSION=	1.6.5
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:0baf6694d54602a66dfc2b82a765c933b24534fd8e2bda7e9b89abf503b29c02
-COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+    sha256:53c4ffbc74bec30ea7fdba7bad957b557c6ee6759e337d0a130c1b0817f51307
+COMPONENT_ARCHIVE_URL=	https://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	utility/ofuv_tools
 
 INSTALL_TARGET=
@@ -37,15 +37,28 @@
 
 CFLAGS += -I$(PROTOUSRINCDIR)/infiniband
 
-LIBS +=	-lopensm -losmvendor -losmcomp -libumad -libmad -libverbs -ldevinfo
+LIBS +=	-lopensm -losmvendor -losmcomp -libumad -libmad -libverbs -ldevinfo -lglib-2.0
 
 COMPONENT_PREP_ACTION = \
         cp solaris_set_nodedesc.c $(@D)/src
 
 COMPONENT_INSTALL_ENV +=	PERL=$(PERL.5.12)
 
+LDFLAGS += -L$(PROTOUSRLIBDIR64)
 CONFIGURE_ENV +=	PERL=$(PERL.5.12)
 
+#
+# For some weird reason PKG_CONFIG is generating
+# additional linker flags for 64bit builds. We are enforcing
+# the GLIB_LIBS with only glib-2.0 here.
+#
+CONFIGURE_ENV +=       GLIB_LIBS="-lglib-2.0"
+
+CONFIGURE_OPTIONS +=   --sysconfdir=$(ETCDIR)/infiniband
+CONFIGURE_OPTIONS +=   --disable-rdma-ndd
+CONFIGURE_OPTIONS +=   --enable-compat-utils
+CONFIGURE_OPTIONS +=   --enable-test-utils
+
 # it apears that configure is broken
 COMPONENT_BUILD_ARGS  +=	LIBS="$(LIBS)"
 
@@ -75,5 +88,5 @@
 	$(INSTALL) -m 644 manpages/set_nodedesc.sh.8 $(PROTOUSRSHAREMAN8DIR)
 
 # common targets
-install:	$(INSTALL_32_and_64) #$(PROTOMAN8FILES)
+install:	$(INSTALL_64)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags/patches/001-infiniband-diags-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1091 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  1a09f6cd286d3944e93759ba19f877137e556318
+
+diff -r 1a09f6cd286d Makefile.in
+--- a/Makefile.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/Makefile.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -87,6 +87,7 @@
+ 	src/perfquery$(EXEEXT) src/sminfo$(EXEEXT) \
+ 	src/smpdump$(EXEEXT) src/smpquery$(EXEEXT) \
+ 	src/saquery$(EXEEXT) src/vendstat$(EXEEXT) \
++	src/solaris_set_nodedesc$(EXEEXT) \
+ 	src/iblinkinfo$(EXEEXT) src/ibqueryerrors$(EXEEXT) \
+ 	src/ibcacheedit$(EXEEXT) src/ibccquery$(EXEEXT) \
+ 	src/ibccconfig$(EXEEXT) src/dump_fts$(EXEEXT) $(am__EXEEXT_1) \
+@@ -302,6 +303,7 @@
+ am_src_ibsysstat_OBJECTS = ibsysstat.$(OBJEXT)
+ src_ibsysstat_OBJECTS = $(am_src_ibsysstat_OBJECTS)
+ src_ibsysstat_LDADD = $(LDADD)
++src_ibsysstat_LDADD += "-libverbs"
+ src_ibsysstat_DEPENDENCIES = libcommon.a
+ am_src_ibtracert_OBJECTS = ibtracert.$(OBJEXT)
+ src_ibtracert_OBJECTS = $(am_src_ibtracert_OBJECTS)
+@@ -339,6 +341,11 @@
+ src_vendstat_OBJECTS = $(am_src_vendstat_OBJECTS)
+ src_vendstat_LDADD = $(LDADD)
+ src_vendstat_DEPENDENCIES = libcommon.a
++am_src_solaris_set_nodedesc_OBJECTS = solaris_set_nodedesc.$(OBJEXT)
++src_solaris_set_nodedesc_OBJECTS = $(am_src_solaris_set_nodedesc_OBJECTS)
++src_solaris_set_nodedesc_LDADD = $(LDADD)
++src_solaris_set_nodedesc_LDADD += "-libverbs -ldevinfo"
++src_solaris_set_nodedesc_DEPENDENCIES = libcommon.a
+ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+ am__vpath_adj = case $$p in \
+     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+@@ -412,7 +419,7 @@
+ 	$(src_mcm_rereg_test_SOURCES) $(src_perfquery_SOURCES) \
+ 	src/rdma-ndd.c $(src_saquery_SOURCES) $(src_sminfo_SOURCES) \
+ 	$(src_smpdump_SOURCES) $(src_smpquery_SOURCES) \
+-	$(src_vendstat_SOURCES)
++	$(src_vendstat_SOURCES) $(src_solaris_set_nodedesc_SOURCES)
+ DIST_SOURCES = $(libcommon_a_SOURCES) $(src_dump_fts_SOURCES) \
+ 	$(src_ibaddr_SOURCES) $(src_ibcacheedit_SOURCES) \
+ 	$(src_ibccconfig_SOURCES) $(src_ibccquery_SOURCES) \
+@@ -424,7 +431,7 @@
+ 	$(src_mcm_rereg_test_SOURCES) $(src_perfquery_SOURCES) \
+ 	src/rdma-ndd.c $(src_saquery_SOURCES) $(src_sminfo_SOURCES) \
+ 	$(src_smpdump_SOURCES) $(src_smpquery_SOURCES) \
+-	$(src_vendstat_SOURCES)
++	$(src_vendstat_SOURCES) $(src_solaris_set_nodedesc_SOURCES)
+ RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ 	ctags-recursive dvi-recursive html-recursive info-recursive \
+ 	install-data-recursive install-dvi-recursive \
+@@ -877,6 +884,7 @@
+ src_saquery_SOURCES = src/saquery.c
+ src_ibsendtrap_SOURCES = src/ibsendtrap.c
+ src_vendstat_SOURCES = src/vendstat.c
++src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c
+ src_mcm_rereg_test_SOURCES = src/mcm_rereg_test.c
+ src_iblinkinfo_SOURCES = src/iblinkinfo.c
+ src_ibccquery_SOURCES = src/ibccquery.c
+@@ -1088,8 +1096,8 @@
+ 	while read type dir files; do \
+ 	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ 	    test -z "$$files" || { \
+-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
++	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	    } \
+ 	; done
+ 
+@@ -1207,6 +1215,10 @@
+ src/vendstat$(EXEEXT): $(src_vendstat_OBJECTS) $(src_vendstat_DEPENDENCIES) $(EXTRA_src_vendstat_DEPENDENCIES) src/$(am__dirstamp)
+ 	@rm -f src/vendstat$(EXEEXT)
+ 	$(AM_V_CCLD)$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
++
++src/solaris_set_nodedesc$(EXEEXT): $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_DEPENDENCIES) $(EXTRA_src_solaris_set_nodedesc_DEPENDENCIES) src/$(am__dirstamp)
++	@rm -f src/solaris_set_nodedesc$(EXEEXT)
++	$(AM_V_CCLD)$(LINK) $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_LDADD) $(LIBS)
+ install-sbinSCRIPTS: $(sbin_SCRIPTS)
+ 	@$(NORMAL_INSTALL)
+ 	@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
+@@ -1274,6 +1286,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpdump.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpquery.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vendstat.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solaris_set_nodedesc.Po@am__quote@
+ 
+ .c.o:
+ @am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@@ -1646,6 +1659,20 @@
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vendstat.obj `if test -f 'src/vendstat.c'; then $(CYGPATH_W) 'src/vendstat.c'; else $(CYGPATH_W) '$(srcdir)/src/vendstat.c'; fi`
+ 
++solaris_set_nodedesc.o: src/solaris_set_nodedesc.c
++@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solaris_set_nodedesc.o -MD -MP -MF $(DEPDIR)/solaris_set_nodedesc.Tpo -c -o solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
++@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/solaris_set_nodedesc.Tpo $(DEPDIR)/solaris_set_nodedec.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/solaris_set_nodedesc.c' object='solaris_set_nodedesc.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
++
++solaris_set_nodedesc.obj: src/solaris_set_nodedesc.c
++@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solaris_set_nodedesc.obj -MD -MP -MF $(DEPDIR)/solaris_set_nodedesc.Tpo -c -o solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
++@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/solaris_set_nodedesc.Tpo $(DEPDIR)/solaris_set_nodedesc.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/solaris_set_nodedesc.c' object='solaris_set_nodedesc.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
++
+ mostlyclean-libtool:
+ 	-rm -f *.lo
+ 
+@@ -1677,6 +1704,10 @@
+ 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ 	sed 'N;N;s,\n, ,g' | { \
+ 	list=; while read file base inst; do \
++	    ext='8'; \
++	    inst=`echo $$inst | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	    inst=`echo $$inst | sed -e 's/^.*\///'`; \
++	    inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ 	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ 	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ 	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+@@ -1697,6 +1728,10 @@
+ 	  sed -n '/\.8[a-z]*$$/p'; \
+ 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
++	ext='8'; \
++	files=`echo $$files | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	files=`echo $$files | sed -e 's/^.*\///'`; \
++	files=`echo $$files | sed '$(transform)'`.$$ext; \
+ 	dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
+ 
+ # This directory's subdirectories are mostly independent; you can cd
+diff -r 1a09f6cd286d configure
+--- a/configure	Fri Nov 13 07:21:42 2015 -0800
++++ b/configure	Fri Nov 13 08:22:46 2015 -0800
+@@ -9739,6 +9739,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -11822,7 +11823,7 @@
+   $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-losmcomp  $LIBS"
++LIBS="$LDFLAGS -losmcomp  $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+diff -r 1a09f6cd286d libibnetdisc/src/internal.h
+--- a/libibnetdisc/src/internal.h	Fri Nov 13 07:21:42 2015 -0800
++++ b/libibnetdisc/src/internal.h	Fri Nov 13 08:22:46 2015 -0800
+@@ -42,12 +42,56 @@
+ #include <complib/cl_qmap.h>
+ #include <glib.h>
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <sys/varargs.h>
++
++static inline void
++ibnd_msg_internal(FILE *fd, const char *format, va_list alist)
++{
++	const char	*filename;
++	char		*filename_p;
++	char		*format_p = format;
++
++	/*
++	 * The filename returned by va_arg() has the full path. Skip "%s"
++	 * from format="%s:%u; " and truncate full pathname of src file to
++	 * start with infiniband-diags.
++	 */
++	filename = va_arg(alist, const char *);
++	format_p += 2;
++	if ((filename_p = strstr(filename, "infiniband-diags-")) != NULL) {
++		(void) fprintf(fd, "%s", filename_p);
++		(void) vfprintf(fd, format_p, alist);
++	} else {
++		(void) fprintf(fd, "%s", filename);
++		(void) vfprintf(fd, format_p, alist);
++	}
++}
++
++static inline void
++ibnd_msg(FILE *fd, const char *format, ...)
++{
++	va_list alist;
++
++	va_start(alist, format);
++	ibnd_msg_internal(fd, format, alist);
++	va_end(alist);
++}
++
++#define	IBND_DEBUG(fmt, ...) \
++	if (ibdebug) { \
++		ibnd_msg(stdout, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
++	}
++#define	IBND_ERROR(fmt, ...) \
++		ibnd_msg(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
++#else
+ #define	IBND_DEBUG(fmt, ...) \
+ 	if (ibdebug) { \
+ 		printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
+ 	}
+ #define	IBND_ERROR(fmt, ...) \
+ 		fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
++#endif
+ 
+ /* HASH table defines */
+ #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
+diff -r 1a09f6cd286d libibnetdisc/src/query_smp.c
+--- a/libibnetdisc/src/query_smp.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/libibnetdisc/src/query_smp.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -165,7 +165,7 @@
+ 	uint8_t *mad;
+ 	uint32_t trid;
+ 	uint8_t umad[sizeof(struct ib_user_mad) + IB_MAD_SIZE];
+-	int length = umad_size() + IB_MAD_SIZE;
++	int length = IB_MAD_SIZE;
+ 
+ 	memset(umad, 0, sizeof(umad));
+ 
+diff -r 1a09f6cd286d scripts/IBswcountlimits.pm
+--- a/scripts/IBswcountlimits.pm	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/IBswcountlimits.pm	Fri Nov 13 08:22:46 2015 -0800
+@@ -261,7 +261,8 @@
+ 	my $cache_file   = get_cache_file($ca_name, $ca_port);
+ 	my $extra_params = get_ca_name_port_param_string($ca_name, $ca_port);
+ 
+-	if (`ibnetdiscover -g $extra_params > $cache_file`) {
++	my $rc = `ibnetdiscover -g $extra_params > $cache_file`;
++	if ("$?" ne "0") {
+ 		die "Execution of ibnetdiscover failed: $!\n";
+ 	}
+ }
+diff -r 1a09f6cd286d scripts/ibcheckerrors.in
+--- a/scripts/ibcheckerrors.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckerrors.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -74,7 +74,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ BEGIN {
+ 	ne=0
+ }
+diff -r 1a09f6cd286d scripts/ibcheckerrs.in
+--- a/scripts/ibcheckerrs.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckerrs.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -144,7 +144,7 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -152,7 +152,7 @@
+ 	guid=$1
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -171,7 +171,7 @@
+ 	exit 0
+ fi
+ 
+-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
++if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
+ function blue(s)
+ {
+ 	if (brief == "yes") {
+diff -r 1a09f6cd286d scripts/ibchecknet.in
+--- a/scripts/ibchecknet.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibchecknet.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -67,7 +67,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ BEGIN {
+ 	ne=0
+ 	pe=0
+diff -r 1a09f6cd286d scripts/ibchecknode.in
+--- a/scripts/ibchecknode.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibchecknode.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -79,14 +79,14 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+ 	fi
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+diff -r 1a09f6cd286d scripts/ibcheckport.in
+--- a/scripts/ibcheckport.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckport.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -81,7 +81,7 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -89,14 +89,14 @@
+ 	guid=$1
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+ 	fi
+ fi
+ 
+-is_switch=`$IBPATH/smpquery $ca_info nodeinfo $lid $portnum | awk -F '[.:]*' '/^NodeType/{ if ($2 == "Switch") {print 1}}'`
++is_switch=`$IBPATH/smpquery $ca_info nodeinfo $lid $portnum | gawk -F '[.:]*' '/^NodeType/{ if ($2 == "Switch") {print 1}}'`
+ 
+ if [ "$is_switch" -a "$portnum" == "0" ]; then
+ 	ignore_check=true
+@@ -104,7 +104,7 @@
+ 
+ text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
+ rv=$?
+-if echo "$text" | awk -v ignore_check=$ignore_check -v mono=$bw -F '[.:]*' '
++if echo "$text" | gawk -v ignore_check=$ignore_check -v mono=$bw -F '[.:]*' '
+ function blue(s)
+ {
+ 	if (mono)
+diff -r 1a09f6cd286d scripts/ibcheckportstate.in
+--- a/scripts/ibcheckportstate.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckportstate.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -81,7 +81,7 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -89,7 +89,7 @@
+ 	guid=$1
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -99,7 +99,7 @@
+ 
+ text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
+ rv=$?
+-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
++if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
+ function blue(s)
+ {
+ 	if (mono)
+diff -r 1a09f6cd286d scripts/ibcheckportwidth.in
+--- a/scripts/ibcheckportwidth.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckportwidth.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -81,7 +81,7 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -89,7 +89,7 @@
+ 	guid=$1
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -99,7 +99,7 @@
+ 
+ text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
+ rv=$?
+-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
++if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
+ function blue(s)
+ {
+ 	if (mono)
+diff -r 1a09f6cd286d scripts/ibcheckstate.in
+--- a/scripts/ibcheckstate.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckstate.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -69,7 +69,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ BEGIN {
+ 	ne=0
+ 	pe=0
+diff -r 1a09f6cd286d scripts/ibcheckwidth.in
+--- a/scripts/ibcheckwidth.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibcheckwidth.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -69,7 +69,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ BEGIN {
+ 	ne=0
+ 	pe=0
+diff -r 1a09f6cd286d scripts/ibclearcounters.in
+--- a/scripts/ibclearcounters.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibclearcounters.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -59,7 +59,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ 
+ function clear_counters(lid)
+ {
+diff -r 1a09f6cd286d scripts/ibclearerrors.in
+--- a/scripts/ibclearerrors.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibclearerrors.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -63,7 +63,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ 
+ function clear_all_errors(lid, port)
+ {
+diff -r 1a09f6cd286d scripts/ibdatacounters.in
+--- a/scripts/ibdatacounters.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibdatacounters.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -74,7 +74,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ BEGIN {
+ 	ne=0
+ }
+diff -r 1a09f6cd286d scripts/ibdatacounts.in
+--- a/scripts/ibdatacounts.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibdatacounts.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -95,7 +95,7 @@
+ fi
+ 
+ if [ "$guid_addr" ]; then
+-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
++	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
+ 		echo -n "guid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -103,7 +103,7 @@
+ 	guid=$1
+ else
+ 	lid=$1
+-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
++	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
+ 		echo -n "lid $1 address resolution: "
+ 		red "FAILED"
+ 		exit -1
+@@ -118,7 +118,7 @@
+ 
+ text="`eval $IBPATH/perfquery $ca_info $lid $portnum`"
+ rv=$?
+-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
++if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
+ function blue(s)
+ {
+ 	if (brief == "yes") {
+diff -r 1a09f6cd286d scripts/ibdiscover.pl
+--- a/scripts/ibdiscover.pl	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibdiscover.pl	Fri Nov 13 08:22:46 2015 -0800
+@@ -53,9 +53,10 @@
+ 		$localGuid = $local;
+ 	} else {
+ 		($localPort, $type, $remoteGuid, $remotePort) =
+-		  /([\s\S]*)"([SH])\-000([a-f\d]*)"([\s\S]*)\n/;
++		  /([\s\S]*)"([SH])\-([a-f\d]*)"([\s\S]*)\n/;
+ 		($localPort)  = $localPort  =~ /\[(\d*)]/;
+ 		($remotePort) = $remotePort =~ /\[(\d*)]/;
++		$remoteGuid =~ s/^0*//;
+ 		if ($remoteGuid ne "" && $localPort ne "") {
+ 			printf(TOPO2 "%d|%s|%d|%s\n",
+ 				$localPort, $localGuid, $remotePort, $remoteGuid);
+diff -r 1a09f6cd286d scripts/ibhosts.in
+--- a/scripts/ibhosts.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibhosts.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -49,7 +49,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ /^Ca/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
+ 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
+ /^ib/	{print $0; next}
+diff -r 1a09f6cd286d scripts/ibprintca.pl
+--- a/scripts/ibprintca.pl	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibprintca.pl	Fri Nov 13 08:22:46 2015 -0800
+@@ -86,7 +86,7 @@
+ 
+ if ($list_hcas) {
+ 	system("ibhosts $cache_file");
+-	exit 1;
++	exit $?;
+ }
+ 
+ if ($target_hca eq "") {
+diff -r 1a09f6cd286d scripts/ibprintrt.pl
+--- a/scripts/ibprintrt.pl	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibprintrt.pl	Fri Nov 13 08:22:46 2015 -0800
+@@ -86,7 +86,7 @@
+ 
+ if ($list_rts) {
+ 	system("ibrouters $cache_file");
+-	exit 1;
++	exit $?;
+ }
+ 
+ if ($target_rt eq "") {
+diff -r 1a09f6cd286d scripts/ibprintswitch.pl
+--- a/scripts/ibprintswitch.pl	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibprintswitch.pl	Fri Nov 13 08:22:46 2015 -0800
+@@ -86,7 +86,7 @@
+ 
+ if ($list_switches) {
+ 	system("ibswitches $cache_file");
+-	exit 1;
++	exit $?;
+ }
+ 
+ if ($target_switch eq "") {
+diff -r 1a09f6cd286d scripts/ibrouters.in
+--- a/scripts/ibrouters.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibrouters.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -49,7 +49,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ /^Rt/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
+ 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
+ /^ib/	{print $0; next}
+diff -r 1a09f6cd286d scripts/ibstatus
+--- a/scripts/ibstatus	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibstatus	Fri Nov 13 08:22:46 2015 -0800
+@@ -2,66 +2,137 @@
+ 
+ # Usage ibstatus [devname[:port]]
+ 
+-infiniband_base="/sys/class/infiniband"
+-def_ibdev="mthca0"
++ibvdevinfo="/usr/bin/ibv_devinfo"
++ibvdevinfo_results="/tmp/ibvdevinfo.output.$$"
++tmpout="/tmp/tmpout.$$"
+ 
+ usage() {
+ 	prog=`basename $0`
+ 	echo "Usage: " $prog " [-h] [devname[:portnum]]"
+ 	echo "	-h:	this help screen"
+ 	echo "	Examples:"
+-	echo "		$prog mthca1		# shows status of all ports of 'mthca1'"
+-	echo "		$prog mthca0:2	# shows status port number 2 of 'mthca0'"
+-	echo "		$prog		# default: shows status of all '$def_ibdev' ports"
+-	exit -1
++	echo "		$prog mlx4_1		# shows status of all ports of 'mlx4_1'"
++	echo "		$prog mlx4_0:2	# shows status port number 2 of 'mlx4_0'"
++	echo "		$prog		# default: shows status of all IB ports"
++	exit 0
+ }
+ 
+-fatal() {
+-	echo "Fatal error: " $*
+-	exit -1
+-}
+-
+-
+-port_status() {
+-	port_dir="$infiniband_base/$1/ports/$2"
+-	echo "Infiniband device '$1' port $2 status:"
+-	echo "	default gid:	" `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
+-	echo "	base lid:	" `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
+-	echo "	sm lid:		" `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
+-	echo "	state:		" `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
+-	echo "	phys state:	" `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
+-	echo "	rate:		" `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
+-	echo "	link_layer:	" `[ -r $port_dir/link_layer ] && cat $port_dir/link_layer || echo IB`
+-	echo
+-}
+-
+-ib_status() {
+-	ports_dir="$infiniband_base/$1/ports"
+-
+-	if ! [ -d "$ports_dir" ]; then
+-		fatal "device '$1': sys files not found ($ports_dir)"
+-	fi
+-
+-	if [ "$2" = "+" ]; then
+-		ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
+-	else
+-		ports=$2
+-	fi
+-
+-	for i in $ports; do
+-		port_status $1 $i
+-	done
++get_status_ports() {
++	nawk '
++	BEGIN {
++		hcaid_in="'"$1"'"
++		port_in="'"$2"'"
++		if (hcaid_in == "+") {
++			hcaid_hit=1
++			if (port_in == "+")
++				port_hit=1
++		}
++	}
++	{
++		if ($0 ~ "hca_id") {
++			if (hcaid_in == "+") {
++				cur_hcaid = $2
++			} else if (hcaid_in == $2) {
++				hcaid_hit=1
++				if (port_in == "+")
++					port_hit=1
++			} else if (hcaid_hit == 1)
++				exit 0
++		}
++		if (hcaid_hit == 1) {
++			if ($0 ~ "port:") {
++				if (port_in == "+") {
++					cur_port=$2;
++				} else if (port_in == $2) {
++					port_hit=1
++				} else if (port_hit == 1)
++					exit 0
++			}
++		}
++		if (hcaid_hit == 1 && port_hit == 1) {
++			if ($0 ~ "state:" && $0 !~ "phys_state:") {
++				state=$2;
++				staten=$3
++			} else if ($0 ~ "sm_lid:") {
++				sm_lid=$2
++			} else if ($0 ~ "port_lid:") {
++				port_lid=$2
++			} else if ($0 ~ "active_width:") {
++				width = $2
++				sub("X$", "", width)
++			} else if ($0 ~ "active_speed:") {
++				speed=$2
++			} else if ($0 ~ "phys_state:") {
++				pstate=$2
++				pstaten=$3
++			} else if ($0 ~ "link_layer:") {
++				link=$2
++			} else if ($0 ~ "GID"){
++				gid=$NF
++				if (hcaid_in == "+") {
++					printf("Infiniband device '\''%s'\'' port %d status:\n", cur_hcaid, cur_port);
++				} else if (port_in == "+") {
++					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, cur_port);
++				} else {
++					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, port_in);
++				}
++				printf("\tdefault gid:\t%s\n", gid)
++				printf("\tstate:\t\t%d: %s\n", staten, state); 
++				printf("\tphys state:\t%d: %s\n", pstaten, pstate);
++				printf("\tsm lid:\t\t0x%x\n", sm_lid)
++				printf("\tbase lid:\t0x%x\n", port_lid)
++				printf("\trate:\t\t%d Gb/sec (%dX)\n", width * speed, width)
++				printf("\tlink_layer:\t%s\n\n", link); 
++			}
++		}
++	}
++	END {
++		if (hcaid_in != "+" && port_in == "+" && hcaid_hit == 0) {
++ 			printf("Fatal error: device '\''%s'\'' not found\n\n", hcaid_in)
++			exit 1;
++		}
++		if (hacid_in != "+" && port_in != "+" && port_hit == 0) {
++ 			printf("Fatal error: port '\''%s:%d'\'' not found\n\n", hcaid_in, port_in)
++			exit 1;
++		}
++	}' $tmpout
+ }
+ 
+ if [ "$1" = "-h" ]; then
+ 	usage
+ fi
+ 
++# Check to see if /usr/bin/ibv_devinfo exists.
++if [ ! -x $ibvdevinfo ]; then
++	echo "$ibvdevinfo doesn't exist!"
++	exit 1
++fi
++
++# Run ibv_devinfo and direct the output to $ibvdevinfo_results.
++$ibvdevinfo -v > $ibvdevinfo_results
++if [ $? != 0 ]; then
++	echo "$ibvdevinfo failed!"
++	exit 1
++fi
++#
++
++nhcas=`$ibvdevinfo -l | awk '/HCA/{print $1}'`
++if [ -z $nhcas ]; then
++        echo "No HCAs!"
++	rm -f $ibvdevinfo_results
++	exit 1
++fi
++
++egrep "port:|hca_id:|_lid|GID|state:|active_|link_layer:" $ibvdevinfo_results |grep -v _mtu | sed -e 's/(//' -e 's/)//' > $tmpout
++rm -f $ibvdevinfo_results
++
+ if [ -z "$1" ]; then
+-	cd $infiniband_base 2>/dev/null || fatal No devices
+-	for dev in *; do
+-		ib_status $dev "+";
+-	done
++	get_status_ports "+" "+"
++	if [ $? != 0 ]; then
++		rm -f $tmpout
++		exit 1
++	fi
++	rm -f $tmpout
+ 	exit 0
+ fi
+ 
+@@ -73,6 +144,12 @@
+ 		port="+"
+ 	fi
+ 
+-	ib_status $dev $port
++	get_status_ports $dev $port
++	if [ $? != 0 ]; then
++		rm -f $tmpout
++		exit 1
++	fi
++
+ 	shift
+ done
++rm -f $tmpout
+diff -r 1a09f6cd286d scripts/ibswitches.in
+--- a/scripts/ibswitches.in	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/ibswitches.in	Fri Nov 13 08:22:46 2015 -0800
+@@ -49,7 +49,7 @@
+ 
+ text="`eval $netcmd`"
+ rv=$?
+-echo "$text" | awk '
++echo "$text" | gawk '
+ /^Switch/	{
+ 			l=$0
+ 			desc=substr(l, match(l, "#[ \t]*")+RLENGTH)
+diff -r 1a09f6cd286d scripts/set_nodedesc.sh
+--- a/scripts/set_nodedesc.sh	Fri Nov 13 07:21:42 2015 -0800
++++ b/scripts/set_nodedesc.sh	Fri Nov 13 08:22:46 2015 -0800
+@@ -1,5 +1,13 @@
+ #!/bin/sh
+ 
++# Call solaris_set_nodedesc, if operating system is SunOS
++os=`uname -s`
++if [ $os == "SunOS" ]; then
++	solaris_set_nodedesc "$@"
++	rc=$?
++	exit $rc
++fi
++
+ if [ -f /etc/sysconfig/network ]; then
+ . /etc/sysconfig/network
+ fi
+diff -r 1a09f6cd286d src/ibnetdiscover.c
+--- a/src/ibnetdiscover.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/src/ibnetdiscover.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -582,7 +582,7 @@
+ 			}
+ 
+ 			fprintf(f, "\n# Spine Nodes");
+-			for (n = 1; n <= SPINES_MAX_NUM; n++) {
++			for (n = 0; n < SPINES_MAX_NUM; n++) {
+ 				if (ch->spinenode[n]) {
+ 					out_switch(ch->spinenode[n], group,
+ 						   chname, NULL, NULL);
+@@ -599,7 +599,7 @@
+ 				}
+ 			}
+ 			fprintf(f, "\n# Line Nodes");
+-			for (n = 1; n <= LINES_MAX_NUM; n++) {
++			for (n = 0; n < LINES_MAX_NUM; n++) {
+ 				if (ch->linenode[n]) {
+ 					out_switch(ch->linenode[n], group,
+ 						   chname, NULL, NULL);
+diff -r 1a09f6cd286d src/ibportstate.c
+--- a/src/ibportstate.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/src/ibportstate.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -382,6 +382,7 @@
+ 	int portnum = 0;
+ 	ib_portid_t selfportid = { 0 };
+ 	int selfport = 0;
++	int switch_lid = 0;
+ 	int changed = 0;
+ 	int i;
+ 	uint16_t devid, rem_devid;
+@@ -515,6 +516,12 @@
+ 		port_op = QUERY;
+ 
+ 	is_switch = get_node_info(&portid, data);
++	if (!is_switch && (port_op == RESET || port_op == DISABLE ||
++	    port_op == ENABLE)) {
++		mad_rpc_close_port(srcport);
++		exit(-1);
++	}
++
+ 	devid = (uint16_t) mad_get_field(data, 0, IB_NODE_DEVID_F);
+ 
+ 	if ((port_args[MKEY].set || port_args[MKEYLEASE].set ||
+@@ -653,6 +660,12 @@
+ 						 &lsee);
+ 			}
+ 
++			/* Get Switch LID from the default switch port */
++			if (!smp_query_via(data, &portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
++				IBEXIT("could not get port LID");
++
++			switch_lid = mad_get_field(data, 0, IB_PORT_LID_F);
++
+ 			/* Setup portid for peer port */
+ 			memcpy(&peerportid, &portid, sizeof(peerportid));
+ 			peerportid.drpath.cnt = 1;
+@@ -662,6 +675,7 @@
+ 			if (resolve_self(ibd_ca, ibd_ca_port, &selfportid,
+ 						&selfport, 0) < 0)
+ 				IBEXIT("could not resolve self");
++			peerportid.lid = switch_lid;
+ 			peerportid.drpath.drslid = (uint16_t) selfportid.lid;
+ 			peerportid.drpath.drdlid = 0xffff;
+ 
+diff -r 1a09f6cd286d src/ibstat.c
+--- a/src/ibstat.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/src/ibstat.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -54,7 +54,7 @@
+ #include <ibdiag_common.h>
+ 
+ static char *node_type_str[] = {
+-	"???",
++	"Unknown",
+ 	"CA",
+ 	"Switch",
+ 	"Router",
+@@ -67,11 +67,11 @@
+ 		return;
+ 	printf("%s '%s'\n",
+ 	       ((unsigned)ca->node_type <=
+-		IB_NODE_MAX ? node_type_str[ca->node_type] : "???"),
++		IB_NODE_MAX ? node_type_str[ca->node_type] : "Unknown"),
+ 	       ca->ca_name);
+ 	printf("\t%s type: %s\n",
+ 	       ((unsigned)ca->node_type <=
+-		IB_NODE_MAX ? node_type_str[ca->node_type] : "???"),
++		IB_NODE_MAX ? node_type_str[ca->node_type] : "Unknown"),
+ 	       ca->ca_type);
+ 	printf("\tNumber of ports: %d\n", ca->numports);
+ 	printf("\tFirmware version: %s\n", ca->fw_ver);
+@@ -82,7 +82,7 @@
+ }
+ 
+ static char *port_state_str[] = {
+-	"???",
++	"Unknown",
+ 	"Down",
+ 	"Initializing",
+ 	"Armed",
+@@ -176,10 +176,10 @@
+ 	printf("%sPort %d:\n", hdrpre, port->portnum);
+ 	printf("%sState: %s\n", pre,
+ 	       (unsigned)port->state <=
+-	       4 ? port_state_str[port->state] : "???");
++	       4 ? port_state_str[port->state] : "Unknown");
+ 	printf("%sPhysical state: %s\n", pre,
+ 	       (unsigned)port->phys_state <=
+-	       7 ? port_phy_state_str[port->phys_state] : "???");
++	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
+ 	if (is_fdr10(port))
+ 		printf("%sRate: %d (FDR10)\n", pre, port->rate);
+ 	else
+@@ -211,12 +211,12 @@
+ 			IBWARN("%s: '%s' has no port number %d - max (%d)",
+ 			       ((unsigned)ca.node_type <=
+ 				IB_NODE_MAX ? node_type_str[ca.node_type] :
+-				"???"), ca_name, portnum, ca.numports);
++				"Unknown"), ca_name, portnum, ca.numports);
+ 			return -1;
+ 		}
+ 		printf("%s: '%s'\n",
+ 		       ((unsigned)ca.node_type <=
+-			IB_NODE_MAX ? node_type_str[ca.node_type] : "???"),
++			IB_NODE_MAX ? node_type_str[ca.node_type] : "Unknown"),
+ 		       ca.ca_name);
+ 		port_dump(ca.ports[portnum], 1);
+ 		return 0;
+@@ -236,13 +236,13 @@
+ 
+ static int ports_list(char names[][UMAD_CA_NAME_LEN], int n)
+ {
+-	uint64_t guids[64];
++	uint64_t guids[MAX_PORTS];
+ 	int found, ports, i;
+ 
+-	for (i = 0, found = 0; i < n && found < 64; i++) {
++	for (i = 0, found = 0; i < n && found < MAX_PORTS; i++) {
+ 		if ((ports =
+ 		     umad_get_ca_portguids(names[i], guids + found,
+-					   64 - found)) < 0)
++					   MAX_PORTS - found)) < 0)
+ 			return -1;
+ 		found += ports;
+ 	}
+diff -r 1a09f6cd286d src/ibsysstat.c
+--- a/src/ibsysstat.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/src/ibsysstat.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -40,6 +40,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <getopt.h>
++#include <signal.h>
+ 
+ #include <infiniband/umad.h>
+ #include <infiniband/mad.h>
+@@ -143,7 +144,8 @@
+ 		break;
+ 	case IB_CPUINFO_ATTR:
+ 		s[0] = '\0';
+-		for (i = 0; i < host_ncpu && sz > 0; i++) {
++		for (i = 0; i < host_ncpu && sz > 0 && ret < 
++		    IB_VENDOR_RANGE2_DATA_SIZE; i++) {
+ 			n = snprintf(s, sz, "cpu %d: model %s MHZ %s\n",
+ 				     i, cpus[i].model, cpus[i].mhz);
+ 			if (n >= sz) {
+@@ -155,6 +157,8 @@
+ 			s += n;
+ 			ret += n;
+ 		}
++		if (i < host_ncpu)
++			IBWARN("cpuinfo truncated");
+ 		ret++;
+ 		break;
+ 	default:
+@@ -163,6 +167,20 @@
+ 	return ret;
+ }
+ 
++void cleanup(int sig)
++{
++	int	i;
++	for (i = 0; i < host_ncpu ; i++) {
++		if (cpus[i].model)
++			free(cpus[i].model);
++		if (cpus[i].mhz)
++			free(cpus[i].mhz);
++	}
++	mad_rpc_close_port(srcport);
++	(void) signal(SIGINT, SIG_DFL);
++	exit (0);
++}
++
+ static uint8_t buf[2048];
+ 
+ static char *ibsystat_serv(void)
+@@ -172,6 +190,7 @@
+ 	int attr, mod, size;
+ 
+ 	DEBUG("starting to serve...");
++	(void) signal(SIGINT, cleanup);
+ 
+ 	while ((umad = mad_receive_via(buf, -1, srcport))) {
+ 		if (umad_status(buf)) {
+@@ -262,7 +281,25 @@
+ 	char line[1024] = { 0 }, *s, *e;
+ 	FILE *f;
+ 	int ncpu = 0;
++#if defined(__SVR4) && defined(__sun)
++	int		i;
++	char		mhz[8];
++	sol_cpu_info_t	*cpu_info;
+ 
++	ncpu = sol_get_cpu_info(&cpu_info);
++	ncpu = ncpu < MAX_CPUS ? ncpu : MAX_CPUS;
++	if (ncpu <= 0) {
++		IBWARN("couldn't get cpu info");
++		return 0;
++	}
++
++	for (i = 0; i < ncpu; i++) {
++		cpus[i].model = strdup(cpu_info[i].cpu_name);
++		snprintf(mhz, 8, "%d", cpu_info[i].cpu_mhz);
++		cpus[i].mhz = strdup(mhz);
++	}
++	free(cpu_info);
++#else
+ 	if (!(f = fopen("/proc/cpuinfo", "r"))) {
+ 		IBWARN("couldn't open /proc/cpuinfo");
+ 		return 0;
+@@ -290,6 +327,7 @@
+ 	}
+ 
+ 	fclose(f);
++#endif
+ 
+ 	DEBUG("ncpu %d", ncpu);
+ 
+@@ -315,7 +353,7 @@
+ {
+ 	int mgmt_classes[3] =
+ 	    { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
+-	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
++	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS, i;
+ 	ib_portid_t portid = { 0 };
+ 	int attr = IB_PING_ATTR;
+ 	char *err;
+@@ -343,6 +381,8 @@
+ 	if (!srcport)
+ 		IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
+ 
++	bzero((void *)cpus, MAX_CPUS * sizeof (cpu_info));
++
+ 	if (server) {
+ 		if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) <
+ 		    0)
+@@ -367,5 +407,6 @@
+ 		IBEXIT("ibsystat to %s: %s", portid2str(&portid), err);
+ 
+ 	mad_rpc_close_port(srcport);
++
+ 	exit(0);
+ }
+diff -r 1a09f6cd286d src/saquery.c
+--- a/src/saquery.c	Fri Nov 13 07:21:42 2015 -0800
++++ b/src/saquery.c	Fri Nov 13 08:22:46 2015 -0800
+@@ -99,7 +99,6 @@
+ /**
+  * Declare some globals because I don't want this to be too complex.
+  */
+-#define MAX_PORTS (8)
+ #define DEFAULT_SA_TIMEOUT_MS (1000)
+ 
+ enum {
+@@ -1825,7 +1824,7 @@
+ 			requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
+ 			requested_lid_flag++;
+ 		} else if (node_print_desc == NAME_OF_GUID) {
+-			requested_guid = strtoul(argv[0], NULL, 0);
++			requested_guid = strtoull(argv[0], NULL, 0);
+ 			requested_guid_flag++;
+ 		} else
+ 			requested_name = argv[0];
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags/patches/002-infiniband-diags-coredump_due_to_timeout.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,39 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  5e57ae27f93879abc0e8c269ff7166fcf8d896e0
+22271413 ibnetdiscover has segmentation fault when link state is at 2
+
+modified:
+   libibnetdisc/src/ibnetdisc.c
+   src/ibnetdiscover.c
+
+diff -r 5e57ae27f938 libibnetdisc/src/ibnetdisc.c
+--- a/libibnetdisc/src/ibnetdisc.c	Mon Nov 30 08:20:29 2015 -0800
++++ b/libibnetdisc/src/ibnetdisc.c	Thu Dec 03 05:31:40 2015 -0800
+@@ -744,6 +744,7 @@
+ 	if (!scan.ibmad_port) {
+ 		IBND_ERROR("can't open MAD port (%s:%d)\n", ca_name, ca_port);
+ 		smp_engine_destroy(&engine);
++		free(f_int);
+ 		return (NULL);
+ 	}
+ 	mad_rpc_set_timeout(scan.ibmad_port, cfg->timeout_ms);
+diff -r 5e57ae27f938 src/ibnetdiscover.c
+--- a/src/ibnetdiscover.c	Mon Nov 30 08:20:29 2015 -0800
++++ b/src/ibnetdiscover.c	Thu Dec 03 05:31:40 2015 -0800
+@@ -552,6 +552,13 @@
+ 		fprintf(f, "# Reported max hops discovered: %u\n"
+ 			"# Total MADs used: %u\n",
+ 			fabric->maxhops_discovered, fabric->total_mads_used);
++
++	/*
++	 * If from_node data is not available then return.
++	 */
++	if (!fabric->from_node)
++		return i;
++
+ 	fprintf(f, "# Initiated from node %016" PRIx64 " port %016" PRIx64 "\n",
+ 		fabric->from_node->guid,
+ 		mad_get_field64(fabric->from_node->info, 0,
--- a/components/open-fabrics/infiniband-diags/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1162 +0,0 @@
-# This patch was developed both in-house and from outside. We plan to submit it
-# upstream, but do not yet have a target date for doing so
-#
-diff -r -u /tmp/infiniband-diags-1.5.8/Makefile.am infiniband-diags-1.5.8/Makefile.am
---- /tmp/infiniband-diags-1.5.8/Makefile.am	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/Makefile.am	Fri Feb 25 03:09:22 2011
-@@ -13,7 +13,7 @@
- sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \
- 	        src/ibroute src/ibstat src/ibsysstat src/ibtracert \
- 	        src/perfquery src/sminfo src/smpdump src/smpquery \
--	        src/saquery src/vendstat src/iblinkinfo \
-+	        src/saquery src/vendstat src/solaris_set_nodedesc src/iblinkinfo \
- 		src/ibqueryerrors src/ibcacheedit
- 
- if ENABLE_TEST_UTILS
-@@ -44,7 +44,7 @@
- libcommon_a_SOURCES = src/ibdiag_common.c
- src_ibaddr_SOURCES = src/ibaddr.c
- src_ibnetdiscover_SOURCES = src/ibnetdiscover.c
--src_ibnetdiscover_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc
-+src_ibnetdiscover_LDFLAGS =
- src_ibping_SOURCES = src/ibping.c
- src_ibportstate_SOURCES = src/ibportstate.c
- src_ibroute_SOURCES = src/ibroute.c
-@@ -66,6 +66,9 @@
- src_ibcacheedit_SOURCES = src/ibcacheedit.c
- src_ibcacheedit_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc
- 
-+src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c
-+src_solaris_set_nodedesc_CFLAGS = -Wall $(DBGFLAGS)
-+
- man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \
- 	man/ibchecknet.8 man/ibchecknode.8 man/ibcheckport.8 \
- 	man/ibcheckportstate.8 man/ibcheckportwidth.8 man/ibcheckstate.8 \
-diff -r -u /tmp/infiniband-diags-1.5.8/Makefile.in infiniband-diags-1.5.8/Makefile.in
---- /tmp/infiniband-diags-1.5.8/Makefile.in	Wed Feb 16 02:28:20 2011
-+++ infiniband-diags-1.5.8/Makefile.in	Fri Feb 25 03:21:49 2011
-@@ -44,7 +44,8 @@
- 	src/smpdump$(EXEEXT) src/smpquery$(EXEEXT) \
- 	src/saquery$(EXEEXT) src/vendstat$(EXEEXT) \
- 	src/iblinkinfo$(EXEEXT) src/ibqueryerrors$(EXEEXT) \
--	src/ibcacheedit$(EXEEXT) $(am__EXEEXT_1)
-+	src/ibcacheedit$(EXEEXT) $(am__EXEEXT_1) \
-+	src/solaris_set_nodedesc$(EXEEXT)
- @ENABLE_TEST_UTILS_TRUE@am__append_1 = src/ibsendtrap src/mcm_rereg_test
- subdir = .
- DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-@@ -190,6 +191,11 @@
- src_vendstat_OBJECTS = $(am_src_vendstat_OBJECTS)
- src_vendstat_LDADD = $(LDADD)
- src_vendstat_DEPENDENCIES = libcommon.a
-+am_src_solaris_set_nodedesc_OBJECTS = src_solaris_set_nodedesc-solaris_set_nodedesc.$(OBJEXT) \
-+	src_solaris_set_nodedesc-ibdiag_common.$(OBJEXT)
-+src_solaris_set_nodedesc_OBJECTS = $(am_src_solaris_set_nodedesc_OBJECTS)
-+src_solaris_set_nodedesc_LDADD = $(LDADD)
-+sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) -m 755
- am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
- am__vpath_adj = case $$p in \
-     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-@@ -234,7 +240,8 @@
- 	$(src_ibtracert_SOURCES) $(src_mcm_rereg_test_SOURCES) \
- 	$(src_perfquery_SOURCES) $(src_saquery_SOURCES) \
- 	$(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \
--	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES)
-+	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES) \
-+	$(src_solaris_set_nodedesc_SOURCES)
- DIST_SOURCES = $(libcommon_a_SOURCES) $(src_ibaddr_SOURCES) \
- 	$(src_ibcacheedit_SOURCES) $(src_iblinkinfo_SOURCES) \
- 	$(src_ibnetdiscover_SOURCES) $(src_ibping_SOURCES) \
-@@ -244,7 +251,8 @@
- 	$(src_ibtracert_SOURCES) $(src_mcm_rereg_test_SOURCES) \
- 	$(src_perfquery_SOURCES) $(src_saquery_SOURCES) \
- 	$(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \
--	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES)
-+	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES) \
-+	$(src_solaris_set_nodedesc_SOURCES)
- RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- 	html-recursive info-recursive install-data-recursive \
- 	install-dvi-recursive install-exec-recursive \
-@@ -252,7 +260,11 @@
- 	install-pdf-recursive install-ps-recursive install-recursive \
- 	installcheck-recursive installdirs-recursive pdf-recursive \
- 	ps-recursive uninstall-recursive
--man8dir = $(mandir)/man8
-+src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c src/ibdiag_common.c
-+src_solaris_set_nodedesc_CFLAGS = -Wall $(DBGFLAGS)
-+src_solaris_set_nodedesc_LDFLAGS =
-+
-+man8dir = $(mandir)/man8
- NROFF = nroff
- MANS = $(man_MANS)
- RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-@@ -610,8 +622,8 @@
- 	while read type dir files; do \
- 	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- 	    test -z "$$files" || { \
--	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
--	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
-+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(sbindir)$$dir'"; \
-+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
- 	    } \
- 	; done
- 
-@@ -633,6 +645,13 @@
- 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- 	echo " rm -f" $$list; \
- 	rm -f $$list
-+
-+clean-sbinSCRIPTS:
-+	@list=`ls scripts/*.in`; for p in $$list; do \
-+	  f=`echo $$p | sed 's/\.in//'`; \
-+	  echo " rm -f $$f"; \
-+	  rm -f $$f ; \
-+	done
- src/$(am__dirstamp):
- 	@$(MKDIR_P) src
- 	@: > src/$(am__dirstamp)
-@@ -693,6 +712,10 @@
- src/vendstat$(EXEEXT): $(src_vendstat_OBJECTS) $(src_vendstat_DEPENDENCIES) src/$(am__dirstamp)
- 	@rm -f src/vendstat$(EXEEXT)
- 	$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
-+	$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
-+src/solaris_set_nodedesc$(EXEEXT): $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_DEPENDENCIES) src/$(am__dirstamp)
-+	@rm -f src/solaris_set_nodedesc$(EXEEXT)
-+	$(LINK) $(src_solaris_set_nodedesc_LDFLAGS) $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_LDADD) $(LIBS)
- install-sbinSCRIPTS: $(sbin_SCRIPTS)
- 	@$(NORMAL_INSTALL)
- 	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
-@@ -754,6 +777,8 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpdump.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpquery.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vendstat.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po@am__quote@
- 
- .c.o:
- @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@@ -1056,6 +1081,34 @@
- @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vendstat.obj `if test -f 'src/vendstat.c'; then $(CYGPATH_W) 'src/vendstat.c'; else $(CYGPATH_W) '$(srcdir)/src/vendstat.c'; fi`
- 
-+src_solaris_set_nodedesc-solaris_set_nodedesc.o: src/solaris_set_nodedesc.c
-+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-solaris_set_nodedesc.o -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c; \
-+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo"; exit 1; fi
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_set_nodedesc.c' object='src_solaris_set_nodedesc-solaris_set_nodedesc.o' libtool=no @AMDEPBACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
-+
-+src_solaris_set_nodedesc-solaris_set_nodedesc.obj: src/solaris_set_nodedesc.c
-+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-solaris_set_nodedesc.obj -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`; \
-+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo"; exit 1; fi
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_set_nodedesc.c' object='src_solaris_set_nodedesc-solaris_set_nodedesc.obj' libtool=no @AMDEPBACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
-+
-+src_solaris_set_nodedesc-ibdiag_common.o: src/ibdiag_common.c
-+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-ibdiag_common.o -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" -c -o src_solaris_set_nodedesc-ibdiag_common.o `test -f 'src/ibdiag_common.c' || echo '$(srcdir)/'`src/ibdiag_common.c; \
-+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo"; exit 1; fi
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/ibdiag_common.c' object='src_solaris_set_nodedesc-ibdiag_common.o' libtool=no @AMDEPBACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-ibdiag_common.o `test -f 'src/ibdiag_common.c' || echo '$(srcdir)/'`src/ibdiag_common.c
-+
-+src_solaris_set_nodedesc-ibdiag_common.obj: src/ibdiag_common.c
-+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-ibdiag_common.obj -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" -c -o src_solaris_set_nodedesc-ibdiag_common.obj `if test -f 'src/ibdiag_common.c'; then $(CYGPATH_W) 'src/ibdiag_common.c'; else $(CYGPATH_W) '$(srcdir)/src/ibdiag_common.c'; fi`; \
-+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo"; exit 1; fi
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/ibdiag_common.c' object='src_solaris_set_nodedesc-ibdiag_common.obj' libtool=no @AMDEPBACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-ibdiag_common.obj `if test -f 'src/ibdiag_common.c'; then $(CYGPATH_W) 'src/ibdiag_common.c'; else $(CYGPATH_W) '$(srcdir)/src/ibdiag_common.c'; fi`
-+
- mostlyclean-libtool:
- 	-rm -f *.lo
- 
-@@ -1080,6 +1133,10 @@
- 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
- 	sed 'N;N;s,\n, ,g' | { \
- 	list=; while read file base inst; do \
-+	  ext='8'; \
-+	  inst=`echo $$inst | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
- 	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
- 	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
- 	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
-@@ -1100,6 +1157,10 @@
- 	  sed -n '/\.8[a-z]*$$/p'; \
- 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
- 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-+	ext='8'; \
-+	files=`echo $$files | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	files=`echo $$files | sed -e 's/^.*\///'`; \
-+	files=`echo $$files | sed '$(transform)'`.$$ext; \ 
- 	test -z "$$files" || { \
- 	  echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
- 	  cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
-@@ -1470,7 +1531,7 @@
- clean: clean-recursive
- 
- clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
--	clean-sbinPROGRAMS mostlyclean-am
-+	clean-sbinPROGRAMS clean-sbinSCRIPTS mostlyclean-am
- 
- distclean: distclean-recursive
- 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-@@ -1551,7 +1612,8 @@
- 
- .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- 	all all-am am--refresh check check-am clean clean-generic \
--	clean-libtool clean-noinstLIBRARIES clean-sbinPROGRAMS ctags \
-+	clean-libtool clean-noinstLIBRARIES clean-sbinPROGRAMS \
-+	clean-sbinSCRIPTS ctags \
- 	ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
- 	dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
- 	distclean distclean-compile distclean-generic distclean-hdr \
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckportstate.in infiniband-diags-1.5.8/scripts/ibcheckportstate.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckportstate.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckportstate.in	Thu Feb 24 11:26:53 2011
-@@ -73,7 +73,7 @@
- portnum=$2
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -81,7 +81,7 @@
- 	guid=$1
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -91,7 +91,7 @@
- 
- text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
- rv=$?
--if echo "$text" | awk -v mono=$bw -F '[.:]*' '
-+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
- function blue(s)
- {
- 	if (mono)
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibhosts.in infiniband-diags-1.5.8/scripts/ibhosts.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibhosts.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibhosts.in	Thu Feb 24 11:26:56 2011
-@@ -49,7 +49,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- /^Ca/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
- 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
- /^ib/	{print $0; next}
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/set_nodedesc.sh infiniband-diags-1.5.8/scripts/set_nodedesc.sh
---- /tmp/infiniband-diags-1.5.8/scripts/set_nodedesc.sh	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/set_nodedesc.sh	Fri Feb 25 03:09:27 2011
-@@ -1,5 +1,13 @@
- #!/bin/bash
- 
-+# Call solaris_set_nodedesc, if operating system is SunOS
-+os=`uname -s`
-+if [ $os == "SunOS" ]; then
-+	solaris_set_nodedesc "$@"
-+	rc=$?
-+	exit $rc
-+fi
-+
- if [ -f /etc/sysconfig/network ]; then
- . /etc/sysconfig/network
- fi
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibchecknode.in infiniband-diags-1.5.8/scripts/ibchecknode.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibchecknode.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibchecknode.in	Thu Feb 24 11:26:52 2011
-@@ -71,7 +71,7 @@
- fi
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -78,7 +78,7 @@
- 	fi
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckstate.in infiniband-diags-1.5.8/scripts/ibcheckstate.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckstate.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckstate.in	Thu Feb 24 11:26:53 2011
-@@ -69,7 +69,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- BEGIN {
- 	ne=0
- 	pe=0
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibswitches.in infiniband-diags-1.5.8/scripts/ibswitches.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibswitches.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibswitches.in	Thu Feb 24 11:26:58 2011
-@@ -49,7 +49,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- /^Switch/	{
- 			l=$0
- 			desc=substr(l, match(l, "#[ \t]*")+RLENGTH)
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibclearcounters.in infiniband-diags-1.5.8/scripts/ibclearcounters.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibclearcounters.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibclearcounters.in	Thu Feb 24 11:26:54 2011
-@@ -59,7 +59,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- 
- function clear_counters(lid)
- {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrors.in infiniband-diags-1.5.8/scripts/ibcheckerrors.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrors.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckerrors.in	Thu Feb 24 11:26:52 2011
-@@ -74,7 +74,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- BEGIN {
- 	ne=0
- }
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintswitch.pl infiniband-diags-1.5.8/scripts/ibprintswitch.pl
---- /tmp/infiniband-diags-1.5.8/scripts/ibprintswitch.pl	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibprintswitch.pl	Thu Feb 24 11:26:57 2011
-@@ -84,7 +84,7 @@
- 
- if ($list_switches) {
- 	system("ibswitches $cache_file");
--	exit 1;
-+	exit $?;
- }
- 
- if ($target_switch eq "") {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintrt.pl infiniband-diags-1.5.8/scripts/ibprintrt.pl
---- /tmp/infiniband-diags-1.5.8/scripts/ibprintrt.pl	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibprintrt.pl	Thu Feb 24 11:26:57 2011
-@@ -84,7 +84,7 @@
- 
- if ($list_rts) {
- 	system("ibrouters $cache_file");
--	exit 1;
-+	exit $?;
- }
- 
- if ($target_rt eq "") {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibclearerrors.in infiniband-diags-1.5.8/scripts/ibclearerrors.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibclearerrors.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibclearerrors.in	Thu Feb 24 11:26:54 2011
-@@ -63,7 +63,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- 
- function clear_all_errors(lid, port)
- {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdatacounters.in infiniband-diags-1.5.8/scripts/ibdatacounters.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibdatacounters.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibdatacounters.in	Thu Feb 24 11:26:54 2011
-@@ -74,7 +74,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- BEGIN {
- 	ne=0
- }
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrs.in infiniband-diags-1.5.8/scripts/ibcheckerrs.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrs.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckerrs.in	Fri Feb 25 03:09:27 2011
-@@ -136,7 +136,7 @@
- fi
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -144,7 +144,7 @@
- 	guid=$1
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -163,7 +163,7 @@
- 	exit 0
- fi
- 
--if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
-+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
- function blue(s)
- {
- 	if (brief == "yes") {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibrouters.in infiniband-diags-1.5.8/scripts/ibrouters.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibrouters.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibrouters.in	Thu Feb 24 11:26:57 2011
-@@ -49,7 +49,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- /^Rt/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
- 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
- /^ib/	{print $0; next}
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibstatus infiniband-diags-1.5.8/scripts/ibstatus
---- /tmp/infiniband-diags-1.5.8/scripts/ibstatus	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibstatus	Fri Feb 25 03:09:27 2011
-@@ -2,8 +2,9 @@
- 
- # Usage ibstatus [devname[:port]]
- 
--infiniband_base="/sys/class/infiniband"
--def_ibdev="mthca0"
-+ibvdevinfo="/usr/bin/ibv_devinfo"
-+ibvdevinfo_results="/tmp/ibvdevinfo.output.$$"
-+tmpout="/tmp/tmpout.$$"
- 
- usage() {
- 	prog=`basename $0`
-@@ -10,58 +11,128 @@
- 	echo "Usage: " $prog " [-h] [devname[:portnum]]"
- 	echo "	-h:	this help screen"
- 	echo "	Examples:"
--	echo "		$prog mthca1		# shows status of all ports of 'mthca1'"
--	echo "		$prog mthca0:2	# shows status port number 2 of 'mthca0'"
--	echo "		$prog		# default: shows status of all '$def_ibdev' ports"
--	exit -1
-+	echo "		$prog mlx4_1		# shows status of all ports of 'mlx4_1'"
-+	echo "		$prog mlx4_0:2	# shows status port number 2 of 'mlx4_0'"
-+	echo "		$prog		# default: shows status of all IB ports"
-+	exit 0
- }
- 
--fatal() {
--	echo "Fatal error: " $*
--	exit -1
-+get_status_ports() {
-+	nawk '
-+	BEGIN {
-+		hcaid_in="'"$1"'"
-+		port_in="'"$2"'"
-+		if (hcaid_in == "+") {
-+			hcaid_hit=1
-+			if (port_in == "+")
-+				port_hit=1
-+		}
-+	}
-+	{
-+		if ($0 ~ "hca_id") {
-+			if (hcaid_in == "+") {
-+				cur_hcaid = $2
-+			} else if (hcaid_in == $2) {
-+				hcaid_hit=1
-+				if (port_in == "+")
-+					port_hit=1
-+			} else if (hcaid_hit == 1)
-+				exit 0
-+		}
-+		if (hcaid_hit == 1) {
-+			if ($0 ~ "port:") {
-+				if (port_in == "+") {
-+					cur_port=$2;
-+				} else if (port_in == $2) {
-+					port_hit=1
-+				} else if (port_hit == 1)
-+					exit 0
-+			}
-+		}
-+		if (hcaid_hit == 1 && port_hit == 1) {
-+			if ($0 ~ "state:" && $0 !~ "phys_state:") {
-+				state=$2;
-+				staten=$3
-+			} else if ($0 ~ "sm_lid:") {
-+				sm_lid=$2
-+			} else if ($0 ~ "port_lid:") {
-+				port_lid=$2
-+			} else if ($0 ~ "active_width:") {
-+				width = $2
-+				sub("X$", "", width)
-+			} else if ($0 ~ "active_speed:") {
-+				speed=$2
-+			} else if ($0 ~ "phys_state:") {
-+				pstate=$2
-+				pstaten=$3
-+			} else if ($0 ~ "link_layer:") {
-+				link=$2
-+			} else if ($0 ~ "GID"){
-+				gid=$NF
-+				if (hcaid_in == "+") {
-+					printf("Infiniband device '\''%s'\'' port %d status:\n", cur_hcaid, cur_port);
-+				} else if (port_in == "+") {
-+					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, cur_port);
-+				} else {
-+					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, port_in);
-+				}
-+				printf("\tdefault gid:\t%s\n", gid)
-+				printf("\tstate:\t\t%d: %s\n", staten, state); 
-+				printf("\tphys state:\t%d: %s\n", pstaten, pstate);
-+				printf("\tsm lid:\t\t0x%x\n", sm_lid)
-+				printf("\tbase lid:\t0x%x\n", port_lid)
-+				printf("\trate:\t\t%d Gb/sec (%dX)\n", width * speed, width)
-+				printf("\tlink_layer:\t%s\n\n", link); 
-+			}
-+		}
-+	}
-+	END {
-+		if (hcaid_in != "+" && port_in == "+" && hcaid_hit == 0) {
-+ 			printf("Fatal error: device '\''%s'\'' not found\n\n", hcaid_in)
-+			exit 1;
-+		}
-+		if (hacid_in != "+" && port_in != "+" && port_hit == 0) {
-+ 			printf("Fatal error: port '\''%s:%d'\'' not found\n\n", hcaid_in, port_in)
-+			exit 1;
-+		}
-+	}' $tmpout
- }
- 
-+if [ "$1" = "-h" ]; then
-+	usage
-+fi
- 
--port_status() {
--	port_dir="$infiniband_base/$1/ports/$2"
--	echo "Infiniband device '$1' port $2 status:"
--	echo "	default gid:	" `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
--	echo "	base lid:	" `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
--	echo "	sm lid:		" `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
--	echo "	state:		" `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
--	echo "	phys state:	" `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
--	echo "	rate:		" `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
--	echo "	link_layer:	" `[ -r $port_dir/link_layer ] && cat $port_dir/link_layer || echo IB`
--	echo
--}
-+# Check to see if /usr/bin/ibv_devinfo exists.
-+if [ ! -x $ibvdevinfo ]; then
-+	echo "$ibvdevinfo doesn't exist!"
-+	exit 1
-+fi
- 
--ib_status() {
--	ports_dir="$infiniband_base/$1/ports"
-+# Run ibv_devinfo and direct the output to $ibvdevinfo_results.
-+$ibvdevinfo -v > $ibvdevinfo_results
-+if [ $? != 0 ]; then
-+	echo "$ibvdevinfo failed!"
-+	exit 1
-+fi
-+#
- 
--	if ! [ -d "$ports_dir" ]; then
--		fatal "device '$1': sys files not found ($ports_dir)"
--	fi
--
--	if [ "$2" = "+" ]; then
--		ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
--	else
--		ports=$2
--	fi
--
--	for i in $ports; do
--		port_status $1 $i
--	done
--}
--
--if [ "$1" = "-h" ]; then
--	usage
-+nhcas=`$ibvdevinfo -l | awk '/HCA/{print $1}'`
-+if [ -z $nhcas ]; then
-+        echo "No HCAs!"
-+	rm -f $ibvdevinfo_results
-+	exit 1
- fi
- 
-+egrep "port:|hca_id:|_lid|GID|state:|active_|link_layer:" $ibvdevinfo_results |grep -v _mtu | sed -e 's/(//' -e 's/)//' > $tmpout
-+rm -f $ibvdevinfo_results
-+
- if [ -z "$1" ]; then
--	cd $infiniband_base 2>/dev/null || fatal No devices
--	for dev in *; do
--		ib_status $dev "+";
--	done
-+	get_status_ports "+" "+"
-+	if [ $? != 0 ]; then
-+		rm -f $tmpout
-+		exit 1
-+	fi
-+	rm -f $tmpout
- 	exit 0
- fi
- 
-@@ -73,6 +144,12 @@
- 		port="+"
- 	fi
- 
--	ib_status $dev $port
-+	get_status_ports $dev $port
-+	if [ $? != 0 ]; then
-+		rm -f $tmpout
-+		exit 1
-+	fi
-+
- 	shift
- done
-+rm -f $tmpout
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckwidth.in infiniband-diags-1.5.8/scripts/ibcheckwidth.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckwidth.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckwidth.in	Thu Feb 24 11:26:54 2011
-@@ -69,7 +69,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- BEGIN {
- 	ne=0
- 	pe=0
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckportwidth.in infiniband-diags-1.5.8/scripts/ibcheckportwidth.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckportwidth.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckportwidth.in	Thu Feb 24 11:26:53 2011
-@@ -73,7 +73,7 @@
- portnum=$2
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -81,7 +81,7 @@
- 	guid=$1
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -91,7 +91,7 @@
- 
- text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
- rv=$?
--if echo "$text" | awk -v mono=$bw -F '[.:]*' '
-+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
- function blue(s)
- {
- 	if (mono)
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdatacounts.in infiniband-diags-1.5.8/scripts/ibdatacounts.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibdatacounts.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibdatacounts.in	Thu Feb 24 11:26:55 2011
-@@ -91,7 +91,7 @@
- fi
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -99,7 +99,7 @@
- 	guid=$1
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -110,7 +110,7 @@
- 
- text="`eval $IBPATH/perfquery $ca_info $lid $portnum`"
- rv=$?
--if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
-+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
- function blue(s)
- {
- 	if (brief == "yes") {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintca.pl infiniband-diags-1.5.8/scripts/ibprintca.pl
---- /tmp/infiniband-diags-1.5.8/scripts/ibprintca.pl	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibprintca.pl	Thu Feb 24 11:26:57 2011
-@@ -84,7 +84,7 @@
- 
- if ($list_hcas) {
- 	system("ibhosts $cache_file");
--	exit 1;
-+	exit $?;
- }
- 
- if ($target_hca eq "") {
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/IBswcountlimits.pm infiniband-diags-1.5.8/scripts/IBswcountlimits.pm
---- /tmp/infiniband-diags-1.5.8/scripts/IBswcountlimits.pm	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/IBswcountlimits.pm	Thu Jun 30 13:22:36 2011
-@@ -261,7 +261,8 @@
- 	my $cache_file   = get_cache_file($ca_name, $ca_port);
- 	my $extra_params = get_ca_name_port_param_string($ca_name, $ca_port);
- 
--	if (`ibnetdiscover -g $extra_params > $cache_file`) {
-+	my $rc = `ibnetdiscover -g $extra_params > $cache_file`;
-+	if ("$?" ne "0") {
- 		die "Execution of ibnetdiscover failed: $!\n";
- 	}
- }
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckport.in infiniband-diags-1.5.8/scripts/ibcheckport.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibcheckport.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibcheckport.in	Thu Feb 24 11:26:53 2011
-@@ -73,7 +73,7 @@
- portnum=$2
- 
- if [ "$guid_addr" ]; then
--	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
-+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
- 		echo -n "guid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -81,7 +81,7 @@
- 	guid=$1
- else
- 	lid=$1
--	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
-+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
- 		echo -n "lid $1 address resolution: "
- 		red "FAILED"
- 		exit -1
-@@ -91,7 +91,7 @@
- 
- text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
- rv=$?
--if echo "$text" | awk -v mono=$bw -F '[.:]*' '
-+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
- function blue(s)
- {
- 	if (mono)
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdiscover.pl infiniband-diags-1.5.8/scripts/ibdiscover.pl
---- /tmp/infiniband-diags-1.5.8/scripts/ibdiscover.pl	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibdiscover.pl	Thu Feb 24 11:26:55 2011
-@@ -49,9 +49,10 @@
- 		$localGuid = $local;
- 	} else {
- 		($localPort, $type, $remoteGuid, $remotePort) =
--		  /([\s\S]*)"([SH])\-000([a-f\d]*)"([\s\S]*)\n/;
-+		  /([\s\S]*)"([SH])\-([a-f\d]*)"([\s\S]*)\n/;
- 		($localPort)  = $localPort  =~ /\[(\d*)]/;
- 		($remotePort) = $remotePort =~ /\[(\d*)]/;
-+		$remoteGuid =~ s/^0*//;
- 		if ($remoteGuid ne "" && $localPort ne "") {
- 			printf(TOPO2 "%d|%s|%d|%s\n",
- 				$localPort, $localGuid, $remotePort, $remoteGuid);
-diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibchecknet.in infiniband-diags-1.5.8/scripts/ibchecknet.in
---- /tmp/infiniband-diags-1.5.8/scripts/ibchecknet.in	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/scripts/ibchecknet.in	Thu Feb 24 11:26:52 2011
-@@ -67,7 +67,7 @@
- 
- text="`eval $netcmd`"
- rv=$?
--echo "$text" | awk '
-+echo "$text" | gawk '
- BEGIN {
- 	ne=0
- 	pe=0
-diff -r -u /tmp/infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c
---- /tmp/infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c	Thu May  5 15:26:22 2011
-@@ -160,7 +160,7 @@
- 	uint8_t *mad;
- 	uint32_t trid;
- 	uint8_t umad[sizeof(struct ib_user_mad) + IB_MAD_SIZE];
--	int length = umad_size() + IB_MAD_SIZE;
-+	int length = IB_MAD_SIZE;
- 
- 	memset(umad, 0, sizeof(umad));
- 
-diff -r -u /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h infiniband-diags-1.5.8/libibnetdisc/src/internal.h
---- /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Tue Sep 17 13:12:20 2013
-@@ -41,12 +41,56 @@
- #include <infiniband/ibnetdisc.h>
- #include <complib/cl_qmap.h>
- 
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/varargs.h>
-+
-+static inline void
-+ibnd_msg_internal(FILE *fd, const char *format, va_list alist)
-+{
-+	const char	*filename;
-+	char		*filename_p;
-+	char		*format_p = format;
-+
-+	/*
-+	 * The filename returned by va_arg() has the full path. Skip "%s"
-+	 * from format="%s:%u; " and truncate full pathname of src file to
-+	 * start with infiniband-diags.
-+	 */
-+	filename = va_arg(alist, const char *);
-+	format_p += 2;
-+	if ((filename_p = strstr(filename, "infiniband-diags-")) != NULL) {
-+		(void) fprintf(fd, "%s", filename_p);
-+		(void) vfprintf(fd, format_p, alist);
-+	} else {
-+		(void) fprintf(fd, "%s", filename);
-+		(void) vfprintf(fd, format_p, alist);
-+	}
-+}
-+
-+static inline void
-+ibnd_msg(FILE *fd, const char *format, ...)
-+{
-+	va_list alist;
-+
-+	va_start(alist, format);
-+	ibnd_msg_internal(fd, format, alist);
-+	va_end(alist);
-+}
-+
- #define	IBND_DEBUG(fmt, ...) \
- 	if (ibdebug) { \
-+		ibnd_msg(stdout, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
-+	}
-+#define	IBND_ERROR(fmt, ...) \
-+		ibnd_msg(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
-+#else
-+#define	IBND_DEBUG(fmt, ...) \
-+	if (ibdebug) { \
- 		printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
- 	}
- #define	IBND_ERROR(fmt, ...) \
- 		fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
-+#endif
- 
- /* HASH table defines */
- #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
-diff -r -u /tmp/infiniband-diags-1.5.8/configure infiniband-diags-1.5.8/configure
---- /tmp/infiniband-diags-1.5.8/configure	Wed Feb 16 02:28:21 2011
-+++ infiniband-diags-1.5.8/configure	Fri Feb 25 03:09:23 2011
-@@ -8689,6 +8689,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-diff -r -u /tmp/infiniband-diags-1.5.8/src/ibsysstat.c infiniband-diags-1.5.8/src/ibsysstat.c
---- /tmp/infiniband-diags-1.5.8/src/ibsysstat.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/ibsysstat.c	Wed Oct  5 09:27:26 2011
-@@ -40,6 +40,7 @@
- #include <unistd.h>
- #include <string.h>
- #include <getopt.h>
-+#include <signal.h>
- 
- #include <infiniband/umad.h>
- #include <infiniband/mad.h>
-@@ -62,7 +63,7 @@
- } cpu_info;
- 
- static cpu_info cpus[MAX_CPUS];
--static int host_ncpu;
-+static int host_ncpu = 0;
- 
- static int server_respond(void *umad, int size)
- {
-@@ -142,7 +143,8 @@
- 		break;
- 	case IB_CPUINFO_ATTR:
- 		s[0] = '\0';
--		for (i = 0; i < host_ncpu && sz > 0; i++) {
-+		for (i = 0; i < host_ncpu && sz > 0 && ret < 
-+		    IB_VENDOR_RANGE2_DATA_SIZE; i++) {
- 			n = snprintf(s, sz, "cpu %d: model %s MHZ %s\n",
- 				     i, cpus[i].model, cpus[i].mhz);
- 			if (n >= sz) {
-@@ -154,6 +156,8 @@
- 			s += n;
- 			ret += n;
- 		}
-+		if (i < host_ncpu)
-+			IBWARN("cpuinfo truncated");
- 		ret++;
- 		break;
- 	default:
-@@ -162,6 +166,20 @@
- 	return ret;
- }
- 
-+void cleanup(int sig)
-+{
-+	int	i;
-+	for (i = 0; i < host_ncpu ; i++) {
-+		if (cpus[i].model)
-+			free(cpus[i].model);
-+		if (cpus[i].mhz)
-+			free(cpus[i].mhz);
-+	}
-+	mad_rpc_close_port(srcport);
-+	(void) signal(SIGINT, SIG_DFL);
-+	exit (0);
-+}
-+
- static uint8_t buf[2048];
- 
- static char *ibsystat_serv(void)
-@@ -171,6 +189,7 @@
- 	int attr, mod, size;
- 
- 	DEBUG("starting to serve...");
-+	(void) signal(SIGINT, cleanup);
- 
- 	while ((umad = mad_receive_via(buf, -1, srcport))) {
- 		if (umad_status(buf)) {
-@@ -261,7 +280,25 @@
- 	char line[1024] = { 0 }, *s, *e;
- 	FILE *f;
- 	int ncpu = 0;
-+#if defined(__SVR4) && defined(__sun)
-+	int		i;
-+	char		mhz[8];
-+	sol_cpu_info_t	*cpu_info;
- 
-+	ncpu = sol_get_cpu_info(&cpu_info);
-+	ncpu = ncpu < MAX_CPUS ? ncpu : MAX_CPUS;
-+	if (ncpu <= 0) {
-+		IBWARN("couldn't get cpu info");
-+		return 0;
-+	}
-+
-+	for (i = 0; i < ncpu; i++) {
-+		cpus[i].model = strdup(cpu_info[i].cpu_name);
-+		snprintf(mhz, 8, "%d", cpu_info[i].cpu_mhz);
-+		cpus[i].mhz = strdup(mhz);
-+	}
-+	free(cpu_info);
-+#else
- 	if (!(f = fopen("/proc/cpuinfo", "r"))) {
- 		IBWARN("couldn't open /proc/cpuinfo");
- 		return 0;
-@@ -287,6 +324,7 @@
- 	}
- 
- 	fclose(f);
-+#endif
- 
- 	DEBUG("ncpu %d", ncpu);
- 
-@@ -314,7 +352,7 @@
- {
- 	int mgmt_classes[3] =
- 	    { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
--	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
-+	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS, i;
- 	ib_portid_t portid = { 0 };
- 	int attr = IB_PING_ATTR;
- 	char *err;
-@@ -342,6 +380,8 @@
- 	if (!srcport)
- 		IBERROR("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
- 
-+	bzero((void *)cpus, MAX_CPUS * sizeof (cpu_info));
-+
- 	if (server) {
- 		if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) <
- 		    0)
-@@ -366,5 +406,6 @@
- 		IBERROR("ibsystat to %s: %s", portid2str(&portid), err);
- 
- 	mad_rpc_close_port(srcport);
-+
- 	exit(0);
- }
-diff -r -u /tmp/infiniband-diags-1.5.8/src/ibnetdiscover.c infiniband-diags-1.5.8/src/ibnetdiscover.c
---- /tmp/infiniband-diags-1.5.8/src/ibnetdiscover.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/ibnetdiscover.c	Thu Feb 24 11:27:00 2011
-@@ -523,7 +523,7 @@
- 			}
- 
- 			fprintf(f, "\n# Spine Nodes");
--			for (n = 1; n <= SPINES_MAX_NUM; n++) {
-+			for (n = 0; n < SPINES_MAX_NUM; n++) {
- 				if (ch->spinenode[n]) {
- 					out_switch(ch->spinenode[n], group,
- 						   chname, NULL, NULL);
-@@ -540,7 +540,7 @@
- 				}
- 			}
- 			fprintf(f, "\n# Line Nodes");
--			for (n = 1; n <= LINES_MAX_NUM; n++) {
-+			for (n = 0; n < LINES_MAX_NUM; n++) {
- 				if (ch->linenode[n]) {
- 					out_switch(ch->linenode[n], group,
- 						   chname, NULL, NULL);
-diff -r -u /tmp/infiniband-diags-1.5.8/src/saquery.c infiniband-diags-1.5.8/src/saquery.c
---- /tmp/infiniband-diags-1.5.8/src/saquery.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/saquery.c	Thu Jun 23 10:36:40 2011
-@@ -104,7 +104,6 @@
- /**
-  * Declare some globals because I don't want this to be too complex.
-  */
--#define MAX_PORTS (8)
- #define DEFAULT_SA_TIMEOUT_MS (1000)
- static struct query_res result;
- 
-@@ -1757,7 +1756,7 @@
- 			requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
- 			requested_lid_flag++;
- 		} else if (node_print_desc == NAME_OF_GUID) {
--			requested_guid = strtoul(argv[0], NULL, 0);
-+			requested_guid = strtoull(argv[0], NULL, 0);
- 			requested_guid_flag++;
- 		} else
- 			requested_name = argv[0];
-diff -r -u /tmp/infiniband-diags-1.5.8/src/ibportstate.c infiniband-diags-1.5.8/src/ibportstate.c
---- /tmp/infiniband-diags-1.5.8/src/ibportstate.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/ibportstate.c	Thu Feb 24 11:27:00 2011
-@@ -252,6 +252,7 @@
- 	int portnum = 0;
- 	ib_portid_t selfportid = { 0 };
- 	int selfport = 0;
-+	int switch_lid = 0;
- 	int changed = 0;
- 	int i;
- 	long val;
-@@ -351,6 +352,11 @@
- 		port_op = QUERY;
- 
- 	is_switch = get_node_info(&portid, data);
-+	if (!is_switch && (port_op == RESET || port_op == DISABLE ||
-+	    port_op == ENABLE)) {
-+		mad_rpc_close_port(srcport);
-+		exit(-1);
-+	}
- 
- 	if (port_op != QUERY || changed)
- 		printf("Initial %s PortInfo:\n", is_switch ? "Switch" : "CA");
-@@ -431,6 +437,12 @@
- 			mad_decode_field(data, IB_PORT_LINK_SPEED_ENABLED_F,
- 					 &lse);
- 
-+			/* Get Switch LID from the default switch port */
-+			if (!smp_query_via(data, &portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
-+				IBERROR("could not get port LID");
-+
-+			switch_lid = mad_get_field(data, 0, IB_PORT_LID_F);
-+
- 			/* Setup portid for peer port */
- 			memcpy(&peerportid, &portid, sizeof(peerportid));
- 			peerportid.drpath.cnt = 1;
-@@ -440,6 +452,7 @@
- 			if (ib_resolve_self_via(&selfportid,
- 						&selfport, 0, srcport) < 0)
- 				IBERROR("could not resolve self");
-+			peerportid.lid = switch_lid;
- 			peerportid.drpath.drslid = (uint16_t) selfportid.lid;
- 			peerportid.drpath.drdlid = 0xffff;
- 
-diff -r -u /tmp/infiniband-diags-1.5.8/src/ibstat.c infiniband-diags-1.5.8/src/ibstat.c
---- /tmp/infiniband-diags-1.5.8/src/ibstat.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/ibstat.c	Fri Feb 25 03:09:28 2011
-@@ -46,6 +46,7 @@
- 
- #include <infiniband/umad.h>
- #include <infiniband/mad.h>
-+#include <infiniband/verbs.h>
- 
- #include <ibdiag_common.h>
- 
-@@ -78,7 +79,7 @@
- }
- 
- static char *port_state_str[] = {
--	"???",
-+	"Unknown",
- 	"Down",
- 	"Initializing",
- 	"Armed",
-@@ -112,10 +113,10 @@
- 	printf("%sPort %d:\n", hdrpre, port->portnum);
- 	printf("%sState: %s\n", pre,
- 	       (unsigned)port->state <=
--	       4 ? port_state_str[port->state] : "???");
-+	       4 ? port_state_str[port->state] : "Unknown");
- 	printf("%sPhysical state: %s\n", pre,
- 	       (unsigned)port->phys_state <=
--	       7 ? port_phy_state_str[port->phys_state] : "???");
-+	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
- 	printf("%sRate: %d\n", pre, port->rate);
- 	printf("%sBase lid: %d\n", pre, port->base_lid);
- 	printf("%sLMC: %d\n", pre, port->lmc);
-@@ -167,13 +168,13 @@
- 
- static int ports_list(char names[][UMAD_CA_NAME_LEN], int n)
- {
--	uint64_t guids[64];
-+	uint64_t guids[MAX_PORTS];
- 	int found, ports, i;
- 
--	for (i = 0, found = 0; i < n && found < 64; i++) {
-+	for (i = 0, found = 0; i < n && found < MAX_PORTS; i++) {
- 		if ((ports =
- 		     umad_get_ca_portguids(names[i], guids + found,
--					   64 - found)) < 0)
-+					   MAX_PORTS - found)) < 0)
- 			return -1;
- 		found += ports;
- 	}
-@@ -245,7 +246,7 @@
- 		if (i >= n)
- 			IBPANIC("'%s' IB device can't be found", argv[0]);
- 
--		strncpy(names[i], argv[0], sizeof names[i]);
-+		strncpy(names[0], argv[0], sizeof names[i]);
- 		n = 1;
- 	}
- 
-diff -r -u /tmp/infiniband-diags-1.5.8/src/ibdiag_common.c infiniband-diags-1.5.8/src/ibdiag_common.c
---- /tmp/infiniband-diags-1.5.8/src/ibdiag_common.c	Wed Feb 16 02:13:21 2011
-+++ infiniband-diags-1.5.8/src/ibdiag_common.c	Tue May  3 13:50:05 2011
-@@ -322,15 +322,17 @@
- 	char buf[512];
- 	va_list va;
- 	int n;
-+	int bufsz;
- 
- 	va_start(va, msg);
--	n = vsprintf(buf, msg, va);
-+	bufsz = strlen(msg) < sizeof (buf) ? strlen(msg) : sizeof (buf);
-+	n = vsnprintf(buf, bufsz, msg, va);
- 	va_end(va);
- 	buf[n] = 0;
- 
- 	if (ibdebug)
- 		printf("%s: iberror: [pid %d] %s: failed: %s\n",
--		       prog_name ? prog_name : "", getpid(), fn, buf);
-+		       prog_name ? prog_name : "", (int)getpid(), fn, buf);
- 	else
- 		printf("%s: iberror: failed: %s\n",
- 		       prog_name ? prog_name : "", buf);
--- a/components/open-fabrics/infiniband-diags/solaris_set_nodedesc.c	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/infiniband-diags/solaris_set_nodedesc.c	Fri Apr 01 15:20:17 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -35,8 +35,6 @@
  */
 #if defined(__SVR4) && defined(__sun)
 
-#pragma ident	"@(#)solaris_set_nodedesc.c	1.2	11/01/25 SMI"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -55,6 +53,7 @@
 #include <infiniband/verbs.h>
 #include <infiniband/arch.h>
 #include <infiniband/umad.h>
+#include "ibdiag_common.h"
 
 #include <sys/ib/adapters/hermon/hermon_ioctl.h>
 
@@ -78,7 +77,6 @@
 #define	NODEDESC_UPDATE_HCA_STRING	0x00000002
 #define	NODEDESC_READ			0x80000000
 
-#include "ibdiag_common.h"
 
 static char *devpath_prefix = "/devices";
 static char *devpath_suffix = ":devctl";
@@ -198,7 +196,7 @@
 		(void) snprintf(access_devname, devlength, "%s%s%s",
 		    devpath_prefix, devpath, devpath_suffix);
 		if ((devfd = open(access_devname, O_RDONLY)) < 0) {
-			IBERROR("open device file %s failed", access_devname);
+			IBEXIT("open device file %s failed", access_devname);
 			free(access_devname);
 			hcanode = di_drv_next_node(hcanode);
 			continue;
@@ -208,7 +206,7 @@
 
 			if ((rc = ioctl(devfd, HERMON_IOCTL_GET_NODEDESC,
 			    (void *)&nodedesc_ioctl)) != 0) {
-				IBERROR("hermon ioctl failure");
+				IBEXIT("hermon ioctl failure");
 				free(access_devname);
 				close(devfd);
 				hcanode = di_drv_next_node(hcanode);
@@ -217,7 +215,7 @@
 			add_read_info_arr((char *)nodedesc_ioctl.node_desc_str,
 			    *hca_guid);
 		} else {
-			IBERROR("drivername != hermon: %s", drivername);
+			IBEXIT("drivername != hermon: %s", drivername);
 		}
 
 		free(access_devname);
@@ -262,7 +260,7 @@
 
 	if ((hca_desc && childnode == DI_NODE_NIL) ||
 	    hcanode == DI_NODE_NIL) {
-		IBERROR("matching GUID not found");
+		IBEXIT("matching GUID not found");
 		return (-1);
 	}
 
@@ -273,7 +271,7 @@
 	(void) snprintf(access_devname, devlength, "%s%s%s",
 	    devpath_prefix, devpath, devpath_suffix);
 	if ((devfd = open(access_devname, O_RDONLY)) < 0) {
-		IBERROR("open device file %s failed", access_devname);
+		IBEXIT("open device file %s failed", access_devname);
 		free(access_devname);
 		return (rc);
 	}
@@ -288,15 +286,15 @@
 			nodedesc_ioctl.node_desc_update_flag =
 			    HERMON_NODEDESC_UPDATE_HCA_STRING;
 		else {
-			IBERROR("Invalid option");
+			IBEXIT("Invalid option");
 			exit(-1);
 		}
 		if ((rc = ioctl(devfd, HERMON_IOCTL_SET_NODEDESC,
 		    (void *)&nodedesc_ioctl)) != 0) {
-			IBERROR("hermon ioctl failure");
+			IBEXIT("hermon ioctl failure");
 		}
 	} else {
-		IBERROR("drivername != hermon: %s", drivername);
+		IBEXIT("drivername != hermon: %s", drivername);
 	}
 
 	free(access_devname);
@@ -311,7 +309,7 @@
 
 	if ((di_rootnode = di_init("/", DINFOCPYALL | DINFOFORCE))
 	    == DI_NODE_NIL) {
-		IBERROR("read_nodedesc di_init failure");
+		IBEXIT("read_nodedesc di_init failure");
 		return;
 	}
 	for (i = 0; ib_hca_driver_list[i]; i++)
@@ -327,7 +325,7 @@
 
 	if ((di_rootnode = di_init("/", DINFOCPYALL | DINFOFORCE))
 	    == DI_NODE_NIL) {
-		IBERROR("di_init failure");
+		IBEXIT("di_init failure");
 		return (-1);
 	}
 	for (i = 0; ib_hca_driver_list[i]; i++) {
@@ -338,7 +336,7 @@
 			break;
 	}
 	if (rc)
-		IBERROR("Updated failed for all HCA drivers");
+		IBEXIT("Updated failed for all HCA drivers");
 
 	di_fini(di_rootnode);
 	return (rc);
@@ -504,7 +502,7 @@
 	}
 
 	if (hcadesc && guid_inited == B_FALSE) {
-		IBERROR("No GUID specified for HCA Node descriptor");
+		IBEXIT("No GUID specified for HCA Node descriptor");
 		usage();
 		rc = -1;
 		goto free_and_ret;
@@ -514,7 +512,7 @@
 		rc = update_nodedesc(nodedesc, NULL, 0,
 		    NODEDESC_UPDATE_STRING);
 		if (rc) {
-			IBERROR("write common node descriptor "
+			IBEXIT("write common node descriptor "
 			    "failed");
 			rc = -1;
 			goto free_and_ret;
@@ -525,7 +523,7 @@
 		rc = update_nodedesc(NULL, hcadesc, hca_guid,
 		    NODEDESC_UPDATE_HCA_STRING);
 		if (rc) {
-			IBERROR("update_hca_noddesc failed");
+			IBEXIT("update_hca_noddesc failed");
 			rc = -1;
 			goto free_and_ret;
 		}
@@ -535,7 +533,7 @@
 
 	if (nodedesc == NULL) {
 		if (uname(&uts_name) < 0) {
-			IBERROR("Node descriptor unspecified"
+			IBEXIT("Node descriptor unspecified"
 			    "& uts_name failed");
 			rc = -1;
 			goto free_and_ret;
@@ -553,7 +551,7 @@
 		rc = update_nodedesc(nodename, NULL, 0,
 		    NODEDESC_UPDATE_STRING);
 		if (rc) {
-			IBERROR("write common node descriptor failed");
+			IBEXIT("write common node descriptor failed");
 			rc = -1;
 		}
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibmad.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,418 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license libibmad-1.3.7 under the OpenIB.org BSD license.
+
+Copyright (c) 2009 Mellanox Technologies LTD.  All rights reserved.
+Copyright (c) 2004-2009 Voltaire, Inc.  All rights reserved
+Copyright (c) 2009 HNR Consulting.  All rights reserved.
+Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
+
+This software with the exception of OpenSM is available to you
+under a choice of one of two licenses. You may chose to be
+licensed under the terms of the the OpenIB.org BSD license or
+the GNU General Public License (GPL) Version 2, both included
+below.
+
+OpenSM is licensed under either GNU General Public License (GPL)
+Version 2, or Intel BSD + Patent license. See OpenSM for the
+specific language for the latter licensing terms.
+
+==================================================================
+
+OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License. (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code. (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year> <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
--- a/components/open-fabrics/libibmad/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libibmad/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		libibmad
-COMPONENT_VERSION=	1.3.7
+COMPONENT_VERSION=	1.3.12
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:825a1ff5c2df0a6a158e0058560772998d39ae633a838c19b58a99650dc199b0
-COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+    sha256:f1bfb512b5b927496bf8214da1de1972494c7e244d1a68320924b2a933f8937b
+COMPONENT_ARCHIVE_URL=	https://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 include ../ofed-component.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibmad/patches/001-libibmad-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,78 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  c28a7753d5943989e04b1f8f505eda68d0a7fa77
+libibmad solaris specific changes
+
+diff -r c28a7753d594 Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Fri Nov 13 07:26:11 2015 -0800
+@@ -478,8 +478,8 @@
+ 	test -z "$$list2" || { \
+ 	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ 	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+-	  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 c28a7753d594 include/infiniband/mad.h
+--- a/include/infiniband/mad.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/mad.h	Fri Nov 13 07:26:11 2015 -0800
+@@ -1660,6 +1660,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)
+@@ -1687,6 +1691,10 @@
+ }
+ #endif
+ #endif				/* __BYTE_ORDER == __BIG_ENDIAN */
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
++
+ 
+ /* Misc. macros: */
+ /** align value \a l to \a size (ceil) */
+diff -r c28a7753d594 include/infiniband/mad_osd.h
+--- a/include/infiniband/mad_osd.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/mad_osd.h	Fri Nov 13 07:26:11 2015 -0800
+@@ -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 c28a7753d594 src/sa.c
+--- a/src/sa.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/sa.c	Fri Nov 13 07:26:11 2015 -0800
+@@ -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;
+ 	}
+ 
--- a/components/open-fabrics/libibmad/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1754 +0,0 @@
-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
-@@ -40,6 +40,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
-+#include <errno.h>
- 
- #include <infiniband/umad.h>
- #include <infiniband/mad.h>
-@@ -49,18 +50,25 @@
- #undef DEBUG
- #define DEBUG	if (ibdebug)	IBWARN
- 
-+#define GET_IB_USERLAND_TID(tid)	(tid & 0x00000000ffffffff)
-+/*
-+ * Generate the 64 bit MAD transaction ID. The upper 32 bits are reserved for
-+ * use by the kernel. We clear the upper 32 bits here, but MADs received from
-+ * the kernel may contain kernel specific data in these bits, consequently
-+ * userland TID matching should only be done on the lower 32 bits.
-+ */
-+
- uint64_t mad_trid(void)
- {
--	static uint64_t base;
- 	static uint64_t trid;
- 	uint64_t next;
- 
--	if (!base) {
-+	if (!trid) {
- 		srandom((int)time(0) * getpid());
--		base = random();
- 		trid = random();
- 	}
--	next = ++trid | (base << 32);
-+	next = ++trid;
-+	next = GET_IB_USERLAND_TID(next);
- 	return next;
- }
- 
-@@ -91,10 +99,12 @@
- 	if (rpc->mgtclass == IB_SMI_DIRECT_CLASS) {
- 		if (!drpath) {
- 			IBWARN("encoding dr mad without drpath (null)");
-+			errno = EINVAL;
- 			return NULL;
- 		}
- 		if (drpath->cnt >= IB_SUBNET_PATH_HOPS_MAX) {
- 			IBWARN("dr path with hop count %d", drpath->cnt);
-+			errno = EINVAL;
- 			return NULL;
- 		}
- 		mad_set_field(buf, 0, IB_DRSMP_HOPCNT_F, drpath->cnt);
-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,15 @@
- 
- 	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)) {
- 		return -1;
-+	}
- 
- 	mad_decode_field(portinfo, IB_PORT_SMLID_F, &lid);
-+	if (!IB_LID_VALID(lid)) {
-+		errno = ENXIO;
-+		return -1;
-+	}
- 	mad_decode_field(portinfo, IB_PORT_SMSL_F, &sm_id->sl);
- 
- 	return ib_portid_set(sm_id, lid, 0, 0);
-@@ -75,11 +81,13 @@
- 		       ib_portid_t * sm_id, int timeout,
- 		       const struct ibmad_port *srcport)
- {
--	ib_portid_t sm_portid;
-+	ib_portid_t sm_portid = { 0 };
- 	char buf[IB_SA_DATA_SIZE] = { 0 };
- 
--	if (!sm_id) {
-+	if (!sm_id)
- 		sm_id = &sm_portid;
-+
-+	if (!IB_LID_VALID(sm_id->lid)) {
- 		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0)
- 			return -1;
- 	}
-@@ -95,7 +103,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 +110,17 @@
- 	ibmad_gid_t selfgid;
- 	uint8_t nodeinfo[64];
- 
--	if (!sm_id) {
-+	if (!sm_id)
- 		sm_id = &sm_portid;
-+
-+	if (!IB_LID_VALID(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)) {
- 		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);
-@@ -145,18 +156,24 @@
- 	switch (dest_type) {
- 	case IB_DEST_LID:
- 		lid = strtol(addr_str, 0, 0);
--		if (!IB_LID_VALID(lid))
-+		if (!IB_LID_VALID(lid)) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 		return ib_portid_set(portid, lid, 0, 0);
- 
- 	case IB_DEST_DRPATH:
--		if (str2drpath(&portid->drpath, addr_str, 0, 0) < 0)
-+		if (str2drpath(&portid->drpath, addr_str, 0, 0) < 0) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 		return 0;
- 
- 	case IB_DEST_GUID:
--		if (!(guid = strtoull(addr_str, 0, 0)))
-+		if (!(guid = strtoull(addr_str, 0, 0))) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 
- 		/* keep guid in portid? */
- 		return ib_resolve_guid_via(portid, &guid, sm_id, 0, srcport);
-@@ -164,8 +181,10 @@
- 	case IB_DEST_DRSLID:
- 		lid = strtol(addr_str, &routepath, 0);
- 		routepath++;
--		if (!IB_LID_VALID(lid))
-+		if (!IB_LID_VALID(lid)) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 		ib_portid_set(portid, lid, 0, 0);
- 
- 		/* handle DR parsing and set DrSLID to local lid */
-@@ -172,8 +191,10 @@
- 		if (ib_resolve_self_via(&selfportid, &selfport, 0, srcport) < 0)
- 			return -1;
- 		if (str2drpath(&portid->drpath, routepath, selfportid.lid, 0) <
--		    0)
-+		    0) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 		return 0;
- 
- 	case IB_DEST_GID:
-@@ -182,6 +203,7 @@
- 		return ib_resolve_gid_via(portid, gid, sm_id, 0, srcport);
- 	default:
- 		IBWARN("bad dest_type %d", dest_type);
-+		errno = EINVAL;
- 	}
- 
- 	return -1;
-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
-@@ -308,6 +308,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 +775,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
-@@ -128,7 +128,7 @@
- _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len,
- 	   int timeout, int max_retries)
- {
--	uint32_t trid;		/* only low 32 bits */
-+	uint32_t trid;		/* only low 32 bits - see mad_trid() */
- 	int retries;
- 	int length, status;
- 
-@@ -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;
- 			}
- 
-@@ -181,6 +181,7 @@
- 			return length;
- 	}
- 
-+	errno = status;
- 	ERRS("timeout after %d retries, %d ms", retries, timeout * retries);
- 	return -1;
- }
-@@ -246,6 +247,7 @@
- 	if (status != 0) {
- 		ERRS("MAD completed with error status 0x%x; dport (%s)",
- 		     status, portid2str(dport));
-+		errno = EIO;
- 		return NULL;
- 	}
- 
-@@ -286,6 +288,7 @@
- 	if ((status = mad_get_field(mad, 0, IB_MAD_STATUS_F)) != 0) {
- 		ERRS("MAD completed with error status 0x%x; dport (%s)",
- 		     status, portid2str(dport));
-+		errno = EIO;
- 		return NULL;
- 	}
- 
-@@ -337,7 +340,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;
- 	}
- 
-@@ -97,8 +98,10 @@
- 	int is_smi;
- 
- 	if (!portid) {
--		if (!(mad_addr = umad_get_mad_addr(umad)))
-+		if (!(mad_addr = umad_get_mad_addr(umad))) {
-+			errno = EINVAL;
- 			return -1;
-+		}
- 
- 		memset(&rport, 0, sizeof(rport));
- 
-@@ -157,7 +160,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 +182,7 @@
- 			       mad_get_timeout(srcport, timeout))) < 0) {
- 		if (!umad)
- 			umad_free(mad);
--		DEBUG("recv failed: %m");
-+		DEBUG("recv failed: %s", strerror(errno));
- 		return 0;
- 	}
- 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibumad.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,388 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license libibumad-1.3.10.2 under the OpenIB.org BSD license.
+
+The following attribution text was taken from Component libibumad 
+Version 1.3.10.2.  
+
+This software is available to you under a choice of one of two licenses. You
+may chose to be licensed under the terms of the the OpenIB.org BSD 
+license or
+the GNU General Public License (GPL) Version 2, both included below.
+
+Copyright (c) 2004-2008 Voltaire, Inc.  All rights reserved.
+
+==================================================================
+
+              OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following
+   disclaimer in the documentation and/or other materials provided
+   with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                      59 Temple Place, Suite 330, Boston, MA  
+02111-1307  USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+                           Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+   a) You must cause the modified files to carry prominent notices
+   stating that you changed the files and the date of any change.
+
+   b) You must cause any work that you distribute or publish, that in
+   whole or in part contains or is derived from the Program or any
+   part thereof, to be licensed as a whole at no charge to all third
+   parties under the terms of this License.
+
+   c) If the modified program normally reads commands interactively
+   when run, you must cause it, when started running for such
+   interactive use in the most ordinary way, to print or display an
+   announcement including an appropriate copyright notice and a
+   notice that there is no warranty (or else, saying that you provide
+   a warranty) and that users may redistribute the program under
+   these conditions, and telling the user how to view a copy of this
+   License.  (Exception: if the Program itself is interactive but
+   does not normally print such an announcement, your work based on
+   the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+   a) Accompany it with the complete corresponding machine-readable
+   source code, which must be distributed under the terms of Sections
+   1 and 2 above on a medium customarily used for software interchange; or,
+
+   b) Accompany it with a written offer, valid for at least three
+   years, to give any third party, for a charge no more than your
+   cost of physically performing source distribution, a complete
+   machine-readable copy of the corresponding source code, to be
+   distributed under the terms of Sections 1 and 2 above on a medium
+   customarily used for software interchange; or,
+
+   c) Accompany it with the information you received as to the offer
+   to distribute corresponding source code.  (This alternative is
+   allowed only for noncommercial distribution and only if you
+   received the program in object code or executable form with such
+   an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+   <one line to give the program's name and a brief idea of what it does.>
+   Copyright (C) <year>  <name of author>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
+02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+   Gnomovision version 69, Copyright (C) year name of author
+   Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 
+`show w'.
+   This is free software, and you are welcome to redistribute it
+   under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- a/components/open-fabrics/libibumad/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libibumad/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		libibumad
-COMPONENT_VERSION=	1.3.7
+COMPONENT_VERSION=	1.3.10.2
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:4999cb9ff5c7243027d8a154d6b27d1efffaa4359b84447731c5ef545fb72229
-COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+	sha256:500f74e31bd9f3d6c32dea912de3a2d1b299f3f23d7abd893652dd45c77a7e2e
+COMPONENT_ARCHIVE_URL=	https://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 include ../ofed-component.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibumad/patches/001-libibumad-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,437 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  2bd95ad341be80bc24c2f033948996ceecc52db7
+libibumad Solaris specific changes
+
+diff -r 2bd95ad341be Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Fri Nov 13 07:28:27 2015 -0800
+@@ -411,8 +411,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 2bd95ad341be configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Fri Nov 13 07:28:27 2015 -0800
+@@ -8735,6 +8735,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+diff -r 2bd95ad341be include/infiniband/umad.h
+--- a/include/infiniband/umad.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/umad.h	Fri Nov 13 07:28:27 2015 -0800
+@@ -36,7 +36,9 @@
+ 
+ #include <stdint.h>
+ #include <stdlib.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <arpa/inet.h>
+ 
+ #ifdef __cplusplus
+@@ -53,7 +55,15 @@
+ typedef uint32_t be32_t;
+ typedef uint64_t be64_t;
+ 
+-#define UMAD_MAX_DEVICES 32
++/* To accomodate max. of 16 PCIe slots and 63 VFs per HCA, */
++/* we define   MAX_HCAS = (63VFs + 1PF) * 16HCAs */
++/*             MAX_PORTS = MAX_HCAS * 2ports per HCA */
++#define	MAX_HCAS		(64*16)
++#define MAX_PORTS		(MAX_HCAS*2)
++#define	UMAD_MAX_DEVICES	MAX_HCAS
++#define	UMAD_MAX_HCAS   	MAX_HCAS
++#define UMAD_MAX_PORTS		MAX_PORTS
++
+ #define UMAD_ANY_PORT	0
+ typedef struct ib_mad_addr {
+ 	be32_t qpn;
+@@ -104,9 +114,13 @@
+ #define SYS_IB_MAD_PORT		"port"
+ #define SYS_IB_MAD_DEV		"ibdev"
+ 
+-#define UMAD_MAX_PORTS		64
++#define UMAD_MAX_PORTS		MAX_PORTS
+ 
++#if defined(__SVR4) && defined(__sun)
++#define	UMAD_DEV_DIR		"/dev/infiniband/ofs"
++#else
+ #define UMAD_DEV_DIR		"/dev/infiniband"
++#endif
+ 
+ #define SYS_CA_PORTS_DIR	"ports"
+ 
+@@ -229,6 +243,8 @@
+ 	free(umad);
+ }
+ 
++#if !(defined(__SVR4) && defined(__sun))
++
+ #ifndef ntohll
+   #if __BYTE_ORDER == __LITTLE_ENDIAN
+     #define ntohll(x) bswap_64(x)
+@@ -240,5 +256,9 @@
+   #define htonll ntohll
+ #endif
+ 
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
++
+ END_C_DECLS
+ #endif				/* _UMAD_H */
+diff -r 2bd95ad341be src/sysfs.c
+--- a/src/sysfs.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/sysfs.c	Fri Nov 13 07:28:27 2015 -0800
+@@ -46,9 +46,14 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ #include <netinet/in.h>
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/driver.h>
++#endif
+ 
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define htonll(x) bswap_64(x)
+@@ -70,6 +75,16 @@
+ 	char path[256], *s;
+ 	int fd, r;
+ 
++#if defined(__SVR4) && defined(__sun)
++	if ((r = ibv_read_sysfs_file(dir_name, file_name, str, max_len)) < 0) {
++		return -EINVAL;
++	}
++
++	str[(r < max_len) ? r : max_len - 1] = 0;
++
++	if ((s = strrchr(str, '\n')))
++		*s = 0;
++#else
+ 	snprintf(path, sizeof(path), "%s/%s", dir_name, file_name);
+ 
+ 	if ((fd = open(path, O_RDONLY)) < 0)
+@@ -88,6 +103,7 @@
+ 		*s = 0;
+ 
+ 	close(fd);
++#endif
+ 	return 0;
+ }
+ 
+diff -r 2bd95ad341be src/umad.c
+--- a/src/umad.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/umad.c	Fri Nov 13 07:28:27 2015 -0800
+@@ -52,6 +52,11 @@
+ 
+ #include "umad.h"
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/verbs.h>
++#define IB_OFS_DEVPATH_PREFIX	"/dev/infiniband/ofs"
++#endif
++
+ #define IB_OPENIB_OUI                 (0x001405)
+ 
+ #ifdef HAVE_VALGRIND_MEMCHECK_H
+@@ -97,7 +102,7 @@
+ extern int sys_read_uint64(const char *dir_name, const char *file_name, uint64_t * u);
+ extern int sys_read_uint(const char *dir_name, const char *file_name, unsigned *u);
+ 
+-#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## args)
++#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## args)
+ 
+ #define TRACE	if (umaddebug)	IBWARN
+ #define DEBUG	if (umaddebug)	IBWARN
+@@ -141,7 +146,12 @@
+ 	return *p ? 0 : 1;
+ }
+ 
+-static int get_port(const char *ca_name, const char *dir, int portnum, umad_port_t * port)
++#if defined(__SVR4) && defined(__sun)
++static int get_port(char *ca_name, const char *dir, int portnum,
++    struct ibv_context *ctx, umad_port_t * port)
++#else
++ static int get_port(const char *ca_name, const char *dir, int portnum, umad_port_t * port)
++#endif
+ {
+ 	char port_dir[256];
+ 	uint8_t gid[16];
+@@ -187,6 +197,39 @@
+ 	memcpy(&port->port_guid, gid + 8, sizeof port->port_guid);
+ 
+ 	snprintf(port_dir + len, sizeof(port_dir) - len, "/pkeys");
++
++#if defined(__SVR4) && defined(__sun)
++	{
++		struct ibv_port_attr	port_attr;
++
++		if (sol_ibv_query_port(ctx, portnum, &port_attr)) {
++			IBWARN("Could not query \"%s\" port %d", ca_name,
++			       portnum);
++			goto clean;
++		}
++
++		port->pkeys =
++		    malloc(sizeof (uint16_t) * port_attr.pkey_tbl_len);
++
++		if (!port->pkeys) {
++			IBWARN("Could not retrieve pkeys for \"%s\"", ca_name);
++			goto clean;
++		}
++
++		/*
++		 * set high bit of port_num, and try get all pkeys in one go.
++		 */
++		portnum |= 0x80;
++		num_pkeys = ibv_query_pkey(ctx, portnum, port_attr.pkey_tbl_len,
++		    port->pkeys);
++		if (num_pkeys != 0) {
++			IBWARN("get_port: ibv_query_pkey() failed for \"%s\"",
++			    ca_name);
++			goto clean;
++		}
++		port->pkeys_size = port_attr.pkey_tbl_len;
++	}
++#else
+ 	num_pkeys = scandir(port_dir, &namelist, check_for_digit_name, NULL);
+ 	if (num_pkeys <= 0) {
+ 		IBWARN("no pkeys found for %s:%u (at dir %s)...",
+@@ -208,6 +251,8 @@
+ 	port->pkeys_size = num_pkeys;
+ 	free(namelist);
+ 	namelist = NULL;
++#endif
++
+ 	port_dir[len] = '\0';
+ 
+ 	/* FIXME: handle gids */
+@@ -420,6 +465,7 @@
+ 	snprintf(dir_name, sizeof(dir_name), "%s/%s/%s",
+ 		 SYS_INFINIBAND, ca->ca_name, SYS_CA_PORTS_DIR);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	if (!(dir = opendir(dir_name)))
+ 		return -ENOENT;
+ 
+@@ -461,15 +507,100 @@
+ 	free(namelist);
+ 
+ 	closedir(dir);
++#else
++	{
++		struct ibv_device	**root_dev_list, **dev_list = NULL;
++		struct ibv_context	ctx;
++		struct ibv_device_attr  dev_attr;
++		int			num_dev;
++		int                     ret;
++		char			uverbs_devpath[MAXPATHLEN];
++
++		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
++		if (!dev_list) {
++			IBWARN("No HCA devices found");
++			return -EIO;
++		}
++
++		for (i = 0; i < num_dev; i++, dev_list++) {
++			if (strcmp(ibv_get_device_name(*dev_list), ca_name)
++			    == 0) {
++				break;
++			}
++		}
++
++		if (i == num_dev) {
++			IBWARN("Could not find \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			ret = -EIO;
++			goto clean;
++		}
++
++		snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s",
++		    IB_OFS_DEVPATH_PREFIX, (*dev_list)->dev_name);
++
++		ctx.device = *dev_list;
++
++		if ((ctx.cmd_fd = open(uverbs_devpath, O_RDWR)) < 0) {
++			IBWARN("failed to open device \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			ret = -EIO;
++			goto clean;
++		}
++
++		/* Get port count */
++		memset(&dev_attr, 0, sizeof (struct ibv_device_attr));
++		if (sol_ibv_query_device(*dev_list, &dev_attr) != 0) {
++			IBWARN("failed to query device \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			if (ctx.cmd_fd > 0)
++				close(ctx.cmd_fd);
++			ret = -EIO;
++			goto clean;
++		}
++
++		ca->numports = 0;
++		memset(ca->ports, 0, sizeof ca->ports);
++
++		for (portnum = 1; portnum <= dev_attr.phys_port_cnt; portnum++) {
++
++		        if (!(ca->ports[portnum] = calloc(1,
++			    sizeof(*ca->ports[portnum])))) {
++			        ret = -ENOMEM;
++				ibv_free_device_list(root_dev_list);
++				if (ctx.cmd_fd > 0)
++					close(ctx.cmd_fd);
++				goto clean;
++			}
++			if (get_port(ca_name, dir_name, portnum, &ctx,
++			    ca->ports[portnum]) < 0) {
++			        free(ca->ports[portnum]);
++				ca->ports[portnum] = NULL;
++				ret = -EIO;
++				ibv_free_device_list(root_dev_list);
++				if (ctx.cmd_fd > 0)
++					close(ctx.cmd_fd);
++				goto clean;
++			}
++			if (ca->numports < portnum)
++			        ca->numports = portnum;
++		}
++	}
++#endif
++
+ 	put_ca(ca);
+ 	return 0;
+ 
+ clean:
++#if !(defined(__SVR4) && defined(__sun))
+ 	for (i = 0; i < r; i++)
+ 		free(namelist[i]);
+ 	free(namelist);
++#endif
+ error:
++#if !(defined(__SVR4) && defined(__sun))
+ 	closedir(dir);
++#endif
+ 	release_ca(ca);
+ 
+ 	return ret;
+@@ -520,6 +651,11 @@
+ int umad_init(void)
+ {
+ 	TRACE("umad_init");
++	struct ibv_device **devlist = ibv_get_device_list(NULL);
++	if (devlist == NULL) {
++		IBWARN("No IB devices found");
++		return -1;
++	}
+ 	if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) {
+ 		IBWARN
+ 		    ("can't read ABI version from %s/%s (%m): is ib_umad module loaded?",
+@@ -558,6 +694,28 @@
+ 
+ int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max)
+ {
++#if defined(__SVR4) && defined(__sun)
++	struct ibv_device **devlist = ibv_get_device_list(NULL);
++	int j = 0;
++
++	TRACE("max %d", max);
++
++	if (devlist) {
++		while (devlist[j] && j < max) {
++			strncpy(cas[j], ibv_get_device_name(devlist[j]),
++						UMAD_CA_NAME_LEN);
++			j++;
++		}
++		ibv_free_device_list(devlist);
++		DEBUG("return %d cas", j);
++	}
++	if (j == 0 && max > 0) {
++		/* Is this still needed ? */
++		strncpy((char *)cas, def_ca_name, UMAD_CA_NAME_LEN);
++		DEBUG("return 1 ca");
++		j = 1;
++	}
++#else
+ 	struct dirent **namelist;
+ 	int n, i, j = 0;
+ 
+@@ -583,6 +741,7 @@
+ 	}
+ 	if (n >= 0)
+ 		free(namelist);
++#endif
+ 	return j;
+ }
+ 
+@@ -709,7 +868,52 @@
+ 	snprintf(dir_name, sizeof(dir_name), "%s/%s/%s",
+ 		 SYS_INFINIBAND, ca_name, SYS_CA_PORTS_DIR);
+ 
++#if defined(__SVR4) && defined(__sun)
++	{
++		struct ibv_device	**root_dev_list, **dev_list = NULL;
++		struct ibv_context	ctx;
++		int			num_dev, ret, i;
++		char			uverbs_devpath[MAXPATHLEN];
++
++		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
++		if (!dev_list) {
++			IBWARN("No HCA devices found");
++			return -EIO;
++		}
++
++		for (i = 0; i < num_dev; i++, dev_list++) {
++			if (strcmp(ibv_get_device_name(*dev_list), ca_name)
++			    == 0) {
++				break;
++			}
++		}
++
++		if (i == num_dev) {
++			IBWARN("Could not find \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			return -EIO;
++		}
++
++
++		snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s",
++		    IB_OFS_DEVPATH_PREFIX, (*dev_list)->dev_name);
++
++		if ((ctx.cmd_fd = open(uverbs_devpath, O_RDWR)) < 0) {
++			IBWARN("failed to open device \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			return -EIO;
++		}
++
++		if ((ret = get_port(ca_name, dir_name, portnum, &ctx, port)) != 0) {
++		        ibv_free_device_list(root_dev_list);
++			if (ctx.cmd_fd > 0)
++				close(ctx.cmd_fd);
++		}
++		return ret;
++	}
++#else
+ 	return get_port(ca_name, dir_name, portnum, port);
++#endif
+ }
+ 
+ int umad_release_port(umad_port_t * port)
--- a/components/open-fabrics/libibumad/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,400 +0,0 @@
-diff -r -u /tmp/libibumad-1.3.7/Makefile.in libibumad-1.3.7/Makefile.in
---- /tmp/libibumad-1.3.7/Makefile.in	Mon Feb 14 06:18:00 2011
-+++ libibumad-1.3.7/Makefile.in	Fri Feb 25 03:11:40 2011
-@@ -367,8 +367,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/libibumad-1.3.7/include/infiniband/umad.h libibumad-1.3.7/include/infiniband/umad.h
---- /tmp/libibumad-1.3.7/include/infiniband/umad.h	Mon Feb 14 01:08:29 2011
-+++ libibumad-1.3.7/include/infiniband/umad.h	Fri May 13 04:28:12 2011
-@@ -45,7 +45,15 @@
- #endif				/* __cplusplus */
- 
- BEGIN_C_DECLS
--#define UMAD_MAX_DEVICES 32
-+/* To accomodate max. of 16 PCIe slots and 63 VFs per HCA, */
-+/* we define	MAX_HCAS = (63VFs + 1PF) * 16HCAs */
-+/* 		MAX_PORTS = MAX_HCAS * 2ports per HCA */
-+#define MAX_HCAS	(64*16)
-+#define MAX_PORTS	(MAX_HCAS*2)
-+#define UMAD_MAX_DEVICES MAX_HCAS
-+#define	UMAD_MAX_HCAS	MAX_HCAS
-+#define	UMAD_MAX_PORTS	MAX_PORTS
-+
- #define UMAD_ANY_PORT	0
- typedef struct ib_mad_addr {
- 	uint32_t qpn;
-@@ -94,9 +102,13 @@
- #define SYS_IB_MAD_PORT		"port"
- #define SYS_IB_MAD_DEV		"ibdev"
- 
--#define UMAD_MAX_PORTS		64
-+#define UMAD_MAX_PORTS		MAX_PORTS
- 
-+#if defined(__SVR4) && defined(__sun)
-+#define	UMAD_DEV_DIR		"/dev/infiniband/ofs"
-+#else
- #define UMAD_DEV_DIR		"/dev/infiniband"
-+#endif
- 
- #define SYS_CA_PORTS_DIR	"ports"
- 
-diff -r -u /tmp/libibumad-1.3.7/configure libibumad-1.3.7/configure
---- /tmp/libibumad-1.3.7/configure	Mon Feb 14 06:18:01 2011
-+++ libibumad-1.3.7/configure	Thu Feb 24 11:27:18 2011
-@@ -8713,6 +8713,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-diff -r -u /tmp/libibumad-1.3.7/src/sysfs.c libibumad-1.3.7/src/sysfs.c
---- /tmp/libibumad-1.3.7/src/sysfs.c	Mon Feb 14 01:08:29 2011
-+++ libibumad-1.3.7/src/sysfs.c	Thu Feb 24 11:27:30 2011
-@@ -46,9 +46,14 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- #include <netinet/in.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <infiniband/driver.h>
-+#endif
- 
- #if __BYTE_ORDER == __LITTLE_ENDIAN
- #define htonll(x) bswap_64(x)
-@@ -70,6 +75,16 @@
- 	char path[256], *s;
- 	int fd, r;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	if ((r = ibv_read_sysfs_file(dir_name, file_name, str, max_len)) < 0) {
-+		return -EINVAL;
-+	}
-+
-+	str[(r < max_len) ? r : max_len - 1] = 0;
-+
-+	if ((s = strrchr(str, '\n')))
-+		*s = 0;
-+#else
- 	snprintf(path, sizeof(path), "%s/%s", dir_name, file_name);
- 
- 	if ((fd = open(path, O_RDONLY)) < 0)
-@@ -88,6 +103,7 @@
- 		*s = 0;
- 
- 	close(fd);
-+#endif
- 	return 0;
- }
- 
-diff -r -u /tmp/libibumad-1.3.7/src/umad.c libibumad-1.3.7/src/umad.c
---- /tmp/libibumad-1.3.7/src/umad.c	Mon Feb 14 01:08:29 2011
-+++ libibumad-1.3.7/src/umad.c	Fri May  6 05:18:47 2011
-@@ -50,6 +50,11 @@
- 
- #include "umad.h"
- 
-+#if defined(__SVR4) && defined(__sun)
-+#include <infiniband/verbs.h>
-+#define IB_OFS_DEVPATH_PREFIX	"/dev/infiniband/ofs"
-+#endif
-+
- #define IB_OPENIB_OUI                 (0x001405)
- 
- #ifdef HAVE_VALGRIND_MEMCHECK_H
-@@ -82,7 +87,7 @@
- extern int sys_read_uint64(char *dir_name, char *file_name, uint64_t * u);
- extern int sys_read_uint(char *dir_name, char *file_name, unsigned *u);
- 
--#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## args)
-+#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## args)
- 
- #define TRACE	if (umaddebug)	IBWARN
- #define DEBUG	if (umaddebug)	IBWARN
-@@ -126,7 +131,12 @@
- 	return *p ? 0 : 1;
- }
- 
-+#if defined(__SVR4) && defined(__sun)
-+static int get_port(char *ca_name, char *dir, int portnum,
-+    struct ibv_context *ctx, umad_port_t * port)
-+#else
- static int get_port(char *ca_name, char *dir, int portnum, umad_port_t * port)
-+#endif
- {
- 	char port_dir[256];
- 	uint8_t gid[16];
-@@ -172,6 +182,39 @@
- 	memcpy(&port->port_guid, gid + 8, sizeof port->port_guid);
- 
- 	snprintf(port_dir + len, sizeof(port_dir) - len, "/pkeys");
-+
-+#if defined(__SVR4) && defined(__sun)
-+	{
-+		struct ibv_port_attr	port_attr;
-+
-+		if (sol_ibv_query_port(ctx, portnum, &port_attr)) {
-+			IBWARN("Could not query \"%s\" port %d", ca_name,
-+			       portnum);
-+			goto clean;
-+		}
-+
-+		port->pkeys =
-+		    malloc(sizeof (uint16_t) * port_attr.pkey_tbl_len);
-+
-+		if (!port->pkeys) {
-+			IBWARN("Could not retrieve pkeys for \"%s\"", ca_name);
-+			goto clean;
-+		}
-+
-+		/*
-+		 * set high bit of port_num, and try get all pkeys in one go.
-+		 */
-+		portnum |= 0x80;
-+		num_pkeys = ibv_query_pkey(ctx, portnum, port_attr.pkey_tbl_len,
-+		    port->pkeys);
-+		if (num_pkeys != 0) {
-+			IBWARN("get_port: ibv_query_pkey() failed for \"%s\"",
-+			    ca_name);
-+			goto clean;
-+		}
-+		port->pkeys_size = port_attr.pkey_tbl_len;
-+	}
-+#else
- 	num_pkeys = scandir(port_dir, &namelist, check_for_digit_name, NULL);
- 	if (num_pkeys <= 0) {
- 		IBWARN("no pkeys found for %s:%u (at dir %s)...",
-@@ -193,6 +236,8 @@
- 	port->pkeys_size = num_pkeys;
- 	free(namelist);
- 	namelist = NULL;
-+#endif
-+
- 	port_dir[len] = '\0';
- 
- 	/* FIXME: handle gids */
-@@ -384,6 +429,7 @@
- 	snprintf(dir_name, sizeof(dir_name), "%s/%s/%s",
- 		 SYS_INFINIBAND, ca->ca_name, SYS_CA_PORTS_DIR);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	if (!(dir = opendir(dir_name)))
- 		return -ENOENT;
- 
-@@ -425,15 +471,100 @@
- 	free(namelist);
- 
- 	closedir(dir);
-+#else
-+	{
-+		struct ibv_device	**root_dev_list, **dev_list = NULL;
-+		struct ibv_context	ctx;
-+		struct ibv_device_attr  dev_attr;
-+		int			num_dev;
-+		int                     ret;
-+		char			uverbs_devpath[MAXPATHLEN];
-+
-+		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
-+		if (!dev_list) {
-+			IBWARN("No HCA devices found");
-+			return -EIO;
-+		}
-+
-+		for (i = 0; i < num_dev; i++, dev_list++) {
-+			if (strcmp(ibv_get_device_name(*dev_list), ca_name)
-+			    == 0) {
-+				break;
-+			}
-+		}
-+
-+		if (i == num_dev) {
-+			IBWARN("Could not find \"%s\"", ca_name);
-+			ibv_free_device_list(root_dev_list);
-+			ret = -EIO;
-+			goto clean;
-+		}
-+
-+		snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s",
-+		    IB_OFS_DEVPATH_PREFIX, (*dev_list)->dev_name);
-+
-+		ctx.device = *dev_list;
-+
-+		if ((ctx.cmd_fd = open(uverbs_devpath, O_RDWR)) < 0) {
-+			IBWARN("failed to open device \"%s\"", ca_name);
-+			ibv_free_device_list(root_dev_list);
-+			ret = -EIO;
-+			goto clean;
-+		}
-+
-+		/* Get port count */
-+		memset(&dev_attr, 0, sizeof (struct ibv_device_attr));
-+		if (sol_ibv_query_device(*dev_list, &dev_attr) != 0) {
-+			IBWARN("failed to query device \"%s\"", ca_name);
-+			ibv_free_device_list(root_dev_list);
-+			if (ctx.cmd_fd > 0)
-+				close(ctx.cmd_fd);
-+			ret = -EIO;
-+			goto clean;
-+		}
-+
-+		ca->numports = 0;
-+		memset(ca->ports, 0, sizeof ca->ports);
-+
-+		for (portnum = 1; portnum <= dev_attr.phys_port_cnt; portnum++) {
-+
-+		        if (!(ca->ports[portnum] = calloc(1,
-+			    sizeof(*ca->ports[portnum])))) {
-+			        ret = -ENOMEM;
-+				ibv_free_device_list(root_dev_list);
-+				if (ctx.cmd_fd > 0)
-+					close(ctx.cmd_fd);
-+				goto clean;
-+			}
-+			if (get_port(ca_name, dir_name, portnum, &ctx,
-+			    ca->ports[portnum]) < 0) {
-+			        free(ca->ports[portnum]);
-+				ca->ports[portnum] = NULL;
-+				ret = -EIO;
-+				ibv_free_device_list(root_dev_list);
-+				if (ctx.cmd_fd > 0)
-+					close(ctx.cmd_fd);
-+				goto clean;
-+			}
-+			if (ca->numports < portnum)
-+			        ca->numports = portnum;
-+		}
-+	}
-+#endif
-+
- 	put_ca(ca);
- 	return 0;
- 
- clean:
-+#if !(defined(__SVR4) && defined(__sun))
- 	for (i = 0; i < r; i++)
- 		free(namelist[i]);
- 	free(namelist);
-+#endif
- error:
-+#if !(defined(__SVR4) && defined(__sun))
- 	closedir(dir);
-+#endif
- 	release_ca(ca);
- 
- 	return ret;
-@@ -484,6 +615,11 @@
- int umad_init(void)
- {
- 	TRACE("umad_init");
-+	struct ibv_device **devlist = ibv_get_device_list(NULL);
-+	if (devlist == NULL) {
-+		IBWARN("No IB devices found");
-+		return -1;
-+	}
- 	if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) {
- 		IBWARN
- 		    ("can't read ABI version from %s/%s (%m): is ib_umad module loaded?",
-@@ -522,6 +658,28 @@
- 
- int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	struct ibv_device **devlist = ibv_get_device_list(NULL);
-+	int j = 0;
-+
-+	TRACE("max %d", max);
-+
-+	if (devlist) {
-+		while (devlist[j] && j < max) {
-+			strncpy(cas[j], ibv_get_device_name(devlist[j]),
-+						UMAD_CA_NAME_LEN);
-+			j++;
-+		}
-+		ibv_free_device_list(devlist);
-+		DEBUG("return %d cas", j);
-+	}
-+	if (j == 0 && max > 0) {
-+		/* Is this still needed ? */
-+		strncpy((char *)cas, def_ca_name, UMAD_CA_NAME_LEN);
-+		DEBUG("return 1 ca");
-+		j = 1;
-+	}
-+#else
- 	struct dirent **namelist;
- 	int n, i, j = 0;
- 
-@@ -547,6 +705,7 @@
- 	}
- 	if (n >= 0)
- 		free(namelist);
-+#endif
- 	return j;
- }
- 
-@@ -673,7 +832,52 @@
- 	snprintf(dir_name, sizeof(dir_name), "%s/%s/%s",
- 		 SYS_INFINIBAND, ca_name, SYS_CA_PORTS_DIR);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	{
-+		struct ibv_device	**root_dev_list, **dev_list = NULL;
-+		struct ibv_context	ctx;
-+		int			num_dev, ret, i;
-+		char			uverbs_devpath[MAXPATHLEN];
-+
-+		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
-+		if (!dev_list) {
-+			IBWARN("No HCA devices found");
-+			return -EIO;
-+		}
-+
-+		for (i = 0; i < num_dev; i++, dev_list++) {
-+			if (strcmp(ibv_get_device_name(*dev_list), ca_name)
-+			    == 0) {
-+				break;
-+			}
-+		}
-+
-+		if (i == num_dev) {
-+			IBWARN("Could not find \"%s\"", ca_name);
-+			ibv_free_device_list(root_dev_list);
-+			return -EIO;
-+		}
-+
-+
-+		snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s",
-+		    IB_OFS_DEVPATH_PREFIX, (*dev_list)->dev_name);
-+
-+		if ((ctx.cmd_fd = open(uverbs_devpath, O_RDWR)) < 0) {
-+			IBWARN("failed to open device \"%s\"", ca_name);
-+			ibv_free_device_list(root_dev_list);
-+			return -EIO;
-+		}
-+
-+		if ((ret = get_port(ca_name, dir_name, portnum, &ctx, port)) != 0) {
-+		        ibv_free_device_list(root_dev_list);
-+			if (ctx.cmd_fd > 0)
-+				close(ctx.cmd_fd);
-+		}
-+		return ret;
-+	}
-+#else
- 	return get_port(ca_name, dir_name, portnum, port);
-+#endif
- }
- 
- int umad_release_port(umad_port_t * port)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,422 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license ibibverbs-1.1.4 under the OpenIB.org BSD license.
+
+Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved
+Copyright (c) 2004 Topspin Communications.  All rights reserved.
+Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+Copyright (c) 2005 PathScale, Inc.  All rights reserved.
+Copyright (c) 2005 Intel Corporation.  All rights reserved.
+Copyright (c) 2005 Voltaire, Inc. All rights reserved.
+Copyright (c) 2004 Intel Corporation.  All rights reserved.
+Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc.  All rights reserved.
+Copyright (c) 2008 Lawrence Livermore National Laboratory
+
+This software is available to you under a choice of one of two
+licenses. You may choose to be licensed under the terms of the the
+OpenIB.org BSD license or the GNU General Public License (GPL) Version
+2, both included below.
+
+==================================================================
+
+OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License. (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code. (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year> <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
+
+
+
--- a/components/open-fabrics/libibverbs/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libibverbs/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		libibverbs
-COMPONENT_VERSION=	1.1.4
-COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-1.22.g7257cd3.tar.gz
+COMPONENT_VERSION=	1.1.8
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:1e04aa9d518e3dc372fdda6bd25bf072caae4c85c38d0ae095a614104aa583d4
+	sha256:7c766e679e1e6dbcb37bdfc624c64310787e3a380baf7ee1eebde39c6991828f
+COMPONENT_ARCHIVE_URL= https://www.openfabrics.org/downloads/verbs/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 INSTALL_TARGET=
@@ -44,11 +44,13 @@
 include $(WS_MAKE_RULES)/shared-targets.mk
 
 # add flags to get at extra bits from other components' source trees
-CPPFLAGS +=	-I$(PWD)/../libmlx4/libmlx4-1.0.1/src
-CPPFLAGS +=	-I$(PWD)/../librdmacm/librdmacm-1.0.14.1/include
+CPPFLAGS +=	-I$(PWD)/../libmlx4/libmlx4-1.0.6/src
+CPPFLAGS +=	-I$(PWD)/../librdmacm/librdmacm-1.0.21/include
 
 LIBS +=	-lkstat
 
+CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)/infiniband
+
 # --disable-libcheck is not a supported option for this component
 DISABLE_LIBCHECK=
 
@@ -70,5 +72,5 @@
 	$(PROTOUSRSHAREMAN3DIR)/ibv_create_xrc_rcv_qp.3 \
 	$(PROTOUSRSHAREMAN3DIR)/ibv_modify_xrc_rcv_qp.3
 
-install:	$(INSTALL_32_and_64) $(PROTOMAN3FILES)
+install:	$(INSTALL_64) $(PROTOMAN3FILES)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/patches/001-libibverbs-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1806 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  714ac8a9d237c16e4c1d4c0d6b836fd6f2442b4f
+libibverbs solaris specific changes
+
+diff -r 714ac8a9d237 Makefile.am
+--- a/Makefile.am	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.am	Mon Feb 01 09:10:21 2016 -0800
+@@ -11,7 +11,7 @@
+ 
+ src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
+ 			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
+-			    src/enum_strs.c
++			    src/enum_strs.c src/solaris_compatibility.c
+ src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
+     $(libibverbs_version_script)
+ src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map
+@@ -40,7 +40,7 @@
+ 
+ libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
+     include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
+-    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
++    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
+ 
+ man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
+     man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
+@@ -67,6 +67,7 @@
+ 
+ EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
+     include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
++    include/infiniband/ofa_solaris.h \
+     include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
+     src/ibverbs.h examples/pingpong.h \
+     src/libibverbs.map libibverbs.spec.in $(man_MANS)
+diff -r 714ac8a9d237 Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Mon Feb 01 09:10:21 2016 -0800
+@@ -1,7 +1,7 @@
+-# Makefile.in generated by automake 1.14.1 from Makefile.am.
++# Makefile.in generated by automake 1.15 from Makefile.am.
+ # @configure_input@
+ 
+-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
++# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+ 
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -17,7 +17,17 @@
+ 
+ 
+ VPATH = @srcdir@
+-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
++am__is_gnu_make = { \
++  if test -z '$(MAKELEVEL)'; then \
++    false; \
++  elif test -n '$(MAKE_HOST)'; then \
++    true; \
++  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
++    true; \
++  else \
++    false; \
++  fi; \
++}
+ am__make_running_with_option = \
+   case $${target_option-} in \
+       ?) ;; \
+@@ -88,17 +98,6 @@
+ 	examples/ibv_srq_pingpong$(EXEEXT) \
+ 	examples/ibv_xsrq_pingpong$(EXEEXT)
+ subdir = .
+-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+-	$(top_srcdir)/configure $(am__configure_deps) \
+-	$(srcdir)/config.h.in $(srcdir)/libibverbs.spec.in \
+-	$(top_srcdir)/config/depcomp $(libibverbsinclude_HEADERS) \
+-	AUTHORS COPYING ChangeLog README config/compile \
+-	config/config.guess config/config.sub config/depcomp \
+-	config/install-sh config/missing config/ltmain.sh \
+-	$(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
+-	$(top_srcdir)/config/config.sub \
+-	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+-	$(top_srcdir)/config/missing
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+ 	$(top_srcdir)/config/ltoptions.m4 \
+@@ -107,6 +106,9 @@
+ 	$(top_srcdir)/config/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ 	$(ACLOCAL_M4)
++DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
++	$(am__configure_deps) $(libibverbsinclude_HEADERS) \
++	$(am__DIST_COMMON)
+ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+  configure.lineno config.status.lineno
+ mkinstalldirs = $(install_sh) -d
+@@ -152,7 +154,8 @@
+ 	src/src_libibverbs_la-marshall.lo \
+ 	src/src_libibverbs_la-memory.lo src/src_libibverbs_la-sysfs.lo \
+ 	src/src_libibverbs_la-verbs.lo \
+-	src/src_libibverbs_la-enum_strs.lo
++	src/src_libibverbs_la-enum_strs.lo \
++	src/src_libibverbs_la-solaris_compatibility.lo
+ src_libibverbs_la_OBJECTS = $(am_src_libibverbs_la_OBJECTS)
+ AM_V_lt = $(am__v_lt_@AM_V@)
+ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+@@ -288,6 +291,15 @@
+ CTAGS = ctags
+ CSCOPE = cscope
+ AM_RECURSIVE_TARGETS = cscope
++am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
++	$(srcdir)/libibverbs.spec.in $(top_srcdir)/config/compile \
++	$(top_srcdir)/config/config.guess \
++	$(top_srcdir)/config/config.sub $(top_srcdir)/config/depcomp \
++	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
++	$(top_srcdir)/config/missing AUTHORS COPYING ChangeLog README \
++	config/compile config/config.guess config/config.sub \
++	config/depcomp config/install-sh config/ltmain.sh \
++	config/missing
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -428,7 +440,7 @@
+ libibverbs_version_script = @LIBIBVERBS_VERSION_SCRIPT@
+ src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
+ 			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
+-			    src/enum_strs.c
++			    src/enum_strs.c src/solaris_compatibility.c
+ 
+ src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
+     $(libibverbs_version_script)
+@@ -453,7 +465,7 @@
+ libibverbsincludedir = $(includedir)/infiniband
+ libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
+     include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
+-    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
++    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
+ 
+ man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
+     man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
+@@ -480,6 +492,7 @@
+ 
+ EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
+     include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
++    include/infiniband/ofa_solaris.h \
+     include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
+     src/ibverbs.h examples/pingpong.h \
+     src/libibverbs.map libibverbs.spec.in $(man_MANS)
+@@ -504,7 +517,6 @@
+ 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ 	$(am__cd) $(top_srcdir) && \
+ 	  $(AUTOMAKE) --foreign Makefile
+-.PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ 	@case '$?' in \
+ 	  *config.status*) \
+@@ -599,6 +611,8 @@
+ 	src/$(DEPDIR)/$(am__dirstamp)
+ src/src_libibverbs_la-enum_strs.lo: src/$(am__dirstamp) \
+ 	src/$(DEPDIR)/$(am__dirstamp)
++src/src_libibverbs_la-solaris_compatibility.lo: src/$(am__dirstamp) \
++	src/$(DEPDIR)/$(am__dirstamp)
+ 
+ src/libibverbs.la: $(src_libibverbs_la_OBJECTS) $(src_libibverbs_la_DEPENDENCIES) $(EXTRA_src_libibverbs_la_DEPENDENCIES) src/$(am__dirstamp)
+ 	$(AM_V_CCLD)$(src_libibverbs_la_LINK) -rpath $(libdir) $(src_libibverbs_la_OBJECTS) $(src_libibverbs_la_LIBADD) $(LIBS)
+@@ -733,6 +747,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-init.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-marshall.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-memory.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-solaris_compatibility.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-sysfs.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/src_libibverbs_la-verbs.Plo@am__quote@
+ 
+@@ -823,6 +838,13 @@
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src/src_libibverbs_la-enum_strs.lo `test -f 'src/enum_strs.c' || echo '$(srcdir)/'`src/enum_strs.c
+ 
++src/src_libibverbs_la-solaris_compatibility.lo: src/solaris_compatibility.c
++@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -MT src/src_libibverbs_la-solaris_compatibility.lo -MD -MP -MF src/$(DEPDIR)/src_libibverbs_la-solaris_compatibility.Tpo -c -o src/src_libibverbs_la-solaris_compatibility.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
++@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/$(DEPDIR)/src_libibverbs_la-solaris_compatibility.Tpo src/$(DEPDIR)/src_libibverbs_la-solaris_compatibility.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/solaris_compatibility.c' object='src/src_libibverbs_la-solaris_compatibility.lo' libtool=yes @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src/src_libibverbs_la-solaris_compatibility.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
++
+ mostlyclean-libtool:
+ 	-rm -f *.lo
+ 
+@@ -1059,15 +1081,15 @@
+ 	$(am__post_remove_distdir)
+ 
+ dist-tarZ: distdir
+-	@echo WARNING: "Support for shar distribution archives is" \
+-	               "deprecated." >&2
++	@echo WARNING: "Support for distribution archives compressed with" \
++		       "legacy program 'compress' is deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ 	$(am__post_remove_distdir)
+ 
+ dist-shar: distdir
+-	@echo WARNING: "Support for distribution archives compressed with" \
+-		       "legacy program 'compress' is deprecated." >&2
++	@echo WARNING: "Support for shar distribution archives is" \
++	               "deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ 	$(am__post_remove_distdir)
+@@ -1103,17 +1125,17 @@
+ 	esac
+ 	chmod -R a-w $(distdir)
+ 	chmod u+w $(distdir)
+-	mkdir $(distdir)/_build $(distdir)/_inst
++	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
+ 	chmod a-w $(distdir)
+ 	test -d $(distdir)/_build || exit 0; \
+ 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ 	  && am__cwd=`pwd` \
+-	  && $(am__cd) $(distdir)/_build \
+-	  && ../configure \
++	  && $(am__cd) $(distdir)/_build/sub \
++	  && ../../configure \
+ 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+-	    --srcdir=.. --prefix="$$dc_install_base" \
++	    --srcdir=../.. --prefix="$$dc_install_base" \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) check \
+@@ -1312,6 +1334,8 @@
+ 	uninstall-libibverbsincludeHEADERS uninstall-man \
+ 	uninstall-man1 uninstall-man3
+ 
++.PRECIOUS: Makefile
++
+ 
+ dist-hook: libibverbs.spec
+ 	cp libibverbs.spec $(distdir)
+diff -r 714ac8a9d237 aclocal.m4
+--- a/aclocal.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/aclocal.m4	Mon Feb 01 09:10:21 2016 -0800
+@@ -1,6 +1,6 @@
+-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
++# generated automatically by aclocal 1.15 -*- Autoconf -*-
+ 
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ 
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -20,7 +20,7 @@
+ If you have problems, you may need to regenerate the build system entirely.
+ To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+ 
+-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
++# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -32,10 +32,10 @@
+ # generated from the m4 files accompanying Automake X.Y.
+ # (This private macro should not be called outside this file.)
+ AC_DEFUN([AM_AUTOMAKE_VERSION],
+-[am__api_version='1.14'
++[am__api_version='1.15'
+ dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+ dnl require some minimum version.  Point them to the right macro.
+-m4_if([$1], [1.14.1], [],
++m4_if([$1], [1.15], [],
+       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+ ])
+ 
+@@ -51,14 +51,14 @@
+ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+ # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+-[AM_AUTOMAKE_VERSION([1.14.1])dnl
++[AM_AUTOMAKE_VERSION([1.15])dnl
+ m4_ifndef([AC_AUTOCONF_VERSION],
+   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+ 
+ # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -103,15 +103,14 @@
+ # configured tree to be moved without reconfiguration.
+ 
+ AC_DEFUN([AM_AUX_DIR_EXPAND],
+-[dnl Rely on autoconf to set up CDPATH properly.
+-AC_PREREQ([2.50])dnl
+-# expand $ac_aux_dir to an absolute path
+-am_aux_dir=`cd $ac_aux_dir && pwd`
++[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
++# Expand $ac_aux_dir to an absolute path.
++am_aux_dir=`cd "$ac_aux_dir" && pwd`
+ ])
+ 
+ # AM_CONDITIONAL                                            -*- Autoconf -*-
+ 
+-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
++# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -142,7 +141,7 @@
+ Usually this means the macro was only invoked conditionally.]])
+ fi])])
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -333,7 +332,7 @@
+ 
+ # Generate code to set up dependency tracking.              -*- Autoconf -*-
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -409,7 +408,7 @@
+ 
+ # Do all the work for Automake.                             -*- Autoconf -*-
+ 
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -499,8 +498,8 @@
+ # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+ # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+ AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+-# We need awk for the "check" target.  The system "awk" is bad on
+-# some platforms.
++# We need awk for the "check" target (and possibly the TAP driver).  The
++# system "awk" is bad on some platforms.
+ AC_REQUIRE([AC_PROG_AWK])dnl
+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+@@ -574,6 +573,9 @@
+     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+   fi
+ fi
++dnl The trailing newline in this macro's definition is deliberate, for
++dnl backward compatibility and to allow trailing 'dnl'-style comments
++dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+ ])
+ 
+ dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+@@ -603,7 +605,7 @@
+ done
+ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -614,7 +616,7 @@
+ # Define $install_sh.
+ AC_DEFUN([AM_PROG_INSTALL_SH],
+ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+-if test x"${install_sh}" != xset; then
++if test x"${install_sh+set}" != xset; then
+   case $am_aux_dir in
+   *\ * | *\	*)
+     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+@@ -624,7 +626,7 @@
+ fi
+ AC_SUBST([install_sh])])
+ 
+-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
++# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -645,7 +647,7 @@
+ 
+ # Check to see how 'make' treats includes.	            -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -695,7 +697,7 @@
+ 
+ # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+ 
+-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
++# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -734,7 +736,7 @@
+ 
+ # Helper functions for option handling.                     -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -763,7 +765,7 @@
+ AC_DEFUN([_AM_IF_OPTION],
+ [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -810,7 +812,7 @@
+ # For backward compatibility.
+ AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -829,7 +831,7 @@
+ 
+ # Check to make sure that the build environment is sane.    -*- Autoconf -*-
+ 
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -910,7 +912,7 @@
+ rm -f conftest.file
+ ])
+ 
+-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
++# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -970,7 +972,7 @@
+ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+ ])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -998,7 +1000,7 @@
+ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+ AC_SUBST([INSTALL_STRIP_PROGRAM])])
+ 
+-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
++# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -1017,7 +1019,7 @@
+ 
+ # Check how to create a tarball.                            -*- Autoconf -*-
+ 
+-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
++# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+diff -r 714ac8a9d237 configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Mon Feb 01 09:10:21 2016 -0800
+@@ -2285,7 +2285,7 @@
+ 
+ ac_config_headers="$ac_config_headers config.h"
+ 
+-am__api_version='1.14'
++am__api_version='1.15'
+ 
+ # Find a good install program.  We prefer a C program (faster),
+ # so one script is as good as another.  But avoid the broken or
+diff -r 714ac8a9d237 examples/device_list.c
+--- a/examples/device_list.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/device_list.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -36,16 +36,32 @@
+ 
+ #include <stdio.h>
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ 
++#include <stdlib.h>
++#include <string.h>
+ #include <infiniband/verbs.h>
+ #include <infiniband/arch.h>
+ 
++/*
++ * Structure to hold the data printed by ibv_devices.
++ */
++typedef struct dev_print_s {
++	char			name[24];
++	unsigned long long	guid;
++	uint8_t			is_pf;
++} dev_print_t;
++
+ int main(int argc, char *argv[])
+ {
+ 	struct ibv_device **dev_list;
+ 	int num_devices, i;
++	unsigned long long	guid_external;
++	dev_print_t	*dp;
++	int	print_col = 0;
+ 
+ 	dev_list = ibv_get_device_list(&num_devices);
+ 	if (!dev_list) {
+@@ -53,15 +69,45 @@
+ 		return 1;
+ 	}
+ 
+-	printf("    %-16s\t   node GUID\n", "device");
+-	printf("    %-16s\t----------------\n", "------");
++	dp = (dev_print_t *)malloc(sizeof(dev_print_t) * num_devices);
+ 
+-	for (i = 0; i < num_devices; ++i) {
+-		printf("    %-16s\t%016llx\n",
+-		       ibv_get_device_name(dev_list[i]),
+-		       (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i])));
++	for (i = (num_devices - 1); i >= 0; --i) {
++		strcpy(dp[i].name, ibv_get_device_name(dev_list[i]));
++
++		dp[i].guid = (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i]));
++		guid_external = (unsigned long long) ntohll(ibv_get_device_guid_external(dev_list[i]));
++		if (dp[i].guid != guid_external) {
++			print_col = 1;
++			dp[i].is_pf = 0;
++		} else
++			dp[i].is_pf = 1;
+ 	}
+ 
++	if (print_col) {
++		printf("    %-16s\t   node GUID\t        type\n", "device");
++		printf("    %-16s\t----------------\t----\n", "------");
++		/* First print PFs */
++		for (i = (num_devices - 1); i >= 0; --i) {
++			if (dp[i].is_pf)
++				printf("    %-16s\t%016llx\t %s\n",
++					dp[i].name, dp[i].guid, "PF");
++		}
++		/* print VFs */
++		for (i = (num_devices - 1); i >= 0; --i) {
++			if (!dp[i].is_pf)
++				printf("    %-16s\t%016llx\t %s\n",
++					dp[i].name, dp[i].guid, "VF");
++		}
++	} else {
++		printf("    %-16s\t   node GUID\n", "device");
++		printf("    %-16s\t----------------\n", "------");
++		for (i = (num_devices - 1); i >= 0; --i) {
++			printf("    %-16s\t%016llx\n",
++				dp[i].name, dp[i].guid);
++		}
++	}
++	free(dp);
++
+ 	ibv_free_device_list(dev_list);
+ 
+ 	return 0;
+diff -r 714ac8a9d237 examples/devinfo.c
+--- a/examples/devinfo.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/devinfo.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -41,8 +41,10 @@
+ #include <string.h>
+ #include <getopt.h>
+ #include <netinet/in.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ 
+ #include <infiniband/verbs.h>
+ #include <infiniband/driver.h>
+diff -r 714ac8a9d237 examples/rc_pingpong.c
+--- a/examples/rc_pingpong.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/rc_pingpong.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -156,8 +156,13 @@
+ 
+ 	n = getaddrinfo(servername, service, &hints, &res);
+ 
+-	if (n < 0) {
+-		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
++	if (n != 0) {
++		if (n == EAI_NONAME)
++			fprintf(stderr,
++			    "Name or service not known for %s:%d\n", servername, port);
++		else
++			fprintf(stderr,
++			    "%s for %s:%d\n", gai_strerror(n), servername, port);
+ 		free(service);
+ 		return NULL;
+ 	}
+@@ -233,7 +238,7 @@
+ 
+ 	n = getaddrinfo(NULL, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
+ 		free(service);
+ 		return NULL;
+diff -r 714ac8a9d237 examples/srq_pingpong.c
+--- a/examples/srq_pingpong.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/srq_pingpong.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -166,8 +166,13 @@
+ 
+ 	n = getaddrinfo(servername, service, &hints, &res);
+ 
+-	if (n < 0) {
+-		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
++	if (n != 0) {
++		if (n == EAI_NONAME)
++			fprintf(stderr,
++			    "Name or service not known for %s:%d\n", servername, port);
++		else
++			fprintf(stderr,
++			    "%s for %s:%d\n", gai_strerror(n), servername, port);
+ 		free(service);
+ 		return NULL;
+ 	}
+@@ -255,7 +260,7 @@
+ 
+ 	n = getaddrinfo(NULL, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
+ 		free(service);
+ 		return NULL;
+diff -r 714ac8a9d237 examples/uc_pingpong.c
+--- a/examples/uc_pingpong.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/uc_pingpong.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -144,7 +144,7 @@
+ 
+ 	n = getaddrinfo(servername, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
+ 		free(service);
+ 		return NULL;
+@@ -221,7 +221,7 @@
+ 
+ 	n = getaddrinfo(NULL, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
+ 		free(service);
+ 		return NULL;
+diff -r 714ac8a9d237 examples/ud_pingpong.c
+--- a/examples/ud_pingpong.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/ud_pingpong.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -144,8 +144,13 @@
+ 
+ 	n = getaddrinfo(servername, service, &hints, &res);
+ 
+-	if (n < 0) {
+-		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
++	if (n != 0) {
++		if (n == EAI_NONAME)
++			fprintf(stderr,
++			    "Name or service not known for %s:%d\n", servername, port);
++		else
++			fprintf(stderr,
++			    "%s for %s:%d\n", gai_strerror(n), servername, port);
+ 		free(service);
+ 		return NULL;
+ 	}
+@@ -220,7 +225,7 @@
+ 
+ 	n = getaddrinfo(NULL, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
+ 		free(service);
+ 		return NULL;
+diff -r 714ac8a9d237 include/infiniband/arch.h
+--- a/include/infiniband/arch.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/arch.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -34,6 +34,7 @@
+ #define INFINIBAND_ARCH_H
+ 
+ #include <stdint.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
+ 
+@@ -46,6 +47,9 @@
+ #else
+ #error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN
+ #endif
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ /*
+  * Architecture-specific defines.  Currently, an architecture is
+diff -r 714ac8a9d237 include/infiniband/driver.h
+--- a/include/infiniband/driver.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/driver.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -190,6 +190,10 @@
+ 			  struct ibv_recv_wr **bad_wr);
+ int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
+ 		      struct ibv_ah_attr *attr);
++int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah,
++			struct ibv_ah_attr *attr,
++			struct ibv_create_ah *cmd, size_t cmd_size,
++			struct ibv_create_ah_resp *resp, size_t resp_size);
+ int ibv_cmd_destroy_ah(struct ibv_ah *ah);
+ int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
+ int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
+diff -r 714ac8a9d237 include/infiniband/kern-abi.h
+--- a/include/infiniband/kern-abi.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/kern-abi.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -35,7 +35,11 @@
+ #ifndef KERN_ABI_H
+ #define KERN_ABI_H
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <linux/types.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ /*
+  * This file must be kept in sync with the kernel's version of
+@@ -199,6 +203,7 @@
+ struct ibv_query_device_resp {
+ 	__u64 fw_ver;
+ 	__u64 node_guid;
++	__u64 node_guid_external;
+ 	__u64 sys_image_guid;
+ 	__u64 max_mr_size;
+ 	__u64 page_size_cap;
+@@ -279,11 +284,13 @@
+ 	__u16 in_words;
+ 	__u16 out_words;
+ 	__u64 response;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+ struct ibv_alloc_pd_resp {
+ 	__u32 pd_handle;
++	__u32 reserved;
+ };
+ 
+ struct ibv_dealloc_pd {
+@@ -291,6 +298,8 @@
+ 	__u16 in_words;
+ 	__u16 out_words;
+ 	__u32 pd_handle;
++	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_open_xrcd {
+@@ -324,6 +333,7 @@
+ 	__u64 hca_va;
+ 	__u32 pd_handle;
+ 	__u32 access_flags;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -331,6 +341,7 @@
+ 	__u32 mr_handle;
+ 	__u32 lkey;
+ 	__u32 rkey;
++	__u32 reserved;
+ };
+ 
+ struct ibv_dereg_mr {
+@@ -338,6 +349,8 @@
+ 	__u16 in_words;
+ 	__u16 out_words;
+ 	__u32 mr_handle;
++	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_create_comp_channel {
+@@ -349,6 +362,7 @@
+ 
+ struct ibv_create_comp_channel_resp {
+ 	__u32 fd;
++	__u32 reserved;
+ };
+ 
+ struct ibv_create_cq {
+@@ -394,6 +408,7 @@
+ 	__u64 response;
+ 	__u32 cq_handle;
+ 	__u32 ne;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_poll_cq_resp {
+@@ -408,6 +423,7 @@
+ 	__u16 out_words;
+ 	__u32 cq_handle;
+ 	__u32 solicited;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_resize_cq {
+@@ -417,6 +433,7 @@
+ 	__u64 response;
+ 	__u32 cq_handle;
+ 	__u32 cqe;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -433,6 +450,7 @@
+ 	__u64 response;
+ 	__u32 cq_handle;
+ 	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_destroy_cq_resp {
+@@ -567,6 +585,7 @@
+ 	__u64 response;
+ 	__u32 qp_handle;
+ 	__u32 attr_mask;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -634,6 +653,7 @@
+ 	__u8  alt_port_num;
+ 	__u8  alt_timeout;
+ 	__u8  reserved[2];
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -644,10 +664,12 @@
+ 	__u64 response;
+ 	__u32 qp_handle;
+ 	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_destroy_qp_resp {
+ 	__u32 events_reported;
++	__u32 reserved;
+ };
+ 
+ struct ibv_kern_send_wr {
+@@ -767,6 +789,7 @@
+ 
+ struct ibv_post_send_resp {
+ 	__u32 bad_wr;
++	__u32 reserved;
+ };
+ 
+ struct ibv_kern_recv_wr {
+@@ -789,6 +812,7 @@
+ 
+ struct ibv_post_recv_resp {
+ 	__u32 bad_wr;
++	__u32 reserved;
+ };
+ 
+ struct ibv_post_srq_recv {
+@@ -805,6 +829,7 @@
+ 
+ struct ibv_post_srq_recv_resp {
+ 	__u32 bad_wr;
++	__u32 reserved;
+ };
+ 
+ struct ibv_create_ah {
+@@ -820,6 +845,7 @@
+ 
+ struct ibv_create_ah_resp {
+ 	__u32 handle;
++	__u32 reserved;
+ };
+ 
+ struct ibv_destroy_ah {
+@@ -827,6 +853,8 @@
+ 	__u16 in_words;
+ 	__u16 out_words;
+ 	__u32 ah_handle;
++	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_attach_mcast {
+@@ -837,6 +865,7 @@
+ 	__u32 qp_handle;
+ 	__u16 mlid;
+ 	__u16 reserved;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -866,6 +895,7 @@
+ 	__u32 qp_handle;
+ 	__u16 mlid;
+ 	__u16 reserved;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -914,6 +944,7 @@
+ 	__u32 attr_mask;
+ 	__u32 max_wr;
+ 	__u32 srq_limit;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -924,6 +955,7 @@
+ 	__u64 response;
+ 	__u32 srq_handle;
+ 	__u32 reserved;
++	__u64 user_handle;
+ 	__u64 driver_data[0];
+ };
+ 
+@@ -941,10 +973,12 @@
+ 	__u64 response;
+ 	__u32 srq_handle;
+ 	__u32 reserved;
++	__u64 user_handle;
+ };
+ 
+ struct ibv_destroy_srq_resp {
+ 	__u32 events_reported;
++	__u32 reserved;
+ };
+ 
+ /*
+diff -r 714ac8a9d237 include/infiniband/sa-kern-abi.h
+--- a/include/infiniband/sa-kern-abi.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/sa-kern-abi.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -33,7 +33,11 @@
+ #ifndef INFINIBAND_SA_KERN_ABI_H
+ #define INFINIBAND_SA_KERN_ABI_H
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <linux/types.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ /*
+  * Obsolete, deprecated names.  Will be removed in libibverbs 1.1.
+diff -r 714ac8a9d237 include/infiniband/verbs.h
+--- a/include/infiniband/verbs.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/infiniband/verbs.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -40,6 +40,9 @@
+ #include <pthread.h>
+ #include <stddef.h>
+ #include <errno.h>
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #ifdef __cplusplus
+ #  define BEGIN_C_DECLS extern "C" {
+@@ -128,6 +131,7 @@
+ struct ibv_device_attr {
+ 	char			fw_ver[64];
+ 	uint64_t		node_guid;
++	uint64_t		node_guid_external;
+ 	uint64_t		sys_image_guid;
+ 	uint64_t		max_mr_size;
+ 	uint64_t		page_size_cap;
+@@ -498,6 +502,14 @@
+ 	uint32_t		max_inline_data;
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * The 31st bit of sq_sig_all is set for QPs allocated
++ * using librdmacm. Consumers use sq_sig_all 0 /1.
++ */
++#define LIB_RDMACM_QP_BIT	0x8000
++#endif
++
+ struct ibv_qp_init_attr {
+ 	void		       *qp_context;
+ 	struct ibv_cq	       *send_cq;
+@@ -859,6 +871,7 @@
+ 	char			dev_path[IBV_SYSFS_PATH_MAX];
+ 	/* Path to infiniband class device in sysfs */
+ 	char			ibdev_path[IBV_SYSFS_PATH_MAX];
++	uint                    blueflame_enabled;
+ };
+ 
+ struct verbs_device {
+@@ -934,6 +947,13 @@
+ 	struct ibv_device      *device;
+ 	struct ibv_context_ops	ops;
+ 	int			cmd_fd;
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Solaris user libraries use this FD for mmap operations. It is an
++	 * open to the underlying kernel hardware specific driver.
++	 */
++	int			mmap_fd;
++#endif
+ 	int			async_fd;
+ 	int			num_comp_vectors;
+ 	pthread_mutex_t		mutex;
+@@ -1028,6 +1048,11 @@
+ uint64_t ibv_get_device_guid(struct ibv_device *device);
+ 
+ /**
++ * ibv_get_device_guid_external - Return device's node external GUID
++ */
++uint64_t ibv_get_device_guid_external(struct ibv_device *device);
++
++/**
+  * ibv_open_device - Initialize device for use
+  */
+ struct ibv_context *ibv_open_device(struct ibv_device *device);
+diff -r 714ac8a9d237 man/ibv_devices.1
+--- a/man/ibv_devices.1	Wed Oct 14 12:54:37 2015 -0700
++++ b/man/ibv_devices.1	Mon Feb 01 09:10:21 2016 -0800
+@@ -10,6 +10,35 @@
+ .PP
+ List RDMA devices available for use from userspace.
+ 
++On SR-IOV capable systems, if a domain is configured with
++VFs (Virtual Function), ibv_devices lists for each IB device
++the node GUID and the type (PF or VF).  In this case, the PF
++devices are displayed before the VF devices.  The following
++shows the results of running ibv_devices on a domain with
++one PF and two VFs:
++
++    device                 node GUID            type
++    ------              ----------------        ----
++    mlx4_2              00212800013f3126         PF
++    mlx4_0              00212d00013f3126         VF
++    mlx4_1              00212900013f3126         VF
++
++If all of the IB devices are PFs, only node GUIDs are
++listed.  The following shows the results of running
++ibv_devices on a domain with one PF and no VFs:
++
++    device                 node GUID
++    ------              ----------------
++    mlx4_0              00212800013f3126
++
++On systems which are not SR-IOV capable only node GUIDs are
++listed.
++
++    device                 node GUID
++    ------              ----------------
++    mlx4_0              0021280001a0e4d8
++    mlx4_1              0021280001a0e754
++
+ .SH SEE ALSO
+ .BR ibv_devinfo (1)
+ 
+diff -r 714ac8a9d237 src/cmd.c
+--- a/src/cmd.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/cmd.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -42,24 +42,81 @@
+ #include <errno.h>
+ #include <alloca.h>
+ #include <string.h>
++#if defined(__SVR4) && defined(__sun)
++#include <fcntl.h>
++#include <sys/stat.h>
++#include <sys/mkdev.h>
++#endif
+ 
+ #include "ibverbs.h"
+ 
++#if defined(__SVR4) && defined(__sun)
++extern int ibv_open_mmap_driver(char *dev_name);
++
++/*
++ * Event file creation for GET_CONTEXT & CREATE_COMP_CHANNEL :
++ * 	Solaris Uverbs driver supports creation of event file
++ * 	from the open(2) system call only. Event file will not
++ * 	be created by the write(2) syscall, for the above commands
++ *	as in Linux OFED.
++ *
++ * Sequence of operations for GET_CONTEXT &  CREATE_COMP_CHANNEL :
++ *	event_fd = open(UVERBS_EVENT_FILE, O_RDWR);
++ *	fstat(event_fd, &fstat_buf);
++ *	NOTE : Minor number of event file passed to driver 
++ *	cmd.resp.fd = minor(fstat_buf.st_rdev);
++ *	write(verbs_fd);
++ *	NOTE : Initialize the fd to one got by opening event file
++ *	cmd.resp.fd = event_fd;
++ */
++#endif
+ 
+ int ibv_cmd_get_context(struct ibv_context *context, struct ibv_get_context *cmd,
+ 			size_t cmd_size, struct ibv_get_context_resp *resp,
+ 			size_t resp_size)
+ {
++#if defined(__SVR4) && defined(__sun)
++	int			event_fd;
++	struct stat		fstat_buf;
++#endif
+ 	if (abi_ver < IB_USER_VERBS_MIN_ABI_VERSION)
+ 		return ENOSYS;
+ 
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
++#if defined(__SVR4) && defined(__sun)
++	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
++	if (event_fd < 0)
++		return (errno);	
++	if (fstat(event_fd, &fstat_buf))
++		return (errno);
++	resp->async_fd = minor(fstat_buf.st_rdev);
+ 
++	/*
++	 * Open the underlying kernel hardware driver that will
++	 * provide the mmap function for this context.
++	 */
++	context->mmap_fd = ibv_open_mmap_driver(context->device->dev_name);
++	if (context->mmap_fd < 0) {
++		fprintf(stderr, PFX "ibv_cmd_get_context: Mmap open failed\n");
++	}
++#endif
+ 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
+ 		return errno;
++#if defined(__SVR4) && defined(__sun)
++	resp->async_fd = event_fd;
++#endif
+ 
+ 	(void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ 
++#if defined(__SVR4) && defined(__sun)
++	/* We don't support parent-child sharing of IB resources on Solaris */
++	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
++		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed: %s\n",
++		    strerror(errno));
++		return errno;
++	}
++#endif
++
+ 	context->async_fd         = resp->async_fd;
+ 	context->num_comp_vectors = resp->num_comp_vectors;
+ 
+@@ -83,6 +140,7 @@
+ 	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
+ 	*raw_fw_ver			       = resp.fw_ver;
+ 	device_attr->node_guid 		       = resp.node_guid;
++	device_attr->node_guid_external	       = resp.node_guid_external;
+ 	device_attr->sys_image_guid 	       = resp.sys_image_guid;
+ 	device_attr->max_mr_size 	       = resp.max_mr_size;
+ 	device_attr->page_size_cap 	       = resp.page_size_cap;
+@@ -170,6 +228,8 @@
+ {
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size);
+ 
++	cmd->user_handle     = (uintptr_t) pd;
++
+ 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
+ 		return errno;
+ 
+@@ -187,6 +247,7 @@
+ 
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD);
+ 	cmd.pd_handle = pd->handle;
++	cmd.user_handle = (uintptr_t) pd;
+ 
+ 	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -252,6 +313,7 @@
+ 	cmd->length 	  = length;
+ 	cmd->hca_va 	  = hca_va;
+ 	cmd->pd_handle 	  = pd->handle;
++	cmd->user_handle  = (uintptr_t) mr;
+ 	cmd->access_flags = access;
+ 
+ 	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
+@@ -273,6 +335,7 @@
+ 
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR);
+ 	cmd.mr_handle = mr->handle;
++	cmd.user_handle  = (uintptr_t) mr;
+ 
+ 	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -290,7 +353,19 @@
+ 	cmd->user_handle   = (uintptr_t) cq;
+ 	cmd->cqe           = cqe;
+ 	cmd->comp_vector   = comp_vector;
++#if defined(__SVR4) && defined(__sun)
++	if (channel) {
++		struct stat	fstat_buf;
++
++		if (fstat(channel->fd, &fstat_buf))
++			return (errno);
++		else
++			cmd->comp_channel = minor(fstat_buf.st_rdev);
++	} else 
++		cmd->comp_channel = 0;
++#else
+ 	cmd->comp_channel  = channel ? channel->fd : -1;
++#endif
+ 	cmd->reserved      = 0;
+ 
+ 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
+@@ -321,6 +396,7 @@
+ 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize);
+ 	cmd.cq_handle = ibcq->handle;
+ 	cmd.ne        = ne;
++	cmd.user_handle  = (uintptr_t) ibcq;
+ 
+ 	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
+ 		ret = -1;
+@@ -359,6 +435,7 @@
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ);
+ 	cmd.cq_handle = ibcq->handle;
+ 	cmd.solicited = !!solicited_only;
++	cmd.user_handle  = (uintptr_t) ibcq;
+ 
+ 	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -373,6 +450,7 @@
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
+ 	cmd->cq_handle = cq->handle;
+ 	cmd->cqe       = cqe;
++	cmd->user_handle   = (uintptr_t) cq;
+ 
+ 	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
+ 		return errno;
+@@ -392,6 +470,7 @@
+ 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp);
+ 	cmd.cq_handle = cq->handle;
+ 	cmd.reserved  = 0;
++	cmd.user_handle  = (uintptr_t) cq;
+ 
+ 	if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -516,7 +595,6 @@
+ 	return 0;
+ }
+ 
+-
+ static int ibv_cmd_modify_srq_v3(struct ibv_srq *srq,
+ 				 struct ibv_srq_attr *srq_attr,
+ 				 int srq_attr_mask,
+@@ -560,6 +638,7 @@
+ 	cmd->attr_mask	= srq_attr_mask;
+ 	cmd->max_wr	= srq_attr->max_wr;
+ 	cmd->srq_limit	= srq_attr->srq_limit;
++	cmd->user_handle   = (uintptr_t) srq;
+ 
+ 	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
+ 		return errno;
+@@ -574,6 +653,7 @@
+ 
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
+ 	cmd->srq_handle = srq->handle;
++	cmd->user_handle   = (uintptr_t) srq;
+ 	cmd->reserved   = 0;
+ 
+ 	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
+@@ -595,6 +675,7 @@
+ 
+ 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp);
+ 	cmd.srq_handle = srq->handle;
++	cmd.user_handle  = (uintptr_t) srq;
+ 	cmd.reserved   = 0;
+ 
+ 	if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+@@ -646,7 +727,18 @@
+ 	cmd->max_send_sge    = attr_ex->cap.max_send_sge;
+ 	cmd->max_recv_sge    = attr_ex->cap.max_recv_sge;
+ 	cmd->max_inline_data = attr_ex->cap.max_inline_data;
++#if defined(__SVR4) && defined(__sun)
++	if (attr_ex->sq_sig_all & LIB_RDMACM_QP_BIT) {
++		cmd->sq_sig_all =
++		    (uint8_t)(attr_ex->sq_sig_all & ~LIB_RDMACM_QP_BIT);
++		cmd->sq_sig_all |= 0x80;
++		attr_ex->sq_sig_all &= ~LIB_RDMACM_QP_BIT;
++	} else {
++		cmd->sq_sig_all = (uint8_t)attr_ex->sq_sig_all;
++	}
++#else
+ 	cmd->sq_sig_all	     = attr_ex->sq_sig_all;
++#endif
+ 	cmd->qp_type         = attr_ex->qp_type;
+ 	cmd->is_srq	     = !!attr_ex->srq;
+ 	cmd->reserved	     = 0;
+@@ -721,7 +813,20 @@
+ 	cmd->max_send_sge    = attr->cap.max_send_sge;
+ 	cmd->max_recv_sge    = attr->cap.max_recv_sge;
+ 	cmd->max_inline_data = attr->cap.max_inline_data;
++
++#if defined(__SVR4) && defined(__sun)
++	if (attr->sq_sig_all & LIB_RDMACM_QP_BIT) {
++		cmd->sq_sig_all =
++		    (uint8_t)(attr->sq_sig_all & ~LIB_RDMACM_QP_BIT);
++		cmd->sq_sig_all |= 0x80;
++		attr->sq_sig_all &= ~LIB_RDMACM_QP_BIT;
++	} else {
++		cmd->sq_sig_all = (uint8_t)attr->sq_sig_all;
++	}
++#else
+ 	cmd->sq_sig_all	     = attr->sq_sig_all;
++#endif
++
+ 	cmd->qp_type 	     = attr->qp_type;
+ 	cmd->is_srq 	     = !!attr->srq;
+ 	cmd->reserved	     = 0;
+@@ -822,6 +927,7 @@
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp);
+ 	cmd->qp_handle = qp->handle;
+ 	cmd->attr_mask = attr_mask;
++	cmd->user_handle   = (uintptr_t) qp;
+ 
+ 	if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
+ 		return errno;
+@@ -901,6 +1007,7 @@
+ 	IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP);
+ 
+ 	cmd->qp_handle 		 = qp->handle;
++	cmd->user_handle   	 = (uintptr_t) qp;
+ 	cmd->attr_mask 		 = attr_mask;
+ 	cmd->qkey 		 = attr->qkey;
+ 	cmd->rq_psn 		 = attr->rq_psn;
+@@ -1170,36 +1277,45 @@
+ 	return ret;
+ }
+ 
++int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr,
++			 struct ibv_create_ah *cmd, size_t cmd_size,
++			 struct ibv_create_ah_resp *resp, size_t resp_size)
++{
++	IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size);
++	cmd->user_handle            = (uintptr_t) ah;
++	cmd->pd_handle              = pd->handle;
++	cmd->reserved               = 0;
++	cmd->attr.dlid              = attr->dlid;
++	cmd->attr.sl                = attr->sl;
++	cmd->attr.src_path_bits     = attr->src_path_bits;
++	cmd->attr.static_rate       = attr->static_rate;
++	cmd->attr.is_global         = attr->is_global;
++	cmd->attr.port_num          = attr->port_num;
++	cmd->attr.grh.flow_label    = attr->grh.flow_label;
++	cmd->attr.grh.sgid_index    = attr->grh.sgid_index;
++	cmd->attr.grh.hop_limit     = attr->grh.hop_limit;
++	cmd->attr.grh.traffic_class = attr->grh.traffic_class;
++	cmd->attr.grh.reserved      = 0;
++	cmd->attr.reserved          = 0;
++	memcpy(cmd->attr.grh.dgid, attr->grh.dgid.raw, 16);
++
++	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
++		return errno;
++
++	(void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
++
++	ah->handle  = resp->handle;
++	ah->context = pd->context;
++
++	return 0;
++}
++
+ int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
+ 		      struct ibv_ah_attr *attr)
+ {
+ 	struct ibv_create_ah      cmd;
+ 	struct ibv_create_ah_resp resp;
+-
+-	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, &resp, sizeof resp);
+-	cmd.user_handle            = (uintptr_t) ah;
+-	cmd.pd_handle              = pd->handle;
+-	cmd.attr.dlid              = attr->dlid;
+-	cmd.attr.sl                = attr->sl;
+-	cmd.attr.src_path_bits     = attr->src_path_bits;
+-	cmd.attr.static_rate       = attr->static_rate;
+-	cmd.attr.is_global         = attr->is_global;
+-	cmd.attr.port_num          = attr->port_num;
+-	cmd.attr.grh.flow_label    = attr->grh.flow_label;
+-	cmd.attr.grh.sgid_index    = attr->grh.sgid_index;
+-	cmd.attr.grh.hop_limit     = attr->grh.hop_limit;
+-	cmd.attr.grh.traffic_class = attr->grh.traffic_class;
+-	memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16);
+-
+-	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+-		return errno;
+-
+-	(void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+-
+-	ah->handle  = resp.handle;
+-	ah->context = pd->context;
+-
+-	return 0;
++	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp, sizeof(resp));
+ }
+ 
+ int ibv_cmd_destroy_ah(struct ibv_ah *ah)
+@@ -1208,6 +1324,7 @@
+ 
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, DESTROY_AH);
+ 	cmd.ah_handle = ah->handle;
++	cmd.user_handle            = (uintptr_t) ah;
+ 
+ 	if (write(ah->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -1223,6 +1340,7 @@
+ 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp);
+ 	cmd.qp_handle = qp->handle;
+ 	cmd.reserved  = 0;
++	cmd.user_handle  = (uintptr_t) qp;
+ 
+ 	if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
+ 		return errno;
+@@ -1244,6 +1362,7 @@
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST);
+ 	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
+ 	cmd.qp_handle = qp->handle;
++	cmd.user_handle  = (uintptr_t) qp;
+ 	cmd.mlid      = lid;
+ 	cmd.reserved  = 0;
+ 
+@@ -1260,6 +1379,7 @@
+ 	IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST);
+ 	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
+ 	cmd.qp_handle = qp->handle;
++	cmd.user_handle  = (uintptr_t) qp;
+ 	cmd.mlid      = lid;
+ 	cmd.reserved  = 0;
+ 
+diff -r 714ac8a9d237 src/device.c
+--- a/src/device.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/device.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -122,6 +122,28 @@
+ }
+ default_symver(__ibv_get_device_guid, ibv_get_device_guid);
+ 
++uint64_t __ibv_get_device_guid_external(struct ibv_device *device)
++{
++	char attr[24];
++	uint64_t guid = 0;
++	uint16_t parts[4];
++	int i;
++
++	if (ibv_read_sysfs_file(device->ibdev_path, "node_guid_external",
++				attr, sizeof attr) < 0)
++		return 0;
++
++	if (sscanf(attr, "%hx:%hx:%hx:%hx",
++		   parts, parts + 1, parts + 2, parts + 3) != 4)
++		return 0;
++
++	for (i = 0; i < 4; ++i)
++		guid = (guid << 16) | parts[i];
++
++	return htonll(guid);
++}
++default_symver(__ibv_get_device_guid_external, ibv_get_device_guid_external);
++
+ struct ibv_context *__ibv_open_device(struct ibv_device *device)
+ {
+ 	struct verbs_device *verbs_device = verbs_get_device(device);
+@@ -130,8 +152,13 @@
+ 	struct ibv_context *context;
+ 	struct verbs_context *context_ex;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	if (asprintf(&devpath, "/dev/infiniband/%s", device->dev_name) < 0)
+ 		return NULL;
++#else
++	if (asprintf(&devpath, "/dev/infiniband/ofs/%s", device->dev_name) < 0)
++		return NULL;
++#endif		
+ 
+ 	/*
+ 	 * We'll only be doing writes, but we need O_RDWR in case the
+@@ -143,6 +170,14 @@
+ 	if (cmd_fd < 0)
+ 		return NULL;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/* We don't support parent-child sharing of IB resources on Solaris */
++	if (fcntl(cmd_fd, F_SETFD, FD_CLOEXEC) < 0) {
++		fprintf(stderr, "ibv_open_device: FD_CLOEXEC failed: %s\n",
++		    strerror(errno));
++		goto err;
++	}
++#endif
+ 	if (!verbs_device) {
+ 		context = device->ops.alloc_context(device, cmd_fd);
+ 		if (!context)
+@@ -195,6 +230,9 @@
+ 	int cmd_fd   = context->cmd_fd;
+ 	int cq_fd    = -1;
+ 	struct verbs_context *context_ex;
++#if defined(__SVR4) && defined(__sun)
++	int mmap_fd   = context->mmap_fd;
++#endif
+ 
+ 	context_ex = verbs_get_ctx(context);
+ 	if (context_ex) {
+@@ -205,6 +243,11 @@
+ 		context->device->ops.free_context(context);
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	if (mmap_fd > 0) {
++		close(mmap_fd);
++	}
++#endif
+ 	close(async_fd);
+ 	close(cmd_fd);
+ 	if (abi_ver <= 2)
+diff -r 714ac8a9d237 src/ibverbs.h
+--- a/src/ibverbs.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/ibverbs.h	Mon Feb 01 09:10:21 2016 -0800
+@@ -52,7 +52,12 @@
+ #  define VALGRIND_MAKE_MEM_DEFINED(addr, len) 0
+ #endif
+ 
+-#define HIDDEN		__attribute__((visibility ("hidden")))
++#if defined(__SVR4) && defined(__sun)
++#define	HIDDEN
++#undef HAVE_SYMVER_SUPPORT
++#else
++#define	HIDDEN		__attribute__((visibility ("hidden")))
++#endif
+ 
+ #define INIT		__attribute__((constructor))
+ #define FINI		__attribute__((destructor))
+diff -r 714ac8a9d237 src/init.c
+--- a/src/init.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/init.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -78,8 +78,13 @@
+ static struct ibv_driver_name *driver_name_list;
+ static struct ibv_driver *head_driver, *tail_driver;
+ 
++static uint blueflame_enabled = 0;
++
+ static int find_sysfs_devs(void)
+ {
++#if defined(__SVR4) && defined(__sun)
++	char device_path[IBV_SYSFS_PATH_MAX];
++#endif
+ 	char class_path[IBV_SYSFS_PATH_MAX];
+ 	DIR *class_dir;
+ 	struct dirent *dent;
+@@ -87,19 +92,35 @@
+ 	char value[8];
+ 	int ret = 0;
+ 
++#if defined(__SVR4) && defined(__sun)
++	snprintf(device_path, sizeof device_path, "/dev/infiniband/ofs");
++#endif
+ 	snprintf(class_path, sizeof class_path, "%s/class/infiniband_verbs",
+ 		 ibv_get_sysfs_path());
+ 
++#if defined(__SVR4) && defined(__sun)
++	class_dir = opendir(device_path);
++#else
+ 	class_dir = opendir(class_path);
++#endif
+ 	if (!class_dir)
+ 		return ENOSYS;
+ 
+ 	while ((dent = readdir(class_dir))) {
++#if defined(__SVR4) && defined(__sun)
++		int adapter_num;
++#else
+ 		struct stat buf;
++#endif
+ 
+ 		if (dent->d_name[0] == '.')
+ 			continue;
+ 
++#if defined(__SVR4) && defined(__sun)
++		if (sscanf(dent->d_name, "uverbs%d",
++		    &adapter_num) != 1)
++			continue;
++#endif
+ 		if (!sysfs_dev)
+ 			sysfs_dev = malloc(sizeof *sysfs_dev);
+ 		if (!sysfs_dev) {
+@@ -110,6 +131,7 @@
+ 		snprintf(sysfs_dev->sysfs_path, sizeof sysfs_dev->sysfs_path,
+ 			 "%s/%s", class_path, dent->d_name);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 		if (stat(sysfs_dev->sysfs_path, &buf)) {
+ 			fprintf(stderr, PFX "Warning: couldn't stat '%s'.\n",
+ 				sysfs_dev->sysfs_path);
+@@ -118,6 +140,7 @@
+ 
+ 		if (!S_ISDIR(buf.st_mode))
+ 			continue;
++#endif
+ 
+ 		snprintf(sysfs_dev->sysfs_name, sizeof sysfs_dev->sysfs_name,
+ 			"%s", dent->d_name);
+@@ -296,6 +319,13 @@
+ 
+ 			driver_name->next = driver_name_list;
+ 			driver_name_list  = driver_name;
++		} else if (strcmp(field, "blueflame") == 0) {
++			config += strspn(config, "\t ");
++			field = strsep(&config, "\n\t ");
++			if (strcmp(field, "enable") == 0)
++				blueflame_enabled = 1;
++			if (strcmp(field, "disable") == 0)
++				blueflame_enabled = 0;
+ 		} else
+ 			fprintf(stderr, PFX "Warning: ignoring bad config directive "
+ 				"'%s' in file '%s'.\n", field, path);
+@@ -401,6 +431,7 @@
+ 	strcpy(dev->dev_path,   sysfs_dev->sysfs_path);
+ 	strcpy(dev->name,       sysfs_dev->ibdev_name);
+ 	strcpy(dev->ibdev_path, sysfs_dev->ibdev_path);
++	dev->blueflame_enabled = blueflame_enabled;
+ 
+ 	return dev;
+ }
+@@ -443,6 +474,7 @@
+ 
+ static void check_memlock_limit(void)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	struct rlimit rlim;
+ 
+ 	if (!geteuid())
+@@ -457,6 +489,7 @@
+ 		fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %lu bytes.\n"
+ 			"    This will severely limit memory registrations.\n",
+ 			rlim.rlim_cur);
++#endif
+ }
+ 
+ static void add_device(struct ibv_device *dev,
+diff -r 714ac8a9d237 src/libibverbs.map
+--- a/src/libibverbs.map	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/libibverbs.map	Mon Feb 01 09:10:21 2016 -0800
+@@ -73,6 +73,7 @@
+ 		mult_to_ibv_rate;
+ 		ibv_get_sysfs_path;
+ 		ibv_read_sysfs_file;
++		sol_get_cpu_info;
+ 
+ 	local: *;
+ };
+diff -r 714ac8a9d237 src/sysfs.c
+--- a/src/sysfs.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/sysfs.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -44,6 +44,10 @@
+ 
+ #include "ibverbs.h"
+ 
++#if defined(__SVR4) && defined(__sun)
++int sol_read_sysfs_file(char *path, char *buf, size_t size);
++#endif
++
+ static char *sysfs_path;
+ 
+ const char *ibv_get_sysfs_path(void)
+@@ -79,12 +83,18 @@
+ 			char *buf, size_t size)
+ {
+ 	char *path;
++#if !(defined(__SVR4) && defined(__sun))
+ 	int fd;
++#endif
+ 	int len;
+ 
+ 	if (asprintf(&path, "%s/%s", dir, file) < 0)
+ 		return -1;
+ 
++#if defined(__SVR4) && defined(__sun)
++	len = sol_read_sysfs_file(path, buf, size);
++	free(path);
++#else
+ 	fd = open(path, O_RDONLY | O_CLOEXEC);
+ 	if (fd < 0) {
+ 		free(path);
+@@ -98,6 +108,7 @@
+ 
+ 	if (len > 0 && buf[len - 1] == '\n')
+ 		buf[--len] = '\0';
++#endif
+ 
+ 	return len;
+ }
+diff -r 714ac8a9d237 src/verbs.c
+--- a/src/verbs.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/verbs.c	Mon Feb 01 09:10:21 2016 -0800
+@@ -41,6 +41,11 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <string.h>
++#if defined(__SVR4) && defined(__sun)
++#include <fcntl.h>
++#include <sys/stat.h>
++#include <sys/mkdev.h>
++#endif
+ 
+ #include "ibverbs.h"
+ 
+@@ -141,6 +146,12 @@
+ int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
+ 		    int index, union ibv_gid *gid)
+ {
++#if defined(__SVR4) && defined(__sun)
++	extern int sol_ibv_query_gid();
++
++	return sol_ibv_query_gid(context, port_num, index, gid);
++
++#else
+ 	char name[24];
+ 	char attr[41];
+ 	uint16_t val;
+@@ -160,12 +171,19 @@
+ 	}
+ 
+ 	return 0;
++#endif
+ }
+ default_symver(__ibv_query_gid, ibv_query_gid);
+ 
+ int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
+ 		     int index, uint16_t *pkey)
+ {
++#if defined(__SVR4) && defined(__sun)
++	extern int sol_ibv_query_pkey();
++
++	return sol_ibv_query_pkey(context, port_num, index, pkey);
++
++#else
+ 	char name[24];
+ 	char attr[8];
+ 	uint16_t val;
+@@ -181,6 +199,7 @@
+ 
+ 	*pkey = htons(val);
+ 	return 0;
++#endif
+ }
+ default_symver(__ibv_query_pkey, ibv_query_pkey);
+ 
+@@ -260,6 +279,10 @@
+ 	struct ibv_comp_channel            *channel;
+ 	struct ibv_create_comp_channel      cmd;
+ 	struct ibv_create_comp_channel_resp resp;
++#if defined(__SVR4) && defined(__sun)
++	int		event_fd;
++	struct stat	fstat_buf;
++#endif
+ 
+ 	if (abi_ver <= 2)
+ 		return ibv_create_comp_channel_v2(context);
+@@ -269,13 +292,32 @@
+ 		return NULL;
+ 
+ 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_COMP_CHANNEL, &resp, sizeof resp);
++#if defined(__SVR4) && defined(__sun)
++	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
++	if (event_fd < 0) {
++		free(channel);
++		return NULL;
++	}
++
++	if (fstat(event_fd, &fstat_buf)) {
++		free(channel);
++		return NULL;
++	}
++	resp.fd = minor(fstat_buf.st_rdev);
++#endif
+ 	if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
++#if defined(__SVR4) && defined(__sun)
++		close(event_fd);
++#endif
+ 		free(channel);
+ 		return NULL;
+ 	}
+ 
+ 	(void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ 
++#if defined(__SVR4) && defined(__sun)
++	resp.fd = event_fd;
++#endif
+ 	channel->context = context;
+ 	channel->fd      = resp.fd;
+ 	channel->refcnt  = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/patches/002-libibverbs-shpd_fmr.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,2810 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# User [email protected]
+# Parent  688b7fd31600bd6dd04f6f7bf85df804730410e8
+Shared PD and FMR specific patch.
+
+diff -r 688b7fd31600 Makefile.am
+--- a/Makefile.am	Tue Nov 24 11:26:20 2015 -0800
++++ b/Makefile.am	Tue Nov 24 20:12:48 2015 -0800
+@@ -11,24 +11,29 @@
+ 
+ src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
+ 			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
+-			    src/enum_strs.c src/solaris_compatibility.c
++			    src/enum_strs.c
+ src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
+     $(libibverbs_version_script)
+ src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map
+ 
+ bin_PROGRAMS = examples/ibv_devices examples/ibv_devinfo \
++    examples/ibv_frc_pingpong examples/ibv_shpd_pingpong \
+     examples/ibv_asyncwatch examples/ibv_rc_pingpong examples/ibv_uc_pingpong \
+     examples/ibv_ud_pingpong examples/ibv_srq_pingpong examples/ibv_xsrq_pingpong
+ examples_ibv_devices_SOURCES = examples/device_list.c
+ examples_ibv_devices_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_devinfo_SOURCES = examples/devinfo.c
+ examples_ibv_devinfo_LDADD = $(top_builddir)/src/libibverbs.la
++examples_ibv_frc_pingpong_SOURCES = examples/frc_pingpong.c examples/pingpong.c
++examples_ibv_frc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_rc_pingpong_SOURCES = examples/rc_pingpong.c examples/pingpong.c
+ examples_ibv_rc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_uc_pingpong_SOURCES = examples/uc_pingpong.c examples/pingpong.c
+ examples_ibv_uc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_ud_pingpong_SOURCES = examples/ud_pingpong.c examples/pingpong.c
+ examples_ibv_ud_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
++examples_ibv_shpd_pingpong_SOURCES = examples/shpd_pingpong.c examples/pingpong.c
++examples_ibv_shpd_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_srq_pingpong_SOURCES = examples/srq_pingpong.c examples/pingpong.c
+ examples_ibv_srq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_xsrq_pingpong_SOURCES = examples/xsrq_pingpong.c examples/pingpong.c
+@@ -40,9 +45,10 @@
+ 
+ libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
+     include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
+-    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
++    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
+ 
+ man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
++    man/ibv_shpd_pingpong.1			\
+     man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
+     man/ibv_srq_pingpong.1 man/ibv_alloc_pd.3 man/ibv_attach_mcast.3	\
+     man/ibv_create_ah.3 man/ibv_create_ah_from_wc.3			\
+@@ -67,7 +73,6 @@
+ 
+ EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
+     include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
+-    include/infiniband/ofa_solaris.h \
+     include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
+     src/ibverbs.h examples/pingpong.h \
+     src/libibverbs.map libibverbs.spec.in $(man_MANS)
+diff -r 688b7fd31600 Makefile.in
+--- a/Makefile.in	Tue Nov 24 11:26:20 2015 -0800
++++ b/Makefile.in	Tue Nov 24 20:12:48 2015 -0800
+@@ -1,7 +1,7 @@
+-# Makefile.in generated by automake 1.15 from Makefile.am.
++# Makefile.in generated by automake 1.14.1 from Makefile.am.
+ # @configure_input@
+ 
+-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
++# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+ 
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -17,17 +17,7 @@
+ 
+ 
+ VPATH = @srcdir@
+-am__is_gnu_make = { \
+-  if test -z '$(MAKELEVEL)'; then \
+-    false; \
+-  elif test -n '$(MAKE_HOST)'; then \
+-    true; \
+-  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+-    true; \
+-  else \
+-    false; \
+-  fi; \
+-}
++am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+ am__make_running_with_option = \
+   case $${target_option-} in \
+       ?) ;; \
+@@ -92,12 +82,25 @@
+ host_triplet = @host@
+ bin_PROGRAMS = examples/ibv_devices$(EXEEXT) \
+ 	examples/ibv_devinfo$(EXEEXT) examples/ibv_asyncwatch$(EXEEXT) \
++	examples/ibv_frc_pingpong$(EXEEXT) \
++	examples/ibv_shpd_pingpong$(EXEEXT) \
+ 	examples/ibv_rc_pingpong$(EXEEXT) \
+ 	examples/ibv_uc_pingpong$(EXEEXT) \
+ 	examples/ibv_ud_pingpong$(EXEEXT) \
+ 	examples/ibv_srq_pingpong$(EXEEXT) \
+ 	examples/ibv_xsrq_pingpong$(EXEEXT)
+ subdir = .
++DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
++	$(top_srcdir)/configure $(am__configure_deps) \
++	$(srcdir)/config.h.in $(srcdir)/libibverbs.spec.in \
++	$(top_srcdir)/config/depcomp $(libibverbsinclude_HEADERS) \
++	AUTHORS COPYING ChangeLog README config/compile \
++	config/config.guess config/config.sub config/depcomp \
++	config/install-sh config/missing config/ltmain.sh \
++	$(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
++	$(top_srcdir)/config/config.sub \
++	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
++	$(top_srcdir)/config/missing
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+ 	$(top_srcdir)/config/ltoptions.m4 \
+@@ -106,9 +109,6 @@
+ 	$(top_srcdir)/config/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ 	$(ACLOCAL_M4)
+-DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+-	$(am__configure_deps) $(libibverbsinclude_HEADERS) \
+-	$(am__DIST_COMMON)
+ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+  configure.lineno config.status.lineno
+ mkinstalldirs = $(install_sh) -d
+@@ -177,12 +177,24 @@
+ am_examples_ibv_devinfo_OBJECTS = examples/devinfo.$(OBJEXT)
+ examples_ibv_devinfo_OBJECTS = $(am_examples_ibv_devinfo_OBJECTS)
+ examples_ibv_devinfo_DEPENDENCIES = $(top_builddir)/src/libibverbs.la
++am_examples_ibv_frc_pingpong_OBJECTS =  \
++	examples/frc_pingpong.$(OBJEXT) examples/pingpong.$(OBJEXT)
++examples_ibv_frc_pingpong_OBJECTS =  \
++	$(am_examples_ibv_frc_pingpong_OBJECTS)
++examples_ibv_frc_pingpong_DEPENDENCIES =  \
++	$(top_builddir)/src/libibverbs.la
+ am_examples_ibv_rc_pingpong_OBJECTS = examples/rc_pingpong.$(OBJEXT) \
+ 	examples/pingpong.$(OBJEXT)
+ examples_ibv_rc_pingpong_OBJECTS =  \
+ 	$(am_examples_ibv_rc_pingpong_OBJECTS)
+ examples_ibv_rc_pingpong_DEPENDENCIES =  \
+ 	$(top_builddir)/src/libibverbs.la
++am_examples_ibv_shpd_pingpong_OBJECTS =  \
++	examples/shpd_pingpong.$(OBJEXT) examples/pingpong.$(OBJEXT)
++examples_ibv_shpd_pingpong_OBJECTS =  \
++	$(am_examples_ibv_shpd_pingpong_OBJECTS)
++examples_ibv_shpd_pingpong_DEPENDENCIES =  \
++	$(top_builddir)/src/libibverbs.la
+ am_examples_ibv_srq_pingpong_OBJECTS =  \
+ 	examples/srq_pingpong.$(OBJEXT) examples/pingpong.$(OBJEXT)
+ examples_ibv_srq_pingpong_OBJECTS =  \
+@@ -245,7 +257,9 @@
+ 	$(examples_ibv_asyncwatch_SOURCES) \
+ 	$(examples_ibv_devices_SOURCES) \
+ 	$(examples_ibv_devinfo_SOURCES) \
++	$(examples_ibv_frc_pingpong_SOURCES) \
+ 	$(examples_ibv_rc_pingpong_SOURCES) \
++	$(examples_ibv_shpd_pingpong_SOURCES) \
+ 	$(examples_ibv_srq_pingpong_SOURCES) \
+ 	$(examples_ibv_uc_pingpong_SOURCES) \
+ 	$(examples_ibv_ud_pingpong_SOURCES) \
+@@ -254,7 +268,9 @@
+ 	$(examples_ibv_asyncwatch_SOURCES) \
+ 	$(examples_ibv_devices_SOURCES) \
+ 	$(examples_ibv_devinfo_SOURCES) \
++	$(examples_ibv_frc_pingpong_SOURCES) \
+ 	$(examples_ibv_rc_pingpong_SOURCES) \
++	$(examples_ibv_shpd_pingpong_SOURCES) \
+ 	$(examples_ibv_srq_pingpong_SOURCES) \
+ 	$(examples_ibv_uc_pingpong_SOURCES) \
+ 	$(examples_ibv_ud_pingpong_SOURCES) \
+@@ -291,15 +307,6 @@
+ CTAGS = ctags
+ CSCOPE = cscope
+ AM_RECURSIVE_TARGETS = cscope
+-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+-	$(srcdir)/libibverbs.spec.in $(top_srcdir)/config/compile \
+-	$(top_srcdir)/config/config.guess \
+-	$(top_srcdir)/config/config.sub $(top_srcdir)/config/depcomp \
+-	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+-	$(top_srcdir)/config/missing AUTHORS COPYING ChangeLog README \
+-	config/compile config/config.guess config/config.sub \
+-	config/depcomp config/install-sh config/ltmain.sh \
+-	config/missing
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -450,12 +457,16 @@
+ examples_ibv_devices_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_devinfo_SOURCES = examples/devinfo.c
+ examples_ibv_devinfo_LDADD = $(top_builddir)/src/libibverbs.la
++examples_ibv_frc_pingpong_SOURCES = examples/frc_pingpong.c examples/pingpong.c
++examples_ibv_frc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_rc_pingpong_SOURCES = examples/rc_pingpong.c examples/pingpong.c
+ examples_ibv_rc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_uc_pingpong_SOURCES = examples/uc_pingpong.c examples/pingpong.c
+ examples_ibv_uc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_ud_pingpong_SOURCES = examples/ud_pingpong.c examples/pingpong.c
+ examples_ibv_ud_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
++examples_ibv_shpd_pingpong_SOURCES = examples/shpd_pingpong.c examples/pingpong.c
++examples_ibv_shpd_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_srq_pingpong_SOURCES = examples/srq_pingpong.c examples/pingpong.c
+ examples_ibv_srq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la
+ examples_ibv_xsrq_pingpong_SOURCES = examples/xsrq_pingpong.c examples/pingpong.c
+@@ -468,6 +479,7 @@
+     include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
+ 
+ man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
++    man/ibv_shpd_pingpong.1			\
+     man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
+     man/ibv_srq_pingpong.1 man/ibv_alloc_pd.3 man/ibv_attach_mcast.3	\
+     man/ibv_create_ah.3 man/ibv_create_ah_from_wc.3			\
+@@ -517,6 +529,7 @@
+ 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ 	$(am__cd) $(top_srcdir) && \
+ 	  $(AUTOMAKE) --foreign Makefile
++.PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ 	@case '$?' in \
+ 	  *config.status*) \
+@@ -689,14 +702,26 @@
+ examples/ibv_devinfo$(EXEEXT): $(examples_ibv_devinfo_OBJECTS) $(examples_ibv_devinfo_DEPENDENCIES) $(EXTRA_examples_ibv_devinfo_DEPENDENCIES) examples/$(am__dirstamp)
+ 	@rm -f examples/ibv_devinfo$(EXEEXT)
+ 	$(AM_V_CCLD)$(LINK) $(examples_ibv_devinfo_OBJECTS) $(examples_ibv_devinfo_LDADD) $(LIBS)
+-examples/rc_pingpong.$(OBJEXT): examples/$(am__dirstamp) \
++examples/frc_pingpong.$(OBJEXT): examples/$(am__dirstamp) \
+ 	examples/$(DEPDIR)/$(am__dirstamp)
+ examples/pingpong.$(OBJEXT): examples/$(am__dirstamp) \
+ 	examples/$(DEPDIR)/$(am__dirstamp)
+ 
++examples/ibv_frc_pingpong$(EXEEXT): $(examples_ibv_frc_pingpong_OBJECTS) $(examples_ibv_frc_pingpong_DEPENDENCIES) $(EXTRA_examples_ibv_frc_pingpong_DEPENDENCIES) examples/$(am__dirstamp)
++	@rm -f examples/ibv_frc_pingpong$(EXEEXT)
++	$(AM_V_CCLD)$(LINK) $(examples_ibv_frc_pingpong_OBJECTS) $(examples_ibv_frc_pingpong_LDADD) $(LIBS)
++examples/rc_pingpong.$(OBJEXT): examples/$(am__dirstamp) \
++	examples/$(DEPDIR)/$(am__dirstamp)
++
+ examples/ibv_rc_pingpong$(EXEEXT): $(examples_ibv_rc_pingpong_OBJECTS) $(examples_ibv_rc_pingpong_DEPENDENCIES) $(EXTRA_examples_ibv_rc_pingpong_DEPENDENCIES) examples/$(am__dirstamp)
+ 	@rm -f examples/ibv_rc_pingpong$(EXEEXT)
+ 	$(AM_V_CCLD)$(LINK) $(examples_ibv_rc_pingpong_OBJECTS) $(examples_ibv_rc_pingpong_LDADD) $(LIBS)
++examples/shpd_pingpong.$(OBJEXT): examples/$(am__dirstamp) \
++	examples/$(DEPDIR)/$(am__dirstamp)
++
++examples/ibv_shpd_pingpong$(EXEEXT): $(examples_ibv_shpd_pingpong_OBJECTS) $(examples_ibv_shpd_pingpong_DEPENDENCIES) $(EXTRA_examples_ibv_shpd_pingpong_DEPENDENCIES) examples/$(am__dirstamp)
++	@rm -f examples/ibv_shpd_pingpong$(EXEEXT)
++	$(AM_V_CCLD)$(LINK) $(examples_ibv_shpd_pingpong_OBJECTS) $(examples_ibv_shpd_pingpong_LDADD) $(LIBS)
+ examples/srq_pingpong.$(OBJEXT): examples/$(am__dirstamp) \
+ 	examples/$(DEPDIR)/$(am__dirstamp)
+ 
+@@ -734,8 +759,10 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/asyncwatch.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/device_list.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/devinfo.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/frc_pingpong.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/pingpong.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/rc_pingpong.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/shpd_pingpong.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/srq_pingpong.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/uc_pingpong.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/ud_pingpong.Po@am__quote@
+@@ -1081,15 +1108,15 @@
+ 	$(am__post_remove_distdir)
+ 
+ dist-tarZ: distdir
+-	@echo WARNING: "Support for distribution archives compressed with" \
+-		       "legacy program 'compress' is deprecated." >&2
++	@echo WARNING: "Support for shar distribution archives is" \
++	               "deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ 	$(am__post_remove_distdir)
+ 
+ dist-shar: distdir
+-	@echo WARNING: "Support for shar distribution archives is" \
+-	               "deprecated." >&2
++	@echo WARNING: "Support for distribution archives compressed with" \
++		       "legacy program 'compress' is deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ 	$(am__post_remove_distdir)
+@@ -1125,17 +1152,17 @@
+ 	esac
+ 	chmod -R a-w $(distdir)
+ 	chmod u+w $(distdir)
+-	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
++	mkdir $(distdir)/_build $(distdir)/_inst
+ 	chmod a-w $(distdir)
+ 	test -d $(distdir)/_build || exit 0; \
+ 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ 	  && am__cwd=`pwd` \
+-	  && $(am__cd) $(distdir)/_build/sub \
+-	  && ../../configure \
++	  && $(am__cd) $(distdir)/_build \
++	  && ../configure \
+ 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+-	    --srcdir=../.. --prefix="$$dc_install_base" \
++	    --srcdir=.. --prefix="$$dc_install_base" \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) check \
+@@ -1334,8 +1361,6 @@
+ 	uninstall-libibverbsincludeHEADERS uninstall-man \
+ 	uninstall-man1 uninstall-man3
+ 
+-.PRECIOUS: Makefile
+-
+ 
+ dist-hook: libibverbs.spec
+ 	cp libibverbs.spec $(distdir)
+diff -r 688b7fd31600 examples/frc_pingpong.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/examples/frc_pingpong.c	Tue Nov 24 20:12:48 2015 -0800
+@@ -0,0 +1,950 @@
++/*
++ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
++ *
++ * This software is available to you under a choice of one of two
++ * licenses.  You may choose to be licensed under the terms of the GNU
++ * General Public License (GPL) Version 2, available from the file
++ * COPYING in the main directory of this source tree, or the
++ * OpenIB.org BSD license below:
++ *
++ *     Redistribution and use in source and binary forms, with or
++ *     without modification, are permitted provided that the following
++ *     conditions are met:
++ *
++ *      - Redistributions of source code must retain the above
++ *        copyright notice, this list of conditions and the following
++ *        disclaimer.
++ *
++ *      - Redistributions in binary form must reproduce the above
++ *        copyright notice, this list of conditions and the following
++ *        disclaimer in the documentation and/or other materials
++ *        provided with the distribution.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ */
++
++#if HAVE_CONFIG_H
++#  include <config.h>
++#endif /* HAVE_CONFIG_H */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/time.h>
++#include <netdb.h>
++#include <malloc.h>
++#include <getopt.h>
++#include <arpa/inet.h>
++#include <time.h>
++#include <errno.h>
++
++#include "pingpong.h"
++
++enum {
++	PINGPONG_RECV_WRID = 1,
++	PINGPONG_SEND_WRID = 2,
++};
++
++static int page_size;
++static int roffset = 0;
++static int soffset = 0;
++static long mr_calls_failed = 0;
++
++#define MAX_QUEUELEN 500
++
++struct pingpong_context {
++	struct ibv_context	*context;
++	struct ibv_comp_channel *channel;
++	struct ibv_pd		*pd;
++	struct ibv_mr		*rmr[MAX_QUEUELEN];
++	struct ibv_mr		*smr[MAX_QUEUELEN];
++	struct ibv_cq		*cq;
++	struct ibv_qp		*qp;
++	void			*rbuf;
++	void			*sbuf;
++	int			 size;
++	int			 rx_depth;
++	int			 rpending;
++	int			 spending;
++	struct ibv_port_attr     portinfo;
++};
++
++struct pingpong_dest {
++	int lid;
++	int qpn;
++	int psn;
++	union ibv_gid gid;
++};
++
++static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
++			  enum ibv_mtu mtu, int sl,
++			  struct pingpong_dest *dest, int sgid_idx)
++{
++	struct ibv_qp_attr attr = {
++		.qp_state		= IBV_QPS_RTR,
++		.path_mtu		= mtu,
++		.dest_qp_num		= dest->qpn,
++		.rq_psn			= dest->psn,
++		.max_dest_rd_atomic	= 1,
++		.min_rnr_timer		= 12,
++		.ah_attr		= {
++			.is_global	= 0,
++			.dlid		= dest->lid,
++			.sl		= sl,
++			.src_path_bits	= 0,
++			.port_num	= port
++		}
++	};
++
++	if (dest->gid.global.interface_id) {
++		attr.ah_attr.is_global = 1;
++		attr.ah_attr.grh.hop_limit = 1;
++		attr.ah_attr.grh.dgid = dest->gid;
++		attr.ah_attr.grh.sgid_index = sgid_idx;
++	}
++	if (ibv_modify_qp(ctx->qp, &attr,
++			  IBV_QP_STATE              |
++			  IBV_QP_AV                 |
++			  IBV_QP_PATH_MTU           |
++			  IBV_QP_DEST_QPN           |
++			  IBV_QP_RQ_PSN             |
++			  IBV_QP_MAX_DEST_RD_ATOMIC |
++			  IBV_QP_MIN_RNR_TIMER)) {
++		fprintf(stderr, "Failed to modify QP to RTR\n");
++		return 1;
++	}
++
++	attr.qp_state	    = IBV_QPS_RTS;
++	attr.timeout	    = 14;
++	attr.retry_cnt	    = 7;
++	attr.rnr_retry	    = 7;
++	attr.sq_psn	    = my_psn;
++	attr.max_rd_atomic  = 1;
++	if (ibv_modify_qp(ctx->qp, &attr,
++			  IBV_QP_STATE              |
++			  IBV_QP_TIMEOUT            |
++			  IBV_QP_RETRY_CNT          |
++			  IBV_QP_RNR_RETRY          |
++			  IBV_QP_SQ_PSN             |
++			  IBV_QP_MAX_QP_RD_ATOMIC)) {
++		fprintf(stderr, "Failed to modify QP to RTS\n");
++		return 1;
++	}
++
++	return 0;
++}
++
++static struct pingpong_dest *pp_client_exch_dest(const char *servername, int port,
++						 const struct pingpong_dest *my_dest)
++{
++	struct addrinfo *res, *t;
++	struct addrinfo hints = {
++		.ai_family   = AF_UNSPEC,
++		.ai_socktype = SOCK_STREAM
++	};
++	char *service;
++	char msg[sizeof "0000:000000:000000:00000000000000000000000000000000"];
++	int n;
++	int sockfd = -1;
++	struct pingpong_dest *rem_dest = NULL;
++	char gid[33];
++
++	if (asprintf(&service, "%d", port) < 0)
++		return NULL;
++
++	n = getaddrinfo(servername, service, &hints, &res);
++
++	if (n < 0) {
++		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
++		free(service);
++		return NULL;
++	}
++
++	for (t = res; t; t = t->ai_next) {
++		sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
++		if (sockfd >= 0) {
++			if (!connect(sockfd, t->ai_addr, t->ai_addrlen))
++				break;
++			close(sockfd);
++			sockfd = -1;
++		}
++	}
++
++	freeaddrinfo(res);
++	free(service);
++
++	if (sockfd < 0) {
++		fprintf(stderr, "Couldn't connect to %s:%d\n", servername, port);
++		return NULL;
++	}
++
++	gid_to_wire_gid(&my_dest->gid, gid);
++	sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn, my_dest->psn, gid);
++	if (write(sockfd, msg, sizeof msg) != sizeof msg) {
++		fprintf(stderr, "Couldn't send local address\n");
++		goto out;
++	}
++
++	if (read(sockfd, msg, sizeof msg) != sizeof msg) {
++		perror("client read");
++		fprintf(stderr, "Couldn't read remote address\n");
++		goto out;
++	}
++
++	write(sockfd, "done", sizeof "done");
++
++	rem_dest = malloc(sizeof *rem_dest);
++	if (!rem_dest)
++		goto out;
++
++	sscanf(msg, "%x:%x:%x:%s", &rem_dest->lid, &rem_dest->qpn, &rem_dest->psn, gid);
++	wire_gid_to_gid(gid, &rem_dest->gid);
++
++out:
++	close(sockfd);
++	return rem_dest;
++}
++
++static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
++						 int ib_port, enum ibv_mtu mtu,
++						 int port, int sl,
++						 const struct pingpong_dest *my_dest,
++						 int sgid_idx)
++{
++	struct addrinfo *res, *t;
++	struct addrinfo hints = {
++		.ai_flags    = AI_PASSIVE,
++		.ai_family   = AF_UNSPEC,
++		.ai_socktype = SOCK_STREAM
++	};
++	char *service;
++	char msg[sizeof "0000:000000:000000:00000000000000000000000000000000"];
++	int n;
++	int sockfd = -1, connfd;
++	struct pingpong_dest *rem_dest = NULL;
++	char gid[33];
++
++	if (asprintf(&service, "%d", port) < 0)
++		return NULL;
++
++	n = getaddrinfo(NULL, service, &hints, &res);
++
++	if (n < 0) {
++		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
++		free(service);
++		return NULL;
++	}
++
++	for (t = res; t; t = t->ai_next) {
++		sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
++		if (sockfd >= 0) {
++			n = 1;
++
++			setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof n);
++
++			if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
++				break;
++			close(sockfd);
++			sockfd = -1;
++		}
++	}
++
++	freeaddrinfo(res);
++	free(service);
++
++	if (sockfd < 0) {
++		fprintf(stderr, "Couldn't listen to port %d\n", port);
++		return NULL;
++	}
++
++	listen(sockfd, 1);
++	connfd = accept(sockfd, NULL, 0);
++	close(sockfd);
++	if (connfd < 0) {
++		fprintf(stderr, "accept() failed\n");
++		return NULL;
++	}
++
++	n = read(connfd, msg, sizeof msg);
++	if (n != sizeof msg) {
++		perror("server read");
++		fprintf(stderr, "%d/%d: Couldn't read remote address\n", n, (int) sizeof msg);
++		goto out;
++	}
++
++	rem_dest = malloc(sizeof *rem_dest);
++	if (!rem_dest)
++		goto out;
++
++	sscanf(msg, "%x:%x:%x:%s", &rem_dest->lid, &rem_dest->qpn, &rem_dest->psn, gid);
++	wire_gid_to_gid(gid, &rem_dest->gid);
++
++	if (pp_connect_ctx(ctx, ib_port, my_dest->psn, mtu, sl, rem_dest, sgid_idx)) {
++		fprintf(stderr, "Couldn't connect to remote QP\n");
++		free(rem_dest);
++		rem_dest = NULL;
++		goto out;
++	}
++
++
++	gid_to_wire_gid(&my_dest->gid, gid);
++	sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn, my_dest->psn, gid);
++	if (write(connfd, msg, sizeof msg) != sizeof msg) {
++		fprintf(stderr, "Couldn't send local address\n");
++		free(rem_dest);
++		rem_dest = NULL;
++		goto out;
++	}
++
++	read(connfd, msg, sizeof msg);
++
++out:
++	close(connfd);
++	return rem_dest;
++}
++
++static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
++					    int rx_depth, int port,
++					    int use_event, int is_server)
++{
++	struct pingpong_context *ctx;
++
++	ctx = calloc(1, sizeof *ctx);
++	if (!ctx)
++		return NULL;
++
++	ctx->size     = size;
++	ctx->rx_depth = rx_depth;
++
++	ctx->rbuf = memalign(page_size, size * MAX_QUEUELEN);
++	ctx->sbuf = memalign(page_size, size * MAX_QUEUELEN);
++	if (!ctx->rbuf || !ctx->sbuf) {
++		fprintf(stderr, "Couldn't allocate work buf.\n");
++		return NULL;
++	}
++
++	memset(ctx->sbuf, 0x7b + is_server, size * 2);
++	memset(ctx->sbuf + size*2, 0xcc + is_server, size * 2);
++	((char*)ctx->sbuf)[ctx->size * 4 + 1] = (char)0xab;
++
++	ctx->context = ibv_open_device(ib_dev);
++	if (!ctx->context) {
++		fprintf(stderr, "Couldn't get context for %s\n",
++			ibv_get_device_name(ib_dev));
++		return NULL;
++	}
++
++	if (use_event) {
++		ctx->channel = ibv_create_comp_channel(ctx->context);
++		if (!ctx->channel) {
++			fprintf(stderr, "Couldn't create completion channel\n");
++			return NULL;
++		}
++	} else
++		ctx->channel = NULL;
++
++	ctx->pd = ibv_alloc_pd(ctx->context);
++	if (!ctx->pd) {
++		fprintf(stderr, "Couldn't allocate PD\n");
++		return NULL;
++	}
++
++s_retry:
++	ctx->smr[0] = ibv_reg_mr_relaxed(ctx->pd, ctx->sbuf, size,
++						IBV_ACCESS_LOCAL_WRITE);
++	if (!ctx->smr[0]) {
++		mr_calls_failed++;
++		if (errno == EAGAIN) {
++			usleep(1);
++			goto s_retry;
++		}
++		fprintf(stderr, "Couldn't register MR\n");
++		return NULL;
++	}
++	printf("fmr:lkey = %x, rkey = %x for start=%p, len = %lu , access = %x\n",
++		ctx->smr[0]->lkey, ctx->smr[0]->rkey, ctx->sbuf, size,
++		IBV_ACCESS_LOCAL_WRITE);
++
++retry:
++	ctx->rmr[0] = ibv_reg_mr_relaxed(ctx->pd, ctx->rbuf, size,
++					 IBV_ACCESS_LOCAL_WRITE);
++	if (!ctx->rmr[0]) {
++		mr_calls_failed++;
++		if (errno == EAGAIN) {
++			usleep(1);
++			goto retry;
++		}
++		fprintf(stderr, "Couldn't register MR\n");
++		return NULL;
++	}
++	printf("fmr:lkey = %x, rkey = %x for start=%p, len = %lu , access = %x\n",
++		ctx->rmr[0]->lkey, ctx->rmr[0]->rkey, ctx->rbuf, size,
++		IBV_ACCESS_LOCAL_WRITE);
++
++	ctx->cq = ibv_create_cq(ctx->context, rx_depth * 2 + 1, NULL,
++				ctx->channel, 0);
++	if (!ctx->cq) {
++		fprintf(stderr, "Couldn't create CQ\n");
++		return NULL;
++	}
++
++	{
++		struct ibv_qp_init_attr attr = {
++			.send_cq = ctx->cq,
++			.recv_cq = ctx->cq,
++			.cap     = {
++				.max_send_wr  = rx_depth,
++				.max_recv_wr  = rx_depth,
++				.max_send_sge = 1,
++				.max_recv_sge = 1
++			},
++			.qp_type = IBV_QPT_RC
++		};
++
++		ctx->qp = ibv_create_qp(ctx->pd, &attr);
++		if (!ctx->qp)  {
++			fprintf(stderr, "Couldn't create QP\n");
++			return NULL;
++		}
++	}
++
++	{
++		struct ibv_qp_attr attr = {
++			.qp_state        = IBV_QPS_INIT,
++			.pkey_index      = 0,
++			.port_num        = port,
++			.qp_access_flags = 0
++		};
++
++		if (ibv_modify_qp(ctx->qp, &attr,
++				  IBV_QP_STATE              |
++				  IBV_QP_PKEY_INDEX         |
++				  IBV_QP_PORT               |
++				  IBV_QP_ACCESS_FLAGS)) {
++			fprintf(stderr, "Failed to modify QP to INIT\n");
++			return NULL;
++		}
++	}
++
++	return ctx;
++}
++
++int pp_close_ctx(struct pingpong_context *ctx)
++{
++	int i = 0;
++	if (ibv_destroy_qp(ctx->qp)) {
++		fprintf(stderr, "Couldn't destroy QP\n");
++		return 1;
++	}
++
++	if (ibv_destroy_cq(ctx->cq)) {
++		fprintf(stderr, "Couldn't destroy CQ\n");
++		return 1;
++	}
++
++	for (i = 0; i < MAX_QUEUELEN; i++) {
++		if (ctx->smr[i] && ibv_dereg_mr_relaxed(ctx->smr[i])) {
++			fprintf(stderr, "Couldn't deregister MR\n");
++			return 1;
++		}
++		if (ctx->rmr[i] && ibv_dereg_mr_relaxed(ctx->rmr[i])) {
++			fprintf(stderr, "Couldn't deregister MR\n");
++			return 1;
++		}
++	}
++
++	if (ibv_dealloc_pd(ctx->pd)) {
++		fprintf(stderr, "Couldn't deallocate PD\n");
++		return 1;
++	}
++
++	if (ctx->channel) {
++		if (ibv_destroy_comp_channel(ctx->channel)) {
++			fprintf(stderr, "Couldn't destroy completion channel\n");
++			return 1;
++		}
++	}
++
++	if (ibv_close_device(ctx->context)) {
++		fprintf(stderr, "Couldn't release context\n");
++		return 1;
++	}
++
++	if (*(char*)ctx->rbuf == 0x7b || *(char*)ctx->rbuf == 0x7c) {
++		char is_server = *(char*)ctx->rbuf - (char)0x7b;
++		char *buf1 = ctx->rbuf;
++		char *buf2 = ctx->rbuf + 2 * ctx->size;
++		for (i = 0 ; i < ctx->size * 2; i++) {
++			if (buf1[i] != (0x7b + is_server) ) {
++				fprintf(stderr, "Data corruption  at %d - %x\n", i, buf1[i]);
++				break;
++			}
++			if ((char)buf2[i] != (char)(0xcc + is_server)) {
++				fprintf(stderr, "Data corruption  at %d - %x\n", 2 * ctx->size + i, buf2[i]);
++				break;
++			}
++		}
++	}
++
++	if ((char)((char*)ctx->rbuf)[ctx->size * 4 + 1] != (char)0xab)
++		fprintf(stderr, "Data corruption  at %d - %x\n", ctx->size * 4 + 1, (char)((char*)ctx->rbuf)[ctx->size * 4 + 1]);
++
++	free(ctx->rbuf);
++	free(ctx->sbuf);
++	free(ctx);
++
++	return 0;
++}
++
++static int pp_post_recv(struct pingpong_context *ctx, int n)
++{
++
++	if (ctx->rmr[roffset] && ibv_dereg_mr_relaxed(ctx->rmr[roffset])) {
++		fprintf(stderr, "Couldn't unregister MT\n");
++		return -1;
++	}
++retry:
++	ctx->rmr[roffset]= ibv_reg_mr_relaxed(ctx->pd, ctx->rbuf + roffset*ctx->size,
++						ctx->size , IBV_ACCESS_LOCAL_WRITE);
++	if (!ctx->rmr[roffset]) {
++		mr_calls_failed++;
++		if (errno == EAGAIN) {
++			usleep(1);
++			goto retry;
++		}
++		fprintf(stderr, "Couldn't register MR\n");
++		return -1;
++	}
++	{
++		struct ibv_sge list = {
++			.addr	= (uintptr_t) ctx->rbuf + roffset * ctx->size,
++			.length = ctx->size,
++			.lkey	= ctx->rmr[roffset]->lkey
++		};
++		struct ibv_recv_wr wr = {
++			.wr_id	    = PINGPONG_RECV_WRID,
++			.sg_list    = &list,
++			.num_sge    = 1,
++		};
++		struct ibv_recv_wr *bad_wr;
++		int i;
++
++		roffset++;
++		if (roffset >= MAX_QUEUELEN)
++			roffset = 0;
++
++		for (i = 0; i < n; ++i)
++			if (ibv_post_recv(ctx->qp, &wr, &bad_wr))
++				break;
++
++		return i;
++	}
++}
++
++static int pp_post_send(struct pingpong_context *ctx)
++{
++	if (ctx->smr[soffset] && ibv_dereg_mr_relaxed(ctx->smr[soffset])) {
++		fprintf(stderr, "Couldn't unregister MT\n");
++		return -1;
++	}
++retry:
++	ctx->smr[soffset] = ibv_reg_mr_relaxed(ctx->pd, ctx->sbuf + soffset * ctx->size,
++						ctx->size, IBV_ACCESS_LOCAL_WRITE);
++	if (!ctx->smr[soffset]) {
++		mr_calls_failed++;
++		if (errno == EAGAIN) {
++			usleep(1);
++			goto retry;
++		}
++		fprintf(stderr, "Couldn't register MR\n");
++		return -1;
++	}
++
++	{
++		struct ibv_sge list = {
++			.addr	= (uintptr_t) ctx->sbuf + soffset * ctx->size,
++			.length = ctx->size,
++			.lkey	= ctx->smr[soffset]->lkey
++		};
++		struct ibv_send_wr wr = {
++			.wr_id	    = PINGPONG_SEND_WRID,
++			.sg_list    = &list,
++			.num_sge    = 1,
++			.opcode     = IBV_WR_SEND,
++			.send_flags = IBV_SEND_SIGNALED,
++		};
++		struct ibv_send_wr *bad_wr;
++
++		soffset++;
++		if (soffset >= MAX_QUEUELEN)
++			soffset = 0;
++
++		return ibv_post_send(ctx->qp, &wr, &bad_wr);
++	}
++}
++
++static void usage(const char *argv0)
++{
++	printf("Usage:\n");
++	printf("  %s            start a server and wait for connection\n", argv0);
++	printf("  %s <host>     connect to server at <host>\n", argv0);
++	printf("\n");
++	printf("Options:\n");
++	printf("  -p, --port=<port>      listen on/connect to port <port> (default 18515)\n");
++	printf("  -d, --ib-dev=<dev>     use IB device <dev> (default first device found)\n");
++	printf("  -i, --ib-port=<port>   use port <port> of IB device (default 1)\n");
++	printf("  -s, --size=<size>      size of message to exchange (default 4096)\n");
++	printf("  -m, --mtu=<size>       path MTU (default 1024)\n");
++	printf("  -r, --rx-depth=<dep>   number of receives to post at a time (default 500)\n");
++	printf("  -n, --iters=<iters>    number of exchanges (default 1000)\n");
++	printf("  -l, --sl=<sl>          service level value\n");
++	printf("  -e, --events           sleep on CQ events (default poll)\n");
++	printf("  -g, --gid-idx=<gid index> local port gid index\n");
++}
++
++int main(int argc, char *argv[])
++{
++	struct ibv_device      **dev_list;
++	struct ibv_device	*ib_dev;
++	struct pingpong_context *ctx;
++	struct pingpong_dest     my_dest;
++	struct pingpong_dest    *rem_dest;
++	struct timeval           start, end;
++	char                    *ib_devname = NULL;
++	char                    *servername = NULL;
++	int                      port = 18515;
++	int                      ib_port = 1;
++	int                      size = 4096;
++	enum ibv_mtu		 mtu = IBV_MTU_1024;
++	int                      rx_depth = 200;
++	int                      iters = 1000;
++	int                      use_event = 0;
++	int                      routs;
++	int                      rcnt, scnt;
++	int                      num_cq_events = 0;
++	int                      sl = 0;
++	int			 gidx = -1;
++	char			 gid[33];
++
++	srand48(getpid() * time(NULL));
++
++	while (1) {
++		int c;
++
++		static struct option long_options[] = {
++			{ .name = "port",     .has_arg = 1, .val = 'p' },
++			{ .name = "ib-dev",   .has_arg = 1, .val = 'd' },
++			{ .name = "ib-port",  .has_arg = 1, .val = 'i' },
++			{ .name = "size",     .has_arg = 1, .val = 's' },
++			{ .name = "mtu",      .has_arg = 1, .val = 'm' },
++			{ .name = "rx-depth", .has_arg = 1, .val = 'r' },
++			{ .name = "iters",    .has_arg = 1, .val = 'n' },
++			{ .name = "sl",       .has_arg = 1, .val = 'l' },
++			{ .name = "events",   .has_arg = 0, .val = 'e' },
++			{ .name = "gid-idx",  .has_arg = 1, .val = 'g' },
++			{ 0 }
++		};
++
++		c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:", long_options, NULL);
++		if (c == -1)
++			break;
++
++		switch (c) {
++		case 'p':
++			port = strtol(optarg, NULL, 0);
++			if (port < 0 || port > 65535) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 'd':
++			ib_devname = strdupa(optarg);
++			break;
++
++		case 'i':
++			ib_port = strtol(optarg, NULL, 0);
++			if (ib_port < 0) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 's':
++			size = strtol(optarg, NULL, 0);
++			break;
++
++		case 'm':
++			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
++			if (mtu < 0) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 'r':
++			rx_depth = strtol(optarg, NULL, 0);
++			break;
++
++		case 'n':
++			iters = strtol(optarg, NULL, 0);
++			break;
++
++		case 'l':
++			sl = strtol(optarg, NULL, 0);
++			break;
++
++		case 'e':
++			++use_event;
++			break;
++
++		case 'g':
++			gidx = strtol(optarg, NULL, 0);
++			break;
++
++		default:
++			usage(argv[0]);
++			return 1;
++		}
++	}
++
++	if (optind == argc - 1)
++		servername = strdupa(argv[optind]);
++	else if (optind < argc) {
++		usage(argv[0]);
++		return 1;
++	}
++
++	page_size = sysconf(_SC_PAGESIZE);
++
++	dev_list = ibv_get_device_list(NULL);
++	if (!dev_list) {
++		perror("Failed to get IB devices list");
++		return 1;
++	}
++
++	if (!ib_devname) {
++		ib_dev = *dev_list;
++		if (!ib_dev) {
++			fprintf(stderr, "No IB devices found\n");
++			return 1;
++		}
++	} else {
++		int i;
++		for (i = 0; dev_list[i]; ++i)
++			if (!strcmp(ibv_get_device_name(dev_list[i]), ib_devname))
++				break;
++		ib_dev = dev_list[i];
++		if (!ib_dev) {
++			fprintf(stderr, "IB device %s not found\n", ib_devname);
++			return 1;
++		}
++	}
++
++	ctx = pp_init_ctx(ib_dev, size, rx_depth, ib_port, use_event, !servername);
++	if (!ctx)
++		return 1;
++
++	{
++		int i = 0;
++		for (i = 0; i < ctx->rx_depth; i++) {
++			routs += pp_post_recv(ctx, 1);
++		}
++	}
++	if (routs < ctx->rx_depth) {
++		fprintf(stderr, "Couldn't post receive (%d)\n", routs);
++		return 1;
++	}
++
++	if (use_event)
++		if (ibv_req_notify_cq(ctx->cq, 0)) {
++			fprintf(stderr, "Couldn't request CQ notification\n");
++			return 1;
++		}
++
++
++	if (pp_get_port_info(ctx->context, ib_port, &ctx->portinfo)) {
++		fprintf(stderr, "Couldn't get port info\n");
++		return 1;
++	}
++
++	my_dest.lid = ctx->portinfo.lid;
++	if (ctx->portinfo.link_layer == IBV_LINK_LAYER_INFINIBAND && !my_dest.lid) {
++		fprintf(stderr, "Couldn't get local LID\n");
++		return 1;
++	}
++
++	if (gidx >= 0) {
++		if (ibv_query_gid(ctx->context, ib_port, gidx, &my_dest.gid)) {
++			fprintf(stderr, "Could not get local gid for gid index %d\n", gidx);
++			return 1;
++		}
++	} else
++		memset(&my_dest.gid, 0, sizeof my_dest.gid);
++
++	my_dest.qpn = ctx->qp->qp_num;
++	my_dest.psn = lrand48() & 0xffffff;
++	inet_ntop(AF_INET6, &my_dest.gid, gid, sizeof gid);
++	printf("  local address:  LID 0x%04x, QPN 0x%06x, PSN 0x%06x, GID %s\n",
++	       my_dest.lid, my_dest.qpn, my_dest.psn, gid);
++
++
++	if (servername)
++		rem_dest = pp_client_exch_dest(servername, port, &my_dest);
++	else
++		rem_dest = pp_server_exch_dest(ctx, ib_port, mtu, port, sl, &my_dest, gidx);
++
++	if (!rem_dest)
++		return 1;
++
++	inet_ntop(AF_INET6, &rem_dest->gid, gid, sizeof gid);
++	printf("  remote address: LID 0x%04x, QPN 0x%06x, PSN 0x%06x, GID %s\n",
++	       rem_dest->lid, rem_dest->qpn, rem_dest->psn, gid);
++
++	if (servername)
++		if (pp_connect_ctx(ctx, ib_port, my_dest.psn, mtu, sl, rem_dest, gidx))
++			return 1;
++
++	ctx->rpending = ctx->rx_depth;
++
++	if (servername) {
++		while (ctx->spending < ctx->rx_depth) {
++			ctx->spending++;
++			if (pp_post_send(ctx)) {
++				fprintf(stderr, "Couldn't post send\n");
++				return 1;
++			}
++		}
++	}
++
++	if (gettimeofday(&start, NULL)) {
++		perror("gettimeofday");
++		return 1;
++	}
++
++	rcnt = scnt = 0;
++	while (rcnt < iters || scnt < iters) {
++		if (use_event) {
++			struct ibv_cq *ev_cq;
++			void          *ev_ctx;
++
++			if (ibv_get_cq_event(ctx->channel, &ev_cq, &ev_ctx)) {
++				fprintf(stderr, "Failed to get cq_event\n");
++				return 1;
++			}
++
++			++num_cq_events;
++
++			if (ev_cq != ctx->cq) {
++				fprintf(stderr, "CQ event for unknown CQ %p\n", ev_cq);
++				return 1;
++			}
++
++			if (ibv_req_notify_cq(ctx->cq, 0)) {
++				fprintf(stderr, "Couldn't request CQ notification\n");
++				return 1;
++			}
++		}
++
++		{
++			struct ibv_wc wc[100];
++			int ne, i;
++
++			do {
++				ne = ibv_poll_cq(ctx->cq, 100, wc);
++				if (ne < 0) {
++					fprintf(stderr, "poll CQ failed %d\n", ne);
++					return 1;
++				}
++
++			} while (!use_event && ne < 1);
++
++			for (i = 0; i < ne; ++i) {
++				if (wc[i].status != IBV_WC_SUCCESS) {
++					fprintf(stderr, "Failed status %s (%d[%d]) for wr_id %d(scnt %d, rcnt %d, i %d)\n",
++						ibv_wc_status_str(wc[i].status),
++						wc[i].status,wc[i].vendor_err, (int) wc[i].wr_id, scnt, rcnt, i);
++					return 1;
++				}
++
++				switch ((int) wc[i].wr_id) {
++					case PINGPONG_SEND_WRID:
++						ctx->spending--;
++						++scnt;
++						break;
++
++					case PINGPONG_RECV_WRID:
++						ctx->rpending--;
++						--routs ;
++						routs += pp_post_recv(ctx, 1);
++						if (routs < ctx->rx_depth) {
++							fprintf(stderr,
++									"Couldn't post receive (%d)\n",
++									routs);
++							return 1;
++						}
++						ctx->rpending++;
++
++						++rcnt;
++						break;
++
++					default:
++						fprintf(stderr, "Completion for unknown wr_id %d\n",
++								(int) wc[i].wr_id);
++						return 1;
++				}
++
++				if ((ctx->spending + scnt) < iters) {
++					int j =0;
++					int count = iters - (ctx->spending + scnt);
++					count = (count > (ctx->rx_depth - ctx->spending)) ?
++						 ctx->rx_depth - ctx->spending  : count;
++					for (j = 0; j < count; j++) {
++						if (pp_post_send(ctx)) {
++							fprintf(stderr, "Couldn't post send %d, count %d\n", i, count);
++							return 1;
++						}
++					}
++					ctx->spending  += count;
++				}
++			}
++		}
++	}
++
++	if (gettimeofday(&end, NULL)) {
++		perror("gettimeofday");
++		return 1;
++	}
++
++	{
++		float usec = (end.tv_sec - start.tv_sec) * 1000000 +
++			(end.tv_usec - start.tv_usec);
++		long long bytes = (long long) size * iters * 2;
++
++		printf("%lld bytes in %.2f seconds = %.2f Mbit/sec\n",
++		       bytes, usec / 1000000., bytes * 8. / usec);
++		printf("%d iters in %.2f seconds = %.2f usec/iter\n",
++		       iters, usec / 1000000., usec / iters);
++	}
++		printf(" %lld reg_mrs failed\n", mr_calls_failed);
++
++	ibv_ack_cq_events(ctx->cq, num_cq_events);
++
++	if (pp_close_ctx(ctx))
++		return 1;
++
++	ibv_free_device_list(dev_list);
++	free(rem_dest);
++
++	return 0;
++}
+diff -r 688b7fd31600 examples/shpd_pingpong.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/examples/shpd_pingpong.c	Tue Nov 24 20:12:48 2015 -0800
+@@ -0,0 +1,960 @@
++/*
++ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
++ *
++ * This software is available to you under a choice of one of two
++ * licenses.  You may choose to be licensed under the terms of the GNU
++ * General Public License (GPL) Version 2, available from the file
++ * COPYING in the main directory of this source tree, or the
++ * OpenIB.org BSD license below:
++ *
++ *     Redistribution and use in source and binary forms, with or
++ *     without modification, are permitted provided that the following
++ *     conditions are met:
++ *
++ *      - Redistributions of source code must retain the above
++ *        copyright notice, this list of conditions and the following
++ *        disclaimer.
++ *
++ *      - Redistributions in binary form must reproduce the above
++ *        copyright notice, this list of conditions and the following
++ *        disclaimer in the documentation and/or other materials
++ *        provided with the distribution.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ */
++
++#if HAVE_CONFIG_H
++#  include <config.h>
++#endif /* HAVE_CONFIG_H */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/time.h>
++#include <netdb.h>
++#include <malloc.h>
++#include <getopt.h>
++#include <arpa/inet.h>
++#include <time.h>
++#include <sys/ipc.h>
++#include <sys/shm.h>
++#include <errno.h>
++
++#include "pingpong.h"
++
++enum {
++	PINGPONG_RECV_WRID = 1,
++	PINGPONG_SEND_WRID = 2,
++};
++
++static int page_size;
++
++struct ppshm {
++	void			*shmaddr;
++	struct ibv_shpd		 shpd;
++	struct ibv_mr		 mr;
++	volatile int		 status;
++	char			 buf[1];
++};
++
++struct pingpong_context {
++	struct ibv_context	*context;
++	struct ibv_comp_channel *channel;
++	struct ibv_pd		*pd;
++	struct ibv_mr		*mr;
++	struct ibv_cq		*cq;
++	struct ibv_qp		*qp;
++	void			*buf;
++	int			 size;
++	int			 rx_depth;
++	int			 pending;
++	struct ibv_port_attr     portinfo;
++	struct ibv_shpd		 shpd;
++	int			 is_server;
++	key_t			 key;
++	int			 shmsize;
++	int			 shmid;
++	uintptr_t		 shmoffset;
++	struct ppshm 		 *shm;
++};
++
++struct pingpong_dest {
++	int lid;
++	int qpn;
++	int psn;
++	union ibv_gid gid;
++};
++
++static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
++			  enum ibv_mtu mtu, int sl,
++			  struct pingpong_dest *dest, int sgid_idx)
++{
++	struct ibv_qp_attr attr = {
++		.qp_state		= IBV_QPS_RTR,
++		.path_mtu		= mtu,
++		.dest_qp_num		= dest->qpn,
++		.rq_psn			= dest->psn,
++		.max_dest_rd_atomic	= 1,
++		.min_rnr_timer		= 12,
++		.ah_attr		= {
++			.is_global	= 0,
++			.dlid		= dest->lid,
++			.sl		= sl,
++			.src_path_bits	= 0,
++			.port_num	= port
++		}
++	};
++
++	if (dest->gid.global.interface_id) {
++		attr.ah_attr.is_global = 1;
++		attr.ah_attr.grh.hop_limit = 1;
++		attr.ah_attr.grh.dgid = dest->gid;
++		attr.ah_attr.grh.sgid_index = sgid_idx;
++	}
++	if (ibv_modify_qp(ctx->qp, &attr,
++			  IBV_QP_STATE              |
++			  IBV_QP_AV                 |
++			  IBV_QP_PATH_MTU           |
++			  IBV_QP_DEST_QPN           |
++			  IBV_QP_RQ_PSN             |
++			  IBV_QP_MAX_DEST_RD_ATOMIC |
++			  IBV_QP_MIN_RNR_TIMER)) {
++		fprintf(stderr, "Failed to modify QP to RTR\n");
++		return 1;
++	}
++
++	attr.qp_state	    = IBV_QPS_RTS;
++	attr.timeout	    = 14;
++	attr.retry_cnt	    = 7;
++	attr.rnr_retry	    = 7;
++	attr.sq_psn	    = my_psn;
++	attr.max_rd_atomic  = 1;
++	if (ibv_modify_qp(ctx->qp, &attr,
++			  IBV_QP_STATE              |
++			  IBV_QP_TIMEOUT            |
++			  IBV_QP_RETRY_CNT          |
++			  IBV_QP_RNR_RETRY          |
++			  IBV_QP_SQ_PSN             |
++			  IBV_QP_MAX_QP_RD_ATOMIC)) {
++		fprintf(stderr, "Failed to modify QP to RTS\n");
++		return 1;
++	}
++
++	return 0;
++}
++
++static struct pingpong_dest *pp_client_exch_dest(const char *servername, int port,
++						 const struct pingpong_dest *my_dest)
++{
++	struct addrinfo *res, *t;
++	struct addrinfo hints = {
++		.ai_family   = AF_UNSPEC,
++		.ai_socktype = SOCK_STREAM
++	};
++	char *service;
++	char msg[sizeof "0000:000000:000000:00000000000000000000000000000000"];
++	int n;
++	int sockfd = -1;
++	struct pingpong_dest *rem_dest = NULL;
++	char gid[33];
++
++	if (asprintf(&service, "%d", port) < 0)
++		return NULL;
++
++	n = getaddrinfo(servername, service, &hints, &res);
++
++	if (n < 0) {
++		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
++		free(service);
++		return NULL;
++	}
++
++	for (t = res; t; t = t->ai_next) {
++		sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
++		if (sockfd >= 0) {
++			if (!connect(sockfd, t->ai_addr, t->ai_addrlen))
++				break;
++			close(sockfd);
++			sockfd = -1;
++		}
++	}
++
++	freeaddrinfo(res);
++	free(service);
++
++	if (sockfd < 0) {
++		fprintf(stderr, "Couldn't connect to %s:%d\n", servername, port);
++		return NULL;
++	}
++
++	gid_to_wire_gid(&my_dest->gid, gid);
++	sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn, my_dest->psn, gid);
++	if (write(sockfd, msg, sizeof msg) != sizeof msg) {
++		fprintf(stderr, "Couldn't send local address\n");
++		goto out;
++	}
++
++	if (read(sockfd, msg, sizeof msg) != sizeof msg) {
++		perror("client read");
++		fprintf(stderr, "Couldn't read remote address\n");
++		goto out;
++	}
++
++	write(sockfd, "done", sizeof "done");
++
++	rem_dest = malloc(sizeof *rem_dest);
++	if (!rem_dest)
++		goto out;
++
++	sscanf(msg, "%x:%x:%x:%s", &rem_dest->lid, &rem_dest->qpn, &rem_dest->psn, gid);
++	wire_gid_to_gid(gid, &rem_dest->gid);
++
++out:
++	close(sockfd);
++	return rem_dest;
++}
++
++static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
++						 int ib_port, enum ibv_mtu mtu,
++						 int port, int sl,
++						 const struct pingpong_dest *my_dest,
++						 int sgid_idx)
++{
++	struct addrinfo *res, *t;
++	struct addrinfo hints = {
++		.ai_flags    = AI_PASSIVE,
++		.ai_family   = AF_UNSPEC,
++		.ai_socktype = SOCK_STREAM
++	};
++	char *service;
++	char msg[sizeof "0000:000000:000000:00000000000000000000000000000000"];
++	int n;
++	int sockfd = -1, connfd;
++	struct pingpong_dest *rem_dest = NULL;
++	char gid[33];
++
++	if (asprintf(&service, "%d", port) < 0)
++		return NULL;
++
++	n = getaddrinfo(NULL, service, &hints, &res);
++
++	if (n < 0) {
++		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
++		free(service);
++		return NULL;
++	}
++
++	for (t = res; t; t = t->ai_next) {
++		sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
++		if (sockfd >= 0) {
++			n = 1;
++
++			setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof n);
++
++			if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
++				break;
++			close(sockfd);
++			sockfd = -1;
++		}
++	}
++
++	freeaddrinfo(res);
++	free(service);
++
++	if (sockfd < 0) {
++		fprintf(stderr, "Couldn't listen to port %d\n", port);
++		return NULL;
++	}
++
++	listen(sockfd, 1);
++	connfd = accept(sockfd, NULL, 0);
++	close(sockfd);
++	if (connfd < 0) {
++		fprintf(stderr, "accept() failed\n");
++		return NULL;
++	}
++
++	n = read(connfd, msg, sizeof msg);
++	if (n != sizeof msg) {
++		perror("server read");
++		fprintf(stderr, "%d/%d: Couldn't read remote address\n", n, (int) sizeof msg);
++		goto out;
++	}
++
++	rem_dest = malloc(sizeof *rem_dest);
++	if (!rem_dest)
++		goto out;
++
++	sscanf(msg, "%x:%x:%x:%s", &rem_dest->lid, &rem_dest->qpn, &rem_dest->psn, gid);
++	wire_gid_to_gid(gid, &rem_dest->gid);
++
++	if (pp_connect_ctx(ctx, ib_port, my_dest->psn, mtu, sl, rem_dest, sgid_idx)) {
++		fprintf(stderr, "Couldn't connect to remote QP\n");
++		free(rem_dest);
++		rem_dest = NULL;
++		goto out;
++	}
++
++
++	gid_to_wire_gid(&my_dest->gid, gid);
++	sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn, my_dest->psn, gid);
++	if (write(connfd, msg, sizeof msg) != sizeof msg) {
++		fprintf(stderr, "Couldn't send local address\n");
++		free(rem_dest);
++		rem_dest = NULL;
++		goto out;
++	}
++
++	read(connfd, msg, sizeof msg);
++
++out:
++	close(connfd);
++	return rem_dest;
++}
++
++static int pp_setup_shm(struct pingpong_context *ctx)
++{
++	ctx->shmid = shmget(ctx->key, ctx->shmsize, IPC_CREAT|IPC_EXCL|0666);
++	if (ctx->shmid == -1) {
++		fprintf(stderr, "shm with id %d already exists\n", ctx->key);
++		return 1;
++	}
++
++	ctx->shm = shmat(ctx->shmid, NULL, 0);
++	if (ctx->shm == (void *)-1) {
++		fprintf(stderr, "attach failed\n");
++		return 1;
++	}
++
++	ctx->shm->status  = 0;
++	return 0;
++}
++
++static int pp_waitfor_shm(struct pingpong_context *ctx)
++{
++retry:
++	ctx->shmid = shmget(ctx->key, ctx->shmsize, 0666);
++	if (ctx->shmid == -1) {
++		sleep(1);
++		goto retry;
++	}
++	ctx->shm = shmat(ctx->shmid, NULL, 0);
++	if (ctx->shm == (void *)-1) {
++		fprintf(stderr, "attach failed\n");
++		return 1;
++	}
++
++	/* wait for status 2 */
++
++	while (ctx->shm->status == 0)
++		sleep(1);
++
++	if (ctx->shm->status == 1)
++		return 1;
++
++	return 0;
++}
++
++static int pp_delete_shm(struct pingpong_context *ctx)
++{
++	if (shmdt(ctx->shm)) {
++		fprintf(stderr, "Couldn't detach shm\n");
++		return 1;
++	}
++
++	if (ctx->is_server)
++		shmctl(ctx->shmid, IPC_RMID, 0);
++
++	return 0;
++}
++
++static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
++					    int rx_depth, int port,
++					    int use_event, key_t key, int is_server)
++{
++	struct pingpong_context *ctx;
++	uint64_t mypass = 1234;
++
++	ctx = calloc(1, sizeof *ctx);
++	if (!ctx)
++		return NULL;
++
++	ctx->size     = size;
++	ctx->rx_depth = rx_depth;
++	ctx->is_server = is_server;
++	ctx->key = key;
++	ctx->shmsize = sizeof(*(ctx->shm)) + ctx->size * 2 + page_size * 2;
++	ctx->shmoffset = 0;
++
++	ctx->context = ibv_open_device(ib_dev);
++	if (!ctx->context) {
++		fprintf(stderr, "Couldn't get context for %s\n",
++			ibv_get_device_name(ib_dev));
++		return NULL;
++	}
++
++	if (use_event) {
++		ctx->channel = ibv_create_comp_channel(ctx->context);
++		if (!ctx->channel) {
++			fprintf(stderr, "Couldn't create completion channel\n");
++			return NULL;
++		}
++	} else
++		ctx->channel = NULL;
++
++	if (is_server) {
++		struct ibv_shpd *shpd;
++		ctx->pd = ibv_alloc_pd(ctx->context);
++		if (!ctx->pd) {
++			fprintf(stderr, "Couldn't allocate PD\n");
++			return NULL;
++		}
++
++		/* mark the pd as shareable & get shpd info */
++		shpd = ibv_alloc_shpd(ctx->pd, mypass, &ctx->shpd);
++		if (!shpd) {
++			fprintf(stderr, "Couldn't share PD : errno %d\n", errno);
++			return NULL;
++		}
++
++		if (pp_setup_shm(ctx))
++			return NULL;
++
++#define PAGE_ALIGN(addr, page) (uintptr_t)(((uintptr_t)addr + page - 1) \
++					 & ~(page - 1))
++
++		/* use shared memory are as buffer */
++		ctx->buf = (char *)PAGE_ALIGN(ctx->shm->buf, page_size);
++
++		ctx->mr = ibv_reg_mr(ctx->pd, ctx->shm, ctx->shmsize, IBV_ACCESS_LOCAL_WRITE);
++		if (!ctx->mr) {
++			fprintf(stderr, "Couldn't register MR\n");
++			ctx->shm->status = 1;
++			return NULL;
++		}
++
++		ctx->shm->shpd = ctx->shpd;
++		ctx->shm->mr = *ctx->mr;
++		ctx->shm->shmaddr = ctx->shm;
++
++		/* all details initialized ready to go */
++		ctx->shm->status = 2;
++	} else {
++		if (pp_waitfor_shm(ctx)) {
++			fprintf(stderr, "Couldn't get shm working\n");
++			return NULL;
++		}
++
++		ctx->shpd = ctx->shm->shpd;
++		/* create pd from shared pd information we have */
++		ctx->pd = ibv_share_pd(ctx->context, &ctx->shpd, mypass);
++
++		/* NOTE: some parts of ibv_mr struct is invalid in client process.
++		   only rkey & lkey is relevant
++		 */
++		ctx->mr = &ctx->shm->mr;
++
++		/* the memory address at which shm is mapped in the client may not be same
++		   as that in server. All WR to HCA should give local VA's w.r.t server's
++		   shared memory address
++		 */
++		ctx->shmoffset = (uintptr_t)(ctx->shm->shmaddr) -  (uintptr_t)ctx->shm;
++		ctx->buf = (char *)PAGE_ALIGN(ctx->shm->buf, page_size)
++					+ PAGE_ALIGN(size, page_size);
++	}
++
++	memset(ctx->buf, 0x7b + is_server, size);
++
++	ctx->cq = ibv_create_cq(ctx->context, rx_depth + 1, NULL,
++				ctx->channel, 0);
++	if (!ctx->cq) {
++		fprintf(stderr, "Couldn't create CQ\n");
++		return NULL;
++	}
++
++	{
++		struct ibv_qp_init_attr attr = {
++			.send_cq = ctx->cq,
++			.recv_cq = ctx->cq,
++			.cap     = {
++				.max_send_wr  = 1,
++				.max_recv_wr  = rx_depth,
++				.max_send_sge = 1,
++				.max_recv_sge = 1
++			},
++			.qp_type = IBV_QPT_RC
++		};
++
++		ctx->qp = ibv_create_qp(ctx->pd, &attr);
++		if (!ctx->qp)  {
++			fprintf(stderr, "Couldn't create QP\n");
++			return NULL;
++		}
++	}
++
++	{
++		struct ibv_qp_attr attr = {
++			.qp_state        = IBV_QPS_INIT,
++			.pkey_index      = 0,
++			.port_num        = port,
++			.qp_access_flags = 0
++		};
++
++		if (ibv_modify_qp(ctx->qp, &attr,
++				  IBV_QP_STATE              |
++				  IBV_QP_PKEY_INDEX         |
++				  IBV_QP_PORT               |
++				  IBV_QP_ACCESS_FLAGS)) {
++			fprintf(stderr, "Failed to modify QP to INIT\n");
++			return NULL;
++		}
++	}
++
++	return ctx;
++}
++
++int pp_close_ctx(struct pingpong_context *ctx)
++{
++	if (ibv_destroy_qp(ctx->qp)) {
++		fprintf(stderr, "Couldn't destroy QP\n");
++		return 1;
++	}
++
++	if (ibv_destroy_cq(ctx->cq)) {
++		fprintf(stderr, "Couldn't destroy CQ\n");
++		return 1;
++	}
++
++	if (ctx->is_server) {
++		if (ibv_dereg_mr(ctx->mr)) {
++			fprintf(stderr, "Couldn't deregister MR\n");
++			return 1;
++		}
++	}
++
++	if (pp_delete_shm(ctx)) {
++		fprintf(stderr, "couldn't destroy shared memory\n");
++		return 1;
++	}
++
++	if (ibv_dealloc_pd(ctx->pd)) {
++		fprintf(stderr, "Couldn't deallocate PD\n");
++		return 1;
++	}
++
++	if (ctx->channel) {
++		if (ibv_destroy_comp_channel(ctx->channel)) {
++			fprintf(stderr, "Couldn't destroy completion channel\n");
++			return 1;
++		}
++	}
++
++	if (ibv_close_device(ctx->context)) {
++		fprintf(stderr, "Couldn't release context\n");
++		return 1;
++	}
++
++	free(ctx);
++
++	return 0;
++}
++
++static int pp_post_recv(struct pingpong_context *ctx, int n)
++{
++	struct ibv_sge list = {
++		.addr	= (uintptr_t) ctx->buf + ctx->shmoffset,
++		.length = ctx->size,
++		.lkey	= ctx->mr->lkey
++	};
++	struct ibv_recv_wr wr = {
++		.wr_id	    = PINGPONG_RECV_WRID,
++		.sg_list    = &list,
++		.num_sge    = 1,
++	};
++	struct ibv_recv_wr *bad_wr;
++	int i;
++
++	for (i = 0; i < n; ++i)
++		if (ibv_post_recv(ctx->qp, &wr, &bad_wr))
++			break;
++
++	return i;
++}
++
++static int pp_post_send(struct pingpong_context *ctx)
++{
++	struct ibv_sge list = {
++		.addr	= (uintptr_t) ctx->buf + ctx->shmoffset,
++		.length = ctx->size,
++		.lkey	= ctx->mr->lkey
++	};
++	struct ibv_send_wr wr = {
++		.wr_id	    = PINGPONG_SEND_WRID,
++		.sg_list    = &list,
++		.num_sge    = 1,
++		.opcode     = IBV_WR_SEND,
++		.send_flags = IBV_SEND_SIGNALED,
++	};
++	struct ibv_send_wr *bad_wr;
++
++	return ibv_post_send(ctx->qp, &wr, &bad_wr);
++}
++
++static void usage(const char *argv0)
++{
++	printf("Usage:\n");
++	printf("  %s            start a server and wait for connection\n", argv0);
++	printf("  %s <host>     connect to server at <host>\n", argv0);
++	printf("\n");
++	printf("Options:\n");
++	printf("  -p, --port=<port>      listen on/connect to port <port> (default 18515)\n");
++	printf("  -d, --ib-dev=<dev>     use IB device <dev> (default first device found)\n");
++	printf("  -i, --ib-port=<port>   use port <port> of IB device (default 1)\n");
++	printf("  -s, --size=<size>      size of message to exchange (default 4096)\n");
++	printf("  -m, --mtu=<size>       path MTU (default 1024)\n");
++	printf("  -r, --rx-depth=<dep>   number of receives to post at a time (default 500)\n");
++	printf("  -n, --iters=<iters>    number of exchanges (default 1000)\n");
++	printf("  -l, --sl=<sl>          service level value\n");
++	printf("  -e, --events           sleep on CQ events (default poll)\n");
++	printf("  -g, --gid-idx=<gid index> local port gid index\n");
++	printf("  -S, --shm-key=<shm key> shared memory key for the test (default 18515)\n");
++}
++
++int main(int argc, char *argv[])
++{
++	struct ibv_device      **dev_list;
++	struct ibv_device	*ib_dev;
++	struct pingpong_context *ctx;
++	struct pingpong_dest     my_dest;
++	struct pingpong_dest    *rem_dest;
++	struct timeval           start, end;
++	char                    *ib_devname = NULL;
++	char                    *servername = NULL;
++	int                      port = 18515;
++	int                      ib_port = 1;
++	int                      size = 4096;
++	enum ibv_mtu		 mtu = IBV_MTU_1024;
++	int                      rx_depth = 500;
++	int                      iters = 1000;
++	int                      use_event = 0;
++	int                      routs;
++	int                      rcnt, scnt;
++	int                      num_cq_events = 0;
++	int                      sl = 0;
++	int			 gidx = -1;
++	char			 gid[33];
++	key_t			 key = 18515;
++
++	srand48(getpid() * time(NULL));
++
++	while (1) {
++		int c;
++
++		static struct option long_options[] = {
++			{ .name = "port",     .has_arg = 1, .val = 'p' },
++			{ .name = "ib-dev",   .has_arg = 1, .val = 'd' },
++			{ .name = "ib-port",  .has_arg = 1, .val = 'i' },
++			{ .name = "size",     .has_arg = 1, .val = 's' },
++			{ .name = "mtu",      .has_arg = 1, .val = 'm' },
++			{ .name = "rx-depth", .has_arg = 1, .val = 'r' },
++			{ .name = "iters",    .has_arg = 1, .val = 'n' },
++			{ .name = "sl",       .has_arg = 1, .val = 'l' },
++			{ .name = "events",   .has_arg = 0, .val = 'e' },
++			{ .name = "gid-idx",  .has_arg = 1, .val = 'g' },
++			{ .name = "shm-key",  .has_arg = 1, .val = 'S' },
++			{ 0 }
++		};
++
++		c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:S:", long_options, NULL);
++		if (c == -1)
++			break;
++
++		switch (c) {
++		case 'p':
++			port = strtol(optarg, NULL, 0);
++			if (port < 0 || port > 65535) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 'd':
++			ib_devname = strdupa(optarg);
++			break;
++
++		case 'i':
++			ib_port = strtol(optarg, NULL, 0);
++			if (ib_port < 0) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 's':
++			size = strtol(optarg, NULL, 0);
++			break;
++
++		case 'm':
++			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
++			if (mtu < 0) {
++				usage(argv[0]);
++				return 1;
++			}
++			break;
++
++		case 'r':
++			rx_depth = strtol(optarg, NULL, 0);
++			break;
++
++		case 'n':
++			iters = strtol(optarg, NULL, 0);
++			break;
++
++		case 'l':
++			sl = strtol(optarg, NULL, 0);
++			break;
++
++		case 'e':
++			++use_event;
++			break;
++
++		case 'g':
++			gidx = strtol(optarg, NULL, 0);
++			break;
++
++		case 'S':
++			key = strtol(optarg, NULL, 0);
++			break;
++
++		default:
++			usage(argv[0]);
++			return 1;
++		}
++	}
++
++	if (optind == argc - 1)
++		servername = strdupa(argv[optind]);
++	else if (optind < argc) {
++		usage(argv[0]);
++		return 1;
++	}
++
++	page_size = sysconf(_SC_PAGESIZE);
++
++	dev_list = ibv_get_device_list(NULL);
++	if (!dev_list) {
++		perror("Failed to get IB devices list");
++		return 1;
++	}
++
++	if (!ib_devname) {
++		ib_dev = *dev_list;
++		if (!ib_dev) {
++			fprintf(stderr, "No IB devices found\n");
++			return 1;
++		}
++	} else {
++		int i;
++		for (i = 0; dev_list[i]; ++i)
++			if (!strcmp(ibv_get_device_name(dev_list[i]), ib_devname))
++				break;
++		ib_dev = dev_list[i];
++		if (!ib_dev) {
++			fprintf(stderr, "IB device %s not found\n", ib_devname);
++			return 1;
++		}
++	}
++
++	ctx = pp_init_ctx(ib_dev, size, rx_depth, ib_port, use_event, key, !servername);
++	if (!ctx)
++		return 1;
++
++	routs = pp_post_recv(ctx, ctx->rx_depth);
++	if (routs < ctx->rx_depth) {
++		fprintf(stderr, "Couldn't post receive (%d)\n", routs);
++		return 1;
++	}
++
++	if (use_event)
++		if (ibv_req_notify_cq(ctx->cq, 0)) {
++			fprintf(stderr, "Couldn't request CQ notification\n");
++			return 1;
++		}
++
++
++	if (pp_get_port_info(ctx->context, ib_port, &ctx->portinfo)) {
++		fprintf(stderr, "Couldn't get port info\n");
++		return 1;
++	}
++
++	my_dest.lid = ctx->portinfo.lid;
++	if (ctx->portinfo.link_layer == IBV_LINK_LAYER_INFINIBAND && !my_dest.lid) {
++		fprintf(stderr, "Couldn't get local LID\n");
++		return 1;
++	}
++
++	if (gidx >= 0) {
++		if (ibv_query_gid(ctx->context, ib_port, gidx, &my_dest.gid)) {
++			fprintf(stderr, "Could not get local gid for gid index %d\n", gidx);
++			return 1;
++		}
++	} else
++		memset(&my_dest.gid, 0, sizeof my_dest.gid);
++
++	my_dest.qpn = ctx->qp->qp_num;
++	my_dest.psn = lrand48() & 0xffffff;
++	inet_ntop(AF_INET6, &my_dest.gid, gid, sizeof gid);
++	printf("  local address:  LID 0x%04x, QPN 0x%06x, PSN 0x%06x, GID %s\n",
++	       my_dest.lid, my_dest.qpn, my_dest.psn, gid);
++
++
++	if (servername)
++		rem_dest = pp_client_exch_dest(servername, port, &my_dest);
++	else
++		rem_dest = pp_server_exch_dest(ctx, ib_port, mtu, port, sl, &my_dest, gidx);
++
++	if (!rem_dest)
++		return 1;
++
++	inet_ntop(AF_INET6, &rem_dest->gid, gid, sizeof gid);
++	printf("  remote address: LID 0x%04x, QPN 0x%06x, PSN 0x%06x, GID %s\n",
++	       rem_dest->lid, rem_dest->qpn, rem_dest->psn, gid);
++
++	if (servername)
++		if (pp_connect_ctx(ctx, ib_port, my_dest.psn, mtu, sl, rem_dest, gidx))
++			return 1;
++
++	ctx->pending = PINGPONG_RECV_WRID;
++
++	if (servername) {
++		if (pp_post_send(ctx)) {
++			fprintf(stderr, "Couldn't post send\n");
++			return 1;
++		}
++		ctx->pending |= PINGPONG_SEND_WRID;
++	}
++
++	if (gettimeofday(&start, NULL)) {
++		perror("gettimeofday");
++		return 1;
++	}
++
++	rcnt = scnt = 0;
++	while (rcnt < iters || scnt < iters) {
++		if (use_event) {
++			struct ibv_cq *ev_cq;
++			void          *ev_ctx;
++
++			if (ibv_get_cq_event(ctx->channel, &ev_cq, &ev_ctx)) {
++				fprintf(stderr, "Failed to get cq_event\n");
++				return 1;
++			}
++
++			++num_cq_events;
++
++			if (ev_cq != ctx->cq) {
++				fprintf(stderr, "CQ event for unknown CQ %p\n", ev_cq);
++				return 1;
++			}
++
++			if (ibv_req_notify_cq(ctx->cq, 0)) {
++				fprintf(stderr, "Couldn't request CQ notification\n");
++				return 1;
++			}
++		}
++
++		{
++			struct ibv_wc wc[2];
++			int ne, i;
++
++			do {
++				ne = ibv_poll_cq(ctx->cq, 2, wc);
++				if (ne < 0) {
++					fprintf(stderr, "poll CQ failed %d\n", ne);
++					return 1;
++				}
++
++			} while (!use_event && ne < 1);
++
++			for (i = 0; i < ne; ++i) {
++				if (wc[i].status != IBV_WC_SUCCESS) {
++					fprintf(stderr, "Failed status %s (%d) for wr_id %d\n",
++						ibv_wc_status_str(wc[i].status),
++						wc[i].status, (int) wc[i].wr_id);
++					return 1;
++				}
++
++				switch ((int) wc[i].wr_id) {
++				case PINGPONG_SEND_WRID:
++					++scnt;
++					break;
++
++				case PINGPONG_RECV_WRID:
++					if (--routs <= 1) {
++						routs += pp_post_recv(ctx, ctx->rx_depth - routs);
++						if (routs < ctx->rx_depth) {
++							fprintf(stderr,
++								"Couldn't post receive (%d)\n",
++								routs);
++							return 1;
++						}
++					}
++
++					++rcnt;
++					break;
++
++				default:
++					fprintf(stderr, "Completion for unknown wr_id %d\n",
++						(int) wc[i].wr_id);
++					return 1;
++				}
++
++				ctx->pending &= ~(int) wc[i].wr_id;
++				if (scnt < iters && !ctx->pending) {
++					if (pp_post_send(ctx)) {
++						fprintf(stderr, "Couldn't post send\n");
++						return 1;
++					}
++					ctx->pending = PINGPONG_RECV_WRID |
++						       PINGPONG_SEND_WRID;
++				}
++			}
++		}
++	}
++
++	if (gettimeofday(&end, NULL)) {
++		perror("gettimeofday");
++		return 1;
++	}
++
++	{
++		float usec = (end.tv_sec - start.tv_sec) * 1000000 +
++			(end.tv_usec - start.tv_usec);
++		long long bytes = (long long) size * iters * 2;
++
++		printf("%lld bytes in %.2f seconds = %.2f Mbit/sec\n",
++		       bytes, usec / 1000000., bytes * 8. / usec);
++		printf("%d iters in %.2f seconds = %.2f usec/iter\n",
++		       iters, usec / 1000000., usec / iters);
++	}
++
++	ibv_ack_cq_events(ctx->cq, num_cq_events);
++
++	if (pp_close_ctx(ctx))
++		return 1;
++
++	ibv_free_device_list(dev_list);
++	free(rem_dest);
++
++	return 0;
++}
+diff -r 688b7fd31600 include/infiniband/driver.h
+--- a/include/infiniband/driver.h	Tue Nov 24 11:26:20 2015 -0800
++++ b/include/infiniband/driver.h	Tue Nov 24 20:12:48 2015 -0800
+@@ -115,6 +115,14 @@
+ int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
+ 		     struct ibv_alloc_pd *cmd, size_t cmd_size,
+ 		     struct ibv_alloc_pd_resp *resp, size_t resp_size);
++int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
++		     uint64_t share_key, struct ibv_shpd *shpd,
++		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
++		     struct ibv_alloc_shpd_resp *resp, size_t resp_size);
++int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
++		     uint64_t share_key, struct ibv_pd *pd,
++		     struct ibv_share_pd *cmd, size_t cmd_size,
++		     struct ibv_share_pd_resp *resp, size_t resp_size);
+ int ibv_cmd_dealloc_pd(struct ibv_pd *pd);
+ int ibv_cmd_open_xrcd(struct ibv_context *context, struct verbs_xrcd *xrcd,
+ 		      int vxrcd_size,
+@@ -128,7 +136,15 @@
+ 		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
+ 		   size_t cmd_size,
+ 		   struct ibv_reg_mr_resp *resp, size_t resp_size);
++#define IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
++int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
++		   uint64_t hca_va, int access,
++		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
++		   size_t cmd_size,
++		   struct ibv_reg_mr_resp *resp, size_t resp_size);
+ int ibv_cmd_dereg_mr(struct ibv_mr *mr);
++int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr);
++int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd);
+ int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
+ 		      struct ibv_comp_channel *channel,
+ 		      int comp_vector, struct ibv_cq *cq,
+diff -r 688b7fd31600 include/infiniband/kern-abi.h
+--- a/include/infiniband/kern-abi.h	Tue Nov 24 11:26:20 2015 -0800
++++ b/include/infiniband/kern-abi.h	Tue Nov 24 20:12:48 2015 -0800
+@@ -95,7 +95,27 @@
+ 	IB_USER_VERBS_CMD_OPEN_XRCD,
+ 	IB_USER_VERBS_CMD_CLOSE_XRCD,
+ 	IB_USER_VERBS_CMD_CREATE_XSRQ,
+-	IB_USER_VERBS_CMD_OPEN_QP
++	IB_USER_VERBS_CMD_OPEN_QP, /* =40 */
++	/*
++	 * Note: 0-40 verbs defined above
++	 * Start oracle verb additions leaving a gap
++	 * for upstream verbs growth.
++	 *
++	 * We start at 46 which is the starting value used
++	 * for these verbs in UEK2 and add them in same
++	 * order.
++	 *
++	 * (Even if we dont care about aligning with UEK2 values,
++	 *  cannot go beyond 63 because of "struct ib_device"
++	 *  has uverbs_cmd_mask which is 64 bits wide!)
++	 */
++#define IB_USER_VERBS_CMD_ORACLE_ADDS_START 46
++	IB_USER_VERBS_CMD_ALLOC_SHPD = IB_USER_VERBS_CMD_ORACLE_ADDS_START,
++					/* =46 */
++	IB_USER_VERBS_CMD_SHARE_PD, /* =47 */
++	IB_USER_VERBS_CMD_REG_MR_RELAXED, /* =48 */
++	IB_USER_VERBS_CMD_DEREG_MR_RELAXED, /* =49 */
++	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR /* =50 */
+ };
+ 
+ #define IB_USER_VERBS_CMD_COMMAND_MASK		0xff
+@@ -293,6 +313,40 @@
+ 	__u32 reserved;
+ };
+ 
++struct ibv_alloc_shpd {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u64 response;
++	__u32 pd_handle;
++	__u32 reserved;
++	__u64 share_key;
++	__u64 user_handle;
++	__u64 driver_data[0];
++};
++
++struct ibv_alloc_shpd_resp {
++	__u32 shpd_handle;
++	__u32 reserved;
++};
++
++struct ibv_share_pd {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u64 response;
++	__u32 shpd_handle;
++	__u32 reserved;
++	__u64 share_key;
++	__u64 user_handle;
++	__u64 driver_data[0];
++};
++
++struct ibv_share_pd_resp {
++	__u32 pd_handle;
++        __u32 reserved;
++};
++
+ struct ibv_dealloc_pd {
+ 	__u32 command;
+ 	__u16 in_words;
+@@ -353,6 +407,15 @@
+ 	__u64 user_handle;
+ };
+ 
++struct ibv_flush_relaxed_mr {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u32 pd_handle;
++	__u32 reserved;
++	__u64 user_handle;
++};
++
+ struct ibv_create_comp_channel {
+ 	__u32 command;
+ 	__u16 in_words;
+@@ -701,6 +764,7 @@
+ 	union {
+ 		struct {
+ 			__u32 remote_srqn;
++			__u32 reserved;
+ 		} xrc;
+ 	} qp_type;
+ };
+@@ -1035,7 +1099,12 @@
+ 	IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
+ 	IB_USER_VERBS_CMD_OPEN_QP_V2 = -1,
+ 	IB_USER_VERBS_CMD_CREATE_FLOW_V2 = -1,
+-	IB_USER_VERBS_CMD_DESTROY_FLOW_V2 = -1
++	IB_USER_VERBS_CMD_DESTROY_FLOW_V2 = -1,
++	IB_USER_VERBS_CMD_ALLOC_SHPD_V2 = -1,
++	IB_USER_VERBS_CMD_SHARE_PD_V2 = -1,
++	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
++	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
++	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR_V2 = -1
+ };
+ 
+ struct ibv_modify_srq_v3 {
+diff -r 688b7fd31600 include/infiniband/verbs.h
+--- a/include/infiniband/verbs.h	Tue Nov 24 11:26:20 2015 -0800
++++ b/include/infiniband/verbs.h	Tue Nov 24 20:12:48 2015 -0800
+@@ -342,6 +342,10 @@
+ 	struct ibv_context     *context;
+ };
+ 
++struct ibv_shpd {
++	uint32_t		handle;
++};
++
+ enum ibv_rereg_mr_flags {
+ 	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
+ 	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
+@@ -941,6 +945,13 @@
+ 	int			(*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
+ 						uint16_t lid);
+ 	void			(*async_event)(struct ibv_async_event *event);
++	struct ibv_shpd *	(*alloc_shpd)(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
++	struct ibv_pd *		(*share_pd)(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
++	struct ibv_mr *         (*reg_mr_relaxed)(struct ibv_pd *pd,
++						  void *addr, size_t length,
++						  int access);
++	int                     (*dereg_mr_relaxed)(struct ibv_mr *mr);
++	int                     (*flush_relaxed_mr)(struct ibv_pd *pd);
+ };
+ 
+ struct ibv_context {
+@@ -1128,6 +1139,16 @@
+ struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);
+ 
+ /**
++ * ibv_alloc_shpd - Mark a pd as shareable & return shareable pd
++ */
++struct ibv_shpd *ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
++
++/**
++ * ibv_share_pd - allocate a process private pd from shared pd
++ */
++struct ibv_pd *ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
++
++/**
+  * ibv_dealloc_pd - Free a protection domain
+  */
+ int ibv_dealloc_pd(struct ibv_pd *pd);
+@@ -1182,11 +1203,27 @@
+ 			  size_t length, int access);
+ 
+ /**
++ * ibv_reg_mr_relaxed - Register a memory region using FMR
++ */
++struct ibv_mr *ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
++			  size_t length, int access);
++
++/**
+  * ibv_dereg_mr - Deregister a memory region
+  */
+ int ibv_dereg_mr(struct ibv_mr *mr);
+ 
+ /**
++ * ibv_dereg_mr_relaxed - Deregister a memory region registered using FMR
++ */
++int ibv_dereg_mr_relaxed(struct ibv_mr *mr);
++
++/**
++ * ibv_flush_relaxed_mr - Flush all free mr's in the protection domain
++ */
++int ibv_flush_relaxed_mr(struct ibv_pd *pd);
++
++/**
+  * ibv_create_comp_channel - Create a completion event channel
+  */
+ struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context);
+diff -r 688b7fd31600 man/ibv_shpd_pingpong.1
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/man/ibv_shpd_pingpong.1	Tue Nov 24 20:12:48 2015 -0800
+@@ -0,0 +1,69 @@
++.TH IBV_SHPD_PINGPONG 1 "June 11, 2012" "libibverbs" "USER COMMANDS"
++
++.SH NAME
++ibv_shpd_pingpong \- simple InfiniBand RC transport test that uses shared PD
++
++.SH SYNOPSIS
++.B ibv_shpd_pingpong
++[\-p port] [\-d device] [\-i ib port] [\-s size] [\-r rx depth]
++[\-n iters] [\-l sl] [\-e] [\-S shm key] \fBHOSTNAME\fR
++
++.B ibv_shpd_pingpong
++[\-p port] [\-d device] [\-i ib port] [\-s size] [\-r rx depth]
++[\-n iters] [\-l sl] [\-e] [\-S shm key]
++
++.SH DESCRIPTION
++.PP
++Run a simple ping-pong test over InfiniBand via the reliable
++connected (RC) transport sharing the same PD.
++.PP
++Both server and client must be running on the same machine.
++.SH OPTIONS
++
++.PP
++.TP
++\fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR
++use TCP port \fIPORT\fR for initial synchronization (default 18515)
++.TP
++\fB\-d\fR, \fB\-\-ib\-dev\fR=\fIDEVICE\fR
++use IB device \fIDEVICE\fR (default first device found)
++.TP
++\fB\-i\fR, \fB\-\-ib\-port\fR=\fIPORT\fR
++use IB port \fIPORT\fR (default port 1)
++.TP
++\fB\-s\fR, \fB\-\-size\fR=\fISIZE\fR
++ping-pong messages of size \fISIZE\fR (default 4096)
++.TP
++\fB\-r\fR, \fB\-\-rx\-depth\fR=\fIDEPTH\fR
++post \fIDEPTH\fR receives at a time (default 1000)
++.TP
++\fB\-n\fR, \fB\-\-iters\fR=\fIITERS\fR
++perform \fIITERS\fR message exchanges (default 1000)
++.TP
++\fB\-l\fR, \fB\-\-sl\fR=\fISL\fR
++use \fISL\fR as the service level value of the QP (default 0)
++.TP
++\fB\-e\fR, \fB\-\-events\fR
++sleep while waiting for work completion events (default is to poll for
++completions)
++.TP
++\fB\-S\fR, \fB\-\-shm\-key\fR=\fIKEY\fR
++value of the shared memory key that both sides will use (default 18515)
++
++.SH SEE ALSO
++.BR ibv_rc_pingpong (1),
++.BR ibv_uc_pingpong (1),
++.BR ibv_ud_pingpong (1),
++.BR ibv_srq_pingpong (1)
++
++.SH AUTHORS
++.TP
++Dotan Barak
++.RI < [email protected] >
++
++.SH BUGS
++The network synchronization between client and server instances is
++weak, and does not prevent incompatible options from being used on the
++two instances.  The method used for retrieving work completions is not
++strictly correct, and race conditions may cause failures on some
++systems.
+diff -r 688b7fd31600 src/cmd.c
+--- a/src/cmd.c	Tue Nov 24 11:26:20 2015 -0800
++++ b/src/cmd.c	Tue Nov 24 20:12:48 2015 -0800
+@@ -241,6 +241,51 @@
+ 	return 0;
+ }
+ 
++int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
++         uint64_t share_key, struct ibv_shpd *shpd,
++		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
++		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
++{
++	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
++	cmd->pd_handle = pd->handle;
++#if defined(__SVR4) && defined(__sun)
++	cmd->user_handle = (uintptr_t) pd;
++#endif
++	cmd->share_key = share_key;
++
++	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
++		return errno;
++
++	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
++
++	shpd->handle  = resp->shpd_handle;
++
++	return 0;
++}
++
++int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
++         uint64_t share_key, struct ibv_pd *pd,
++		     struct ibv_share_pd *cmd, size_t cmd_size,
++		     struct ibv_share_pd_resp *resp, size_t resp_size)
++{
++	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
++	cmd->shpd_handle = shpd->handle;
++	cmd->share_key = share_key;
++#if defined(__SVR4) && defined(__sun)
++	cmd->user_handle     = (uintptr_t) pd;
++#endif
++
++	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
++		return errno;
++
++	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
++
++	pd->handle  = resp->pd_handle;
++	pd->context = context;
++
++	return 0;
++}
++
+ int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
+ {
+ 	struct ibv_dealloc_pd cmd;
+@@ -329,6 +374,37 @@
+ 	return 0;
+ }
+ 
++int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
++		   uint64_t hca_va, int access,
++		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
++		   size_t cmd_size,
++		   struct ibv_reg_mr_resp *resp, size_t resp_size)
++{
++
++	IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR_RELAXED, resp, resp_size);
++
++	cmd->start 	  = (uintptr_t) addr;
++	cmd->length 	  = length;
++	cmd->hca_va 	  = hca_va;
++	cmd->pd_handle 	  = pd->handle;
++#if defined(__SVR4) && defined(__sun)
++	cmd->user_handle  = (uintptr_t) mr;
++#endif
++	cmd->access_flags = access;
++
++	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
++		return errno;
++
++	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
++
++	mr->handle  = resp->mr_handle;
++	mr->lkey    = resp->lkey;
++	mr->rkey    = resp->rkey;
++	mr->context = pd->context;
++
++	return 0;
++}
++
+ int ibv_cmd_dereg_mr(struct ibv_mr *mr)
+ {
+ 	struct ibv_dereg_mr cmd;
+@@ -343,6 +419,38 @@
+ 	return 0;
+ }
+ 
++int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
++{
++	struct ibv_dereg_mr cmd;
++
++	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
++	cmd.mr_handle = mr->handle;
++#if defined(__SVR4) && defined(__sun)
++	cmd.user_handle  = (uintptr_t) mr;
++#endif
++
++	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++		return errno;
++
++	return 0;
++}
++
++int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd)
++{
++	struct ibv_flush_relaxed_mr cmd;
++
++	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
++	cmd.pd_handle = pd->handle;
++#if defined(__SVR4) && defined(__sun)
++	cmd.user_handle  = (uintptr_t) pd;
++#endif
++
++	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++		return errno;
++
++	return 0;
++}
++
+ int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
+ 		      struct ibv_comp_channel *channel,
+ 		      int comp_vector, struct ibv_cq *cq,
+@@ -1277,9 +1385,13 @@
+ 	return ret;
+ }
+ 
+-int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr,
+-			 struct ibv_create_ah *cmd, size_t cmd_size,
+-			 struct ibv_create_ah_resp *resp, size_t resp_size)
++int ibv_cmd_create_ah_ex(struct ibv_pd *pd,
++			 struct ibv_ah *ah,
++			 struct ibv_ah_attr *attr,
++			 struct ibv_create_ah *cmd,
++			 size_t cmd_size,
++			 struct ibv_create_ah_resp *resp,
++			 size_t resp_size)
+ {
+ 	IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size);
+ 	cmd->user_handle            = (uintptr_t) ah;
+@@ -1315,7 +1427,9 @@
+ {
+ 	struct ibv_create_ah      cmd;
+ 	struct ibv_create_ah_resp resp;
+-	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp, sizeof(resp));
++
++	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp,
++				    sizeof(resp));
+ }
+ 
+ int ibv_cmd_destroy_ah(struct ibv_ah *ah)
+diff -r 688b7fd31600 src/libibverbs.map
+--- a/src/libibverbs.map	Tue Nov 24 11:26:20 2015 -0800
++++ b/src/libibverbs.map	Tue Nov 24 20:12:48 2015 -0800
+@@ -13,9 +13,14 @@
+ 		ibv_query_gid;
+ 		ibv_query_pkey;
+ 		ibv_alloc_pd;
++		ibv_alloc_shpd;
++		ibv_share_pd;
+ 		ibv_dealloc_pd;
+ 		ibv_reg_mr;
++		ibv_reg_mr_relaxed;
+ 		ibv_dereg_mr;
++		ibv_dereg_mr_relaxed;
++		ibv_flush_relaxed_mr;
+ 		ibv_create_comp_channel;
+ 		ibv_destroy_comp_channel;
+ 		ibv_create_cq;
+@@ -41,9 +46,14 @@
+ 		ibv_cmd_query_gid;
+ 		ibv_cmd_query_pkey;
+ 		ibv_cmd_alloc_pd;
++		ibv_cmd_alloc_shpd;
++		ibv_cmd_share_pd;
+ 		ibv_cmd_dealloc_pd;
+ 		ibv_cmd_reg_mr;
++		ibv_cmd_reg_mr_relaxed;
+ 		ibv_cmd_dereg_mr;
++		ibv_cmd_dereg_mr_relaxed;
++		ibv_cmd_flush_relaxed_mr;
+ 		ibv_cmd_create_cq;
+ 		ibv_cmd_poll_cq;
+ 		ibv_cmd_req_notify_cq;
+@@ -61,6 +71,7 @@
+ 		ibv_cmd_post_recv;
+ 		ibv_cmd_post_srq_recv;
+ 		ibv_cmd_create_ah;
++		ibv_cmd_create_ah_ex;
+ 		ibv_cmd_destroy_ah;
+ 		ibv_cmd_attach_mcast;
+ 		ibv_cmd_detach_mcast;
+diff -r 688b7fd31600 src/verbs.c
+--- a/src/verbs.c	Tue Nov 24 11:26:20 2015 -0800
++++ b/src/verbs.c	Tue Nov 24 20:12:48 2015 -0800
+@@ -215,6 +215,27 @@
+ }
+ default_symver(__ibv_alloc_pd, ibv_alloc_pd);
+ 
++struct ibv_shpd *__ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
++{
++
++	shpd = pd->context->ops.alloc_shpd(pd, share_key, shpd);
++
++	return shpd;
++}
++default_symver(__ibv_alloc_shpd, ibv_alloc_shpd);
++
++struct ibv_pd *__ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
++{
++	struct ibv_pd *pd;
++
++	pd = context->ops.share_pd(context, shpd, share_key);
++	if (pd)
++		pd->context = context;
++
++	return pd;
++}
++default_symver(__ibv_share_pd, ibv_share_pd);
++
+ int __ibv_dealloc_pd(struct ibv_pd *pd)
+ {
+ 	return pd->context->ops.dealloc_pd(pd);
+@@ -242,6 +263,27 @@
+ }
+ default_symver(__ibv_reg_mr, ibv_reg_mr);
+ 
++struct ibv_mr *__ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
++			    size_t length, int access)
++{
++	struct ibv_mr *mr;
++
++	if (ibv_dontfork_range(addr, length))
++		return NULL;
++
++	mr = pd->context->ops.reg_mr_relaxed(pd, addr, length, access);
++	if (mr) {
++		mr->context = pd->context;
++		mr->pd      = pd;
++		mr->addr    = addr;
++		mr->length  = length;
++	} else
++		ibv_dofork_range(addr, length);
++
++	return mr;
++}
++default_symver(__ibv_reg_mr_relaxed, ibv_reg_mr_relaxed);
++
+ int __ibv_dereg_mr(struct ibv_mr *mr)
+ {
+ 	int ret;
+@@ -256,6 +298,26 @@
+ }
+ default_symver(__ibv_dereg_mr, ibv_dereg_mr);
+ 
++int __ibv_dereg_mr_relaxed(struct ibv_mr *mr)
++{
++	int ret;
++	void *addr	= mr->addr;
++	size_t length	= mr->length;
++
++	ret = mr->context->ops.dereg_mr_relaxed(mr);
++	if (!ret)
++		ibv_dofork_range(addr, length);
++
++	return ret;
++}
++default_symver(__ibv_dereg_mr_relaxed, ibv_dereg_mr_relaxed);
++
++int __ibv_flush_relaxed_mr(struct ibv_pd *pd)
++{
++	return pd->context->ops.flush_relaxed_mr(pd);
++}
++default_symver(__ibv_flush_relaxed_mr, ibv_flush_relaxed_mr);
++
+ static struct ibv_comp_channel *ibv_create_comp_channel_v2(struct ibv_context *context)
+ {
+ 	struct ibv_abi_compat_v2 *t = context->abi_compat;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/patches/003-libibverbs-SMGID-events.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,886 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# User [email protected]
+# Parent  6f1b3e12e65a05883b7375d196cad71d6e5ce1bc
+PSARC 2012/384 Fast IB node death detection
+16037511 Add support SM events to facilitate fast node death detection (userland
+
+diff -r 6f1b3e12e65a examples/asyncwatch.c
+--- a/examples/asyncwatch.c	Tue Nov 24 20:12:48 2015 -0800
++++ b/examples/asyncwatch.c	Tue Nov 24 20:13:37 2015 -0800
+@@ -35,11 +35,72 @@
+ #endif /* HAVE_CONFIG_H */
+ 
+ #include <stdio.h>
++#include <stdlib.h>
++#include <ctype.h>
++#include <getopt.h>
++#include <signal.h>
++#include <string.h>
++#include <strings.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ 
+ #include <infiniband/verbs.h>
+ 
++#define IS_PORT_EVENT(event)				\
++	((event == IBV_EVENT_PORT_ACTIVE) ||		\
++	(event == IBV_EVENT_PORT_ERR ) ||		\
++	(event == IBV_EVENT_LID_CHANGE) ||		\
++	(event == IBV_EVENT_PKEY_CHANGE) ||		\
++	(event == IBV_EVENT_SM_CHANGE) ||		\
++	(event == IBV_EVENT_GID_CHANGE) ||		\
++	(event == IBV_EVENT_CLIENT_REREGISTER))
++
++#define IS_SM_EVENT(event)				\
++	((event == IBV_EVENT_MCG_CREATED) ||		\
++	(event == IBV_EVENT_MCG_DELETED) ||		\
++	(event == IBV_EVENT_GID_AVAIL) ||		\
++	(event == IBV_EVENT_GID_UNAVAIL))
++
++#define IS_QP_EVENT(event)				\
++	((event == IBV_EVENT_CQ_ERR) ||			\
++	(event == IBV_EVENT_QP_FATAL) ||		\
++	(event == IBV_EVENT_QP_REQ_ERR) ||		\
++	(event == IBV_EVENT_COMM_EST) ||		\
++	(event == IBV_EVENT_SQ_DRAINED) ||		\
++	(event == IBV_EVENT_PATH_MIG) ||		\
++	(event == IBV_EVENT_PATH_MIG_ERR) ||		\
++	(event == IBV_EVENT_QP_LAST_WQE_REACHED) ||	\
++	(event == IBV_EVENT_QP_ACCESS_ERR))
++
++#define IS_CQ_EVENT(event)				\
++	(event == IBV_EVENT_CQ_ERR)
++
++#define IS_SRQ_EVENT(event)				\
++	((event == IBV_EVENT_SRQ_ERR) ||		\
++	(event == IBV_EVENT_SRQ_LIMIT_REACHED))
++
++#define IS_CA_EVENT(event)				\
++	(event == IBV_EVENT_DEVICE_FATAL)
++
++
++struct ibv_device	**dev_list;
++struct ibv_context	*context;
++struct ibv_async_event	event;
++union ibv_gid		*gids = NULL;
++uint_t			num_gids = 0;
++ibv_sm_event_type_t	events;
++
++static struct option long_options[] = {
++    {"sm",		0, 0, 's'},
++    {"GUID",		0, 0, 'G'},
++    {"MCG",		0, 0, 'M'},
++    {"port",		1, 0, 'p'},
++    {0, 0, 0, 0}
++};
++
++
+ static const char *event_name_str(enum ibv_event_type event_type)
+ {
+ 	switch (event_type) {
+@@ -59,7 +120,14 @@
+ 		return "IBV_EVENT_CLIENT_REREGISTER";
+ 	case IBV_EVENT_GID_CHANGE:
+ 		return "IBV_EVENT_GID_CHANGE";
+-
++	case IBV_EVENT_MCG_CREATED:
++		return "IBV_EVENT_MCG_CREATED";
++	case IBV_EVENT_MCG_DELETED:
++		return "IBV_EVENT_MCG_DELETED";
++	case IBV_EVENT_GID_AVAIL:
++		return "IBV_EVENT_GID_AVAIL";
++	case IBV_EVENT_GID_UNAVAIL:
++		return "IBV_EVENT_GID_UNAVAIL";
+ 	case IBV_EVENT_CQ_ERR:
+ 	case IBV_EVENT_QP_FATAL:
+ 	case IBV_EVENT_QP_REQ_ERR:
+@@ -76,14 +144,172 @@
+ 	}
+ }
+ 
++static void catch_signal(int sig_num)
++{
++	ibv_unregister_sm_events(context, events, num_gids, gids);
++	if (gids)
++		free(gids);
++	ibv_close_device(context);
++	(void) ibv_free_device_list(dev_list);
++	exit (0);
++}
++
++static void usage(const char *argv0)
++{
++	printf("Usage:\n");
++	printf("\n");
++	printf("Options:\n");
++	printf("[ -s, --sm<gid> ]\t\tsm event\n");
++	printf("[ -M, --M ]\t\t\tsm event for MGID (multicast)\n");
++	printf("[ -G, --G ]\t\t\tsm event for UGID (unicast)\n");
++	printf("[ -p, --port=<port> ]\t\t(default 1)\n");
++	printf("\nExamples;\n");
++	printf("ibv_asyncwatch -s\t\t# monitor event=IBV_SM_EVENT_ALL\n");
++	printf("ibv_asyncwatch -G -s\t\t# monitor event="
++	    "IBV_SM_EVENT_UGID_ALL\n");
++	printf("ibv_asyncwatch -M -s\t\t# monitor event="
++	    "IBV_SM_EVENT_MGID_ALL\n");
++	printf("ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da\n");
++	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_UGID\n");
++	printf("ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238,");
++	printf("0xff12:ffff::38:220c\n");
++	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_MGID\n");
++}
++
++
++uint_t get_gids(char *argptr, uint64_t subnet_prefix)
++{
++	char		*curr, *next;
++	char		*guid_str_p1, *guid_str_p2 = NULL;
++	int		i = 0;
++	int		data_num;
++
++	for (curr = argptr; curr; curr = next, i++) {
++		next = strchr(curr, ',');
++		if (next)
++			next++;
++        }
++	data_num = i;
++	if (data_num == 0)
++		return (0);
++
++	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
++	guid_str_p1 = malloc(strlen(argptr));
++	strncpy(guid_str_p1, argptr, strlen(argptr));
++
++	i = 0;
++	guid_str_p2 = strtok(guid_str_p1, (const char *)",");
++	while (guid_str_p2 != NULL) {
++		gids[i].global.subnet_prefix = subnet_prefix;
++		gids[i].global.interface_id =
++		    htonll((uint64_t)strtoull(guid_str_p2, 0, 0));
++		i++;
++		guid_str_p2 = strtok(NULL, (const char *)",");
++	}
++	free (guid_str_p1);
++	return (data_num);
++}
++
++void process_one_mcg_gid(union ibv_gid *gid, char *mcg_str)
++{
++	char		*token, *token_p, half_token[3];
++	uint8_t		mcg_gid[16];
++	int		i, j = 0, num_data = -1;
++	char		*curr, *next;
++
++	/* find out how many two-byte data from command line input */
++	for (curr = mcg_str; curr; curr = next, num_data++) {
++		next = strchr(curr, ':');
++		if (next)
++			next++;
++        }
++
++	if (num_data > 8) {
++		fprintf(stderr, "Invalid MGID input format: %s\n", mcg_str);
++		exit (-1);
++	}
++
++	curr = mcg_str + 2;	/* Skip past 0x */
++	while ((token = strsep(&curr, ":")) != NULL && j < 15) {
++		if (strncmp(token, "\0", 1) == 0) {
++			/* We have :: in the input */
++			for (i = 0; i < 8 - num_data; i++) {
++				mcg_gid[j++] = 0;
++				mcg_gid[j++] = 0;
++			}
++		} else {
++			if (strlen(token) < 3) {
++				mcg_gid[j++] = 0;
++				mcg_gid[j++] =
++				    (uint8_t)strtoll(token, NULL, 16);
++			} else {
++				memset(half_token, 0, 3);
++				token_p = token;
++				if (strlen(token) == 3) {
++					strncpy(half_token, token, 1);
++					token_p += 1;
++				} else {
++					strncpy(half_token, token, 2);
++					token_p += 2;
++				}
++				mcg_gid[j++] = (uint8_t)strtol(half_token,
++				    NULL, 16);
++
++				mcg_gid[j++] = (uint8_t)strtol(token_p,
++				    NULL, 16);
++			}
++		}
++	}
++
++	memcpy(gid->raw, mcg_gid, 16);
++}
++
++uint_t get_mcgs(char *argptr, uint64_t subnet_prefix)
++{
++	char            *curr, *next;
++	char		*mcg_str_p1, *mcg_str_p2 = NULL;
++	int		i = 0;
++	int		data_num;
++
++	for (curr = argptr; curr; curr = next, i++) {
++		next = strchr(curr, ',');
++		if (next)
++			next++;
++        }
++	data_num = i;
++	if (data_num == 0)
++		return (0);
++
++	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
++	mcg_str_p1 = malloc(strlen(argptr));
++	strncpy(mcg_str_p1, argptr, strlen(argptr));
++
++	i = 0;
++	mcg_str_p2 = strtok(mcg_str_p1, (const char *)",");
++	while (mcg_str_p2 != NULL) {
++		if (strncmp(mcg_str_p2, "0xff", 4) != 0) {
++			fprintf(stderr, "Invalid MGID input format: %s\n",
++			    mcg_str_p2);
++			exit (-1);
++		}
++		process_one_mcg_gid(&gids[i], mcg_str_p2);
++		i++;
++		mcg_str_p2 = strtok(NULL, (const char *)",");
++	}
++	free(mcg_str_p1);
++	return (data_num);
++}
++
+ int main(int argc, char *argv[])
+ {
+-	struct ibv_device **dev_list;
+-	struct ibv_context *context;
+-	struct ibv_async_event event;
+-
+-	/* Force line-buffering in case stdout is redirected */
+-	setvbuf(stdout, NULL, _IOLBF, 0);
++	int		c;
++	int		ret;
++	uint_t		port = 1;	/* default */
++	uint_t		do_sm_event_register = 0;
++	union ibv_gid	sgid;
++	uint64_t	subnet_prefix = 0ULL;
++	int		mcgflag = 0;
++	int		guidflag = 0;
+ 
+ 	dev_list = ibv_get_device_list(NULL);
+ 	if (!dev_list) {
+@@ -103,19 +329,111 @@
+ 		return 1;
+ 	}
+ 
+-	printf("%s: async event FD %d\n",
++	printf("\n%s: async event FD %d\n\n",
+ 	       ibv_get_device_name(*dev_list), context->async_fd);
+ 
++	ibv_query_gid(context, port, 0, &sgid);
++	subnet_prefix = sgid.global.subnet_prefix;
++
++	while ((c = getopt_long(argc, argv, "p:GMs::t:", long_options, NULL))
++	    != -1) {
++		switch(c) {
++			case 'G':
++				guidflag = 1;
++				break;
++			case 'M':
++				mcgflag = 1;
++				break;
++			case 's':
++				do_sm_event_register = 1;
++				if (mcgflag == 1)
++					num_gids =
++					    get_mcgs(optarg, subnet_prefix);
++				else
++					num_gids =
++					    get_gids(optarg, subnet_prefix);
++				break;
++			case 'p':
++				port = strtol(optarg, NULL, 0);
++				ibv_query_gid(context, port, 0, &sgid);
++				subnet_prefix = sgid.global.subnet_prefix;
++				break;
++			default:
++				usage(argv[0]);
++				return 1;
++		}
++	}
++
++	/* Force line-buffering in case stdout is redirected */
++	setvbuf(stdout, NULL, _IOLBF, 0);
++
++	if (num_gids) {
++		if (mcgflag)
++			events = IBV_SM_EVENT_MGID;
++		else
++			events = IBV_SM_EVENT_UGID;
++	} else {
++		if (mcgflag && guidflag)
++			events = IBV_SM_EVENT_ALL;
++		else if (mcgflag)
++			events = IBV_SM_EVENT_MGID_ALL;
++		else if (guidflag)
++			events = IBV_SM_EVENT_UGID_ALL;
++		else
++			events = IBV_SM_EVENT_ALL;
++	}
++
++	if (do_sm_event_register)
++		ret = ibv_register_sm_events(context, events, num_gids, gids);
++
++	(void) signal(SIGINT, catch_signal);
++
+ 	while (1) {
+ 		if (ibv_get_async_event(context, &event))
+ 			return 1;
+ 
+-		printf("  event_type %s (%d), port %d\n",
+-		       event_name_str(event.event_type),
+-		       event.event_type, event.element.port_num);
++		if (IS_PORT_EVENT(event.event_type))
++			printf("Event: %s (%d), port %d\n",
++			    event_name_str(event.event_type),
++			    event.event_type, event.element.port_num);
++		else if (IS_SM_EVENT(event.event_type))
++			printf("Event: %s (%d), gid " \
++			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
++			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
++			    event_name_str(event.event_type), event.event_type,
++			    event.element.gid.raw[0], event.element.gid.raw[1],
++			    event.element.gid.raw[2], event.element.gid.raw[3],
++			    event.element.gid.raw[4], event.element.gid.raw[5],
++			    event.element.gid.raw[6], event.element.gid.raw[7],
++			    event.element.gid.raw[8], event.element.gid.raw[9],
++			    event.element.gid.raw[10],
++			    event.element.gid.raw[11],
++			    event.element.gid.raw[12],
++			    event.element.gid.raw[13],
++			    event.element.gid.raw[14],
++			    event.element.gid.raw[15]);
++		else if (IS_QP_EVENT(event.event_type))
++			printf("Event: %s (%d) QPN %d\n",
++			    event_name_str(event.event_type), event.event_type,
++			    event.element.qp->qp_num);
++		else if (IS_CQ_EVENT(event.event_type))
++			printf("Event: %s (%d) CQE %d\n",
++			    event_name_str(event.event_type), event.event_type,
++			    event.element.cq->cqe);
++		else if (IS_SRQ_EVENT(event.event_type))
++			printf("Event: %s (%d) SRQ %d\n",
++			    event_name_str(event.event_type), event.event_type,
++			    event.element.srq->handle);
++		else
++			printf("Event: %s (%d)\n",
++			    event_name_str(event.event_type), event.event_type);
+ 
+ 		ibv_ack_async_event(&event);
++
++		if (event.event_type == IBV_EVENT_GID_AVAIL) {
++			ret = ibv_gid_reachable(context, port,
++			    &event.element.gid, 0);
++		}
+ 	}
+-
+ 	return 0;
+ }
+diff -r 6f1b3e12e65a include/infiniband/kern-abi.h
+--- a/include/infiniband/kern-abi.h	Tue Nov 24 20:12:48 2015 -0800
++++ b/include/infiniband/kern-abi.h	Tue Nov 24 20:13:37 2015 -0800
+@@ -115,7 +115,10 @@
+ 	IB_USER_VERBS_CMD_SHARE_PD, /* =47 */
+ 	IB_USER_VERBS_CMD_REG_MR_RELAXED, /* =48 */
+ 	IB_USER_VERBS_CMD_DEREG_MR_RELAXED, /* =49 */
+-	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR /* =50 */
++	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR, /* =50 */
++	IB_USER_VERBS_CMD_REG_SM_EVENT,
++	IB_USER_VERBS_CMD_UNREG_SM_EVENT,
++	IB_USER_VERBS_CMD_GID_REACHABLE
+ };
+ 
+ #define IB_USER_VERBS_CMD_COMMAND_MASK		0xff
+@@ -174,6 +177,8 @@
+ 	__u64 element;
+ 	__u32 event_type;
+ 	__u32 reserved;
++	__u64 subnet_prefix;
++	__u64 interface_id;
+ };
+ 
+ struct ibv_comp_event {
+@@ -299,6 +304,34 @@
+ 	__u8  reserved[2];
+ };
+ 
++struct ibv_reg_sm_event {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u32 events;
++	__u32 data_num;
++	__u64 driver_data[0];
++};
++
++struct ibv_unreg_sm_event {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u32 events;
++	__u32 data_num;
++	__u64 driver_data[0];
++};
++
++struct ibv_gid_reachable {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u32 timeout;
++	__u8  port_num;
++	__u8  reserved[3];
++	__u8  gid[16];
++};
++
+ struct ibv_alloc_pd {
+ 	__u32 command;
+ 	__u16 in_words;
+@@ -1104,7 +1137,10 @@
+ 	IB_USER_VERBS_CMD_SHARE_PD_V2 = -1,
+ 	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
+ 	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
+-	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR_V2 = -1
++	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR_V2 = -1,
++	IB_USER_VERBS_CMD_REG_SM_EVENT_V2 = -1,
++	IB_USER_VERBS_CMD_UNREG_SM_EVENT_V2 = -1,
++	IB_USER_VERBS_CMD_GID_REACHABLE_V2 = -1
+ };
+ 
+ struct ibv_modify_srq_v3 {
+diff -r 6f1b3e12e65a include/infiniband/verbs.h
+--- a/include/infiniband/verbs.h	Tue Nov 24 20:12:48 2015 -0800
++++ b/include/infiniband/verbs.h	Tue Nov 24 20:13:37 2015 -0800
+@@ -239,6 +239,10 @@
+ 	IBV_EVENT_QP_LAST_WQE_REACHED,
+ 	IBV_EVENT_CLIENT_REREGISTER,
+ 	IBV_EVENT_GID_CHANGE,
++	IBV_EVENT_MCG_CREATED,
++	IBV_EVENT_MCG_DELETED,
++	IBV_EVENT_GID_AVAIL,
++	IBV_EVENT_GID_UNAVAIL,
+ };
+ 
+ struct ibv_async_event {
+@@ -247,10 +251,20 @@
+ 		struct ibv_qp  *qp;
+ 		struct ibv_srq *srq;
+ 		int		port_num;
++		union ibv_gid	gid;
+ 	} element;
+ 	enum ibv_event_type	event_type;
+ };
+ 
++typedef enum ibv_sm_event_type_e {
++	IBV_SM_EVENT_MGID	= 1,
++	IBV_SM_EVENT_MGID_ALL	= 1 << 2,
++	IBV_SM_EVENT_UGID	= 1 << 3,
++	IBV_SM_EVENT_UGID_ALL	= 1 << 4,
++        IBV_SM_EVENT_ALL	= 1 << 5
++
++} ibv_sm_event_type_t;
++
+ enum ibv_wc_status {
+ 	IBV_WC_SUCCESS,
+ 	IBV_WC_LOC_LEN_ERR,
+@@ -1134,6 +1148,25 @@
+ 		   int index, uint16_t *pkey);
+ 
+ /**
++ * ibv_register_sm_events - Register subnet event for GID change
++ */
++int ibv_register_sm_events(struct ibv_context *context,
++    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
++
++/**
++ * ibv_unregister_sm_events - Unregister subnet event for GID change
++ */
++int ibv_unregister_sm_events(struct ibv_context *context,
++    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
++
++/**
++ * ibv_gid_reachable - To contact subnet agent for GID status; reachable or
++ * not reachable
++ */
++int ibv_gid_reachable(struct ibv_context *context,
++    uint port, union ibv_gid *gid_p, int timeout);
++
++/**
+  * ibv_alloc_pd - Allocate a protection domain
+  */
+ struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);
+diff -r 6f1b3e12e65a man/ibv_asyncwatch.1
+--- a/man/ibv_asyncwatch.1	Tue Nov 24 20:12:48 2015 -0800
++++ b/man/ibv_asyncwatch.1	Tue Nov 24 20:13:37 2015 -0800
+@@ -1,16 +1,78 @@
+-.TH IBV_ASYNCWATCH 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
++'\" te
++.TH IBV_ASYNCWATCH 1 "August 8, 2012" "libibverbs" "USER COMMANDS"
+ 
+ .SH NAME
+ ibv_asyncwatch \- display asynchronous events
+ 
+ .SH SYNOPSIS
+-.B ibv_asyncwatch
+-
++.sp
++.nf
++\fIibv_asyncwatch\fR [\-G | \-M] [\-s[<guid>]] [\-p port]
++\fIibv_asyncwactch\fR \-s
++\fIibv_asyncwatch\fR \-G \-s
++\fIibv_asyncwatch\fR \-M \-s
++\fIibv_asyncwatch\fR \-G [\-p port] \-s<guid1>,<guid2>,...
++\fIibv_asyncwatch\fR \-M [\-p port] \-s<mgid1>,<mgid2>,...
++.fi
++.sp
+ .SH DESCRIPTION
+ .PP
+-Display asynchronous events forwarded to userspace for an RDMA device.
++Display asynchronous events forwarded to userspace for an InfiniBand device.
++SM events can be monitored using the '-s' option, which optionally
++takes a remote port GUID, or list of remote port GUIDS separated by ','.
++If '-s' is specified with no argument then all remote nodes reachable
++form device 0 are monitored, otherwise only the specified remote
++nodes are monitored. The following SM events are monitored using
++the '-s' option: 
+ 
+-.SH AUTHORS
+-.TP
+-Roland Dreier
+-.RI < [email protected] >
++    IBV_SM_EVENT_MCG_CREATED
++         An MCG specified by the "mgid" has been created
++         on this subnet.
++
++    IBV_SM_EVENT_MCG_DELETED
++         The MCG specified by the "mgid" has been deleted
++         on this subnet.
++
++    IBV_SM_EVENT_GID_AVAIL
++         The GID specified by the "guid" is available
++         on this subnet.
++
++    IBV_SM_EVENT_GID_UNAVAIL
++         The GID specified by the "guid" is no longer
++         available on this subnet.
++
++.SH OPTIONS
++.pp
++\-G               Monitor SM event for Unicast GIDs
++.sp
++.pp
++\-M               Monitor SM event for Multicast GIDs
++.pp
++\-s<GUID>         Takes as an optional argument a comma separated list of remote port GUIDs if \-G is specified or Multicast GIDs if \-M is specified.
++.sp
++.PP
++\-p <port>        use the specified ca_port.
++.sp
++.pp
++.SH EXAMPLES
++.PP
++To monitor event=IBV_SM_EVENT_ALL
++.sp
++ibv_asyncwatch -s
++.sp
++To monitor event=IBV_SM_EVENT_UGID_ALL
++.sp
++ibv_asyncwatch -G -s
++.sp
++To monitor event=IBV_SM_EVENT_MGID_ALL
++.sp
++ibv_asyncwatch -M -s
++.sp
++To monitor event=IBV_SM_EVENT_UGID
++.sp
++ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da
++.sp
++To monitor event=IBV_SM_EVENT_MGID
++.sp
++ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238
++.sp
+diff -r 6f1b3e12e65a man/ibv_get_async_event.3
+--- a/man/ibv_get_async_event.3	Tue Nov 24 20:12:48 2015 -0800
++++ b/man/ibv_get_async_event.3	Tue Nov 24 20:13:37 2015 -0800
+@@ -14,7 +14,7 @@
+ .fi
+ .SH "DESCRIPTION"
+ .B ibv_get_async_event()
+-waits for the next async event of the RDMA device context
++waits for the next async event of the InfiniBand device context
+ .I context
+ and returns it through the pointer
+ .I event\fR,
+@@ -29,6 +29,8 @@
+ struct ibv_qp  *qp;             /* QP that got the event */
+ struct ibv_srq *srq;            /* SRQ that got the event */
+ int             port_num;       /* port number that got the event */
++uint32_t        xrc_qp_num;     /* XRC QP that got the event */
++union ibv_gid   gid;            /* list of guids that got the event */
+ .in -8
+ } element;
+ enum ibv_event_type     event_type;     /* type of the event */
+@@ -88,6 +90,16 @@
+ .TP
+ .B IBV_EVENT_DEVICE_FATAL \fR CA is in FATAL state
+ .PP
++.I Subnet events:
++.TP
++.B IBV_SM_EVENT_MCG_CREATED \fR notification of MCG creation
++.TP
++.B IBV_SM_EVENT_MCG_DELETED \fR notification of MCG deletion
++.TP
++.B IBV_SM_EVENT_GID_AVAIL \fR notification of GID available events
++.TP
++.B IBV_SM_EVENT_GID_UNAVAIL \fR notification of GID unavailable events
++.PP
+ .B ibv_ack_async_event()
+ acknowledge the async event
+ .I event\fR.
+diff -r 6f1b3e12e65a src/device.c
+--- a/src/device.c	Tue Nov 24 20:12:48 2015 -0800
++++ b/src/device.c	Tue Nov 24 20:13:37 2015 -0800
+@@ -287,7 +287,15 @@
+ 	case IBV_EVENT_SRQ_LIMIT_REACHED:
+ 		event->element.srq = (void *) (uintptr_t) ev.element;
+ 		break;
+-
++	case IBV_EVENT_GID_AVAIL:
++	case IBV_EVENT_GID_UNAVAIL:
++	case IBV_EVENT_MCG_CREATED:
++	case IBV_EVENT_MCG_DELETED:
++		event->element.gid.global.subnet_prefix
++		    = ev.subnet_prefix;
++                event->element.gid.global.interface_id
++		    = ev.interface_id;
++		break;
+ 	default:
+ 		event->element.port_num = ev.element;
+ 		break;
+diff -r 6f1b3e12e65a src/enum_strs.c
+--- a/src/enum_strs.c	Tue Nov 24 20:12:48 2015 -0800
++++ b/src/enum_strs.c	Tue Nov 24 20:13:37 2015 -0800
+@@ -87,10 +87,14 @@
+ 		[IBV_EVENT_SRQ_LIMIT_REACHED]	= "SRQ limit reached",
+ 		[IBV_EVENT_QP_LAST_WQE_REACHED]	= "last WQE reached",
+ 		[IBV_EVENT_CLIENT_REREGISTER]	= "client reregistration",
+-		[IBV_EVENT_GID_CHANGE]		= "GID table change"
++		[IBV_EVENT_GID_CHANGE]		= "GID table change",
++		[IBV_EVENT_MCG_CREATED]		= "MCG created",
++		[IBV_EVENT_MCG_DELETED]		= "MCG deleted",
++		[IBV_EVENT_GID_AVAIL]		= "GID available",
++		[IBV_EVENT_GID_UNAVAIL]		= "GID unavailable"
+ 	};
+ 
+-	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_GID_CHANGE)
++	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_GID_UNAVAIL)
+ 		return "unknown";
+ 
+ 	return event_type_str[event];
+diff -r 6f1b3e12e65a src/libibverbs.map
+--- a/src/libibverbs.map	Tue Nov 24 20:12:48 2015 -0800
++++ b/src/libibverbs.map	Tue Nov 24 20:13:37 2015 -0800
+@@ -21,6 +21,9 @@
+ 		ibv_dereg_mr;
+ 		ibv_dereg_mr_relaxed;
+ 		ibv_flush_relaxed_mr;
++		ibv_register_sm_events;
++		ibv_unregister_sm_events;
++		ibv__gid_reachable;
+ 		ibv_create_comp_channel;
+ 		ibv_destroy_comp_channel;
+ 		ibv_create_cq;
+diff -r 6f1b3e12e65a src/verbs.c
+--- a/src/verbs.c	Tue Nov 24 20:12:48 2015 -0800
++++ b/src/verbs.c	Tue Nov 24 20:13:37 2015 -0800
+@@ -49,6 +49,16 @@
+ 
+ #include "ibverbs.h"
+ 
++#define	IBV_IS_VALID_UGID(gid)	\
++	(gid->raw[0] != 0xff)
++
++#define	IBV_IS_VALID_MGID(gid)					\
++	((gids->raw[0] == 0xff) &&				\
++	((gids->raw[1] == 0x0e) || (gids->raw[1] == 0x02) ||	\
++	(gids->raw[1] == 0x05)  || (gids->raw[1] == 0x08) ||	\
++	(gids->raw[1] == 0x1e)  || (gids->raw[1] == 0x12) ||	\
++	(gids->raw[1] == 0x15)  || (gids->raw[1] == 0x18)))
++
+ int ibv_rate_to_mult(enum ibv_rate rate)
+ {
+ 	switch (rate) {
+@@ -203,6 +213,155 @@
+ }
+ default_symver(__ibv_query_pkey, ibv_query_pkey);
+ 
++int ibv_register_sm_events(struct ibv_context *context,
++    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
++{
++	struct ibv_reg_sm_event		*cmd;
++	int				cmd_size, data_size;
++	void				*data_p;
++
++	if (((gid_num > 0) && (gids == NULL)) ||
++	   ((gid_num == 0) && (gids != NULL))) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
++	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
++	    (event != IBV_SM_EVENT_ALL)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
++	    (gid_num == 0)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if (((event == IBV_SM_EVENT_UGID_ALL) ||
++	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
++	    (gid_num != 0)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	data_size = gid_num * (sizeof (union ibv_gid));
++	cmd_size = (sizeof (struct ibv_reg_sm_event)) + data_size;
++	data_p = (void *)gids;
++	cmd  = alloca(cmd_size);
++	cmd->data_num = gid_num;
++
++	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
++		errno = EINVAL;
++		return (-1);
++	}
++
++	IBV_INIT_CMD(cmd, cmd_size, REG_SM_EVENT);
++
++	cmd->events = event;
++	if (gid_num > 0)
++		memcpy(cmd->driver_data, data_p, data_size);
++
++	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	return (0);
++}
++
++int ibv_unregister_sm_events(struct ibv_context *context,
++    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
++{
++	struct ibv_unreg_sm_event	*cmd;
++	int				cmd_size, data_size;
++	void				*data_p;
++
++	if (((gid_num > 0) && (gids == NULL)) ||
++	   ((gid_num == 0) && (gids != NULL))) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
++	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
++	    (event != IBV_SM_EVENT_ALL)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
++	    (gid_num == 0)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if (((event == IBV_SM_EVENT_UGID_ALL) ||
++	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
++	    (gid_num != 0)) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	data_size = gid_num*(sizeof (union ibv_gid));
++	cmd_size = (sizeof (struct ibv_unreg_sm_event)) + data_size;
++	data_p = (void *)gids;
++	cmd  = alloca(cmd_size);
++	cmd->data_num = gid_num;
++
++	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
++		errno = EINVAL;
++		return (-1);
++	}
++
++	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
++		errno = EINVAL;
++		return (-1);
++	}
++
++	IBV_INIT_CMD(cmd, cmd_size, UNREG_SM_EVENT);
++
++	cmd->events = event;
++	if (gid_num > 0)
++		memcpy(cmd->driver_data, data_p, data_size);
++
++	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
++		errno = EINVAL;
++		return (-1);
++	}
++
++	return (0);
++}
++
++int ibv_gid_reachable(struct ibv_context *context,
++    uint_t port, union ibv_gid *gid_p, int timeout)
++{
++	struct ibv_gid_reachable	*cmd;
++	int				rc;
++
++	cmd = alloca((sizeof (struct ibv_gid_reachable)));
++	cmd->port_num = port;
++	cmd->timeout = timeout;
++
++	IBV_INIT_CMD(cmd, sizeof (struct ibv_gid_reachable),
++	    GID_REACHABLE);
++
++	memcpy(cmd->gid, gid_p, sizeof (*gid_p));
++
++	rc = write(context->cmd_fd, cmd, sizeof(struct ibv_gid_reachable));
++	if (rc < 0) {
++		return (-1);
++	}
++
++	return (0);
++}
++
+ struct ibv_pd *__ibv_alloc_pd(struct ibv_context *context)
+ {
+ 	struct ibv_pd *pd;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/patches/004-libibverbs-man-changes-for-no-xrc.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,231 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  3903116dd520bb552df4e8fa55f573d1cb9b9097
+remove xrc man pages
+
+diff -r 3903116dd520 Makefile.am
+--- a/Makefile.am	Wed Jan 13 09:20:30 2016 -0800
++++ b/Makefile.am	Wed Jan 13 09:32:13 2016 -0800
+@@ -63,8 +63,7 @@
+     man/ibv_query_pkey.3 man/ibv_query_port.3 man/ibv_query_qp.3	\
+     man/ibv_query_srq.3 man/ibv_rate_to_mult.3 man/ibv_reg_mr.3		\
+     man/ibv_req_notify_cq.3 man/ibv_resize_cq.3 man/ibv_rate_to_mbps.3  \
+-    man/ibv_create_qp_ex.3 man/ibv_create_srq_ex.3 man/ibv_open_xrcd.3  \
+-    man/ibv_get_srq_num.3 man/ibv_open_qp.3
++    man/ibv_open_xrcd.3 man/ibv_open_qp.3
+ 
+ DEBIAN = debian/changelog debian/compat debian/control debian/copyright \
+     debian/ibverbs-utils.install debian/libibverbs1.install \
+diff -r 3903116dd520 Makefile.in
+--- a/Makefile.in	Wed Jan 13 09:20:30 2016 -0800
++++ b/Makefile.in	Wed Jan 13 09:32:13 2016 -0800
+@@ -494,8 +494,7 @@
+     man/ibv_query_pkey.3 man/ibv_query_port.3 man/ibv_query_qp.3	\
+     man/ibv_query_srq.3 man/ibv_rate_to_mult.3 man/ibv_reg_mr.3		\
+     man/ibv_req_notify_cq.3 man/ibv_resize_cq.3 man/ibv_rate_to_mbps.3  \
+-    man/ibv_create_qp_ex.3 man/ibv_create_srq_ex.3 man/ibv_open_xrcd.3  \
+-    man/ibv_get_srq_num.3 man/ibv_open_qp.3
++    man/ibv_open_xrcd.3 man/ibv_open_qp.3
+ 
+ DEBIAN = debian/changelog debian/compat debian/control debian/copyright \
+     debian/ibverbs-utils.install debian/libibverbs1.install \
+diff -r 3903116dd520 man/ibv_create_qp_ex.3
+--- a/man/ibv_create_qp_ex.3	Wed Jan 13 09:20:30 2016 -0800
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,83 +0,0 @@
+-.\" -*- nroff -*-
+-.\"
+-.TH IBV_CREATE_QP_EX 3 2013-06-26 libibverbs "Libibverbs Programmer's Manual"
+-.SH "NAME"
+-ibv_create_qp_ex, ibv_destroy_qp \- create or destroy a queue pair (QP)
+-.SH "SYNOPSIS"
+-.nf
+-.B #include <infiniband/verbs.h>
+-.sp
+-.BI "struct ibv_qp *ibv_create_qp_ex(struct ibv_context " "*context" ,
+-.BI "                                struct ibv_qp_init_attr_ex " "*qp_init_attr" );
+-.sp
+-.BI "int ibv_destroy_qp(struct ibv_qp " "*qp" );
+-.fi
+-.SH "DESCRIPTION"
+-.B ibv_create_qp_ex()
+-creates a queue pair (QP) associated with the protection domain
+-.I pd\fR.
+-The argument
+-.I qp_init_attr_ex
+-is an ibv_qp_init_attr_ex struct, as defined in <infiniband/verbs.h>.
+-.PP
+-.nf
+-struct ibv_qp_init_attr_ex {
+-.in +8
+-void                   *qp_context;     /* Associated context of the QP */
+-struct ibv_cq          *send_cq;        /* CQ to be associated with the Send Queue (SQ) */
+-struct ibv_cq          *recv_cq;        /* CQ to be associated with the Receive Queue (RQ) */
+-struct ibv_srq         *srq;            /* SRQ handle if QP is to be associated with an SRQ, otherwise NULL */
+-struct ibv_qp_cap       cap;            /* QP capabilities */
+-enum ibv_qp_type        qp_type;        /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD or IBV_QPT_RAW_PACKET */
+-int                     sq_sig_all;     /* If set, each Work Request (WR) submitted to the SQ generates a completion entry */
+-uint32_t                comp_mask;	/* Identifies valid fields */
+-struct ibv_pd          *pd;		/* PD to be associated with the QP */
+-struct ibv_xrcd        *xrcd;		/* XRC domain to be associated with the target QP */
+-enum ibv_qp_create_flags create_flags;	/* Creation flags for this QP */
+-.in -8
+-};
+-.sp
+-.nf
+-struct ibv_qp_cap {
+-.in +8
+-uint32_t                max_send_wr;    /* Requested max number of outstanding WRs in the SQ */
+-uint32_t                max_recv_wr;    /* Requested max number of outstanding WRs in the RQ */
+-uint32_t                max_send_sge;   /* Requested max number of scatter/gather (s/g) elements in a WR in the SQ */
+-uint32_t                max_recv_sge;   /* Requested max number of s/g elements in a WR in the SQ */
+-uint32_t                max_inline_data;/* Requested max number of data (bytes) that can be posted inline to the SQ, otherwise 0 */
+-.in -8
+-};
+-.fi
+-.PP
+-The function
+-.B ibv_create_qp_ex()
+-will update the
+-.I qp_init_attr_ex\fB\fR->cap
+-struct with the actual \s-1QP\s0 values of the QP that was created;
+-the values will be greater than or equal to the values requested.
+-.PP
+-.B ibv_destroy_qp()
+-destroys the QP
+-.I qp\fR.
+-.SH "RETURN VALUE"
+-.B ibv_create_qp_ex()
+-returns a pointer to the created QP, or NULL if the request fails.
+-Check the QP number (\fBqp_num\fR) in the returned QP.
+-.PP
+-.B ibv_destroy_qp()
+-returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+-.SH "NOTES"
+-.PP
+-The attributes max_recv_wr and max_recv_sge are ignored by
+-.B ibv_create_qp_ex()
+-if the QP is to be associated with an SRQ.
+-.PP
+-.B ibv_destroy_qp()
+-fails if the QP is attached to a multicast group.
+-.SH "SEE ALSO"
+-.BR ibv_alloc_pd (3),
+-.BR ibv_modify_qp (3),
+-.BR ibv_query_qp (3)
+-.SH "AUTHORS"
+-.TP
+-Yishai Hadas <[email protected]>
+diff -r 3903116dd520 man/ibv_create_srq_ex.3
+--- a/man/ibv_create_srq_ex.3	Wed Jan 13 09:20:30 2016 -0800
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,71 +0,0 @@
+-.\" -*- nroff -*-
+-.\"
+-.TH IBV_CREATE_SRQ_EX 3 2013-06-26 libibverbs "Libibverbs Programmer's Manual"
+-.SH "NAME"
+-ibv_create_srq_ex, ibv_destroy_srq \- create or destroy a shared receive queue (SRQ)
+-.SH "SYNOPSIS"
+-.nf
+-.B #include <infiniband/verbs.h>
+-.sp
+-.BI "struct ibv_srq *ibv_create_srq_ex(struct ibv_context " "*context" ", struct "
+-.BI "                               ibv_srq_init_attr_ex " "*srq_init_attr_ex" );
+-.sp
+-.BI "int ibv_destroy_srq(struct ibv_srq " "*srq" );
+-.fi
+-.SH "DESCRIPTION"
+-.B ibv_create_srq_ex()
+-creates a shared receive queue (SRQ) supporting both basic and xrc modes.
+-The argument
+-.I srq_init_attr_ex
+-is an ibv_srq_init_attr_ex struct, as defined in <infiniband/verbs.h>.
+-.PP
+-.nf
+-struct ibv_srq_init_attr_ex {
+-.in +8
+-void                   *srq_context;    /* Associated context of the SRQ */
+-struct ibv_srq_attr     attr;           /* SRQ attributes */
+-uint32_t                comp_mask;      /* Identifies valid fields */
+-enum ibv_srq_type       srq_type;       /* Basic / XRC */
+-struct ibv_pd          *pd;             /* PD associated with the SRQ */
+-struct ibv_xrcd        *xrcd;           /* XRC domain to associate with the SRQ */
+-struct ibv_cq          *cq;             /* CQ to associate with the SRQ for XRC mode */
+-.in -8
+-};
+-.sp
+-.nf
+-struct ibv_srq_attr {
+-.in +8
+-uint32_t                max_wr;         /* Requested max number of outstanding work requests (WRs) in the SRQ */
+-uint32_t                max_sge;        /* Requested max number of scatter elements per WR */
+-uint32_t                srq_limit;      /* The limit value of the SRQ */
+-.in -8
+-};
+-.fi
+-.PP
+-The function
+-.B ibv_create_srq_ex()
+-will update the
+-.I srq_init_attr_ex
+-struct with the original values of the SRQ that was created; the
+-values of max_wr and max_sge will be greater than or equal to the
+-values requested.
+-.PP
+-.B ibv_destroy_srq()
+-destroys the SRQ
+-.I srq\fR.
+-.SH "RETURN VALUE"
+-.B ibv_create_srq_ex()
+-returns a pointer to the created SRQ, or NULL if the request fails.
+-.PP
+-.B ibv_destroy_srq()
+-returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+-.SH "NOTES"
+-.B ibv_destroy_srq()
+-fails if any queue pair is still associated with this SRQ.
+-.SH "SEE ALSO"
+-.BR ibv_alloc_pd (3),
+-.BR ibv_modify_srq (3),
+-.BR ibv_query_srq (3)
+-.SH "AUTHORS"
+-.TP
+-Yishai Hadas <[email protected]>
+diff -r 3903116dd520 man/ibv_get_srq_num.3
+--- a/man/ibv_get_srq_num.3	Wed Jan 13 09:20:30 2016 -0800
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,32 +0,0 @@
+-.\" -*- nroff -*-
+-.\"
+-.TH IBV_GET_SRQ_NUM 3 2013-06-26 libibverbs "Libibverbs Programmer's Manual"
+-.SH "NAME"
+-ibv_get_srq_num  \- return srq number associated with the given shared receive queue (SRQ)
+-.SH "SYNOPSIS"
+-.nf
+-.B #include <infiniband/verbs.h>
+-.sp
+-.BI "int ibv_get_srq_num(struct ibv_srq " "*srq" ,
+-.BI "                    uint32_t " "*srq_num" );
+-.fi
+-.SH "DESCRIPTION"
+-.B ibv_get_srq_num()
+-return srq number associated with the given shared receive queue
+-The argument
+-.I srq
+-is an ibv_srq struct, as defined in <infiniband/verbs.h>.
+-.I srq_num
+-is an output parameter that holds the returned srq number.
+-.PP
+-.nf
+-.SH "RETURN VALUE"
+-.B ibv_get_srq_num()
+-returns 0 on success, or the value of errno on failure (which indicates the failure reason).
+-.SH "SEE ALSO"
+-.BR ibv_alloc_pd (3),
+-.BR ibv_modify_srq (3),
+-.BR ibv_create_srq_ex (3)
+-.SH "AUTHORS"
+-.TP
+-Yishai Hadas <[email protected]>
--- a/components/open-fabrics/libibverbs/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3281 +0,0 @@
-#This patch was developed both in-house and from outside. We plan to submit it
-#upstream, but do not yet have a target date for doing so
-#
-diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.am libibverbs-1.1.4/Makefile.am
---- /tmp/846623/libibverbs-1.1.4/Makefile.am	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/Makefile.am	Fri Feb 11 04:02:12 2011
-@@ -4,13 +4,13 @@
- 
- AM_CFLAGS = -g -Wall -D_GNU_SOURCE
- 
--src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(sysconfdir)/libibverbs.d\"
-+src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(datadir)/libibverbs.d\"
- 
- libibverbs_version_script = @LIBIBVERBS_VERSION_SCRIPT@
- 
- src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
- 			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
--			    src/enum_strs.c
-+			    src/enum_strs.c src/solaris_compatibility.c
- src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
-     $(libibverbs_version_script)
- src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map
-@@ -37,7 +37,7 @@
- 
- libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
-     include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
--    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
-+    include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h include/infiniband/ofa_solaris.h
- 
- man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
-     man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1	\
-@@ -65,6 +65,7 @@
- 
- EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
-     include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
-+	 include/infiniband/ofa_solaris.h \
-     include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
-     src/ibverbs.h examples/pingpong.h \
-     src/libibverbs.map libibverbs.spec.in $(man_MANS)
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_name.3 libibverbs-1.1.4/man/ibv_get_device_name.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_name.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_get_device_name.3	Mon Mar 28 03:11:46 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_GET_DEVICE_NAME 3  2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_get_device_name \- get an RDMA device's name
-+ibv_get_device_name \- get an InfiniBand device's name
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-@@ -11,7 +11,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_get_device_name()
--returns a human-readable name associated with the RDMA device
-+returns a human-readable name associated with the InfiniBand device
- .I device\fR.
- .SH "RETURN VALUE"
- .B ibv_get_device_name()
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_attach_mcast.3 libibverbs-1.1.4/man/ibv_attach_mcast.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_attach_mcast.3	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/man/ibv_attach_mcast.3	Tue May  3 13:50:06 2011
-@@ -38,9 +38,6 @@
- .SH "NOTES"
- Only QPs of Transport Service Type
- .BR IBV_QPT_UD
--or
--.BR IBV_QPT_RAW_PACKET
--may be attached to multicast groups.
- .PP
- If a QP is attached to the same multicast group multiple times, the QP will still receive a single copy of a multicast message.
- .PP
-@@ -48,22 +45,6 @@
- multicast group must be sent to the subnet administrator (SA), so that
- the fabric's multicast routing is configured to deliver messages to
- the local port.
--.SH EXAMPLE
--	An example of the use of ibv_attach_mcast with RAW ETH QP:
--.nf
--
--	union ibv_gid mgid;
--
--	memset(&mgid, 0, sizeof(union ibv_gid));
--
--	memcpy(&mgid.raw[10], mmac, 6);
--
--	if (ibv_attach_mcast(qp, &mgid, 0)) {
--		printf ("Failed to attach qp to mcast. Errno: %d\\n",errno);
--		return 1;
--	}
--.fi
--
- .SH "SEE ALSO"
- .BR ibv_create_qp (3)
- .SH "AUTHORS"
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_modify_qp.3 libibverbs-1.1.4/man/ibv_modify_qp.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_modify_qp.3	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/man/ibv_modify_qp.3	Tue May  3 13:50:06 2011
-@@ -161,7 +161,7 @@
- .fi
- .PP
- .nf
--For QP Transport Service Type \fB IBV_QPT_RAW_PACKET\fR:
-+For QP Transport Service Type:
- .sp
- Next state     Required attributes
- \-\-\-\-\-\-\-\-\-\-     \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_devinfo.1 libibverbs-1.1.4/man/ibv_devinfo.1
---- /tmp/846623/libibverbs-1.1.4/man/ibv_devinfo.1	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_devinfo.1	Mon Mar 28 03:11:46 2011
-@@ -1,7 +1,7 @@
- .TH IBV_DEVINFO 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
- 
- .SH NAME
--ibv_devinfo \- query RDMA devices
-+ibv_devinfo \- query InfiniBand devices
- 
- .SH SYNOPSIS
- .B ibv_devinfo
-@@ -9,7 +9,7 @@
- 
- .SH DESCRIPTION
- .PP
--Print information about RDMA devices available for use from userspace.
-+Print information about InfiniBand devices available for use from userspace.
- 
- .SH OPTIONS
- 
-@@ -22,10 +22,10 @@
- query port \fIPORT\fR (default all ports)
- 
- \fB\-l\fR, \fB\-\-list\fR
--only list names of RDMA devices
-+only list names of InfiniBand devices
- 
- \fB\-v\fR, \fB\-\-verbose\fR
--print all available information about RDMA devices
-+print all available information about InfiniBand devices
- 
- .SH SEE ALSO
- .BR ibv_devices (1)
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_qp.3 libibverbs-1.1.4/man/ibv_query_qp.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_query_qp.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_query_qp.3	Mon Mar 28 03:11:47 2011
-@@ -68,7 +68,7 @@
- The argument
- .I attr_mask
- is a hint that specifies the minimum list of attributes to retrieve.
--Some RDMA devices may return extra attributes not requested, for
-+Some InfiniBand devices may return extra attributes not requested, for
- example if the value can be returned cheaply. This has the same
- form as in
- .B ibv_modify_qp()\fR.
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_guid.3 libibverbs-1.1.4/man/ibv_get_device_guid.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_guid.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_get_device_guid.3	Mon Mar 28 03:11:46 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_GET_DEVICE_GUID 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_get_device_guid \- get an RDMA device's GUID
-+ibv_get_device_guid \- get an InfiniBand device's GUID
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-@@ -11,7 +11,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_get_device_name()
--returns the Global Unique IDentifier (GUID) of the RDMA device
-+returns the Global Unique IDentifier (GUID) of the InfiniBand device
- .I device\fR.
- .SH "RETURN VALUE"
- .B ibv_get_device_guid()
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_post_send.3 libibverbs-1.1.4/man/ibv_post_send.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_post_send.3	Thu Mar 10 06:58:20 2011
-+++ libibverbs-1.1.4/man/ibv_post_send.3	Tue Nov 13 10:04:25 2012
-@@ -91,14 +91,17 @@
- The attribute send_flags describes the properties of the \s-1WR\s0. It is either 0 or the bitwise \s-1OR\s0 of one or more of the following flags:
- .PP
- .TP
--.B IBV_SEND_FENCE \fR Set the fence indicator.  Valid only for QPs with Transport Service Type \fBIBV_QPT_RC
-+.B IBV_SEND_FENCE \fR
-+Set the fence indicator.  Valid only for QPs with Transport Service Type \fBIBV_QPT_RC
- .TP
--.B IBV_SEND_SIGNALED \fR Set the completion notification indicator.  Relevant only if QP was created with sq_sig_all=0
-+.B IBV_SEND_SIGNALED \fR
-+Set the completion notification indicator.  Relevant only if QP was created with sq_sig_all=0
- .TP
--.B IBV_SEND_SOLICITED \fR Set the solicited event indicator.  Valid only for Send and RDMA Write with immediate
-+.B IBV_SEND_SOLICITED \fR
-+Set the solicited event indicator.  Valid only for Send and RDMA Write with immediate
- .TP
--.B IBV_SEND_INLINE \fR Send data in given gather list as inline data
--in a send WQE.  Valid only for Send and RDMA Write.  The L_Key will not be checked.
-+.B IBV_SEND_INLINE \fR
-+Send data in given gather list as inline data in a send WQE.  Valid only for Send and RDMA Write.  The L_Key will not be checked.
- .SH "RETURN VALUE"
- .B ibv_post_send()
- returns 0 on success, or the value of errno on failure (which indicates the failure reason).
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_alloc_pd.3 libibverbs-1.1.4/man/ibv_alloc_pd.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_alloc_pd.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_alloc_pd.3	Mon Mar 28 03:11:45 2011
-@@ -13,7 +13,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_alloc_pd()
--allocates a PD for the RDMA device context 
-+allocates a PD for the InfiniBand device context 
- .I context\fR.
- .PP
- .B ibv_dealloc_pd()
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_async_event.3 libibverbs-1.1.4/man/ibv_get_async_event.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_get_async_event.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_get_async_event.3	Mon Mar 28 03:11:46 2011
-@@ -14,7 +14,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_get_async_event()
--waits for the next async event of the RDMA device context
-+waits for the next async event of the InfiniBand device context
- .I context
- and returns it through the pointer
- .I event\fR,
-@@ -29,6 +29,8 @@
- struct ibv_qp  *qp;             /* QP that got the event */
- struct ibv_srq *srq;            /* SRQ that got the event */
- int             port_num;       /* port number that got the event */
-+uint32_t        xrc_qp_num;     /* XRC QP that got the event */
-+union ibv_gid   gid;            /* list of guids that got the event */
- .in -8
- } element;
- enum ibv_event_type     event_type;     /* type of the event */
-@@ -86,6 +88,16 @@
- .TP
- .B IBV_EVENT_DEVICE_FATAL \fR CA is in FATAL state
- .PP
-+.I Subnet events:
-+.TP
-+.B IBV_SM_EVENT_MCG_CREATED \fR notification of MCG creation
-+.TP
-+.B IBV_SM_EVENT_MCG_DELETED \fR notification of MCG deletion
-+.TP
-+.B IBV_SM_EVENT_GID_AVAIL \fR notification of GID available events
-+.TP
-+.B IBV_SM_EVENT_GID_UNAVAIL \fR notification of GID unavailable events
-+.PP
- .B ibv_ack_async_event()
- acknowledge the async event
- .I event\fR.
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_list.3 libibverbs-1.1.4/man/ibv_get_device_list.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_get_device_list.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_get_device_list.3	Mon Mar 28 03:11:46 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_GET_DEVICE_LIST 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_get_device_list, ibv_free_device_list \- get and release list of available RDMA devices
-+ibv_get_device_list, ibv_free_device_list \- get and release list of available InfiniBand devices
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-@@ -13,7 +13,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_get_device_list()
--returns a NULL-terminated array of RDMA devices currently available.
-+returns a NULL-terminated array of InfiniBand devices currently available.
- The argument
- .I num_devices
- is optional; if not NULL, it is set to the number of devices returned in the array.
-@@ -25,7 +25,7 @@
- .B ibv_get_device_list()\fR.
- .SH "RETURN VALUE"
- .B ibv_get_device_list()
--returns the array of available RDMA devices, or sets
-+returns the array of available InfiniBand devices, or sets
- .I errno
- and returns NULL if the request fails. If no devices are found then
- .I num_devices
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_device.3 libibverbs-1.1.4/man/ibv_query_device.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_query_device.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_query_device.3	Mon Mar 28 03:11:47 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_QUERY_DEVICE 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_query_device \- query an RDMA device's attributes
-+ibv_query_device \- query an InfiniBand device's attributes
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_query_port.3 libibverbs-1.1.4/man/ibv_query_port.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_query_port.3	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/man/ibv_query_port.3	Mon Mar 28 03:11:47 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_QUERY_PORT 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_query_port \- query an RDMA port's attributes
-+ibv_query_port \- query an InfiniBand port's attributes
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_asyncwatch.1 libibverbs-1.1.4/man/ibv_asyncwatch.1
---- /tmp/846623/libibverbs-1.1.4/man/ibv_asyncwatch.1	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_asyncwatch.1	Mon Mar 28 03:11:45 2011
-@@ -1,16 +1,78 @@
--.TH IBV_ASYNCWATCH 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
-+'\" te
-+.TH IBV_ASYNCWATCH 1 "August 8, 2012" "libibverbs" "USER COMMANDS"
- 
- .SH NAME
- ibv_asyncwatch \- display asynchronous events
- 
- .SH SYNOPSIS
--.B ibv_asyncwatch
--
-+.sp
-+.nf
-+\fIibv_asyncwatch\fR [\-G | \-M] [\-s[<guid>]] [\-p port]
-+\fIibv_asyncwactch\fR \-s
-+\fIibv_asyncwatch\fR \-G \-s
-+\fIibv_asyncwatch\fR \-M \-s
-+\fIibv_asyncwatch\fR \-G [\-p port] \-s<guid1>,<guid2>,...
-+\fIibv_asyncwatch\fR \-M [\-p port] \-s<mgid1>,<mgid2>,...
-+.fi
-+.sp
- .SH DESCRIPTION
- .PP
--Display asynchronous events forwarded to userspace for an RDMA device.
-+Display asynchronous events forwarded to userspace for an InfiniBand device.
-+SM events can be monitored using the '-s' option, which optionally
-+takes a remote port GUID, or list of remote port GUIDS separated by ','.
-+If '-s' is specified with no argument then all remote nodes reachable
-+form device 0 are monitored, otherwise only the specified remote
-+nodes are monitored. The following SM events are monitored using
-+the '-s' option: 
- 
--.SH AUTHORS
--.TP
--Roland Dreier
--.RI < [email protected] >
-+    IBV_SM_EVENT_MCG_CREATED
-+         An MCG specified by the "mgid" has been created
-+         on this subnet.
-+
-+    IBV_SM_EVENT_MCG_DELETED
-+         The MCG specified by the "mgid" has been deleted
-+         on this subnet.
-+
-+    IBV_SM_EVENT_GID_AVAIL
-+         The GID specified by the "guid" is available
-+         on this subnet.
-+
-+    IBV_SM_EVENT_GID_UNAVAIL
-+         The GID specified by the "guid" is no longer
-+         available on this subnet.
-+
-+.SH OPTIONS
-+.pp
-+\-G               Monitor SM event for Unicast GIDs
-+.sp
-+.pp
-+\-M               Monitor SM event for Multicast GIDs
-+.pp
-+\-s<GUID>         Takes as an optional argument a comma separated list of remote port GUIDs if \-G is specified or Multicast GIDs if \-M is specified.
-+.sp
-+.PP
-+\-p <port>        use the specified ca_port.
-+.sp
-+.pp
-+.SH EXAMPLES
-+.PP
-+To monitor event=IBV_SM_EVENT_ALL
-+.sp
-+ibv_asyncwatch -s
-+.sp
-+To monitor event=IBV_SM_EVENT_UGID_ALL
-+.sp
-+ibv_asyncwatch -G -s
-+.sp
-+To monitor event=IBV_SM_EVENT_MGID_ALL
-+.sp
-+ibv_asyncwatch -M -s
-+.sp
-+To monitor event=IBV_SM_EVENT_UGID
-+.sp
-+ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da
-+.sp
-+To monitor event=IBV_SM_EVENT_MGID
-+.sp
-+ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238
-+.sp
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_open_device.3 libibverbs-1.1.4/man/ibv_open_device.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_open_device.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_open_device.3	Mon Mar 28 03:11:46 2011
-@@ -2,7 +2,7 @@
- .\"
- .TH IBV_OPEN_DEVICE 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
- .SH "NAME"
--ibv_open_device, ibv_close_device \- open and close an RDMA device context
-+ibv_open_device, ibv_close_device \- open and close an InfiniBand device context
- .SH "SYNOPSIS"
- .nf
- .B #include <infiniband/verbs.h>
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_comp_channel.3 libibverbs-1.1.4/man/ibv_create_comp_channel.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_create_comp_channel.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_create_comp_channel.3	Mon Mar 28 03:11:45 2011
-@@ -15,7 +15,7 @@
- .fi
- .SH "DESCRIPTION"
- .B ibv_create_comp_channel()
--creates a completion event channel for the RDMA device context
-+creates a completion event channel for the InfiniBand device context
- .I context\fR.
- .PP
- .B ibv_destroy_comp_channel()
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_cq.3 libibverbs-1.1.4/man/ibv_create_cq.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_create_cq.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_create_cq.3	Mon Mar 28 03:11:45 2011
-@@ -18,7 +18,7 @@
- .B ibv_create_cq()
- creates a completion queue (CQ) with at least
- .I cqe
--entries for the RDMA device context
-+entries for the InfiniBand device context
- .I context\fR.
- The pointer
- .I cq_context
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_devices.1 libibverbs-1.1.4/man/ibv_devices.1
---- /tmp/846623/libibverbs-1.1.4/man/ibv_devices.1	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_devices.1	Mon Mar 28 03:11:45 2011
-@@ -1,7 +1,7 @@
- .TH IBV_DEVICES 1 "August 30, 2005" "libibverbs" "USER COMMANDS"
- 
- .SH NAME
--ibv_devices \- list RDMA devices
-+ibv_devices \- list InfiniBand devices
- 
- .SH SYNOPSIS
- .B ibv_devices
-@@ -8,8 +8,37 @@
- 
- .SH DESCRIPTION
- .PP
--List RDMA devices available for use from userspace.
-+List InfiniBand devices available for use from userspace.
- 
-+On SR-IOV capable systems, if a domain is configured with
-+VFs (Virtual Function), ibv_devices lists for each IB device
-+the node GUID and the type (PF or VF).  In this case, the PF
-+devices are displayed before the VF devices.  The following
-+shows the results of running ibv_devices on a domain with
-+one PF and two VFs:
-+
-+    device                 node GUID            type
-+    ------              ----------------        ----
-+    mlx4_2              00212800013f3126         PF
-+    mlx4_0              00212d00013f3126         VF
-+    mlx4_1              00212900013f3126         VF
-+
-+If all of the IB devices are PFs, only node GUIDs are
-+listed.  The following shows the results of running
-+ibv_devices on a domain with one PF and no VFs:
-+
-+    device                 node GUID
-+    ------              ----------------
-+    mlx4_0              00212800013f3126
-+
-+On systems which are not SR-IOV capable only node GUIDs are
-+listed.
-+
-+    device                 node GUID
-+    ------              ----------------
-+    mlx4_0              0021280001a0e4d8
-+    mlx4_1              0021280001a0e754
-+
- .SH SEE ALSO
- .BR ibv_devinfo (1)
- 
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_qp.3 libibverbs-1.1.4/man/ibv_create_qp.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_create_qp.3	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/man/ibv_create_qp.3	Tue May  3 13:50:06 2011
-@@ -28,7 +28,7 @@
- struct ibv_cq          *recv_cq;        /* CQ to be associated with the Receive Queue (RQ) */
- struct ibv_srq         *srq;            /* SRQ handle if QP is to be associated with an SRQ, otherwise NULL */
- struct ibv_qp_cap       cap;            /* QP capabilities */
--enum ibv_qp_type        qp_type;        /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD, IBV_QPT_XRC or IBV_QPT_RAW_PACKET */
-+enum ibv_qp_type        qp_type;        /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD, IBV_QPT_XRC */
- int                     sq_sig_all;     /* If set, each Work Request (WR) submitted to the SQ generates a completion entry */
- struct ibv_xrc_domain  *xrc_domain;     /* XRC domain the QP will be associated with (valid only for IBV_QPT_XRC QP), otherwise NULL */
- .in -8
-diff -r -u /tmp/846623/libibverbs-1.1.4/man/ibv_create_ah_from_wc.3 libibverbs-1.1.4/man/ibv_create_ah_from_wc.3
---- /tmp/846623/libibverbs-1.1.4/man/ibv_create_ah_from_wc.3	Thu Mar 10 04:51:46 2011
-+++ libibverbs-1.1.4/man/ibv_create_ah_from_wc.3	Mon Mar 28 03:11:45 2011
-@@ -21,7 +21,7 @@
- .B ibv_init_ah_from_wc()
- initializes the address handle (AH) attribute structure
- .I ah_attr
--for the RDMA device context
-+for the InfiniBand device context
- .I context
- using the port number
- .I port_num\fR,
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/kern_abi.h libibverbs-1.1.4/src/kern_abi.h
---- /tmp/846623/libibverbs-1.1.4/src/kern_abi.h	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/src/kern_abi.h	Fri Feb 11 04:02:32 2011
-@@ -33,7 +33,11 @@
- #ifndef KERN_ABI_H
- #define KERN_ABI_H
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <linux/types.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- /*
-  * Increment this value if any changes that break userspace ABI
-@@ -47,7 +51,10 @@
- 	IB_USER_VERBS_CMD_ALLOC_PD,
- 	IB_USER_VERBS_CMD_DEALLOC_PD,
- 	IB_USER_VERBS_CMD_REG_MR,
--	IB_USER_VERBS_CMD_DEREG_MR
-+	IB_USER_VERBS_CMD_DEREG_MR,
-+	IB_USER_VERBS_CMD_REG_MR_RELAXED,
-+	IB_USER_VERBS_CMD_DEREG_MR_RELAXED,
-+	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR
- };
- 
- /*
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/verbs.c libibverbs-1.1.4/src/verbs.c
---- /tmp/846623/libibverbs-1.1.4/src/verbs.c	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/src/verbs.c	Fri Feb 11 04:02:33 2011
-@@ -41,9 +41,24 @@
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <fcntl.h>
-+#include <sys/stat.h>
-+#include <sys/mkdev.h>
-+#endif
- 
- #include "ibverbs.h"
- 
-+#define	IBV_IS_VALID_UGID(gid)	\
-+	(gid->raw[0] != 0xff)
-+
-+#define	IBV_IS_VALID_MGID(gid)					\
-+	((gids->raw[0] == 0xff) &&				\
-+	((gids->raw[1] == 0x0e) || (gids->raw[1] == 0x02) ||	\
-+	(gids->raw[1] == 0x05)  || (gids->raw[1] == 0x08) ||	\
-+	(gids->raw[1] == 0x1e)  || (gids->raw[1] == 0x12) ||	\
-+	(gids->raw[1] == 0x15)  || (gids->raw[1] == 0x18)))
-+
- int ibv_rate_to_mult(enum ibv_rate rate)
- {
- 	switch (rate) {
-@@ -76,6 +91,54 @@
- 	}
- }
- 
-+int ibv_rate_to_mbps(enum ibv_rate rate)
-+{
-+	switch (rate) {
-+	case IBV_RATE_2_5_GBPS: return 2500;
-+	case IBV_RATE_5_GBPS:   return 5000;
-+	case IBV_RATE_10_GBPS:  return 10000;
-+	case IBV_RATE_20_GBPS:  return 20000;
-+	case IBV_RATE_30_GBPS:  return 30000;
-+	case IBV_RATE_40_GBPS:  return 40000;
-+	case IBV_RATE_60_GBPS:  return 60000;
-+	case IBV_RATE_80_GBPS:  return 80000;
-+	case IBV_RATE_120_GBPS: return 120000;
-+	case IBV_RATE_14_GBPS:  return 14062;
-+	case IBV_RATE_56_GBPS:  return 56250;
-+	case IBV_RATE_112_GBPS: return 112500;
-+	case IBV_RATE_168_GBPS: return 168750;
-+	case IBV_RATE_25_GBPS:  return 25781;
-+	case IBV_RATE_100_GBPS: return 103125;
-+	case IBV_RATE_200_GBPS: return 206250;
-+	case IBV_RATE_300_GBPS: return 309375;
-+	default:               return -1;
-+	}
-+}
-+
-+enum ibv_rate mbps_to_ibv_rate(int mbps)
-+{
-+	switch (mbps) {
-+	case 2500:   return IBV_RATE_2_5_GBPS;
-+	case 5000:   return IBV_RATE_5_GBPS;
-+	case 10000:  return IBV_RATE_10_GBPS;
-+	case 20000:  return IBV_RATE_20_GBPS;
-+	case 30000:  return IBV_RATE_30_GBPS;
-+	case 40000:  return IBV_RATE_40_GBPS;
-+	case 60000:  return IBV_RATE_60_GBPS;
-+	case 80000:  return IBV_RATE_80_GBPS;
-+	case 120000: return IBV_RATE_120_GBPS;
-+	case 14062:  return IBV_RATE_14_GBPS;
-+	case 56250:  return IBV_RATE_56_GBPS;
-+	case 112500: return IBV_RATE_112_GBPS;
-+	case 168750: return IBV_RATE_168_GBPS;
-+	case 25781:  return IBV_RATE_25_GBPS;
-+	case 103125: return IBV_RATE_100_GBPS;
-+	case 206250: return IBV_RATE_200_GBPS;
-+	case 309375: return IBV_RATE_300_GBPS;
-+	default:     return IBV_RATE_MAX;
-+	}
-+}
-+
- int __ibv_query_device(struct ibv_context *context,
- 		       struct ibv_device_attr *device_attr)
- {
-@@ -93,6 +156,12 @@
- int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
- 		    int index, union ibv_gid *gid)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	extern int sol_ibv_query_gid();
-+
-+	return sol_ibv_query_gid(context, port_num, index, gid);
-+
-+#else
- 	char name[24];
- 	char attr[41];
- 	uint16_t val;
-@@ -112,6 +181,7 @@
- 	}
- 
- 	return 0;
-+#endif
- }
- default_symver(__ibv_query_gid, ibv_query_gid);
- 
-@@ -118,6 +188,12 @@
- int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
- 		     int index, uint16_t *pkey)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	extern int sol_ibv_query_pkey();
-+
-+	return sol_ibv_query_pkey(context, port_num, index, pkey);
-+
-+#else
- 	char name[24];
- 	char attr[8];
- 	uint16_t val;
-@@ -133,9 +209,159 @@
- 
- 	*pkey = htons(val);
- 	return 0;
-+#endif
- }
- default_symver(__ibv_query_pkey, ibv_query_pkey);
- 
-+int ibv_register_sm_events(struct ibv_context *context,
-+    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
-+{
-+	struct ibv_reg_sm_event		*cmd;
-+	int				cmd_size, data_size;
-+	void				*data_p;
-+
-+	if (((gid_num > 0) && (gids == NULL)) ||
-+	   ((gid_num == 0) && (gids != NULL))) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
-+	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
-+	    (event != IBV_SM_EVENT_ALL)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
-+	    (gid_num == 0)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if (((event == IBV_SM_EVENT_UGID_ALL) ||
-+	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
-+	    (gid_num != 0)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	data_size = gid_num * (sizeof (union ibv_gid));
-+	cmd_size = (sizeof (struct ibv_reg_sm_event)) + data_size;
-+	data_p = (void *)gids;
-+	cmd  = alloca(cmd_size);
-+	cmd->data_num = gid_num;
-+
-+	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	IBV_INIT_CMD(cmd, cmd_size, REG_SM_EVENT);
-+
-+	cmd->events = event;
-+	if (gid_num > 0)
-+		memcpy(cmd->driver_data, data_p, data_size);
-+
-+	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	return (0);
-+}
-+
-+int ibv_unregister_sm_events(struct ibv_context *context,
-+    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids)
-+{
-+	struct ibv_unreg_sm_event	*cmd;
-+	int				cmd_size, data_size;
-+	void				*data_p;
-+
-+	if (((gid_num > 0) && (gids == NULL)) ||
-+	   ((gid_num == 0) && (gids != NULL))) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if ((event != IBV_SM_EVENT_UGID) && (event != IBV_SM_EVENT_UGID_ALL) &&
-+	    (event != IBV_SM_EVENT_MGID) && (event != IBV_SM_EVENT_MGID_ALL) &&
-+	    (event != IBV_SM_EVENT_ALL)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if (((event == IBV_SM_EVENT_UGID) || (event == IBV_SM_EVENT_MGID)) &&
-+	    (gid_num == 0)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if (((event == IBV_SM_EVENT_UGID_ALL) ||
-+	    (event == IBV_SM_EVENT_MGID_ALL) || (event == IBV_SM_EVENT_ALL)) &&
-+	    (gid_num != 0)) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	data_size = gid_num*(sizeof (union ibv_gid));
-+	cmd_size = (sizeof (struct ibv_unreg_sm_event)) + data_size;
-+	data_p = (void *)gids;
-+	cmd  = alloca(cmd_size);
-+	cmd->data_num = gid_num;
-+
-+	if ((event == IBV_SM_EVENT_UGID) && (!IBV_IS_VALID_UGID(gids))) { 
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	if ((event == IBV_SM_EVENT_MGID) && (!IBV_IS_VALID_MGID(gids))) { 
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	IBV_INIT_CMD(cmd, cmd_size, UNREG_SM_EVENT);
-+
-+	cmd->events = event;
-+	if (gid_num > 0)
-+		memcpy(cmd->driver_data, data_p, data_size);
-+
-+	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) {
-+		errno = EINVAL;
-+		return (-1);
-+	}
-+
-+	return (0);
-+}
-+
-+int ibv_gid_reachable(struct ibv_context *context,
-+    uint_t port, union ibv_gid *gid_p, int timeout)
-+{
-+	struct ibv_gid_reachable	*cmd;
-+	int				rc;
-+
-+	cmd = alloca((sizeof (struct ibv_gid_reachable)));
-+	cmd->port_num = port;
-+	cmd->timeout = timeout;
-+
-+	IBV_INIT_CMD(cmd, sizeof (struct ibv_gid_reachable),
-+	    GID_REACHABLE);
-+
-+	memcpy(cmd->gid, gid_p, sizeof (*gid_p));
-+
-+	rc = write(context->cmd_fd, cmd, sizeof(struct ibv_gid_reachable));
-+	if (rc < 0) {
-+		return (-1);
-+	}
-+
-+	return (0);
-+}
-+
- struct ibv_pd *__ibv_alloc_pd(struct ibv_context *context)
- {
- 	struct ibv_pd *pd;
-@@ -148,6 +374,27 @@
- }
- default_symver(__ibv_alloc_pd, ibv_alloc_pd);
- 
-+struct ibv_shpd *__ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
-+{
-+
-+	shpd = pd->context->ops.alloc_shpd(pd, share_key, shpd);
-+
-+	return shpd;
-+}
-+default_symver(__ibv_alloc_shpd, ibv_alloc_shpd);
-+
-+struct ibv_pd *__ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
-+{
-+	struct ibv_pd *pd;
-+
-+	pd = context->ops.share_pd(context, shpd, share_key);
-+	if (pd)
-+		pd->context = context;
-+
-+	return pd;
-+}
-+default_symver(__ibv_share_pd, ibv_share_pd);
-+
- int __ibv_dealloc_pd(struct ibv_pd *pd)
- {
- 	return pd->context->ops.dealloc_pd(pd);
-@@ -175,6 +422,27 @@
- }
- default_symver(__ibv_reg_mr, ibv_reg_mr);
- 
-+struct ibv_mr *__ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
-+			    size_t length, int access)
-+{
-+	struct ibv_mr *mr;
-+
-+	if (ibv_dontfork_range(addr, length))
-+		return NULL;
-+
-+	mr = pd->context->ops.reg_mr_relaxed(pd, addr, length, access);
-+	if (mr) {
-+		mr->context = pd->context;
-+		mr->pd      = pd;
-+		mr->addr    = addr;
-+		mr->length  = length;
-+	} else
-+		ibv_dofork_range(addr, length);
-+
-+	return mr;
-+}
-+default_symver(__ibv_reg_mr_relaxed, ibv_reg_mr_relaxed);
-+
- int __ibv_dereg_mr(struct ibv_mr *mr)
- {
- 	int ret;
-@@ -189,6 +457,26 @@
- }
- default_symver(__ibv_dereg_mr, ibv_dereg_mr);
- 
-+int __ibv_dereg_mr_relaxed(struct ibv_mr *mr)
-+{
-+	int ret;
-+	void *addr	= mr->addr;
-+	size_t length	= mr->length;
-+
-+	ret = mr->context->ops.dereg_mr_relaxed(mr);
-+	if (!ret)
-+		ibv_dofork_range(addr, length);
-+
-+	return ret;
-+}
-+default_symver(__ibv_dereg_mr_relaxed, ibv_dereg_mr_relaxed);
-+
-+int __ibv_flush_relaxed_mr(struct ibv_pd *pd)
-+{
-+	return pd->context->ops.flush_relaxed_mr(pd);
-+}
-+default_symver(__ibv_flush_relaxed_mr, ibv_flush_relaxed_mr);
-+
- static struct ibv_comp_channel *ibv_create_comp_channel_v2(struct ibv_context *context)
- {
- 	struct ibv_abi_compat_v2 *t = context->abi_compat;
-@@ -212,6 +500,10 @@
- 	struct ibv_comp_channel            *channel;
- 	struct ibv_create_comp_channel      cmd;
- 	struct ibv_create_comp_channel_resp resp;
-+#if defined(__SVR4) && defined(__sun)
-+	int		event_fd;
-+	struct stat	fstat_buf;
-+#endif
- 
- 	if (abi_ver <= 2)
- 		return ibv_create_comp_channel_v2(context);
-@@ -221,7 +513,23 @@
- 		return NULL;
- 
- 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_COMP_CHANNEL, &resp, sizeof resp);
-+#if defined(__SVR4) && defined(__sun)
-+	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
-+	if (event_fd < 0) {
-+		free(channel);
-+		return NULL;
-+	}
-+
-+	if (fstat(event_fd, &fstat_buf)) {
-+		free(channel);
-+		return NULL;
-+	}
-+	resp.fd = minor(fstat_buf.st_rdev);
-+#endif
- 	if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
-+#if defined(__SVR4) && defined(__sun)
-+		close(event_fd);
-+#endif
- 		free(channel);
- 		return NULL;
- 	}
-@@ -228,6 +536,9 @@
- 
- 	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	resp.fd = event_fd;
-+#endif
- 	channel->context = context;
- 	channel->fd      = resp.fd;
- 	channel->refcnt  = 0;
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/device.c libibverbs-1.1.4/src/device.c
---- /tmp/846623/libibverbs-1.1.4/src/device.c	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/src/device.c	Fri Feb 11 04:02:31 2011
-@@ -122,6 +122,28 @@
- }
- default_symver(__ibv_get_device_guid, ibv_get_device_guid);
- 
-+uint64_t __ibv_get_device_guid_external(struct ibv_device *device)
-+{
-+	char attr[24];
-+	uint64_t guid = 0;
-+	uint16_t parts[4];
-+	int i;
-+
-+	if (ibv_read_sysfs_file(device->ibdev_path, "node_guid_external",
-+				attr, sizeof attr) < 0)
-+		return 0;
-+
-+	if (sscanf(attr, "%hx:%hx:%hx:%hx",
-+		   parts, parts + 1, parts + 2, parts + 3) != 4)
-+		return 0;
-+
-+	for (i = 0; i < 4; ++i)
-+		guid = (guid << 16) | parts[i];
-+
-+	return htonll(guid);
-+}
-+default_symver(__ibv_get_device_guid_external, ibv_get_device_guid_external);
-+
- struct ibv_context *__ibv_open_device(struct ibv_device *device)
- {
- 	char *devpath;
-@@ -128,8 +150,13 @@
- 	int cmd_fd;
- 	struct ibv_context *context;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	if (asprintf(&devpath, "/dev/infiniband/%s", device->dev_name) < 0)
- 		return NULL;
-+#else
-+	if (asprintf(&devpath, "/dev/infiniband/ofs/%s", device->dev_name) < 0)
-+		return NULL;
-+#endif		
- 
- 	/*
- 	 * We'll only be doing writes, but we need O_RDWR in case the
-@@ -141,6 +168,15 @@
- 	if (cmd_fd < 0)
- 		return NULL;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	/* We don't support parent-child sharing of IB resources on Solaris */
-+	if (fcntl(cmd_fd, F_SETFD, FD_CLOEXEC) < 0) {
-+		fprintf(stderr, "ibv_open_device: FD_CLOEXEC failed: %s\n",
-+		    strerror(errno));
-+		goto err;
-+	}
-+#endif
-+
- 	context = device->ops.alloc_context(device, cmd_fd);
- 	if (!context)
- 		goto err;
-@@ -163,6 +199,9 @@
- 	int async_fd = context->async_fd;
- 	int cmd_fd   = context->cmd_fd;
- 	int cq_fd    = -1;
-+#if defined(__SVR4) && defined(__sun)
-+	int mmap_fd   = context->mmap_fd;
-+#endif
- 
- 	if (abi_ver <= 2) {
- 		struct ibv_abi_compat_v2 *t = context->abi_compat;
-@@ -172,6 +211,11 @@
- 
- 	context->device->ops.free_context(context);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	if (mmap_fd > 0) {
-+		close(mmap_fd);
-+	}
-+#endif
- 	close(async_fd);
- 	close(cmd_fd);
- 	if (abi_ver <= 2)
-@@ -214,6 +258,15 @@
- 		case IBV_EVENT_SRQ_LIMIT_REACHED:
- 			event->element.srq = (void *) (uintptr_t) ev.element;
- 			break;
-+		case IBV_EVENT_GID_AVAIL:
-+		case IBV_EVENT_GID_UNAVAIL:
-+		case IBV_EVENT_MCG_CREATED:
-+		case IBV_EVENT_MCG_DELETED:
-+			event->element.gid.global.subnet_prefix
-+			    = ev.subnet_prefix;
-+                        event->element.gid.global.interface_id
-+			    = ev.interface_id;
-+			break;
- 		default:
- 			event->element.port_num = ev.element;
- 			break;
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/ibverbs.h libibverbs-1.1.4/src/ibverbs.h
---- /tmp/846623/libibverbs-1.1.4/src/ibverbs.h	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/src/ibverbs.h	Fri Feb 11 04:02:31 2011
-@@ -52,7 +52,12 @@
- #  define VALGRIND_MAKE_MEM_DEFINED(addr, len)
- #endif
- 
--#define HIDDEN		__attribute__((visibility ("hidden")))
-+#if defined(__SVR4) && defined(__sun)
-+#define	HIDDEN
-+#undef HAVE_SYMVER_SUPPORT
-+#else
-+#define	HIDDEN		__attribute__((visibility ("hidden")))
-+#endif
- 
- #define INIT		__attribute__((constructor))
- #define FINI		__attribute__((destructor))
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/libibverbs.map libibverbs-1.1.4/src/libibverbs.map
---- /tmp/846623/libibverbs-1.1.4/src/libibverbs.map	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/src/libibverbs.map	Mon Mar 28 13:44:44 2011
-@@ -12,10 +12,18 @@
- 		ibv_query_port;
- 		ibv_query_gid;
- 		ibv_query_pkey;
-+		ibv_register_sm_events;
-+		ibv_unregister_sm_events;
-+		ibv__gid_reachable;
- 		ibv_alloc_pd;
-+		ibv_alloc_shpd;
-+		ibv_share_pd;
- 		ibv_dealloc_pd;
- 		ibv_reg_mr;
-+		ibv_reg_mr_relaxed;
- 		ibv_dereg_mr;
-+		ibv_dereg_mr_relaxed;
-+		ibv_flush_relaxed_mr;
- 		ibv_create_comp_channel;
- 		ibv_destroy_comp_channel;
- 		ibv_create_cq;
-@@ -41,9 +49,14 @@
- 		ibv_cmd_query_gid;
- 		ibv_cmd_query_pkey;
- 		ibv_cmd_alloc_pd;
-+		ibv_cmd_alloc_shpd;
-+		ibv_cmd_share_pd;
- 		ibv_cmd_dealloc_pd;
- 		ibv_cmd_reg_mr;
-+		ibv_cmd_reg_mr_relaxed;
- 		ibv_cmd_dereg_mr;
-+		ibv_cmd_dereg_mr_relaxed;
-+		ibv_cmd_flush_relaxed_mr;
- 		ibv_cmd_create_cq;
- 		ibv_cmd_poll_cq;
- 		ibv_cmd_req_notify_cq;
-@@ -71,6 +84,7 @@
- 		mult_to_ibv_rate;
- 		ibv_get_sysfs_path;
- 		ibv_read_sysfs_file;
-+		sol_get_cpu_info;
- 
- 	local: *;
- };
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/cmd.c libibverbs-1.1.4/src/cmd.c
---- /tmp/846623/libibverbs-1.1.4/src/cmd.c	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/src/cmd.c	Fri Feb 11 04:02:31 2011
-@@ -42,9 +42,34 @@
- #include <errno.h>
- #include <alloca.h>
- #include <string.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <fcntl.h>
-+#include <sys/stat.h>
-+#include <sys/mkdev.h>
-+#endif
- 
- #include "ibverbs.h"
- 
-+#if defined(__SVR4) && defined(__sun)
-+extern int ibv_open_mmap_driver(char *dev_name);
-+
-+/*
-+ * Event file creation for GET_CONTEXT & CREATE_COMP_CHANNEL :
-+ * 	Solaris Uverbs driver supports creation of event file
-+ * 	from the open(2) system call only. Event file will not
-+ * 	be created by the write(2) syscall, for the above commands
-+ *	as in Linux OFED.
-+ *
-+ * Sequence of operations for GET_CONTEXT &  CREATE_COMP_CHANNEL :
-+ *	event_fd = open(UVERBS_EVENT_FILE, O_RDWR);
-+ *	fstat(event_fd, &fstat_buf);
-+ *	NOTE : Minor number of event file passed to driver 
-+ *	cmd.resp.fd = minor(fstat_buf.st_rdev);
-+ *	write(verbs_fd);
-+ *	NOTE : Initialize the fd to one got by opening event file
-+ *	cmd.resp.fd = event_fd;
-+ */
-+#endif
- static int ibv_cmd_get_context_v2(struct ibv_context *context,
- 				  struct ibv_get_context *new_cmd,
- 				  size_t new_cmd_size,
-@@ -55,6 +80,10 @@
- 	struct ibv_get_context_v2 *cmd;
- 	size_t cmd_size;
- 	uint32_t cq_fd;
-+#if defined(__SVR4) && defined(__sun)
-+	int			event_fd;
-+	struct stat		fstat_buf;
-+#endif
- 
- 	t = malloc(sizeof *t);
- 	if (!t)
-@@ -67,12 +96,45 @@
- 
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
- 	cmd->cq_fd_tab = (uintptr_t) &cq_fd;
-+#if defined(__SVR4) && defined(__sun)
-+	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
-+	if (event_fd < 0)
-+		return (errno);	
-+	if (fstat(event_fd, &fstat_buf))
-+		return (errno);
-+	resp->async_fd = minor(fstat_buf.st_rdev);
- 
-+	/*
-+	 * Open the underlying kernel hardware driver that will
-+	 * provide the mmap function for this context.
-+	 */
-+	context->mmap_fd = ibv_open_mmap_driver(context->device->dev_name);
-+	if (context->mmap_fd < 0) {
-+		fprintf(stderr, PFX "ibv_cmd_get_context: Mmap open failed\n");
-+	}
-+#endif
-+
- 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
-+#if defined(__SVR4) && defined(__sun)
-+	resp->async_fd = event_fd;
-+#endif
- 
- 	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	/* We don't support parent-child sharing of IB resources on Solaris */
-+	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
-+		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
-+		    "for async_fd: %s\n", strerror(errno));
-+		return errno;
-+	}
-+	if (fcntl(cq_fd, F_SETFD, FD_CLOEXEC) < 0) {
-+		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed "
-+		    "for cq_fd: %s\n", strerror(errno));
-+		return errno;
-+	}
-+#endif
- 	context->async_fd         = resp->async_fd;
- 	context->num_comp_vectors = 1;
- 	t->channel.context        = context;
-@@ -87,19 +149,50 @@
- 			size_t cmd_size, struct ibv_get_context_resp *resp,
- 			size_t resp_size)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	int			event_fd;
-+	struct stat		fstat_buf;
-+#endif
- 	if (abi_ver <= 2)
- 		return ibv_cmd_get_context_v2(context, cmd, cmd_size, resp, resp_size);
- 
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size);
-+#if defined(__SVR4) && defined(__sun)
-+	event_fd = open("/dev/infiniband/ofs/uverbs:event", O_RDWR);
-+	if (event_fd < 0)
-+		return (errno);	
-+	if (fstat(event_fd, &fstat_buf))
-+		return (errno);
-+	resp->async_fd = minor(fstat_buf.st_rdev);
- 
-+	/*
-+	 * Open the underlying kernel hardware driver that will
-+	 * provide the mmap function for this context.
-+	 */
-+	context->mmap_fd = ibv_open_mmap_driver(context->device->dev_name);
-+	if (context->mmap_fd < 0) {
-+		fprintf(stderr, PFX "ibv_cmd_get_context: Mmap open failed\n");
-+	}
-+#endif
- 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
-+#if defined(__SVR4) && defined(__sun)
-+	resp->async_fd = event_fd;
-+#endif
- 
- 	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	/* We don't support parent-child sharing of IB resources on Solaris */
-+	if (fcntl(resp->async_fd, F_SETFD, FD_CLOEXEC) < 0) {
-+		fprintf(stderr, "ibv_get_context: FD_CLOEXEC failed: %s\n",
-+		    strerror(errno));
-+		return errno;
-+	}
-+#endif
-+
- 	context->async_fd         = resp->async_fd;
- 	context->num_comp_vectors = resp->num_comp_vectors;
--
- 	return 0;
- }
- 
-@@ -120,6 +213,7 @@
- 	memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
- 	*raw_fw_ver			       = resp.fw_ver;
- 	device_attr->node_guid 		       = resp.node_guid;
-+	device_attr->node_guid_external	       = resp.node_guid_external;
- 	device_attr->sys_image_guid 	       = resp.sys_image_guid;
- 	device_attr->max_mr_size 	       = resp.max_mr_size;
- 	device_attr->page_size_cap 	       = resp.page_size_cap;
-@@ -207,6 +301,8 @@
- {
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size);
- 
-+	cmd->user_handle     = (uintptr_t) pd;
-+
- 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
- 
-@@ -218,6 +314,47 @@
- 	return 0;
- }
- 
-+int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
-+         uint64_t share_key, struct ibv_shpd *shpd,
-+		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
-+		     struct ibv_alloc_shpd_resp *resp, size_t resp_size)
-+{
-+	IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_SHPD, resp, resp_size);
-+        cmd->pd_handle = pd->handle;
-+	cmd->user_handle = (uintptr_t) pd;
-+	cmd->share_key = share_key;
-+
-+	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
-+		return errno;
-+
-+	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
-+
-+	shpd->handle  = resp->shpd_handle;
-+
-+	return 0;
-+}
-+
-+int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
-+         uint64_t share_key, struct ibv_pd *pd,
-+		     struct ibv_share_pd *cmd, size_t cmd_size,
-+		     struct ibv_share_pd_resp *resp, size_t resp_size)
-+{
-+	IBV_INIT_CMD_RESP(cmd, cmd_size, SHARE_PD, resp, resp_size);
-+	cmd->shpd_handle = shpd->handle;
-+	cmd->share_key = share_key;
-+	cmd->user_handle     = (uintptr_t) pd;
-+
-+	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
-+		return errno;
-+
-+	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
-+
-+	pd->handle  = resp->pd_handle;
-+	pd->context = context;
-+
-+	return 0;
-+}
-+
- int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
- {
- 	struct ibv_dealloc_pd cmd;
-@@ -224,6 +361,7 @@
- 
- 	IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD);
- 	cmd.pd_handle = pd->handle;
-+	cmd.user_handle = (uintptr_t) pd;
- 
- 	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -244,6 +382,7 @@
- 	cmd->length 	  = length;
- 	cmd->hca_va 	  = hca_va;
- 	cmd->pd_handle 	  = pd->handle;
-+	cmd->user_handle  = (uintptr_t) mr;
- 	cmd->access_flags = access;
- 
- 	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
-@@ -259,6 +398,35 @@
- 	return 0;
- }
- 
-+int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
-+		   uint64_t hca_va, int access,
-+		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
-+		   size_t cmd_size,
-+		   struct ibv_reg_mr_resp *resp, size_t resp_size)
-+{
-+
-+	IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR_RELAXED, resp, resp_size);
-+
-+	cmd->start 	  = (uintptr_t) addr;
-+	cmd->length 	  = length;
-+	cmd->hca_va 	  = hca_va;
-+	cmd->pd_handle 	  = pd->handle;
-+	cmd->user_handle  = (uintptr_t) mr;
-+	cmd->access_flags = access;
-+
-+	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
-+		return errno;
-+
-+	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
-+
-+	mr->handle  = resp->mr_handle;
-+	mr->lkey    = resp->lkey;
-+	mr->rkey    = resp->rkey;
-+	mr->context = pd->context;
-+
-+	return 0;
-+}
-+
- int ibv_cmd_dereg_mr(struct ibv_mr *mr)
- {
- 	struct ibv_dereg_mr cmd;
-@@ -265,6 +433,7 @@
- 
- 	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR);
- 	cmd.mr_handle = mr->handle;
-+	cmd.user_handle  = (uintptr_t) mr;
- 
- 	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -272,6 +441,34 @@
- 	return 0;
- }
- 
-+int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr)
-+{
-+	struct ibv_dereg_mr cmd;
-+
-+	IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR_RELAXED);
-+	cmd.mr_handle = mr->handle;
-+	cmd.user_handle  = (uintptr_t) mr;
-+
-+	if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
-+		return errno;
-+
-+	return 0;
-+}
-+
-+int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd)
-+{
-+	struct ibv_flush_relaxed_mr cmd;
-+
-+	IBV_INIT_CMD(&cmd, sizeof cmd, FLUSH_RELAXED_MR);
-+	cmd.pd_handle = pd->handle;
-+	cmd.user_handle  = (uintptr_t) pd;
-+
-+	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
-+		return errno;
-+
-+	return 0;
-+}
-+
- static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
- 				struct ibv_cq *cq,
- 				struct ibv_create_cq *new_cmd, size_t new_cmd_size,
-@@ -315,7 +512,19 @@
- 	cmd->user_handle   = (uintptr_t) cq;
- 	cmd->cqe           = cqe;
- 	cmd->comp_vector   = comp_vector;
-+#if defined(__SVR4) && defined(__sun)
-+	if (channel) {
-+		struct stat	fstat_buf;
-+
-+		if (fstat(channel->fd, &fstat_buf))
-+			return (errno);
-+		else
-+			cmd->comp_channel = minor(fstat_buf.st_rdev);
-+	} else 
-+		cmd->comp_channel = 0;
-+#else
- 	cmd->comp_channel  = channel ? channel->fd : -1;
-+#endif
- 	cmd->reserved      = 0;
- 
- 	if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
-@@ -346,6 +555,7 @@
- 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize);
- 	cmd.cq_handle = ibcq->handle;
- 	cmd.ne        = ne;
-+	cmd.user_handle  = (uintptr_t) ibcq;
- 
- 	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) {
- 		ret = -1;
-@@ -384,6 +594,7 @@
- 	IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ);
- 	cmd.cq_handle = ibcq->handle;
- 	cmd.solicited = !!solicited_only;
-+	cmd.user_handle  = (uintptr_t) ibcq;
- 
- 	if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -399,6 +610,7 @@
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
- 	cmd->cq_handle = cq->handle;
- 	cmd->cqe       = cqe;
-+	cmd->user_handle   = (uintptr_t) cq;
- 
- 	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
-@@ -434,6 +646,7 @@
- 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp);
- 	cmd.cq_handle = cq->handle;
- 	cmd.reserved  = 0;
-+	cmd.user_handle  = (uintptr_t) cq;
- 
- 	if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -555,6 +768,7 @@
- 	cmd->attr_mask	= srq_attr_mask;
- 	cmd->max_wr	= srq_attr->max_wr;
- 	cmd->srq_limit	= srq_attr->srq_limit;
-+	cmd->user_handle   = (uintptr_t) srq;
- 
- 	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
-@@ -569,6 +783,7 @@
- 
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
- 	cmd->srq_handle = srq->handle;
-+	cmd->user_handle   = (uintptr_t) srq;
- 	cmd->reserved   = 0;
- 
- 	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
-@@ -606,6 +821,7 @@
- 
- 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp);
- 	cmd.srq_handle = srq->handle;
-+	cmd.user_handle  = (uintptr_t) srq;
- 	cmd.reserved   = 0;
- 
- 	if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
-@@ -637,7 +853,20 @@
- 	cmd->max_send_sge    = attr->cap.max_send_sge;
- 	cmd->max_recv_sge    = attr->cap.max_recv_sge;
- 	cmd->max_inline_data = attr->cap.max_inline_data;
-+
-+#if defined(__SVR4) && defined(__sun)
-+	if (attr->sq_sig_all & LIB_RDMACM_QP_BIT) {
-+		cmd->sq_sig_all =
-+		    (uint8_t)(attr->sq_sig_all & ~LIB_RDMACM_QP_BIT);
-+		cmd->sq_sig_all |= 0x80;
-+		attr->sq_sig_all &= ~LIB_RDMACM_QP_BIT;
-+	} else {
-+		cmd->sq_sig_all = (uint8_t)attr->sq_sig_all;
-+	}
-+#else
- 	cmd->sq_sig_all	     = attr->sq_sig_all;
-+#endif
-+
- 	cmd->qp_type 	     = attr->qp_type;
- 	cmd->is_srq 	     = !!attr->srq;
- 	cmd->srq_handle      = attr->qp_type == IBV_QPT_XRC ?
-@@ -691,6 +920,7 @@
- 	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp);
- 	cmd->qp_handle = qp->handle;
- 	cmd->attr_mask = attr_mask;
-+	cmd->user_handle   = (uintptr_t) qp;
- 
- 	if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
-@@ -772,6 +1002,7 @@
- 	IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP);
- 
- 	cmd->qp_handle 		 = qp->handle;
-+	cmd->user_handle   	 = (uintptr_t) qp;
- 	cmd->attr_mask 		 = attr_mask;
- 	cmd->qkey 		 = attr->qkey;
- 	cmd->rq_psn 		 = attr->rq_psn;
-@@ -1236,38 +1467,47 @@
- 	return ret;
- }
- 
--int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
--		      struct ibv_ah_attr *attr)
-+int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr,
-+			 struct ibv_create_ah *cmd, size_t cmd_size,
-+			 struct ibv_create_ah_resp *resp, size_t resp_size)
- {
--	struct ibv_create_ah      cmd;
--	struct ibv_create_ah_resp resp;
-+	IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size);
-+	cmd->user_handle            = (uintptr_t) ah;
-+	cmd->pd_handle              = pd->handle;
-+	cmd->reserved               = 0;
-+	cmd->attr.dlid              = attr->dlid;
-+	cmd->attr.sl                = attr->sl;
-+	cmd->attr.src_path_bits     = attr->src_path_bits;
-+	cmd->attr.static_rate       = attr->static_rate;
-+	cmd->attr.is_global         = attr->is_global;
-+	cmd->attr.port_num          = attr->port_num;
-+	cmd->attr.grh.flow_label    = attr->grh.flow_label;
-+	cmd->attr.grh.sgid_index    = attr->grh.sgid_index;
-+	cmd->attr.grh.hop_limit     = attr->grh.hop_limit;
-+	cmd->attr.grh.traffic_class = attr->grh.traffic_class;
-+	cmd->attr.grh.reserved      = 0;
-+	cmd->attr.reserved          = 0;
-+	memcpy(cmd->attr.grh.dgid, attr->grh.dgid.raw, 16);
- 
--	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, &resp, sizeof resp);
--	cmd.user_handle            = (uintptr_t) ah;
--	cmd.pd_handle              = pd->handle;
--	cmd.attr.dlid              = attr->dlid;
--	cmd.attr.sl                = attr->sl;
--	cmd.attr.src_path_bits     = attr->src_path_bits;
--	cmd.attr.static_rate       = attr->static_rate;
--	cmd.attr.is_global         = attr->is_global;
--	cmd.attr.port_num          = attr->port_num;
--	cmd.attr.grh.flow_label    = attr->grh.flow_label;
--	cmd.attr.grh.sgid_index    = attr->grh.sgid_index;
--	cmd.attr.grh.hop_limit     = attr->grh.hop_limit;
--	cmd.attr.grh.traffic_class = attr->grh.traffic_class;
--	memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16);
--
--	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
-+	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
- 		return errno;
- 
--	VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
-+	VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
- 
--	ah->handle  = resp.handle;
-+	ah->handle  = resp->handle;
- 	ah->context = pd->context;
- 
- 	return 0;
- }
- 
-+int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
-+		      struct ibv_ah_attr *attr)
-+{
-+	struct ibv_create_ah      cmd;
-+	struct ibv_create_ah_resp resp;
-+	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp, sizeof(resp));
-+}
-+
- int ibv_cmd_destroy_ah(struct ibv_ah *ah)
- {
- 	struct ibv_destroy_ah cmd;
-@@ -1274,6 +1514,7 @@
- 
- 	IBV_INIT_CMD(&cmd, sizeof cmd, DESTROY_AH);
- 	cmd.ah_handle = ah->handle;
-+	cmd.user_handle            = (uintptr_t) ah;
- 
- 	if (write(ah->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -1292,6 +1533,7 @@
- 	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp);
- 	cmd.qp_handle = qp->handle;
- 	cmd.reserved  = 0;
-+	cmd.user_handle  = (uintptr_t) qp;
- 
- 	if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
- 		return errno;
-@@ -1313,6 +1555,7 @@
- 	IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST);
- 	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
- 	cmd.qp_handle = qp->handle;
-+	cmd.user_handle  = (uintptr_t) qp;
- 	cmd.mlid      = lid;
- 	cmd.reserved  = 0;
- 
-@@ -1329,6 +1572,7 @@
- 	IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST);
- 	memcpy(cmd.gid, gid->raw, sizeof cmd.gid);
- 	cmd.qp_handle = qp->handle;
-+	cmd.user_handle  = (uintptr_t) qp;
- 	cmd.mlid      = lid;
- 	cmd.reserved  = 0;
- 
-@@ -1406,4 +1650,3 @@
- 		return errno;
- 	return 0;
- }
--
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/init.c libibverbs-1.1.4/src/init.c
---- /tmp/846623/libibverbs-1.1.4/src/init.c	Sun Nov  1 06:47:19 2009
-+++ libibverbs-1.1.4/src/init.c	Fri Feb 11 04:02:32 2011
-@@ -77,8 +77,13 @@
- static struct ibv_driver_name *driver_name_list;
- static struct ibv_driver *head_driver, *tail_driver;
- 
-+static uint blueflame_enabled = 0;
-+
- static int find_sysfs_devs(void)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	char device_path[IBV_SYSFS_PATH_MAX];
-+#endif
- 	char class_path[IBV_SYSFS_PATH_MAX];
- 	DIR *class_dir;
- 	struct dirent *dent;
-@@ -86,19 +91,35 @@
- 	char value[8];
- 	int ret = 0;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	snprintf(device_path, sizeof device_path, "/dev/infiniband/ofs");
-+#endif
- 	snprintf(class_path, sizeof class_path, "%s/class/infiniband_verbs",
- 		 ibv_get_sysfs_path());
- 
-+#if defined(__SVR4) && defined(__sun)
-+	class_dir = opendir(device_path);
-+#else
- 	class_dir = opendir(class_path);
-+#endif
- 	if (!class_dir)
- 		return ENOSYS;
- 
- 	while ((dent = readdir(class_dir))) {
-+#if defined(__SVR4) && defined(__sun)
-+		int adapter_num;
-+#else
- 		struct stat buf;
-+#endif
- 
- 		if (dent->d_name[0] == '.')
- 			continue;
- 
-+#if defined(__SVR4) && defined(__sun)
-+		if (sscanf(dent->d_name, "uverbs%d",
-+		    &adapter_num) != 1)
-+			continue;
-+#endif
- 		if (!sysfs_dev)
- 			sysfs_dev = malloc(sizeof *sysfs_dev);
- 		if (!sysfs_dev) {
-@@ -109,6 +130,7 @@
- 		snprintf(sysfs_dev->sysfs_path, sizeof sysfs_dev->sysfs_path,
- 			 "%s/%s", class_path, dent->d_name);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 		if (stat(sysfs_dev->sysfs_path, &buf)) {
- 			fprintf(stderr, PFX "Warning: couldn't stat '%s'.\n",
- 				sysfs_dev->sysfs_path);
-@@ -117,6 +139,7 @@
- 
- 		if (!S_ISDIR(buf.st_mode))
- 			continue;
-+#endif
- 
- 		snprintf(sysfs_dev->sysfs_name, sizeof sysfs_dev->sysfs_name,
- 			"%s", dent->d_name);
-@@ -280,6 +303,13 @@
- 
- 			driver_name->next = driver_name_list;
- 			driver_name_list  = driver_name;
-+		} else if (strcmp(field, "blueflame") == 0) {
-+			config += strspn(config, "\t ");
-+			field = strsep(&config, "\n\t ");
-+			if (strcmp(field, "enable") == 0)
-+				blueflame_enabled = 1;
-+			if (strcmp(field, "disable") == 0)
-+				blueflame_enabled = 0;
- 		} else
- 			fprintf(stderr, PFX "Warning: ignoring bad config directive "
- 				"'%s' in file '%s'.\n", field, path);
-@@ -367,6 +397,7 @@
- 	strcpy(dev->dev_path,   sysfs_dev->sysfs_path);
- 	strcpy(dev->name,       sysfs_dev->ibdev_name);
- 	strcpy(dev->ibdev_path, sysfs_dev->ibdev_path);
-+	dev->blueflame_enabled = blueflame_enabled;
- 
- 	return dev;
- }
-@@ -409,6 +440,7 @@
- 
- static void check_memlock_limit(void)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	struct rlimit rlim;
- 
- 	if (!geteuid())
-@@ -423,6 +455,7 @@
- 		fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %lu bytes.\n"
- 			"    This will severely limit memory registrations.\n",
- 			rlim.rlim_cur);
-+#endif
- }
- 
- static void add_device(struct ibv_device *dev,
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/enum_strs.c libibverbs-1.1.4/src/enum_strs.c
---- /tmp/846623/libibverbs-1.1.4/src/enum_strs.c	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/src/enum_strs.c	Tue Mar 20 16:27:45 2012
-@@ -85,9 +85,14 @@
- 		[IBV_EVENT_SRQ_LIMIT_REACHED]	= "SRQ limit reached",
- 		[IBV_EVENT_QP_LAST_WQE_REACHED]	= "last WQE reached",
- 		[IBV_EVENT_CLIENT_REREGISTER]	= "client reregistration",
-+		[IBV_EVENT_GID_CHANGE]		= "GID change",
-+		[IBV_EVENT_MCG_CREATED]		= "MCG created",
-+		[IBV_EVENT_MCG_DELETED]		= "MCG deleted",
-+		[IBV_EVENT_GID_AVAIL]		= "GID available",
-+		[IBV_EVENT_GID_UNAVAIL]		= "GID unavailable",
- 	};
- 
--	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_CLIENT_REREGISTER)
-+	if (event < IBV_EVENT_CQ_ERR || event > IBV_EVENT_GID_UNAVAIL)
- 		return "unknown";
- 
- 	return event_type_str[event];
-diff -r -u /tmp/846623/libibverbs-1.1.4/src/sysfs.c libibverbs-1.1.4/src/sysfs.c
---- /tmp/846623/libibverbs-1.1.4/src/sysfs.c	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/src/sysfs.c	Fri Feb 11 04:02:33 2011
-@@ -44,6 +44,10 @@
- 
- #include "ibverbs.h"
- 
-+#if defined(__SVR4) && defined(__sun)
-+int sol_read_sysfs_file(char *path, char *buf, size_t size);
-+#endif
-+
- static char *sysfs_path;
- 
- const char *ibv_get_sysfs_path(void)
-@@ -79,12 +83,18 @@
- 			char *buf, size_t size)
- {
- 	char *path;
-+#if !(defined(__SVR4) && defined(__sun))
- 	int fd;
-+#endif
- 	int len;
- 
- 	if (asprintf(&path, "%s/%s", dir, file) < 0)
- 		return -1;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	len = sol_read_sysfs_file(path, buf, size);
-+	free(path);
-+#else
- 	fd = open(path, O_RDONLY);
- 	if (fd < 0) {
- 		free(path);
-@@ -98,6 +108,7 @@
- 
- 	if (len > 0 && buf[len - 1] == '\n')
- 		buf[--len] = '\0';
-+#endif
- 
- 	return len;
- }
-diff -r -u /tmp/846623/libibverbs-1.1.4/configure libibverbs-1.1.4/configure
---- /tmp/846623/libibverbs-1.1.4/configure	Thu Feb  3 01:53:23 2011
-+++ libibverbs-1.1.4/configure	Fri Feb 11 04:02:14 2011
-@@ -3173,6 +3173,7 @@
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
- $as_echo_n "checking whether the C compiler works... " >&6; }
- ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-+ac_link_default=`$as_echo "$ac_link" | sed 's/ \$LIBS//'`
- 
- # The possible output files:
- ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-@@ -3258,6 +3259,7 @@
- ac_clean_files=$ac_clean_files_save
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
- $as_echo_n "checking for suffix of executables... " >&6; }
-+ac_link_nolibs=`$as_echo "$ac_link" | sed 's/ \$LIBS//'`
- if { { ac_try="$ac_link"
- case "(($ac_try" in
-   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-@@ -3265,7 +3267,7 @@
- esac
- eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
- $as_echo "$ac_try_echo"; } >&5
--  (eval "$ac_link") 2>&5
-+  (eval "$ac_link_nolibs") 2>&5
-   ac_status=$?
-   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-   test $ac_status = 0; }; then :
-@@ -3321,7 +3323,7 @@
- esac
- eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
- $as_echo "$ac_try_echo"; } >&5
--  (eval "$ac_link") 2>&5
-+  (eval "$ac_link_nolibs") 2>&5
-   ac_status=$?
-   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-   test $ac_status = 0; }
-@@ -3509,13 +3511,13 @@
-   CFLAGS=$ac_save_CFLAGS
- elif test $ac_cv_prog_cc_g = yes; then
-   if test "$GCC" = yes; then
--    CFLAGS="-g -O2"
-+    CFLAGS="-g -O3"
-   else
-     CFLAGS="-g"
-   fi
- else
-   if test "$GCC" = yes; then
--    CFLAGS="-O2"
-+    CFLAGS="-O3"
-   else
-     CFLAGS=
-   fi
-@@ -8721,6 +8723,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+	 hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-@@ -10945,13 +10948,13 @@
-   CFLAGS=$ac_save_CFLAGS
- elif test $ac_cv_prog_cc_g = yes; then
-   if test "$GCC" = yes; then
--    CFLAGS="-g -O2"
-+    CFLAGS="-g -O3"
-   else
-     CFLAGS="-g"
-   fi
- else
-   if test "$GCC" = yes; then
--    CFLAGS="-O2"
-+    CFLAGS="-O3"
-   else
-     CFLAGS=
-   fi
-@@ -11198,7 +11201,7 @@
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-ldl  $LIBS"
-+LIBS="-ldl"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-@@ -11245,7 +11248,7 @@
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lpthread  $LIBS"
-+LIBS="-lpthread"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/sa-kern-abi.h libibverbs-1.1.4/include/infiniband/sa-kern-abi.h
---- /tmp/846623/libibverbs-1.1.4/include/infiniband/sa-kern-abi.h	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/include/infiniband/sa-kern-abi.h	Fri Feb 11 04:02:21 2011
-@@ -33,7 +33,11 @@
- #ifndef INFINIBAND_SA_KERN_ABI_H
- #define INFINIBAND_SA_KERN_ABI_H
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <linux/types.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- /*
-  * Obsolete, deprecated names.  Will be removed in libibverbs 1.1.
-diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/kern-abi.h libibverbs-1.1.4/include/infiniband/kern-abi.h
---- /tmp/846623/libibverbs-1.1.4/include/infiniband/kern-abi.h	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/include/infiniband/kern-abi.h	Fri Feb 11 04:02:20 2011
-@@ -35,7 +35,11 @@
- #ifndef KERN_ABI_H
- #define KERN_ABI_H
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <linux/types.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- /*
-  * This file must be kept in sync with the kernel's version of
-@@ -94,6 +98,14 @@
- 	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
- 	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
- 	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
-+	IB_USER_VERBS_CMD_REG_MR_RELAXED,
-+	IB_USER_VERBS_CMD_DEREG_MR_RELAXED,
-+	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR,
-+	IB_USER_VERBS_CMD_ALLOC_SHPD,
-+	IB_USER_VERBS_CMD_SHARE_PD,
-+	IB_USER_VERBS_CMD_REG_SM_EVENT,
-+	IB_USER_VERBS_CMD_UNREG_SM_EVENT,
-+	IB_USER_VERBS_CMD_GID_REACHABLE
- };
- 
- /*
-@@ -111,6 +123,8 @@
- 	__u64 element;
- 	__u32 event_type;
- 	__u32 reserved;
-+	__u64 subnet_prefix;
-+	__u64 interface_id;
- };
- 
- struct ibv_comp_event {
-@@ -160,6 +174,7 @@
- struct ibv_query_device_resp {
- 	__u64 fw_ver;
- 	__u64 node_guid;
-+	__u64 node_guid_external;
- 	__u64 sys_image_guid;
- 	__u64 max_mr_size;
- 	__u64 page_size_cap;
-@@ -235,23 +250,89 @@
- 	__u8  reserved[2];
- };
- 
-+struct ibv_reg_sm_event {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u32 events;
-+	__u32 data_num;
-+	__u64 driver_data[0];
-+};
-+
-+struct ibv_unreg_sm_event {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u32 events;
-+	__u32 data_num;
-+	__u64 driver_data[0];
-+};
-+
-+struct ibv_gid_reachable {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u32 timeout;
-+	__u8  port_num;
-+	__u8  reserved[3];
-+	__u8  gid[16];
-+};
-+
- struct ibv_alloc_pd {
- 	__u32 command;
- 	__u16 in_words;
- 	__u16 out_words;
- 	__u64 response;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
- struct ibv_alloc_pd_resp {
- 	__u32 pd_handle;
-+	__u32 reserved;
- };
- 
-+struct ibv_alloc_shpd {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u64 response;
-+	__u32 pd_handle;
-+	__u32 reserved;
-+	__u64 share_key;
-+	__u64 user_handle;
-+	__u64 driver_data[0];
-+};
-+
-+struct ibv_alloc_shpd_resp {
-+	__u32 shpd_handle;
-+	__u32 reserved;
-+};
-+
-+struct ibv_share_pd {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u64 response;
-+	__u32 shpd_handle;
-+	__u32 reserved;
-+	__u64 share_key;
-+	__u64 user_handle;
-+	__u64 driver_data[0];
-+};
-+
-+struct ibv_share_pd_resp {
-+	__u32 pd_handle;
-+        __u32 reserved;
-+};
-+
- struct ibv_dealloc_pd {
- 	__u32 command;
- 	__u16 in_words;
- 	__u16 out_words;
- 	__u32 pd_handle;
-+	__u32 reserved;
-+	__u64 user_handle;
- };
- 
- struct ibv_reg_mr {
-@@ -264,6 +345,7 @@
- 	__u64 hca_va;
- 	__u32 pd_handle;
- 	__u32 access_flags;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -271,6 +353,7 @@
- 	__u32 mr_handle;
- 	__u32 lkey;
- 	__u32 rkey;
-+	__u32 reserved;
- };
- 
- struct ibv_dereg_mr {
-@@ -278,8 +361,19 @@
- 	__u16 in_words;
- 	__u16 out_words;
- 	__u32 mr_handle;
-+	__u32 reserved;
-+	__u64 user_handle;
- };
- 
-+struct ibv_flush_relaxed_mr {
-+	__u32 command;
-+	__u16 in_words;
-+	__u16 out_words;
-+	__u32 pd_handle;
-+	__u32 reserved;
-+	__u64 user_handle;
-+};
-+
- struct ibv_create_comp_channel {
- 	__u32 command;
- 	__u16 in_words;
-@@ -289,6 +383,7 @@
- 
- struct ibv_create_comp_channel_resp {
- 	__u32 fd;
-+	__u32 reserved;
- };
- 
- struct ibv_create_cq {
-@@ -334,6 +429,7 @@
- 	__u64 response;
- 	__u32 cq_handle;
- 	__u32 ne;
-+	__u64 user_handle;
- };
- 
- struct ibv_poll_cq_resp {
-@@ -348,6 +444,7 @@
- 	__u16 out_words;
- 	__u32 cq_handle;
- 	__u32 solicited;
-+	__u64 user_handle;
- };
- 
- struct ibv_resize_cq {
-@@ -357,6 +454,7 @@
- 	__u64 response;
- 	__u32 cq_handle;
- 	__u32 cqe;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -373,6 +471,7 @@
- 	__u64 response;
- 	__u32 cq_handle;
- 	__u32 reserved;
-+	__u64 user_handle;
- };
- 
- struct ibv_destroy_cq_resp {
-@@ -493,6 +592,7 @@
- 	__u64 response;
- 	__u32 qp_handle;
- 	__u32 attr_mask;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -560,6 +660,7 @@
- 	__u8  alt_port_num;
- 	__u8  alt_timeout;
- 	__u8  reserved[2];
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -570,10 +671,12 @@
- 	__u64 response;
- 	__u32 qp_handle;
- 	__u32 reserved;
-+	__u64 user_handle;
- };
- 
- struct ibv_destroy_qp_resp {
- 	__u32 events_reported;
-+	__u32 reserved;
- };
- 
- struct ibv_create_xrc_rcv_qp {
-@@ -705,6 +808,7 @@
- 
- struct ibv_post_send_resp {
- 	__u32 bad_wr;
-+	__u32 reserved;
- };
- 
- struct ibv_kern_recv_wr {
-@@ -727,6 +831,7 @@
- 
- struct ibv_post_recv_resp {
- 	__u32 bad_wr;
-+	__u32 reserved;
- };
- 
- struct ibv_post_srq_recv {
-@@ -743,6 +848,7 @@
- 
- struct ibv_post_srq_recv_resp {
- 	__u32 bad_wr;
-+	__u32 reserved;
- };
- 
- struct ibv_create_ah {
-@@ -758,6 +864,7 @@
- 
- struct ibv_create_ah_resp {
- 	__u32 handle;
-+	__u32 reserved;
- };
- 
- struct ibv_destroy_ah {
-@@ -765,6 +872,8 @@
- 	__u16 in_words;
- 	__u16 out_words;
- 	__u32 ah_handle;
-+	__u32 reserved;
-+	__u64 user_handle;
- };
- 
- struct ibv_attach_mcast {
-@@ -775,6 +884,7 @@
- 	__u32 qp_handle;
- 	__u16 mlid;
- 	__u16 reserved;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -786,6 +896,7 @@
- 	__u32 qp_handle;
- 	__u16 mlid;
- 	__u16 reserved;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -832,6 +943,7 @@
- 	__u32 attr_mask;
- 	__u32 max_wr;
- 	__u32 srq_limit;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -842,6 +954,7 @@
- 	__u64 response;
- 	__u32 srq_handle;
- 	__u32 reserved;
-+	__u64 user_handle;
- 	__u64 driver_data[0];
- };
- 
-@@ -859,10 +972,12 @@
- 	__u64 response;
- 	__u32 srq_handle;
- 	__u32 reserved;
-+	__u64 user_handle;
- };
- 
- struct ibv_destroy_srq_resp {
- 	__u32 events_reported;
-+	__u32 reserved;
- };
- 
- struct ibv_open_xrc_domain {
-@@ -877,6 +992,7 @@
- 
- struct ibv_open_xrc_domain_resp {
- 	__u32 xrcd_handle;
-+	__u32 reserved;
- };
- 
- struct ibv_close_xrc_domain {
-@@ -946,6 +1062,14 @@
- 	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
- 	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
- 	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
-+	IB_USER_VERBS_CMD_REG_MR_RELAXED_V2 = -1,
-+	IB_USER_VERBS_CMD_DEREG_MR_RELAXED_V2 = -1,
-+	IB_USER_VERBS_CMD_FLUSH_RELAXED_MR_V2 = -1,
-+  	IB_USER_VERBS_CMD_ALLOC_SHPD_V2 = -1,
-+  	IB_USER_VERBS_CMD_SHARE_PD_V2 = -1,
-+	IB_USER_VERBS_CMD_REG_SM_EVENT_V2 = -1,
-+	IB_USER_VERBS_CMD_UNREG_SM_EVENT_V2 = -1,
-+	IB_USER_VERBS_CMD_GID_REACHABLE_V2 = -1,
- };
- 
- struct ibv_destroy_cq_v1 {
-diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/driver.h libibverbs-1.1.4/include/infiniband/driver.h
---- /tmp/846623/libibverbs-1.1.4/include/infiniband/driver.h	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/include/infiniband/driver.h	Fri Feb 11 04:02:20 2011
-@@ -74,6 +74,14 @@
- int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
- 		     struct ibv_alloc_pd *cmd, size_t cmd_size,
- 		     struct ibv_alloc_pd_resp *resp, size_t resp_size);
-+int ibv_cmd_alloc_shpd(struct ibv_context *context, struct ibv_pd *pd,
-+		     uint64_t share_key, struct ibv_shpd *shpd,
-+		     struct ibv_alloc_shpd *cmd, size_t cmd_size,
-+		     struct ibv_alloc_shpd_resp *resp, size_t resp_size);
-+int ibv_cmd_share_pd(struct ibv_context *context, struct ibv_shpd *shpd,
-+		     uint64_t share_key, struct ibv_pd *pd,
-+		     struct ibv_share_pd *cmd, size_t cmd_size,
-+		     struct ibv_share_pd_resp *resp, size_t resp_size);
- int ibv_cmd_dealloc_pd(struct ibv_pd *pd);
- #define IBV_CMD_REG_MR_HAS_RESP_PARAMS
- int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
-@@ -81,7 +89,15 @@
- 		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
- 		   size_t cmd_size,
- 		   struct ibv_reg_mr_resp *resp, size_t resp_size);
-+#define IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
-+int ibv_cmd_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
-+		   uint64_t hca_va, int access,
-+		   struct ibv_mr *mr, struct ibv_reg_mr *cmd,
-+		   size_t cmd_size,
-+		   struct ibv_reg_mr_resp *resp, size_t resp_size);
- int ibv_cmd_dereg_mr(struct ibv_mr *mr);
-+int ibv_cmd_dereg_mr_relaxed(struct ibv_mr *mr);
-+int ibv_cmd_flush_relaxed_mr(struct ibv_pd *pd);
- int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
- 		      struct ibv_comp_channel *channel,
- 		      int comp_vector, struct ibv_cq *cq,
-@@ -133,6 +149,10 @@
- 			  struct ibv_recv_wr **bad_wr);
- int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
- 		      struct ibv_ah_attr *attr);
-+int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah,
-+			struct ibv_ah_attr *attr,
-+			struct ibv_create_ah *cmd, size_t cmd_size,
-+			struct ibv_create_ah_resp *resp, size_t resp_size);
- int ibv_cmd_destroy_ah(struct ibv_ah *ah);
- int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
- int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
-@@ -164,8 +184,8 @@
- int ibv_read_sysfs_file(const char *dir, const char *file,
- 			char *buf, size_t size);
- 
--int ibv_resolve_eth_gid(const struct ibv_pd *pd, uint8_t port_num,
--			union ibv_gid *dgid, uint8_t sgid_index,
-+int ibv_resolve_eth_gid(struct ibv_pd *pd, uint8_t port_num,
-+			const union ibv_gid *dgid, uint8_t sgid_index,
- 			uint8_t mac[], uint16_t *vlan, uint8_t *tagged,
- 			uint8_t *is_mcast);
- 
-diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/verbs.h libibverbs-1.1.4/include/infiniband/verbs.h
---- /tmp/846623/libibverbs-1.1.4/include/infiniband/verbs.h	Thu Feb  3 01:53:17 2011
-+++ libibverbs-1.1.4/include/infiniband/verbs.h	Fri Feb 11 04:02:21 2011
-@@ -38,6 +38,9 @@
- 
- #include <stdint.h>
- #include <pthread.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #ifdef __cplusplus
- #  define BEGIN_C_DECLS extern "C" {
-@@ -105,6 +108,7 @@
- struct ibv_device_attr {
- 	char			fw_ver[64];
- 	uint64_t		node_guid;
-+	uint64_t		node_guid_external;
- 	uint64_t		sys_image_guid;
- 	uint64_t		max_mr_size;
- 	uint64_t		page_size_cap;
-@@ -212,6 +216,10 @@
- 	IBV_EVENT_QP_LAST_WQE_REACHED,
- 	IBV_EVENT_CLIENT_REREGISTER,
- 	IBV_EVENT_GID_CHANGE,
-+	IBV_EVENT_MCG_CREATED,
-+	IBV_EVENT_MCG_DELETED,
-+	IBV_EVENT_GID_AVAIL,
-+	IBV_EVENT_GID_UNAVAIL,
- };
- 
- enum ibv_event_flags {
-@@ -225,10 +233,20 @@
- 		struct ibv_srq *srq;
- 		int		port_num;
- 		uint32_t	xrc_qp_num;
-+		union ibv_gid	gid;
- 	} element;
- 	enum ibv_event_type	event_type;
- };
- 
-+typedef enum ibv_sm_event_type_e {
-+	IBV_SM_EVENT_MGID	= 1,
-+	IBV_SM_EVENT_MGID_ALL	= 1 << 2,
-+	IBV_SM_EVENT_UGID	= 1 << 3,
-+	IBV_SM_EVENT_UGID_ALL	= 1 << 4,
-+        IBV_SM_EVENT_ALL	= 1 << 5
-+
-+} ibv_sm_event_type_t;
-+
- enum ibv_wc_status {
- 	IBV_WC_SUCCESS,
- 	IBV_WC_LOC_LEN_ERR,
-@@ -297,7 +315,8 @@
- 	IBV_ACCESS_REMOTE_WRITE		= (1<<1),
- 	IBV_ACCESS_REMOTE_READ		= (1<<2),
- 	IBV_ACCESS_REMOTE_ATOMIC	= (1<<3),
--	IBV_ACCESS_MW_BIND		= (1<<4)
-+	IBV_ACCESS_MW_BIND		= (1<<4),
-+	IBV_ACCESS_SO			= (1<<5)	/* Strong Order */
- };
- 
- struct ibv_pd {
-@@ -305,6 +324,10 @@
- 	uint32_t		handle;
- };
- 
-+struct ibv_shpd {
-+	uint32_t		handle;
-+};
-+
- enum ibv_rereg_mr_flags {
- 	IBV_REREG_MR_CHANGE_TRANSLATION	= (1 << 0),
- 	IBV_REREG_MR_CHANGE_PD		= (1 << 1),
-@@ -360,7 +383,15 @@
- 	IBV_RATE_40_GBPS  = 7,
- 	IBV_RATE_60_GBPS  = 8,
- 	IBV_RATE_80_GBPS  = 9,
--	IBV_RATE_120_GBPS = 10
-+	IBV_RATE_120_GBPS = 10,
-+	IBV_RATE_14_GBPS  = 11,
-+	IBV_RATE_56_GBPS  = 12,
-+	IBV_RATE_112_GBPS = 13,
-+	IBV_RATE_168_GBPS = 14,
-+	IBV_RATE_25_GBPS  = 15,
-+	IBV_RATE_100_GBPS = 16,
-+	IBV_RATE_200_GBPS = 17,
-+	IBV_RATE_300_GBPS = 18
- };
- 
- /**
-@@ -377,6 +408,20 @@
-  */
- enum ibv_rate mult_to_ibv_rate(int mult) __attribute_const;
- 
-+/**
-+ * ibv_rate_to_mbps - Convert the IB rate enum to Mbit/sec.
-+ * For example, IBV_RATE_5_GBPS will return the value 5000.
-+ * @rate: rate to convert.
-+ */
-+int ibv_rate_to_mbps(enum ibv_rate rate) __attribute_const;
-+
-+/**
-+ * mbps_to_ibv_rate - Convert a Mbit/sec value to an IB rate enum.
-+ * @mbps: value to convert.
-+ */
-+enum ibv_rate mbps_to_ibv_rate(int mbps) __attribute_const;
-+
-+
- struct ibv_ah_attr {
- 	struct ibv_global_route	grh;
- 	uint16_t		dlid;
-@@ -425,6 +470,14 @@
- 	uint32_t		max_inline_data;
- };
- 
-+#if defined(__SVR4) && defined(__sun)
-+/*
-+ * The 31st bit of sq_sig_all is set for QPs allocated
-+ * using librdmacm. Consumers use sq_sig_all 0 /1.
-+ */
-+#define LIB_RDMACM_QP_BIT	0x8000
-+#endif
-+
- struct ibv_qp_init_attr {
- 	void		       *qp_context;
- 	struct ibv_cq	       *send_cq;
-@@ -659,6 +712,7 @@
- 	char			dev_path[IBV_SYSFS_PATH_MAX];
- 	/* Path to infiniband class device in sysfs */
- 	char			ibdev_path[IBV_SYSFS_PATH_MAX];
-+	uint                    blueflame_enabled;
- };
- 
- struct ibv_more_ops {
-@@ -743,6 +797,12 @@
- 	int			(*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
- 						uint16_t lid);
- 	void			(*async_event)(struct ibv_async_event *event);
-+	struct ibv_mr *		(*reg_mr_relaxed)(struct ibv_pd *pd, void *addr, size_t length,
-+					  int access);
-+	int			(*dereg_mr_relaxed)(struct ibv_mr *mr);
-+	int			(*flush_relaxed_mr)(struct ibv_pd *pd);
-+	struct ibv_shpd *	(*alloc_shpd)(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
-+	struct ibv_pd *		(*share_pd)(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
- };
- 
- struct ibv_context {
-@@ -749,6 +809,13 @@
- 	struct ibv_device      *device;
- 	struct ibv_context_ops	ops;
- 	int			cmd_fd;
-+#if defined(__SVR4) && defined(__sun)
-+	/*
-+	 * Solaris user libraries use this FD for mmap operations. It is an
-+	 * open to the underlying kernel hardware specific driver.
-+	 */
-+	int			mmap_fd;
-+#endif
- 	int			async_fd;
- 	int			num_comp_vectors;
- 	pthread_mutex_t		mutex;
-@@ -797,6 +864,11 @@
- uint64_t ibv_get_device_guid(struct ibv_device *device);
- 
- /**
-+ * ibv_get_device_guid_external - Return device's node external GUID
-+ */
-+uint64_t ibv_get_device_guid_external(struct ibv_device *device);
-+
-+/**
-  * ibv_open_device - Initialize device for use
-  */
- struct ibv_context *ibv_open_device(struct ibv_device *device);
-@@ -853,11 +925,44 @@
- 		   int index, uint16_t *pkey);
- 
- /**
-+ * ibv_register_sm_events - Register subnet event for GID change
-+ */
-+int ibv_register_sm_events(struct ibv_context *context,
-+    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
-+
-+/**
-+ * ibv_unregister_sm_events - Unregister subnet event for GID change
-+ */
-+int ibv_unregister_sm_events(struct ibv_context *context,
-+    ibv_sm_event_type_t event, uint_t gid_num, union ibv_gid *gids);
-+
-+/**
-+ * ibv_gid_reachable - To contact subnet agent for GID status; reachable or
-+ * not reachable
-+ */
-+int ibv_gid_reachable(struct ibv_context *context,
-+    uint port, union ibv_gid *gid_p, int timeout);
-+
-+/**
-  * ibv_alloc_pd - Allocate a protection domain
-  */
- struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);
- 
- /**
-+ * ibv_alloc_shpd - Mark given protection domain as shareable & return shpd structure
-+ *                  that identify it.
-+ *                  the storage for shpd structure needs to be provided by client.
-+ */
-+struct ibv_shpd *ibv_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
-+
-+/**
-+ * ibv_share_pd - share the protection domain identified by given shpd struct & return a
-+ *                process linked ibv_pd struct.
-+ *                the share_key given should match with the share_key specifed in alloc_shpd().
-+ */
-+struct ibv_pd *ibv_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
-+
-+/**
-  * ibv_dealloc_pd - Free a protection domain
-  */
- int ibv_dealloc_pd(struct ibv_pd *pd);
-@@ -869,11 +974,27 @@
- 			  size_t length, int access);
- 
- /**
-+ * ibv_reg_mr_relaxed - Register a memory region using FMR
-+ */
-+struct ibv_mr *ibv_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
-+			  size_t length, int access);
-+
-+/**
-  * ibv_dereg_mr - Deregister a memory region
-  */
- int ibv_dereg_mr(struct ibv_mr *mr);
- 
- /**
-+ * ibv_dereg_mr_relaxed - Deregister a memory region registered using FMR
-+ */
-+int ibv_dereg_mr_relaxed(struct ibv_mr *mr);
-+
-+/**
-+ * ibv_flush_relaxed_mr - Flush all free mr's in the protection domain
-+ */
-+int ibv_flush_relaxed_mr(struct ibv_pd *pd);
-+
-+/**
-  * ibv_create_comp_channel - Create a completion event channel
-  */
- struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context);
-diff -r -u /tmp/846623/libibverbs-1.1.4/include/infiniband/arch.h libibverbs-1.1.4/include/infiniband/arch.h
---- /tmp/846623/libibverbs-1.1.4/include/infiniband/arch.h	Wed Sep 16 04:27:22 2009
-+++ libibverbs-1.1.4/include/infiniband/arch.h	Fri Feb 11 04:02:20 2011
-@@ -34,6 +34,7 @@
- #define INFINIBAND_ARCH_H
- 
- #include <stdint.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
- 
-@@ -46,6 +47,9 @@
- #else
- #error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN
- #endif
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- /*
-  * Architecture-specific defines.  Currently, an architecture is
-diff -r -u /tmp/846623/libibverbs-1.1.4/Makefile.in libibverbs-1.1.4/Makefile.in
---- /tmp/846623/libibverbs-1.1.4/Makefile.in	Thu Feb  3 01:53:23 2011
-+++ libibverbs-1.1.4/Makefile.in	Fri Feb 11 05:27:45 2011
-@@ -90,7 +90,8 @@
- 	src_libibverbs_la-compat-1_0.lo src_libibverbs_la-device.lo \
- 	src_libibverbs_la-init.lo src_libibverbs_la-marshall.lo \
- 	src_libibverbs_la-memory.lo src_libibverbs_la-sysfs.lo \
--	src_libibverbs_la-verbs.lo src_libibverbs_la-enum_strs.lo
-+	src_libibverbs_la-verbs.lo src_libibverbs_la-enum_strs.lo \
-+	src_libibverbs_la-solaris.lo
- src_libibverbs_la_OBJECTS = $(am_src_libibverbs_la_OBJECTS)
- AM_V_lt = $(am__v_lt_$(V))
- am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
-@@ -313,11 +314,11 @@
- INCLUDES = -I$(srcdir)/include
- lib_LTLIBRARIES = src/libibverbs.la
- AM_CFLAGS = -g -Wall -D_GNU_SOURCE
--src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(sysconfdir)/libibverbs.d\"
-+src_libibverbs_la_CFLAGS = $(AM_CFLAGS) -DIBV_CONFIG_DIR=\"$(datadir)/libibverbs.d\"
- libibverbs_version_script = @LIBIBVERBS_VERSION_SCRIPT@
- src_libibverbs_la_SOURCES = src/cmd.c src/compat-1_0.c src/device.c src/init.c \
- 			    src/marshall.c src/memory.c src/sysfs.c src/verbs.c \
--			    src/enum_strs.c
-+			    src/enum_strs.c src/solaris_compatability src/verbs.c
- 
- src_libibverbs_la_LDFLAGS = -version-info 1 -export-dynamic \
-     $(libibverbs_version_script)
-@@ -340,6 +341,7 @@
- libibverbsincludedir = $(includedir)/infiniband
- libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver.h \
-     include/infiniband/kern-abi.h include/infiniband/opcode.h include/infiniband/verbs.h \
-+	include/infiniband/ofa_solaris.h \
-     include/infiniband/sa-kern-abi.h include/infiniband/sa.h include/infiniband/marshall.h
- 
- man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1	\
-@@ -368,6 +370,7 @@
- 
- EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
-     include/infiniband/opcode.h include/infiniband/verbs.h include/infiniband/marshall.h \
-+	 include/infiniband/ofa_solaris.h \
-     include/infiniband/sa-kern-abi.h include/infiniband/sa.h \
-     src/ibverbs.h examples/pingpong.h \
-     src/libibverbs.map libibverbs.spec.in $(man_MANS)
-@@ -440,8 +443,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:
-@@ -486,8 +489,8 @@
- 	while read type dir files; do \
- 	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- 	    test -z "$$files" || { \
--	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
--	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(bindir)$$dir'"; \
-+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
- 	    } \
- 	; done
- 
-@@ -554,6 +557,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-memory.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-sysfs.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-verbs.Plo@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_libibverbs_la-solaris.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srq_pingpong.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_pingpong.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ud_pingpong.Po@am__quote@
-@@ -654,6 +658,14 @@
- @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src_libibverbs_la-enum_strs.lo `test -f 'src/enum_strs.c' || echo '$(srcdir)/'`src/enum_strs.c
- 
-+src_libibverbs_la-solaris.lo: src/solaris_compatibility.c
-+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -MT src_libibverbs_la-solaris.lo -MD -MP -MF $(DEPDIR)/src_libibverbs_la-solaris.Tpo -c -o src_libibverbs_la-solaris.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
-+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/src_libibverbs_la-solaris.Tpo $(DEPDIR)/src_libibverbs_la-solaris.Plo
-+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_compatibility.c' object='src_libibverbs_la-solaris.lo' libtool=yes @AMDEPBACKSLASH@
-+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-+@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_libibverbs_la_CFLAGS) $(CFLAGS) -c -o src_libibverbs_la-solaris.lo `test -f 'src/solaris_compatibility.c' || echo '$(srcdir)/'`src/solaris_compatibility.c
-+
- asyncwatch.o: examples/asyncwatch.c
- @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT asyncwatch.o -MD -MP -MF $(DEPDIR)/asyncwatch.Tpo -c -o asyncwatch.o `test -f 'examples/asyncwatch.c' || echo '$(srcdir)/'`examples/asyncwatch.c
- @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/asyncwatch.Tpo $(DEPDIR)/asyncwatch.Po
-@@ -669,7 +681,6 @@
- @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='examples/asyncwatch.c' object='asyncwatch.obj' libtool=no @AMDEPBACKSLASH@
- @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o asyncwatch.obj `if test -f 'examples/asyncwatch.c'; then $(CYGPATH_W) 'examples/asyncwatch.c'; else $(CYGPATH_W) '$(srcdir)/examples/asyncwatch.c'; fi`
--
- device_list.o: examples/device_list.c
- @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT device_list.o -MD -MP -MF $(DEPDIR)/device_list.Tpo -c -o device_list.o `test -f 'examples/device_list.c' || echo '$(srcdir)/'`examples/device_list.c
- @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/device_list.Tpo $(DEPDIR)/device_list.Po
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/uc_pingpong.c libibverbs-1.1.4/examples/uc_pingpong.c
---- /tmp/846623/libibverbs-1.1.4/examples/uc_pingpong.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/uc_pingpong.c	Tue Aug 19 10:46:28 2014
-@@ -144,7 +144,7 @@
- 
- 	n = getaddrinfo(servername, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
- 		free(service);
- 		return NULL;
-@@ -219,7 +219,7 @@
- 
- 	n = getaddrinfo(NULL, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
- 		free(service);
- 		return NULL;
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/asyncwatch.c libibverbs-1.1.4/examples/asyncwatch.c
---- /tmp/846623/libibverbs-1.1.4/examples/asyncwatch.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/asyncwatch.c	Fri Feb 11 04:02:18 2011
-@@ -35,11 +35,72 @@
- #endif /* HAVE_CONFIG_H */
- 
- #include <stdio.h>
-+#include <stdlib.h>
-+#include <ctype.h>
-+#include <getopt.h>
-+#include <signal.h>
-+#include <string.h>
-+#include <strings.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- 
- #include <infiniband/verbs.h>
- 
-+#define IS_PORT_EVENT(event)				\
-+	((event == IBV_EVENT_PORT_ACTIVE) ||		\
-+	(event == IBV_EVENT_PORT_ERR ) ||		\
-+	(event == IBV_EVENT_LID_CHANGE) ||		\
-+	(event == IBV_EVENT_PKEY_CHANGE) ||		\
-+	(event == IBV_EVENT_SM_CHANGE) ||		\
-+	(event == IBV_EVENT_GID_CHANGE) ||		\
-+	(event == IBV_EVENT_CLIENT_REREGISTER))
-+
-+#define IS_SM_EVENT(event)				\
-+	((event == IBV_EVENT_MCG_CREATED) ||		\
-+	(event == IBV_EVENT_MCG_DELETED) ||		\
-+	(event == IBV_EVENT_GID_AVAIL) ||		\
-+	(event == IBV_EVENT_GID_UNAVAIL))
-+
-+#define IS_QP_EVENT(event)				\
-+	((event == IBV_EVENT_CQ_ERR) ||			\
-+	(event == IBV_EVENT_QP_FATAL) ||		\
-+	(event == IBV_EVENT_QP_REQ_ERR) ||		\
-+	(event == IBV_EVENT_COMM_EST) ||		\
-+	(event == IBV_EVENT_SQ_DRAINED) ||		\
-+	(event == IBV_EVENT_PATH_MIG) ||		\
-+	(event == IBV_EVENT_PATH_MIG_ERR) ||		\
-+	(event == IBV_EVENT_QP_LAST_WQE_REACHED) ||	\
-+	(event == IBV_EVENT_QP_ACCESS_ERR))
-+
-+#define IS_CQ_EVENT(event)				\
-+	(event == IBV_EVENT_CQ_ERR)
-+
-+#define IS_SRQ_EVENT(event)				\
-+	((event == IBV_EVENT_SRQ_ERR) ||		\
-+	(event == IBV_EVENT_SRQ_LIMIT_REACHED))
-+
-+#define IS_CA_EVENT(event)				\
-+	(event == IBV_EVENT_DEVICE_FATAL)
-+
-+
-+struct ibv_device	**dev_list;
-+struct ibv_context	*context;
-+struct ibv_async_event	event;
-+union ibv_gid		*gids = NULL;
-+uint_t			num_gids = 0;
-+ibv_sm_event_type_t	events;
-+
-+static struct option long_options[] = {
-+    {"sm",		0, 0, 's'},
-+    {"GUID",		0, 0, 'G'},
-+    {"MCG",		0, 0, 'M'},
-+    {"port",		1, 0, 'p'},
-+    {0, 0, 0, 0}
-+};
-+
-+
- static const char *event_name_str(enum ibv_event_type event_type)
- {
- 	switch (event_type) {
-@@ -59,7 +120,14 @@
- 		return "IBV_EVENT_CLIENT_REREGISTER";
- 	case IBV_EVENT_GID_CHANGE:
- 		return "IBV_EVENT_GID_CHANGE";
--
-+	case IBV_EVENT_MCG_CREATED:
-+		return "IBV_EVENT_MCG_CREATED";
-+	case IBV_EVENT_MCG_DELETED:
-+		return "IBV_EVENT_MCG_DELETED";
-+	case IBV_EVENT_GID_AVAIL:
-+		return "IBV_EVENT_GID_AVAIL";
-+	case IBV_EVENT_GID_UNAVAIL:
-+		return "IBV_EVENT_GID_UNAVAIL";
- 	case IBV_EVENT_CQ_ERR:
- 	case IBV_EVENT_QP_FATAL:
- 	case IBV_EVENT_QP_REQ_ERR:
-@@ -76,15 +144,173 @@
- 	}
- }
- 
--int main(int argc, char *argv[])
-+static void catch_signal(int sig_num)
- {
--	struct ibv_device **dev_list;
--	struct ibv_context *context;
--	struct ibv_async_event event;
-+	ibv_unregister_sm_events(context, events, num_gids, gids);
-+	if (gids)
-+		free(gids);
-+	ibv_close_device(context);
-+	(void) ibv_free_device_list(dev_list);
-+	exit (0);
-+}
- 
--	/* Force line-buffering in case stdout is redirected */
--	setvbuf(stdout, NULL, _IOLBF, 0);
-+static void usage(const char *argv0)
-+{
-+	printf("Usage:\n");
-+	printf("\n");
-+	printf("Options:\n");
-+	printf("[ -s, --sm<gid> ]\t\tsm event\n");
-+	printf("[ -M, --M ]\t\t\tsm event for MGID (multicast)\n");
-+	printf("[ -G, --G ]\t\t\tsm event for UGID (unicast)\n");
-+	printf("[ -p, --port=<port> ]\t\t(default 1)\n");
-+	printf("\nExamples;\n");
-+	printf("ibv_asyncwatch -s\t\t# monitor event=IBV_SM_EVENT_ALL\n");
-+	printf("ibv_asyncwatch -G -s\t\t# monitor event="
-+	    "IBV_SM_EVENT_UGID_ALL\n");
-+	printf("ibv_asyncwatch -M -s\t\t# monitor event="
-+	    "IBV_SM_EVENT_MGID_ALL\n");
-+	printf("ibv_asyncwatch -G -s0x0021280001a0e4d9,0x0021280001a0e4da\n");
-+	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_UGID\n");
-+	printf("ibv_asyncwatch -M -s0xff12:4001:ffff::c:2238,");
-+	printf("0xff12:ffff::38:220c\n");
-+	printf("\t\t\t\t# monitor event=IBV_SM_EVENT_MGID\n");
-+}
- 
-+
-+uint_t get_gids(char *argptr, uint64_t subnet_prefix)
-+{
-+	char		*curr, *next;
-+	char		*guid_str_p1, *guid_str_p2 = NULL;
-+	int		i = 0;
-+	int		data_num;
-+
-+	for (curr = argptr; curr; curr = next, i++) {
-+		next = strchr(curr, ',');
-+		if (next)
-+			next++;
-+        }
-+	data_num = i;
-+	if (data_num == 0)
-+		return (0);
-+
-+	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
-+	guid_str_p1 = malloc(strlen(argptr));
-+	strncpy(guid_str_p1, argptr, strlen(argptr));
-+
-+	i = 0;
-+	guid_str_p2 = strtok(guid_str_p1, (const char *)",");
-+	while (guid_str_p2 != NULL) {
-+		gids[i].global.subnet_prefix = subnet_prefix;
-+		gids[i].global.interface_id =
-+		    htonll((uint64_t)strtoull(guid_str_p2, 0, 0));
-+		i++;
-+		guid_str_p2 = strtok(NULL, (const char *)",");
-+	}
-+	free (guid_str_p1);
-+	return (data_num);
-+}
-+
-+void process_one_mcg_gid(union ibv_gid *gid, char *mcg_str)
-+{
-+	char		*token, *token_p, half_token[3];
-+	uint8_t		mcg_gid[16];
-+	int		i, j = 0, num_data = -1;
-+	char		*curr, *next;
-+
-+	/* find out how many two-byte data from command line input */
-+	for (curr = mcg_str; curr; curr = next, num_data++) {
-+		next = strchr(curr, ':');
-+		if (next)
-+			next++;
-+        }
-+
-+	if (num_data > 8) {
-+		fprintf(stderr, "Invalid MGID input format: %s\n", mcg_str);
-+		exit (-1);
-+	}
-+
-+	curr = mcg_str + 2;	/* Skip past 0x */
-+	while ((token = strsep(&curr, ":")) != NULL && j < 15) {
-+		if (strncmp(token, "\0", 1) == 0) {
-+			/* We have :: in the input */
-+			for (i = 0; i < 8 - num_data; i++) {
-+				mcg_gid[j++] = 0;
-+				mcg_gid[j++] = 0;
-+			}
-+		} else {
-+			if (strlen(token) < 3) {
-+				mcg_gid[j++] = 0;
-+				mcg_gid[j++] =
-+				    (uint8_t)strtoll(token, NULL, 16);
-+			} else {
-+				memset(half_token, 0, 3);
-+				token_p = token;
-+				if (strlen(token) == 3) {
-+					strncpy(half_token, token, 1);
-+					token_p += 1;
-+				} else {
-+					strncpy(half_token, token, 2);
-+					token_p += 2;
-+				}
-+				mcg_gid[j++] = (uint8_t)strtol(half_token,
-+				    NULL, 16);
-+
-+				mcg_gid[j++] = (uint8_t)strtol(token_p,
-+				    NULL, 16);
-+			}
-+		}
-+	}
-+
-+	memcpy(gid->raw, mcg_gid, 16);
-+}
-+
-+uint_t get_mcgs(char *argptr, uint64_t subnet_prefix)
-+{
-+	char            *curr, *next;
-+	char		*mcg_str_p1, *mcg_str_p2 = NULL;
-+	int		i = 0;
-+	int		data_num;
-+
-+	for (curr = argptr; curr; curr = next, i++) {
-+		next = strchr(curr, ',');
-+		if (next)
-+			next++;
-+        }
-+	data_num = i;
-+	if (data_num == 0)
-+		return (0);
-+
-+	gids = (union ibv_gid *)calloc(data_num, sizeof (union ibv_gid));
-+	mcg_str_p1 = malloc(strlen(argptr));
-+	strncpy(mcg_str_p1, argptr, strlen(argptr));
-+
-+	i = 0;
-+	mcg_str_p2 = strtok(mcg_str_p1, (const char *)",");
-+	while (mcg_str_p2 != NULL) {
-+		if (strncmp(mcg_str_p2, "0xff", 4) != 0) {
-+			fprintf(stderr, "Invalid MGID input format: %s\n",
-+			    mcg_str_p2);
-+			exit (-1);
-+		}
-+		process_one_mcg_gid(&gids[i], mcg_str_p2);
-+		i++;
-+		mcg_str_p2 = strtok(NULL, (const char *)",");
-+	}
-+	free(mcg_str_p1);
-+	return (data_num);
-+}
-+
-+int main(int argc, char *argv[])
-+{
-+	int		c;
-+	int		ret;
-+	uint_t		port = 1;	/* default */
-+	uint_t		do_sm_event_register = 0;
-+	union ibv_gid	sgid;
-+	uint64_t	subnet_prefix = 0ULL;
-+	int		mcgflag = 0;
-+	int		guidflag = 0;
-+
- 	dev_list = ibv_get_device_list(NULL);
- 	if (!dev_list) {
- 		perror("Failed to get IB devices list");
-@@ -103,19 +329,111 @@
- 		return 1;
- 	}
- 
--	printf("%s: async event FD %d\n",
-+	printf("\n%s: async event FD %d\n\n",
- 	       ibv_get_device_name(*dev_list), context->async_fd);
- 
-+	ibv_query_gid(context, port, 0, &sgid);
-+	subnet_prefix = sgid.global.subnet_prefix;
-+
-+	while ((c = getopt_long(argc, argv, "p:GMs::t:", long_options, NULL))
-+	    != -1) {
-+		switch(c) {
-+			case 'G':
-+				guidflag = 1;
-+				break;
-+			case 'M':
-+				mcgflag = 1;
-+				break;
-+			case 's':
-+				do_sm_event_register = 1;
-+				if (mcgflag == 1)
-+					num_gids =
-+					    get_mcgs(optarg, subnet_prefix);
-+				else
-+					num_gids =
-+					    get_gids(optarg, subnet_prefix);
-+				break;
-+			case 'p':
-+				port = strtol(optarg, NULL, 0);
-+				ibv_query_gid(context, port, 0, &sgid);
-+				subnet_prefix = sgid.global.subnet_prefix;
-+				break;
-+			default:
-+				usage(argv[0]);
-+				return 1;
-+		}
-+	}
-+
-+	/* Force line-buffering in case stdout is redirected */
-+	setvbuf(stdout, NULL, _IOLBF, 0);
-+
-+	if (num_gids) {
-+		if (mcgflag)
-+			events = IBV_SM_EVENT_MGID;
-+		else
-+			events = IBV_SM_EVENT_UGID;
-+	} else {
-+		if (mcgflag && guidflag)
-+			events = IBV_SM_EVENT_ALL;
-+		else if (mcgflag)
-+			events = IBV_SM_EVENT_MGID_ALL;
-+		else if (guidflag)
-+			events = IBV_SM_EVENT_UGID_ALL;
-+		else
-+			events = IBV_SM_EVENT_ALL;
-+	}
-+
-+	if (do_sm_event_register)
-+		ret = ibv_register_sm_events(context, events, num_gids, gids);
-+
-+	(void) signal(SIGINT, catch_signal);
-+
- 	while (1) {
- 		if (ibv_get_async_event(context, &event))
- 			return 1;
- 
--		printf("  event_type %s (%d), port %d\n",
--		       event_name_str(event.event_type),
--		       event.event_type, event.element.port_num);
-+		if (IS_PORT_EVENT(event.event_type))
-+			printf("Event: %s (%d), port %d\n",
-+			    event_name_str(event.event_type),
-+			    event.event_type, event.element.port_num);
-+		else if (IS_SM_EVENT(event.event_type))
-+			printf("Event: %s (%d), gid " \
-+			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
-+			    "%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
-+			    event_name_str(event.event_type), event.event_type,
-+			    event.element.gid.raw[0], event.element.gid.raw[1],
-+			    event.element.gid.raw[2], event.element.gid.raw[3],
-+			    event.element.gid.raw[4], event.element.gid.raw[5],
-+			    event.element.gid.raw[6], event.element.gid.raw[7],
-+			    event.element.gid.raw[8], event.element.gid.raw[9],
-+			    event.element.gid.raw[10],
-+			    event.element.gid.raw[11],
-+			    event.element.gid.raw[12],
-+			    event.element.gid.raw[13],
-+			    event.element.gid.raw[14],
-+			    event.element.gid.raw[15]);
-+		else if (IS_QP_EVENT(event.event_type))
-+			printf("Event: %s (%d) QPN %d\n",
-+			    event_name_str(event.event_type), event.event_type,
-+			    event.element.qp->qp_num);
-+		else if (IS_CQ_EVENT(event.event_type))
-+			printf("Event: %s (%d) CQE %d\n",
-+			    event_name_str(event.event_type), event.event_type,
-+			    event.element.cq->cqe);
-+		else if (IS_SRQ_EVENT(event.event_type))
-+			printf("Event: %s (%d) SRQ %d\n",
-+			    event_name_str(event.event_type), event.event_type,
-+			    event.element.srq->handle);
-+		else
-+			printf("Event: %s (%d)\n",
-+			    event_name_str(event.event_type), event.event_type);
- 
- 		ibv_ack_async_event(&event);
--	}
- 
-+		if (event.event_type == IBV_EVENT_GID_AVAIL) {
-+			ret = ibv_gid_reachable(context, port,
-+			    &event.element.gid, 0);
-+		}
-+	}
- 	return 0;
- }
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/srq_pingpong.c libibverbs-1.1.4/examples/srq_pingpong.c
---- /tmp/846623/libibverbs-1.1.4/examples/srq_pingpong.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/srq_pingpong.c	Wed Jun  8 09:46:34 2011
-@@ -165,8 +165,13 @@
- 
- 	n = getaddrinfo(servername, service, &hints, &res);
- 
--	if (n < 0) {
--		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
-+	if (n != 0) {
-+		if (n == EAI_NONAME)
-+			fprintf(stderr,
-+			    "Name or service not known for %s:%d\n", servername, port);
-+		else
-+			fprintf(stderr,
-+			    "%s for %s:%d\n", gai_strerror(n), servername, port);
- 		free(service);
- 		return NULL;
- 	}
-@@ -253,7 +258,7 @@
- 
- 	n = getaddrinfo(NULL, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
- 		free(service);
- 		return NULL;
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/ud_pingpong.c libibverbs-1.1.4/examples/ud_pingpong.c
---- /tmp/846623/libibverbs-1.1.4/examples/ud_pingpong.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/ud_pingpong.c	Wed Jun  8 09:46:34 2011
-@@ -143,8 +143,13 @@
- 
- 	n = getaddrinfo(servername, service, &hints, &res);
- 
--	if (n < 0) {
--		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
-+	if (n != 0) {
-+		if (n == EAI_NONAME)
-+			fprintf(stderr,
-+			    "Name or service not known for %s:%d\n", servername, port);
-+		else
-+			fprintf(stderr,
-+			    "%s for %s:%d\n", gai_strerror(n), servername, port);
- 		free(service);
- 		return NULL;
- 	}
-@@ -217,7 +222,7 @@
- 
- 	n = getaddrinfo(NULL, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
- 		free(service);
- 		return NULL;
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/rc_pingpong.c libibverbs-1.1.4/examples/rc_pingpong.c
---- /tmp/846623/libibverbs-1.1.4/examples/rc_pingpong.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/rc_pingpong.c	Wed Jun  8 09:46:34 2011
-@@ -155,8 +155,13 @@
- 
- 	n = getaddrinfo(servername, service, &hints, &res);
- 
--	if (n < 0) {
--		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
-+	if (n != 0) {
-+		if (n == EAI_NONAME)
-+			fprintf(stderr,
-+			    "Name or service not known for %s:%d\n", servername, port);
-+		else
-+			fprintf(stderr,
-+			    "%s for %s:%d\n", gai_strerror(n), servername, port);
- 		free(service);
- 		return NULL;
- 	}
-@@ -230,7 +235,7 @@
- 
- 	n = getaddrinfo(NULL, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
- 		free(service);
- 		return NULL;
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/device_list.c libibverbs-1.1.4/examples/device_list.c
---- /tmp/846623/libibverbs-1.1.4/examples/device_list.c	Sun Nov  1 06:47:19 2009
-+++ libibverbs-1.1.4/examples/device_list.c	Fri Feb 11 04:02:18 2011
-@@ -36,16 +36,32 @@
- 
- #include <stdio.h>
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- 
-+#include <stdlib.h>
-+#include <string.h>
- #include <infiniband/verbs.h>
- #include <infiniband/arch.h>
- 
-+/*
-+ * Structure to hold the data printed by ibv_devices.
-+ */
-+typedef struct dev_print_s {
-+	char			name[24];
-+	unsigned long long	guid;
-+	uint8_t			is_pf;
-+} dev_print_t;
-+
- int main(int argc, char *argv[])
- {
- 	struct ibv_device **dev_list;
- 	int num_devices, i;
-+	unsigned long long	guid_external;
-+	dev_print_t	*dp;
-+	int	print_col = 0;
- 
- 	dev_list = ibv_get_device_list(&num_devices);
- 	if (!dev_list) {
-@@ -53,15 +69,45 @@
- 		return 1;
- 	}
- 
--	printf("    %-16s\t   node GUID\n", "device");
--	printf("    %-16s\t----------------\n", "------");
-+	dp = (dev_print_t *)malloc(sizeof(dev_print_t) * num_devices);
- 
--	for (i = 0; i < num_devices; ++i) {
--		printf("    %-16s\t%016llx\n",
--		       ibv_get_device_name(dev_list[i]),
--		       (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i])));
-+	for (i = (num_devices - 1); i >= 0; --i) {
-+		strcpy(dp[i].name, ibv_get_device_name(dev_list[i]));
-+
-+		dp[i].guid = (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i]));
-+		guid_external = (unsigned long long) ntohll(ibv_get_device_guid_external(dev_list[i]));
-+		if (dp[i].guid != guid_external) {
-+			print_col = 1;
-+			dp[i].is_pf = 0;
-+		} else
-+			dp[i].is_pf = 1;
- 	}
- 
-+	if (print_col) {
-+		printf("    %-16s\t   node GUID\t        type\n", "device");
-+		printf("    %-16s\t----------------\t----\n", "------");
-+		/* First print PFs */
-+		for (i = (num_devices - 1); i >= 0; --i) {
-+			if (dp[i].is_pf)
-+				printf("    %-16s\t%016llx\t %s\n",
-+					dp[i].name, dp[i].guid, "PF");
-+		}
-+		/* print VFs */
-+		for (i = (num_devices - 1); i >= 0; --i) {
-+			if (!dp[i].is_pf)
-+				printf("    %-16s\t%016llx\t %s\n",
-+					dp[i].name, dp[i].guid, "VF");
-+		}
-+	} else {
-+		printf("    %-16s\t   node GUID\n", "device");
-+		printf("    %-16s\t----------------\n", "------");
-+		for (i = (num_devices - 1); i >= 0; --i) {
-+			printf("    %-16s\t%016llx\n",
-+				dp[i].name, dp[i].guid);
-+		}
-+	}
-+	free(dp);
-+
- 	ibv_free_device_list(dev_list);
- 
- 	return 0;
-diff -r -u /tmp/846623/libibverbs-1.1.4/examples/devinfo.c libibverbs-1.1.4/examples/devinfo.c
---- /tmp/846623/libibverbs-1.1.4/examples/devinfo.c	Thu Mar 10 06:58:21 2011
-+++ libibverbs-1.1.4/examples/devinfo.c	Fri Feb 11 04:02:19 2011
-@@ -41,8 +41,10 @@
- #include <string.h>
- #include <getopt.h>
- #include <netinet/in.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- 
- #include <infiniband/verbs.h>
- #include <infiniband/driver.h>
-@@ -140,6 +142,9 @@
- 	case 1:  return "2.5 Gbps";
- 	case 2:  return "5.0 Gbps";
- 	case 4:  return "10.0 Gbps";
-+	case 8:  return "10.0 Gbps";
-+	case 16: return "14.0 Gbps";
-+	case 32: return "25.0 Gbps";
- 	default: return "invalid speed";
- 	}
- }
--- a/components/open-fabrics/libibverbs/solaris_compatibility.c	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libibverbs/solaris_compatibility.c	Fri Apr 01 15:20:17 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -94,10 +94,52 @@
 static int sol_uverbs_minor_dev = -1;
 
 /*
+ * Override verbs abi version.
+ * If the build system doesn't have the intended
+ * header file then override with the intended abi version.
+ * These changes can be deleted once the build system has
+ * the correct header file.
+ */
+#if	(IB_USER_VERBS_SOLARIS_ABI_VERSION == 3)
+#undef	IB_USER_VERBS_SOLARIS_ABI_VERSION
+#define	IB_USER_VERBS_SOLARIS_ABI_VERSION	4
+
+#define	UVERBS_PSID_STR_SZ		32
+#define	UVERBS_IBDEV_NAME_SZ		64
+#define	UVERBS_HCA_DRIVER_NAME_SZ	40
+#define	UVERBS_DEVID_STR_SZ		16
+
+typedef struct sol_uverbs_hca_info_v4_s {
+	char		uverbs_hca_psid_string[UVERBS_PSID_STR_SZ];
+	uint8_t		uverbs_hca_pad1[8];
+	char		uverbs_hca_ibdev_name[UVERBS_IBDEV_NAME_SZ];
+	char		uverbs_hca_driver_name[UVERBS_HCA_DRIVER_NAME_SZ];
+	uint32_t	uverbs_hca_driver_instance;
+	uint32_t	uverbs_hca_vendorid;
+	uint16_t	uverbs_hca_deviceid;
+	uint16_t	uverbs_hca_devidx;
+	int32_t		uverbs_hca_abi_version;
+	uint64_t	uverbs_hca_fw_ver;
+	uint64_t	uverbs_hca_node_guid;
+	uint64_t	uverbs_hca_node_external_guid;
+	uint64_t	uverbs_hca_sys_image_guid;
+	uint32_t	uverbs_hca_hw_version;
+	uint8_t		uverbs_hca_pad2[4];
+	char		uverbs_hca_devid_string[UVERBS_DEVID_STR_SZ];
+	uint8_t		uverbs_hca_pad3[24];
+} sol_uverbs_hca_info_v4_t;
+#define	IB_USER_VERBS_V4_IN_V3
+#endif
+
+/*
  * Some useful definitions.
  */
 #define	SIZEOF_UVERBS_INFO	(sizeof (sol_uverbs_info_t))
+#ifdef	IB_USER_VERBS_V4_IN_V3
+#define	SIZEOF_HCA_INFO		(sizeof (sol_uverbs_hca_info_v4_t))
+#else
 #define	SIZEOF_HCA_INFO		(sizeof (sol_uverbs_hca_info_t))
+#endif
 #define	UVERBS_INFO(x)		((sol_uverbs_info_t *)x)
 
 /*
@@ -136,9 +178,9 @@
 	char				ibd_node_guid_external_str[20];
 	char				ibd_sys_image_guid[20];
 	char				ibd_fw_ver[16];
-	char				ibd_name[IBDEV_NAME_SZ];
-	char				ibd_boardid_string[PSID_STR_SZ];
-	char				ibd_devid_string[DEVID_STR_SZ];
+	char				ibd_name[UVERBS_IBDEV_NAME_SZ];
+	char				ibd_boardid_string[UVERBS_PSID_STR_SZ];
+	char				ibd_devid_string[UVERBS_DEVID_STR_SZ];
 } ibdev_cache_info_t;
 
 /* IB device info cache */
@@ -269,7 +311,11 @@
 	int				fd, i, hca_cnt;
 	char				uverbs_devpath[MAX_OFS_DEVPATH_LEN];
 	sol_uverbs_info_t		*uverbs_infop;
+#ifdef	IB_USER_VERBS_V4_IN_V3
+	sol_uverbs_hca_info_v4_t	*hca_infop;
+#else
 	sol_uverbs_hca_info_t		*hca_infop;
+#endif
 	char 				*buf;
 	size_t				bufsize;
 	uint16_t			major, minor, sub_minor;
@@ -336,7 +382,7 @@
 		info = &ibdev_cache[hca_infop->uverbs_hca_devidx];
 
 		(void) strncpy(info->ibd_name,
-		    hca_infop->uverbs_hca_ibdev_name, IBDEV_NAME_SZ);
+		    hca_infop->uverbs_hca_ibdev_name, UVERBS_IBDEV_NAME_SZ);
 
 		guid = hca_infop->uverbs_hca_node_guid;
 		sprintf(info->ibd_node_guid_str, "%04x:%04x:%04x:%04x",
@@ -378,10 +424,10 @@
 		    hca_infop->uverbs_hca_driver_instance);
 
 		strncpy(info->ibd_boardid_string,
-		    hca_infop->uverbs_hca_psid_string, PSID_STR_SZ);
+		    hca_infop->uverbs_hca_psid_string, UVERBS_PSID_STR_SZ);
 
 		strncpy(info->ibd_devid_string,
-		    hca_infop->uverbs_hca_devid_string, DEVID_STR_SZ);
+		    hca_infop->uverbs_hca_devid_string, UVERBS_DEVID_STR_SZ);
 
 		info->ibd_valid = B_TRUE;
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,414 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license libmlx4-1.0.1 under the OpenIB.org BSD license.
+
+Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+Copyright (c) 2005, 2006, 2007 Cisco Systems.  All rights reserved.
+Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+
+This software is available to you under a choice of one of two
+licenses. You may choose to be licensed under the terms of the the
+OpenIB.org BSD license or the GNU General Public License (GPL) Version
+2, both included below.
+
+Copyright (c) 2004 Topspin Communications. All rights reserved.
+
+==================================================================
+
+OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License. (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code. (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year> <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
--- a/components/open-fabrics/libmlx4/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libmlx4/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		libmlx4
-COMPONENT_VERSION=	1.0.1
-COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-1.18.gb810a27.tar.gz
+COMPONENT_VERSION=	1.0.6
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:ac3aa335d5749a8edc471630b1f5049122c8b7b66bab88c299e255122028e19c
+	sha256:f680ecbb60b01ad893490c158b4ce8028a3014bb8194c2754df508d53aa848a8
+COMPONENT_ARCHIVE_URL= https://www.openfabrics.org/downloads/mlx4/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 include ../ofed-component.mk
@@ -40,6 +40,8 @@
 LIBS=	-libverbs
 LDFLAGS +=	-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))
 
+CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)/infiniband
+
 # requires an older automake to reconfigure
 COMPONENT_PREP_ACTION += (if [ x$(MACH) = "xi386" ]; then \
 		cp mlx4.driver.i386 $(@D)/mlx4.driver; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/patches/001-libmlx4-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1852 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  428f909809d31308ed8899463fa947e85a080c7c
+libmlx4 solaris specific changes
+
+diff -r 428f909809d3 Makefile.am
+--- a/Makefile.am	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.am	Fri Nov 13 00:56:50 2015 -0800
+@@ -13,7 +13,7 @@
+ mlx4conf_DATA = mlx4.driver
+ 
+ EXTRA_DIST = src/doorbell.h src/mlx4.h src/mlx4-abi.h src/wqe.h \
+-    src/mlx4.map libmlx4.spec.in mlx4.driver
++    src/mlnx_umap.h src/mlx4.map libmlx4.spec.in mlx4.driver
+ 
+ dist-hook: libmlx4.spec
+ 	cp libmlx4.spec $(distdir)
+diff -r 428f909809d3 Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Fri Nov 13 00:56:50 2015 -0800
+@@ -1,7 +1,7 @@
+-# Makefile.in generated by automake 1.14.1 from Makefile.am.
++# Makefile.in generated by automake 1.15 from Makefile.am.
+ # @configure_input@
+ 
+-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
++# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+ 
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -16,7 +16,17 @@
+ 
+ 
+ VPATH = @srcdir@
+-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
++am__is_gnu_make = { \
++  if test -z '$(MAKELEVEL)'; then \
++    false; \
++  elif test -n '$(MAKE_HOST)'; then \
++    true; \
++  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
++    true; \
++  else \
++    false; \
++  fi; \
++}
+ am__make_running_with_option = \
+   case $${target_option-} in \
+       ?) ;; \
+@@ -80,21 +90,12 @@
+ build_triplet = @build@
+ host_triplet = @host@
+ subdir = .
+-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+-	$(top_srcdir)/configure $(am__configure_deps) \
+-	$(srcdir)/config.h.in $(srcdir)/libmlx4.spec.in \
+-	$(top_srcdir)/config/depcomp AUTHORS COPYING README \
+-	config/compile config/config.guess config/config.sub \
+-	config/depcomp config/install-sh config/missing \
+-	config/ltmain.sh $(top_srcdir)/config/compile \
+-	$(top_srcdir)/config/config.guess \
+-	$(top_srcdir)/config/config.sub \
+-	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+-	$(top_srcdir)/config/missing
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ 	$(ACLOCAL_M4)
++DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
++	$(am__configure_deps) $(am__DIST_COMMON)
+ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+  configure.lineno config.status.lineno
+ mkinstalldirs = $(install_sh) -d
+@@ -208,6 +209,15 @@
+ CTAGS = ctags
+ CSCOPE = cscope
+ AM_RECURSIVE_TARGETS = cscope
++am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
++	$(srcdir)/libmlx4.spec.in $(top_srcdir)/config/compile \
++	$(top_srcdir)/config/config.guess \
++	$(top_srcdir)/config/config.sub $(top_srcdir)/config/depcomp \
++	$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
++	$(top_srcdir)/config/missing AUTHORS COPYING README \
++	config/compile config/config.guess config/config.sub \
++	config/depcomp config/install-sh config/ltmain.sh \
++	config/missing
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -354,7 +364,7 @@
+ mlx4confdir = $(sysconfdir)/libibverbs.d
+ mlx4conf_DATA = mlx4.driver
+ EXTRA_DIST = src/doorbell.h src/mlx4.h src/mlx4-abi.h src/wqe.h \
+-    src/mlx4.map libmlx4.spec.in mlx4.driver
++    src/mlnx_umap.h src/mlx4.map libmlx4.spec.in mlx4.driver
+ 
+ all: config.h
+ 	$(MAKE) $(AM_MAKEFLAGS) all-am
+@@ -376,7 +386,6 @@
+ 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ 	$(am__cd) $(top_srcdir) && \
+ 	  $(AUTOMAKE) --foreign Makefile
+-.PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ 	@case '$?' in \
+ 	  *config.status*) \
+@@ -653,15 +662,15 @@
+ 	$(am__post_remove_distdir)
+ 
+ dist-tarZ: distdir
+-	@echo WARNING: "Support for shar distribution archives is" \
+-	               "deprecated." >&2
++	@echo WARNING: "Support for distribution archives compressed with" \
++		       "legacy program 'compress' is deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ 	$(am__post_remove_distdir)
+ 
+ dist-shar: distdir
+-	@echo WARNING: "Support for distribution archives compressed with" \
+-		       "legacy program 'compress' is deprecated." >&2
++	@echo WARNING: "Support for shar distribution archives is" \
++	               "deprecated." >&2
+ 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ 	$(am__post_remove_distdir)
+@@ -697,17 +706,17 @@
+ 	esac
+ 	chmod -R a-w $(distdir)
+ 	chmod u+w $(distdir)
+-	mkdir $(distdir)/_build $(distdir)/_inst
++	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
+ 	chmod a-w $(distdir)
+ 	test -d $(distdir)/_build || exit 0; \
+ 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ 	  && am__cwd=`pwd` \
+-	  && $(am__cd) $(distdir)/_build \
+-	  && ../configure \
++	  && $(am__cd) $(distdir)/_build/sub \
++	  && ../../configure \
+ 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+-	    --srcdir=.. --prefix="$$dc_install_base" \
++	    --srcdir=../.. --prefix="$$dc_install_base" \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ 	  && $(MAKE) $(AM_MAKEFLAGS) check \
+@@ -894,6 +903,8 @@
+ 	tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \
+ 	uninstall-mlx4confDATA
+ 
++.PRECIOUS: Makefile
++
+ 
+ dist-hook: libmlx4.spec
+ 	cp libmlx4.spec $(distdir)
+diff -r 428f909809d3 aclocal.m4
+--- a/aclocal.m4	Wed Oct 14 12:54:37 2015 -0700
++++ b/aclocal.m4	Fri Nov 13 00:56:50 2015 -0800
+@@ -1,6 +1,6 @@
+-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+-
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# generated automatically by aclocal 1.15 -*- Autoconf -*-
++
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ 
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -1326,7 +1326,7 @@
+   rm -rf conftest*
+   ;;
+ 
+-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
++x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+   # Find out which ABI we are using.
+   echo 'int i;' > conftest.$ac_ext
+@@ -1338,19 +1338,9 @@
+ 	    LD="${LD-ld} -m elf_i386_fbsd"
+ 	    ;;
+ 	  x86_64-*linux*)
+-	    case `/usr/bin/file conftest.o` in
+-	      *x86-64*)
+-		LD="${LD-ld} -m elf32_x86_64"
+-		;;
+-	      *)
+-		LD="${LD-ld} -m elf_i386"
+-		;;
+-	    esac
++	    LD="${LD-ld} -m elf_i386"
+ 	    ;;
+-	  powerpc64le-*)
+-	    LD="${LD-ld} -m elf32lppclinux"
+-	    ;;
+-	  powerpc64-*)
++	  ppc64-*linux*|powerpc64-*linux*)
+ 	    LD="${LD-ld} -m elf32ppclinux"
+ 	    ;;
+ 	  s390x-*linux*)
+@@ -1369,10 +1359,7 @@
+ 	  x86_64-*linux*)
+ 	    LD="${LD-ld} -m elf_x86_64"
+ 	    ;;
+-	  powerpcle-*)
+-	    LD="${LD-ld} -m elf64lppc"
+-	    ;;
+-	  powerpc-*)
++	  ppc*-*linux*|powerpc*-*linux*)
+ 	    LD="${LD-ld} -m elf64ppc"
+ 	    ;;
+ 	  s390*-*linux*|s390*-*tpf*)
+@@ -1715,8 +1702,7 @@
+     ;;
+   *)
+     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+-    if test -n "$lt_cv_sys_max_cmd_len" && \
+-	test undefined != "$lt_cv_sys_max_cmd_len"; then
++    if test -n "$lt_cv_sys_max_cmd_len"; then
+       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+     else
+@@ -2540,6 +2526,17 @@
+   esac
+   ;;
+ 
++gnu*)
++  version_type=linux # correct to gnu/linux during the next big refactor
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
++  soname_spec='${libname}${release}${shared_ext}$major'
++  shlibpath_var=LD_LIBRARY_PATH
++  shlibpath_overrides_runpath=no
++  hardcode_into_libs=yes
++  ;;
++
+ haiku*)
+   version_type=linux # correct to gnu/linux during the next big refactor
+   need_lib_prefix=no
+@@ -2656,7 +2653,7 @@
+   ;;
+ 
+ # This must be glibc/ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++linux* | k*bsd*-gnu | kopensolaris*-gnu)
+   version_type=linux # correct to gnu/linux during the next big refactor
+   need_lib_prefix=no
+   need_version=no
+@@ -2701,18 +2698,6 @@
+   dynamic_linker='GNU/Linux ld.so'
+   ;;
+ 
+-netbsdelf*-gnu)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=no
+-  hardcode_into_libs=yes
+-  dynamic_linker='NetBSD ld.elf_so'
+-  ;;
+-
+ netbsd*)
+   version_type=sunos
+   need_lib_prefix=no
+@@ -3272,6 +3257,10 @@
+   fi
+   ;;
+ 
++gnu*)
++  lt_cv_deplibs_check_method=pass_all
++  ;;
++
+ haiku*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -3310,11 +3299,11 @@
+   ;;
+ 
+ # This must be glibc/ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++linux* | k*bsd*-gnu | kopensolaris*-gnu)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+ 
+-netbsd* | netbsdelf*-gnu)
++netbsd*)
+   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+   else
+@@ -4062,7 +4051,7 @@
+ 	    ;;
+ 	esac
+ 	;;
+-      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ 	case $cc_basename in
+ 	  KCC*)
+ 	    # KAI C++ Compiler
+@@ -4126,7 +4115,7 @@
+ 	    ;;
+ 	esac
+ 	;;
+-      netbsd* | netbsdelf*-gnu)
++      netbsd*)
+ 	;;
+       *qnx* | *nto*)
+         # QNX uses GNU C++, but need to define -shared option too, otherwise
+@@ -4361,7 +4350,7 @@
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+       ;;
+ 
+-    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+       case $cc_basename in
+       # old Intel for x86_64 which still supported -KPIC.
+       ecc*)
+@@ -4603,9 +4592,6 @@
+       ;;
+     esac
+     ;;
+-  linux* | k*bsd*-gnu | gnu*)
+-    _LT_TAGVAR(link_all_deplibs, $1)=no
+-    ;;
+   *)
+     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+     ;;
+@@ -4668,9 +4654,6 @@
+   openbsd*)
+     with_gnu_ld=no
+     ;;
+-  linux* | k*bsd*-gnu | gnu*)
+-    _LT_TAGVAR(link_all_deplibs, $1)=no
+-    ;;
+   esac
+ 
+   _LT_TAGVAR(ld_shlibs, $1)=yes
+@@ -4892,7 +4875,7 @@
+       fi
+       ;;
+ 
+-    netbsd* | netbsdelf*-gnu)
++    netbsd*)
+       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ 	wlarc=
+@@ -5069,7 +5052,6 @@
+ 	if test "$aix_use_runtimelinking" = yes; then
+ 	  shared_flag="$shared_flag "'${wl}-G'
+ 	fi
+-	_LT_TAGVAR(link_all_deplibs, $1)=no
+       else
+ 	# not using gcc
+ 	if test "$host_cpu" = ia64; then
+@@ -5374,7 +5356,7 @@
+       _LT_TAGVAR(link_all_deplibs, $1)=yes
+       ;;
+ 
+-    netbsd* | netbsdelf*-gnu)
++    netbsd*)
+       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+       else
+@@ -6250,6 +6232,9 @@
+         _LT_TAGVAR(ld_shlibs, $1)=yes
+         ;;
+ 
++      gnu*)
++        ;;
++
+       haiku*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_TAGVAR(link_all_deplibs, $1)=yes
+@@ -6411,7 +6396,7 @@
+         _LT_TAGVAR(inherit_rpath, $1)=yes
+         ;;
+ 
+-      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+         case $cc_basename in
+           KCC*)
+ 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+@@ -8622,7 +8607,7 @@
+ m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+ m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
+ 
+-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
++# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -8634,10 +8619,10 @@
+ # generated from the m4 files accompanying Automake X.Y.
+ # (This private macro should not be called outside this file.)
+ AC_DEFUN([AM_AUTOMAKE_VERSION],
+-[am__api_version='1.14'
++[am__api_version='1.15'
+ dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+ dnl require some minimum version.  Point them to the right macro.
+-m4_if([$1], [1.14.1], [],
++m4_if([$1], [1.15], [],
+       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+ ])
+ 
+@@ -8653,14 +8638,14 @@
+ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+ # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+-[AM_AUTOMAKE_VERSION([1.14.1])dnl
++[AM_AUTOMAKE_VERSION([1.15])dnl
+ m4_ifndef([AC_AUTOCONF_VERSION],
+   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+ 
+ # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -8705,15 +8690,14 @@
+ # configured tree to be moved without reconfiguration.
+ 
+ AC_DEFUN([AM_AUX_DIR_EXPAND],
+-[dnl Rely on autoconf to set up CDPATH properly.
+-AC_PREREQ([2.50])dnl
+-# expand $ac_aux_dir to an absolute path
+-am_aux_dir=`cd $ac_aux_dir && pwd`
++[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
++# Expand $ac_aux_dir to an absolute path.
++am_aux_dir=`cd "$ac_aux_dir" && pwd`
+ ])
+ 
+ # AM_CONDITIONAL                                            -*- Autoconf -*-
+ 
+-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
++# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -8744,7 +8728,7 @@
+ Usually this means the macro was only invoked conditionally.]])
+ fi])])
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -8935,7 +8919,7 @@
+ 
+ # Generate code to set up dependency tracking.              -*- Autoconf -*-
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9011,7 +8995,7 @@
+ 
+ # Do all the work for Automake.                             -*- Autoconf -*-
+ 
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9101,8 +9085,8 @@
+ # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+ # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+ AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+-# We need awk for the "check" target.  The system "awk" is bad on
+-# some platforms.
++# We need awk for the "check" target (and possibly the TAP driver).  The
++# system "awk" is bad on some platforms.
+ AC_REQUIRE([AC_PROG_AWK])dnl
+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+@@ -9176,6 +9160,9 @@
+     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+   fi
+ fi
++dnl The trailing newline in this macro's definition is deliberate, for
++dnl backward compatibility and to allow trailing 'dnl'-style comments
++dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+ ])
+ 
+ dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+@@ -9205,7 +9192,7 @@
+ done
+ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9216,7 +9203,7 @@
+ # Define $install_sh.
+ AC_DEFUN([AM_PROG_INSTALL_SH],
+ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+-if test x"${install_sh}" != xset; then
++if test x"${install_sh+set}" != xset; then
+   case $am_aux_dir in
+   *\ * | *\	*)
+     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+@@ -9226,7 +9213,7 @@
+ fi
+ AC_SUBST([install_sh])])
+ 
+-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
++# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9247,7 +9234,7 @@
+ 
+ # Check to see how 'make' treats includes.	            -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9297,7 +9284,7 @@
+ 
+ # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+ 
+-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
++# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9336,7 +9323,7 @@
+ 
+ # Helper functions for option handling.                     -*- Autoconf -*-
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9365,7 +9352,7 @@
+ AC_DEFUN([_AM_IF_OPTION],
+ [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+ 
+-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
++# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9412,7 +9399,7 @@
+ # For backward compatibility.
+ AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9431,7 +9418,7 @@
+ 
+ # Check to make sure that the build environment is sane.    -*- Autoconf -*-
+ 
+-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
++# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9512,7 +9499,7 @@
+ rm -f conftest.file
+ ])
+ 
+-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
++# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9572,7 +9559,7 @@
+ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+ ])
+ 
+-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
++# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9600,7 +9587,7 @@
+ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+ AC_SUBST([INSTALL_STRIP_PROGRAM])])
+ 
+-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
++# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -9619,7 +9606,7 @@
+ 
+ # Check how to create a tarball.                            -*- Autoconf -*-
+ 
+-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
++# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+diff -r 428f909809d3 configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Fri Nov 13 00:56:50 2015 -0800
+@@ -2422,7 +2422,7 @@
+ 
+ ac_config_headers="$ac_config_headers config.h"
+ 
+-am__api_version='1.14'
++am__api_version='1.15'
+ 
+ # Find a good install program.  We prefer a C program (faster),
+ # so one script is as good as another.  But avoid the broken or
+diff -r 428f909809d3 src/buf.c
+--- a/src/buf.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/buf.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -60,7 +60,9 @@
+ void mlx4_free_buf(struct mlx4_buf *buf)
+ {
+ 	if (buf->length) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		ibv_dofork_range(buf->buf, buf->length);
++#endif
+ 		munmap(buf->buf, buf->length);
+ 	}
+ }
+diff -r 428f909809d3 src/dbrec.c
+--- a/src/dbrec.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/dbrec.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -41,6 +41,156 @@
+ 
+ #include "mlx4.h"
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * In Solaris the doorbell UAR is setup by the kernel, we only
++ * mmap the offset specified for the doorbell into the user
++ * address space.  A reference counted page list is maintained
++ * per user context of doorbell pages that have been mapped.
++ */
++struct mlx4_db_page {
++	struct mlx4_db_page	   *prev, *next;
++	uint32_t                   *dbp_page_addr;
++	uint32_t                   *dbp_page_addr_end;
++	uint64_t                   dbp_map_offset;
++	uint64_t                   dbp_map_len;
++	int                        fd;
++	int                        dbp_use_cnt;
++};
++
++/*
++ * These are not required in Solaris, but we keep them to pass
++ * as dummy arguments so that the the doorbell function calls can
++ * keep the same API.
++ */
++static const int db_size[] = {
++	[MLX4_DB_TYPE_CQ] = 8,
++	[MLX4_DB_TYPE_RQ] = 4,
++};
++
++/*
++ * Return a doorbell pointer for the specified map offset.  If this
++ * offset has not been previously mapped it will be mmap'd and the
++ * appropriate doorbell returned; otherwise, the reference count
++ * will be updated and the appropriate doorbell will be returned.
++ * Each successful call to mlx4_alloc_db() must call mlx4_free_db()
++ * to release the reference to the doorbell page  when the doorbell
++ * is no longer required.
++ */
++uint32_t *mlx4_alloc_db(struct mlx4_context *context,
++                        uint64_t mapoffset,
++                        uint64_t maplen,
++                        uint32_t offset)
++{
++	struct mlx4_db_page *page;
++	uint32_t *db = NULL;
++
++	pthread_mutex_lock(&context->db_list_mutex);
++
++	for (page = context->db_page_list; page; page = page->next) {
++		if (page->dbp_map_offset == mapoffset &&
++		    page->fd == context->ibv_ctx.mmap_fd) {
++			if (page->dbp_map_len == maplen) {
++				goto found;
++			}
++			fprintf(stderr,
++			        PFX "mlx4_alloc_db: Bad maplen (%" PRId64 ")\n",
++			        maplen);
++			goto out;
++		}
++	}
++
++	page = malloc(sizeof(struct mlx4_db_page));
++	if (!page) {
++		fprintf(stderr, PFX "DB alloc memory allocate failure\n");
++		goto out;
++	}
++
++	page->dbp_page_addr = (uint32_t *) mmap64((void *)0, maplen,
++	                                          (PROT_READ | PROT_WRITE),
++	                                          MAP_SHARED,
++	                                          context->ibv_ctx.mmap_fd,
++	                                          mapoffset);
++	if (page->dbp_page_addr == MAP_FAILED) {
++		fprintf(stderr, PFX
++		        "Unable to map doorbell entry: maplen:%" PRId64 ", offset:%" PRId64
++		        "\n", maplen, mapoffset);
++		free(page);
++		goto out;
++	}
++
++	page->dbp_page_addr_end = (uint32_t *)((uint8_t *) page->dbp_page_addr + maplen);
++
++	page->dbp_map_offset  = mapoffset;
++	page->dbp_map_len     = maplen;
++	page->dbp_use_cnt     = 0;
++	page->fd	      = context->ibv_ctx.mmap_fd;
++	page->next            = context->db_page_list;
++
++	if (context->db_page_list)
++		context->db_page_list->prev = page;
++
++	page->prev            = NULL;
++	context->db_page_list = page;
++
++found:
++	page->dbp_use_cnt++;
++
++
++	db = (uint32_t *) ((uint8_t *)page->dbp_page_addr + offset);
++out:
++	pthread_mutex_unlock(&context->db_list_mutex);
++
++	return db;
++}
++
++/*
++ * Dereference doorbell page mappinge associated with the specified doorbell.
++ * If this is the last doorbell that references a mapped region, then that
++ * region will be unmapped.
++ */
++void mlx4_free_db(struct mlx4_context *context,
++                  enum mlx4_db_type dummy,
++                  uint32_t *db)
++{
++	struct mlx4_db_page *page;
++
++	pthread_mutex_lock(&context->db_list_mutex);
++
++	for (page = context->db_page_list; page; page = page->next) {
++		if (db >= page->dbp_page_addr && db < page->dbp_page_addr_end) {
++			break;
++		}
++	}
++
++	if (page == NULL) {
++		fprintf(stderr, PFX "mlx4_free_db: Doorbell not mapped\n");
++		goto out;
++	}
++
++	page->dbp_use_cnt--;
++	if (page->dbp_use_cnt > 0) {
++		goto out;
++	}
++
++	munmap((void *)page->dbp_page_addr, page->dbp_map_len);
++	if (page->next) {
++		page->next->prev = page->prev;
++	}
++	if (page->prev) {
++		page->prev->next = page->next;
++	} else {
++		context->db_page_list = page->next;
++	}
++
++	free(page);
++
++out:
++	pthread_mutex_unlock(&context->db_list_mutex);
++}
++
++#else
++
+ struct mlx4_db_page {
+ 	struct mlx4_db_page	       *prev, *next;
+ 	struct mlx4_buf			buf;
+@@ -152,3 +302,4 @@
+ out:
+ 	pthread_mutex_unlock(&context->db_list_mutex);
+ }
++#endif
+diff -r 428f909809d3 src/mlx4-abi.h
+--- a/src/mlx4-abi.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/mlx4-abi.h	Fri Nov 13 00:56:50 2015 -0800
+@@ -35,6 +35,10 @@
+ 
+ #include <infiniband/kern-abi.h>
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <sys/ib/adapters/mlnx_umap.h>   /* Opaque CI data out definitions */
++#endif
++
+ #define MLX4_UVERBS_MIN_ABI_VERSION	2
+ #define MLX4_UVERBS_MAX_ABI_VERSION	4
+ 
+@@ -49,6 +53,10 @@
+ 	__u32				qp_tab_size;
+ 	__u16				bf_reg_size;
+ 	__u16				bf_regs_per_page;
++#if defined(__SVR4) && defined(__sun)
++	uint32_t			muc_rev;
++	uint32_t			muc_reserved;
++#endif
+ };
+ 
+ struct mlx4_alloc_ucontext_resp {
+@@ -58,6 +66,10 @@
+ 	__u16				bf_reg_size;
+ 	__u16				bf_regs_per_page;
+ 	__u32				cqe_size;
++#if defined(__SVR4) && defined(__sun)
++	uint32_t			muc_rev;
++	uint32_t			muc_reserved;
++#endif
+ };
+ 
+ struct mlx4_alloc_pd_resp {
+@@ -68,25 +80,42 @@
+ 
+ struct mlx4_create_cq {
+ 	struct ibv_create_cq		ibv_cmd;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u64				buf_addr;
+ 	__u64				db_addr;
++#endif
+ };
+ 
+ struct mlx4_create_cq_resp {
+ 	struct ibv_create_cq_resp	ibv_resp;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u32				cqn;
+ 	__u32				reserved;
++#else
++	mlnx_umap_cq_data_out_t		mdd;
++#endif
+ };
+ 
+ struct mlx4_resize_cq {
+ 	struct ibv_resize_cq		ibv_cmd;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u64				buf_addr;
++#endif
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++struct mlx4_resize_cq_resp {
++	struct ibv_resize_cq_resp	ibv_resp;
++	mlnx_umap_cq_data_out_t		mdd;
++};
++#endif
++
+ struct mlx4_create_srq {
+ 	struct ibv_create_srq		ibv_cmd;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u64				buf_addr;
+ 	__u64				db_addr;
++#endif
+ };
+ 
+ struct mlx4_create_xsrq {
+@@ -97,18 +126,31 @@
+ 
+ struct mlx4_create_srq_resp {
+ 	struct ibv_create_srq_resp	ibv_resp;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u32				srqn;
+ 	__u32				reserved;
++#else
++	mlnx_umap_srq_data_out_t	mdd;
++#endif
+ };
+ 
+ struct mlx4_create_qp {
+ 	struct ibv_create_qp		ibv_cmd;
++#if !(defined(__SVR4) && defined(__sun))
+ 	__u64				buf_addr;
+ 	__u64				db_addr;
+ 	__u8				log_sq_bb_count;
+ 	__u8				log_sq_stride;
+ 	__u8				sq_no_prefetch;	/* was reserved in ABI 2 */
+ 	__u8				reserved[5];
++#endif
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++struct mlx4_create_qp_resp {
++	struct ibv_create_qp_resp	ibv_resp;
++	mlnx_umap_qp_data_out_t		mdd;
++};
++#endif
++
+ #endif /* MLX4_ABI_H */
+diff -r 428f909809d3 src/mlx4.c
+--- a/src/mlx4.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/mlx4.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -127,6 +127,11 @@
+ 	__u16				bf_reg_size;
+ 	struct mlx4_device              *dev = to_mdev(&v_device->device);
+ 	struct verbs_context *verbs_ctx = verbs_get_ctx(ibv_ctx);
++#if defined(__SVR4) && defined(__sun)
++	pid_t                           cur_pid;
++	off64_t                         uarpg_offset;
++	uint32_t                        temp_qp_num;
++#endif
+ 
+ 	/* memory footprint of mlx4_context and verbs_context share
+ 	* struct ibv_context.
+@@ -134,11 +139,29 @@
+ 	context = to_mctx(ibv_ctx);
+ 	ibv_ctx->cmd_fd = cmd_fd;
+ 
++#if defined(__SVR4) && defined(__sun)
++	ibv_ctx->device = &v_device->device;
++#endif
+ 	if (dev->abi_version <= MLX4_UVERBS_NO_DEV_CAPS_ABI_VERSION) {
+ 		if (ibv_cmd_get_context(ibv_ctx, &cmd, sizeof cmd,
+ 					&resp_v3.ibv_resp, sizeof resp_v3))
+ 			return errno;
++#if defined(__SVR4) && defined(__sun)
++		/* 
++		 * OFED expects power of two, round up here to make user table
++		 * large enough.
++		 */
++		for (temp_qp_num = 1; temp_qp_num < resp_v3.qp_tab_size; temp_qp_num <<= 1)
++			;
++		resp_v3.qp_tab_size = temp_qp_num;
+ 
++		/*
++		 * NOTE: In Solaris this value is not returned in the channel interface
++		 * opaque data and is assumed to be 2*256 by the dapl code.  We have
++		 * made the same assumption here.
++		 */
++		resp_v3.bf_reg_size = 512;
++#endif
+ 		context->num_qps  = resp_v3.qp_tab_size;
+ 		bf_reg_size	  = resp_v3.bf_reg_size;
+ 		context->cqe_size = sizeof (struct mlx4_cqe);
+@@ -146,6 +169,22 @@
+ 		if (ibv_cmd_get_context(ibv_ctx, &cmd, sizeof cmd,
+ 					&resp.ibv_resp, sizeof resp))
+ 			return errno;
++#if defined(__SVR4) && defined(__sun)
++		/* 
++		 * OFED expects power of two, round up here to make user table
++		 * large enough.
++		 */
++		for (temp_qp_num = 1; temp_qp_num < resp.qp_tab_size; temp_qp_num <<= 1)
++			;
++		resp.qp_tab_size = temp_qp_num;
++
++		/*
++		 * NOTE: In Solaris this value is not returned in the channel interface
++		 * opaque data and is assumed to be 2*256 by the dapl code.  We have
++		 * made the same assumption here.
++		 */
++		resp.bf_reg_size = 512;
++#endif
+ 
+ 		context->num_qps  = resp.qp_tab_size;
+ 		bf_reg_size	  = resp.bf_reg_size;
+@@ -162,21 +201,46 @@
+ 	for (i = 0; i < MLX4_QP_TABLE_SIZE; ++i)
+ 		context->qp_table[i].refcnt = 0;
+ 
++#if defined(__SVR4) && defined(__sun)
++	context->db_page_list = NULL;
++#else
+ 	for (i = 0; i < MLX4_NUM_DB_TYPE; ++i)
+ 		context->db_list[i] = NULL;
++#endif
+ 
+ 	mlx4_init_xsrq_table(&context->xsrq_table, context->num_qps);
+ 	pthread_mutex_init(&context->db_list_mutex, NULL);
+ 
++#if defined(__SVR4) && defined(__sun)
++	cur_pid = getpid();
++	uarpg_offset = (((off64_t) cur_pid << MLNX_UMAP_RSRC_TYPE_SHIFT) |
++	                MLNX_UMAP_UARPG_RSRC) * dev->page_size;
++	context->uar = mmap64((void *)0, dev->page_size, PROT_WRITE,
++			    MAP_SHARED, ibv_ctx->mmap_fd, uarpg_offset);
++#else
+ 	context->uar = mmap(NULL, dev->page_size, PROT_WRITE,
+ 			    MAP_SHARED, cmd_fd, 0);
++#endif
+ 	if (context->uar == MAP_FAILED)
+ 		return errno;
+ 
+ 	if (bf_reg_size) {
++#if defined(__SVR4) && defined(__sun)
++		/*
++		 * If kernel driver is supporting Blue Flame feature, map
++		 * the Blue Flame user access region as well.
++		 */
++		uarpg_offset = (((off64_t) cur_pid << MLNX_UMAP_RSRC_TYPE_SHIFT)
++		    | MLNX_UMAP_BLUEFLAMEPG_RSRC) * dev->page_size;
++
++		context->bf_page = mmap64((void *)0, dev->page_size,
++		    PROT_WRITE, MAP_SHARED, ibv_ctx->mmap_fd,
++		    uarpg_offset);
++#else
+ 		context->bf_page = mmap(NULL, dev->page_size,
+ 					PROT_WRITE, MAP_SHARED, cmd_fd,
+ 					dev->page_size);
++#endif
+ 		if (context->bf_page == MAP_FAILED) {
+ 			fprintf(stderr, PFX "Warning: BlueFlame available, "
+ 				"but failed to mmap() BlueFlame page.\n");
+diff -r 428f909809d3 src/mlx4.h
+--- a/src/mlx4.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/mlx4.h	Fri Nov 13 00:56:50 2015 -0800
+@@ -185,7 +185,12 @@
+ 	int				qp_table_shift;
+ 	int				qp_table_mask;
+ 
++
++#if defined(__SVR4) && defined(__sun)
++	struct mlx4_db_page	       *db_page_list;
++#else
+ 	struct mlx4_db_page	       *db_list[MLX4_NUM_DB_TYPE];
++#endif
+ 	pthread_mutex_t			db_list_mutex;
+ 	int				cqe_size;
+ 	struct mlx4_xsrq_table		xsrq_table;
+@@ -347,7 +352,12 @@
+ int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size);
+ void mlx4_free_buf(struct mlx4_buf *buf);
+ 
++#if defined(__SVR4) && defined(__sun)
++uint32_t *mlx4_alloc_db(struct mlx4_context *context, uint64_t mapoffset,
++                        uint64_t maplen, uint32_t offset);
++#else
+ uint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type);
++#endif
+ void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t *db);
+ 
+ int mlx4_query_device(struct ibv_context *context,
+@@ -393,8 +403,13 @@
+ 			   struct ibv_srq_attr *attr);
+ int mlx4_destroy_srq(struct ibv_srq *srq);
+ int mlx4_destroy_xrc_srq(struct ibv_srq *srq);
++#if defined(__SVR4) && defined(__sun)
++int mlx4_set_srq_buf(struct ibv_pd *pd, struct mlx4_srq *srq,
++			uint32_t srq_wqesz, uint32_t srq_numwqe);
++#else
+ int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
+ 			struct mlx4_srq *srq);
++#endif
+ void mlx4_init_xsrq_table(struct mlx4_xsrq_table *xsrq_table, int size);
+ struct mlx4_srq *mlx4_find_xsrq(struct mlx4_xsrq_table *xsrq_table, uint32_t srqn);
+ int mlx4_store_xsrq(struct mlx4_xsrq_table *xsrq_table, uint32_t srqn,
+@@ -423,8 +438,15 @@
+ 			  struct ibv_recv_wr **bad_wr);
+ void mlx4_calc_sq_wqe_size(struct ibv_qp_cap *cap, enum ibv_qp_type type,
+ 			   struct mlx4_qp *qp);
++
++#if defined(__SVR4) && defined(__sun)
++int mlx4_set_qp_buf(struct ibv_pd *pd, struct mlx4_qp *qp,
++                    void *qpbuf, uint64_t buflen, uint32_t rq_wqesz,
++                     uint32_t rq_off, uint32_t sq_wqesz, uint32_t sq_off);
++#else
+ int mlx4_alloc_qp_buf(struct ibv_context *context, struct ibv_qp_cap *cap,
+ 		       enum ibv_qp_type type, struct mlx4_qp *qp);
++#endif
+ void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
+ 		       enum ibv_qp_type type);
+ struct mlx4_qp *mlx4_find_qp(struct mlx4_context *ctx, uint32_t qpn);
+diff -r 428f909809d3 src/qp.c
+--- a/src/qp.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/qp.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -587,6 +587,60 @@
+ 		; /* nothing */
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++int mlx4_set_qp_buf(struct ibv_pd *pd, struct mlx4_qp *qp, void *qpbuf,
++    uint64_t buflen, uint32_t rq_wqesz, uint32_t rq_off,
++    uint32_t sq_wqesz, uint32_t sq_off)
++{
++	qp->buf.buf      = qpbuf;
++	qp->buf.length   = buflen;
++
++	qp->sq.wrid = malloc(qp->sq.wqe_cnt * sizeof (uint64_t));
++	if (!qp->sq.wrid)
++		return -1;
++
++	if (qp->rq.wqe_cnt) {
++		qp->rq.wrid = malloc(qp->rq.wqe_cnt * sizeof (uint64_t));
++		if (!qp->rq.wrid) {
++			free(qp->sq.wrid);
++			return -1;
++		}
++	}
++
++	for (qp->rq.wqe_shift = 4; 1 << qp->rq.wqe_shift < rq_wqesz;
++	     qp->rq.wqe_shift++) {
++		; /* nothing */
++	}
++
++	for (qp->sq.wqe_shift = 6; 1 << qp->sq.wqe_shift < sq_wqesz;
++	     qp->sq.wqe_shift++) {
++		; /* nothing */
++	}
++
++	qp->buf_size = (qp->rq.wqe_cnt << qp->rq.wqe_shift) +
++		(qp->sq.wqe_cnt << qp->sq.wqe_shift);
++	if (qp->rq.wqe_shift > qp->sq.wqe_shift) {
++		qp->rq.offset = 0;
++		qp->sq.offset = qp->rq.wqe_cnt << qp->rq.wqe_shift;
++	} else {
++		qp->rq.offset = qp->sq.wqe_cnt << qp->sq.wqe_shift;
++		qp->sq.offset = 0;
++	}
++
++	if ((long int)qp->buf.length < (long int)qp->buf_size) {
++		fprintf(stderr, PFX "QP kernel buffer size %lu < user buf "
++		    "size %d\n", (unsigned long)qp->buf.length, qp->buf_size);
++	}
++	if ((!rq_off && qp->rq.offset) || (!sq_off && qp->sq.offset)) {
++		fprintf(stderr, PFX "QP kernel and user out of sync on "
++		    "buffer order\n");
++	}
++
++	memset(qp->buf.buf, 0, qp->buf_size);
++	return 0;
++}
++#endif
++
+ int mlx4_alloc_qp_buf(struct ibv_context *context, struct ibv_qp_cap *cap,
+ 		       enum ibv_qp_type type, struct mlx4_qp *qp)
+ {
+diff -r 428f909809d3 src/srq.c
+--- a/src/srq.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/srq.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -125,6 +125,54 @@
+ 	return err;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * The Solaris kernel allocates the SRQ WQE buffer, this routine
++ * initializes the control structures and buffer contents for the
++ * SRQ memory.  That memory is mapped into the caller's address
++ * space prior to this call.
++ */
++int mlx4_set_srq_buf(struct ibv_pd *pd, struct mlx4_srq *srq,
++				uint32_t srq_wqesz, uint32_t srq_numwqe)
++{
++	struct mlx4_wqe_srq_next_seg *next;
++	struct mlx4_wqe_data_seg *scatter;
++	int i;
++
++	srq->max         = srq_numwqe;
++
++	srq->wrid = malloc(srq->max * sizeof (uint64_t));
++	if (!srq->wrid) {
++		return -1;
++	}
++
++	for (srq->wqe_shift = 5; 1 << srq->wqe_shift < srq_wqesz; ++srq->wqe_shift) {
++		; /* nothing */
++	}
++
++	memset(srq->buf.buf, 0, srq->buf.length);
++
++	/*
++	 * Now initialize the SRQ buffer so that all of the WQEs are
++	 * linked into the list of free WQEs.
++	 */
++	for (i = 0; i < srq->max; ++i) {
++		next = get_wqe(srq, i);
++		next->next_wqe_index = htons((i + 1) & (srq->max - 1));
++
++		for (scatter = (void *) (next + 1);
++		    (void *) scatter < (void *) next + (1 << srq->wqe_shift);
++		    ++scatter)
++			scatter->lkey = htonl(MLX4_INVALID_LKEY);
++	}
++
++	srq->head = 0;
++	srq->tail = srq->max - 1;
++
++	return 0;
++}
++#endif
++
+ int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
+ 		       struct mlx4_srq *srq)
+ {
+@@ -254,6 +302,7 @@
+ 	if (pthread_spin_init(&srq->lock, PTHREAD_PROCESS_PRIVATE))
+ 		goto err;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	srq->max     = align_queue_size(attr_ex->attr.max_wr + 1);
+ 	srq->max_gs  = attr_ex->attr.max_sge;
+ 	srq->counter = 0;
+@@ -267,6 +316,23 @@
+ 		goto err_free;
+ 
+ 	*srq->db = 0;
++#else
++	/*
++	 * Solaris SRQ WQE memory is supplied by the kernel; we'll update
++	 * these after the creation.
++	 */
++	srq->buf.buf      = NULL;
++	srq->buf.length   = 0;
++	srq->db           = NULL;
++
++	/*
++	 * Need solaris to allocate space for the spare WR in
++	 * the list that makes the queue work. The Solaris driver
++	 * will round up to the nearest power of 2 as align_queue_size()
++	 * does for OFED.
++	 */
++	attr_ex->attr.max_wr += 1;
++#endif
+ 
+ 	cmd.buf_addr = (uintptr_t) srq->buf.buf;
+ 	cmd.db_addr  = (uintptr_t) srq->db;
+diff -r 428f909809d3 src/verbs.c
+--- a/src/verbs.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/verbs.c	Fri Nov 13 00:56:50 2015 -0800
+@@ -56,6 +56,14 @@
+ 	if (ret)
+ 		return ret;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * To be consistent with OFED and so the queue operations in srq.c work
++	 * we need to report the max as actual max  less 1. In OFED this is
++	 * done in the HCA driver.
++	 */
++	attr->max_srq_wr -=1;
++#endif
+ 	major     = (raw_fw_ver >> 32) & 0xffff;
+ 	minor     = (raw_fw_ver >> 16) & 0xffff;
+ 	sub_minor = raw_fw_ver & 0xffff;
+@@ -197,6 +205,9 @@
+ 	struct mlx4_cq		  *cq;
+ 	int			   ret;
+ 	struct mlx4_context       *mctx = to_mctx(context);
++#if defined(__SVR4) && defined(__sun)
++	void                      *cqbuf;
++#endif
+ 
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 0x3fffff)
+@@ -213,6 +224,7 @@
+ 
+ 	cqe = align_queue_size(cqe + 1);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	if (mlx4_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe, mctx->cqe_size))
+ 		goto err;
+ 
+@@ -228,15 +240,75 @@
+ 
+ 	cmd.buf_addr = (uintptr_t) cq->buf.buf;
+ 	cmd.db_addr  = (uintptr_t) cq->set_ci_db;
++#else
++	cq->cqe_size   = mctx->cqe_size;
++	cq->buf.buf    = NULL;
++	cq->buf.length = 0;
++	cq->arm_db     = NULL;
++	cq->set_ci_db  = NULL;
++#endif
+ 
+ 	ret = ibv_cmd_create_cq(context, cqe - 1, channel, comp_vector,
+ 				&cq->ibv_cq, &cmd.ibv_cmd, sizeof cmd,
+ 				&resp.ibv_resp, sizeof resp);
+ 	if (ret)
++#if !(defined(__SVR4) && defined(__sun))
+ 		goto err_db;
+ 
+ 	cq->cqn = resp.cqn;
++#else
++		goto err;
+ 
++        /*
++         * For Solaris the kernel driver passes back mmap information for
++	 *  mapping the CQ memory it allocated.
++         */
++	if (resp.mdd.mcq_rev < MLNX_UMAP_IF_VERSION) {
++		fprintf(stderr, PFX "libmlx4_create_cq: libmlx4/hermon umap "
++		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mcq_rev);
++		goto err_destroy;
++	}
++
++        cqbuf = mmap64((void *)0, resp.mdd.mcq_maplen, (PROT_READ | PROT_WRITE),
++	    MAP_SHARED, context->mmap_fd, resp.mdd.mcq_mapoffset);
++
++        if (cqbuf == MAP_FAILED)
++                goto err_destroy;
++
++        /*
++         * Extract hardware driver values for the number of CQEs and the
++	 * hardware CQ number to use (needed for user space doorbells).
++         */
++	cqe            = resp.mdd.mcq_numcqe;
++	cq->cqn        = resp.mdd.mcq_cqnum;
++	cq->buf.buf    = cqbuf;
++	cq->buf.length = resp.mdd.mcq_maplen;
++	cq->ibv_cq.cqe = cqe-1;
++
++	/*
++	 * We map both poll and arm as seperate doorbells (OFED assumes 1 word
++	 * offset and just bumps the address) since Solaris provides a
++	 * separate offst. This will amount to the same thing (a second
++	 * reference to the first doorbell is added) but is more flexible.
++	 */
++	cq->set_ci_db = mlx4_alloc_db(to_mctx(context),
++	    resp.mdd.mcq_polldbr_mapoffset, resp.mdd.mcq_polldbr_maplen,
++	    resp.mdd.mcq_polldbr_offset);
++
++        if (cq->set_ci_db == NULL)
++                goto err_buf;
++
++	cq->arm_db = mlx4_alloc_db(to_mctx(context),
++	    resp.mdd.mcq_armdbr_mapoffset, resp.mdd.mcq_armdbr_maplen,
++	    resp.mdd.mcq_armdbr_offset);
++
++        if (cq->arm_db == NULL)
++                goto err_db;
++
++	*cq->arm_db    = 0;
++	cq->arm_sn     = 1;
++	*cq->set_ci_db = 0;
++#endif
+ 	return &cq->ibv_cq;
+ 
+ err_db:
+@@ -245,6 +317,21 @@
+ err_buf:
+ 	mlx4_free_buf(&cq->buf);
+ 
++#if defined(__SVR4) && defined(__sun)
++err_destroy:
++	/*
++	 * Calling ibv_cmd_destroy_cq() will try and take the ibv_cq
++	 * mutext that is initialised by the ibv_create_cq() entry point
++	 * that called us AFETR we return, so its not initialised yet.
++	 * So initialised it here so the destroy call doesn't hang.
++	 */
++	pthread_mutex_init(&(cq->ibv_cq.mutex), NULL);
++	pthread_cond_init(&(cq->ibv_cq.cond), NULL);
++	cq->ibv_cq.comp_events_completed = 0;
++	cq->ibv_cq.async_events_completed = 0;
++
++	ibv_cmd_destroy_cq(&cq->ibv_cq);
++#endif
+ err:
+ 	free(cq);
+ 
+@@ -255,10 +342,14 @@
+ {
+ 	struct mlx4_cq *cq = to_mcq(ibcq);
+ 	struct mlx4_resize_cq cmd;
+-	struct ibv_resize_cq_resp resp;
+ 	struct mlx4_buf buf;
+ 	int old_cqe, outst_cqe, ret;
+-
++#if !(defined(__SVR4) && defined(__sun))
++	struct ibv_resize_cq_resp resp;
++#else
++	struct mlx4_resize_cq_resp	resp;
++	void				*cqbuf;
++#endif
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 0x3fffff)
+ 		return EINVAL;
+@@ -278,25 +369,75 @@
+ 		goto out;
+ 	}
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	ret = mlx4_alloc_cq_buf(to_mdev(ibcq->context->device), &buf, cqe, cq->cqe_size);
+ 	if (ret)
+ 		goto out;
+-
+-	old_cqe = ibcq->cqe;
+ 	cmd.buf_addr = (uintptr_t) buf.buf;
++#endif
++        old_cqe = ibcq->cqe;
+ 
+ 	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
+-				&resp, sizeof resp);
+-	if (ret) {
+-		mlx4_free_buf(&buf);
++#if !(defined(__SVR4) && defined(__sun))
++					&resp, sizeof resp);
++#else
++					&resp.ibv_resp, sizeof resp);
++#endif
++
++        if (ret) {
++#if !(defined(__SVR4) && defined(__sun))
++                mlx4_free_buf(&buf);
+ 		goto out;
+ 	}
+ 
+ 	mlx4_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
++        mlx4_free_buf(&cq->buf);
++        cq->buf = buf;
++#else
++		goto out;
++	}
++        if (cq->buf.buf != NULL) {
++        	buf.buf = malloc(cq->buf.length);
++        	if (!buf.buf) {
++                	ret = ENOMEM;
++                	goto out;
++        	}
+ 
+-	mlx4_free_buf(&cq->buf);
+-	cq->buf = buf;
++        	memcpy(buf.buf, cq->buf.buf, cq->buf.length);
++        	buf.length =  cq->buf.length;
++                ret = munmap((char *)cq->buf.buf, cq->buf.length);
++                if (ret) {
++                        free(buf.buf);
++                        goto out;
++                }
++        }
++	/*
++	 * For Solaris the kernel driver passes back mmap information for
++	 * mapping the CQ memory it allocated.
++	 */
++	if (resp.mdd.mcq_rev < MLNX_UMAP_IF_VERSION) {
++		fprintf(stderr, PFX "libmlx4_resize_cq: libmlx4/hermon umap "
++		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mcq_rev);
++		ret = EINVAL;
++		goto out;
++	}
+ 
++	cqbuf = mmap64((void *)0, resp.mdd.mcq_maplen, (PROT_READ | PROT_WRITE),
++	     MAP_SHARED, ibcq->context->mmap_fd, resp.mdd.mcq_mapoffset);
++
++	if (cqbuf == MAP_FAILED) {
++		ret = EINVAL;
++		goto out;
++	}
++	cq->buf.buf    = buf.buf;
++	cq->buf.length = buf.length;
++	mlx4_cq_resize_copy_cqes(cq, cqbuf, old_cqe);
++	cq->buf.buf    = cqbuf;
++	cq->buf.length = resp.mdd.mcq_maplen;
++	free(buf.buf);
++	cq->ibv_cq.cqe =  resp.mdd.mcq_numcqe - 1;
++	cq->cqn        = resp.mdd.mcq_cqnum;
++#endif
+ out:
+ 	pthread_spin_unlock(&cq->lock);
+ 	return ret;
+@@ -311,6 +452,9 @@
+ 		return ret;
+ 
+ 	mlx4_free_db(to_mctx(cq->context), MLX4_DB_TYPE_CQ, to_mcq(cq)->set_ci_db);
++#if defined(__SVR4) && defined(__sun)
++	mlx4_free_db(to_mctx(cq->context), MLX4_DB_TYPE_CQ, to_mcq(cq)->arm_db);
++#endif
+ 	mlx4_free_buf(&to_mcq(cq)->buf);
+ 	free(to_mcq(cq));
+ 
+@@ -324,6 +468,9 @@
+ 	struct mlx4_create_srq_resp resp;
+ 	struct mlx4_srq		   *srq;
+ 	int			    ret;
++#if defined(__SVR4) && defined(__sun)
++	void                       *srqbuf;
++#endif
+ 
+ 	/* Sanity check SRQ size before proceeding */
+ 	if (attr->attr.max_wr > 1 << 16 || attr->attr.max_sge > 64)
+@@ -336,6 +483,7 @@
+ 	if (pthread_spin_init(&srq->lock, PTHREAD_PROCESS_PRIVATE))
+ 		goto err;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	srq->max     = align_queue_size(attr->attr.max_wr + 1);
+ 	srq->max_gs  = attr->attr.max_sge;
+ 	srq->counter = 0;
+@@ -352,21 +500,117 @@
+ 
+ 	cmd.buf_addr = (uintptr_t) srq->buf.buf;
+ 	cmd.db_addr  = (uintptr_t) srq->db;
++#else
++	/*
++	 * Solaris SRQ WQE memory is supplied by the kernel; we'll update
++	 * these after the creation.
++	 */
++	srq->buf.buf      = NULL;
++	srq->buf.length   = 0;
++	srq->db           = NULL;
++	srq->ext_srq	  = 0;
++
++	/*
++	 * Need solaris to allocate space for the spare WR in
++	 * the list that makes the queue work. The Solaris driver
++	 * will round up to the nearest power of 2 as align_queue_size()
++	 * does for OFED.
++	 */
++	attr->attr.max_wr += 1;
++#endif
+ 
+ 	ret = ibv_cmd_create_srq(pd, &srq->verbs_srq.srq, attr,
+ 				 &cmd.ibv_cmd, sizeof cmd,
+ 				 &resp.ibv_resp, sizeof resp);
++#if defined(__SVR4) && defined(__sun)
++	if (ret) {
++		goto err;
++	}
++
++        /*
++         * The kernel driver passes back mmap information for mapping the
++         * SRQ work queue memory it allocated and the doorbell for
++	 * for posting.
++         */
++	if (resp.mdd.msrq_rev < 1) {
++		fprintf(stderr, PFX "libmlx4_create_srq libmlx4/hermon umap "
++			"rev mismatch (kernel rev=%d)\n", resp.mdd.msrq_rev);
++		goto err_destroy;
++	}
++
++        srqbuf = mmap64((void *)0, resp.mdd.msrq_maplen,
++	    (PROT_READ | PROT_WRITE), MAP_SHARED, pd->context->mmap_fd,
++	    resp.mdd.msrq_mapoffset);
++
++        if (srqbuf == MAP_FAILED) {
++                goto err_destroy;
++        }
++
++	srq->buf.buf    = srqbuf;
++	srq->buf.length = resp.mdd.msrq_maplen;
++	srq->max	= resp.ibv_resp.max_wr;
++	srq->max_gs	= resp.ibv_resp.max_sge;
++	srq->srqn       = resp.mdd.msrq_srqnum;
++	srq->counter 	= 0;
++
++	srq->db = mlx4_alloc_db(to_mctx(pd->context),
++	    resp.mdd.msrq_rdbr_mapoffset, resp.mdd.msrq_rdbr_maplen,
++	    resp.mdd.msrq_rdbr_offset);
++	if (srq->db == NULL) {
++                goto err_unmap;
++	}
++
++	/*
++	 * The following call only initializes memory and control structures,
++	 * it utilizes the memory allocated by the kernel.
++	 * It also allocates the srq->wrid memory.
++	 */
++	if (mlx4_set_srq_buf(pd, srq, resp.mdd.msrq_wqesz,
++	    resp.mdd.msrq_numwqe)) {
++		goto err_db;
++	}
++
++	/*
++	 * The rturned max wr will have been rounded up to the nearest
++	 * power of 2, subtracting  1 from that and rporting that value
++	 * as the max will give us the required free WR in the queue, as
++	 * in OFED.
++	 */
++	attr->attr.max_wr -= 1;
++#else
+ 	if (ret)
+ 		goto err_db;
+ 
++#endif
+ 	return &srq->verbs_srq.srq;
+ 
+ err_db:
+ 	mlx4_free_db(to_mctx(pd->context), MLX4_DB_TYPE_RQ, srq->db);
+ 
++#if defined(__SVR4) && defined(__sun)
++	if (srq->wrid)
++		free(srq->wrid);
++err_unmap:
++	mlx4_free_buf(&srq->buf);
++
++err_destroy:
++	/*
++	 * Calling ibv_cmd_destroy_srq() will try and take the ibv_srq
++	 * mutext that is initialised by the ibv_create_srq() entry point
++	 * that called us AFETR we return, so its not initialised yet.
++	 * So initialised it here so the destroy call doesn't hang.
++	 */
++	pthread_mutex_init(&(srq->verbs_srq.srq.mutex), NULL);
++	pthread_cond_init(&(srq->verbs_srq.srq.cond), NULL);
++	srq->verbs_srq.srq.events_completed = 0;
++
++	ibv_cmd_destroy_srq(&srq->verbs_srq.srq);
++
++#else
+ err_free:
+ 	free(srq->wrid);
+ 	mlx4_free_buf(&srq->buf);
++#endif
+ 
+ err:
+ 	free(srq);
+@@ -392,7 +636,16 @@
+ {
+ 	struct ibv_modify_srq cmd;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
++#else
++	int	ret;
++
++	attr->max_wr += 1;		/* See create_srq */
++	ret = ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
++	attr->max_wr -= 1;
++	return (ret);
++#endif
+ }
+ 
+ int mlx4_query_srq(struct ibv_srq *srq,
+@@ -400,7 +653,17 @@
+ {
+ 	struct ibv_query_srq cmd;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd);
++#else
++
++	int	ret;
++
++	ret = ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd);
++	attr->max_wr -= 1;		/* See create_srq */
++
++	return (ret);
++#endif
+ }
+ 
+ int mlx4_destroy_srq(struct ibv_srq *srq)
+@@ -426,9 +689,14 @@
+ 				 struct ibv_qp_init_attr_ex *attr)
+ {
+ 	struct mlx4_create_qp     cmd;
+-	struct ibv_create_qp_resp resp;
+ 	struct mlx4_qp		 *qp;
+ 	int			  ret;
++#if !(defined(__SVR4) && defined(__sun))
++	struct ibv_create_qp_resp resp;
++#else
++	struct mlx4_create_qp_resp	resp;
++	void				*qpbuf;
++#endif
+ 
+ 	/* Sanity check QP size before proceeding */
+ 	if (attr->cap.max_send_wr     > 65536 ||
+@@ -445,6 +713,7 @@
+ 	if (attr->qp_type == IBV_QPT_XRC_RECV) {
+ 		attr->cap.max_send_wr = qp->sq.wqe_cnt = 0;
+ 	} else {
++#if !(defined(__SVR4) && defined(__sun))
+ 		mlx4_calc_sq_wqe_size(&attr->cap, attr->qp_type, qp);
+ 		/*
+ 		 * We need to leave 2 KB + 1 WQE of headroom in the SQ to
+@@ -452,19 +721,38 @@
+ 		 */
+ 		qp->sq_spare_wqes = (2048 >> qp->sq.wqe_shift) + 1;
+ 		qp->sq.wqe_cnt = align_queue_size(attr->cap.max_send_wr + qp->sq_spare_wqes);
++#endif
+ 	}
+ 
+ 	if (attr->srq || attr->qp_type == IBV_QPT_XRC_SEND ||
+ 	    attr->qp_type == IBV_QPT_XRC_RECV) {
+ 		attr->cap.max_recv_wr = qp->rq.wqe_cnt = attr->cap.max_recv_sge = 0;
+ 	} else {
++#if !(defined(__SVR4) && defined(__sun))
+ 		qp->rq.wqe_cnt = align_queue_size(attr->cap.max_recv_wr);
++#endif
+ 		if (attr->cap.max_recv_sge < 1)
+ 			attr->cap.max_recv_sge = 1;
+ 		if (attr->cap.max_recv_wr < 1)
+ 			attr->cap.max_recv_wr = 1;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) ||
++	    pthread_spin_init(&qp->rq.lock, PTHREAD_PROCESS_PRIVATE))
++		goto err;
++
++	/*
++	 * Solaris QP work queue memory is supplied by the kernel, so
++	 * we will update this after creation.
++	 */
++	qp->buf.buf	= NULL;
++	qp->sq.wrid	= NULL;
++	qp->rq.wrid	= NULL;
++	qp->buf.length	= 0;
++	qp->db		= NULL;
++	memset(&cmd, 0, sizeof(cmd));
++#else
+ 	if (mlx4_alloc_qp_buf(context, &attr->cap, attr->qp_type, qp))
+ 		goto err;
+ 
+@@ -493,12 +781,15 @@
+ 		; /* nothing */
+ 	cmd.sq_no_prefetch = 0;	/* OK for ABI 2: just a reserved field */
+ 	memset(cmd.reserved, 0, sizeof cmd.reserved);
++#endif
+ 
+ 	pthread_mutex_lock(&to_mctx(context)->qp_table_mutex);
+ 
+ 	ret = ibv_cmd_create_qp_ex(context, &qp->verbs_qp,
+-				   sizeof(qp->verbs_qp), attr,
+-				   &cmd.ibv_cmd, sizeof cmd, &resp, sizeof resp);
++				sizeof(qp->verbs_qp), attr,
++				&cmd.ibv_cmd, sizeof cmd,
++#if !(defined(__SVR4) && defined(__sun))
++				&resp, sizeof resp);
+ 	if (ret)
+ 		goto err_rq_db;
+ 
+@@ -507,6 +798,70 @@
+ 		if (ret)
+ 			goto err_destroy;
+ 	}
++#else
++				&resp.ibv_resp, sizeof resp);
++	if (ret)
++		goto err_free;
++
++        /*
++         * The kernel driver passes back mmap information for mapping the
++         * QP work queue memory it allocated back into user space.
++         */
++	if (resp.mdd.mqp_rev < 2) {
++		fprintf(stderr, PFX "libmlx4_create_qp: libmlx4/hermon umap "
++		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mqp_rev);
++		goto err_destroy;
++	}
++	qpbuf = mmap64((void *)0, resp.mdd.mqp_maplen, (PROT_READ | PROT_WRITE),
++	    MAP_SHARED, context->mmap_fd, resp.mdd.mqp_mapoffset);
++
++	if (qpbuf == MAP_FAILED)
++		goto err_destroy;
++
++	/*
++	 * Need to set qp->buf here in case alloc_db fails then
++	 * we'll call mlx4_free_buf() to umap.
++	 */
++	qp->buf.buf	= qpbuf;
++	qp->buf.length	= resp.mdd.mqp_maplen;
++
++	if (attr->cap.max_recv_sge) {
++		qp->db = mlx4_alloc_db(to_mctx(context),
++		    resp.mdd.mqp_rdbr_mapoffset, resp.mdd.mqp_rdbr_maplen,
++		    resp.mdd.mqp_rdbr_offset);
++		if (qp->db == NULL)
++			goto err_buf;
++
++		*qp->db = 0;
++	}
++
++	/*
++	 * Retrieve sendqueue actual size, and the number of headroom WQEs
++	 * that were required based on kernel setup of prefetch or not for
++	 * send queue.
++	 * 	Note: mqp_sq_numwqe includes the head room wqes. The private
++	 *	      wqe.cnt also includes headroom wqes, the verbs count
++	 *	      should reflect the wqe count that is usable.
++	 */
++	qp->sq_spare_wqes = resp.mdd.mqp_sq_headroomwqes;
++	qp->sq.wqe_cnt    = resp.mdd.mqp_sq_numwqe;
++
++	if (attr->srq)
++		qp->rq.wqe_cnt  = 0;
++	else
++		qp->rq.wqe_cnt  = resp.mdd.mqp_rq_numwqe;
++
++	if (mlx4_set_qp_buf(attr->pd, qp, qpbuf, resp.mdd.mqp_maplen,
++	    resp.mdd.mqp_rq_wqesz, resp.mdd.mqp_rq_off,
++	    resp.mdd.mqp_sq_wqesz, resp.mdd.mqp_sq_off))
++		goto err_rq_db;
++
++	mlx4_init_qp_indices(qp);
++
++	ret = mlx4_store_qp(to_mctx(context), qp->verbs_qp.qp.qp_num, qp);
++	if (ret)
++		goto err_rq_db;
++#endif
+ 	pthread_mutex_unlock(&to_mctx(context)->qp_table_mutex);
+ 
+ 	qp->rq.wqe_cnt = qp->rq.max_post = attr->cap.max_recv_wr;
+@@ -522,6 +877,35 @@
+ 
+ 	return &qp->verbs_qp.qp;
+ 
++#if defined(__SVR4) && defined(__sun)
++err_rq_db:
++	if (attr->cap.max_recv_sge)
++		mlx4_free_db(to_mctx(context), MLX4_DB_TYPE_RQ, qp->db);
++err_buf:
++	mlx4_free_buf(&qp->buf);
++
++err_destroy:
++	/*
++	 * Calling ibv_cmd_destroy_qp() will try and take the ibv_qp
++	 * mutext that is initialised by the ibv_create_qp() entry point
++	 * that called us AFETR we retrun, so its not initialised yet.
++	 * So initialised it here so the destroy call doesn't hang.
++	 */
++	pthread_mutex_init(&(qp->verbs_qp.qp.mutex), NULL);
++	pthread_cond_init(&(qp->verbs_qp.qp.cond), NULL);
++	qp->verbs_qp.qp.events_completed = 0;
++	ibv_cmd_destroy_qp(&qp->verbs_qp.qp);
++err_free:
++	pthread_mutex_unlock(&to_mctx(context)->qp_table_mutex);
++
++	if (qp->sq.wrid)
++		free(qp->sq.wrid);
++
++	if (qp->rq.wrid)
++		free(qp->rq.wrid);
++err:
++	free(qp);
++#else
+ err_destroy:
+ 	ibv_cmd_destroy_qp(&qp->verbs_qp.qp);
+ 
+@@ -538,6 +922,7 @@
+ 
+ err:
+ 	free(qp);
++#endif
+ 
+ 	return NULL;
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/patches/002-libmlx4-shpd_fmr.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,174 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  cb9a51f3fdf99efd32b1dbadb44a974593c50163
+
+diff -r cb9a51f3fdf9 src/mlx4-abi.h
+--- a/src/mlx4-abi.h	Fri Nov 13 00:56:50 2015 -0800
++++ b/src/mlx4-abi.h	Fri Nov 13 00:58:16 2015 -0800
+@@ -78,6 +78,12 @@
+ 	__u32				reserved;
+ };
+ 
++struct mlx4_share_pd_resp {
++	struct ibv_share_pd_resp	ibv_resp;
++	__u32				pdn;
++	__u32				reserved;
++};
++
+ struct mlx4_create_cq {
+ 	struct ibv_create_cq		ibv_cmd;
+ #if !(defined(__SVR4) && defined(__sun))
+diff -r cb9a51f3fdf9 src/mlx4.c
+--- a/src/mlx4.c	Fri Nov 13 00:56:50 2015 -0800
++++ b/src/mlx4.c	Fri Nov 13 00:58:16 2015 -0800
+@@ -91,8 +91,13 @@
+ 	.query_port    = mlx4_query_port,
+ 	.alloc_pd      = mlx4_alloc_pd,
+ 	.dealloc_pd    = mlx4_free_pd,
++	.alloc_shpd    = mlx4_alloc_shpd,
++	.share_pd      = mlx4_share_pd,
+ 	.reg_mr	       = mlx4_reg_mr,
++	.reg_mr_relaxed	       = mlx4_reg_mr_relaxed,
+ 	.dereg_mr      = mlx4_dereg_mr,
++	.dereg_mr_relaxed      = mlx4_dereg_mr_relaxed,
++	.flush_relaxed_mr      = mlx4_flush_relaxed_mr,
+ 	.create_cq     = mlx4_create_cq,
+ 	.poll_cq       = mlx4_poll_cq,
+ 	.req_notify_cq = mlx4_arm_cq,
+diff -r cb9a51f3fdf9 src/mlx4.h
+--- a/src/mlx4.h	Fri Nov 13 00:56:50 2015 -0800
++++ b/src/mlx4.h	Fri Nov 13 00:58:16 2015 -0800
+@@ -366,6 +366,8 @@
+ 		     struct ibv_port_attr *attr);
+ 
+ struct ibv_pd *mlx4_alloc_pd(struct ibv_context *context);
++struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
++struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
+ int mlx4_free_pd(struct ibv_pd *pd);
+ struct ibv_xrcd *mlx4_open_xrcd(struct ibv_context *context,
+ 				struct ibv_xrcd_init_attr *attr);
+@@ -373,7 +375,11 @@
+ 
+ struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
+ 			    size_t length, int access);
++struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
++			    size_t length, int access);
+ int mlx4_dereg_mr(struct ibv_mr *mr);
++int mlx4_dereg_mr_relaxed(struct ibv_mr *mr);
++int mlx4_flush_relaxed_mr(struct ibv_pd *pd);
+ 
+ struct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe,
+ 			       struct ibv_comp_channel *channel,
+diff -r cb9a51f3fdf9 src/verbs.c
+--- a/src/verbs.c	Fri Nov 13 00:56:50 2015 -0800
++++ b/src/verbs.c	Fri Nov 13 00:58:16 2015 -0800
+@@ -103,6 +103,39 @@
+ 	return &pd->ibv_pd;
+ }
+ 
++struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
++{
++	struct ibv_alloc_shpd cmd;
++	struct ibv_alloc_shpd_resp resp;
++
++	if (ibv_cmd_alloc_shpd(pd->context, pd, share_key, shpd, &cmd, sizeof cmd,
++			     &resp, sizeof resp)) {
++		return NULL;
++	}
++
++	return shpd;
++}
++
++
++struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
++{
++	struct ibv_share_pd       cmd;
++	struct mlx4_share_pd_resp resp;
++	struct mlx4_pd		 *pd;
++
++	pd = malloc(sizeof *pd);
++	if (!pd)
++		return NULL;
++
++	if (ibv_cmd_share_pd(context, shpd, share_key, &pd->ibv_pd, &cmd, sizeof cmd,
++			     &resp.ibv_resp, sizeof resp)) {
++		free(pd);
++		return NULL;
++	}
++	pd->pdn = resp.pdn;
++	return &pd->ibv_pd;
++}
++
+ int mlx4_free_pd(struct ibv_pd *pd)
+ {
+ 	int ret;
+@@ -174,6 +207,37 @@
+ 	return mr;
+ }
+ 
++struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
++			   int access)
++{
++	struct ibv_mr *mr;
++	struct ibv_reg_mr cmd;
++	int ret;
++
++	mr = malloc(sizeof *mr);
++	if (!mr)
++		return NULL;
++
++#ifdef IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
++	{
++		struct ibv_reg_mr_resp resp;
++
++		ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr,
++				     access, mr, &cmd, sizeof cmd,
++				     &resp, sizeof resp);
++	}
++#else
++	ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr, access, mr,
++			     &cmd, sizeof cmd);
++#endif
++	if (ret) {
++		free(mr);
++		return NULL;
++	}
++
++	return mr;
++}
++
+ int mlx4_dereg_mr(struct ibv_mr *mr)
+ {
+ 	int ret;
+@@ -186,6 +250,29 @@
+ 	return 0;
+ }
+ 
++int mlx4_dereg_mr_relaxed(struct ibv_mr *mr)
++{
++	int ret;
++
++	ret = ibv_cmd_dereg_mr_relaxed(mr);
++	if (ret)
++		return ret;
++
++	free(mr);
++	return 0;
++}
++
++int mlx4_flush_relaxed_mr(struct ibv_pd *pd)
++{
++	int ret;
++
++	ret = ibv_cmd_flush_relaxed_mr(pd);
++	if (ret)
++		return ret;
++
++	return 0;
++}
++
+ int align_queue_size(int req)
+ {
+ 	int nent;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/patches/003-libmlx4-uek-shpd-fmr-merge.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,55 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  feb9bdbadf6c3ec5d4c5c98487f14d9c894076eb
+
+diff -r feb9bdbadf6c src/mlx4.c
+--- a/src/mlx4.c	Thu Nov 19 10:26:02 2015 -0800
++++ b/src/mlx4.c	Thu Nov 19 14:04:18 2015 -0800
+@@ -90,9 +90,9 @@
+ 	.query_device  = mlx4_query_device,
+ 	.query_port    = mlx4_query_port,
+ 	.alloc_pd      = mlx4_alloc_pd,
+-	.dealloc_pd    = mlx4_free_pd,
+ 	.alloc_shpd    = mlx4_alloc_shpd,
+ 	.share_pd      = mlx4_share_pd,
++	.dealloc_pd    = mlx4_free_pd,
+ 	.reg_mr	       = mlx4_reg_mr,
+ 	.reg_mr_relaxed	       = mlx4_reg_mr_relaxed,
+ 	.dereg_mr      = mlx4_dereg_mr,
+diff -r feb9bdbadf6c src/mlx4.h
+--- a/src/mlx4.h	Thu Nov 19 10:26:02 2015 -0800
++++ b/src/mlx4.h	Thu Nov 19 14:04:18 2015 -0800
+@@ -374,9 +374,9 @@
+ int mlx4_close_xrcd(struct ibv_xrcd *xrcd);
+ 
+ struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
+-			    size_t length, int access);
++			   size_t length, int access);
+ struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
+-			    size_t length, int access);
++				   size_t length, enum ibv_access_flags access);
+ int mlx4_dereg_mr(struct ibv_mr *mr);
+ int mlx4_dereg_mr_relaxed(struct ibv_mr *mr);
+ int mlx4_flush_relaxed_mr(struct ibv_pd *pd);
+diff -r feb9bdbadf6c src/verbs.c
+--- a/src/verbs.c	Thu Nov 19 10:26:02 2015 -0800
++++ b/src/verbs.c	Thu Nov 19 14:04:18 2015 -0800
+@@ -208,7 +208,7 @@
+ }
+ 
+ struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
+-			   int access)
++			   enum ibv_access_flags access)
+ {
+ 	struct ibv_mr *mr;
+ 	struct ibv_reg_mr cmd;
+@@ -437,6 +437,7 @@
+ 	struct mlx4_resize_cq_resp	resp;
+ 	void				*cqbuf;
+ #endif
++
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 0x3fffff)
+ 		return EINVAL;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/patches/004-libmlx4-remove-xrc.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,115 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  56ebd417e6ed24cfa11c23bd564417ec7d2e5812
+Disable xrc routines in libmlx4
+
+diff -r 56ebd417e6ed src/srq.c
+--- a/src/srq.c	Wed Dec 02 15:27:52 2015 -0800
++++ b/src/srq.c	Wed Dec 02 15:47:02 2015 -0800
+@@ -286,6 +286,13 @@
+ struct ibv_srq *mlx4_create_xrc_srq(struct ibv_context *context,
+ 				    struct ibv_srq_init_attr_ex *attr_ex)
+ {
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Not supported by Solaris kernel driver.  When/if supported
++	 * this routine will need to be ported.
++	 */
++	return NULL;
++#else
+ 	struct mlx4_create_xsrq cmd;
+ 	struct mlx4_create_srq_resp resp;
+ 	struct mlx4_srq *srq;
+@@ -362,10 +369,18 @@
+ err:
+ 	free(srq);
+ 	return NULL;
++#endif
+ }
+ 
+ int mlx4_destroy_xrc_srq(struct ibv_srq *srq)
+ {
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * Not supported by Solaris kernel driver.  When/if supported
++         * this routine will need to be ported.
++         */
++        return NULL;
++#else
+ 	struct mlx4_context *mctx = to_mctx(srq->context);
+ 	struct mlx4_srq *msrq = to_msrq(srq);
+ 	struct mlx4_cq *mcq;
+@@ -391,4 +406,5 @@
+ 	free(msrq);
+ 
+ 	return 0;
++#endif
+ }
+diff -r 56ebd417e6ed src/verbs.c
+--- a/src/verbs.c	Wed Dec 02 15:27:52 2015 -0800
++++ b/src/verbs.c	Wed Dec 02 15:47:02 2015 -0800
+@@ -151,6 +151,13 @@
+ struct ibv_xrcd *mlx4_open_xrcd(struct ibv_context *context,
+ 				struct ibv_xrcd_init_attr *attr)
+ {
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * Not supported by Solaris kernel driver.  When/if supported
++         * this routine will need to be ported.
++         */
++        return NULL;
++#else
+ 	struct ibv_open_xrcd cmd;
+ 	struct ibv_open_xrcd_resp resp;
+ 	struct verbs_xrcd *xrcd;
+@@ -170,10 +177,18 @@
+ err:
+ 	free(xrcd);
+ 	return NULL;
++#endif
+ }
+ 
+ int mlx4_close_xrcd(struct ibv_xrcd *ib_xrcd)
+ {
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * Not supported by Solaris kernel driver.  When/if supported
++         * this routine will need to be ported.
++         */
++        return NULL;
++#else
+ 	struct verbs_xrcd *xrcd = container_of(ib_xrcd, struct verbs_xrcd, xrcd);
+ 	int ret;
+ 
+@@ -182,6 +197,7 @@
+ 		free(xrcd);
+ 
+ 	return ret;
++#endif
+ }
+ 
+ struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
+@@ -1031,6 +1047,13 @@
+ 
+ struct ibv_qp *mlx4_open_qp(struct ibv_context *context, struct ibv_qp_open_attr *attr)
+ {
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * Not supported by Solaris kernel driver.  When/if supported
++         * this routine will need to be ported.
++         */
++        return NULL;
++#else
+ 	struct ibv_open_qp cmd;
+ 	struct ibv_create_qp_resp resp;
+ 	struct mlx4_qp *qp;
+@@ -1050,6 +1073,7 @@
+ err:
+ 	free(qp);
+ 	return NULL;
++#endif
+ }
+ 
+ int mlx4_query_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
--- a/components/open-fabrics/libmlx4/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1518 +0,0 @@
-#This patch was developed in-house. We plan to submit it upstream, but do
-# not yet have a target date for doing so
-#
-diff -r -u /tmp/839450/libmlx4-1.0.1/Makefile.am libmlx4-1.0.1/Makefile.am
---- /tmp/839450/libmlx4-1.0.1/Makefile.am	Tue Sep  8 06:40:35 2009
-+++ libmlx4-1.0.1/Makefile.am	Tue Mar 15 06:49:47 2011
-@@ -10,7 +10,7 @@
-     src_libmlx4_la_SOURCES = $(MLX4_SOURCES)
-     src_libmlx4_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
-         $(mlx4_version_script)
--    mlx4confdir = $(sysconfdir)/libibverbs.d
-+    mlx4confdir = $(datadir)/libibverbs.d
-     mlx4conf_DATA = mlx4.driver
- else
-     mlx4libdir = $(libdir)/infiniband
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/mlx4-abi.h libmlx4-1.0.1/src/mlx4-abi.h
---- /tmp/839450/libmlx4-1.0.1/src/mlx4-abi.h	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/mlx4-abi.h	Fri Feb 11 03:49:51 2011
-@@ -35,6 +35,10 @@
- 
- #include <infiniband/kern-abi.h>
- 
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/ib/adapters/mlnx_umap.h>   / * Opaque CI data out definitions * /
-+#endif
-+
- #define MLX4_UVERBS_MIN_ABI_VERSION	2
- #define MLX4_UVERBS_MAX_ABI_VERSION	3
- 
-@@ -43,6 +47,10 @@
- 	__u32				qp_tab_size;
- 	__u16				bf_reg_size;
- 	__u16				bf_regs_per_page;
-+#if defined(__SVR4) && defined(__sun)
-+	uint32_t			muc_rev;
-+	uint32_t			muc_reserved;
-+#endif
- };
- 
- struct mlx4_alloc_pd_resp {
-@@ -51,23 +59,45 @@
- 	__u32				reserved;
- };
- 
-+struct mlx4_share_pd_resp {
-+	struct ibv_share_pd_resp	ibv_resp;
-+	__u32				pdn;
-+	__u32				reserved;
-+};
-+
- struct mlx4_create_cq {
- 	struct ibv_create_cq		ibv_cmd;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u64				buf_addr;
- 	__u64				db_addr;
-+#endif
- };
- 
- struct mlx4_create_cq_resp {
- 	struct ibv_create_cq_resp	ibv_resp;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u32				cqn;
- 	__u32				reserved;
-+#else
-+	mlnx_umap_cq_data_out_t		mdd;
-+#endif
- };
- 
- struct mlx4_resize_cq {
- 	struct ibv_resize_cq		ibv_cmd;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u64				buf_addr;
-+#endif
- };
- 
-+#if defined(__SVR4) && defined(__sun)
-+struct mlx4_resize_cq_resp {
-+	struct ibv_resize_cq_resp	ibv_resp;
-+	mlnx_umap_cq_data_out_t		mdd;
-+};
-+#endif
-+
-+
- #ifdef HAVE_IBV_XRC_OPS
- struct mlx4_create_xrc_srq {
- 	struct ibv_create_xrc_srq	ibv_cmd;
-@@ -78,18 +108,25 @@
- 
- struct mlx4_create_srq {
- 	struct ibv_create_srq		ibv_cmd;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u64				buf_addr;
- 	__u64				db_addr;
-+#endif
- };
- 
- struct mlx4_create_srq_resp {
- 	struct ibv_create_srq_resp	ibv_resp;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u32				srqn;
- 	__u32				reserved;
-+#else
-+	mlnx_umap_srq_data_out_t	mdd;
-+#endif
- };
- 
- struct mlx4_create_qp {
- 	struct ibv_create_qp		ibv_cmd;
-+#if !(defined(__SVR4) && defined(__sun))
- 	__u64				buf_addr;
- 	__u64				db_addr;
- 	__u8				log_sq_bb_count;
-@@ -96,8 +133,16 @@
- 	__u8				log_sq_stride;
- 	__u8				sq_no_prefetch;	/* was reserved in ABI 2 */
- 	__u8				reserved[5];
-+#endif
- };
- 
-+#if defined(__SVR4) && defined(__sun)
-+struct mlx4_create_qp_resp {
-+	struct ibv_create_qp_resp	ibv_resp;
-+	mlnx_umap_qp_data_out_t		mdd;
-+};
-+#endif
-+
- #ifdef HAVE_IBV_XRC_OPS
- struct mlx4_open_xrc_domain_resp {
- 	struct ibv_open_xrc_domain_resp	ibv_resp;
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/verbs.c libmlx4-1.0.1/src/verbs.c
---- /tmp/839450/libmlx4-1.0.1/src/verbs.c	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/verbs.c	Fri Mar 11 14:40:18 2011
-@@ -56,6 +56,14 @@
- 	if (ret)
- 		return ret;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	/*
-+	 * To be consistent with OFED and so the queue operations in srq.c work
-+	 * we need to report the max as actual max  less 1. In OFED this is
-+	 * done in the HCA driver.
-+	 */
-+	attr->max_srq_wr -=1;
-+#endif
- 	major     = (raw_fw_ver >> 32) & 0xffff;
- 	minor     = (raw_fw_ver >> 16) & 0xffff;
- 	sub_minor = raw_fw_ver & 0xffff;
-@@ -95,6 +103,39 @@
- 	return &pd->ibv_pd;
- }
- 
-+struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd)
-+{
-+	struct ibv_alloc_shpd cmd;
-+	struct ibv_alloc_shpd_resp resp;
-+
-+	if (ibv_cmd_alloc_shpd(pd->context, pd, share_key, shpd, &cmd, sizeof cmd,
-+			     &resp, sizeof resp)) {
-+		return NULL;
-+	}
-+
-+	return shpd;
-+}
-+
-+
-+struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key)
-+{
-+	struct ibv_share_pd       cmd;
-+	struct mlx4_share_pd_resp resp;
-+	struct mlx4_pd		 *pd;
-+
-+	pd = malloc(sizeof *pd);
-+	if (!pd)
-+		return NULL;
-+
-+	if (ibv_cmd_share_pd(context, shpd, share_key, &pd->ibv_pd, &cmd, sizeof cmd,
-+			     &resp.ibv_resp, sizeof resp)) {
-+		free(pd);
-+		return NULL;
-+	}
-+	pd->pdn = resp.pdn;
-+	return &pd->ibv_pd;
-+}
-+
- int mlx4_free_pd(struct ibv_pd *pd)
- {
- 	int ret;
-@@ -138,6 +179,37 @@
- 	return mr;
- }
- 
-+struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr, size_t length,
-+			   int access)
-+{
-+	struct ibv_mr *mr;
-+	struct ibv_reg_mr cmd;
-+	int ret;
-+
-+	mr = malloc(sizeof *mr);
-+	if (!mr)
-+		return NULL;
-+
-+#ifdef IBV_CMD_REG_MR_RELAXED_HAS_RESP_PARAMS
-+	{
-+		struct ibv_reg_mr_resp resp;
-+
-+		ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr,
-+				     access, mr, &cmd, sizeof cmd,
-+				     &resp, sizeof resp);
-+	}
-+#else
-+	ret = ibv_cmd_reg_mr_relaxed(pd, addr, length, (uintptr_t) addr, access, mr,
-+			     &cmd, sizeof cmd);
-+#endif
-+	if (ret) {
-+		free(mr);
-+		return NULL;
-+	}
-+
-+	return mr;
-+}
-+
- int mlx4_dereg_mr(struct ibv_mr *mr)
- {
- 	int ret;
-@@ -150,6 +222,29 @@
- 	return 0;
- }
- 
-+int mlx4_dereg_mr_relaxed(struct ibv_mr *mr)
-+{
-+	int ret;
-+
-+	ret = ibv_cmd_dereg_mr_relaxed(mr);
-+	if (ret)
-+		return ret;
-+
-+	free(mr);
-+	return 0;
-+}
-+
-+int mlx4_flush_relaxed_mr(struct ibv_pd *pd)
-+{
-+	int ret;
-+
-+	ret = ibv_cmd_flush_relaxed_mr(pd);
-+	if (ret)
-+		return ret;
-+
-+	return 0;
-+}
-+
- static int align_queue_size(int req)
- {
- 	int nent;
-@@ -168,6 +263,9 @@
- 	struct mlx4_create_cq_resp resp;
- 	struct mlx4_cq		  *cq;
- 	int			   ret;
-+#if defined(__SVR4) && defined(__sun)
-+	void                      *cqbuf;
-+#endif
- 
- 	/* Sanity check CQ size before proceeding */
- 	if (cqe > 0x3fffff)
-@@ -184,7 +282,8 @@
- 
- 	cqe = align_queue_size(cqe + 1);
- 
--	if (mlx4_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe))
-+#if !(defined(__SVR4) && defined(__sun))
-+	if (mlx4_alloc_cq_buf((to_mdev(context->device), &cq->buf, cqe))
- 		goto err;
- 
- 	cq->set_ci_db  = mlx4_alloc_db(to_mctx(context), MLX4_DB_TYPE_CQ);
-@@ -198,15 +297,73 @@
- 
- 	cmd.buf_addr = (uintptr_t) cq->buf.buf;
- 	cmd.db_addr  = (uintptr_t) cq->set_ci_db;
-+#else
-+	cq->buf.buf    = NULL;
-+	cq->buf.length = 0;
-+	cq->arm_db     = NULL;
-+	cq->set_ci_db  = NULL;
-+#endif
- 
- 	ret = ibv_cmd_create_cq(context, cqe - 1, channel, comp_vector,
- 				&cq->ibv_cq, &cmd.ibv_cmd, sizeof cmd,
- 				&resp.ibv_resp, sizeof resp);
- 	if (ret)
-+#if !(defined(__SVR4) && defined(__sun))
- 		goto err_db;
--
- 	cq->cqn = resp.cqn;
-+#else
-+		goto err;
- 
-+        /*
-+         * For Solaris the kernel driver passes back mmap information for
-+	 *  mapping the CQ memory it allocated.
-+         */
-+	if (resp.mdd.mcq_rev < MLNX_UMAP_IF_VERSION) {
-+		fprintf(stderr, PFX "libmlx4_create_cq: libmlx4/hermon umap "
-+		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mcq_rev);
-+		goto err_destroy;
-+	}
-+
-+        cqbuf = mmap64((void *)0, resp.mdd.mcq_maplen, (PROT_READ | PROT_WRITE),
-+	    MAP_SHARED, context->mmap_fd, resp.mdd.mcq_mapoffset);
-+
-+        if (cqbuf == MAP_FAILED)
-+                goto err_destroy;
-+
-+        /*
-+         * Extract hardware driver values for the number of CQEs and the
-+	 * hardware CQ number to use (needed for user space doorbells).
-+         */
-+	cqe            = resp.mdd.mcq_numcqe;
-+	cq->cqn        = resp.mdd.mcq_cqnum;
-+	cq->buf.buf    = cqbuf;
-+	cq->buf.length = resp.mdd.mcq_maplen;
-+	cq->ibv_cq.cqe = cqe-1;
-+
-+	/*
-+	 * We map both poll and arm as seperate doorbells (OFED assumes 1 word
-+	 * offset and just bumps the address) since Solaris provides a
-+	 * separate offst. This will amount to the same thing (a second
-+	 * reference to the first doorbell is added) but is more flexible.
-+	 */
-+	cq->set_ci_db = mlx4_alloc_db(to_mctx(context),
-+	    resp.mdd.mcq_polldbr_mapoffset, resp.mdd.mcq_polldbr_maplen,
-+	    resp.mdd.mcq_polldbr_offset);
-+
-+        if (cq->set_ci_db == NULL)
-+                goto err_buf;
-+
-+	cq->arm_db = mlx4_alloc_db(to_mctx(context),
-+	    resp.mdd.mcq_armdbr_mapoffset, resp.mdd.mcq_armdbr_maplen,
-+	    resp.mdd.mcq_armdbr_offset);
-+
-+        if (cq->arm_db == NULL)
-+                goto err_db;
-+
-+	*cq->arm_db    = 0;
-+	cq->arm_sn     = 1;
-+	*cq->set_ci_db = 0;
-+#endif
- 	return &cq->ibv_cq;
- 
- err_db:
-@@ -215,6 +372,21 @@
- err_buf:
- 	mlx4_free_buf(&cq->buf);
- 
-+#if defined(__SVR4) && defined(__sun)
-+err_destroy:
-+	/*
-+	 * Calling ibv_cmd_destroy_cq() will try and take the ibv_cq
-+	 * mutext that is initialised by the ibv_create_cq() entry point
-+	 * that called us AFETR we return, so its not initialised yet.
-+	 * So initialised it here so the destroy call doesn't hang.
-+	 */
-+	pthread_mutex_init(&(cq->ibv_cq.mutex), NULL);
-+	pthread_cond_init(&(cq->ibv_cq.cond), NULL);
-+	cq->ibv_cq.comp_events_completed = 0;
-+	cq->ibv_cq.async_events_completed = 0;
-+
-+	ibv_cmd_destroy_cq(&cq->ibv_cq);
-+#endif
- err:
- 	free(cq);
- 
-@@ -227,10 +399,15 @@
- 	struct mlx4_resize_cq cmd;
- 	struct mlx4_buf buf;
- 	int old_cqe, outst_cqe, ret;
--
-+#if !(defined(__SVR4) && defined(__sun))
-+	struct ibv_resize_cq_resp resp;
-+#else
-+	struct mlx4_resize_cq_resp	resp;
-+	void				*cqbuf;
-+#endif
- 	/* Sanity check CQ size before proceeding */
- 	if (cqe > 0x3fffff)
--		return EINVAL;
-+ 		return EINVAL;
- 
- 	pthread_spin_lock(&cq->lock);
- 
-@@ -247,32 +424,79 @@
- 		goto out;
- 	}
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	ret = mlx4_alloc_cq_buf(to_mdev(ibcq->context->device), &buf, cqe);
- 	if (ret)
- 		goto out;
--
--	old_cqe = ibcq->cqe;
- 	cmd.buf_addr = (uintptr_t) buf.buf;
-+#endif
-+        old_cqe = ibcq->cqe;
- 
- #ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS
--	{
--		struct ibv_resize_cq_resp resp;
--		ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
-+	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
-+#if !(defined(__SVR4) && defined(__sun))
- 					&resp, sizeof resp);
--	}
- #else
-+					&resp.ibv_resp, sizeof resp);
-+#endif
-+#else
- 	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd);
- #endif
--	if (ret) {
--		mlx4_free_buf(&buf);
-+
-+        if (ret) {
-+#if !(defined(__SVR4) && defined(__sun))
-+                mlx4_free_buf(&buf);
- 		goto out;
- 	}
- 
--	mlx4_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
-+        mlx4_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
-+        mlx4_free_buf(&cq->buf);
-+        cq->buf = buf;
-+#else
-+		goto out;
-+	}
-+        if (cq->buf.buf != NULL) {
-+        	buf.buf = malloc(cq->buf.length);
-+        	if (!buf.buf) {
-+                	ret = ENOMEM;
-+                	goto out;
-+        	}
- 
--	mlx4_free_buf(&cq->buf);
--	cq->buf = buf;
-+        	memcpy(buf.buf, cq->buf.buf, cq->buf.length);
-+        	buf.length =  cq->buf.length;
-+                ret = munmap((char *)cq->buf.buf, cq->buf.length);
-+                if (ret) {
-+                        free(buf.buf);
-+                        goto out;
-+                }
-+        }
-+	/*
-+	 * For Solaris the kernel driver passes back mmap information for
-+	 * mapping the CQ memory it allocated.
-+	 */
-+	if (resp.mdd.mcq_rev < MLNX_UMAP_IF_VERSION) {
-+		fprintf(stderr, PFX "libmlx4_resize_cq: libmlx4/hermon umap "
-+		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mcq_rev);
-+		ret = EINVAL;
-+		goto out;
-+	}
- 
-+	cqbuf = mmap64((void *)0, resp.mdd.mcq_maplen, (PROT_READ | PROT_WRITE),
-+	     MAP_SHARED, ibcq->context->mmap_fd, resp.mdd.mcq_mapoffset);
-+
-+	if (cqbuf == MAP_FAILED) {
-+		ret = EINVAL;
-+		goto out;
-+	}
-+	cq->buf.buf    = buf.buf;
-+	cq->buf.length = buf.length;
-+	mlx4_cq_resize_copy_cqes(cq, cqbuf, old_cqe);
-+	cq->buf.buf    = cqbuf;
-+	cq->buf.length = resp.mdd.mcq_maplen;
-+	free(buf.buf);
-+	cq->ibv_cq.cqe =  resp.mdd.mcq_numcqe - 1;
-+	cq->cqn        = resp.mdd.mcq_cqnum;
-+#endif
- out:
- 	pthread_spin_unlock(&cq->lock);
- 	return ret;
-@@ -287,6 +511,9 @@
- 		return ret;
- 
- 	mlx4_free_db(to_mctx(cq->context), MLX4_DB_TYPE_CQ, to_mcq(cq)->set_ci_db);
-+#if defined(__SVR4) && defined(__sun)
-+	mlx4_free_db(to_mctx(cq->context), MLX4_DB_TYPE_CQ, to_mcq(cq)->arm_db);
-+#endif
- 	mlx4_free_buf(&to_mcq(cq)->buf);
- 	free(to_mcq(cq));
- 
-@@ -300,6 +527,9 @@
- 	struct mlx4_create_srq_resp resp;
- 	struct mlx4_srq		   *srq;
- 	int			    ret;
-+#if defined(__SVR4) && defined(__sun)
-+	void                       *srqbuf;
-+#endif
- 
- 	/* Sanity check SRQ size before proceeding */
- 	if (attr->attr.max_wr > 1 << 16 || attr->attr.max_sge > 64)
-@@ -312,6 +542,7 @@
- 	if (pthread_spin_init(&srq->lock, PTHREAD_PROCESS_PRIVATE))
- 		goto err;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	srq->max     = align_queue_size(attr->attr.max_wr + 1);
- 	srq->max_gs  = attr->attr.max_sge;
- 	srq->counter = 0;
-@@ -327,23 +558,118 @@
- 
- 	cmd.buf_addr = (uintptr_t) srq->buf.buf;
- 	cmd.db_addr  = (uintptr_t) srq->db;
-+#else
-+	/*
-+	 * Solaris SRQ WQE memory is supplied by the kernel; we'll update
-+	 * these after the creation.
-+	 */
-+	srq->buf.buf      = NULL;
-+	srq->buf.length   = 0;
-+	srq->db           = NULL;
- 
-+	/*
-+	 * Need solaris to allocate space for the spare WR in
-+	 * the list that makes the queue work. The Solaris driver
-+	 * will round up to the nearest power of 2 as align_queue_size()
-+	 * does for OFED.
-+	 */
-+	attr->attr.max_wr += 1;
-+#endif
-+
- 	ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr,
- 				 &cmd.ibv_cmd, sizeof cmd,
- 				 &resp.ibv_resp, sizeof resp);
-+#if defined(__SVR4) && defined(__sun)
-+	if (ret) {
-+		goto err;
-+	}
-+
-+        /*
-+         * The kernel driver passes back mmap information for mapping the
-+         * SRQ work queue memory it allocated and the doorbell for
-+	 * for posting.
-+         */
-+	if (resp.mdd.msrq_rev < 1) {
-+		fprintf(stderr, PFX "libmlx4_create_srq libmlx4/hermon umap "
-+			"rev mismatch (kernel rev=%d)\n", resp.mdd.msrq_rev);
-+		goto err_destroy;
-+	}
-+
-+        srqbuf = mmap64((void *)0, resp.mdd.msrq_maplen,
-+	    (PROT_READ | PROT_WRITE), MAP_SHARED, pd->context->mmap_fd,
-+	    resp.mdd.msrq_mapoffset);
-+
-+        if (srqbuf == MAP_FAILED) {
-+                goto err_destroy;
-+        }
-+
-+	srq->buf.buf    = srqbuf;
-+	srq->buf.length = resp.mdd.msrq_maplen;
-+	srq->max	= resp.ibv_resp.max_wr;
-+	srq->max_gs	= resp.ibv_resp.max_sge;
-+	srq->srqn       = resp.mdd.msrq_srqnum;
-+	srq->counter 	= 0;
-+
-+	srq->db = mlx4_alloc_db(to_mctx(pd->context),
-+	    resp.mdd.msrq_rdbr_mapoffset, resp.mdd.msrq_rdbr_maplen,
-+	    resp.mdd.msrq_rdbr_offset);
-+	if (srq->db == NULL) {
-+                goto err_unmap;
-+	}
-+
-+	/*
-+	 * The following call only initializes memory and control structures,
-+	 * it utilizes the memory allocated by the kernel.
-+	 * It also allocates the srq->wrid memory.
-+	 */
-+	if (mlx4_set_srq_buf(pd, srq, resp.mdd.msrq_wqesz,
-+	    resp.mdd.msrq_numwqe)) {
-+		goto err_db;
-+	}
-+
-+	/*
-+	 * The rturned max wr will have been rounded up to the nearest
-+	 * power of 2, subtracting  1 from that and rporting that value
-+	 * as the max will give us the required free WR in the queue, as
-+	 * in OFED.
-+	 */
-+	attr->attr.max_wr -= 1;
-+#else
- 	if (ret)
- 		goto err_db;
- 
- 	srq->srqn = resp.srqn;
- 
-+#endif
- 	return &srq->ibv_srq;
- 
- err_db:
- 	mlx4_free_db(to_mctx(pd->context), MLX4_DB_TYPE_RQ, srq->db);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	if (srq->wrid)
-+		free(srq->wrid);
-+err_unmap:
-+	mlx4_free_buf(&srq->buf);
-+
-+err_destroy:
-+	/*
-+	 * Calling ibv_cmd_destroy_srq() will try and take the ibv_srq
-+	 * mutext that is initialised by the ibv_create_srq() entry point
-+	 * that called us AFETR we return, so its not initialised yet.
-+	 * So initialised it here so the destroy call doesn't hang.
-+	 */
-+	pthread_mutex_init(&(srq->ibv_srq.mutex), NULL);
-+	pthread_cond_init(&(srq->ibv_srq.cond), NULL);
-+	srq->ibv_srq.events_completed = 0;
-+
-+	ibv_cmd_destroy_srq(&srq->ibv_srq);
-+
-+#else
- err_free:
- 	free(srq->wrid);
- 	mlx4_free_buf(&srq->buf);
-+#endif
- 
- err:
- 	free(srq);
-@@ -357,7 +683,16 @@
- {
- 	struct ibv_modify_srq cmd;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
-+#else
-+	int	ret;
-+
-+	attr->max_wr += 1;		/* See create_srq */
-+	ret = ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
-+	attr->max_wr -= 1;
-+	return (ret);
-+#endif
- }
- 
- int mlx4_query_srq(struct ibv_srq *srq,
-@@ -365,7 +700,17 @@
- {
- 	struct ibv_query_srq cmd;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd);
-+#else
-+
-+	int	ret;
-+
-+	ret = ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd);
-+	attr->max_wr -= 1;		/* See create_srq */
-+
-+	return (ret);
-+#endif
- }
- 
- int mlx4_destroy_srq(struct ibv_srq *ibsrq)
-@@ -443,12 +788,16 @@
- struct ibv_qp *mlx4_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
- {
- 	struct mlx4_create_qp     cmd;
--	struct ibv_create_qp_resp resp;
- 	struct mlx4_qp		 *qp;
- 	int			  ret;
- 	struct mlx4_context	 *context = to_mctx(pd->context);
-+#if !(defined(__SVR4) && defined(__sun))
-+	struct ibv_create_qp_resp resp;
-+#else
-+	struct mlx4_create_qp_resp	resp;
-+	void				*qpbuf;
-+#endif
- 
--
- 	/* Sanity check QP size before proceeding */
- 	if (verify_sizes(attr, context))
- 		return NULL;
-@@ -457,6 +806,7 @@
- 	if (!qp)
- 		return NULL;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	mlx4_calc_sq_wqe_size(&attr->cap, attr->qp_type, qp);
- 
- 	/*
-@@ -466,6 +816,7 @@
- 	qp->sq_spare_wqes = (2048 >> qp->sq.wqe_shift) + 1;
- 	qp->sq.wqe_cnt = align_queue_size(attr->cap.max_send_wr + qp->sq_spare_wqes);
- 	qp->rq.wqe_cnt = align_queue_size(attr->cap.max_recv_wr);
-+#endif
- 
- 	if (attr->srq || attr->qp_type == IBV_QPT_XRC)
- 		attr->cap.max_recv_wr = qp->rq.wqe_cnt = 0;
-@@ -476,6 +827,22 @@
- 			attr->cap.max_recv_wr = 1;
- 	}
- 
-+#if defined(__SVR4) && defined(__sun)
-+	if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) ||
-+	    pthread_spin_init(&qp->rq.lock, PTHREAD_PROCESS_PRIVATE))
-+		goto err;
-+
-+	/*
-+	 * Solaris QP work queue memory is supplied by the kernel, so
-+	 * we will update this after creation.
-+	 */
-+	qp->buf.buf	= NULL;
-+	qp->sq.wrid	= NULL;
-+	qp->rq.wrid	= NULL;
-+	qp->buf.length	= 0;
-+	qp->db		= NULL;
-+	memset(&cmd, 0, sizeof(cmd));
-+#else
- 	if (mlx4_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp))
- 		goto err;
- 
-@@ -505,10 +872,12 @@
- 		; /* nothing */
- 	cmd.sq_no_prefetch = 0;	/* OK for ABI 2: just a reserved field */
- 	memset(cmd.reserved, 0, sizeof cmd.reserved);
-+#endif
- 
- 	pthread_mutex_lock(&to_mctx(pd->context)->qp_table_mutex);
- 
- 	ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd.ibv_cmd, sizeof cmd,
-+#if !(defined(__SVR4) && defined(__sun))
- 				&resp, sizeof resp);
- 	if (ret)
- 		goto err_rq_db;
-@@ -516,6 +885,70 @@
- 	ret = mlx4_store_qp(to_mctx(pd->context), qp->ibv_qp.qp_num, qp);
- 	if (ret)
- 		goto err_destroy;
-+#else
-+				&resp.ibv_resp, sizeof resp);
-+	if (ret)
-+		goto err_free;
-+
-+        /*
-+         * The kernel driver passes back mmap information for mapping the
-+         * QP work queue memory it allocated back into user space.
-+         */
-+	if (resp.mdd.mqp_rev < 2) {
-+		fprintf(stderr, PFX "libmlx4_create_qp: libmlx4/hermon umap "
-+		    "rev mismatch (kernel rev=%d)\n", resp.mdd.mqp_rev);
-+		goto err_destroy;
-+	}
-+	qpbuf = mmap64((void *)0, resp.mdd.mqp_maplen, (PROT_READ | PROT_WRITE),
-+	    MAP_SHARED, pd->context->mmap_fd, resp.mdd.mqp_mapoffset);
-+
-+	if (qpbuf == MAP_FAILED)
-+		goto err_destroy;
-+
-+	/*
-+	 * Need to set qp->buf here in case alloc_db fails then
-+	 * we'll call mlx4_free_buf() to umap.
-+	 */
-+	qp->buf.buf	= qpbuf;
-+	qp->buf.length	= resp.mdd.mqp_maplen;
-+
-+	if (!attr->srq && attr->qp_type != IBV_QPT_XRC) {
-+		qp->db = mlx4_alloc_db(to_mctx(pd->context),
-+		    resp.mdd.mqp_rdbr_mapoffset, resp.mdd.mqp_rdbr_maplen,
-+		    resp.mdd.mqp_rdbr_offset);
-+		if (qp->db == NULL)
-+			goto err_buf;
-+
-+		*qp->db = 0;
-+	}
-+
-+	/*
-+	 * Retrieve sendqueue actual size, and the number of headroom WQEs
-+	 * that were required based on kernel setup of prefetch or not for
-+	 * send queue.
-+	 * 	Note: mqp_sq_numwqe includes the head room wqes. The private
-+	 *	      wqe.cnt also includes headroom wqes, the verbs count
-+	 *	      should reflect the wqe count that is usable.
-+	 */
-+	qp->sq_spare_wqes = resp.mdd.mqp_sq_headroomwqes;
-+	qp->sq.wqe_cnt    = resp.mdd.mqp_sq_numwqe;
-+
-+	if (attr->srq)
-+		qp->rq.wqe_cnt  = 0;
-+	else
-+		qp->rq.wqe_cnt  = resp.mdd.mqp_rq_numwqe;
-+
-+	if (mlx4_set_qp_buf(pd, qp, qpbuf, resp.mdd.mqp_maplen,
-+	    resp.mdd.mqp_rq_wqesz, resp.mdd.mqp_rq_off,
-+	    resp.mdd.mqp_sq_wqesz, resp.mdd.mqp_sq_off))
-+		goto err_rq_db;
-+
-+	mlx4_init_qp_indices(qp);
-+
-+	ret = mlx4_store_qp(to_mctx(pd->context), qp->ibv_qp.qp_num, qp);
-+	if (ret)
-+		goto err_rq_db;
-+#endif
- 	pthread_mutex_unlock(&to_mctx(pd->context)->qp_table_mutex);
- 
- 	qp->rq.wqe_cnt = attr->cap.max_recv_wr;
-@@ -536,9 +969,38 @@
- 
- 	return &qp->ibv_qp;
- 
-+#if defined(__SVR4) && defined(__sun)
-+err_rq_db:
-+	if (!attr->srq && attr->qp_type != IBV_QPT_XRC)
-+		mlx4_free_db(to_mctx(pd->context), MLX4_DB_TYPE_RQ, qp->db);
-+err_buf:
-+	mlx4_free_buf(&qp->buf);
-+
- err_destroy:
-+	/*
-+	 * Calling ibv_cmd_destroy_qp() will try and take the ibv_qp
-+	 * mutext that is initialised by the ibv_create_qp() entry point
-+	 * that called us AFETR we retrun, so its not initialised yet.
-+	 * So initialised it here so the destroy call doesn't hang.
-+	 */
-+	pthread_mutex_init(&(qp->ibv_qp.mutex), NULL);
-+	pthread_cond_init(&(qp->ibv_qp.cond), NULL);
-+	qp->ibv_qp.events_completed = 0;
- 	ibv_cmd_destroy_qp(&qp->ibv_qp);
-+err_free:
-+	pthread_mutex_unlock(&to_mctx(pd->context)->qp_table_mutex);
- 
-+	if (qp->sq.wrid)
-+		free(qp->sq.wrid);
-+
-+	if (qp->rq.wrid)
-+		free(qp->rq.wrid);
-+err:
-+	free(qp);
-+#else
-+err_destroy:
-+	ibv_cmd_destroy_qp(&qp->ibv_qp);
-+
- err_rq_db:
- 	pthread_mutex_unlock(&to_mctx(pd->context)->qp_table_mutex);
- 	if (!attr->srq && attr->qp_type != IBV_QPT_XRC)
-@@ -552,6 +1014,7 @@
- 
- err:
- 	free(qp);
-+#endif
- 
- 	return NULL;
- }
-@@ -745,6 +1208,13 @@
- 				    struct ibv_cq *xrc_cq,
- 				    struct ibv_srq_init_attr *attr)
- {
-+#if defined(__SVR4) && defined(__sun)
-+	/*
-+	 * Not supported by Solaris kenrel driver.  When/if supported
-+	 * this routine will need to be ported.
-+	 */
-+	return NULL;
-+#else
- 	struct mlx4_create_xrc_srq  cmd;
- 	struct mlx4_create_srq_resp resp;
- 	struct mlx4_srq		   *srq;
-@@ -807,6 +1277,7 @@
- 	free(srq);
- 
- 	return NULL;
-+#endif
- }
- 
- struct ibv_xrc_domain *mlx4_open_xrc_domain(struct ibv_context *context,
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/qp.c libmlx4-1.0.1/src/qp.c
---- /tmp/839450/libmlx4-1.0.1/src/qp.c	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/qp.c	Tue Mar 15 07:09:43 2011
-@@ -407,7 +407,8 @@
- out:
- 	ctx = to_mctx(ibqp->context);
- 
--	if (nreq == 1 && inl && size > 1 && size < ctx->bf_buf_size / 16) {
-+	if (ctx->ibv_ctx.device->blueflame_enabled && nreq == 1 && inl &&
-+	    size > 1 && size < ctx->bf_buf_size / 16) {
- 		ctrl->owner_opcode |= htonl((qp->sq.head & 0xffff) << 8);
- 		*(uint32_t *) (&ctrl->vlan_tag) |= qp->doorbell_qpn;
- 		/*
-@@ -589,6 +590,59 @@
- 		; /* nothing */
- }
- 
-+#if defined(__SVR4) && defined(__sun)
-+int mlx4_set_qp_buf(struct ibv_pd *pd, struct mlx4_qp *qp, void *qpbuf,
-+    uint64_t buflen, uint32_t rq_wqesz, uint32_t rq_off,
-+    uint32_t sq_wqesz, uint32_t sq_off)
-+{
-+	qp->buf.buf      = qpbuf;
-+	qp->buf.length   = buflen;
-+
-+	qp->sq.wrid = malloc(qp->sq.wqe_cnt * sizeof (uint64_t));
-+	if (!qp->sq.wrid)
-+		return -1;
-+
-+	if (qp->rq.wqe_cnt) {
-+		qp->rq.wrid = malloc(qp->rq.wqe_cnt * sizeof (uint64_t));
-+		if (!qp->rq.wrid) {
-+			free(qp->sq.wrid);
-+			return -1;
-+		}
-+	}
-+
-+	for (qp->rq.wqe_shift = 4; 1 << qp->rq.wqe_shift < rq_wqesz;
-+	     qp->rq.wqe_shift++) {
-+		; /* nothing */
-+	}
-+
-+	for (qp->sq.wqe_shift = 6; 1 << qp->sq.wqe_shift < sq_wqesz;
-+	     qp->sq.wqe_shift++) {
-+		; /* nothing */
-+	}
-+
-+	qp->buf_size = (qp->rq.wqe_cnt << qp->rq.wqe_shift) +
-+		(qp->sq.wqe_cnt << qp->sq.wqe_shift);
-+	if (qp->rq.wqe_shift > qp->sq.wqe_shift) {
-+		qp->rq.offset = 0;
-+		qp->sq.offset = qp->rq.wqe_cnt << qp->rq.wqe_shift;
-+	} else {
-+		qp->rq.offset = qp->sq.wqe_cnt << qp->sq.wqe_shift;
-+		qp->sq.offset = 0;
-+	}
-+
-+	if ((long int)qp->buf.length < (long int)qp->buf_size) {
-+		fprintf(stderr, PFX "QP kernel buffer size %lu < user buf "
-+		    "size %d\n", (unsigned long)qp->buf.length, qp->buf_size);
-+	}
-+	if ((!rq_off && qp->rq.offset) || (!sq_off && qp->sq.offset)) {
-+		fprintf(stderr, PFX "QP kernel and user out of sync on "
-+		    "buffer order\n");
-+	}
-+
-+	memset(qp->buf.buf, 0, qp->buf_size);
-+	return 0;
-+}
-+#endif
- int mlx4_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
- 		       enum ibv_qp_type type, struct mlx4_qp *qp)
- {
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/mlx4.h libmlx4-1.0.1/src/mlx4.h
---- /tmp/839450/libmlx4-1.0.1/src/mlx4.h	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/mlx4.h	Fri Feb 11 04:05:04 2011
-@@ -202,7 +202,11 @@
- 	int				xrc_srq_table_shift;
- 	int				xrc_srq_table_mask;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	struct mlx4_db_page	       *db_page_list;
-+#else
- 	struct mlx4_db_page	       *db_list[MLX4_NUM_DB_TYPE];
-+#endif
- 	pthread_mutex_t			db_list_mutex;
- };
- 
-@@ -351,7 +355,12 @@
- int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size);
- void mlx4_free_buf(struct mlx4_buf *buf);
- 
-+#if defined(__SVR4) && defined(__sun)
-+uint32_t *mlx4_alloc_db(struct mlx4_context *context, uint64_t mapoffset,
-+                        uint64_t maplen, uint32_t offset);
-+#else
- uint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type);
-+#endif
- void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t *db);
- 
- int mlx4_query_device(struct ibv_context *context,
-@@ -360,11 +369,17 @@
- 		     struct ibv_port_attr *attr);
- 
- struct ibv_pd *mlx4_alloc_pd(struct ibv_context *context);
-+struct ibv_shpd *mlx4_alloc_shpd(struct ibv_pd *pd, uint64_t share_key, struct ibv_shpd *shpd);
-+struct ibv_pd *mlx4_share_pd(struct ibv_context *context, struct ibv_shpd *shpd, uint64_t share_key);
- int mlx4_free_pd(struct ibv_pd *pd);
- 
- struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
- 			    size_t length, int access);
-+struct ibv_mr *mlx4_reg_mr_relaxed(struct ibv_pd *pd, void *addr,
-+			    size_t length, int access);
- int mlx4_dereg_mr(struct ibv_mr *mr);
-+int mlx4_dereg_mr_relaxed(struct ibv_mr *mr);
-+int mlx4_flush_relaxed_mr(struct ibv_pd *pd);
- 
- struct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe,
- 			       struct ibv_comp_channel *channel,
-@@ -388,8 +403,13 @@
- int mlx4_query_srq(struct ibv_srq *srq,
- 			   struct ibv_srq_attr *attr);
- int mlx4_destroy_srq(struct ibv_srq *srq);
-+#if defined(__SVR4) && defined(__sun)
-+int mlx4_set_srq_buf(struct ibv_pd *pd, struct mlx4_srq *srq,
-+			uint32_t srq_wqesz, uint32_t srq_numwqe);
-+#else
- int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
- 			struct mlx4_srq *srq);
-+#endif
- void mlx4_free_srq_wqe(struct mlx4_srq *srq, int ind);
- int mlx4_post_srq_recv(struct ibv_srq *ibsrq,
- 		       struct ibv_recv_wr *wr,
-@@ -415,8 +435,14 @@
- void mlx4_calc_sq_wqe_size(struct ibv_qp_cap *cap, enum ibv_qp_type type,
- 			   struct mlx4_qp *qp);
- int num_inline_segs(int data, enum ibv_qp_type type);
-+#if defined(__SVR4) && defined(__sun)
-+int mlx4_set_qp_buf(struct ibv_pd *pd, struct mlx4_qp *qp,
-+                    void *qpbuf, uint64_t buflen, uint32_t rq_wqesz,
-+                     uint32_t rq_off, uint32_t sq_wqesz, uint32_t sq_off);
-+#else
- int mlx4_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
- 		       enum ibv_qp_type type, struct mlx4_qp *qp);
-+#endif
- void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
- 		       enum ibv_qp_type type);
- struct mlx4_qp *mlx4_find_qp(struct mlx4_context *ctx, uint32_t qpn);
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/srq.c libmlx4-1.0.1/src/srq.c
---- /tmp/839450/libmlx4-1.0.1/src/srq.c	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/srq.c	Fri Feb 11 04:05:05 2011
-@@ -124,6 +124,54 @@
- 	return err;
- }
- 
-+#if defined(__SVR4) && defined(__sun)
-+/*
-+ * The Solaris kernel allocates the SRQ WQE buffer, this routine
-+ * initializes the control structures and buffer contents for the
-+ * SRQ memory.  That memory is mapped into the caller's address
-+ * space prior to this call.
-+ */
-+int mlx4_set_srq_buf(struct ibv_pd *pd, struct mlx4_srq *srq,
-+				uint32_t srq_wqesz, uint32_t srq_numwqe)
-+{
-+	struct mlx4_wqe_srq_next_seg *next;
-+	struct mlx4_wqe_data_seg *scatter;
-+	int i;
-+
-+	srq->max         = srq_numwqe;
-+
-+	srq->wrid = malloc(srq->max * sizeof (uint64_t));
-+	if (!srq->wrid) {
-+		return -1;
-+	}
-+
-+	for (srq->wqe_shift = 5; 1 << srq->wqe_shift < srq_wqesz; ++srq->wqe_shift) {
-+		; /* nothing */
-+	}
-+
-+	memset(srq->buf.buf, 0, srq->buf.length);
-+
-+	/*
-+	 * Now initialize the SRQ buffer so that all of the WQEs are
-+	 * linked into the list of free WQEs.
-+	 */
-+	for (i = 0; i < srq->max; ++i) {
-+		next = get_wqe(srq, i);
-+		next->next_wqe_index = htons((i + 1) & (srq->max - 1));
-+
-+		for (scatter = (void *) (next + 1);
-+		    (void *) scatter < (void *) next + (1 << srq->wqe_shift);
-+		    ++scatter)
-+			scatter->lkey = htonl(MLX4_INVALID_LKEY);
-+	}
-+
-+	srq->head = 0;
-+	srq->tail = srq->max - 1;
-+
-+	return 0;
-+}
-+#endif
-+
- int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
- 		       struct mlx4_srq *srq)
- {
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/dbrec.c libmlx4-1.0.1/src/dbrec.c
---- /tmp/839450/libmlx4-1.0.1/src/dbrec.c	Tue Sep  8 06:40:36 2009
-+++ libmlx4-1.0.1/src/dbrec.c	Fri Feb 11 04:05:04 2011
-@@ -41,7 +41,157 @@
- 
- #include "mlx4.h"
- 
-+#if defined(__SVR4) && defined(__sun)
-+/*
-+ * In Solaris the doorbell UAR is setup by the kernel, we only
-+ * mmap the offset specified for the doorbell into the user
-+ * address space.  A reference counted page list is maintained
-+ * per user context of doorbell pages that have been mapped.
-+ */
- struct mlx4_db_page {
-+	struct mlx4_db_page	   *prev, *next;
-+	uint32_t                   *dbp_page_addr;
-+	uint32_t                   *dbp_page_addr_end;
-+	uint64_t                   dbp_map_offset;
-+	uint64_t                   dbp_map_len;
-+	int                        fd;
-+	int                        dbp_use_cnt;
-+};
-+
-+/*
-+ * These are not required in Solaris, but we keep them to pass
-+ * as dummy arguments so that the the doorbell function calls can
-+ * keep the same API.
-+ */
-+static const int db_size[] = {
-+	[MLX4_DB_TYPE_CQ] = 8,
-+	[MLX4_DB_TYPE_RQ] = 4,
-+};
-+
-+/*
-+ * Return a doorbell pointer for the specified map offset.  If this
-+ * offset has not been previously mapped it will be mmap'd and the
-+ * appropriate doorbell returned; otherwise, the reference count
-+ * will be updated and the appropriate doorbell will be returned.
-+ * Each successful call to mlx4_alloc_db() must call mlx4_free_db()
-+ * to release the reference to the doorbell page  when the doorbell
-+ * is no longer required.
-+ */
-+uint32_t *mlx4_alloc_db(struct mlx4_context *context,
-+                        uint64_t mapoffset,
-+                        uint64_t maplen,
-+                        uint32_t offset)
-+{
-+	struct mlx4_db_page *page;
-+	uint32_t *db = NULL;
-+
-+	pthread_mutex_lock(&context->db_list_mutex);
-+
-+	for (page = context->db_page_list; page; page = page->next) {
-+		if (page->dbp_map_offset == mapoffset &&
-+		    page->fd == context->ibv_ctx.mmap_fd) {
-+			if (page->dbp_map_len == maplen) {
-+				goto found;
-+			}
-+			fprintf(stderr,
-+			        PFX "mlx4_alloc_db: Bad maplen (%" PRId64 ")\n",
-+			        maplen);
-+			goto out;
-+		}
-+	}
-+
-+	page = malloc(sizeof(struct mlx4_db_page));
-+	if (!page) {
-+		fprintf(stderr, PFX "DB alloc memory allocate failure\n");
-+		goto out;
-+	}
-+
-+	page->dbp_page_addr = (uint32_t *) mmap64((void *)0, maplen,
-+	                                          (PROT_READ | PROT_WRITE),
-+	                                          MAP_SHARED,
-+	                                          context->ibv_ctx.mmap_fd,
-+	                                          mapoffset);
-+	if (page->dbp_page_addr == MAP_FAILED) {
-+		fprintf(stderr, PFX
-+		        "Unable to map doorbell entry: maplen:%" PRId64 ", offset:%" PRId64
-+		        "\n", maplen, mapoffset);
-+		free(page);
-+		goto out;
-+	}
-+
-+	page->dbp_page_addr_end = (uint32_t *)((uint8_t *) page->dbp_page_addr + maplen);
-+
-+	page->dbp_map_offset  = mapoffset;
-+	page->dbp_map_len     = maplen;
-+	page->dbp_use_cnt     = 0;
-+	page->fd	      = context->ibv_ctx.mmap_fd;
-+	page->next            = context->db_page_list;
-+
-+	if (context->db_page_list)
-+		context->db_page_list->prev = page;
-+
-+	page->prev            = NULL;
-+	context->db_page_list = page;
-+
-+found:
-+	page->dbp_use_cnt++;
-+
-+
-+	db = (uint32_t *) ((uint8_t *)page->dbp_page_addr + offset);
-+out:
-+	pthread_mutex_unlock(&context->db_list_mutex);
-+
-+	return db;
-+}
-+
-+/*
-+ * Dereference doorbell page mappinge associated with the specified doorbell.
-+ * If this is the last doorbell that references a mapped region, then that
-+ * region will be unmapped.
-+ */
-+void mlx4_free_db(struct mlx4_context *context,
-+                  enum mlx4_db_type dummy,
-+                  uint32_t *db)
-+{
-+	struct mlx4_db_page *page;
-+
-+	pthread_mutex_lock(&context->db_list_mutex);
-+
-+	for (page = context->db_page_list; page; page = page->next) {
-+		if (db >= page->dbp_page_addr && db < page->dbp_page_addr_end) {
-+			break;
-+		}
-+	}
-+
-+	if (page == NULL) {
-+		fprintf(stderr, PFX "mlx4_free_db: Doorbell not mapped\n");
-+		goto out;
-+	}
-+
-+	page->dbp_use_cnt--;
-+	if (page->dbp_use_cnt > 0) {
-+		goto out;
-+	}
-+
-+	munmap((void *)page->dbp_page_addr, page->dbp_map_len);
-+	if (page->next) {
-+		page->next->prev = page->prev;
-+	}
-+	if (page->prev) {
-+		page->prev->next = page->next;
-+	} else {
-+		context->db_page_list = page->next;
-+	}
-+
-+	free(page);
-+
-+out:
-+	pthread_mutex_unlock(&context->db_list_mutex);
-+}
-+
-+#else
-+
-+struct mlx4_db_page {
- 	struct mlx4_db_page	       *prev, *next;
- 	struct mlx4_buf			buf;
- 	int				num_db;
-@@ -152,3 +302,4 @@
- out:
- 	pthread_mutex_unlock(&context->db_list_mutex);
- }
-+#endif
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/buf.c libmlx4-1.0.1/src/buf.c
---- /tmp/839450/libmlx4-1.0.1/src/buf.c	Tue Sep  8 06:41:26 2009
-+++ libmlx4-1.0.1/src/buf.c	Fri Feb 11 04:05:03 2011
-@@ -78,6 +78,8 @@
- 
- void mlx4_free_buf(struct mlx4_buf *buf)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	ibv_dofork_range(buf->buf, buf->length);
-+#endif
- 	munmap(buf->buf, buf->length);
- }
-diff -r -u /tmp/839450/libmlx4-1.0.1/src/mlx4.c libmlx4-1.0.1/src/mlx4.c
---- /tmp/839450/libmlx4-1.0.1/src/mlx4.c	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/src/mlx4.c	Fri Mar 11 14:05:26 2011
-@@ -112,8 +112,13 @@
- 	.query_port    = mlx4_query_port,
- 	.alloc_pd      = mlx4_alloc_pd,
- 	.dealloc_pd    = mlx4_free_pd,
-+	.alloc_shpd    = mlx4_alloc_shpd,
-+	.share_pd      = mlx4_share_pd,
- 	.reg_mr	       = mlx4_reg_mr,
-+	.reg_mr_relaxed	       = mlx4_reg_mr_relaxed,
- 	.dereg_mr      = mlx4_dereg_mr,
-+	.dereg_mr_relaxed      = mlx4_dereg_mr_relaxed,
-+	.flush_relaxed_mr      = mlx4_flush_relaxed_mr,
- 	.create_cq     = mlx4_create_cq,
- 	.poll_cq       = mlx4_poll_cq,
- 	.req_notify_cq = mlx4_arm_cq,
-@@ -144,6 +149,11 @@
- 	struct mlx4_alloc_ucontext_resp resp;
- 	int				i;
- 	struct ibv_device_attr		dev_attrs;
-+#if defined(__SVR4) && defined(__sun)
-+	pid_t                           cur_pid;
-+	off64_t                         uarpg_offset;
-+	uint32_t                        temp_qp_num;
-+#endif
- 
- 	context = calloc(1, sizeof *context);
- 	if (!context)
-@@ -150,11 +160,29 @@
- 		return NULL;
- 
- 	context->ibv_ctx.cmd_fd = cmd_fd;
--
-+#if defined(__SVR4) && defined(__sun)
-+	context->ibv_ctx.device = ibdev;
-+#endif
- 	if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, sizeof cmd,
- 				&resp.ibv_resp, sizeof resp))
- 		goto err_free;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	/* 
-+	 * OFED expects power of two, round up here to make user table
-+	 * large enough.
-+	 */
-+	for (temp_qp_num = 1; temp_qp_num < resp.qp_tab_size; temp_qp_num <<= 1)
-+		;
-+	resp.qp_tab_size = temp_qp_num;
-+
-+	/*
-+	 * NOTE: In Solaris this value is not returned in the channel interface
-+	 * opaque data and is assumed to be 2*256 by the dapl code.  We have
-+	 * made the same assumption here.
-+	 */
-+	resp.bf_reg_size = 512;
-+#endif
- 	context->num_qps	= resp.qp_tab_size;
- 	context->qp_table_shift = ffs(context->num_qps) - 1 - MLX4_QP_TABLE_BITS;
- 	context->qp_table_mask	= (1 << context->qp_table_shift) - 1;
-@@ -172,20 +200,45 @@
- 	for (i = 0; i < MLX4_XRC_SRQ_TABLE_SIZE; ++i)
- 		context->xrc_srq_table[i].refcnt = 0;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	context->db_page_list = NULL;
-+#else
- 	for (i = 0; i < MLX4_NUM_DB_TYPE; ++i)
- 		context->db_list[i] = NULL;
-+#endif
- 
- 	pthread_mutex_init(&context->db_list_mutex, NULL);
- 
-+#if defined(__SVR4) && defined(__sun)
-+	cur_pid = getpid();
-+	uarpg_offset = (((off64_t) cur_pid << MLNX_UMAP_RSRC_TYPE_SHIFT) |
-+	                MLNX_UMAP_UARPG_RSRC) * to_mdev(ibdev)->page_size;
-+	context->uar = mmap64((void *)0, to_mdev(ibdev)->page_size, PROT_WRITE,
-+			    MAP_SHARED, context->ibv_ctx.mmap_fd, uarpg_offset);
-+#else
- 	context->uar = mmap(NULL, to_mdev(ibdev)->page_size, PROT_WRITE,
- 			    MAP_SHARED, cmd_fd, 0);
-+#endif
- 	if (context->uar == MAP_FAILED)
- 		goto err_free;
- 
- 	if (resp.bf_reg_size) {
-+#if defined(__SVR4) && defined(__sun)
-+		/*
-+		 * If kernel driver is supporting Blue Flame feature, map
-+		 * the Blue Flame user access region as well.
-+		 */
-+		uarpg_offset = (((off64_t) cur_pid << MLNX_UMAP_RSRC_TYPE_SHIFT)
-+		    | MLNX_UMAP_BLUEFLAMEPG_RSRC) * to_mdev(ibdev)->page_size;
-+
-+		context->bf_page = mmap64((void *)0, to_mdev(ibdev)->page_size,
-+		    PROT_WRITE, MAP_SHARED, context->ibv_ctx.mmap_fd,
-+		    uarpg_offset);
-+#else
- 		context->bf_page = mmap(NULL, to_mdev(ibdev)->page_size,
- 					PROT_WRITE, MAP_SHARED, cmd_fd,
- 					to_mdev(ibdev)->page_size);
-+#endif
- 		if (context->bf_page == MAP_FAILED) {
- 			fprintf(stderr, PFX "Warning: BlueFlame available, "
- 				"but failed to mmap() BlueFlame page.\n");
-@@ -214,6 +267,7 @@
- 	context->max_qp_wr = dev_attrs.max_qp_wr;
- 	context->max_sge = dev_attrs.max_sge;
- 	context->max_cqe = dev_attrs.max_cqe;
-+#ifdef HAVE_IBV_XRC_OPS
- 	if (!(dev_attrs.device_cap_flags & IBV_DEVICE_XRC)) {
- 		fprintf(stderr, PFX "There is a mismatch between "
- 		        "the kernel and the userspace libraries: "
-@@ -220,6 +274,7 @@
- 			"Kernel does not support XRC. Exiting.\n");
- 		goto query_free;
- 	}
-+#endif
- 
- 	return &context->ibv_ctx;
- 
-@@ -240,6 +295,7 @@
- 	munmap(context->uar, to_mdev(ibctx->device)->page_size);
- 	if (context->bf_page)
- 		munmap(context->bf_page, to_mdev(ibctx->device)->page_size);
-+
- 	free(context);
- }
- 
-diff -r -u /tmp/839450/libmlx4-1.0.1/configure.in libmlx4-1.0.1/configure.in
---- /tmp/839450/libmlx4-1.0.1/configure.in	Thu Mar 10 04:48:34 2011
-+++ libmlx4-1.0.1/configure.in	Tue Mar 15 07:41:46 2011
-@@ -43,11 +43,11 @@
- AC_C_CONST
- AC_CHECK_SIZEOF(long)
- AC_CHECK_MEMBER(struct ibv_context.more_ops,
--    [AC_DEFINE([HAVE_IBV_MORE_OPS], 1, [Define to 1 if more_ops is a member of ibv_context])],,
-+    [AC_DEFINE([HAVE_IBV_MORE_OPS], 0, [Define to 1 if more_ops is a member of ibv_context])],,
-     [#include <infiniband/verbs.h>])
--AC_CHECK_MEMBER(struct ibv_more_ops.create_xrc_srq,
--    [AC_DEFINE([HAVE_IBV_XRC_OPS], 1, [Define to 1 if have xrc ops])],,
--    [#include <infiniband/verbs.h>])
-+#AC_CHECK_MEMBER(struct ibv_more_ops.create_xrc_srq,
-+#    [AC_DEFINE([HAVE_IBV_XRC_OPS], 1, [Define to 1 if have xrc ops])],,
-+#    [#include <infiniband/verbs.h>])
- 
- dnl Checks for library functions
- AC_CHECK_FUNC(ibv_read_sysfs_file, [],
-@@ -80,6 +80,5 @@
- fi
- AC_SUBST(MLX4_VERSION_SCRIPT)
- 
--SHAVE_INIT([], [enable])
- AC_CONFIG_FILES([Makefile libmlx4.spec shave shave-libtool])
- AC_OUTPUT
-diff -r -u /tmp/839450/libmlx4-1.0.1/libmlx4.spec.in libmlx4-1.0.1/libmlx4.spec.in
---- /tmp/839450/libmlx4-1.0.1/libmlx4.spec.in	Thu Mar 10 00:23:34 2011
-+++ libmlx4-1.0.1/libmlx4.spec.in	Tue Mar 15 07:43:54 2011
-@@ -6,7 +6,7 @@
- Group: System Environment/Libraries
- License: GPLv2 or BSD
- Url: http://openfabrics.org/
--Source: http://openfabrics.org/downloads/libmlx4/libmlx4-1.0.1.tar.gz
-+Source: http://openfabrics.org/downloads/libmlx4-1.0.1.tar.gz
- BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
- 
- BuildRequires: libibverbs-devel >= 1.1-0.1.rc2
-diff -r -u /tmp/839450/libmlx4-1.0.1/configure libmlx4-1.0.1/configure
---- /tmp/839450/libmlx4-1.0.1/configure	Thu Mar 10 04:48:41 2011
-+++ libmlx4-1.0.1/configure	Tue Mar 15 07:35:49 2011
-@@ -3899,13 +3899,13 @@
-   CFLAGS=$ac_save_CFLAGS
- elif test $ac_cv_prog_cc_g = yes; then
-   if test "$GCC" = yes; then
--    CFLAGS="-g -O2"
-+    CFLAGS="-g -O3"
-   else
-     CFLAGS="-g"
-   fi
- else
-   if test "$GCC" = yes; then
--    CFLAGS="-O2"
-+    CFLAGS="-O3"
-   else
-     CFLAGS=
-   fi
-@@ -8890,6 +8890,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+	hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-@@ -11113,13 +11114,13 @@
-   CFLAGS=$ac_save_CFLAGS
- elif test $ac_cv_prog_cc_g = yes; then
-   if test "$GCC" = yes; then
--    CFLAGS="-g -O2"
-+    CFLAGS="-g -O3"
-   else
-     CFLAGS="-g"
-   fi
- else
-   if test "$GCC" = yes; then
--    CFLAGS="-O2"
-+    CFLAGS="-O3"
-   else
-     CFLAGS=
-   fi
-@@ -11654,11 +11655,11 @@
- 
- ac_fn_c_check_member "$LINENO" "struct ibv_more_ops" "create_xrc_srq" "ac_cv_member_struct_ibv_more_ops_create_xrc_srq" "#include <infiniband/verbs.h>
- "
--if test "x$ac_cv_member_struct_ibv_more_ops_create_xrc_srq" = x""yes; then :
-+#if test "x$ac_cv_member_struct_ibv_more_ops_create_xrc_srq" = x""yes; then :
- 
--$as_echo "#define HAVE_IBV_XRC_OPS 1" >>confdefs.h
-+#$as_echo "#define HAVE_IBV_XRC_OPS 1" >>confdefs.h
- 
--fi
-+#fi
- 
- 
- ac_fn_c_check_func "$LINENO" "ibv_read_sysfs_file" "ac_cv_func_ibv_read_sysfs_file"
-diff -r -u /tmp/839450/libmlx4-1.0.1/Makefile.in libmlx4-1.0.1/Makefile.in
---- /tmp/839450/libmlx4-1.0.1/Makefile.in	Thu Mar 10 04:48:40 2011
-+++ libmlx4-1.0.1/Makefile.in	Tue Mar 15 07:48:16 2011
-@@ -264,7 +264,7 @@
- @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@src_libmlx4_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
- @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@        $(mlx4_version_script)
- 
--@HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mlx4confdir = $(sysconfdir)/libibverbs.d
-+@HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mlx4confdir = $(datadir)/libibverbs.d
- @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mlx4conf_DATA = mlx4.driver
- @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@mlx4libdir = $(libdir)/infiniband
- @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@mlx4lib_LTLIBRARIES = src/mlx4.la
-@@ -345,8 +345,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:
-@@ -376,8 +376,8 @@
- 	  else :; fi; \
- 	done; \
- 	test -z "$$list2" || { \
--	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(mlx4libdir)'"; \
--	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(mlx4libdir)"; \
-+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m755 $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(mlx4libdir)'"; \
-+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(mlx4libdir)"; \
- 	}
- 
- uninstall-mlx4libLTLIBRARIES:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,37 @@
+This software is available to you under a choice of one of two
+licenses.  You may choose to be licensed under the terms of the the
+OpenIB.org BSD license or the GNU General Public License (GPL) Version
+2, both included below.
+
+Copyright (c) 2005 Intel Corporation.  All rights reserved.
+
+==================================================================
+
+              OpenIB.org BSD license
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following
+   disclaimer in the documentation and/or other materials provided
+   with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
--- a/components/open-fabrics/librdmacm/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/librdmacm/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,27 +22,23 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		librdmacm
-COMPONENT_VERSION=	1.0.14.1
+COMPONENT_VERSION=	1.0.21
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:b74d367415b4f294f3821955428f3e362b91f779042c88970f99941216c13a7c
-COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/rdmacm/$(COMPONENT_ARCHIVE)
+	sha256:bd99d29d24338f0bcc7258f7cde32dc06e5a85139938c2f655c5d5dd4ae6a27b
+COMPONENT_ARCHIVE_URL= https://www.openfabrics.org/downloads/rdmacm/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 include ../ofed-component.mk
 
 LIBS += -libverbs
 
+CONFIGURE_OPTIONS += --disable-rsocket-utils
+
 CLEANUP_FILES =\
-	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man1/rdma_server.1\
-	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man1/rdma_client.1\
-	$(PROTOUSRBINDIR)/rdma_server\
-	$(PROTOUSRBINDIR)/rdma_client\
-	$(PROTOUSRBINDIR)/$(MACH32)/rdma_server\
-	$(PROTOUSRBINDIR)/$(MACH32)/rdma_client\
 	$(PROTOUSRINCDIR)/infiniband/ib.h\
 	$(PROTOUSRINCDIR)/rdma/rdma_cma_abi.h\
 	$(PROTOUSRLIBDIR)/$(COMPONENT_NAME).la\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/001-librdmacm-disable-rsockets.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,509 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  276da03b3ce08017654f5b4571b019a4b00c19d5
+Add option to disable compilation of rsocket
+
+Added an option enable-rsocket-utils to control the compilation of
+rsocket utilities and examples from the top level build file.
+By default the parameter is set to no to disable the code which would
+correspondingly set the ENABLE_RSOCKET flag in the code.
+
+diff -r 276da03b3ce0 Makefile.am
+--- a/Makefile.am	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.am	Mon Nov 16 17:13:21 2015 -0800
+@@ -1,14 +1,20 @@
+ AM_CPPFLAGS = -I$(srcdir)/include
+ 
++if ENABLE_RSOCKET
+ rslibdir = $(libdir)/rsocket
++endif
+ lib_LTLIBRARIES = src/librdmacm.la
++if ENABLE_RSOCKET
+ rslib_LTLIBRARIES = src/librspreload.la
++endif
+ 
+ ACLOCAL_AMFLAGS = -I config
+ AM_CFLAGS = -g -Wall -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)\" -DRDMADIR=\"@rdmadir@\"
+ 
+ src_librdmacm_la_CFLAGS = $(AM_CFLAGS)
++if ENABLE_RSOCKET
+ src_librspreload_la_CFLAGS = $(AM_CFLAGS)
++endif
+ 
+ if HAVE_LD_VERSION_SCRIPT
+     librdmacm_version_script = -Wl,--version-script=$(srcdir)/src/librdmacm.map
+@@ -17,19 +23,27 @@
+ endif
+ 
+ src_librdmacm_la_SOURCES = src/cma.c src/addrinfo.c src/acm.c \
+-		src/rsocket.c src/indexer.c
++		src/indexer.c
++if ENABLE_RSOCKET
++src_librdmacm_la_SOURCES += src/rsocket.c
++endif
+ src_librdmacm_la_LDFLAGS = -version-info 1 -export-dynamic \
+ 			   $(librdmacm_version_script)
+ src_librdmacm_la_DEPENDENCIES =  $(srcdir)/src/librdmacm.map
+ 
++if ENABLE_RSOCKET
+ src_librspreload_la_SOURCES = src/preload.c src/indexer.c
+ src_librspreload_la_LDFLAGS = -version-info 1 -export-dynamic
+ src_librspreload_la_LIBADD = $(top_builddir)/src/librdmacm.la
++endif
+ 
+ bin_PROGRAMS = examples/ucmatose examples/rping examples/udaddy examples/mckey \
+ 	       examples/rdma_client examples/rdma_server examples/rdma_xclient \
+-	       examples/rdma_xserver examples/rstream examples/rcopy \
+-	       examples/riostream examples/udpong examples/cmtime
++	       examples/rdma_xserver examples/cmtime
++if ENABLE_RSOCKET
++bin_PROGRAMS += examples/rstream examples/rcopy examples/riostream examples/udpong
++endif
++
+ examples_ucmatose_SOURCES = examples/cmatose.c examples/common.c
+ examples_ucmatose_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_rping_SOURCES = examples/rping.c
+@@ -46,6 +60,7 @@
+ examples_rdma_xclient_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_rdma_xserver_SOURCES = examples/rdma_xserver.c
+ examples_rdma_xserver_LDADD = $(top_builddir)/src/librdmacm.la
++if ENABLE_RSOCKET
+ examples_rstream_SOURCES = examples/rstream.c examples/common.c
+ examples_rstream_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_riostream_SOURCES = examples/riostream.c examples/common.c
+@@ -54,6 +69,7 @@
+ examples_rcopy_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_udpong_SOURCES = examples/udpong.c examples/common.c
+ examples_udpong_LDADD = $(top_builddir)/src/librdmacm.la
++endif
+ examples_cmtime_SOURCES = examples/cmtime.c examples/common.c
+ examples_cmtime_LDADD = $(top_builddir)/src/librdmacm.la
+ 
+@@ -62,8 +78,10 @@
+ 
+ librdmacminclude_HEADERS = $(top_srcdir)/include/rdma/rdma_cma_abi.h \
+ 			   $(top_srcdir)/include/rdma/rdma_cma.h \
+-			   $(top_srcdir)/include/rdma/rdma_verbs.h \
+-			   $(top_srcdir)/include/rdma/rsocket.h
++			   $(top_srcdir)/include/rdma/rdma_verbs.h
++if ENABLE_RSOCKET
++librdmacminclude_HEADERS += $(top_srcdir)/include/rdma/rsocket.h
++endif
+ 
+ infinibandinclude_HEADERS = $(top_srcdir)/include/infiniband/ib.h
+ 
+@@ -125,11 +143,15 @@
+ 	man/rdma_client.1 \
+ 	man/rdma_xserver.1 \
+ 	man/rdma_xclient.1 \
++	man/rdma_cm.7 
++
++if ENABLE_RSOCKET
++man_MANS += \
+ 	man/riostream.1 \
+ 	man/rstream.1 \
+ 	man/rcopy.1 \
+-	man/rdma_cm.7 \
+ 	man/rsocket.7
++endif
+ 
+ EXTRA_DIST = src/cma.h src/indexer.h src/librdmacm.map \
+ 	examples/common.h librdmacm.spec.in $(man_MANS)
+diff -r 276da03b3ce0 Makefile.in
+--- a/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/Makefile.in	Mon Nov 16 17:13:21 2015 -0800
+@@ -36,13 +36,20 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
++@ENABLE_RSOCKET_TRUE@am__append_1 = src/rsocket.c
+ bin_PROGRAMS = examples/ucmatose$(EXEEXT) examples/rping$(EXEEXT) \
+ 	examples/udaddy$(EXEEXT) examples/mckey$(EXEEXT) \
+ 	examples/rdma_client$(EXEEXT) examples/rdma_server$(EXEEXT) \
+ 	examples/rdma_xclient$(EXEEXT) examples/rdma_xserver$(EXEEXT) \
+-	examples/rstream$(EXEEXT) examples/rcopy$(EXEEXT) \
+-	examples/riostream$(EXEEXT) examples/udpong$(EXEEXT) \
+-	examples/cmtime$(EXEEXT)
++	examples/cmtime$(EXEEXT) $(am__EXEEXT_1)
++@ENABLE_RSOCKET_TRUE@am__append_2 = examples/rstream examples/rcopy examples/riostream examples/udpong
++@ENABLE_RSOCKET_TRUE@am__append_3 = $(top_srcdir)/include/rdma/rsocket.h
++@ENABLE_RSOCKET_TRUE@am__append_4 = \
++@ENABLE_RSOCKET_TRUE@	man/riostream.1 \
++@ENABLE_RSOCKET_TRUE@	man/rstream.1 \
++@ENABLE_RSOCKET_TRUE@	man/rcopy.1 \
++@ENABLE_RSOCKET_TRUE@	man/rsocket.7
++
+ subdir = .
+ DIST_COMMON = README $(am__configure_deps) \
+ 	$(infinibandinclude_HEADERS) $(librdmacminclude_HEADERS) \
+@@ -93,11 +100,13 @@
+ 	"$(DESTDIR)$(librdmacmincludedir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES) $(rslib_LTLIBRARIES)
+ src_librdmacm_la_LIBADD =
++am__src_librdmacm_la_SOURCES_DIST = src/cma.c src/addrinfo.c src/acm.c \
++	src/indexer.c src/rsocket.c
+ am__dirstamp = $(am__leading_dot)dirstamp
++@ENABLE_RSOCKET_TRUE@am__objects_1 = src/src_librdmacm_la-rsocket.lo
+ am_src_librdmacm_la_OBJECTS = src/src_librdmacm_la-cma.lo \
+ 	src/src_librdmacm_la-addrinfo.lo src/src_librdmacm_la-acm.lo \
+-	src/src_librdmacm_la-rsocket.lo \
+-	src/src_librdmacm_la-indexer.lo
++	src/src_librdmacm_la-indexer.lo $(am__objects_1)
+ src_librdmacm_la_OBJECTS = $(am_src_librdmacm_la_OBJECTS)
+ AM_V_lt = $(am__v_lt_$(V))
+ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+@@ -106,14 +115,22 @@
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ 	$(src_librdmacm_la_CFLAGS) $(CFLAGS) \
+ 	$(src_librdmacm_la_LDFLAGS) $(LDFLAGS) -o $@
+-src_librspreload_la_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+-am_src_librspreload_la_OBJECTS = src/src_librspreload_la-preload.lo \
+-	src/src_librspreload_la-indexer.lo
++@ENABLE_RSOCKET_TRUE@src_librspreload_la_DEPENDENCIES =  \
++@ENABLE_RSOCKET_TRUE@	$(top_builddir)/src/librdmacm.la
++am__src_librspreload_la_SOURCES_DIST = src/preload.c src/indexer.c
++@ENABLE_RSOCKET_TRUE@am_src_librspreload_la_OBJECTS =  \
++@ENABLE_RSOCKET_TRUE@	src/src_librspreload_la-preload.lo \
++@ENABLE_RSOCKET_TRUE@	src/src_librspreload_la-indexer.lo
+ src_librspreload_la_OBJECTS = $(am_src_librspreload_la_OBJECTS)
+ src_librspreload_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ 	$(src_librspreload_la_CFLAGS) $(CFLAGS) \
+ 	$(src_librspreload_la_LDFLAGS) $(LDFLAGS) -o $@
++@ENABLE_RSOCKET_TRUE@am_src_librspreload_la_rpath = -rpath $(rslibdir)
++@ENABLE_RSOCKET_TRUE@am__EXEEXT_1 = examples/rstream$(EXEEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/rcopy$(EXEEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/riostream$(EXEEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/udpong$(EXEEXT)
+ PROGRAMS = $(bin_PROGRAMS)
+ am_examples_cmtime_OBJECTS = examples/cmtime.$(OBJEXT) \
+ 	examples/common.$(OBJEXT)
+@@ -122,9 +139,12 @@
+ am_examples_mckey_OBJECTS = examples/mckey.$(OBJEXT)
+ examples_mckey_OBJECTS = $(am_examples_mckey_OBJECTS)
+ examples_mckey_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+-am_examples_rcopy_OBJECTS = examples/rcopy.$(OBJEXT)
++am__examples_rcopy_SOURCES_DIST = examples/rcopy.c
++@ENABLE_RSOCKET_TRUE@am_examples_rcopy_OBJECTS =  \
++@ENABLE_RSOCKET_TRUE@	examples/rcopy.$(OBJEXT)
+ examples_rcopy_OBJECTS = $(am_examples_rcopy_OBJECTS)
+-examples_rcopy_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_rcopy_DEPENDENCIES =  \
++@ENABLE_RSOCKET_TRUE@	$(top_builddir)/src/librdmacm.la
+ am_examples_rdma_client_OBJECTS = examples/rdma_client.$(OBJEXT)
+ examples_rdma_client_OBJECTS = $(am_examples_rdma_client_OBJECTS)
+ examples_rdma_client_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+@@ -137,17 +157,25 @@
+ am_examples_rdma_xserver_OBJECTS = examples/rdma_xserver.$(OBJEXT)
+ examples_rdma_xserver_OBJECTS = $(am_examples_rdma_xserver_OBJECTS)
+ examples_rdma_xserver_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+-am_examples_riostream_OBJECTS = examples/riostream.$(OBJEXT) \
+-	examples/common.$(OBJEXT)
++am__examples_riostream_SOURCES_DIST = examples/riostream.c \
++	examples/common.c
++@ENABLE_RSOCKET_TRUE@am_examples_riostream_OBJECTS =  \
++@ENABLE_RSOCKET_TRUE@	examples/riostream.$(OBJEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/common.$(OBJEXT)
+ examples_riostream_OBJECTS = $(am_examples_riostream_OBJECTS)
+-examples_riostream_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_riostream_DEPENDENCIES =  \
++@ENABLE_RSOCKET_TRUE@	$(top_builddir)/src/librdmacm.la
+ am_examples_rping_OBJECTS = examples/rping.$(OBJEXT)
+ examples_rping_OBJECTS = $(am_examples_rping_OBJECTS)
+ examples_rping_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+-am_examples_rstream_OBJECTS = examples/rstream.$(OBJEXT) \
+-	examples/common.$(OBJEXT)
++am__examples_rstream_SOURCES_DIST = examples/rstream.c \
++	examples/common.c
++@ENABLE_RSOCKET_TRUE@am_examples_rstream_OBJECTS =  \
++@ENABLE_RSOCKET_TRUE@	examples/rstream.$(OBJEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/common.$(OBJEXT)
+ examples_rstream_OBJECTS = $(am_examples_rstream_OBJECTS)
+-examples_rstream_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_rstream_DEPENDENCIES =  \
++@ENABLE_RSOCKET_TRUE@	$(top_builddir)/src/librdmacm.la
+ am_examples_ucmatose_OBJECTS = examples/cmatose.$(OBJEXT) \
+ 	examples/common.$(OBJEXT)
+ examples_ucmatose_OBJECTS = $(am_examples_ucmatose_OBJECTS)
+@@ -156,10 +184,13 @@
+ 	examples/common.$(OBJEXT)
+ examples_udaddy_OBJECTS = $(am_examples_udaddy_OBJECTS)
+ examples_udaddy_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
+-am_examples_udpong_OBJECTS = examples/udpong.$(OBJEXT) \
+-	examples/common.$(OBJEXT)
++am__examples_udpong_SOURCES_DIST = examples/udpong.c examples/common.c
++@ENABLE_RSOCKET_TRUE@am_examples_udpong_OBJECTS =  \
++@ENABLE_RSOCKET_TRUE@	examples/udpong.$(OBJEXT) \
++@ENABLE_RSOCKET_TRUE@	examples/common.$(OBJEXT)
+ examples_udpong_OBJECTS = $(am_examples_udpong_OBJECTS)
+-examples_udpong_DEPENDENCIES = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_udpong_DEPENDENCIES =  \
++@ENABLE_RSOCKET_TRUE@	$(top_builddir)/src/librdmacm.la
+ DEFAULT_INCLUDES = -I.@am__isrc@
+ depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+ am__depfiles_maybe = depfiles
+@@ -195,21 +226,28 @@
+ 	$(examples_rping_SOURCES) $(examples_rstream_SOURCES) \
+ 	$(examples_ucmatose_SOURCES) $(examples_udaddy_SOURCES) \
+ 	$(examples_udpong_SOURCES)
+-DIST_SOURCES = $(src_librdmacm_la_SOURCES) \
+-	$(src_librspreload_la_SOURCES) $(examples_cmtime_SOURCES) \
+-	$(examples_mckey_SOURCES) $(examples_rcopy_SOURCES) \
++DIST_SOURCES = $(am__src_librdmacm_la_SOURCES_DIST) \
++	$(am__src_librspreload_la_SOURCES_DIST) \
++	$(examples_cmtime_SOURCES) $(examples_mckey_SOURCES) \
++	$(am__examples_rcopy_SOURCES_DIST) \
+ 	$(examples_rdma_client_SOURCES) \
+ 	$(examples_rdma_server_SOURCES) \
+ 	$(examples_rdma_xclient_SOURCES) \
+-	$(examples_rdma_xserver_SOURCES) $(examples_riostream_SOURCES) \
+-	$(examples_rping_SOURCES) $(examples_rstream_SOURCES) \
++	$(examples_rdma_xserver_SOURCES) \
++	$(am__examples_riostream_SOURCES_DIST) \
++	$(examples_rping_SOURCES) $(am__examples_rstream_SOURCES_DIST) \
+ 	$(examples_ucmatose_SOURCES) $(examples_udaddy_SOURCES) \
+-	$(examples_udpong_SOURCES)
++	$(am__examples_udpong_SOURCES_DIST)
+ man1dir = $(mandir)/man1
+ man3dir = $(mandir)/man3
+ man7dir = $(mandir)/man7
+ NROFF = nroff
+ MANS = $(man_MANS)
++am__librdmacminclude_HEADERS_DIST =  \
++	$(top_srcdir)/include/rdma/rdma_cma_abi.h \
++	$(top_srcdir)/include/rdma/rdma_cma.h \
++	$(top_srcdir)/include/rdma/rdma_verbs.h \
++	$(top_srcdir)/include/rdma/rsocket.h
+ HEADERS = $(infinibandinclude_HEADERS) $(librdmacminclude_HEADERS)
+ ETAGS = etags
+ CTAGS = ctags
+@@ -338,25 +376,24 @@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -I$(srcdir)/include
+-rslibdir = $(libdir)/rsocket
++@ENABLE_RSOCKET_TRUE@rslibdir = $(libdir)/rsocket
+ lib_LTLIBRARIES = src/librdmacm.la
+-rslib_LTLIBRARIES = src/librspreload.la
++@ENABLE_RSOCKET_TRUE@rslib_LTLIBRARIES = src/librspreload.la
+ ACLOCAL_AMFLAGS = -I config
+ AM_CFLAGS = -g -Wall -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)\" -DRDMADIR=\"@rdmadir@\"
+ src_librdmacm_la_CFLAGS = $(AM_CFLAGS)
+-src_librspreload_la_CFLAGS = $(AM_CFLAGS)
++@ENABLE_RSOCKET_TRUE@src_librspreload_la_CFLAGS = $(AM_CFLAGS)
+ @HAVE_LD_VERSION_SCRIPT_FALSE@librdmacm_version_script = 
+ @HAVE_LD_VERSION_SCRIPT_TRUE@librdmacm_version_script = -Wl,--version-script=$(srcdir)/src/librdmacm.map
+ src_librdmacm_la_SOURCES = src/cma.c src/addrinfo.c src/acm.c \
+-		src/rsocket.c src/indexer.c
+-
++	src/indexer.c $(am__append_1)
+ src_librdmacm_la_LDFLAGS = -version-info 1 -export-dynamic \
+ 			   $(librdmacm_version_script)
+ 
+ src_librdmacm_la_DEPENDENCIES = $(srcdir)/src/librdmacm.map
+-src_librspreload_la_SOURCES = src/preload.c src/indexer.c
+-src_librspreload_la_LDFLAGS = -version-info 1 -export-dynamic
+-src_librspreload_la_LIBADD = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@src_librspreload_la_SOURCES = src/preload.c src/indexer.c
++@ENABLE_RSOCKET_TRUE@src_librspreload_la_LDFLAGS = -version-info 1 -export-dynamic
++@ENABLE_RSOCKET_TRUE@src_librspreload_la_LIBADD = $(top_builddir)/src/librdmacm.la
+ examples_ucmatose_SOURCES = examples/cmatose.c examples/common.c
+ examples_ucmatose_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_rping_SOURCES = examples/rping.c
+@@ -373,23 +410,21 @@
+ examples_rdma_xclient_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_rdma_xserver_SOURCES = examples/rdma_xserver.c
+ examples_rdma_xserver_LDADD = $(top_builddir)/src/librdmacm.la
+-examples_rstream_SOURCES = examples/rstream.c examples/common.c
+-examples_rstream_LDADD = $(top_builddir)/src/librdmacm.la
+-examples_riostream_SOURCES = examples/riostream.c examples/common.c
+-examples_riostream_LDADD = $(top_builddir)/src/librdmacm.la
+-examples_rcopy_SOURCES = examples/rcopy.c
+-examples_rcopy_LDADD = $(top_builddir)/src/librdmacm.la
+-examples_udpong_SOURCES = examples/udpong.c examples/common.c
+-examples_udpong_LDADD = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_rstream_SOURCES = examples/rstream.c examples/common.c
++@ENABLE_RSOCKET_TRUE@examples_rstream_LDADD = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_riostream_SOURCES = examples/riostream.c examples/common.c
++@ENABLE_RSOCKET_TRUE@examples_riostream_LDADD = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_rcopy_SOURCES = examples/rcopy.c
++@ENABLE_RSOCKET_TRUE@examples_rcopy_LDADD = $(top_builddir)/src/librdmacm.la
++@ENABLE_RSOCKET_TRUE@examples_udpong_SOURCES = examples/udpong.c examples/common.c
++@ENABLE_RSOCKET_TRUE@examples_udpong_LDADD = $(top_builddir)/src/librdmacm.la
+ examples_cmtime_SOURCES = examples/cmtime.c examples/common.c
+ examples_cmtime_LDADD = $(top_builddir)/src/librdmacm.la
+ librdmacmincludedir = $(includedir)/rdma
+ infinibandincludedir = $(includedir)/infiniband
+ librdmacminclude_HEADERS = $(top_srcdir)/include/rdma/rdma_cma_abi.h \
+-			   $(top_srcdir)/include/rdma/rdma_cma.h \
+-			   $(top_srcdir)/include/rdma/rdma_verbs.h \
+-			   $(top_srcdir)/include/rdma/rsocket.h
+-
++	$(top_srcdir)/include/rdma/rdma_cma.h \
++	$(top_srcdir)/include/rdma/rdma_verbs.h $(am__append_3)
+ infinibandinclude_HEADERS = $(top_srcdir)/include/infiniband/ib.h
+ man_MANS = \
+ 	man/rdma_accept.3 \
+@@ -449,11 +484,8 @@
+ 	man/rdma_client.1 \
+ 	man/rdma_xserver.1 \
+ 	man/rdma_xclient.1 \
+-	man/riostream.1 \
+-	man/rstream.1 \
+-	man/rcopy.1 \
+ 	man/rdma_cm.7 \
+-	man/rsocket.7
++	$(am__append_4)
+ 
+ EXTRA_DIST = src/cma.h src/indexer.h src/librdmacm.map \
+ 	examples/common.h librdmacm.spec.in $(man_MANS)
+diff -r 276da03b3ce0 configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Mon Nov 16 17:13:21 2015 -0800
+@@ -747,6 +747,8 @@
+ am__EXEEXT_TRUE
+ LTLIBOBJS
+ LIBOBJS
++ENABLE_RSOCKET_FALSE
++ENABLE_RSOCKET_TRUE
+ rdmadir
+ HAVE_LD_VERSION_SCRIPT_FALSE
+ HAVE_LD_VERSION_SCRIPT_TRUE
+@@ -870,6 +872,7 @@
+ enable_libtool_lock
+ with_valgrind
+ enable_libcheck
++enable_rsocket_utils
+ '
+       ac_precious_vars='build_alias
+ host_alias
+@@ -1511,6 +1514,7 @@
+   --enable-dependency-tracking   do not reject slow dependency extractors
+   --disable-libtool-lock  avoid locking (might break parallel builds)
+   --disable-libcheck      do not test for presence of ib libraries
++  --enable-rsocket-utils build rsocket (default=no)
+ 
+ Optional Packages:
+   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+@@ -11830,6 +11834,30 @@
+ 
+ fi
+ 
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-rsocket-utils" >&5
++$as_echo_n "checking for --enable-rsocket-utils... " >&6; }
++# Check whether --enable-rsocket-utils was given.
++if test "${enable_rsocket_utils+set}" = set; then :
++  enableval=$enable_rsocket_utils; case "${enableval}" in
++  yes) rsocketutils=yes ;;
++  no)  rsocketutils=no ;;
++  *) as_fn_error $? "bad value ${enableval} for --enable-rsocket-utils" "$LINENO" 5 ;;
++esac
++else
++  rsocketutils=no
++fi
++
++ if test x$rsocketutils = xyes; then
++  ENABLE_RSOCKET_TRUE=
++  ENABLE_RSOCKET_FALSE='#'
++else
++  ENABLE_RSOCKET_TRUE='#'
++  ENABLE_RSOCKET_FALSE=
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${rsocketutils=no}" >&5
++$as_echo "${rsocketutils=no}" >&6; }
++
+ ac_config_files="$ac_config_files Makefile librdmacm.spec"
+ 
+ cat >confcache <<\_ACEOF
+@@ -11954,6 +11982,10 @@
+   as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${ENABLE_RSOCKET_TRUE}" && test -z "${ENABLE_RSOCKET_FALSE}"; then
++  as_fn_error $? "conditional \"ENABLE_RSOCKET\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ 
+ : ${CONFIG_STATUS=./config.status}
+ ac_write_fail=0
+diff -r 276da03b3ce0 configure.ac
+--- a/configure.ac	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure.ac	Mon Nov 16 17:13:21 2015 -0800
+@@ -104,5 +104,17 @@
+    AC_SUBST(rdmadir, rdma)
+ fi
+ 
++dnl Check if we should include rsocket utilities and examples 
++AC_MSG_CHECKING(for --enable-rsocket-utils)
++AC_ARG_ENABLE(rsocket-utils,
++[  --enable-rsocket-utils build rsocket (default=no)],
++[case "${enableval}" in
++  yes) rsocketutils=yes ;;
++  no)  rsocketutils=no ;;
++  *) AC_MSG_ERROR(bad value ${enableval} for --enable-rsocket-utils) ;;
++esac],[rsocketutils=no])
++AM_CONDITIONAL(ENABLE_RSOCKET, test x$rsocketutils = xyes)
++AC_MSG_RESULT(${rsocketutils=no})
++
+ AC_CONFIG_FILES([Makefile librdmacm.spec])
+ AC_OUTPUT
+diff -r 276da03b3ce0 examples/common.c
+--- a/examples/common.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/common.c	Mon Nov 16 17:13:21 2015 -0800
+@@ -45,7 +45,11 @@
+ #include <rdma/rdma_cma.h>
+ #include "common.h"
+ 
++#if ENABLE_RSOCKET
+ int use_rs = 1;
++#else
++int use_rs = 0;
++#endif
+ 
+ int get_rdma_addr(char *src, char *dst, char *port,
+ 		  struct rdma_addrinfo *hints, struct rdma_addrinfo **rai)
+diff -r 276da03b3ce0 examples/common.h
+--- a/examples/common.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/examples/common.h	Mon Nov 16 17:13:21 2015 -0800
+@@ -51,6 +51,7 @@
+ 
+ extern int use_rs;
+ 
++#if ENABLE_RSOCKET 
+ #define rs_socket(f,t,p)  use_rs ? rsocket(f,t,p)  : socket(f,t,p)
+ #define rs_bind(s,a,l)    use_rs ? rbind(s,a,l)    : bind(s,a,l)
+ #define rs_listen(s,b)    use_rs ? rlisten(s,b)    : listen(s,b)
+@@ -71,6 +72,30 @@
+ #define rs_getsockopt(s,l,n,v,ol) \
+ 	use_rs ? rgetsockopt(s,l,n,v,ol) : getsockopt(s,l,n,v,ol)
+ 
++#else
++
++#define rs_socket(f,t,p)  socket(f,t,p)
++#define rs_bind(s,a,l)    bind(s,a,l)
++#define rs_listen(s,b)    listen(s,b)
++#define rs_connect(s,a,l) connect(s,a,l)
++#define rs_accept(s,a,l)  accept(s,a,l)
++#define rs_shutdown(s,h)  shutdown(s,h)
++#define rs_close(s)       close(s)
++#define rs_recv(s,b,l,f)  recv(s,b,l,f)
++#define rs_send(s,b,l,f)  send(s,b,l,f)
++#define rs_recvfrom(s,b,l,f,a,al) \
++	recvfrom(s,b,l,f,a,al)
++#define rs_sendto(s,b,l,f,a,al) \
++	sendto(s,b,l,f,a,al)
++#define rs_poll(f,n,t)	  poll(f,n,t)
++#define rs_fcntl(s,c,p)   fcntl(s,c,p)
++#define rs_setsockopt(s,l,n,v,ol) \
++	setsockopt(s,l,n,v,ol)
++#define rs_getsockopt(s,l,n,v,ol) \
++	getsockopt(s,l,n,v,ol)
++
++#endif
++
+ union socket_addr {
+ 	struct sockaddr		sa;
+ 	struct sockaddr_in	sin;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/002-librdmacm-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,623 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  b5e87c2d333b6adb2743deb20bd5d68a754ea03f
+Add solaris specific changes for librdmacm
+
+Added the changes required to compile and work with the Solaris
+system.
+
+diff -r b5e87c2d333b Makefile.am
+--- a/Makefile.am	Wed Nov 18 11:01:02 2015 -0800
++++ b/Makefile.am	Thu Nov 19 11:18:58 2015 -0800
+@@ -143,6 +143,7 @@
+ 	man/rdma_client.1 \
+ 	man/rdma_xserver.1 \
+ 	man/rdma_xclient.1 \
++	man/cmtime.1 \
+ 	man/rdma_cm.7 
+ 
+ if ENABLE_RSOCKET
+diff -r b5e87c2d333b Makefile.in
+--- a/Makefile.in	Wed Nov 18 11:01:02 2015 -0800
++++ b/Makefile.in	Thu Nov 19 11:18:58 2015 -0800
+@@ -484,6 +484,7 @@
+ 	man/rdma_client.1 \
+ 	man/rdma_xserver.1 \
+ 	man/rdma_xclient.1 \
++	man/cmtime.1 \
+ 	man/rdma_cm.7 \
+ 	$(am__append_4)
+ 
+diff -r b5e87c2d333b examples/cmatose.c
+--- a/examples/cmatose.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/cmatose.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -40,7 +40,9 @@
+ #include <netinet/in.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <getopt.h>
+ 
+ #include <rdma/rdma_cma.h>
+diff -r b5e87c2d333b examples/common.c
+--- a/examples/common.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/common.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -40,7 +40,9 @@
+ #include <netinet/in.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ 
+ #include <rdma/rdma_cma.h>
+ #include "common.h"
+diff -r b5e87c2d333b examples/common.h
+--- a/examples/common.h	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/common.h	Thu Nov 19 11:18:58 2015 -0800
+@@ -34,7 +34,9 @@
+ 
+ #include <stdlib.h>
+ #include <sys/types.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <poll.h>
+ 
+ #include <rdma/rdma_cma.h>
+diff -r b5e87c2d333b examples/mckey.c
+--- a/examples/mckey.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/mckey.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -41,7 +41,9 @@
+ #include <arpa/inet.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <unistd.h>
+ #include <getopt.h>
+ 
+@@ -329,6 +331,16 @@
+ 
+ 	while (1) {
+ 		ret = rdma_get_cm_event(test.channel, &event);
++
++/* 
++ * Solaris returns EBADF if we close the channel while we're waiting
++ * for any events to occur. It is safe to ignore EBADF here.
++ */
++#if defined(__SVR4) && defined(__sun)
++		if (ret && (errno == EBADF))
++			break;
++#endif
++
+ 		if (ret) {
+ 			perror("rdma_get_cm_event");
+ 			break;
+@@ -461,6 +473,8 @@
+ 	return ret;
+ }
+ 
++/* Solaris does not yet support family AF_IB */
++#if !(defined(__SVR4) && defined(__sun))
+ static int get_dst_addr(char *dst, struct sockaddr *addr)
+ {
+ 	struct sockaddr_ib *sib;
+@@ -474,6 +488,7 @@
+ 	inet_pton(AF_INET6, dst, &sib->sib_addr);
+ 	return 0;
+ }
++#endif
+ 
+ static int run(void)
+ {
+@@ -486,7 +501,12 @@
+ 			return ret;
+ 	}
+ 
++/* Solaris does not yet support family AF_IB */
++#if defined(__SVR4) && defined(__sun)
++	ret = get_addr(dst_addr, (struct sockaddr *) &test.dst_in);
++#else
+ 	ret = get_dst_addr(dst_addr, (struct sockaddr *) &test.dst_in);
++#endif
+ 	if (ret)
+ 		return ret;
+ 
+diff -r b5e87c2d333b examples/rping.c
+--- a/examples/rping.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/rping.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -40,11 +40,17 @@
+ #include <netinet/in.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <semaphore.h>
+ #include <arpa/inet.h>
+ #include <pthread.h>
+ #include <inttypes.h>
++#if defined(__SVR4) && defined(__sun)
++#include <unistd.h>
++#include <libgen.h>
++#endif
+ 
+ #include <rdma/rdma_cma.h>
+ #include <infiniband/arch.h>
+@@ -572,9 +578,15 @@
+ 
+ 	while (1) {
+ 		ret = rdma_get_cm_event(cb->cm_channel, &event);
+-		if (ret) {
++		/*
++		 * If the retry of read() syscall returned EBADF, as the
++		 * file was closed on process exit. Ignore this error.
++		 */
++		if (ret && errno != EBADF) {
+ 			perror("rdma_get_cm_event");
+ 			exit(ret);
++		} else if (ret && errno == EBADF) {
++			exit(0);
+ 		}
+ 		ret = rping_cma_event_handler(event->id, event);
+ 		rdma_ack_cm_event(event);
+@@ -596,8 +608,14 @@
+ 		pthread_testcancel();
+ 
+ 		ret = ibv_get_cq_event(cb->channel, &ev_cq, &ev_ctx);
+-		if (ret) {
++		/*
++		 * If the retry of write() syscall returned EBADF, as the
++		 * file was closed on process exit. Ignore this error.
++		 */
++		if (ret && errno != EBADF) {
+ 			fprintf(stderr, "Failed to get cq event!\n");
++			 pthread_exit(NULL);
++		} else if (ret && errno == EBADF) {
+ 			pthread_exit(NULL);
+ 		}
+ 		if (ev_cq != cb->cq) {
+diff -r b5e87c2d333b examples/udaddy.c
+--- a/examples/udaddy.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/examples/udaddy.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -40,7 +40,9 @@
+ #include <netinet/in.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <getopt.h>
+ 
+ #include <rdma/rdma_cma.h>
+diff -r b5e87c2d333b include/infiniband/ib.h
+--- a/include/infiniband/ib.h	Wed Nov 18 11:01:02 2015 -0800
++++ b/include/infiniband/ib.h	Thu Nov 19 11:18:58 2015 -0800
+@@ -33,7 +33,11 @@
+ #if !defined(_RDMA_IB_H)
+ #define _RDMA_IB_H
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <linux/types.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ #include <string.h>
+ 
+ #ifndef AF_IB
+diff -r b5e87c2d333b include/rdma/rdma_cma_abi.h
+--- a/include/rdma/rdma_cma_abi.h	Wed Nov 18 11:01:02 2015 -0800
++++ b/include/rdma/rdma_cma_abi.h	Thu Nov 19 11:18:58 2015 -0800
+@@ -113,6 +113,7 @@
+ 	__u64 response;
+ 	struct sockaddr_in6 addr;
+ 	__u32 id;
++	uint32_t	reserved;
+ };
+ 
+ struct ucma_abi_bind {
+@@ -291,6 +292,7 @@
+ 	__u64 uid;
+ 	struct sockaddr_in6 addr;
+ 	__u32 id;
++	uint32_t	reserved;
+ };
+ 
+ struct ucma_abi_join_mcast {
+diff -r b5e87c2d333b man/cmtime.1
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/man/cmtime.1	Thu Nov 19 11:18:58 2015 -0800
+@@ -0,0 +1,45 @@
++.TH "CMTIME" 1 "2015-11-19" "librdmacm" "librdmacm" librdmacm
++.SH NAME
++cmtime \- sample program that times rdma cm calls
++.SH SYNOPSIS
++.sp
++.nf
++\fIcmtime\fR [-s server_address] [-b bind_address] [-c connections]
++		[-p port_number] [-t timeout_ms]
++\fIcmtime\fR -s server_address [-b bind_address] [-c connections]
++		[-p port_number] [-t timeout_ms]
++.fi
++.SH "DESCRIPTION"
++Measures how long it takes for each step in the RDMA connection
++process to complete. It can be used to analyze the performance of
++the various CM steps.
++.SH "OPTIONS"
++.TP
++\-s server_address
++The IP address of the server system listening for connections.
++The used address must route over an RDMA device.This option must be 
++specified by the client.
++.TP
++\-b bind_address
++The local network address to bind to.
++.TP
++\-c connections
++The number of connections to establish between the client and server.
++(default 100)
++.TP
++\-p port_number
++Specifies the port number that the server listens on.  By default the server
++listens on port 7471.
++.TP
++\-t timeout_ms
++Specifies the timeout value in milliseconds for which it would try to 
++resolve the given IP address. By default, the value is 2000ms
++.SH "NOTES"
++Basic usage is to start cmtime on a server system, then run
++cmtime -s server_name on a client system.
++.P
++Because this test maps RDMA resources to userspace, users must ensure
++that they have available system resources and permissions.  See the
++libibverbs README file for additional details.
++.SH "SEE ALSO"
++rdma_cm(7), udaddy(1), rping(1), ucmatose(1), mckey(1)
+diff -r b5e87c2d333b man/rdma_cm.7
+--- a/man/rdma_cm.7	Wed Nov 18 11:01:02 2015 -0800
++++ b/man/rdma_cm.7	Thu Nov 19 11:18:58 2015 -0800
+@@ -19,7 +19,7 @@
+ API defined by the libibverbs library.  The libibverbs library provides the
+ underlying interfaces needed to send and receive data.
+ .P
+-The RDMA CM can operate asynchronously or synchronously.  The mode of
++The RDMA CM can operate asynchronously.  The mode of
+ operation is controlled by the user through the use of the rdma_cm event channel
+ parameter in specific calls.  If an event channel is provided, an rdma_cm identifier
+ will report its event data (results of connecting, for example), on that channel.
+@@ -31,44 +31,10 @@
+ of the more commonly used verbs funcationality.  The full set of abstracted
+ verb calls are:
+ .P
+-rdma_reg_msgs  - register an array of buffers for sending and receiving
+-.P
+-rdma_reg_read  - registers a buffer for RDMA read operations
+-.P
+-rdma_reg_write - registers a buffer for RDMA write operations
+-.P
+-rdma_dereg_mr  - deregisters a memory region
+-.P
+-rdma_post_recv  - post a buffer to receive a message
+-.P
+-rdma_post_send  - post a buffer to send a message
+-.P
+-rdma_post_read  - post an RDMA to read data into a buffer
+-.P
+-rdma_post_write - post an RDMA to send data from a buffer
+-.P
+-rdma_post_recvv  - post a vector of buffers to receive a message
+-.P
+-rdma_post_sendv  - post a vector of buffers to send a message
+-.P
+-rdma_post_readv  - post a vector of buffers to receive an RDMA read
+-.P
+-rdma_post_writev - post a vector of buffers to send an RDMA write
+-.P
+-rdma_post_ud_send - post a buffer to send a message on a UD QP
+-.P
+-rdma_get_send_comp - get completion status for a send or RDMA operation
+-.P
+-rdma_get_recv_comp - get information about a completed receive
+ .SH "CLIENT OPERATION"
+ This section provides a general overview of the basic operation for the active,
+ or client, side of communication.  This flow assume asynchronous operation with
+-low level call details shown.  For
+-synchronous operation, calls to rdma_create_event_channel, rdma_get_cm_event,
+-rdma_ack_cm_event, and rdma_destroy_event_channel
+-would be eliminated.  Abstracted calls, such as rdma_create_ep encapsulate
+-serveral of these calls under a single API.
+-Users may also refer to the example applications for
++low level call details shown.  Users may also refer to the example applications for
+ code samples.  A general connection flow would be:
+ .IP rdma_getaddrinfo
+ retrieve address information of the destination
+@@ -178,12 +144,9 @@
+ rdma_ack_cm_event(3),
+ rdma_bind_addr(3),
+ rdma_connect(3),
+-rdma_create_ep(3),
+ rdma_create_event_channel(3),
+ rdma_create_id(3),
+ rdma_create_qp(3),
+-rdma_dereg_mr(3),
+-rdma_destroy_ep(3),
+ rdma_destroy_event_channel(3),
+ rdma_destroy_id(3),
+ rdma_destroy_qp(3),
+@@ -196,27 +159,11 @@
+ rdma_get_dst_port(3),
+ rdma_get_local_addr(3),
+ rdma_get_peer_addr(3),
+-rdma_get_recv_comp(3),
+-rdma_get_request(3),
+-rdma_get_send_comp(3),
+ rdma_get_src_port(3),
+ rdma_join_multicast(3),
+ rdma_leave_multicast(3),
+ rdma_listen(3),
+-rdma_migrate_id(3),
+ rdma_notify(3),
+-rdma_post_read(3)
+-rdma_post_readv(3),
+-rdma_post_recv(3),
+-rdma_post_recvv(3),
+-rdma_post_send(3),
+-rdma_post_sendv(3),
+-rdma_post_ud_send(3),
+-rdma_post_write(3),
+-rdma_post_writev(3),
+-rdma_reg_msgs(3),
+-rdma_reg_read(3),
+-rdma_reg_write(3),
+ rdma_reject(3),
+ rdma_resolve_addr(3),
+ rdma_resolve_route(3),
+diff -r b5e87c2d333b man/rdma_set_option.3
+--- a/man/rdma_set_option.3	Wed Nov 18 11:01:02 2015 -0800
++++ b/man/rdma_set_option.3	Thu Nov 19 11:18:58 2015 -0800
+@@ -14,16 +14,26 @@
+ .IP "id" 12
+ RDMA identifier.
+ .IP "level" 12
+-Protocol level of the option to set.
++Protocol level of the option to set.  Currently level RDMA_OPTION_ID is supported.
+ .IP "optname" 12
+-Name of the option, relative to the level, to set.
++Name of the option, relative to the level, to set.  The only supported option isRDMA_OPTION_ID_REUSEADDR for level RDMA_OPTION_ID.
+ .IP "optval" 12
+-Reference to the option data.  The data is dependent on the level and optname.
++Reference to the option data.  The data is dependent on the level and optname.  For the option RDMA_OPTION_ID_REUSEADDR, an integer is passed.
+ .IP "optlen" 12
+ The size of the %optval buffer.
+ .SH "DESCRIPTION"
+ Sets communication options for an rdma_cm_id.  This call is used to override
+ the default system settings.
++.sp
++The RDMA_OPTION_ID_REUSEADDR option can be used to enable or
++disable REUSEADDR option for a CMID. A value of 0 disables
++the option and a non-zero value enables the option. This
++option can be set before calling rdma_bind_addr(3) or the
++rdma_resolve_addr(3) API. Listening for connection requests,
++using rdma_listen(3), is not supported for CMIDs set with
++this option. This option enables multiple connections to share
++the same source IP Port on the active side of the connection.
++.sp
+ .SH "RETURN VALUE"
+ Returns 0 on success, or -1 on error.  If an error occurs, errno will be
+ set to indicate the failure reason.
+diff -r b5e87c2d333b src/addrinfo.c
+--- a/src/addrinfo.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/src/addrinfo.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -132,9 +132,16 @@
+ 	(*dst)->sib_family = AF_IB;
+ 	(*dst)->sib_pkey = 0xFFFF;
+ 	(*dst)->sib_flowinfo = src->sin6_flowinfo;
++#if !(defined(__SVR4) && defined(__sun))
+ 	ib_addr_set(&(*dst)->sib_addr, src->sin6_addr.s6_addr32[0],
+ 		    src->sin6_addr.s6_addr32[1], src->sin6_addr.s6_addr32[2],
+ 		    src->sin6_addr.s6_addr32[3]);
++#else
++	ib_addr_set(&(*dst)->sib_addr, src->sin6_addr._S6_un._S6_u32[0],
++		    src->sin6_addr._S6_un._S6_u32[1], src->sin6_addr._S6_un._S6_u32[2],
++		    src->sin6_addr._S6_un._S6_u32[3]);
++#endif
++
+ 	ucma_set_sid(ps, (struct sockaddr *) src, *dst);
+ 	(*dst)->sib_scope_id = src->sin6_scope_id;
+ 
+diff -r b5e87c2d333b src/cma.c
+--- a/src/cma.c	Wed Nov 18 11:01:02 2015 -0800
++++ b/src/cma.c	Thu Nov 19 11:18:58 2015 -0800
+@@ -44,8 +44,13 @@
+ #include <poll.h>
+ #include <unistd.h>
+ #include <pthread.h>
++#if defined(__SVR4) && defined(__sun)
++#include <sys/stat.h>
++#include <sys/mkdev.h>
++#else
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ #include <stddef.h>
+ #include <netdb.h>
+ #include <syslog.h>
+@@ -53,6 +58,7 @@
+ 
+ #include "cma.h"
+ #include "indexer.h"
++#include <infiniband/arch.h>
+ #include <infiniband/driver.h>
+ #include <infiniband/marshall.h>
+ #include <rdma/rdma_cma.h>
+@@ -154,7 +160,6 @@
+ 
+ 		fastlock_destroy(&idm_lock);
+ 		free(cma_dev_array);
+-		cma_dev_cnt = 0;
+ 	}
+ }
+ 
+@@ -173,12 +178,17 @@
+ 		 * backports, assume the most recent version of the ABI.  If
+ 		 * we're wrong, we'll simply fail later when calling the ABI.
+ 		 */
++		fprintf(stderr, "librdmacm: couldn't read ABI version.\n");
++		fprintf(stderr, "librdmacm: assuming: %d\n", abi_ver);
+ 		return 0;
+ 	}
+ 
+ 	abi_ver = strtol(value, NULL, 10);
+ 	if (abi_ver < RDMA_USER_CM_MIN_ABI_VERSION ||
+ 	    abi_ver > RDMA_USER_CM_MAX_ABI_VERSION) {
++		fprintf(stderr, "librdmacm: kernel ABI version %d "
++				"doesn't match library version %d.\n",
++				abi_ver, RDMA_USER_CM_MAX_ABI_VERSION);
+ 		return -1;
+ 	}
+ 	return 0;
+@@ -232,11 +242,13 @@
+ 
+ 	dev_list = ibv_get_device_list(&dev_cnt);
+ 	if (!dev_list) {
++		printf("CMA: unable to get RDMA device list\n");
+ 		ret = ERR(ENODEV);
+ 		goto err1;
+ 	}
+ 
+ 	if (!dev_cnt) {
++		printf("CMA: no RDMA devices found\n");
+ 		ret = ERR(ENODEV);
+ 		goto err2;
+ 	}
+@@ -272,6 +284,7 @@
+ 
+ 	dev_list = ibv_get_device_list(NULL);
+ 	if (!dev_list) {
++		fprintf(stderr, PFX "Fatal: unable to get RDMA device list\n");
+ 		return NULL;
+ 	}
+ 
+@@ -282,6 +295,9 @@
+ 		}
+ 	}
+ 
++	if (!verbs)
++		fprintf(stderr, PFX "Fatal: unable to open RDMA device\n");
++
+ 	ibv_free_device_list(dev_list);
+ 	return verbs;
+ }
+@@ -301,6 +317,7 @@
+ 
+ 	ret = ibv_query_device(cma_dev->verbs, &attr);
+ 	if (ret) {
++		fprintf(stderr, PFX "Fatal: unable to query RDMA device\n");
+ 		ret = ERR(ret);
+ 		goto err;
+ 	}
+@@ -396,8 +413,18 @@
+ 	if (!channel)
+ 		return NULL;
+ 
++#if defined(__SVR4) && defined(__sun)
++	channel->fd = open("/dev/infiniband/ofs/rdma_cm", O_RDWR | O_CLOEXEC);
++#else
+ 	channel->fd = open("/dev/infiniband/rdma_cm", O_RDWR | O_CLOEXEC);
++#endif
++
+ 	if (channel->fd < 0) {
++#if defined(__SVR4) && defined(__sun)
++		printf("CMA: unable to open /dev/infiniband/ofs/rdma_cm\n");
++#else
++		printf("CMA: unable to open /dev/infiniband/rdma_cm\n");
++#endif
+ 		goto err;
+ 	}
+ 	return channel;
+@@ -1388,6 +1415,14 @@
+ 	if (ret)
+ 		return ret;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * The 31st bit of sq_sig_all is set for QPs allocated
++	 * using librdmacm. Consumers use sq_sig_all 0 /1.
++	 */
++	attr->sq_sig_all |= LIB_RDMACM_QP_BIT;
++#endif
++
+ 	if (!attr->send_cq)
+ 		attr->send_cq = id->send_cq;
+ 	if (!attr->recv_cq)
+@@ -2018,6 +2053,9 @@
+ 
+ 	CMA_INIT_CMD(&cmd, sizeof cmd, ACCEPT);
+ 	cmd.id = id_priv->handle;
++#if defined(__SVR4) && defined(__sun)
++	cmd.conn_param.qp_num = ((id_priv->id).qp)->qp_num;
++#endif
+ 
+ 	ret = write(id_priv->id.channel->fd, &cmd, sizeof cmd);
+ 	if (ret != sizeof cmd) {
+@@ -2300,7 +2338,23 @@
+ 
+ 	CMA_INIT_CMD_RESP(&cmd, sizeof cmd, MIGRATE_ID, &resp, sizeof resp);
+ 	cmd.id = id_priv->handle;
++
++#if !(defined(__SVR4) && defined(__sun))
+ 	cmd.fd = id->channel->fd;
++#else
++	{
++		/* Solaris has no way of mapping fd back to the cloned device 
++		 * created during open() system call. It can only map the minor 
++		 * number to cloned device.
++		 */
++		struct stat	fstat_buf;
++		int		rc;
++
++		if ((rc = fstat(id->channel->fd, &fstat_buf)) != 0)
++			return (ERR(ENODATA));
++		cmd.fd = minor(fstat_buf.st_rdev);
++	}
++#endif
+ 
+ 	ret = write(channel->fd, &cmd, sizeof cmd);
+ 	if (ret != sizeof cmd) {
+diff -r b5e87c2d333b src/cma.h
+--- a/src/cma.h	Wed Nov 18 11:01:02 2015 -0800
++++ b/src/cma.h	Thu Nov 19 11:18:58 2015 -0800
+@@ -40,8 +40,11 @@
+ 
+ #include <stdlib.h>
+ #include <errno.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
++
+ #include <semaphore.h>
+ 
+ #include <rdma/rdma_cma.h>
+@@ -60,6 +63,7 @@
+ 
+ #define PFX "librdmacm: "
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ static inline uint64_t htonll(uint64_t x) { return bswap_64(x); }
+ static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); }
+@@ -67,6 +71,7 @@
+ static inline uint64_t htonll(uint64_t x) { return x; }
+ static inline uint64_t ntohll(uint64_t x) { return x; }
+ #endif
++#endif
+ 
+ #define max(a, b) ((a) > (b) ? a : b)
+ #define min(a, b) ((a) < (b) ? a : b)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/003-librdmacm-22219198-cmtime-handle-invalid-address-for-bind-addr.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,50 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  c45c7e5a56f16c37b46ec2376d2eac3c924a2473
+22219198 - librdmacm: cmtime gets segmentation fault when given invalid argument with -b
+
+When -b option is passed an invalid address, the example crashes with Segmentation Fault.
+Fixed the error by cleaning and exiting the example once the error is encountered.
+Also, ignore the error print when EBADF error is encountered in rdma_get_cm_event
+
+diff -r c45c7e5a56f1 examples/cmtime.c
+--- a/examples/cmtime.c	Mon Nov 16 17:47:33 2015 -0800
++++ b/examples/cmtime.c	Mon Nov 16 18:01:01 2015 -0800
+@@ -420,8 +420,14 @@
+ 		if (!ret) {
+ 			cma_handler(event->id, event);
+ 		} else {
+-			perror("failure in rdma_get_cm_event in process_server_events");
+-			ret = errno;
++			/*
++			 * If the retry of read() syscall returned EBADF, as the
++			 * file was closed on process exit. Ignore this error.
++			 */
++			if (!(ret && errno == EBADF)) {
++				perror("failure in rdma_get_cm_event in process_server_events");
++				ret = errno;
++			}
+ 		}
+ 	}
+ 	return NULL;
+@@ -680,6 +686,11 @@
+ 	} else {
+ 		hints.ai_flags |= RAI_PASSIVE;
+ 		ret = run_server();
++		/* Check if server setup fails */
++		if (ret != 0) {
++			rdma_destroy_event_channel(channel);
++			goto out;
++		}
+ 	}
+ 
+ 	cleanup_nodes();
+@@ -689,5 +700,6 @@
+ 
+ 	show_perf();
+ 	free(nodes);
++	out:
+ 	return ret;
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/004-librdmacm-remove-comments-for-XRC-support-from-man-pages.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,36 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  9b6cc8c68b03b28d0b674dbf0fec4e6e143bd185
+Added comments for XRC support not available in the man pages
+
+diff -r 9b6cc8c68b03 man/rdma_create_id.3
+--- a/man/rdma_create_id.3	Thu Nov 19 11:19:08 2015 -0800
++++ b/man/rdma_create_id.3	Fri Dec 04 17:46:54 2015 -0800
+@@ -48,7 +48,7 @@
+ Provides unreliable, connectionless QP communication.  Supports both datagram
+ and multicast communication.
+ .IP RDMA_PS_IB
+-Provides for any IB services (UD, UC, RC, XRC, etc.).
++Provides for any IB services (UD, UC, RC, etc.). Currently, it does not support XRC.
+ .SH "SEE ALSO"
+ rdma_cm(7), rdma_create_event_channel(3), rdma_destroy_id(3), rdma_get_devices(3),
+ rdma_bind_addr(3), rdma_resolve_addr(3), rdma_connect(3), rdma_listen(3),
+diff -r 9b6cc8c68b03 man/rdma_create_srq.3
+--- a/man/rdma_create_srq.3	Thu Nov 19 11:19:08 2015 -0800
++++ b/man/rdma_create_srq.3	Fri Dec 04 17:46:54 2015 -0800
+@@ -35,10 +35,12 @@
+ allocated by the rdma_cm for the SRQ, along with corresponding completion
+ channels.  Completion channels and CQ data created by the rdma_cm are
+ exposed to the user through the rdma_cm_id structure.
++Currently, the creation of XRC SRQs are not supported by this function in
++the Solaris specific implementation.
+ .P
+ The actual capabilities and properties of the created SRQ will be
+ returned to the user through the attr parameter.  An rdma_cm_id
+-may only be associated with a single SRQ.
++may only be associated with a single SRQ. 
+ .SH "SEE ALSO"
+ rdma_bind_addr(3), rdma_resolve_addr(3), rdma_create_ep(3),
+ rdma_destroy_srq(3), ibv_create_srq(3), ibv_create_xsrq(3)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/005-librdmacm-fix-core-dump-in-rping-client-without-running-server.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,63 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+# HG changeset patch
+# Parent  68a7383fdd511ce1ea9a0dfc24404b3d74e67055
+
+diff -r 68a7383fdd51 examples/rping.c
+--- a/examples/rping.c	Tue Mar 15 19:57:38 2016 -0700
++++ b/examples/rping.c	Thu Mar 17 00:08:03 2016 -0700
+@@ -88,6 +88,7 @@
+ 	RDMA_READ_COMPLETE,
+ 	RDMA_WRITE_ADV,
+ 	RDMA_WRITE_COMPLETE,
++	CALLING_DISCONNECT,
+ 	DISCONNECTED,
+ 	ERROR
+ };
+@@ -290,6 +291,20 @@
+ 
+ 		if (wc.status) {
+ 			if (wc.status == IBV_WC_WR_FLUSH_ERR) {
++				/*
++				 * FLUSH Error can be polled before RDMA-CM
++				 * DISCONNECT is notified. Ensure that cb_state
++				 * is set appropriately in such a case.
++				 * sleep for sometime if Disconnect has not
++				 * been called. The FLUSH WR can be because
++				 * the remote end initiated the disconnect.
++				 */
++				if (!(cb->state == CALLING_DISCONNECT || cb->state == DISCONNECTED))
++					sleep(2);
++
++				if (cb->state == DISCONNECTED)
++					return (0);
++
+ 				flushed = 1;
+ 				continue;
+ 
+@@ -824,7 +839,9 @@
+ 	}
+ 
+ 	rping_test_server(cb);
++	cb->state = CALLING_DISCONNECT;
+ 	rdma_disconnect(cb->child_cm_id);
++	pthread_cancel(cb->cqthread);
+ 	pthread_join(cb->cqthread, NULL);
+ 	rping_free_buffers(cb);
+ 	rping_free_qp(cb);
+@@ -943,6 +960,7 @@
+ 
+ 	ret = 0;
+ err3:
++	cb->state = CALLING_DISCONNECT;
+ 	rdma_disconnect(cb->child_cm_id);
+ 	pthread_join(cb->cqthread, NULL);
+ 	rdma_destroy_id(cb->child_cm_id);
+@@ -1122,6 +1140,7 @@
+ 
+ 	ret = 0;
+ err4:
++	cb->state = CALLING_DISCONNECT;
+ 	rdma_disconnect(cb->cm_id);
+ err3:
+ 	pthread_join(cb->cqthread, NULL);
--- a/components/open-fabrics/librdmacm/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,860 +0,0 @@
-diff -r -u /tmp/librdmacm-1.0.14.1/configure librdmacm-1.0.14.1/configure
---- /tmp/librdmacm-1.0.14.1/configure	Tue Feb 15 17:12:14 2011
-+++ librdmacm-1.0.14.1/configure	Thu Feb 24 08:39:24 2011
-@@ -7625,6 +7625,7 @@
-  	esac ;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
-diff -r -u /tmp/librdmacm-1.0.14.1/Makefile.in librdmacm-1.0.14.1/Makefile.in
---- /tmp/librdmacm-1.0.14.1/Makefile.in	Tue Feb 15 17:12:13 2011
-+++ librdmacm-1.0.14.1/Makefile.in	Mon Mar 28 16:49:13 2011
-@@ -69,7 +69,7 @@
- 	"$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
- 	"$(DESTDIR)$(man7dir)" "$(DESTDIR)$(infinibandincludedir)" \
- 	"$(DESTDIR)$(librdmacmincludedir)"
--libLTLIBRARIES_INSTALL = $(INSTALL)
-+libLTLIBRARIES_INSTALL = $(INSTALL) -m 755
- LTLIBRARIES = $(lib_LTLIBRARIES)
- src_librdmacm_la_LIBADD =
- am_src_librdmacm_la_OBJECTS = src_librdmacm_la-cma.lo \
-@@ -76,7 +76,7 @@
- 	src_librdmacm_la-addrinfo.lo src_librdmacm_la-acm.lo
- src_librdmacm_la_OBJECTS = $(am_src_librdmacm_la_OBJECTS)
- am__dirstamp = $(am__leading_dot)dirstamp
--binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -m 755
- PROGRAMS = $(bin_PROGRAMS)
- am_examples_mckey_OBJECTS = mckey.$(OBJEXT)
- examples_mckey_OBJECTS = $(am_examples_mckey_OBJECTS)
-diff -r -u /tmp/librdmacm-1.0.14.1/src/cma.h librdmacm-1.0.14.1/src/cma.h
---- /tmp/librdmacm-1.0.14.1/src/cma.h	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/src/cma.h	Fri Feb 11 04:08:57 2011
-@@ -40,8 +40,10 @@
- 
- #include <stdlib.h>
- #include <errno.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- 
- #include <rdma/rdma_cma.h>
- 
-@@ -58,14 +60,6 @@
- 
- #define PFX "librdmacm: "
- 
--#if __BYTE_ORDER == __LITTLE_ENDIAN
--static inline uint64_t htonll(uint64_t x) { return bswap_64(x); }
--static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); }
--#else
--static inline uint64_t htonll(uint64_t x) { return x; }
--static inline uint64_t ntohll(uint64_t x) { return x; }
--#endif
--
- #define min(a, b) (a < b ? a : b)
- 
- static inline int ERR(int err)
-@@ -74,7 +68,7 @@
- 	return -1;
- }
- 
--int ucma_init();
-+int ucma_init(void);
- extern int af_ib_support;
- 
- #define RAI_ROUTEONLY		0x01000000
-diff -r -u /tmp/librdmacm-1.0.14.1/src/cma.c librdmacm-1.0.14.1/src/cma.c
---- /tmp/librdmacm-1.0.14.1/src/cma.c	Fri Dec 10 12:05:34 2010
-+++ librdmacm-1.0.14.1/src/cma.c	Mon Mar 28 16:44:55 2011
-@@ -46,12 +46,18 @@
- #include <poll.h>
- #include <unistd.h>
- #include <pthread.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/stat.h>
-+#include <sys/mkdev.h>
-+#else
- #include <endian.h>
- #include <byteswap.h>
-+#endif
- #include <stddef.h>
- #include <netdb.h>
- 
- #include "cma.h"
-+#include <infiniband/arch.h>
- #include <infiniband/driver.h>
- #include <infiniband/marshall.h>
- #include <rdma/rdma_cma.h>
-@@ -100,6 +106,8 @@
- 	struct ibv_pd	   *pd;
- 	uint64_t	    guid;
- 	int		    port_cnt;
-+	int		    refcnt;
-+	int		    max_qpsize;
- 	uint8_t		    max_initiator_depth;
- 	uint8_t		    max_responder_resources;
- };
-@@ -143,6 +151,7 @@
- 
- static struct cma_device *cma_dev_array;
- static int cma_dev_cnt;
-+static int cma_init_cnt;
- static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
- static int abi_ver = RDMA_USER_CM_MAX_ABI_VERSION;
- int af_ib_support;
-@@ -156,12 +165,16 @@
- 
- 	if (cma_dev_cnt) {
- 		while (cma_dev_cnt--) {
--			ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
-+			if (!cma_dev_array[cma_dev_cnt].verbs)
-+				continue;
-+
-+			if (cma_dev_array[cma_dev_cnt].refcnt)
-+				ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
- 			ibv_close_device(cma_dev_array[cma_dev_cnt].verbs);
-+			cma_init_cnt--;
- 		}
- 
- 		free(cma_dev_array);
--		cma_dev_cnt = 0;
- 	}
- }
- 
-@@ -228,9 +241,7 @@
- int ucma_init(void)
- {
- 	struct ibv_device **dev_list = NULL;
--	struct cma_device *cma_dev;
--	struct ibv_device_attr attr;
--	int i, ret, dev_cnt, ib;
-+	int i, ret, dev_cnt;
- 
- 	/* Quick check without lock to see if we're already initialized */
- 	if (cma_dev_cnt)
-@@ -253,46 +264,20 @@
- 		goto err1;
- 	}
- 
--	cma_dev_array = malloc(sizeof *cma_dev * dev_cnt);
-+	if (!dev_cnt) {
-+		printf("CMA: no RDMA devices found\n");
-+		ret = ERR(ENODEV);
-+		goto err2;
-+	}
-+	cma_dev_array = calloc(dev_cnt, sizeof *cma_dev_array);
- 	if (!cma_dev_array) {
- 		ret = ERR(ENOMEM);
- 		goto err2;
- 	}
- 
--	for (i = 0, ib = 0; dev_list[i];) {
--		cma_dev = &cma_dev_array[i];
-+	for (i = 0; dev_list[i]; i++)
-+		cma_dev_array[i].guid = ibv_get_device_guid(dev_list[i]);
- 
--		cma_dev->guid = ibv_get_device_guid(dev_list[i]);
--		cma_dev->verbs = ibv_open_device(dev_list[i]);
--		if (!cma_dev->verbs) {
--			printf("CMA: unable to open RDMA device\n");
--			ret = ERR(ENODEV);
--			goto err3;
--		}
--
--		cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
--		if (!cma_dev->pd) {
--			ibv_close_device(cma_dev->verbs);
--			ret = ERR(ENOMEM);
--			goto err3;
--		}
--
--		i++;
--		ret = ibv_query_device(cma_dev->verbs, &attr);
--		if (ret) {
--			printf("CMA: unable to query RDMA device\n");
--			ret = ERR(ret);
--			goto err3;
--		}
--
--		cma_dev->port_cnt = attr.phys_port_cnt;
--		cma_dev->max_initiator_depth = (uint8_t) attr.max_qp_init_rd_atom;
--		cma_dev->max_responder_resources = (uint8_t) attr.max_qp_rd_atom;
--		ib += (cma_dev->verbs->device->transport_type == IBV_TRANSPORT_IB);
--	}
--
--	if (ib)
--		ucma_ib_init();
- 	cma_dev_cnt = dev_cnt;
- 	ucma_set_af_ib_support();
- 	pthread_mutex_unlock(&mut);
-@@ -299,12 +284,6 @@
- 	ibv_free_device_list(dev_list);
- 	return 0;
- 
--err3:
--	while (i--) {
--		ibv_dealloc_pd(cma_dev_array[i].pd);
--		ibv_close_device(cma_dev_array[i].verbs);
--	}
--	free(cma_dev_array);
- err2:
- 	ibv_free_device_list(dev_list);
- err1:
-@@ -312,12 +291,93 @@
- 	return ret;
- }
- 
-+static struct ibv_context *ucma_open_device(uint64_t guid)
-+{
-+	struct ibv_device **dev_list;
-+	struct ibv_context *verbs = NULL;
-+	int i;
-+
-+	dev_list = ibv_get_device_list(NULL);
-+	if (!dev_list) {
-+		fprintf(stderr, PFX "Fatal: unable to get RDMA device list\n");
-+		return NULL;
-+	}
-+
-+	for (i = 0; dev_list[i]; i++) {
-+		if (ibv_get_device_guid(dev_list[i]) == guid) {
-+			verbs = ibv_open_device(dev_list[i]);
-+			break;
-+		}
-+	}
-+
-+	if (!verbs)
-+		fprintf(stderr, PFX "Fatal: unable to open RDMA device\n");
-+
-+	ibv_free_device_list(dev_list);
-+	return verbs;
-+}
-+
-+static int ucma_init_device(struct cma_device *cma_dev)
-+{
-+	struct ibv_device_attr attr;
-+	int ret;
-+
-+	if (cma_dev->verbs)
-+		return 0;
-+
-+	cma_dev->verbs = ucma_open_device(cma_dev->guid);
-+	if (!cma_dev->verbs)
-+		return ERR(ENODEV);
-+
-+	ret = ibv_query_device(cma_dev->verbs, &attr);
-+	if (ret) {
-+		fprintf(stderr, PFX "Fatal: unable to query RDMA device\n");
-+		ret = ERR(ret);
-+		goto err;
-+	}
-+
-+	cma_dev->port_cnt = attr.phys_port_cnt;
-+	cma_dev->max_qpsize = attr.max_qp_wr;
-+	cma_dev->max_initiator_depth = (uint8_t) attr.max_qp_init_rd_atom;
-+	cma_dev->max_responder_resources = (uint8_t) attr.max_qp_rd_atom;
-+	cma_init_cnt++;
-+	return 0;
-+
-+err:
-+	ibv_close_device(cma_dev->verbs);
-+	cma_dev->verbs = NULL;
-+	return ret;
-+}
-+
-+static int ucma_init_all(void)
-+{
-+	int i, ret = 0;
-+
-+	if (!cma_dev_cnt) {
-+		ret = ucma_init();
-+		if (ret)
-+			return ret;
-+	}
-+
-+	if (cma_init_cnt == cma_dev_cnt)
-+		return 0;
-+
-+	pthread_mutex_lock(&mut);
-+	for (i = 0; i < cma_dev_cnt; i++) {
-+		ret = ucma_init_device(&cma_dev_array[i]);
-+		if (ret)
-+			break;
-+	}
-+	pthread_mutex_unlock(&mut);
-+	return ret;
-+}
-+
- struct ibv_context **rdma_get_devices(int *num_devices)
- {
- 	struct ibv_context **devs = NULL;
- 	int i;
- 
--	if (ucma_init())
-+	if (ucma_init_all())
- 		goto out;
- 
- 	devs = malloc(sizeof *devs * (cma_dev_cnt + 1));
-@@ -354,9 +414,18 @@
- 	if (!channel)
- 		return NULL;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	channel->fd = open("/dev/infiniband/ofs/rdma_cm", O_RDWR);
-+#else
- 	channel->fd = open("/dev/infiniband/rdma_cm", O_RDWR);
-+#endif
-+
- 	if (channel->fd < 0) {
-+#if defined(__SVR4) && defined(__sun)
-+		printf("CMA: unable to open /dev/infiniband/ofs/rdma_cm\n");
-+#else
- 		printf("CMA: unable to open /dev/infiniband/rdma_cm\n");
-+#endif
- 		goto err;
- 	}
- 	return channel;
-@@ -374,18 +443,33 @@
- static int ucma_get_device(struct cma_id_private *id_priv, uint64_t guid)
- {
- 	struct cma_device *cma_dev;
--	int i;
-+	int i, ret;
- 
- 	for (i = 0; i < cma_dev_cnt; i++) {
- 		cma_dev = &cma_dev_array[i];
--		if (cma_dev->guid == guid) {
--			id_priv->cma_dev = cma_dev;
--			id_priv->id.verbs = cma_dev->verbs;
--			return 0;
--		}
-+		if (cma_dev->guid == guid)
-+			goto match;
- 	}
--
-+ 
- 	return ERR(ENODEV);
-+match:
-+	pthread_mutex_lock(&mut);
-+	if ((ret = ucma_init_device(cma_dev)))
-+		goto out;
-+ 
-+	if (!cma_dev->refcnt++) {
-+		cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
-+		if (!cma_dev->pd) {
-+			cma_dev->refcnt--;
-+			ret = ERR(ENOMEM);
-+			goto out;
-+		}
-+	}
-+	id_priv->cma_dev = cma_dev;
-+	id_priv->id.verbs = cma_dev->verbs;
-+out:
-+	pthread_mutex_unlock(&mut);
-+	return ret;
- }
- 
- static void ucma_free_id(struct cma_id_private *id_priv)
-@@ -1186,6 +1270,10 @@
- 	if (ret)
- 		return ret;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	qp_init_attr->sq_sig_all |= LIB_RDMACM_QP_BIT;
-+#endif
-+
- 	qp = ibv_create_qp(pd, qp_init_attr);
- 	if (!qp) {
- 		ret = ERR(ENOMEM);
-@@ -1787,6 +1875,9 @@
- 
- 	CMA_CREATE_MSG_CMD(msg, cmd, UCMA_CMD_ACCEPT, size);
- 	cmd->id = id_priv->handle;
-+#if defined(__SVR4) && defined(__sun)
-+	cmd->conn_param.qp_num = ((id_priv->id).qp)->qp_num;
-+#endif
- 
- 	ret = write(id_priv->id.channel->fd, msg, size);
- 	if (ret != size) {
-@@ -2051,8 +2142,20 @@
- 
- 	CMA_CREATE_MSG_CMD_RESP(msg, cmd, resp, UCMA_CMD_MIGRATE_ID, size);
- 	cmd->id = id_priv->handle;
-+
-+#if !(defined(__SVR4) && defined(__sun))
- 	cmd->fd = id->channel->fd;
-+#else
-+	{
-+		struct stat	fstat_buf;
-+		int		rc;
- 
-+		if ((rc = fstat(id->channel->fd, &fstat_buf)) != 0)
-+			return (ERR(ENODATA));
-+		cmd->fd = minor(fstat_buf.st_rdev);
-+	}
-+#endif
-+
- 	ret = write(channel->fd, msg, size);
- 	if (ret != size)
- 		return (ret >= 0) ? ERR(ENODATA) : -1;
-diff -r -u /tmp/librdmacm-1.0.14.1/man/rdma_create_id.3 librdmacm-1.0.14.1/man/rdma_create_id.3
---- /tmp/librdmacm-1.0.14.1/man/rdma_create_id.3	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/man/rdma_create_id.3	Mon Mar 28 03:11:48 2011
-@@ -31,9 +31,7 @@
- explicitly binding to a specified RDMA device before communication
- can occur, and most operations are asynchronous in nature.  Asynchronous
- communication events on an rdma_cm_id are reported through the associated
--event channel.  If the channel parameter is NULL, the rdma_cm_id will
--be placed into synchronous operation.  While operating synchronously,
--calls that result in an event will block until the operation completes.
-+event channel.
- The event will be returned to the user through the rdma_cm_id structure,
- and be available for access until another rdma_cm call is made.
- .P
-diff -r -u /tmp/librdmacm-1.0.14.1/man/rdma_create_qp.3 librdmacm-1.0.14.1/man/rdma_create_qp.3
---- /tmp/librdmacm-1.0.14.1/man/rdma_create_qp.3	Fri Dec 10 12:05:34 2010
-+++ librdmacm-1.0.14.1/man/rdma_create_qp.3	Mon Mar 28 03:11:48 2011
-@@ -33,8 +33,7 @@
- the rdma_cm_id will be created using a default protection domain.  One
- default protection domain is allocated per RDMA device.
- .P
--The initial QP attributes are specified by the qp_init_attr parameter.  The
--send_cq and recv_cq fields in the ibv_qp_init_attr are optional.  If
-+The initial QP attributes are specified by the qp_init_attr parameter.  If
- a send or receive completion queue is not specified, then a CQ will be
- allocated by the rdma_cm for the QP, along with corresponding completion
- channels.  Completion channels and CQ data created by the rdma_cm are
-diff -r -u /tmp/librdmacm-1.0.14.1/man/rdma_set_option.3 librdmacm-1.0.14.1/man/rdma_set_option.3
---- /tmp/librdmacm-1.0.14.1/man/rdma_set_option.3	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/man/rdma_set_option.3	Fri Jun 13 09:07:41 2014
-@@ -14,16 +14,26 @@
- .IP "id" 12
- RDMA identifier.
- .IP "level" 12
--Protocol level of the option to set.
-+Protocol level of the option to set.  Currently level RDMA_OPTION_ID is supported.
- .IP "optname" 12
--Name of the option, relative to the level, to set.
-+Name of the option, relative to the level, to set.  The only supported option isRDMA_OPTION_ID_REUSEADDR for level RDMA_OPTION_ID.
- .IP "optval" 12
--Reference to the option data.  The data is dependent on the level and optname.
-+Reference to the option data.  The data is dependent on the level and optname.  For the option RDMA_OPTION_ID_REUSEADDR, an integer is passed.
- .IP "optlen" 12
- The size of the %optval buffer.
- .SH "DESCRIPTION"
- Sets communication options for an rdma_cm_id.  This call is used to override
- the default system settings.
-+.sp
-+The RDMA_OPTION_ID_REUSEADDR option can be used to enable or
-+disable REUSEADDR option for a CMID. A value of 0 disables
-+the option and a non-zero value enables the option. This
-+option can be set before calling rdma_bind_addr(3) or the
-+rdma_resolve_addr(3) API. Listening for connection requests,
-+using rdma_listen(3), is not supported for CMIDs set with
-+this option. This option enables multiple connections to share
-+the same source IP Port on the active side of the connection.
-+.sp
- .SH "RETURN VALUE"
- Returns 0 on success, or -1 on error.  If an error occurs, errno will be
- set to indicate the failure reason.
-diff -r -u /tmp/librdmacm-1.0.14.1/man/rdma_cm.7 librdmacm-1.0.14.1/man/rdma_cm.7
---- /tmp/librdmacm-1.0.14.1/man/rdma_cm.7	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/man/rdma_cm.7	Mon Mar 28 03:11:47 2011
-@@ -19,7 +19,7 @@
- API defined by the libibverbs library.  The libibverbs library provides the
- underlying interfaces needed to send and receive data.
- .P
--The RDMA CM can operate asynchronously or synchronously.  The mode of
-+The RDMA CM operates asynchronously.  The mode of
- operation is controlled by the user through the use of the rdma_cm event channel
- parameter in specific calls.  If an event channel is provided, an rdma_cm identifier
- will report its event data (results of connecting, for example), on that channel.
-@@ -31,44 +31,10 @@
- of the more commonly used verbs funcationality.  The full set of abstracted
- verb calls are:
- .P
--rdma_reg_msgs  - register an array of buffers for sending and receiving
--.P
--rdma_reg_read  - registers a buffer for RDMA read operations
--.P
--rdma_reg_write - registers a buffer for RDMA write operations
--.P
--rdma_dereg_mr  - deregisters a memory region
--.P
--rdma_post_recv  - post a buffer to receive a message
--.P
--rdma_post_send  - post a buffer to send a message
--.P
--rdma_post_read  - post an RDMA to read data into a buffer
--.P
--rdma_post_write - post an RDMA to send data from a buffer
--.P
--rdma_post_recvv  - post a vector of buffers to receive a message
--.P
--rdma_post_sendv  - post a vector of buffers to send a message
--.P
--rdma_post_readv  - post a vector of buffers to receive an RDMA read
--.P
--rdma_post_writev - post a vector of buffers to send an RDMA write
--.P
--rdma_post_ud_send - post a buffer to send a message on a UD QP
--.P
--rdma_get_send_comp - get completion status for a send or RDMA operation
--.P
--rdma_get_recv_comp - get information about a completed receive
- .SH "CLIENT OPERATION"
- This section provides a general overview of the basic operation for the active,
- or client, side of communication.  This flow assume asynchronous operation with
--low level call details shown.  For
--synchronous operation, calls to rdma_create_event_channel, rdma_get_cm_event,
--rdma_ack_cm_event, and rdma_destroy_event_channel
--would be eliminated.  Abstracted calls, such as rdma_create_ep encapsulate
--serveral of these calls under a single API.
--Users may also refer to the example applications for
-+low level call details shown.  Users may also refer to the example applications for
- code samples.  A general connection flow would be:
- .IP rdma_getaddrinfo
- retrieve address information of the destination
-@@ -178,12 +144,9 @@
- rdma_ack_cm_event(3),
- rdma_bind_addr(3),
- rdma_connect(3),
--rdma_create_ep(3),
- rdma_create_event_channel(3),
- rdma_create_id(3),
- rdma_create_qp(3),
--rdma_dereg_mr(3),
--rdma_destroy_ep(3),
- rdma_destroy_event_channel(3),
- rdma_destroy_id(3),
- rdma_destroy_qp(3),
-@@ -196,27 +159,11 @@
- rdma_get_dst_port(3),
- rdma_get_local_addr(3),
- rdma_get_peer_addr(3),
--rdma_get_recv_comp(3),
--rdma_get_request(3),
--rdma_get_send_comp(3),
- rdma_get_src_port(3),
- rdma_join_multicast(3),
- rdma_leave_multicast(3),
- rdma_listen(3),
--rdma_migrate_id(3),
- rdma_notify(3),
--rdma_post_read(3)
--rdma_post_readv(3),
--rdma_post_recv(3),
--rdma_post_recvv(3),
--rdma_post_send(3),
--rdma_post_sendv(3),
--rdma_post_ud_send(3),
--rdma_post_write(3),
--rdma_post_writev(3),
--rdma_reg_msgs(3),
--rdma_reg_read(3),
--rdma_reg_write(3),
- rdma_reject(3),
- rdma_resolve_addr(3),
- rdma_resolve_route(3),
-diff -r -u /tmp/librdmacm-1.0.14.1/include/infiniband/ib.h librdmacm-1.0.14.1/include/infiniband/ib.h
---- /tmp/librdmacm-1.0.14.1/include/infiniband/ib.h	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/include/infiniband/ib.h	Fri Feb 11 04:08:56 2011
-@@ -33,7 +33,11 @@
- #if !defined(_RDMA_IB_H)
- #define _RDMA_IB_H
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #include <linux/types.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- #include <string.h>
- 
- #ifndef AF_IB
-diff -r -u /tmp/librdmacm-1.0.14.1/include/rdma/rdma_cma_abi.h librdmacm-1.0.14.1/include/rdma/rdma_cma_abi.h
---- /tmp/librdmacm-1.0.14.1/include/rdma/rdma_cma_abi.h	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/include/rdma/rdma_cma_abi.h	Fri Feb 11 04:08:48 2011
-@@ -104,6 +104,9 @@
- 	__u64 response;
- 	struct sockaddr_in6 addr;
- 	__u32 id;
-+#if defined(__SVR4) && defined(__sun)
-+	uint32_t	reserved;
-+#endif
- };
- 
- struct ucma_abi_bind {
-@@ -243,6 +246,9 @@
- 	__u64 uid;
- 	struct sockaddr_in6 addr;
- 	__u32 id;
-+#if defined(__SVR4) && defined(__sun)
-+	uint32_t	reserved;
-+#endif
- };
- 
- struct ucma_abi_join_mcast {
-diff -r -u /tmp/librdmacm-1.0.14.1/include/rdma/rdma_cma.h librdmacm-1.0.14.1/include/rdma/rdma_cma.h
---- /tmp/librdmacm-1.0.14.1/include/rdma/rdma_cma.h	Fri Dec 10 12:05:34 2010
-+++ librdmacm-1.0.14.1/include/rdma/rdma_cma.h	Tue Jun  3 21:54:14 2014
-@@ -639,8 +639,9 @@
- 
- /* Option details */
- enum {
--	RDMA_OPTION_ID_TOS	= 0,	/* uint8_t: RFC 2474 */
--	RDMA_OPTION_IB_PATH	= 1	/* struct ibv_path_data[] */
-+	RDMA_OPTION_ID_TOS		= 0,	/* uint8_t: RFC 2474 */
-+	RDMA_OPTION_IB_PATH		= 1,	/* struct ibv_path_data[] */
-+	RDMA_OPTION_ID_REUSEADDR	= 1	/* int: ~SO_REUSEADDR */
- };
- 
- /**
-diff -r -u /tmp/librdmacm-1.0.14.1/examples/udaddy.c librdmacm-1.0.14.1/examples/udaddy.c
---- /tmp/librdmacm-1.0.14.1/examples/udaddy.c	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/examples/udaddy.c	Fri Feb 11 04:08:48 2011
-@@ -40,7 +40,9 @@
- #include <netinet/in.h>
- #include <sys/socket.h>
- #include <netdb.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <getopt.h>
- 
- #include <rdma/rdma_cma.h>
-diff -r -u /tmp/librdmacm-1.0.14.1/examples/mckey.c librdmacm-1.0.14.1/examples/mckey.c
---- /tmp/librdmacm-1.0.14.1/examples/mckey.c	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/examples/mckey.c	Fri Feb 11 04:08:48 2011
-@@ -41,7 +41,9 @@
- #include <arpa/inet.h>
- #include <sys/socket.h>
- #include <netdb.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <unistd.h>
- #include <getopt.h>
- 
-@@ -329,6 +331,16 @@
- 
- 	while (1) {
- 		ret = rdma_get_cm_event(test.channel, &event);
-+
-+/* 
-+ * Solaris returns EBADF if we close the channel while we're waiting
-+ * for any events to occur. It is safe to ignore EBADF here.
-+ */
-+#if defined(__SVR4) && defined(__sun)
-+		if (ret && (errno == EBADF))
-+			break;
-+#endif
-+
- 		if (ret) {
- 			perror("rdma_get_cm_event");
- 			break;
-@@ -461,6 +473,7 @@
- 	return ret;
- }
- 
-+#if !(defined(__SVR4) && defined(__sun))
- static int get_dst_addr(char *dst, struct sockaddr *addr)
- {
- 	struct sockaddr_ib *sib;
-@@ -474,6 +487,7 @@
- 	inet_pton(AF_INET6, dst, &sib->sib_addr);
- 	return 0;
- }
-+#endif
- 
- static int run(void)
- {
-@@ -486,7 +500,12 @@
- 			return ret;
- 	}
- 
-+/* Solaris does not yet support family AF_IB */
-+#if defined(__SVR4) && defined(__sun)
-+	ret = get_addr(dst_addr, (struct sockaddr *) &test.dst_in);
-+#else
- 	ret = get_dst_addr(dst_addr, (struct sockaddr *) &test.dst_in);
-+#endif
- 	if (ret)
- 		return ret;
- 
-diff -r -u /tmp/librdmacm-1.0.14.1/examples/cmatose.c librdmacm-1.0.14.1/examples/cmatose.c
---- /tmp/librdmacm-1.0.14.1/examples/cmatose.c	Mon Oct  4 17:00:18 2010
-+++ librdmacm-1.0.14.1/examples/cmatose.c	Fri Feb 11 04:08:48 2011
-@@ -40,7 +40,9 @@
- #include <netinet/in.h>
- #include <sys/socket.h>
- #include <netdb.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <getopt.h>
- 
- #include <rdma/rdma_cma.h>
-diff -r -u /tmp/librdmacm-1.0.14.1/examples/rping.c librdmacm-1.0.14.1/examples/rping.c
---- /tmp/librdmacm-1.0.14.1/examples/rping.c	Tue Feb 15 17:10:48 2011
-+++ librdmacm-1.0.14.1/examples/rping.c	Wed Apr 23 10:37:57 2014
-@@ -40,11 +40,17 @@
- #include <netinet/in.h>
- #include <sys/socket.h>
- #include <netdb.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <semaphore.h>
- #include <arpa/inet.h>
- #include <pthread.h>
- #include <inttypes.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <unistd.h>
-+#include <libgen.h>
-+#endif
- 
- #include <rdma/rdma_cma.h>
- #include <infiniband/arch.h>
-@@ -85,6 +91,13 @@
- 	ERROR
- };
- 
-+enum disconnect_state {
-+	DISCONNECT_NONE,
-+	CALLING_DISCONNECT = 1,
-+	DISCONNECT_CALLED,
-+	DISCONNECT_DONE
-+};
-+
- struct rping_rdma_info {
- 	uint64_t buf;
- 	uint32_t rkey;
-@@ -143,6 +156,9 @@
- 	enum test_state state;		/* used for cond/signalling */
- 	sem_t sem;
- 
-+	enum disconnect_state  dis_state;
-+	sem_t dis_sem;
-+
- 	struct sockaddr_storage sin;
- 	uint16_t port;			/* dst port in NBO */
- 	int verbose;			/* verbose logging */
-@@ -218,6 +234,8 @@
- 		fprintf(stderr, "%s DISCONNECT EVENT...\n",
- 			cb->server ? "server" : "client");
- 		sem_post(&cb->sem);
-+		cb->dis_state = DISCONNECT_DONE;
-+		sem_post(&cb->dis_sem);
- 		break;
- 
- 	case RDMA_CM_EVENT_DEVICE_REMOVAL:
-@@ -285,6 +303,29 @@
- 					"cq completion failed status %d\n",
- 					wc.status);
- 				ret = -1;
-+			} else {
-+				/*
-+				 * FLUSH Error can be polled before RDMA-CM
-+				 * DISCONNECT is notified. Ensure that cb_state
-+				 * is set appropriately in such a case.
-+				 * sleep for sometime if Disconnect has not
-+				 * been called. The FLUSH WR can be because
-+				 * the remote end initiated the disconnect.
-+				 */
-+				if (cb->dis_state == DISCONNECT_NONE)
-+					sleep(2);
-+
-+				if (cb->dis_state == DISCONNECT_DONE)
-+					return (0);
-+
-+				/* Wait if disconnect is called. */
-+				if (cb->dis_state == DISCONNECT_CALLED) {
-+					sem_wait(&cb->dis_sem);
-+					if (cb->dis_state == DISCONNECT_DONE)
-+						return (0);
-+					else
-+						goto error;
-+				}
- 			}
- 			goto error;
- 		}
-@@ -571,9 +612,15 @@
- 
- 	while (1) {
- 		ret = rdma_get_cm_event(cb->cm_channel, &event);
--		if (ret) {
-+		/*
-+		 * If the retry of read() syscall returned EBADF, as the
-+		 * file was closed on process exit. Ignore this error.
-+		 */
-+		if (ret && errno != EBADF) {
- 			perror("rdma_get_cm_event");
- 			exit(ret);
-+		} else if (ret && errno == EBADF) {
-+			exit(0);
- 		}
- 		ret = rping_cma_event_handler(event->id, event);
- 		rdma_ack_cm_event(event);
-@@ -595,8 +642,14 @@
- 		pthread_testcancel();
- 
- 		ret = ibv_get_cq_event(cb->channel, &ev_cq, &ev_ctx);
--		if (ret) {
-+		/*
-+		 * If the retry of write() syscall returned EBADF, as the
-+		 * file was closed on process exit. Ignore this error.
-+		 */
-+		if (ret && errno != EBADF) {
- 			fprintf(stderr, "Failed to get cq event!\n");
-+			 pthread_exit(NULL);
-+		} else if (ret && errno == EBADF) {
- 			pthread_exit(NULL);
- 		}
- 		if (ev_cq != cb->cq) {
-@@ -801,11 +854,13 @@
- 	}
- 
- 	rping_test_server(cb);
-+	cb->dis_state = CALLING_DISCONNECT;
-+	sem_post(&cb->dis_sem);
- 	rdma_disconnect(cb->child_cm_id);
--	rping_free_buffers(cb);
--	rping_free_qp(cb);
- 	pthread_cancel(cb->cqthread);
- 	pthread_join(cb->cqthread, NULL);
-+	rping_free_buffers(cb);
-+	rping_free_qp(cb);
- 	rdma_destroy_id(cb->child_cm_id);
- 	free_cb(cb);
- 	return NULL;
-@@ -889,6 +944,8 @@
- 	}
- 
- 	rping_test_server(cb);
-+	cb->dis_state = CALLING_DISCONNECT;
-+	sem_post(&cb->dis_sem);
- 	rdma_disconnect(cb->child_cm_id);
- 	rdma_destroy_id(cb->child_cm_id);
- err2:
-@@ -1056,6 +1113,8 @@
- 	}
- 
- 	rping_test_client(cb);
-+	cb->dis_state = CALLING_DISCONNECT;
-+	sem_post(&cb->dis_sem);
- 	rdma_disconnect(cb->cm_id);
- err2:
- 	rping_free_buffers(cb);
-@@ -1123,6 +1182,7 @@
- 	cb->sin.ss_family = PF_INET;
- 	cb->port = htons(7174);
- 	sem_init(&cb->sem, 0, 0);
-+	sem_init(&cb->dis_sem, 0, 0);
- 
- 	opterr = 0;
- 	while ((op=getopt(argc, argv, "a:Pp:C:S:t:scvVd")) != -1) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsdp.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,70 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license libsdp-1.1.108 under the OpenIB.org BSD license.
+
+Copyright (c) 2004 Topspin Communications.  All rights reserved.
+Copyright (c) 2005-2006 Mellanox Technologies Ltd.  All rights reserved.
+
+This software is available to you under a choice of one of two
+licenses. You may choose to be licensed under the terms of the GNU
+General Public License (GPL) Version 2, available at
+<http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
+license, included below.
+
+Copyright (c) 2004 Topspin Communications. All rights reserved.
+Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
+
+OpenIB.org BSD license:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
--- a/components/open-fabrics/libsdp/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libsdp/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,7 +22,7 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		libsdp
@@ -41,7 +41,7 @@
 
 CFLAGS += -D_POSIX_PTHREAD_SEMANTICS
 
-CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)
+CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)/infiniband
 CONFIGURE_OPTIONS += --libdir=$(USRLIBDIR)/secure/$(SUFFIX.$(BITS))
 
 CLEANUP_DIRS =	$(PROTOUSRBINDIR)/linux
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsdp/patches/001-libsdp-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1017 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  de0231b8e245553d9dd1f37e46202e96ba6e6e70
+
+diff -r de0231b8e245 Makefile.am
+--- a/Makefile.am	Tue Feb 23 22:30:48 2016 -0800
++++ b/Makefile.am	Tue Feb 23 22:30:49 2016 -0800
+@@ -7,9 +7,9 @@
+ 
+ install-data-hook:
+ 	if test -e $(DESTDIR)$(sysconfdir)/libsdp.conf; then \
+-		diff -q $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
++		diff $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
+ 		if test $$? == 1; then \
+-			t=$(shell date +'%Y%m%d%H%M%S'); \
++			t=$(shell date +'m%d09/20/10M%S'); \
+ 		   cp -p $(srcdir)/libsdp.conf \
+ 				$(DESTDIR)$(sysconfdir)/libsdp.conf.$$t; \
+ 			echo "NOTE: existing libsdp.conf was not updated."; \
+diff -r de0231b8e245 Makefile.in
+--- a/Makefile.in	Tue Feb 23 22:30:48 2016 -0800
++++ b/Makefile.in	Tue Feb 23 22:30:49 2016 -0800
+@@ -59,6 +59,12 @@
+ 	install-recursive installcheck-recursive installdirs-recursive \
+ 	pdf-recursive ps-recursive uninstall-info-recursive \
+ 	uninstall-recursive
++am__installdirs = "$(DESTDIR)$(man3libdir)" "$(DESTDIR)$(man5dir)"
++man3libdir = $(mandir)/man3lib
++man5dir = $(mandir)/man5
++NROFF = nroff
++man_MANS = man/libsdp.3lib man/libsdp.conf.5
++MANS = $(man_MANS)
+ ETAGS = etags
+ CTAGS = ctags
+ DIST_SUBDIRS = $(SUBDIRS)
+@@ -114,8 +120,6 @@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+-LINUX_BUILD_FALSE = @LINUX_BUILD_FALSE@
+-LINUX_BUILD_TRUE = @LINUX_BUILD_TRUE@
+ LN_S = @LN_S@
+ LTLIBOBJS = @LTLIBOBJS@
+ MAINT = @MAINT@
+@@ -131,11 +135,8 @@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ RANLIB = @RANLIB@
+-SED = @SED@
+ SET_MAKE = @SET_MAKE@
+ SHELL = @SHELL@
+-SOLARIS_BUILD_FALSE = @SOLARIS_BUILD_FALSE@
+-SOLARIS_BUILD_TRUE = @SOLARIS_BUILD_TRUE@
+ STRIP = @STRIP@
+ VERSION = @VERSION@
+ WANT_LIBSDP_SYS_FALSE = @WANT_LIBSDP_SYS_FALSE@
+@@ -185,7 +186,7 @@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ SUBDIRS = src
+-EXTRA_DIST = libsdp.spec.in libsdp.conf
++EXTRA_DIST = libsdp.spec.in libsdp.conf libsdp.3lib libsdp.conf.5
+ all: config.h
+ 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+ 
+@@ -252,6 +253,96 @@
+ distclean-libtool:
+ 	-rm -f libtool
+ uninstall-info-am:
++install-man5: $(man5_MANS) $(man_MANS)
++	@$(NORMAL_INSTALL)
++	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
++	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.5*) list="$$list $$i" ;; \
++	  esac; \
++	done; \
++	for i in $$list; do \
++	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
++	  else file=$$i; fi; \
++	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
++	  case "$$ext" in \
++	    5*) ;; \
++	    *) ext='5' ;; \
++	  esac; \
++	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
++	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
++	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
++	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
++	done
++uninstall-man5:
++	@$(NORMAL_UNINSTALL)
++	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.5*) list="$$list $$i" ;; \
++	  esac; \
++	done; \
++	for i in $$list; do \
++	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
++	  case "$$ext" in \
++	    5*) ;; \
++	    *) ext='5' ;; \
++	  esac; \
++	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
++	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
++	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
++	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
++	done
++install-man3lib: $(man3lib_MANS) $(man_MANS)
++	@$(NORMAL_INSTALL)
++	test -z "$(man3libdir)" || $(mkdir_p) "$(DESTDIR)$(man3libdir)"
++	@list='$(man3lib_MANS) $(dist_man3lib_MANS) $(nodist_man3lib_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.3lib*) list="$$list $$i" ;; \
++	  esac; \
++	done; \
++	for i in $$list; do \
++	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
++	  else file=$$i; fi; \
++	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
++	  case "$$ext" in \
++	    3lib*) ;; \
++	    *) ext='3lib' ;; \
++	  esac; \
++	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
++	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
++	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3libdir)/$$inst'"; \
++	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3libdir)/$$inst"; \
++	done
++uninstall-man3lib:
++	@$(NORMAL_UNINSTALL)
++	@list='$(man3lib_MANS) $(dist_man3lib_MANS) $(nodist_man3lib_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.3lib*) list="$$list $$i" ;; \
++	  esac; \
++	done; \
++	for i in $$list; do \
++	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
++	  case "$$ext" in \
++	    3lib*) ;; \
++	    *) ext='3lib' ;; \
++	  esac; \
++	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
++	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
++	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
++	  echo " rm -f '$(DESTDIR)$(man3libdir)/$$inst'"; \
++	  rm -f "$(DESTDIR)$(man3libdir)/$$inst"; \
++	done
+ 
+ # This directory's subdirectories are mostly independent; you can cd
+ # into them and run `make' without going through this Makefile.
+@@ -531,19 +622,23 @@
+ 	       $(distcleancheck_listfiles) ; \
+ 	       exit 1; } >&2
+ check-am: all-am
+-check: check-recursive
+-all-am: Makefile config.h
++check: installmandirs check-recursive
++all-am: Makefile config.h installmandirs
++installmandirs:
++	for dir in "$(DESTDIR)$(man3libdir)" "$(DESTDIR)$(man5dir)"; do \
++	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
++	done
+ installdirs: installdirs-recursive
+ installdirs-am:
+-install: install-recursive
++install: install-man install-recursive
+ install-exec: install-exec-recursive
+-install-data: install-data-recursive
++install-data: install-data-am install-data-recursive
+ uninstall: uninstall-recursive
+ 
+ install-am: all-am
+ 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ 
+-installcheck: installcheck-recursive
++installcheck: install-man installcheck-recursive
+ install-strip:
+ 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+@@ -579,16 +674,16 @@
+ 
+ info-am:
+ 
+-install-data-am:
++install-data-am: install-man
+ 	@$(NORMAL_INSTALL)
+ 	$(MAKE) $(AM_MAKEFLAGS) install-data-hook
+ 
++install-man: install-man5 install-man3lib
++
+ install-exec-am:
+ 
+ install-info: install-info-recursive
+ 
+-install-man:
+-
+ installcheck-am:
+ 
+ maintainer-clean: maintainer-clean-recursive
+@@ -609,11 +704,14 @@
+ 
+ ps-am:
+ 
+-uninstall-am: uninstall-info-am
++uninstall-am: uninstall-man uninstall-info-am
+ 
+ uninstall-info: uninstall-info-recursive
+ 
+-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
++uninstall-man: uninstall-man5 uninstall-man3lib
++
++.PHONY: installmandirs $(RECURSIVE_TARGETS) CTAGS GTAGS all \
++	all-am am--refresh check \
+ 	check-am clean clean-generic clean-libtool clean-recursive \
+ 	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ 	dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
+@@ -622,12 +720,14 @@
+ 	distuninstallcheck dvi dvi-am html html-am info info-am \
+ 	install install-am install-data install-data-am \
+ 	install-data-hook install-exec install-exec-am install-info \
+-	install-info-am install-man install-strip installcheck \
++	install-info-am install-man install-man3lib install-man5 \
++	install-strip installcheck \
+ 	installcheck-am installdirs installdirs-am maintainer-clean \
+ 	maintainer-clean-generic maintainer-clean-recursive \
+ 	mostlyclean mostlyclean-generic mostlyclean-libtool \
+ 	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+-	uninstall uninstall-am uninstall-info-am
++	uninstall uninstall-am uninstall-info-am uninstall-man \
++	uninstall-man3lib uninstall-man5
+ 
+ 
+ dist-hook: libsdp.spec
+@@ -635,9 +735,9 @@
+ 
+ install-data-hook:
+ 	if test -e $(DESTDIR)$(sysconfdir)/libsdp.conf; then \
+-		diff -q $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
++		diff $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
+ 		if test $$? == 1; then \
+-			t=$(shell date +'%Y%m%d%H%M%S'); \
++			t=$(shell date +'m%d01/26/11M%S'); \
+ 		   cp -p $(srcdir)/libsdp.conf \
+ 				$(DESTDIR)$(sysconfdir)/libsdp.conf.$$t; \
+ 			echo "NOTE: existing libsdp.conf was not updated."; \
+@@ -648,7 +748,11 @@
+ 			mkdir -p $(DESTDIR)$(sysconfdir); \
+ 		fi; \
+ 		cp -p $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf; \
+-	fi
++	fi; \
++	cd $(DESTDIR)$(mandir)/man3lib && \
++	$(RM) libssdp.3lib && \
++	cd $(DESTDIR)$(mandir)/man5 && \
++	$(RM) libssdp.conf.5
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
+diff -r de0231b8e245 README
+--- a/README	Tue Feb 23 22:30:48 2016 -0800
++++ b/README	Tue Feb 23 22:30:49 2016 -0800
+@@ -13,14 +13,12 @@
+ libsdp.so isn't setup automatically. it can be used in one of 2 ways:
+ 1) LD_PRELOAD environment variable. Setting this to the name of the
+    library you want to use will cause it to be preloaded.
+-2) Adding the name of the library into /etc/ld.so.preload. This will
+-   cause the library to be preloaded for every executable that is linked
+-   with libc.
+-
++2) Adding the name of the library  using crle(1).
++   
+ The library should be installed in a directory in which the dynamic loader
+-searches for shared libraries (as specified by LD_LIBRARY_PATH,
+-/etc/ld.so.conf, etc). Alternatively, you can specify the full path to the 
+-library that you want to use in LD_PRELOAD or /etc/ld.so.preload as described 
++searches for shared libraries (as specified by LD_LIBRARY_PATH, crle(1)
++, etc). Alternatively, you can specify the full path to the 
++library that you want to use in LD_PRELOAD or crle(1) described 
+ above.
+ 
+ The last option cant be used if you have multiple library versions
+@@ -29,7 +27,7 @@
+ lib (the 32 bit version) and lib64 directories and LD_RELOAD the libsdp.so.
+ This way the correct 32/64bit libsdp.so will be selected. 
+ For example running ssh over SDP with OFED distribution from bash this can be written:
+-LD_LIBRARY_PATH=/usr/local/ofed/lib64:/usr/local/ofed/lib LD_PRELOAD=libsdp.so ssh
++LD_LIBRARY_PATH=/usr/lib/secure/64/:/usr/lib/secure LD_PRELOAD=libsdp.so ssh
+ 
+ CONFIGURATION:
+ --------------
+@@ -39,6 +37,13 @@
+ * selective mode where it uses a configuration file to select which sockets
+   will be using SDP and which will not.
+ 
++Note:
++	both of these modes are designed to work with both IPv4 qand IPv6.
++	But only IPv4 works currently, because Solaris SDP with IPv6,
++	does not use AF_INET_SDP. (Note in Linux, the underlying SDP kernel
++	implementation does not support IPv6.)
++
++
+ For real world applications where communication with X, authentication, 
+ DNS and other servers connected through TCP is required the selective mode
+ is required.
+@@ -49,20 +54,11 @@
+ * the configuration file does not include any address family rule
+ 
+ For information on how to configure libsdp, see libsdp.conf, which is installed
+-in $(sysconfdir) (usually /usr/local/etc or /etc). The user can further control
++in /etc). The user can further control
+ the file to be used for configuration by setting the environment variable:
+ LIBSDP_CONFIG_FILE
+ 
+ LIMITATIONS:
+ ------------
+-1. Applications statically linked with libc will not allow dynamic pre-loading
+-   to port these applications to use SDP one needs to replace specific socket 
+-   calls (within the application) with AF_INET_SDP and recompile.
+-2. If for some reason the dynamic linker fail to pre-load libc before the 
+-   libsdp.so is initialized or it does not support RTDL_NEXT, libsdp will 
+-   fail to find the libc socket API. To overcome this situation a simple 
+-   implementation of hijacking "socket" call is provided in libsdp_sys.
+-   This partial implementation does not support any configuration and is 
+-   limited to i386 architecture.
+-3. Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
++1. Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
+    needed for applications to operate properly.
+diff -r de0231b8e245 libsdp.conf
+--- a/libsdp.conf	Tue Feb 23 22:30:48 2016 -0800
++++ b/libsdp.conf	Tue Feb 23 22:30:49 2016 -0800
+@@ -22,8 +22,8 @@
+ #
+ # By default we let all servers and client try SDP first.
+ # to exclude SDP add "use tcp" rules before these defaults.
+-use both server * *:*
+-use both client * *:*
++use sdp server * *:*
++use sdp client * *:*
+ #
+ #
+ ##############################################################################
+diff -r de0231b8e245 src/Makefile.am
+--- a/src/Makefile.am	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/Makefile.am	Tue Feb 23 22:30:49 2016 -0800
+@@ -7,9 +7,6 @@
+ 
+ libsdp_la_SOURCES = log.c match.c port.c config_parser.c config_scanner.c
+ libsdp_la_LDFLAGS = -version-info 1 -ldl -lc
+-if SOLARIS_BUILD
+-libsdp_la_LDFLAGS += -lsocket
+-endif
+ libsdp_sys_la_SOURCES = socket.c
+ libsdp_sys_la_LDFLAGS = -version-info 1
+ 
+diff -r de0231b8e245 src/Makefile.in
+--- a/src/Makefile.in	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/Makefile.in	Tue Feb 23 22:30:49 2016 -0800
+@@ -37,7 +37,6 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-@SOLARIS_BUILD_TRUE@am__append_1 = -lsocket
+ subdir = src
+ DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
+ 	$(srcdir)/Makefile.in
+@@ -55,7 +54,7 @@
+   esac;
+ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+-libLTLIBRARIES_INSTALL = $(INSTALL)
++libLTLIBRARIES_INSTALL = $(INSTALL) -m 755
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ libsdp_la_LIBADD =
+ am_libsdp_la_OBJECTS = log.lo match.lo port.lo config_parser.lo \
+@@ -144,12 +143,10 @@
+ SED = @SED@
+ SET_MAKE = @SET_MAKE@
+ SHELL = @SHELL@
+-SOLARIS_BUILD_FALSE = @SOLARIS_BUILD_FALSE@
+-SOLARIS_BUILD_TRUE = @SOLARIS_BUILD_TRUE@
+ STRIP = @STRIP@
+ VERSION = @VERSION@
+ WANT_LIBSDP_SYS_FALSE = @WANT_LIBSDP_SYS_FALSE@
+-WANT_LIBSDP_SYS_TRUE = @WANT_LIBSDP_SYS_TRUE@
++#WANT_LIBSDP_SYS_TRUE = @WANT_LIBSDP_SYS_TRUE@
+ YACC = @YACC@
+ ac_ct_AR = @ac_ct_AR@
+ ac_ct_CC = @ac_ct_CC@
+@@ -195,7 +192,7 @@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ lib_LTLIBRARIES = libsdp.la $(LIB_SDP_SYS)
+-@WANT_LIBSDP_SYS_TRUE@LIB_SDP_SYS = libsdp_sys.la
++#@WANT_LIBSDP_SYS_TRUE@LIB_SDP_SYS = libsdp_sys.la
+ AM_CFLAGS = -Wall -DSYSCONFDIR=\"$(sysconfdir)\"
+ libsdp_la_SOURCES = log.c match.c port.c config_parser.c config_scanner.c
+ libsdp_la_LDFLAGS = -version-info 1 -ldl -lc $(am__append_1)
+diff -r de0231b8e245 src/libsdp.h
+--- a/src/libsdp.h	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/libsdp.h	Tue Feb 23 22:30:49 2016 -0800
+@@ -27,7 +27,9 @@
+ /*
+  * SDP specific includes
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ #include "linux/sdp_inet.h"
++#endif
+ 
+ /* --------------------------------------------------------------------- */
+ /* library static and global variables                                   */
+diff -r de0231b8e245 src/log.c
+--- a/src/log.c	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/log.c	Tue Feb 23 22:30:49 2016 -0800
+@@ -79,20 +79,16 @@
+ 	switch ( __sdp_log_type ) {
+ 	case SDP_LOG_SYSLOG:
+ 		sprintf( extra_format, "%s[%d] libsdp %s ",
+-					program_invocation_short_name, getpid(  ), format );
++					program_invocation_short_name, (int)getpid(  ), format );
+ 		vsyslog( LOG_USER | LOG_NOTICE, extra_format, ap );
+ 		break;
+ 	case SDP_LOG_FILE:
+ 		timeval = time(NULL);
+-#ifdef SOLARIS_BUILD
+-		ctime_r(&timeval, timestr, sizeof timestr);
+-#else
+                 ctime_r(&timeval, timestr);
+-#endif
+ 		timestr[strlen(timestr)-1] = '\0';
+ 		sprintf( extra_format, "%s %s[%d] libsdp %s ",
+ 					timestr, program_invocation_short_name,
+-					getpid(  ), format );
++					(int)getpid(  ), format );
+ 		if ( __sdp_log_file == NULL ) {
+ 			vfprintf( stderr, extra_format, ap );
+ #if 0									  /* might slow everything too much? */
+diff -r de0231b8e245 src/match.c
+--- a/src/match.c	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/match.c	Tue Feb 23 22:30:49 2016 -0800
+@@ -39,7 +39,9 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <sys/types.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <linux/types.h>
++#endif
+ 
+ /*
+  * SDP specific includes
+@@ -87,8 +89,13 @@
+ 	snprintf( buf, len, "use %s %s %s:%s", target, prog, addr_buf, ports_buf );
+ }
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
+ 				      unsigned int prefixlen)
++#else
++static inline int __ipv6_prefix_equal(const uint32_t *a1, const uint32_t *a2,
++				      unsigned int prefixlen)
++#endif
+ {
+ 	unsigned pdw, pbi;
+ 
+@@ -109,7 +116,11 @@
+ 				    const struct in6_addr *a2,
+ 				    unsigned int prefixlen)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
++#else
++	return __ipv6_prefix_equal(a1->_S6_un._S6_u32, a2->_S6_un._S6_u32,
++#endif
+ 				   prefixlen);
+ }
+ 
+diff -r de0231b8e245 src/port.c
+--- a/src/port.c	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/port.c	Tue Feb 23 22:30:49 2016 -0800
+@@ -29,7 +29,10 @@
+ #  include <config.h>
+ #endif							/* HAVE_CONFIG_H */
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
++
++#define AF_INET6_SDP	34	/*  should be defined in socket.h but isn't */
++
+ /* Our prototypes for ioctl, get*name and accept do not strictly
+    match the headers - we use the following lines to move the header
+    versions 'out of the way' temporarily. */
+@@ -39,8 +42,9 @@
+ #define accept __real_accept
+ #define FASYNC 0
+ #include <libgen.h>
++#else
++#include <unistd.h>
+ #endif
+-#include <unistd.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -60,9 +64,11 @@
+ #include <fcntl.h>
+ #include <signal.h>
+ #include <sys/poll.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <sys/epoll.h>
+-
+-#ifdef SOLARIS_BUILD
++#endif
++
++#if defined(__SVR4) && defined(__sun)
+ /* We're done protecting ourselves from the header prototypes */
+ #undef ioctl
+ #undef getsockname
+@@ -152,6 +158,7 @@
+ typedef int (*poll_func_t) (struct pollfd * ufds,
+ 							unsigned long int nfds, int timeout);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ typedef int (*epoll_create_func_t) (int size);
+ 
+ typedef int (*epoll_ctl_func_t) (int epfd,
+@@ -165,6 +172,7 @@
+ 								   struct epoll_event * events,
+ 								   int maxevents,
+ 								   int timeout, const sigset_t * sigmask);
++#endif
+ 
+ 
+ struct socket_lib_funcs {
+@@ -184,13 +192,15 @@
+ 	select_func_t select;
+ 	pselect_func_t pselect;
+ 	poll_func_t poll;
++#if !(defined(__SVR4) && defined(__sun))
+ 	epoll_create_func_t epoll_create;
+ 	epoll_ctl_func_t epoll_ctl;
+ 	epoll_wait_func_t epoll_wait;
+ 	epoll_pwait_func_t epoll_pwait;
++#endif
+ };								/* socket_lib_funcs */
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ /* Solaris has another interface to socket functions prefixed with __xnet_ */
+ struct socket_lib_xnet_funcs {
+ 	socket_func_t socket;
+@@ -211,7 +221,7 @@
+ 
+ /* glibc provides these symbols - for Solaris builds we fake them
+  * until _init is called, at which point we quiz libdl.. */
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ char *program_invocation_name = "[progname]", *program_invocation_short_name =
+ 	"[short_progname]";
+ #else
+@@ -239,7 +249,7 @@
+ 	/* Automatically sets all other elements to NULL */
+ };								/* _socket_funcs */
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ static struct socket_lib_xnet_funcs _socket_xnet_funcs = {
+ 	.socket = NULL,
+ 	/* Automatically sets all other elements to NULL */
+@@ -366,6 +376,9 @@
+ 
+ static sa_family_t get_sdp_domain(int domain)
+ {
++#if defined(__SVR4) && defined(__sun)
++		return domain;
++#else
+ 	if (AF_INET_SDP == domain || AF_INET6_SDP == domain)
+ 		return domain;
+ 
+@@ -377,6 +390,7 @@
+ 	__sdp_log(9, "Error %s: unknown TCP domain: %d\n", __func__, domain);
+ 
+ 	return -1;
++#endif
+ }
+ 
+ static int get_sock_domain(int sd)
+@@ -424,10 +438,18 @@
+ static inline int is_invalid_addr(const void *p)
+ {
+ 	/* HACK: on some systems we can not write to check for pointer validity */
++
++	int old_errno = errno;
++
++	errno = 0;
++#if defined(__SVR4) && defined(__sun)
++	size_t ret = write(dev_null_fd, p, 1);
++#else
+ 	size_t ret = fcntl(dev_null_fd, F_GETLK, p);
++#endif
+ 
+ 	ret = (errno == EFAULT);
+-	errno = 0;
++	errno = old_errno;
+ 	return ret;
+ }
+ 
+@@ -636,12 +658,15 @@
+ 										   int type,
+ 										   int protocol, int semantics)
+ {
++__sdp_log(1, "__create_socket_semantic: socket domain:%d type:%d proto:%d semantics:%d\n", domain, type, protocol, semantics);
+ 	return
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ 		(semantics == SOCKET_SEMANTIC_XNET) ?
+ 		_socket_xnet_funcs.socket(domain, type, protocol) :
++		_socket_funcs.socket(domain, type, protocol);
++#else
++		_socket_funcs.socket(domain, type, protocol);
+ #endif
+-		_socket_funcs.socket(domain, type, protocol);
+ }
+ 
+ /* Contains the main logic for creating shadow SDP sockets */
+@@ -703,7 +728,12 @@
+ 
+ 		__sdp_log(1, "SOCKET: making SDP socket type:%d proto:%d\n",
+ 				  type, protocol);
++#if defined(__SVR4) && defined(__sun)
++		s = __create_socket_semantic(sdp_domain, type, PROTO_SDP, semantics);
++
++#else
+ 		s = __create_socket_semantic(sdp_domain, type, protocol, semantics);
++#endif
+ 		init_extra_attribute(s);
+ 		set_is_sdp_socket(s, 1);
+ 		goto done;
+@@ -722,9 +752,14 @@
+ 				protocol = IPPROTO_TCP;
+ 			__sdp_log(1, "SOCKET: making SDP shadow socket type:%d proto:%d\n",
+ 					  type, protocol);
++#if defined(__SVR4) && defined(__sun)
+ 			shadow_fd =
+-				__create_socket_semantic(sdp_domain, type, protocol,
+-										 semantics);
++				__create_socket_semantic(sdp_domain, type, PROTO_SDP, semantics);
++#else
++			shadow_fd =
++				__create_socket_semantic(sdp_domain, type, protocol, semantics);
++
++#endif
+ 			if (is_valid_fd(shadow_fd)) {
+ 				init_extra_attribute(shadow_fd);
+ 				if (libsdp_fd_attributes[s].shadow_fd != -1) {
+@@ -761,7 +796,7 @@
+ 	return __create_socket(domain, type, protocol, SOCKET_SEMANTIC_DEFAULT);
+ }
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ int __xnet_socket(int domain, int type, int protocol)
+ {
+ 	return __create_socket(domain, type, protocol, SOCKET_SEMANTIC_XNET);
+@@ -808,7 +843,7 @@
+ 				 socklen_t addrlen, int semantics)
+ {
+ 	return
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ 		(semantics == SOCKET_SEMANTIC_XNET) ?
+ 		_socket_xnet_funcs.bind(fd, my_addr, addrlen) :
+ #endif
+@@ -852,7 +887,11 @@
+ 		__sdp_log(1, "find_free_port: taking loop (%d)\n", ++num_of_loops);
+ 
+ 		__sdp_log(1, "find_free_port: creating the two sockets\n");
++#if defined(__SVR4) && defined(__sun)
++		tmp_sd[0] = _socket_funcs.socket(sdp_domain, SOCK_STREAM,  PROTO_SDP);
++#else
+ 		tmp_sd[0] = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP);
++#endif
+ 		if (tmp_sd[0] < 0) {
+ 			__sdp_log(8, "Warning find_free_port: creating first socket failed\n");
+ 			goto done;
+@@ -916,6 +955,7 @@
+ 						  strerror(errno));
+ 				goto close_and_mark;
+ 			} else {
++#if !(defined(__SVR4) && defined(__sun))
+ 				int err;
+ 				socklen_t len = sizeof(int);
+ 
+@@ -933,6 +973,7 @@
+ 					 * Continue only with TCP */
+ 					goto close_and_mark;
+ 				}
++#endif
+ 				__sdp_log(1, "find_free_port: %s port %u was busy\n",
+ 					  1 - tmp_turn ? "tcp" : "sdp",
+ 					  ntohs(((const struct sockaddr_in *)sin_addr)->sin_port));
+@@ -995,7 +1036,11 @@
+ 	}
+ 
+ 	__sdp_log(2, "check_legal_bind: binding two temporary sockets\n");
++#if defined(__SVR4) && defined(__sun)
++	*sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM,  PROTO_SDP);
++#else
+ 	*sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP);
++#endif
+ 	if (*sdp_sd < 0) {
+ 		__sdp_log(9, "Error check_legal_bind: " "creating SDP socket failed\n");
+ 		goto done;
+@@ -1035,6 +1080,7 @@
+ 
+ 		if (EADDRINUSE != errno)
+ 			goto done;
++#if !(defined(__SVR4) && defined(__sun))
+ 		if (-1 == getsockopt(*sdp_sd, SOL_TCP, SDP_LAST_BIND_ERR, &err, &len)) {
+ 			__sdp_log(9, "Error check_legal_bind:getsockopt: %s\n",
+ 					  strerror(errno));
+@@ -1057,6 +1103,12 @@
+ 		/* Continue only with TCP */
+ 		_socket_funcs.close(*sdp_sd);
+ 		*sdp_sd = -1;
++#else
++		errno = EINVAL;
++		_socket_funcs.close( *sdp_sd );
++		_socket_funcs.close( *tcp_sd );
++		goto done;
++#endif
+ 	}
+ 
+ 	__sdp_log(1, "check_legal_bind: binding TCP socket\n");
+@@ -1241,7 +1293,7 @@
+ 	return __perform_bind(fd, my_addr, addrlen, SOCKET_SEMANTIC_DEFAULT);
+ }
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ int __xnet_bind(int fd, const struct sockaddr *my_addr, socklen_t addrlen)
+ {
+ 	return __perform_bind(fd, my_addr, addrlen, SOCKET_SEMANTIC_XNET);
+@@ -1262,7 +1314,7 @@
+ 					socklen_t addrlen, int semantics)
+ {
+ 	return
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) & defined(__sun)
+ 		(semantics == SOCKET_SEMANTIC_XNET) ?
+ 		_socket_xnet_funcs.connect(fd, serv_addr, addrlen) :
+ #endif
+@@ -1393,7 +1445,7 @@
+ 	return __perform_connect(fd, serv_addr, addrlen, SOCKET_SEMANTIC_DEFAULT);
+ }
+ 
+-#if defined( SOLARIS_BUILD )
++#if defined(__SVR4) && defined(__sun)
+ int __xnet_connect(int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
+ {
+ 	return __perform_connect(fd, serv_addr, addrlen, SOCKET_SEMANTIC_XNET);
+@@ -1410,7 +1462,7 @@
+ static inline int __listen_semantics(int fd, int backlog, int semantics)
+ {
+ 	return
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ 		(semantics == SOCKET_SEMANTIC_XNET) ?
+ 		_socket_xnet_funcs.listen(fd, backlog) :
+ #endif
+@@ -1564,7 +1616,7 @@
+ 	return __perform_listen(fd, backlog, SOCKET_SEMANTIC_DEFAULT);
+ }
+ 
+-#ifdef SOLARIS_BUILD
++#if defined(__SVR4) && defined(__sun)
+ int __xnet_listen(int fd, int backlog)
+ {
+ 	return __perform_listen(fd, backlog, SOCKET_SEMANTIC_XNET);
+@@ -1735,7 +1787,11 @@
+ 
+ /* ========================================================================= */
+ /*..getsockname -- replacement getsocknanme call.                            */
++#if defined(__SVR4) && defined(__sun)
++int getsockname(int fd, struct sockaddr *name, Psocklen_t * namelen)
++#else
+ int getsockname(int fd, struct sockaddr *name, socklen_t * namelen)
++#endif
+ {
+ 	int ret = 0;
+ 	char buf[MAX_ADDR_STR_LEN];
+@@ -1768,7 +1824,11 @@
+ 
+ 	__sdp_log(2, "GETSOCKNAME <%s:%d>\n", program_invocation_short_name, fd);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	ret = _socket_funcs.getsockname(fd, name, namelen);
++#else
++	ret = _socket_funcs.getsockname(fd, name, (Psocklen_t *)namelen);
++#endif
+ 
+ 	if (__sdp_log_get_level() <= 1) {
+ 		if (get_addr_str(name, buf, MAX_ADDR_STR_LEN)) {
+@@ -1786,7 +1846,11 @@
+ 
+ /* ========================================================================= */
+ /*..getpeername -- replacement getpeername call. */
++#if defined(__SVR4) && defined(__sun)
++int getpeername(int fd, struct sockaddr *name, Psocklen_t * namelen)
++#else
+ int getpeername(int fd, struct sockaddr *name, socklen_t * namelen)
++#endif
+ {
+ 	int ret = 0;
+ 
+@@ -1815,7 +1879,12 @@
+ 
+ 	__sdp_log(2, "GETPEERNAME <%s:%d>\n", program_invocation_short_name, fd);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	ret = _socket_funcs.getpeername(fd, name, namelen);
++#else
++	ret = _socket_funcs.getpeername(fd, name, (Psocklen_t *)namelen);
++#endif
++
+ 
+ 	__sdp_log(2, "GETPEERNAME <%s:%d> result <%d:%d> family=%d s_addr=%d\n",
+ 			  program_invocation_short_name, fd, ret,
+@@ -1833,7 +1902,11 @@
+   If we have a shadow we need to decide which socket we want to accept on
+   so we select first and then give priority based on previous selection
+ */
++#if defined(__SVR4) && defined(__sun)
++int accept(int fd, struct sockaddr *addr, Psocklen_t * addrlen)
++#else
+ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen)
++#endif
+ {
+ 	int shadow_fd;
+ 	int ret = 0;
+@@ -1870,7 +1943,11 @@
+ 	}
+ 
+ 	if (addr && addrlen)
++#if defined(__SVR4) && defined(__sun)
++		saved_addrlen = *(socklen_t *)addrlen;
++#else
+ 		saved_addrlen = *addrlen;
++#endif
+ 
+ 	__sdp_log(2, "ACCEPT: <%s:%d>\n", program_invocation_short_name, fd);
+ 
+@@ -1879,7 +1956,11 @@
+ 		__sdp_log(1, "ACCEPT: fd <%d> opts are <0x%x>\n", fd, fopts);
+ 
+ 		__sdp_log(7, "ACCEPT: accepting on single fd:<%d>\n", fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 		ret = _socket_funcs.accept(fd, addr, addrlen);
++#else
++		ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 		if (ret < 0) {
+ 			if (!(fopts & O_NONBLOCK && errno == EWOULDBLOCK))
+ 				__sdp_log(9, "Error accept: accept returned :<%d> %s\n",
+@@ -1894,10 +1975,18 @@
+ 				  shadow_fd, fopts);
+ 
+ 		/* we need different behavior for NONBLOCK or signal IO and BLOCK */
++#if defined(__SVR4) && defined(__sun)
++		if ((fopts > 0) && (fopts & O_NONBLOCK)) {
++#else
+ 		if ((fopts > 0) && (fopts & (O_NONBLOCK | FASYNC))) {
++#endif
+ 			__sdp_log(1, "ACCEPT: accepting (nonblock) on SDP fd:<%d>\n", shadow_fd);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 			ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
++#else
++			ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 			if (ret >= 0) {
+ 				set_is_sdp_socket(ret, 1);
+ 
+@@ -1908,7 +1997,11 @@
+ 						  shadow_fd, ret, errno);
+ 
+ 				__sdp_log(1, "ACCEPT: accepting (nonblock) on TCP fd:<%d>\n", fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 				ret = _socket_funcs.accept(fd, addr, addrlen);
++#else
++				ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 				if (ret >= 0) {
+ 					__sdp_log(7, "ACCEPT: accepted (nonblock) TCP fd:<%d>\n",
+ 							  shadow_fd);
+@@ -1931,11 +2024,19 @@
+ 					if (FD_ISSET(fd, &fds)) {
+ 						set_last_accept(fd, 1);
+ 						__sdp_log(7, "ACCEPT: accepting on TCP fd:<%d>\n", fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 						ret = _socket_funcs.accept(fd, addr, addrlen);
++#else
++						ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 					} else {
+ 						__sdp_log(7, "ACCEPT: accepting on SDP fd:<%d>\n",
+ 								  shadow_fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 						ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
++#else
++						ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 						if (ret >= 0)
+ 							set_is_sdp_socket(ret, 1);
+ 					}
+@@ -1944,12 +2045,20 @@
+ 						set_last_accept(fd, 1);
+ 						__sdp_log(7, "ACCEPT: accepting on SDP fd:<%d>\n",
+ 								  shadow_fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 						ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
++#else
++						ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 						if (ret >= 0)
+ 							set_is_sdp_socket(ret, 1);
+ 					} else {
+ 						__sdp_log(7, "ACCEPT: accepting on TCP fd:<%d>\n", fd);
++#if !(defined(__SVR4) && defined(__sun))
+ 						ret = _socket_funcs.accept(fd, addr, addrlen);
++#else
++						ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
++#endif
+ 					}
+ 				}
+ 			} else {
+@@ -1966,7 +2075,11 @@
+ 	}							/* shadow fd */
+ 
+ 	if ((__sdp_log_get_level() <= 1) && (ret >= 0) && addr && addrlen) {
++#if defined(__SVR4) && defined(__sun)
++		get_addr_str(addr, buf, *(socklen_t *)addrlen);
++#else
+ 		get_addr_str(addr, buf, *addrlen);
++#endif
+ 		__sdp_log(1, "ACCEPT: accepted from:%s port:%d into fd:%d\n",
+ 				  buf, ntohs(((struct sockaddr_in *) addr)->sin_port), ret);
+ 	}
+@@ -2262,6 +2375,7 @@
+ 	return ret;
+ }								/* poll */
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ /* ========================================================================= */
+ /*..epoll_create -- replacement socket call.                                 */
+ /*
+@@ -2388,6 +2502,7 @@
+ }								/* epoll_pwait */
+ 
+ /* ========================================================================= */
++#endif
+ 
+ /* --------------------------------------------------------------------- */
+ /*                                                                       */
+@@ -2523,6 +2638,7 @@
+ 		fprintf(stderr, "%s\n", error_str);
+ 	}
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	_socket_funcs.epoll_create = dlsym(__libc_dl_handle, "epoll_create");
+ 	if (NULL != (error_str = dlerror())) {
+ 		fprintf(stderr, "%s\n", error_str);
+@@ -2542,7 +2658,7 @@
+ 	if (NULL != (error_str = dlerror())) {
+ 		fprintf(stderr, "%s\n", error_str);
+ 	}
+-#ifdef SOLARIS_BUILD
++#else
+ 	_socket_xnet_funcs.socket = dlsym(__libc_dl_handle, "__xnet_socket");
+ 	if (NULL != (error_str = dlerror())) {
+ 		fprintf(stderr, "%s\n", error_str);
+diff -r de0231b8e245 src/socket.c
+--- a/src/socket.c	Tue Feb 23 22:30:48 2016 -0800
++++ b/src/socket.c	Tue Feb 23 22:30:49 2016 -0800
+@@ -52,7 +52,9 @@
+ /*
+  * SDP specific includes
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ #include "linux/sdp_inet.h"
++#endif
+ 
+ #if 0
+ #define _SDP_VERBOSE_PRELOAD
+@@ -148,7 +150,11 @@
+                        "int $0x80\n"      /* do syscall */
+                        "movl %1, %%ebx\n" /* restore %ebx */
+                        : "=a" (__ret), "=r" (__scratch)
++#if defined(__SVR4) && defined(__sun)
++                       : "0" (SYS_so_socket),
++#else
+                        : "0" (__NR_socketcall),
++#endif
+ 		       "g" (SOCKOP_socket),
+ 		       "c" (call));
+   return __ret;
--- a/components/open-fabrics/libsdp/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1011 +0,0 @@
-diff -r -u /tmp/895782/libsdp-1.1.108/Makefile.am libsdp-1.1.108/Makefile.am
---- /tmp/895782/libsdp-1.1.108/Makefile.am	Tue Sep 21 01:47:36 2010
-+++ libsdp-1.1.108/Makefile.am	Wed Feb 16 15:42:54 2011
-@@ -7,9 +7,9 @@
- 
- install-data-hook:
- 	if test -e $(DESTDIR)$(sysconfdir)/libsdp.conf; then \
--		diff -q $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
-+		diff $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
- 		if test $$? == 1; then \
--			t=$(shell date +'%Y%m%d%H%M%S'); \
-+			t=$(shell date +'m%d09/20/10M%S'); \
- 		   cp -p $(srcdir)/libsdp.conf \
- 				$(DESTDIR)$(sysconfdir)/libsdp.conf.$$t; \
- 			echo "NOTE: existing libsdp.conf was not updated."; \
-diff -r -u /tmp/895782/libsdp-1.1.108/README libsdp-1.1.108/README
---- /tmp/895782/libsdp-1.1.108/README	Tue Sep 21 01:47:36 2010
-+++ libsdp-1.1.108/README	Fri Feb 11 04:30:29 2011
-@@ -13,14 +13,12 @@
- libsdp.so isn't setup automatically. it can be used in one of 2 ways:
- 1) LD_PRELOAD environment variable. Setting this to the name of the
-    library you want to use will cause it to be preloaded.
--2) Adding the name of the library into /etc/ld.so.preload. This will
--   cause the library to be preloaded for every executable that is linked
--   with libc.
--
-+2) Adding the name of the library  using crle(1).
-+   
- The library should be installed in a directory in which the dynamic loader
--searches for shared libraries (as specified by LD_LIBRARY_PATH,
--/etc/ld.so.conf, etc). Alternatively, you can specify the full path to the 
--library that you want to use in LD_PRELOAD or /etc/ld.so.preload as described 
-+searches for shared libraries (as specified by LD_LIBRARY_PATH, crle(1)
-+, etc). Alternatively, you can specify the full path to the 
-+library that you want to use in LD_PRELOAD or crle(1) described 
- above.
- 
- The last option cant be used if you have multiple library versions
-@@ -29,7 +27,7 @@
- lib (the 32 bit version) and lib64 directories and LD_RELOAD the libsdp.so.
- This way the correct 32/64bit libsdp.so will be selected. 
- For example running ssh over SDP with OFED distribution from bash this can be written:
--LD_LIBRARY_PATH=/usr/local/ofed/lib64:/usr/local/ofed/lib LD_PRELOAD=libsdp.so ssh
-+LD_LIBRARY_PATH=/usr/lib/secure/64/:/usr/lib/secure LD_PRELOAD=libsdp.so ssh
- 
- CONFIGURATION:
- --------------
-@@ -39,6 +37,13 @@
- * selective mode where it uses a configuration file to select which sockets
-   will be using SDP and which will not.
- 
-+Note:
-+	both of these modes are designed to work with both IPv4 qand IPv6.
-+	But only IPv4 works currently, because Solaris SDP with IPv6,
-+	does not use AF_INET_SDP. (Note in Linux, the underlying SDP kernel
-+	implementation does not support IPv6.)
-+
-+
- For real world applications where communication with X, authentication, 
- DNS and other servers connected through TCP is required the selective mode
- is required.
-@@ -49,20 +54,11 @@
- * the configuration file does not include any address family rule
- 
- For information on how to configure libsdp, see libsdp.conf, which is installed
--in $(sysconfdir) (usually /usr/local/etc or /etc). The user can further control
-+in /etc). The user can further control
- the file to be used for configuration by setting the environment variable:
- LIBSDP_CONFIG_FILE
- 
- LIMITATIONS:
- ------------
--1. Applications statically linked with libc will not allow dynamic pre-loading
--   to port these applications to use SDP one needs to replace specific socket 
--   calls (within the application) with AF_INET_SDP and recompile.
--2. If for some reason the dynamic linker fail to pre-load libc before the 
--   libsdp.so is initialized or it does not support RTDL_NEXT, libsdp will 
--   fail to find the libc socket API. To overcome this situation a simple 
--   implementation of hijacking "socket" call is provided in libsdp_sys.
--   This partial implementation does not support any configuration and is 
--   limited to i386 architecture.
--3. Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
-+1. Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
-    needed for applications to operate properly.
-diff -r -u /tmp/895782/libsdp-1.1.108/libsdp.conf libsdp-1.1.108/libsdp.conf
---- /tmp/895782/libsdp-1.1.108/libsdp.conf	Mon Jan 10 07:38:13 2011
-+++ libsdp-1.1.108/libsdp.conf	Tue Jun 21 09:04:51 2011
-@@ -22,8 +22,8 @@
- #
- # By default we let all servers and client try SDP first.
- # to exclude SDP add "use tcp" rules before these defaults.
--use both server * *:*
--use both client * *:*
-+use sdp server * *:*
-+use sdp client * *:*
- #
- #
- ##############################################################################
-diff -r -u /tmp/895782/libsdp-1.1.108/src/Makefile.am libsdp-1.1.108/src/Makefile.am
---- /tmp/895782/libsdp-1.1.108/src/Makefile.am	Mon Oct  4 02:03:14 2010
-+++ libsdp-1.1.108/src/Makefile.am	Wed Feb 16 08:38:10 2011
-@@ -7,9 +7,6 @@
- 
- libsdp_la_SOURCES = log.c match.c port.c config_parser.c config_scanner.c
- libsdp_la_LDFLAGS = -version-info 1 -ldl -lc
--if SOLARIS_BUILD
--libsdp_la_LDFLAGS += -lsocket
--endif
- libsdp_sys_la_SOURCES = socket.c
- libsdp_sys_la_LDFLAGS = -version-info 1
- 
-diff -r -u /tmp/895782/libsdp-1.1.108/src/libsdp.h libsdp-1.1.108/src/libsdp.h
---- /tmp/895782/libsdp-1.1.108/src/libsdp.h	Sun Jan  9 23:35:25 2011
-+++ libsdp-1.1.108/src/libsdp.h	Sat Feb 19 17:39:54 2011
-@@ -27,7 +27,9 @@
- /*
-  * SDP specific includes
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- #include "linux/sdp_inet.h"
-+#endif
- 
- /* --------------------------------------------------------------------- */
- /* library static and global variables                                   */
-diff -r -u /tmp/895782/libsdp-1.1.108/src/port.c libsdp-1.1.108/src/port.c
---- /tmp/895782/libsdp-1.1.108/src/port.c	Mon Jan  3 01:29:24 2011
-+++ libsdp-1.1.108/src/port.c	Wed Feb 16 08:38:12 2011
-@@ -29,7 +29,10 @@
- #  include <config.h>
- #endif							/* HAVE_CONFIG_H */
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
-+
-+#define AF_INET6_SDP	34	/*  should be defined in socket.h but isn't */
-+
- /* Our prototypes for ioctl, get*name and accept do not strictly
-    match the headers - we use the following lines to move the header
-    versions 'out of the way' temporarily. */
-@@ -39,8 +42,9 @@
- #define accept __real_accept
- #define FASYNC 0
- #include <libgen.h>
--#endif
-+#else
- #include <unistd.h>
-+#endif
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -60,9 +64,11 @@
- #include <fcntl.h>
- #include <signal.h>
- #include <sys/poll.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <sys/epoll.h>
-+#endif
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- /* We're done protecting ourselves from the header prototypes */
- #undef ioctl
- #undef getsockname
-@@ -152,6 +158,7 @@
- typedef int (*poll_func_t) (struct pollfd * ufds,
- 							unsigned long int nfds, int timeout);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- typedef int (*epoll_create_func_t) (int size);
- 
- typedef int (*epoll_ctl_func_t) (int epfd,
-@@ -165,6 +172,7 @@
- 								   struct epoll_event * events,
- 								   int maxevents,
- 								   int timeout, const sigset_t * sigmask);
-+#endif
- 
- 
- struct socket_lib_funcs {
-@@ -184,13 +192,15 @@
- 	select_func_t select;
- 	pselect_func_t pselect;
- 	poll_func_t poll;
-+#if !(defined(__SVR4) && defined(__sun))
- 	epoll_create_func_t epoll_create;
- 	epoll_ctl_func_t epoll_ctl;
- 	epoll_wait_func_t epoll_wait;
- 	epoll_pwait_func_t epoll_pwait;
-+#endif
- };								/* socket_lib_funcs */
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- /* Solaris has another interface to socket functions prefixed with __xnet_ */
- struct socket_lib_xnet_funcs {
- 	socket_func_t socket;
-@@ -211,7 +221,7 @@
- 
- /* glibc provides these symbols - for Solaris builds we fake them
-  * until _init is called, at which point we quiz libdl.. */
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- char *program_invocation_name = "[progname]", *program_invocation_short_name =
- 	"[short_progname]";
- #else
-@@ -239,7 +249,7 @@
- 	/* Automatically sets all other elements to NULL */
- };								/* _socket_funcs */
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- static struct socket_lib_xnet_funcs _socket_xnet_funcs = {
- 	.socket = NULL,
- 	/* Automatically sets all other elements to NULL */
-@@ -366,6 +376,9 @@
- 
- static sa_family_t get_sdp_domain(int domain)
- {
-+#if defined(__SVR4) && defined(__sun)
-+		return domain;
-+#else
- 	if (AF_INET_SDP == domain || AF_INET6_SDP == domain)
- 		return domain;
- 
-@@ -377,6 +390,7 @@
- 	__sdp_log(9, "Error %s: unknown TCP domain: %d\n", __func__, domain);
- 
- 	return -1;
-+#endif
- }
- 
- static int get_sock_domain(int sd)
-@@ -424,10 +438,18 @@
- static inline int is_invalid_addr(const void *p)
- {
- 	/* HACK: on some systems we can not write to check for pointer validity */
-+
-+	int old_errno = errno;
-+
-+	errno = 0;
-+#if defined(__SVR4) && defined(__sun)
-+	size_t ret = write(dev_null_fd, p, 1);
-+#else
- 	size_t ret = fcntl(dev_null_fd, F_GETLK, p);
-+#endif
- 
- 	ret = (errno == EFAULT);
--	errno = 0;
-+	errno = old_errno;
- 	return ret;
- }
- 
-@@ -636,12 +658,15 @@
- 										   int type,
- 										   int protocol, int semantics)
- {
-+__sdp_log(1, "__create_socket_semantic: socket domain:%d type:%d proto:%d semantics:%d\n", domain, type, protocol, semantics);
- 	return
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- 		(semantics == SOCKET_SEMANTIC_XNET) ?
- 		_socket_xnet_funcs.socket(domain, type, protocol) :
--#endif
- 		_socket_funcs.socket(domain, type, protocol);
-+#else
-+		_socket_funcs.socket(domain, type, protocol);
-+#endif
- }
- 
- /* Contains the main logic for creating shadow SDP sockets */
-@@ -703,7 +728,12 @@
- 
- 		__sdp_log(1, "SOCKET: making SDP socket type:%d proto:%d\n",
- 				  type, protocol);
-+#if defined(__SVR4) && defined(__sun)
-+		s = __create_socket_semantic(sdp_domain, type, PROTO_SDP, semantics);
-+
-+#else
- 		s = __create_socket_semantic(sdp_domain, type, protocol, semantics);
-+#endif
- 		init_extra_attribute(s);
- 		set_is_sdp_socket(s, 1);
- 		goto done;
-@@ -722,9 +752,14 @@
- 				protocol = IPPROTO_TCP;
- 			__sdp_log(1, "SOCKET: making SDP shadow socket type:%d proto:%d\n",
- 					  type, protocol);
-+#if defined(__SVR4) && defined(__sun)
- 			shadow_fd =
--				__create_socket_semantic(sdp_domain, type, protocol,
--										 semantics);
-+				__create_socket_semantic(sdp_domain, type, PROTO_SDP, semantics);
-+#else
-+			shadow_fd =
-+				__create_socket_semantic(sdp_domain, type, protocol, semantics);
-+
-+#endif
- 			if (is_valid_fd(shadow_fd)) {
- 				init_extra_attribute(shadow_fd);
- 				if (libsdp_fd_attributes[s].shadow_fd != -1) {
-@@ -761,7 +796,7 @@
- 	return __create_socket(domain, type, protocol, SOCKET_SEMANTIC_DEFAULT);
- }
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- int __xnet_socket(int domain, int type, int protocol)
- {
- 	return __create_socket(domain, type, protocol, SOCKET_SEMANTIC_XNET);
-@@ -808,7 +843,7 @@
- 				 socklen_t addrlen, int semantics)
- {
- 	return
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- 		(semantics == SOCKET_SEMANTIC_XNET) ?
- 		_socket_xnet_funcs.bind(fd, my_addr, addrlen) :
- #endif
-@@ -852,7 +887,11 @@
- 		__sdp_log(1, "find_free_port: taking loop (%d)\n", ++num_of_loops);
- 
- 		__sdp_log(1, "find_free_port: creating the two sockets\n");
-+#if defined(__SVR4) && defined(__sun)
-+		tmp_sd[0] = _socket_funcs.socket(sdp_domain, SOCK_STREAM,  PROTO_SDP);
-+#else
- 		tmp_sd[0] = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP);
-+#endif
- 		if (tmp_sd[0] < 0) {
- 			__sdp_log(8, "Warning find_free_port: creating first socket failed\n");
- 			goto done;
-@@ -916,6 +955,7 @@
- 						  strerror(errno));
- 				goto close_and_mark;
- 			} else {
-+#if !(defined(__SVR4) && defined(__sun))
- 				int err;
- 				socklen_t len = sizeof(int);
- 
-@@ -933,6 +973,7 @@
- 					 * Continue only with TCP */
- 					goto close_and_mark;
- 				}
-+#endif
- 				__sdp_log(1, "find_free_port: %s port %u was busy\n",
- 					  1 - tmp_turn ? "tcp" : "sdp",
- 					  ntohs(((const struct sockaddr_in *)sin_addr)->sin_port));
-@@ -995,7 +1036,11 @@
- 	}
- 
- 	__sdp_log(2, "check_legal_bind: binding two temporary sockets\n");
-+#if defined(__SVR4) && defined(__sun)
-+	*sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM,  PROTO_SDP);
-+#else
- 	*sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP);
-+#endif
- 	if (*sdp_sd < 0) {
- 		__sdp_log(9, "Error check_legal_bind: " "creating SDP socket failed\n");
- 		goto done;
-@@ -1035,6 +1080,7 @@
- 
- 		if (EADDRINUSE != errno)
- 			goto done;
-+#if !(defined(__SVR4) && defined(__sun))
- 		if (-1 == getsockopt(*sdp_sd, SOL_TCP, SDP_LAST_BIND_ERR, &err, &len)) {
- 			__sdp_log(9, "Error check_legal_bind:getsockopt: %s\n",
- 					  strerror(errno));
-@@ -1057,6 +1103,12 @@
- 		/* Continue only with TCP */
- 		_socket_funcs.close(*sdp_sd);
- 		*sdp_sd = -1;
-+#else
-+		errno = EINVAL;
-+		_socket_funcs.close( *sdp_sd );
-+		_socket_funcs.close( *tcp_sd );
-+		goto done;
-+#endif
- 	}
- 
- 	__sdp_log(1, "check_legal_bind: binding TCP socket\n");
-@@ -1241,7 +1293,7 @@
- 	return __perform_bind(fd, my_addr, addrlen, SOCKET_SEMANTIC_DEFAULT);
- }
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- int __xnet_bind(int fd, const struct sockaddr *my_addr, socklen_t addrlen)
- {
- 	return __perform_bind(fd, my_addr, addrlen, SOCKET_SEMANTIC_XNET);
-@@ -1262,7 +1314,7 @@
- 					socklen_t addrlen, int semantics)
- {
- 	return
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) & defined(__sun)
- 		(semantics == SOCKET_SEMANTIC_XNET) ?
- 		_socket_xnet_funcs.connect(fd, serv_addr, addrlen) :
- #endif
-@@ -1393,7 +1445,7 @@
- 	return __perform_connect(fd, serv_addr, addrlen, SOCKET_SEMANTIC_DEFAULT);
- }
- 
--#if defined( SOLARIS_BUILD )
-+#if defined(__SVR4) && defined(__sun)
- int __xnet_connect(int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
- {
- 	return __perform_connect(fd, serv_addr, addrlen, SOCKET_SEMANTIC_XNET);
-@@ -1410,7 +1462,7 @@
- static inline int __listen_semantics(int fd, int backlog, int semantics)
- {
- 	return
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- 		(semantics == SOCKET_SEMANTIC_XNET) ?
- 		_socket_xnet_funcs.listen(fd, backlog) :
- #endif
-@@ -1564,7 +1616,7 @@
- 	return __perform_listen(fd, backlog, SOCKET_SEMANTIC_DEFAULT);
- }
- 
--#ifdef SOLARIS_BUILD
-+#if defined(__SVR4) && defined(__sun)
- int __xnet_listen(int fd, int backlog)
- {
- 	return __perform_listen(fd, backlog, SOCKET_SEMANTIC_XNET);
-@@ -1735,7 +1787,11 @@
- 
- /* ========================================================================= */
- /*..getsockname -- replacement getsocknanme call.                            */
-+#if defined(__SVR4) && defined(__sun)
-+int getsockname(int fd, struct sockaddr *name, Psocklen_t * namelen)
-+#else
- int getsockname(int fd, struct sockaddr *name, socklen_t * namelen)
-+#endif
- {
- 	int ret = 0;
- 	char buf[MAX_ADDR_STR_LEN];
-@@ -1768,7 +1824,11 @@
- 
- 	__sdp_log(2, "GETSOCKNAME <%s:%d>\n", program_invocation_short_name, fd);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	ret = _socket_funcs.getsockname(fd, name, namelen);
-+#else
-+	ret = _socket_funcs.getsockname(fd, name, (Psocklen_t *)namelen);
-+#endif
- 
- 	if (__sdp_log_get_level() <= 1) {
- 		if (get_addr_str(name, buf, MAX_ADDR_STR_LEN)) {
-@@ -1786,7 +1846,11 @@
- 
- /* ========================================================================= */
- /*..getpeername -- replacement getpeername call. */
-+#if defined(__SVR4) && defined(__sun)
-+int getpeername(int fd, struct sockaddr *name, Psocklen_t * namelen)
-+#else
- int getpeername(int fd, struct sockaddr *name, socklen_t * namelen)
-+#endif
- {
- 	int ret = 0;
- 
-@@ -1815,8 +1879,13 @@
- 
- 	__sdp_log(2, "GETPEERNAME <%s:%d>\n", program_invocation_short_name, fd);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	ret = _socket_funcs.getpeername(fd, name, namelen);
-+#else
-+	ret = _socket_funcs.getpeername(fd, name, (Psocklen_t *)namelen);
-+#endif
- 
-+
- 	__sdp_log(2, "GETPEERNAME <%s:%d> result <%d:%d> family=%d s_addr=%d\n",
- 			  program_invocation_short_name, fd, ret,
- 			  (!(0 > ret) ? 0 : -1), name->sa_family,
-@@ -1833,7 +1902,11 @@
-   If we have a shadow we need to decide which socket we want to accept on
-   so we select first and then give priority based on previous selection
- */
-+#if defined(__SVR4) && defined(__sun)
-+int accept(int fd, struct sockaddr *addr, Psocklen_t * addrlen)
-+#else
- int accept(int fd, struct sockaddr *addr, socklen_t * addrlen)
-+#endif
- {
- 	int shadow_fd;
- 	int ret = 0;
-@@ -1870,7 +1943,11 @@
- 	}
- 
- 	if (addr && addrlen)
-+#if defined(__SVR4) && defined(__sun)
-+		saved_addrlen = *(socklen_t *)addrlen;
-+#else
- 		saved_addrlen = *addrlen;
-+#endif
- 
- 	__sdp_log(2, "ACCEPT: <%s:%d>\n", program_invocation_short_name, fd);
- 
-@@ -1879,7 +1956,11 @@
- 		__sdp_log(1, "ACCEPT: fd <%d> opts are <0x%x>\n", fd, fopts);
- 
- 		__sdp_log(7, "ACCEPT: accepting on single fd:<%d>\n", fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 		ret = _socket_funcs.accept(fd, addr, addrlen);
-+#else
-+		ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 		if (ret < 0) {
- 			if (!(fopts & O_NONBLOCK && errno == EWOULDBLOCK))
- 				__sdp_log(9, "Error accept: accept returned :<%d> %s\n",
-@@ -1894,10 +1975,18 @@
- 				  shadow_fd, fopts);
- 
- 		/* we need different behavior for NONBLOCK or signal IO and BLOCK */
-+#if defined(__SVR4) && defined(__sun)
-+		if ((fopts > 0) && (fopts & O_NONBLOCK)) {
-+#else
- 		if ((fopts > 0) && (fopts & (O_NONBLOCK | FASYNC))) {
-+#endif
- 			__sdp_log(1, "ACCEPT: accepting (nonblock) on SDP fd:<%d>\n", shadow_fd);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 			ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
-+#else
-+			ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 			if (ret >= 0) {
- 				set_is_sdp_socket(ret, 1);
- 
-@@ -1908,7 +1997,11 @@
- 						  shadow_fd, ret, errno);
- 
- 				__sdp_log(1, "ACCEPT: accepting (nonblock) on TCP fd:<%d>\n", fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 				ret = _socket_funcs.accept(fd, addr, addrlen);
-+#else
-+				ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 				if (ret >= 0) {
- 					__sdp_log(7, "ACCEPT: accepted (nonblock) TCP fd:<%d>\n",
- 							  shadow_fd);
-@@ -1931,11 +2024,19 @@
- 					if (FD_ISSET(fd, &fds)) {
- 						set_last_accept(fd, 1);
- 						__sdp_log(7, "ACCEPT: accepting on TCP fd:<%d>\n", fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 						ret = _socket_funcs.accept(fd, addr, addrlen);
-+#else
-+						ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 					} else {
- 						__sdp_log(7, "ACCEPT: accepting on SDP fd:<%d>\n",
- 								  shadow_fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 						ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
-+#else
-+						ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 						if (ret >= 0)
- 							set_is_sdp_socket(ret, 1);
- 					}
-@@ -1944,12 +2045,20 @@
- 						set_last_accept(fd, 1);
- 						__sdp_log(7, "ACCEPT: accepting on SDP fd:<%d>\n",
- 								  shadow_fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 						ret = _socket_funcs.accept(shadow_fd, addr, addrlen);
-+#else
-+						ret = _socket_funcs.accept(shadow_fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 						if (ret >= 0)
- 							set_is_sdp_socket(ret, 1);
- 					} else {
- 						__sdp_log(7, "ACCEPT: accepting on TCP fd:<%d>\n", fd);
-+#if !(defined(__SVR4) && defined(__sun))
- 						ret = _socket_funcs.accept(fd, addr, addrlen);
-+#else
-+						ret = _socket_funcs.accept(fd, addr, (Psocklen_t *)addrlen);
-+#endif
- 					}
- 				}
- 			} else {
-@@ -1966,7 +2075,11 @@
- 	}							/* shadow fd */
- 
- 	if ((__sdp_log_get_level() <= 1) && (ret >= 0) && addr && addrlen) {
-+#if defined(__SVR4) && defined(__sun)
-+		get_addr_str(addr, buf, *(socklen_t *)addrlen);
-+#else
- 		get_addr_str(addr, buf, *addrlen);
-+#endif
- 		__sdp_log(1, "ACCEPT: accepted from:%s port:%d into fd:%d\n",
- 				  buf, ntohs(((struct sockaddr_in *) addr)->sin_port), ret);
- 	}
-@@ -2262,6 +2375,7 @@
- 	return ret;
- }								/* poll */
- 
-+#if !(defined(__SVR4) && defined(__sun))
- /* ========================================================================= */
- /*..epoll_create -- replacement socket call.                                 */
- /*
-@@ -2388,6 +2502,7 @@
- }								/* epoll_pwait */
- 
- /* ========================================================================= */
-+#endif
- 
- /* --------------------------------------------------------------------- */
- /*                                                                       */
-@@ -2523,6 +2638,7 @@
- 		fprintf(stderr, "%s\n", error_str);
- 	}
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	_socket_funcs.epoll_create = dlsym(__libc_dl_handle, "epoll_create");
- 	if (NULL != (error_str = dlerror())) {
- 		fprintf(stderr, "%s\n", error_str);
-@@ -2542,7 +2658,7 @@
- 	if (NULL != (error_str = dlerror())) {
- 		fprintf(stderr, "%s\n", error_str);
- 	}
--#ifdef SOLARIS_BUILD
-+#else
- 	_socket_xnet_funcs.socket = dlsym(__libc_dl_handle, "__xnet_socket");
- 	if (NULL != (error_str = dlerror())) {
- 		fprintf(stderr, "%s\n", error_str);
-diff -r -u /tmp/895782/libsdp-1.1.108/src/log.c libsdp-1.1.108/src/log.c
---- /tmp/895782/libsdp-1.1.108/src/log.c	Mon Nov  8 01:46:52 2010
-+++ libsdp-1.1.108/src/log.c	Wed Feb 16 08:38:11 2011
-@@ -79,20 +79,16 @@
- 	switch ( __sdp_log_type ) {
- 	case SDP_LOG_SYSLOG:
- 		sprintf( extra_format, "%s[%d] libsdp %s ",
--					program_invocation_short_name, getpid(  ), format );
-+					program_invocation_short_name, (int)getpid(  ), format );
- 		vsyslog( LOG_USER | LOG_NOTICE, extra_format, ap );
- 		break;
- 	case SDP_LOG_FILE:
- 		timeval = time(NULL);
--#ifdef SOLARIS_BUILD
--		ctime_r(&timeval, timestr, sizeof timestr);
--#else
-                 ctime_r(&timeval, timestr);
--#endif
- 		timestr[strlen(timestr)-1] = '\0';
- 		sprintf( extra_format, "%s %s[%d] libsdp %s ",
- 					timestr, program_invocation_short_name,
--					getpid(  ), format );
-+					(int)getpid(  ), format );
- 		if ( __sdp_log_file == NULL ) {
- 			vfprintf( stderr, extra_format, ap );
- #if 0									  /* might slow everything too much? */
-diff -r -u /tmp/895782/libsdp-1.1.108/src/match.c libsdp-1.1.108/src/match.c
---- /tmp/895782/libsdp-1.1.108/src/match.c	Mon Jan 17 05:44:02 2011
-+++ libsdp-1.1.108/src/match.c	Wed Feb 16 08:38:11 2011
-@@ -39,7 +39,9 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <sys/types.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <linux/types.h>
-+#endif
- 
- /*
-  * SDP specific includes
-@@ -87,8 +89,13 @@
- 	snprintf( buf, len, "use %s %s %s:%s", target, prog, addr_buf, ports_buf );
- }
- 
-+#if !(defined(__SVR4) && defined(__sun))
- static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
- 				      unsigned int prefixlen)
-+#else
-+static inline int __ipv6_prefix_equal(const uint32_t *a1, const uint32_t *a2,
-+				      unsigned int prefixlen)
-+#endif
- {
- 	unsigned pdw, pbi;
- 
-@@ -109,7 +116,11 @@
- 				    const struct in6_addr *a2,
- 				    unsigned int prefixlen)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
-+#else
-+	return __ipv6_prefix_equal(a1->_S6_un._S6_u32, a2->_S6_un._S6_u32,
-+#endif
- 				   prefixlen);
- }
- 
-diff -r -u /tmp/895782/libsdp-1.1.108/src/socket.c libsdp-1.1.108/src/socket.c
---- /tmp/895782/libsdp-1.1.108/src/socket.c	Thu Oct 28 01:15:00 2010
-+++ libsdp-1.1.108/src/socket.c	Wed Feb 16 08:38:12 2011
-@@ -52,7 +52,9 @@
- /*
-  * SDP specific includes
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- #include "linux/sdp_inet.h"
-+#endif
- 
- #if 0
- #define _SDP_VERBOSE_PRELOAD
-@@ -148,7 +150,11 @@
-                        "int $0x80\n"      /* do syscall */
-                        "movl %1, %%ebx\n" /* restore %ebx */
-                        : "=a" (__ret), "=r" (__scratch)
-+#if defined(__SVR4) && defined(__sun)
-+                       : "0" (SYS_so_socket),
-+#else
-                        : "0" (__NR_socketcall),
-+#endif
- 		       "g" (SOCKOP_socket),
- 		       "c" (call));
-   return __ret;
-diff -r -u /tmp/895782/libsdp-1.1.108/src/Makefile.in libsdp-1.1.108/src/Makefile.in
---- /tmp/895782/libsdp-1.1.108/src/Makefile.in	Mon Jan 31 23:49:09 2011
-+++ libsdp-1.1.108/src/Makefile.in	Wed Feb 16 08:38:10 2011
-@@ -37,7 +37,6 @@
- POST_UNINSTALL = :
- build_triplet = @build@
- host_triplet = @host@
--@SOLARIS_BUILD_TRUE@am__append_1 = -lsocket
- subdir = src
- DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
- 	$(srcdir)/Makefile.in
-@@ -55,7 +54,7 @@
-   esac;
- am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
- am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
--libLTLIBRARIES_INSTALL = $(INSTALL)
-+libLTLIBRARIES_INSTALL = $(INSTALL) -m 755
- LTLIBRARIES = $(lib_LTLIBRARIES)
- libsdp_la_LIBADD =
- am_libsdp_la_OBJECTS = log.lo match.lo port.lo config_parser.lo \
-@@ -144,12 +143,10 @@
- SED = @SED@
- SET_MAKE = @SET_MAKE@
- SHELL = @SHELL@
--SOLARIS_BUILD_FALSE = @SOLARIS_BUILD_FALSE@
--SOLARIS_BUILD_TRUE = @SOLARIS_BUILD_TRUE@
- STRIP = @STRIP@
- VERSION = @VERSION@
- WANT_LIBSDP_SYS_FALSE = @WANT_LIBSDP_SYS_FALSE@
--WANT_LIBSDP_SYS_TRUE = @WANT_LIBSDP_SYS_TRUE@
-+#WANT_LIBSDP_SYS_TRUE = @WANT_LIBSDP_SYS_TRUE@
- YACC = @YACC@
- ac_ct_AR = @ac_ct_AR@
- ac_ct_CC = @ac_ct_CC@
-@@ -195,7 +192,7 @@
- sysconfdir = @sysconfdir@
- target_alias = @target_alias@
- lib_LTLIBRARIES = libsdp.la $(LIB_SDP_SYS)
--@WANT_LIBSDP_SYS_TRUE@LIB_SDP_SYS = libsdp_sys.la
-+#@WANT_LIBSDP_SYS_TRUE@LIB_SDP_SYS = libsdp_sys.la
- AM_CFLAGS = -Wall -DSYSCONFDIR=\"$(sysconfdir)\"
- libsdp_la_SOURCES = log.c match.c port.c config_parser.c config_scanner.c
- libsdp_la_LDFLAGS = -version-info 1 -ldl -lc $(am__append_1)
-diff -r -u /tmp/895782/libsdp-1.1.108/Makefile.in libsdp-1.1.108/Makefile.in
---- /tmp/895782/libsdp-1.1.108/Makefile.in	Mon Jan 31 23:49:09 2011
-+++ libsdp-1.1.108/Makefile.in	Sat Feb 19 17:54:55 2011
-@@ -59,6 +59,12 @@
- 	install-recursive installcheck-recursive installdirs-recursive \
- 	pdf-recursive ps-recursive uninstall-info-recursive \
- 	uninstall-recursive
-+am__installdirs = "$(DESTDIR)$(man3libdir)" "$(DESTDIR)$(man5dir)"
-+man3libdir = $(mandir)/man3lib
-+man5dir = $(mandir)/man5
-+NROFF = nroff
-+man_MANS = man/libsdp.3lib man/libsdp.conf.5
-+MANS = $(man_MANS)
- ETAGS = etags
- CTAGS = ctags
- DIST_SUBDIRS = $(SUBDIRS)
-@@ -114,8 +120,6 @@
- LIBOBJS = @LIBOBJS@
- LIBS = @LIBS@
- LIBTOOL = @LIBTOOL@
--LINUX_BUILD_FALSE = @LINUX_BUILD_FALSE@
--LINUX_BUILD_TRUE = @LINUX_BUILD_TRUE@
- LN_S = @LN_S@
- LTLIBOBJS = @LTLIBOBJS@
- MAINT = @MAINT@
-@@ -131,11 +135,8 @@
- PACKAGE_VERSION = @PACKAGE_VERSION@
- PATH_SEPARATOR = @PATH_SEPARATOR@
- RANLIB = @RANLIB@
--SED = @SED@
- SET_MAKE = @SET_MAKE@
- SHELL = @SHELL@
--SOLARIS_BUILD_FALSE = @SOLARIS_BUILD_FALSE@
--SOLARIS_BUILD_TRUE = @SOLARIS_BUILD_TRUE@
- STRIP = @STRIP@
- VERSION = @VERSION@
- WANT_LIBSDP_SYS_FALSE = @WANT_LIBSDP_SYS_FALSE@
-@@ -185,7 +186,7 @@
- sysconfdir = @sysconfdir@
- target_alias = @target_alias@
- SUBDIRS = src
--EXTRA_DIST = libsdp.spec.in libsdp.conf
-+EXTRA_DIST = libsdp.spec.in libsdp.conf libsdp.3lib libsdp.conf.5
- all: config.h
- 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
- 
-@@ -252,6 +253,96 @@
- distclean-libtool:
- 	-rm -f libtool
- uninstall-info-am:
-+install-man5: $(man5_MANS) $(man_MANS)
-+	@$(NORMAL_INSTALL)
-+	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
-+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
-+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-+	for i in $$l2; do \
-+	  case "$$i" in \
-+	    *.5*) list="$$list $$i" ;; \
-+	  esac; \
-+	done; \
-+	for i in $$list; do \
-+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-+	  else file=$$i; fi; \
-+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-+	  case "$$ext" in \
-+	    5*) ;; \
-+	    *) ext='5' ;; \
-+	  esac; \
-+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
-+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
-+	done
-+uninstall-man5:
-+	@$(NORMAL_UNINSTALL)
-+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
-+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-+	for i in $$l2; do \
-+	  case "$$i" in \
-+	    *.5*) list="$$list $$i" ;; \
-+	  esac; \
-+	done; \
-+	for i in $$list; do \
-+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-+	  case "$$ext" in \
-+	    5*) ;; \
-+	    *) ext='5' ;; \
-+	  esac; \
-+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-+	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
-+	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
-+	done
-+install-man3lib: $(man3lib_MANS) $(man_MANS)
-+	@$(NORMAL_INSTALL)
-+	test -z "$(man3libdir)" || $(mkdir_p) "$(DESTDIR)$(man3libdir)"
-+	@list='$(man3lib_MANS) $(dist_man3lib_MANS) $(nodist_man3lib_MANS)'; \
-+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-+	for i in $$l2; do \
-+	  case "$$i" in \
-+	    *.3lib*) list="$$list $$i" ;; \
-+	  esac; \
-+	done; \
-+	for i in $$list; do \
-+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-+	  else file=$$i; fi; \
-+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-+	  case "$$ext" in \
-+	    3lib*) ;; \
-+	    *) ext='3lib' ;; \
-+	  esac; \
-+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3libdir)/$$inst'"; \
-+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3libdir)/$$inst"; \
-+	done
-+uninstall-man3lib:
-+	@$(NORMAL_UNINSTALL)
-+	@list='$(man3lib_MANS) $(dist_man3lib_MANS) $(nodist_man3lib_MANS)'; \
-+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-+	for i in $$l2; do \
-+	  case "$$i" in \
-+	    *.3lib*) list="$$list $$i" ;; \
-+	  esac; \
-+	done; \
-+	for i in $$list; do \
-+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-+	  case "$$ext" in \
-+	    3lib*) ;; \
-+	    *) ext='3lib' ;; \
-+	  esac; \
-+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
-+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-+	  echo " rm -f '$(DESTDIR)$(man3libdir)/$$inst'"; \
-+	  rm -f "$(DESTDIR)$(man3libdir)/$$inst"; \
-+	done
- 
- # This directory's subdirectories are mostly independent; you can cd
- # into them and run `make' without going through this Makefile.
-@@ -531,19 +622,23 @@
- 	       $(distcleancheck_listfiles) ; \
- 	       exit 1; } >&2
- check-am: all-am
--check: check-recursive
--all-am: Makefile config.h
-+check: installmandirs check-recursive
-+all-am: Makefile config.h installmandirs
-+installmandirs:
-+	for dir in "$(DESTDIR)$(man3libdir)" "$(DESTDIR)$(man5dir)"; do \
-+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
-+	done
- installdirs: installdirs-recursive
- installdirs-am:
--install: install-recursive
-+install: install-man install-recursive
- install-exec: install-exec-recursive
--install-data: install-data-recursive
-+install-data: install-data-am install-data-recursive
- uninstall: uninstall-recursive
- 
- install-am: all-am
- 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
- 
--installcheck: installcheck-recursive
-+installcheck: install-man installcheck-recursive
- install-strip:
- 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-@@ -579,16 +674,16 @@
- 
- info-am:
- 
--install-data-am:
-+install-data-am: install-man
- 	@$(NORMAL_INSTALL)
- 	$(MAKE) $(AM_MAKEFLAGS) install-data-hook
- 
-+install-man: install-man5 install-man3lib
-+
- install-exec-am:
- 
- install-info: install-info-recursive
- 
--install-man:
--
- installcheck-am:
- 
- maintainer-clean: maintainer-clean-recursive
-@@ -609,11 +704,14 @@
- 
- ps-am:
- 
--uninstall-am: uninstall-info-am
-+uninstall-am: uninstall-man uninstall-info-am
- 
- uninstall-info: uninstall-info-recursive
- 
--.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
-+uninstall-man: uninstall-man5 uninstall-man3lib
-+
-+.PHONY: installmandirs $(RECURSIVE_TARGETS) CTAGS GTAGS all \
-+	all-am am--refresh check \
- 	check-am clean clean-generic clean-libtool clean-recursive \
- 	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
- 	dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
-@@ -622,12 +720,14 @@
- 	distuninstallcheck dvi dvi-am html html-am info info-am \
- 	install install-am install-data install-data-am \
- 	install-data-hook install-exec install-exec-am install-info \
--	install-info-am install-man install-strip installcheck \
-+	install-info-am install-man install-man3lib install-man5 \
-+	install-strip installcheck \
- 	installcheck-am installdirs installdirs-am maintainer-clean \
- 	maintainer-clean-generic maintainer-clean-recursive \
- 	mostlyclean mostlyclean-generic mostlyclean-libtool \
- 	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
--	uninstall uninstall-am uninstall-info-am
-+	uninstall uninstall-am uninstall-info-am uninstall-man \
-+	uninstall-man3lib uninstall-man5
- 
- 
- dist-hook: libsdp.spec
-@@ -635,9 +735,9 @@
- 
- install-data-hook:
- 	if test -e $(DESTDIR)$(sysconfdir)/libsdp.conf; then \
--		diff -q $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
-+		diff $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf 1> /dev/null; \
- 		if test $$? == 1; then \
--			t=$(shell date +'%Y%m%d%H%M%S'); \
-+			t=$(shell date +'m%d01/26/11M%S'); \
- 		   cp -p $(srcdir)/libsdp.conf \
- 				$(DESTDIR)$(sysconfdir)/libsdp.conf.$$t; \
- 			echo "NOTE: existing libsdp.conf was not updated."; \
-@@ -648,7 +748,11 @@
- 			mkdir -p $(DESTDIR)$(sysconfdir); \
- 		fi; \
- 		cp -p $(srcdir)/libsdp.conf $(DESTDIR)$(sysconfdir)/libsdp.conf; \
--	fi
-+	fi; \
-+	cd $(DESTDIR)$(mandir)/man3lib && \
-+	$(RM) libssdp.3lib && \
-+	cd $(DESTDIR)$(mandir)/man5 && \
-+	$(RM) libssdp.conf.5
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
- # Otherwise a system limit (for SysV at least) may be exceeded.
- .NOEXPORT:
--- a/components/open-fabrics/libsif/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libsif/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -48,6 +48,8 @@
 
 CPPFLAGS += -DSOLARIS -I../../include/sif/ -I../../include/psifapi/ -I../../$(COMPONENT_SRC)/src/
 
+CONFIGURE_OPTIONS +=   --sysconfdir=$(ETCDIR)/infiniband
+
 COMPONENT_PREP_ACTION += cd $(COMPONENT_SRC)/src/ ; rm $(REMOVE_OLD_SRC) ; cd - ; \
                 (cd $(@D); \
 		autoreconf -ivf ; \
--- a/components/open-fabrics/libsif/patches/001-libsif-config.patch	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libsif/patches/001-libsif-config.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -3,7 +3,7 @@
 # and submit these changes to it, but do not yet have a target date of doing it.
 diff -r 1584d5cbb44d Makefile.am
 --- a/Makefile.am	Wed Feb 10 12:40:22 2016 +0530
-+++ b/Makefile.am	Tue Mar 01 16:24:16 2016 +0530
++++ b/Makefile.am	Mon Mar 07 19:29:59 2016 +0530
 @@ -9,7 +9,11 @@
    -avoid-version \
    -release @IBV_DEVICE_LIBRARY_EXTENSION@
@@ -17,19 +17,17 @@
  src_libsif_la_SOURCES = \
      src/cpu_features.c \
      src/cq.c \
-@@ -24,14 +28,20 @@
+@@ -24,14 +28,18 @@
  
  src_libsif_la_LDFLAGS = $(SIF_LDFLAGS) $(sif_version_script)
  
-+if SIF_SOLARIS
-+sifconfdir = $(datadir)/libibverbs.d
-+else
++if !SIF_SOLARIS
  src_libsifwa_la_SOURCES = src/sif_eps.c
  src_libsifwa_la_CFLAGS = $(AM_CFLAGS) $(NETLINK_CFLAGS)
  src_libsifwa_la_LDFLAGS = $(SIF_LDFLAGS) $(NETLINK_LIBS) $(sifwa_version_script)
++endif
  
  sifconfdir = $(sysconfdir)/libibverbs.d
-+endif
  sifconf_DATA = sif.driver
  
 +if !SIF_SOLARIS
@@ -38,7 +36,7 @@
  
  EXTRA_DIST = \
      libsif.spec.in \
-@@ -67,8 +77,10 @@
+@@ -67,8 +75,10 @@
      src/psif_hw_print.c
  
  libsif_includedir = $(includedir)/infiniband
@@ -53,7 +51,7 @@
  	@rm -f $(distdir)/m4/{sifdrv,psifapi}.m4
 diff -r 1584d5cbb44d configure.ac
 --- a/configure.ac	Wed Feb 10 12:40:22 2016 +0530
-+++ b/configure.ac	Tue Mar 01 16:24:16 2016 +0530
++++ b/configure.ac	Mon Mar 07 19:29:59 2016 +0530
 @@ -10,6 +10,10 @@
  # Silent rules by default - use make V=1 for verbose
  AM_SILENT_RULES([yes])
@@ -91,7 +89,7 @@
  dnl Checks for header files.
  AC_CHECK_HEADER(infiniband/driver.h, [],
      AC_MSG_ERROR([<infiniband/driver.h> not found.  libsif requires libibverbs.]))
-@@ -86,11 +91,34 @@
+@@ -86,11 +91,22 @@
  AC_SUBST(IBV_DEVICE_LIBRARY_EXTENSION)
  
  SIF_GET_CONTEXT_CONTAINER="return container_of(ibctx, struct sif_context, ibv_ctx);"
@@ -99,26 +97,14 @@
 +SIF_GET_SRQ_CONTAINER="return container_of(ibsrq, struct sif_rq, ibv_srq);"
 +SIF_GET_STRUCT="ibv"
  
--AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+if test $os_type = Linux; then
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
- 	[SIF_GET_CONTEXT_CONTAINER="return container_of(ibctx, struct sif_context, verbs_ctx.context);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+        [SIF_GET_QP_CONTAINER="return container_of(ibqp, struct sif_qp, verbs_qp.qp);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+        [SIF_GET_SRQ_CONTAINER="return container_of(ibsrq, struct sif_rq, verbs_srq.srq);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER], [SIF_GET_STRUCT="verbs"])
-+fi
-+
-+if test $os_type = SunOS ; then
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+        [SIF_GET_CONTEXT_CONTAINER="return container_of(ibctx, struct sif_context, ibv_ctx);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+        [SIF_GET_QP_CONTAINER="return container_of(ibqp, struct sif_qp, ibv_qp);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
-+        [SIF_GET_SRQ_CONTAINER="return container_of(ibsrq, struct sif_rq, ibv_srq);"])
-+    AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER], [SIF_GET_STRUCT="ibv"])
-+fi
+ AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
+-	[SIF_GET_CONTEXT_CONTAINER="return container_of(ibctx, struct sif_context, verbs_ctx.context);"])
++    [SIF_GET_CONTEXT_CONTAINER="return container_of(ibctx, struct sif_context, verbs_ctx.context);"])
++AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
++    [SIF_GET_QP_CONTAINER="return container_of(ibqp, struct sif_qp, verbs_qp.qp);"])
++AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER],dnl
++    [SIF_GET_SRQ_CONTAINER="return container_of(ibsrq, struct sif_rq, verbs_srq.srq);"])
++AM_CONDITIONAL([HAVE_VERBS_REGISTER_DRIVER], [SIF_GET_STRUCT="verbs"])
  
  AC_SUBST([SIF_GET_CONTEXT_CONTAINER])
 +AC_SUBST([SIF_GET_STRUCT])
@@ -129,7 +115,7 @@
      [if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
 diff -r 1584d5cbb44d sif.driver
 --- a/sif.driver	Wed Feb 10 12:40:22 2016 +0530
-+++ b/sif.driver	Tue Mar 01 16:24:16 2016 +0530
++++ b/sif.driver	Mon Mar 07 19:29:59 2016 +0530
 @@ -1,1 +1,6 @@
 +#
 +# Copyright (c) 2014, 2016, Oracle America, Inc. and its Affiliates
--- a/components/open-fabrics/libsif/patches/002-libsif-src.patch	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/libsif/patches/002-libsif-src.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -3,7 +3,7 @@
 # and submit these changes to it, but do not yet have a target date of doing it.
 diff -r 1584d5cbb44d src/cq.c
 --- a/src/cq.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/cq.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/cq.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -43,7 +43,9 @@
  #include <strings.h>
  #include <pthread.h>
@@ -82,7 +82,7 @@
  			lcqe.status, lcqe.vendor_err);
 diff -r 1584d5cbb44d src/encoding.h
 --- a/src/encoding.h	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/encoding.h	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/encoding.h	Mon Mar 21 15:04:35 2016 +0530
 @@ -37,16 +37,25 @@
  #define _SIF_ENCODING_H
  
@@ -129,7 +129,7 @@
  #undef wmb
 diff -r 1584d5cbb44d src/hwprint.c
 --- a/src/hwprint.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/hwprint.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/hwprint.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -34,6 +34,8 @@
   * hwprint.c: User level wrapper for hardware (generated) struct print support
   */
@@ -141,7 +141,7 @@
  #include "psif_hw_print.c"
 diff -r 1584d5cbb44d src/mr.c
 --- a/src/mr.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/mr.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/mr.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -45,6 +45,7 @@
  #include "sif_abi.h"
  #include "mr.h"
@@ -199,7 +199,7 @@
      fprintf(stderr, PFX "%s Not implemented\n", __func__);
 diff -r 1584d5cbb44d src/sif.c
 --- a/src/sif.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/sif.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/sif.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -44,6 +44,7 @@
  #include <sys/mman.h>
  #include <pthread.h>
@@ -344,7 +344,7 @@
      dev->ibv_dev.ops = sif_dev_ops;
 diff -r 1584d5cbb44d src/sif.h.in
 --- a/src/sif.h.in	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/sif.h.in	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/sif.h.in	Mon Mar 21 15:04:35 2016 +0530
 @@ -34,6 +34,9 @@
   * sif.h.in: TBD: **insert desc here**
   */
@@ -360,11 +360,11 @@
  #define PCI_DEVICE_ID_SIBS_PF       0x2188
  #define PCI_DEVICE_ID_SIBS_VF       0x2189
 +#define PCI_DEVICE_ID_SIBS2_PF      0x2198
-+#define PCI_DEVICE_ID_SIBS2_VF      0x2199
++#define PCI_DEVICE_ID_SIBS2_VF      0x2199	
  #endif
  
  #define HIDDEN      __attribute__((visibility ("hidden")))
-@@ -64,6 +69,19 @@
+@@ -64,6 +69,16 @@
  #define SOD_EXPLICIT_WC 0x1
  #define SOD_WC_TO_SQ 0x2
  
@@ -373,9 +373,6 @@
 +#define SIF_PAGE_SIZE	(1 << SIF_PAGE_SHIFT)
 +
 +#define        SIF_DOORBELL_IOCTL      30464
-+#define container_of(ptr, type, member) ({                      \
-+        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-+        (type *)( (char *)__mptr - offsetof(type,member) );})
 +#define SIFPRIx64 PRIx64
 +#include "sif_user.h"
 +#else
@@ -384,7 +381,7 @@
  enum sif_vendor_flags
  {
      MMU_special   =  0x1,  /* Use special mmu setup in associated mappings
-@@ -102,9 +120,10 @@
+@@ -102,9 +117,10 @@
      FLUSH_SQ,
      FLUSH_RQ
  };
@@ -396,7 +393,7 @@
      uint16_t            abi_version;
      uint32_t 		mr_size;  /* Maximal number of MRs in the system */
      uint64_t		min_resp_ms; /* Universal timeout scaling for sif */
-@@ -160,7 +179,7 @@
+@@ -160,7 +176,7 @@
  
  struct sif_rq {
      struct sif_map m;
@@ -405,7 +402,7 @@
      uint32_t index;
      uint32_t entries;
      uint32_t mask;     /* entries - 1 for modulo using & */
-@@ -185,7 +204,7 @@
+@@ -185,7 +201,7 @@
  };
  
  struct sif_context {
@@ -414,7 +411,7 @@
      enum sif_vendor_flags default_flags;
      enum sif_vendor_flags kernel_flags; /* Vendor flags set by the kernel */
      enum sif_mem_type mem_type;
-@@ -198,6 +217,9 @@
+@@ -198,6 +214,9 @@
      struct sif_mr **bypass_mr_ref;
      int bypass_cnt; /* Number of bypass MRs initiated - to avoid slow lookup unless bypass */
      uint64_t debug_mask;
@@ -424,7 +421,7 @@
      uint64_t opt_disable_mask;
      void (* fast_copy)(void *dst, const void *src, int len);
  };
-@@ -222,7 +244,7 @@
+@@ -222,7 +241,7 @@
  };
  
  struct sif_qp {
@@ -433,7 +430,7 @@
      uint32_t qp_idx;
      uint32_t magic;
      uint8_t  qosl;
-@@ -245,7 +267,11 @@
+@@ -245,7 +264,11 @@
  
  struct sif_mr {
      struct ibv_mr   ibv_mr;
@@ -445,7 +442,7 @@
      enum sif_mem_type mem_type;
  };
  
-@@ -298,12 +324,12 @@
+@@ -298,12 +321,12 @@
  
  static inline struct sif_qp *to_sqp(struct ibv_qp *ibqp)
  {
@@ -460,7 +457,7 @@
  }
  
  static inline struct sif_ah *to_sah(struct ibv_ah *ibah)
-@@ -353,6 +379,10 @@
+@@ -353,6 +376,10 @@
                          struct ibv_pd *pd, void *addr, size_t length,
                          int access);
  int sif_dereg_mr(struct ibv_mr *mr);
@@ -471,7 +468,7 @@
  struct ibv_mw *sif_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
  int sif_bind_mw(struct ibv_qp *qp, struct ibv_mw *mw, struct ibv_mw_bind *mw_bind);
  int sif_dealloc_mw(struct ibv_mw *mw);
-@@ -366,9 +396,13 @@
+@@ -366,9 +393,13 @@
  
  struct ibv_qp *sif_create_qp(struct ibv_pd *pd,
                     struct ibv_qp_init_attr *attr);
@@ -485,7 +482,7 @@
  int sif_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
             int attr_mask, struct ibv_qp_init_attr *init_attr);
  int sif_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-@@ -382,8 +416,6 @@
+@@ -382,8 +413,6 @@
  
  struct ibv_srq *sif_create_srq(struct ibv_pd *pd,
                   struct ibv_srq_init_attr *attr);
@@ -496,7 +493,7 @@
               int attr_mask);
 diff -r 1584d5cbb44d src/sif_abi.h
 --- a/src/sif_abi.h	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/sif_abi.h	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/sif_abi.h	Mon Mar 21 15:04:35 2016 +0530
 @@ -142,10 +142,12 @@
  	struct sif_create_srq_ext e;
  };
@@ -512,7 +509,7 @@
  	struct ibv_create_srq_resp ibv_resp;
 diff -r 1584d5cbb44d src/sndrcv.c
 --- a/src/sndrcv.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/sndrcv.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/sndrcv.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -45,10 +45,15 @@
  #include <errno.h>
  #include <netinet/in.h>
@@ -826,7 +823,7 @@
  
 diff -r 1584d5cbb44d src/sndrcv.h
 --- a/src/sndrcv.h	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/sndrcv.h	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/sndrcv.h	Mon Mar 21 15:04:35 2016 +0530
 @@ -36,7 +36,9 @@
  
  #ifndef _SIF_SNDRCV_H
@@ -839,7 +836,7 @@
  int sif_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr);
 diff -r 1584d5cbb44d src/uverbs.c
 --- a/src/uverbs.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/uverbs.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/uverbs.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -50,8 +50,11 @@
  #include "encoding.h"
  #include "sif_user.h"
@@ -852,7 +849,7 @@
  
  unsigned roundup_pwr2(unsigned x)
  {
-@@ -74,16 +77,24 @@
+@@ -74,16 +77,28 @@
      }
  }
  
@@ -870,9 +867,12 @@
  {
      int i;
      void *base = NULL;
--#ifdef HAVE_VERBS_REGISTER_DRIVER
 +#if defined(__SVR4) && defined(__sun)
+ #ifdef HAVE_VERBS_REGISTER_DRIVER
++    int fd = sctx->verbs_ctx.context.mmap_fd;
++#else
 +    int fd = sctx->ibv_ctx.mmap_fd;
++#endif /* HAVE_VERBS_REGISTER_DRIVER */
 +#else
      int fd = sctx->verbs_ctx.context.cmd_fd;
 -#else
@@ -880,7 +880,7 @@
  #endif
      struct sif_desc_cache* dc = &sctx->dc[type];
      uint32_t blk_idx = index / sctx->dc[type].ba.entry_per_block;
-@@ -93,14 +104,22 @@
+@@ -93,14 +108,22 @@
          if (dc->d[i].cmd == SIF_MAP_NONE) {
              enum sif_mmap_cmd cmd = dt_to_mmap(type);
              /* The requested block is not mapped, try to map it: */
@@ -906,13 +906,16 @@
                  base = NULL;
                  break;
              }
-@@ -204,10 +223,10 @@
+@@ -204,10 +227,14 @@
  
  int map_rq(struct sif_rq *rq, struct sif_context *sctx)
  {
--#ifdef HAVE_VERBS_REGISTER_DRIVER
 +#if defined(__SVR4) && defined(__sun)
+ #ifdef HAVE_VERBS_REGISTER_DRIVER
++    int fd = sctx->verbs_ctx.context.mmap_fd;
++#else
 +    int fd = sctx->ibv_ctx.mmap_fd;
++#endif /* HAVE_VERBS_REGISTER_DRIVER */
 +#else
      int fd = sctx->verbs_ctx.context.cmd_fd;
 -#else
@@ -920,7 +923,7 @@
  #endif
      rq->m.sz = rq->extent * rq->entries;
  
-@@ -225,8 +244,14 @@
+@@ -225,8 +252,14 @@
  
      if (rq->m.sz) {
          /* Map the receive queue for this QP */
@@ -935,7 +938,7 @@
          if (rq->m.base == MAP_FAILED)
              return errno;
      } else {
-@@ -240,10 +265,18 @@
+@@ -240,10 +273,18 @@
  
  int sif_map_qp(struct sif_qp *qp)
  {
@@ -954,7 +957,7 @@
      int ret;
  
      qp->sq.m.sz = qp->sq.extent * qp->sq.entries;
-@@ -266,19 +299,29 @@
+@@ -266,19 +307,29 @@
              return errno;
      }
  
@@ -986,7 +989,7 @@
          ret = map_rq(qp->rq, sctx);
          if (ret)
              goto rq_map_failed;
-@@ -301,7 +344,11 @@
+@@ -301,7 +352,11 @@
          if (ret)
              return ret;
      }
@@ -998,7 +1001,7 @@
          struct sif_rq *rq = qp->rq;
          ret = munmap(rq->m.base, rq->m.sz);
          rq->m.sz = 0;
-@@ -315,10 +362,14 @@
+@@ -315,10 +370,14 @@
      struct ibv_context *ctx = cq->ibv_cq.context;
      struct sif_device *dev = to_sdev(ctx->device);
      struct sif_context *sctx = to_sctx(ctx);
@@ -1014,7 +1017,7 @@
      cq->mask = gross_cqe - 1;
      cq->extent = sizeof(struct psif_cq_entry);
      cq->m.sz = gross_cqe * cq->extent;
-@@ -334,8 +385,14 @@
+@@ -334,8 +393,14 @@
          return errno;
  
      if (cq->m.sz) {
@@ -1029,7 +1032,7 @@
          if (cq->m.base == MAP_FAILED)
              return errno;
      } else
-@@ -372,10 +429,15 @@
+@@ -372,10 +437,15 @@
  {
      struct ibv_context *ctx = pd->ibv_pd.context;
      struct sif_device *dev = to_sdev(ctx->device);
@@ -1046,7 +1049,7 @@
  
      if (dev->abi_version < abi_ver(3,0)) {
              fprintf(stderr, "driver v.%d.%d does not support direct user level access\n",
-@@ -384,9 +446,16 @@
+@@ -384,9 +454,16 @@
      }
  
      offset = mmap_set_cmd(SIF_MAP_CB, cb->index);
@@ -1066,7 +1069,7 @@
      return 0;
 diff -r 1584d5cbb44d src/uverbs.h
 --- a/src/uverbs.h	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/uverbs.h	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/uverbs.h	Mon Mar 21 15:04:35 2016 +0530
 @@ -75,6 +75,10 @@
  
  static inline bool has_srq(struct sif_qp *qp)
@@ -1080,7 +1083,7 @@
  #endif
 diff -r 1584d5cbb44d src/verbs.c
 --- a/src/verbs.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/verbs.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/verbs.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -64,7 +64,7 @@
      unsigned major, minor, sub_minor;
      struct ibv_query_device cmd;
@@ -1340,7 +1343,7 @@
      }
  
      if (qp->sq.wr_hdl)
-@@ -489,7 +602,50 @@
+@@ -489,12 +602,59 @@
      return 0;
  }
  
@@ -1391,7 +1394,41 @@
  struct ibv_srq *sif_create_srq_ex(struct ibv_context *context,
                                    struct ibv_srq_init_attr_ex *attr)
  {
-@@ -540,9 +696,13 @@
+     struct sif_rq *rq;
++#if defined(__SVR4) && defined(__sun)
++    struct sif_create_srq_cmd cmd;
++#else
+     struct sif_create_xsrq_cmd cmd;
++#endif
+     struct sif_create_srq_resp resp;
+     struct sif_context *sctx = to_sctx(context);
+     int ret;
+@@ -503,13 +663,24 @@
+     if (!rq)
+         return NULL;
+     memset(rq, 0, sizeof(*rq));
++    memset(&cmd, 0, sizeof(cmd));
++    memset(&resp, 0, sizeof(resp));
++
+     cmd.e.flags = sif_get_default_flags(context);
+     cmd.e.res1 = 0;
+ 
++#if HAVE_IBV_XRC_OPS    
+     ret = ibv_cmd_create_srq_ex(context, &rq->verbs_srq,
+                                 sizeof(rq->verbs_srq),
+                                 attr, &cmd.ibv_cmd, sizeof(cmd),
+                                 &resp.ibv_resp, sizeof(resp));
++#else
++    ret = ibv_cmd_create_srq(attr->pd, &rq->verbs_srq.srq,
++				(struct ibv_srq_init_attr *)attr,
++			       	&cmd.ibv_cmd, sizeof(cmd),
++				&resp.ibv_resp, sizeof(resp));
++#endif
++
+     if (ret) {
+         sif_log(sctx, SIF_INFO, "%s: failed to create srq, ret %d\n", __func__, ret);
+         free(rq);
+@@ -540,9 +711,13 @@
      return &rq->verbs_srq.srq;
  }
  
@@ -1405,7 +1442,7 @@
      struct ibv_srq_init_attr_ex attr_ex;
      struct ibv_srq *srq;
      attr_ex.srq_context = attr->srq_context;
-@@ -554,6 +714,7 @@
+@@ -554,6 +729,7 @@
      if (srq)
          attr->attr = attr_ex.attr;
      return srq;
@@ -1413,7 +1450,7 @@
  }
  
  
-@@ -577,11 +738,6 @@
+@@ -577,11 +753,6 @@
      int ret;
      sif_log(sctx, SIF_SRQ, "rq %d", rq->index);
  
@@ -1425,7 +1462,7 @@
      ret = ibv_cmd_destroy_srq(ibsrq);
      if (ret) {
          sif_log(sctx, SIF_INFO, "ibv_cmd_destroy_srq %d failed with errno %d",
-@@ -589,6 +745,11 @@
+@@ -589,6 +760,11 @@
          return ret;
      }
  
@@ -1439,7 +1476,7 @@
  }
 diff -r 1584d5cbb44d src/xrc.c
 --- a/src/xrc.c	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/xrc.c	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/xrc.c	Mon Mar 21 15:04:35 2016 +0530
 @@ -44,6 +44,7 @@
  #include "xrc.h"
  #include "encoding.h"
@@ -1455,7 +1492,7 @@
 +#endif
 diff -r 1584d5cbb44d src/xrc.h
 --- a/src/xrc.h	Wed Feb 10 12:40:22 2016 +0530
-+++ b/src/xrc.h	Tue Mar 08 15:00:55 2016 +0530
++++ b/src/xrc.h	Mon Mar 21 15:04:35 2016 +0530
 @@ -34,12 +34,16 @@
   * xrc.h: XRC support device specific calls.
   */
--- a/components/open-fabrics/ofed-component.mk	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/ofed-component.mk	Fri Apr 01 15:20:17 2016 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
 #
 
 #
@@ -26,7 +26,7 @@
 # openfabrics userland components.
 #
 COMPONENT_PROJECT_URL ?=	http://www.openfabrics.org/
-COMPONENT_ARCHIVE_URL ?=	http://www.openfabrics.org/downloads/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE)
+COMPONENT_ARCHIVE_URL ?=	https://www.openfabrics.org/downloads/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE)
 
 # component default overrides
 TEST_TARGET=
@@ -34,8 +34,7 @@
 include $(WS_MAKE_RULES)/common.mk
 include ../ofed.mk
 
-# None of the components have yet been tested with ASLR.
-ASLR_MODE= $(ASLR_DISABLE)
+ASLR_MODE= $(ASLR_ENABLE)
 
 # Almost every component requires these before Solaris 12.  Those that do not
 # can simply override.
--- a/components/open-fabrics/open-fabrics.license	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/open-fabrics.license	Fri Apr 01 15:20:17 2016 -0700
@@ -8,3284 +8,3 @@
 stated otherwise, where a choice exists between another license and either the
 OpenIB.org BSD license or the GPL, Oracle chooses the OpenIB.org BSD license.
 
-
-perftest-1.3.0:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license perftest-1.3.0 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
-Copyright (c) 2005 Topspin Communications.  All rights reserved.
-Copyright (c) 2009 HNR Consulting.  All rights reserved.
-Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler).
-Copyright (c) 2006 Mellanox Technologies Ltd.  All rights reserved
-Copyright (c) 2009 Mellanox Technologies Ltd.  All rights reserved
-
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the GNU
-General Public License (GPL) Version 2, available from the file
-COPYING in the main directory of this source tree, or the
-OpenIB.org BSD license below:
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
-- Redistributions of source code must retain the above
-copyright notice, this list of conditions and the following
-disclaimer.
-
-- Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials
-provided with the distribution.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-rds-tools-2.0.7:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license rds-tools-2.0.7 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2006 Oracle.  All rights reserved.
-Copyright (C) 2008 Oracle.  All rights reserved.
-Copyright (c) 2008 Chelsio, Inc. All rights reserved.
-Copyright (c) 1996 by Sun Microsystems, Inc.
-Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-Copyright (C) 1989-2003 Free Software Foundation, Inc.
-
-* This software is available to you under a choice of one of two
-* licenses. You may choose to be licensed under the terms of the GNU
-* General Public License (GPL) Version 2, available from the file
-* COPYING in the main directory of this source tree, or the
-* OpenIB.org BSD license below:
-*
-* Redistribution and use in source and binary forms, with or
-* without modification, are permitted provided that the following
-* conditions are met:
-*
-* - Redistributions of source code must retain the above
-* copyright notice, this list of conditions and the following
-* disclaimer.
-*
-* - Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials
-* provided with the distribution.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-
-libibverbs-1.1.4:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license libibverbs-1.1.4 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved
-Copyright (c) 2004 Topspin Communications.  All rights reserved.
-Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
-Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
-Copyright (c) 2005 PathScale, Inc.  All rights reserved.
-Copyright (c) 2005 Intel Corporation.  All rights reserved.
-Copyright (c) 2005 Voltaire, Inc. All rights reserved.
-Copyright (c) 2004 Intel Corporation.  All rights reserved.
-Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc.  All rights reserved.
-Copyright (c) 2008 Lawrence Livermore National Laboratory
-Copyright (C) 1989-2009 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the the
-OpenIB.org BSD license or the GNU General Public License (GPL) Version
-2, both included below.
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-libibmad-1.3.7:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license libibmad-1.3.7 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2009 Mellanox Technologies LTD.  All rights reserved.
-Copyright (c) 2004-2009 Voltaire, Inc.  All rights reserved
-Copyright (c) 2009 HNR Consulting.  All rights reserved.
-Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
-Copyright (C) 1989-2009 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software with the exception of OpenSM is available to you
-under a choice of one of two licenses. You may chose to be
-licensed under the terms of the the OpenIB.org BSD license or
-the GNU General Public License (GPL) Version 2, both included
-below.
-
-OpenSM is licensed under either GNU General Public License (GPL)
-Version 2, or Intel BSD + Patent license. See OpenSM for the
-specific language for the latter licensing terms.
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. 
-
-FSF changes to this file are in the public domain.
-
-libsdp-1.1.108:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license libsdp-1.1.108 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-
-Copyright (c) 2004 Topspin Communications.  All rights reserved.
-Copyright (c) 2005-2006 Mellanox Technologies Ltd.  All rights reserved.
-Copyright (C) 1999-2005 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the GNU
-General Public License (GPL) Version 2, available at
-<http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
-license, included below.
-
-Copyright (c) 2004 Topspin Communications. All rights reserved.
-Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
-
-OpenIB.org BSD license:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from the X Consortium. 
-
-FSF changes to this file are in the public domain.
-
-opensm-3.3.9:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license opensm-3.3.9 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
-Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
-Copyright (c) 2007 Lawrence Livermore National Lab.
-Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
-Copyright (c) 2009 HNR Consulting. All rights reserved.
-Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2007 The Regents of the University of California.
-Copyright (c) 2001-2009 Mellanox Technologies LTD. All rights reserved.
-Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
-Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
-Copyright (c) 2008,2009      System Fabric Works, Inc. All rights reserved.
-Copyright (c) 2007      Simula Research Laboratory. All rights reserved.
-Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.
-Copyright 2006 PathScale, Inc.  All Rights Reserved.
-Copyright (c) 2006 Mellanox Technologies. All rights reserved.
-Copyright (c) 2002-2006,2008 Mellanox Technologies LTD. All rights reserved.
-Copyright (c) 2008 HNR Consulting. All rights reserved.
-Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
-Copyright (c) 2009 Simula Research Laboratory. All rights reserved.
-Copyright (c) 2009      HNR Consulting. All rights reserved
-Copyright (C) 1994 X Consortium
-Copyright (C) 1996-2009 Free Software Foundation, Inc.
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the GNU
-General Public License (GPL) Version 2, available from the file
-COPYING in the main directory of this source tree, or the
-OpenIB.org BSD license below:
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
-- Redistributions of source code must retain the above
-copyright notice, this list of conditions and the following
-disclaimer.
-
-- Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials
-provided with the distribution.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-ibutils-1.5.7:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license ibutils-1.5.7 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-
-Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
-Copyright (C) 1996-2009 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-Copyright (c) 1996 by Sun Microsystems, Inc.
-
-Portions Copyright (c) 1995-1998
-The University of Utah and The Regents of the University of California.
-
-This software is available to you under a choice of one of two licenses. You may choose to be licensed under the terms of the GNU General Public License (GPL) Version 2, available from the file COPYING in the main directory of this source tree, or the
-
-OpenIB.org BSD license below:
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in 
-this Software without prior written authorization from the X Consortium. 
-
-
-qperf-0.4.6:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license qperf-0.4.6 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2002-2009 Johann George.  All rights reserved.
-Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
-Copyright (C) 1989-2010 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the GNU
-General Public License (GPL) Version 2, available from the file
-COPYING in the main directory of this source tree, or the
-OpenIB.org BSD license below:
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
-- Redistributions of source code must retain the above
-copyright notice, this list of conditions and the following
-disclaimer.
-
-- Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials
-provided with the distribution.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-
-infiniband-diags-1.5.8:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license infiniband-diags-1.5.8 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
-Copyright (c) 2010 Lawrence Livermore National Lab.  All rights reserved.
-Copyright (c) 2009 Mellanox Technologies LTD.  All rights reserved.
-Copyright (c) 2009 HNR Consulting.  All rights reserved.
-Copyright (c) 2010 HNR Consulting.  All rights reserved.
-Copyright (c) 2009 Lawrence Livermore National Security
-Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
-Copyright (c) 2008 Lawrence Livermore National Lab.  All rights reserved.
-Copyright (c) 2008 Lawrence Livermore National Security
-Copyright (c) 2007-2008 Voltaire, Inc. All rights reserved.
-Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
-Copyright (c) 2006,2007 The Regents of the University of California.
-Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
-Copyright (C) 2001-2003 The Regents of the University of California.
-Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
-Copyright (C) 2006 The Regents of the University of California.
-Copyright (C) 1996-2009 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software with the exception of OpenSM is available to you
-under a choice of one of two licenses. You may chose to be
-licensed under the terms of the the OpenIB.org BSD license or
-the GNU General Public License (GPL) Version 2, both included
-below.
-
-OpenSM is licensed under either GNU General Public License (GPL)
-Version 2, or Intel BSD + Patent license. See OpenSM for the
-specific language for the latter licensing terms.
-
-
-=============================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-librdmacm-1.0.14.1:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license librdmacm-1.0.14.1 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2005-2010 Intel Corporation.  All rights reserved.
-Copyright (c) 2005 Ammasso, Inc. All rights reserved.
-Copyright (c) 2006 Open Grid Computing, Inc. All rights reserved.
-Copyright (c) 2005 Voltaire Inc.  All rights reserved.
-Copyright (C) 1989-2005 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the the
-OpenIB.org BSD license or the GNU General Public License (GPL) Version
-2, both included below.
-
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-libibumad-1.3.7:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license libibumad-1.3.7 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
-Copyright (C) 1989-2008 Free Software Foundation, Inc.
-Copyright (C) 1994 X Consortium
-
-This software with the exception of OpenSM is available to you
-under a choice of one of two licenses. You may chose to be
-licensed under the terms of the the OpenIB.org BSD license or
-the GNU General Public License (GPL) Version 2, both included
-below.
-
-OpenSM is licensed under either GNU General Public License (GPL)
-Version 2, or Intel BSD + Patent license. See OpenSM for the
-specific language for the latter licensing terms.
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in 
-this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-
-libmlx4-1.0.1:
-
-In accordance with the terms of the Open Fabric Enterprise Distribution
-licensing scheme as appears below, Oracle is hereby making the election to
-license libmlx4-1.0.1 under the OpenIB.org BSD license. 
-
-The Software contains the following Copyrights, which are reproduced for
-this distribution as per OpenIB.org BSD license conditions:
-
-Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
-Copyright (c) 2005, 2006, 2007 Cisco Systems.  All rights reserved.
-Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
-Copyright (c) 2009, Damien Lespiau <[email protected]>
-Copyright (C) 1994 X Consortium
-Copyright (C) 1989-2009 Free Software Foundation, Inc.
-Copyright (c) 2005, 2006, 2007 Cisco Systems.  All rights reserved.
-
-This software is available to you under a choice of one of two
-licenses. You may choose to be licensed under the terms of the the
-OpenIB.org BSD license or the GNU General Public License (GPL) Version
-2, both included below.
-
-Copyright (c) 2004 Topspin Communications. All rights reserved.
-
-==================================================================
-
-OpenIB.org BSD license
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-==================================================================
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License. (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code. (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year> <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-Copyright (C) 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-of the Software, and to permit persons to whom the Software is furnished to do 
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X 
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be 
-used in advertising or otherwise to promote the sale, use or other dealings in 
-this Software without prior written authorization from the X Consortium. 
-
- FSF changes to this file are in the public domain.
-
-
--- a/components/open-fabrics/open-fabrics.p5m	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/open-fabrics.p5m	Fri Apr 01 15:20:17 2016 -0700
@@ -20,7 +20,7 @@
 #
 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+<transform file path=usr.*/man/.+ -> default mangler.man.stability "pass-through volatile">
 set name=pkg.fmri \
     value=pkg:/network/open-fabrics@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
 set name=pkg.summary \
@@ -32,23 +32,29 @@
     value="org.opensolaris.category.2008:System/Administration and Configuration"
 set name=info.source-url \
     value=http://download.oracle.com/otn-pub/oss/networking/libsif-1.0.tar.gz \
-    value=http://www.openfabrics.org/downloads/ibutils/ibutils-1.5.7.tar.gz \
-    value=http://www.openfabrics.org/downloads/libibverbs/libibverbs-1.1.4-1.22.g7257cd3.tar.gz \
-    value=http://www.openfabrics.org/downloads/libmlx4/libmlx4-1.0.1-1.18.gb810a27.tar.gz \
-    value=http://www.openfabrics.org/downloads/libsdp/libsdp-1.1.108-0.15.gd7fdb72.tar.gz \
-    value=http://www.openfabrics.org/downloads/management/infiniband-diags-1.5.8.tar.gz \
-    value=http://www.openfabrics.org/downloads/management/libibmad-1.3.7.tar.gz \
-    value=http://www.openfabrics.org/downloads/management/libibumad-1.3.7.tar.gz \
-    value=http://www.openfabrics.org/downloads/management/opensm-3.3.9.tar.gz \
-    value=http://www.openfabrics.org/downloads/perftest/perftest-1.3.0-0.42.gf350d3d.tar.gz \
-    value=http://www.openfabrics.org/downloads/qperf/qperf-0.4.6-0.1.gb81434e.tar.gz \
-    value=http://www.openfabrics.org/downloads/rdmacm/librdmacm-1.0.14.1.tar.gz \
-    value=http://www.openfabrics.org/downloads/rds-tools/rds-tools-2.0.4.tar.gz
+    value=https://www.openfabrics.org/downloads/ibutils/ibutils-1.5.7-0.2.gbd7e502.tar.gz \
+    value=https://www.openfabrics.org/downloads/libibverbs/libibverbs-1.1.8.tar.gz \
+    value=https://www.openfabrics.org/downloads/libmlx4/libmlx4-1.0.6.tar.gz \
+    value=https://www.openfabrics.org/downloads/libsdp/libsdp-1.1.108-0.15.gd7fdb72.tar.gz \
+    value=https://www.openfabrics.org/downloads/management/infiniband-diags-1.6.5.tar.gz \
+    value=https://www.openfabrics.org/downloads/management/libibmad-1.3.12.tar.gz \
+    value=https://www.openfabrics.org/downloads/management/libibumad-1.3.10.2.tar.gz \
+    value=https://www.openfabrics.org/downloads/management/opensm-3.3.19.tar.gz \
+    value=https://www.openfabrics.org/downloads/perftest/perftest-1.3.0-0.42.gf350d3d.tar.gz \
+    value=https://www.openfabrics.org/downloads/qperf/qperf-0.4.9.tar.gz \
+    value=https://www.openfabrics.org/downloads/rdmacm/librdmacm-1.0.21.tar.gz \
+    value=https://www.openfabrics.org/downloads/rds-tools/rds-tools-2.0.4.tar.gz
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
-set name=org.opensolaris.arc-caseid value=PSARC/2010/346
+set name=org.opensolaris.arc-caseid value=PSARC/2016/109
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
 set name=variant.opensolaris.zone value=global value=nonglobal
-file path=etc/libsdp.conf mode=0644 preserve=renameold
+file path=etc/infiniband/infiniband-diags/error_thresholds mode=0644 \
+    preserve=renameold
+file path=etc/infiniband/infiniband-diags/ibdiag.conf mode=0644 \
+    preserve=renameold
+file path=etc/infiniband/libibverbs.d/mlx4.driver
+file path=etc/infiniband/libibverbs.d/sif.driver variant.arch=sparc
+file path=etc/infiniband/libsdp.conf mode=0644 preserve=renameold
 link path=usr/bin/$(MACH64)/ib_clock_test target=../ib_clock_test
 link path=usr/bin/$(MACH64)/ib_read_bw target=../ib_read_bw
 link path=usr/bin/$(MACH64)/ib_read_lat target=../ib_read_lat
@@ -63,6 +69,7 @@
 link path=usr/bin/$(MACH64)/rds-info target=../rds-info
 link path=usr/bin/$(MACH64)/rds-ping target=../rds-ping
 link path=usr/bin/$(MACH64)/rds-stress target=../rds-stress
+file path=usr/bin/cmtime
 file path=usr/bin/ib_clock_test
 file path=usr/bin/ib_read_bw
 file path=usr/bin/ib_read_lat
@@ -80,14 +87,15 @@
 file path=usr/bin/mckey
 file path=usr/bin/qperf
 file path=usr/bin/rdma_bw
+file path=usr/bin/rdma_client
 file path=usr/bin/rdma_lat
+file path=usr/bin/rdma_server
 file path=usr/bin/rds-info
 file path=usr/bin/rds-ping
 file path=usr/bin/rds-stress
 file path=usr/bin/rping
 file path=usr/bin/ucmatose
 file path=usr/bin/udaddy
-dir  path=usr/include/infiniband
 file path=usr/include/infiniband/arch.h
 file path=usr/include/infiniband/driver.h
 file path=usr/include/infiniband/kern-abi.h
@@ -97,16 +105,13 @@
 file path=usr/include/infiniband/sa.h
 file path=usr/include/infiniband/umad.h
 file path=usr/include/infiniband/verbs.h
-dir  path=usr/include/rdma
 file path=usr/include/rdma/rdma_cma.h
 file path=usr/include/rdma/rdma_verbs.h
-dir  path=usr/lib/$(MACH64)/ibdiagnet1.5.7
 file path=usr/lib/$(MACH64)/ibdiagnet1.5.7/git_version.tcl
 file path=usr/lib/$(MACH64)/ibdiagnet1.5.7/ibdebug.tcl
 file path=usr/lib/$(MACH64)/ibdiagnet1.5.7/ibdebug_if.tcl
 file path=usr/lib/$(MACH64)/ibdiagnet1.5.7/ibdiagnet.tcl
 file path=usr/lib/$(MACH64)/ibdiagnet1.5.7/pkgIndex.tcl
-dir  path=usr/lib/$(MACH64)/ibdm1.5.7
 file path=usr/lib/$(MACH64)/ibdm1.5.7/ibnl/Buffalo.ibnl
 file path=usr/lib/$(MACH64)/ibdm1.5.7/ibnl/Buffalo8.topo
 file path=usr/lib/$(MACH64)/ibdm1.5.7/ibnl/Cheetah.ibnl
@@ -143,28 +148,27 @@
 file path=usr/lib/$(MACH64)/ibdm1.5.7/ibnl/subnet.lst
 file path=usr/lib/$(MACH64)/ibdm1.5.7/libibdm.so.1.5.7
 file path=usr/lib/$(MACH64)/ibdm1.5.7/pkgIndex.tcl
-dir  path=usr/lib/$(MACH64)/ibis1.5.7
 file path=usr/lib/$(MACH64)/ibis1.5.7/libibis.so.1.5.7
 file path=usr/lib/$(MACH64)/ibis1.5.7/pkgIndex.tcl
-link path=usr/lib/$(MACH64)/libibmad.so target=libibmad.so.5.1.2
-link path=usr/lib/$(MACH64)/libibmad.so.5 target=libibmad.so.5.1.2
-file path=usr/lib/$(MACH64)/libibmad.so.5.1.2
-link path=usr/lib/$(MACH64)/libibnetdisc.so.5 target=libibnetdisc.so.5.0.1
-file path=usr/lib/$(MACH64)/libibnetdisc.so.5.0.1
-link path=usr/lib/$(MACH64)/libibumad.so target=libibumad.so.3.0.2
-link path=usr/lib/$(MACH64)/libibumad.so.3 target=libibumad.so.3.0.2
-file path=usr/lib/$(MACH64)/libibumad.so.3.0.2
+link path=usr/lib/$(MACH64)/libibmad.so target=libibmad.so.5.5.0
+link path=usr/lib/$(MACH64)/libibmad.so.5 target=libibmad.so.5.5.0
+file path=usr/lib/$(MACH64)/libibmad.so.5.5.0
+link path=usr/lib/$(MACH64)/libibnetdisc.so.5 target=libibnetdisc.so.5.3.0
+file path=usr/lib/$(MACH64)/libibnetdisc.so.5.3.0
+link path=usr/lib/$(MACH64)/libibumad.so target=libibumad.so.3.1.0
+link path=usr/lib/$(MACH64)/libibumad.so.3 target=libibumad.so.3.1.0
+file path=usr/lib/$(MACH64)/libibumad.so.3.1.0
 link path=usr/lib/$(MACH64)/libibverbs.so target=libibverbs.so.1.0.0
 link path=usr/lib/$(MACH64)/libibverbs.so.1 target=libibverbs.so.1.0.0
 file path=usr/lib/$(MACH64)/libibverbs.so.1.0.0
 file path=usr/lib/$(MACH64)/libmlx4-rdmav2.so
 link path=usr/lib/$(MACH64)/libmlx4.so target=libmlx4-rdmav2.so
-link path=usr/lib/$(MACH64)/libopensm.so.4 target=libopensm.so.4.0.2
-file path=usr/lib/$(MACH64)/libopensm.so.4.0.2
-link path=usr/lib/$(MACH64)/libosmcomp.so.3 target=libosmcomp.so.3.0.4
-file path=usr/lib/$(MACH64)/libosmcomp.so.3.0.4
-link path=usr/lib/$(MACH64)/libosmvendor.so.3 target=libosmvendor.so.3.0.5
-file path=usr/lib/$(MACH64)/libosmvendor.so.3.0.5
+link path=usr/lib/$(MACH64)/libopensm.so.5 target=libopensm.so.5.2.2
+file path=usr/lib/$(MACH64)/libopensm.so.5.2.2
+link path=usr/lib/$(MACH64)/libosmcomp.so.3 target=libosmcomp.so.3.0.9
+file path=usr/lib/$(MACH64)/libosmcomp.so.3.0.9
+link path=usr/lib/$(MACH64)/libosmvendor.so.4 target=libosmvendor.so.4.0.1
+file path=usr/lib/$(MACH64)/libosmvendor.so.4.0.1
 link path=usr/lib/$(MACH64)/librdmacm.so target=librdmacm.so.1.0.0
 link path=usr/lib/$(MACH64)/librdmacm.so.1 target=librdmacm.so.1.0.0
 file path=usr/lib/$(MACH64)/librdmacm.so.1.0.0
@@ -173,13 +177,7 @@
 link path=usr/lib/secure/$(MACH64)/libsdp.so target=libsdp.so.1.0.0
 link path=usr/lib/secure/$(MACH64)/libsdp.so.1 target=libsdp.so.1.0.0
 file path=usr/lib/secure/$(MACH64)/libsdp.so.1.0.0
-link path=usr/lib/secure/libsdp.so target=libsdp.so.1.0.0
-link path=usr/lib/secure/libsdp.so.1 target=libsdp.so.1.0.0
-file path=usr/lib/secure/libsdp.so.1.0.0
-file path=usr/perl5/site_perl/5.12/i86pc-solaris-64int/IBswcountlimits.pm \
-    group=root mode=0444 variant.arch=i386
-file path=usr/perl5/site_perl/5.12/sun4-solaris-64int/IBswcountlimits.pm \
-    group=root mode=0444 variant.arch=sparc
+file path=usr/perl5/vendor_perl/5.12/IBswcountlimits.pm
 file path=usr/sbin/dump2psl.pl
 file path=usr/sbin/dump2slvl.pl
 file path=usr/sbin/ibaddr
@@ -226,9 +224,7 @@
 file path=usr/sbin/smpdump
 file path=usr/sbin/smpquery
 file path=usr/sbin/solaris_set_nodedesc variant.opensolaris.zone=global
-dir  path=usr/share/libibverbs.d
-file path=usr/share/libibverbs.d/mlx4.driver
-file path=usr/share/libibverbs.d/sif.driver variant.arch=sparc
+file path=usr/share/man/man1/cmtime.1
 file path=usr/share/man/man1/ib_clock_test.1
 file path=usr/share/man/man1/ib_read_bw.1
 link path=usr/share/man/man1/ib_read_lat.1 target=ib_read_bw.1
@@ -248,7 +244,9 @@
 file path=usr/share/man/man1/mckey.1
 file path=usr/share/man/man1/qperf.1
 file path=usr/share/man/man1/rdma_bw.1
+file path=usr/share/man/man1/rdma_client.1
 link path=usr/share/man/man1/rdma_lat.1 target=rdma_bw.1
+file path=usr/share/man/man1/rdma_server.1
 file path=usr/share/man/man1/rds-info.1
 file path=usr/share/man/man1/rds-ping.1
 file path=usr/share/man/man1/rds-stress.1
@@ -302,6 +300,7 @@
 file path=usr/share/man/man3/ibv_query_port.3
 file path=usr/share/man/man3/ibv_query_qp.3
 file path=usr/share/man/man3/ibv_query_srq.3
+file path=usr/share/man/man3/ibv_rate_to_mbps.3
 file path=usr/share/man/man3/ibv_rate_to_mult.3
 file path=usr/share/man/man3/ibv_reg_mr.3
 file path=usr/share/man/man3/ibv_reg_mr_relaxed.3
@@ -311,6 +310,7 @@
 file path=usr/share/man/man3/ibv_share_pd.3
 link path=usr/share/man/man3/ibv_unregister_sm_events.3 \
     target=ibv_register_sm_events.3
+file path=usr/share/man/man3/mbps_to_ibv_rate.3
 link path=usr/share/man/man3/mult_to_ibv_rate.3 target=ibv_rate_to_mult.3
 file path=usr/share/man/man3/rdma_accept.3
 file path=usr/share/man/man3/rdma_ack_cm_event.3
@@ -319,9 +319,11 @@
 file path=usr/share/man/man3/rdma_create_event_channel.3
 file path=usr/share/man/man3/rdma_create_id.3
 file path=usr/share/man/man3/rdma_create_qp.3
+file path=usr/share/man/man3/rdma_create_srq.3
 file path=usr/share/man/man3/rdma_destroy_event_channel.3
 file path=usr/share/man/man3/rdma_destroy_id.3
 file path=usr/share/man/man3/rdma_destroy_qp.3
+file path=usr/share/man/man3/rdma_destroy_srq.3
 file path=usr/share/man/man3/rdma_disconnect.3
 file path=usr/share/man/man3/rdma_event_str.3
 file path=usr/share/man/man3/rdma_free_devices.3
@@ -343,7 +345,6 @@
 file path=usr/share/man/man3lib/libsdp.3lib
 file path=usr/share/man/man5/libsdp.conf.5
 file path=usr/share/man/man7/rdma_cm.7
-file path=usr/share/man/man7/verbs.7
 file path=usr/share/man/man8/ibaddr.8
 file path=usr/share/man/man8/ibcheckerrors.8
 file path=usr/share/man/man8/ibcheckerrs.8
@@ -377,6 +378,7 @@
 file path=usr/share/man/man8/ibswportwatch.8
 file path=usr/share/man/man8/ibsysstat.8
 file path=usr/share/man/man8/ibtracert.8
+file path=usr/share/man/man8/infiniband-diags.8
 file path=usr/share/man/man8/perfquery.8
 file path=usr/share/man/man8/saquery.8
 file path=usr/share/man/man8/set_nodedesc.sh.8 variant.opensolaris.zone=global
@@ -393,53 +395,52 @@
     com.oracle.info.name=libsif com.oracle.info.version=1.0
 license open-fabrics.license license=open-fabrics \
     com.oracle.info.description="the OpenFabrics Enterprise Distribution" \
-    com.oracle.info.name=open-fabrics \
-    com.oracle.info.tpno=$(TPNO_OPEN_FABRICS) com.oracle.info.version=1.5.3
-license open-fabrics.license license="open-fabrics (ibutils)" \
+    com.oracle.info.name=open-fabrics com.oracle.info.version=3.18
+license ibutils.license license="open-fabrics (ibutils)" \
     com.oracle.info.description="the OpenFabrics User Level InfiniBand Management Utilities" \
     com.oracle.info.name=ibutils com.oracle.info.tpno=$(TPNO_IBUTILS) \
     com.oracle.info.version=1.5.7
-license open-fabrics.license license="open-fabrics (infiniband-diags)" \
+license infiniband-diags.license license="open-fabrics (infiniband-diags)" \
     com.oracle.info.description="the OpenFabrics Diagnostic Tools" \
     com.oracle.info.name=infiniband-diags \
-    com.oracle.info.tpno=$(TPNO_INFINIBAND_DIAGS) com.oracle.info.version=1.5.8
-license open-fabrics.license license="open-fabrics (libibmad)" \
+    com.oracle.info.tpno=$(TPNO_INFINIBAND_DIAGS) com.oracle.info.version=1.6.5
+license libibmad.license license="open-fabrics (libibmad)" \
     com.oracle.info.description="the OpenFabrics InfiniBand MAD library" \
     com.oracle.info.name=libibmad com.oracle.info.tpno=$(TPNO_LIBIBMAD) \
-    com.oracle.info.version=1.3.7
-license open-fabrics.license license="open-fabrics (libibumad)" \
+    com.oracle.info.version=1.3.12
+license libibumad.license license="open-fabrics (libibumad)" \
     com.oracle.info.description="the OpenFabrics user MAD interface library" \
     com.oracle.info.name=libibumad com.oracle.info.tpno=$(TPNO_LIBIBUMAD) \
-    com.oracle.info.version=1.3.7
-license open-fabrics.license license="open-fabrics (libibverbs)" \
+    com.oracle.info.version=1.3.10.2
+license libibverbs.license license="open-fabrics (libibverbs)" \
     com.oracle.info.description="the OpenFabrics RDMA verbs library" \
     com.oracle.info.name=libibverbs com.oracle.info.tpno=$(TPNO_LIBIBVERBS) \
     com.oracle.info.version=1.1.4
-license open-fabrics.license license="open-fabrics (libmlx4)" \
+license libmlx4.license license="open-fabrics (libmlx4)" \
     com.oracle.info.description="the OpenFabrics Mellanox ConnectX driver" \
     com.oracle.info.name=libmlx4 com.oracle.info.tpno=$(TPNO_LIBMLX4) \
     com.oracle.info.version=1.0.1
-license open-fabrics.license license="open-fabrics (librdmacm)" \
+license librdmacm.license license="open-fabrics (librdmacm)" \
     com.oracle.info.description="the OpenFabrics RDMA cm library" \
     com.oracle.info.name=librdmacm com.oracle.info.tpno=$(TPNO_LIBRDMACM) \
     com.oracle.info.version=1.0.14.1
-license open-fabrics.license license="open-fabrics (libsdp)" \
+license libsdp.license license="open-fabrics (libsdp)" \
     com.oracle.info.description="the OpenFabrics InfiniBand SDP library" \
     com.oracle.info.name=libsdp com.oracle.info.tpno=$(TPNO_LIBSDP) \
     com.oracle.info.version=1.1.108
-license open-fabrics.license license="open-fabrics (opensm)" \
+license opensm.license license="open-fabrics (opensm)" \
     com.oracle.info.description="the OpenFabrics InfiniBand Subnet Manager and Administrator" \
     com.oracle.info.name=opensm com.oracle.info.tpno=$(TPNO_OPENSM) \
-    com.oracle.info.version=3.3.9
-license open-fabrics.license license="open-fabrics (perftest)" \
+    com.oracle.info.version=3.3.19
+license perftest.license license="open-fabrics (perftest)" \
     com.oracle.info.description="the OpenFabrics performance tests" \
     com.oracle.info.name=perftest com.oracle.info.tpno=$(TPNO_PERFTEST) \
     com.oracle.info.version=1.3.0
-license open-fabrics.license license="open-fabrics (qperf)" \
+license qperf.license license="open-fabrics (qperf)" \
     com.oracle.info.description="the OpenFabrics RDMA and IP performance tests" \
     com.oracle.info.name=qperf com.oracle.info.tpno=$(TPNO_QPERF) \
-    com.oracle.info.version=0.4.6
-license open-fabrics.license license="open-fabrics (rds-tools)" \
+    com.oracle.info.version=0.4.9
+license rds-tools.license license="open-fabrics (rds-tools)" \
     com.oracle.info.description="the OpenFabrics RDS support tools" \
     com.oracle.info.name=rds-tools com.oracle.info.tpno=$(TPNO_RDS_TOOLS) \
     com.oracle.info.version=2.0.4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/opensm.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,35 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license OpenSM 3.3.19 under the OpenIB.org BSD license.
+
+Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+
+This software is available to you under a choice of one of two
+licenses.  You may choose to be licensed under the terms of the GNU
+General Public License (GPL) Version 2, available from the file
+COPYING in the main directory of this source tree, or the
+OpenIB.org BSD license below:
+
+    Redistribution and use in source and binary forms, with or
+    without modification, are permitted provided that the following
+    conditions are met:
+
+     - Redistributions of source code must retain the above
+       copyright notice, this list of conditions and the following
+       disclaimer.
+
+     - Redistributions in binary form must reproduce the above
+       copyright notice, this list of conditions and the following
+       disclaimer in the documentation and/or other materials
+       provided with the distribution.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- a/components/open-fabrics/opensm/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/opensm/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -22,14 +22,14 @@
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 #
-BUILD_BITS= 64_and_32
+BUILD_BITS= 64
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		opensm
-COMPONENT_VERSION=	3.3.9
+COMPONENT_VERSION=	3.3.19
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:b8f333815e9d145cbb29310a38d2f2e39f9727b30eb6b15cb0d81fb9db39a2e1
-COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+    sha256:2ff7729d5566e6569a387603aa188580dede20c929c0f22baf8eb6d36d8925b6
+COMPONENT_ARCHIVE_URL=	https://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=	library/ofuv_lib
 
 include ../ofed-component.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/opensm/patches/001-opensm-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,752 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  bdcd456aae19405169aa2090c74f0ba1ca151896
+opensm solaris specific changes
+
+diff -r bdcd456aae19 complib/Makefile.in
+--- a/complib/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/complib/Makefile.in	Fri Nov 13 06:01:25 2015 -0800
+@@ -248,7 +248,8 @@
+ lib_LTLIBRARIES = libosmcomp.la
+ @DEBUG_FALSE@DBGFLAGS = -g
+ @DEBUG_TRUE@DBGFLAGS = -ggdb -D_DEBUG_
+-libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
++libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 \
++	-D__EXTENSIONS__
+ @HAVE_LD_VERSION_SCRIPT_FALSE@libosmcomp_version_script = 
+ @HAVE_LD_VERSION_SCRIPT_TRUE@libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
+ complib_api_version = $(shell grep LIBVERSION= $(srcdir)/libosmcomp.ver | sed 's/LIBVERSION=//')
+@@ -352,7 +353,7 @@
+ 	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)"; \
++	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ 	}
+ 
+ uninstall-libLTLIBRARIES:
+diff -r bdcd456aae19 complib/cl_spinlock.c
+--- a/complib/cl_spinlock.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/complib/cl_spinlock.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -63,7 +63,21 @@
+ void cl_spinlock_destroy(IN cl_spinlock_t * const p_spinlock)
+ {
+ 	CL_ASSERT(p_spinlock);
++#if !(defined(__SVR4) && defined(__sun))
++/*
++ * Solaris dumps cores when ibdiagnet is run with any of
++ * these three options: --help, --version, and --vars.
++ * The core dumping seems to be triggered by the "exit 0"
++ * in ibdebug_if.tcl after the appropriate message, such as
++ * the help message, is printed. The stack trace from the
++ * core dump shows the following CL_ASSERT fails with
++ * p_spinlock->state being 0, an invalid state. It's not
++ * clear why the TCL "exit 0" dumps cores on Solaris but
++ * not on Linux. As a workaround, the CL_ASSERT() is skipped
++ * to avoid dumping cores.
++ */
+ 	CL_ASSERT(cl_is_state_valid(p_spinlock->state));
++#endif 
+ 
+ 	if (p_spinlock->state == CL_INITIALIZED) {
+ 		p_spinlock->state = CL_UNINITIALIZED;
+diff -r bdcd456aae19 configure
+--- a/configure	Wed Oct 14 12:54:37 2015 -0700
++++ b/configure	Fri Nov 13 06:01:25 2015 -0800
+@@ -8096,7 +8096,7 @@
+     # are reset later if shared libraries are not supported. Putting them
+     # here allows them to be overridden if necessary.
+     runpath_var=LD_RUN_PATH
+-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++    hardcode_libdir_flag_spec='${wl}-R ${wl}$libdir'
+     export_dynamic_flag_spec='${wl}--export-dynamic'
+     # ancient GNU ld didn't support --whole-archive et. al.
+     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+@@ -8319,7 +8319,7 @@
+ 	  # DT_RUNPATH tag from executables and libraries.  But doing so
+ 	  # requires that you compile everything twice, which is a pain.
+ 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+-	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++	    hardcode_libdir_flag_spec='${wl}-R ${wl}$libdir'
+ 	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ 	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ 	  else
+@@ -8567,7 +8567,7 @@
+       ;;
+ 
+     bsdi[45]*)
+-      export_dynamic_flag_spec=-rdynamic
++      export_dynamic_flag_spec=
+       ;;
+ 
+     cygwin* | mingw* | pw32* | cegcc*)
+@@ -8896,6 +8896,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+diff -r bdcd456aae19 include/complib/cl_byteswap_osd.h
+--- a/include/complib/cl_byteswap_osd.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_byteswap_osd.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -44,8 +44,12 @@
+ /*
+  * This provides defines __LITTLE_ENDIAN, __BIG_ENDIAN and __BYTE_ORDER
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #ifdef __cplusplus
+ #  define BEGIN_C_DECLS extern "C" {
+diff -r bdcd456aae19 include/complib/cl_debug_osd.h
+--- a/include/complib/cl_debug_osd.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_debug_osd.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -42,7 +42,6 @@
+ #define _CL_DEBUG_OSD_H_
+ 
+ #include <complib/cl_types.h>
+-#include <bits/wordsize.h>
+ 
+ #ifdef __cplusplus
+ #  define BEGIN_C_DECLS extern "C" {
+diff -r bdcd456aae19 include/complib/cl_map.h
+--- a/include/complib/cl_map.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_map.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -275,7 +275,11 @@
+ 	 * The map's pool of map items is the last thing initialized.
+ 	 * We can therefore use it to test for initialization.
+ 	 */
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (cl_is_qpool_inited(&p_map->pool));
++#else
++	return (boolean_t)(cl_is_qpool_inited(&p_map->pool));
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 include/complib/cl_qlist.h
+--- a/include/complib/cl_qlist.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_qlist.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -508,7 +508,11 @@
+ 	/* CL_ASSERT that the list was initialized. */
+ 	CL_ASSERT(p_list->state == CL_INITIALIZED);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (!cl_qlist_count(p_list));
++#else
++	return (boolean_t)(!cl_qlist_count(p_list));
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 include/complib/cl_qmap.h
+--- a/include/complib/cl_qmap.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_qmap.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -346,7 +346,11 @@
+ 	CL_ASSERT(p_map);
+ 	CL_ASSERT(p_map->state == CL_INITIALIZED);
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (p_map->count == 0);
++#else
++	return (boolean_t)(p_map->count == 0);
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 include/complib/cl_thread_osd.h
+--- a/include/complib/cl_thread_osd.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_thread_osd.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -61,7 +61,11 @@
+ 
+ static inline boolean_t cl_is_blockable(void)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return TRUE;
++#else
++	return ((boolean_t)TRUE);
++#endif
+ }
+ 
+ END_C_DECLS
+diff -r bdcd456aae19 include/complib/cl_types.h
+--- a/include/complib/cl_types.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_types.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -428,8 +428,13 @@
+ */
+ static inline boolean_t cl_is_state_valid(IN const cl_state_t state)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((state == CL_UNINITIALIZED) || (state == CL_INITIALIZED) ||
+ 		(state == CL_DESTROYING) || (state == CL_DESTROYED));
++#else
++	return (boolean_t)((state == CL_UNINITIALIZED) || (state == CL_INITIALIZED) ||
++		(state == CL_DESTROYING) || (state == CL_DESTROYED));
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 include/complib/cl_types_osd.h
+--- a/include/complib/cl_types_osd.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/complib/cl_types_osd.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -84,7 +84,12 @@
+ /*
+  * Types not explicitly defined are native to the platform.
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ typedef int boolean_t;
++#else
++#include <infiniband/ofa_solaris.h>
++#endif
++
+ typedef volatile int32_t atomic32_t;
+ 
+ #ifndef NULL
+diff -r bdcd456aae19 include/iba/ib_types.h
+--- a/include/iba/ib_types.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/iba/ib_types.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -580,8 +580,13 @@
+ static inline boolean_t OSM_API
+ ib_class_is_vendor_specific_low(IN const uint8_t class_code)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
+ 		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
++#else
++	return (boolean_t)((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
++		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
++#endif
+ }
+ 
+ /*
+@@ -612,8 +617,13 @@
+ static inline boolean_t OSM_API
+ ib_class_is_vendor_specific_high(IN const uint8_t class_code)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
+ 		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
++#else
++	return (boolean_t)((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
++		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
++#endif
+ }
+ 
+ /*
+@@ -643,8 +653,13 @@
+ static inline boolean_t OSM_API
+ ib_class_is_vendor_specific(IN const uint8_t class_code)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (ib_class_is_vendor_specific_low(class_code) ||
+ 		ib_class_is_vendor_specific_high(class_code));
++#else
++	return (boolean_t)(ib_class_is_vendor_specific_low(class_code) ||
++		ib_class_is_vendor_specific_high(class_code));
++#endif
+ }
+ 
+ /*
+@@ -673,11 +688,19 @@
+ */
+ static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((class_code == IB_MCLASS_SUBN_ADM) ||
+ 		(class_code == IB_MCLASS_DEV_MGMT) ||
+ 		(class_code == IB_MCLASS_DEV_ADM) ||
+ 		(class_code == IB_MCLASS_BIS) ||
+ 		ib_class_is_vendor_specific_high(class_code));
++#else
++	return (boolean_t)((class_code == IB_MCLASS_SUBN_ADM) ||
++		(class_code == IB_MCLASS_DEV_MGMT) ||
++		(class_code == IB_MCLASS_DEV_ADM) ||
++		(class_code == IB_MCLASS_BIS) ||
++		ib_class_is_vendor_specific_high(class_code));
++#endif
+ }
+ 
+ /*
+@@ -2200,7 +2223,11 @@
+ */
+ static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
++#else
++	return (boolean_t)((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
++#endif
+ }
+ 
+ /*
+@@ -2231,7 +2258,11 @@
+ */
+ static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;
++#else
++	return ib_pkey_get_base(pkey) == 0x0000 ? (boolean_t)TRUE : (boolean_t)FALSE;
++#endif
+ }
+ 
+ /*
+@@ -2294,7 +2325,11 @@
+ */
+ static inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (p_gid->raw[0] == 0xFF);
++#else
++	return (boolean_t)(p_gid->raw[0] == 0xFF);
++#endif
+ }
+ 
+ /****f* IBA Base: Types/ib_gid_get_scope
+@@ -2402,8 +2437,13 @@
+ static inline boolean_t OSM_API
+ ib_gid_is_link_local(IN const ib_gid_t * const p_gid)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((ib_gid_get_subnet_prefix(p_gid) &
+ 		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
++#else
++	return (boolean_t)((ib_gid_get_subnet_prefix(p_gid) &
++		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
++#endif
+ }
+ 
+ /*
+@@ -2434,9 +2474,15 @@
+ static inline boolean_t OSM_API
+ ib_gid_is_site_local(IN const ib_gid_t * const p_gid)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((ib_gid_get_subnet_prefix(p_gid) &
+ 		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
+ 		CL_HTON64(0xFEC0000000000000ULL));
++#else
++	return (boolean_t)((ib_gid_get_subnet_prefix(p_gid) &
++		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
++		CL_HTON64(0xFEC0000000000000ULL));
++#endif
+ }
+ 
+ /*
+@@ -3954,8 +4000,13 @@
+ ib_mad_is_response(IN const ib_mad_t * const p_mad)
+ {
+ 	CL_ASSERT(p_mad);
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||
+ 		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
++#else
++	return (boolean_t)(p_mad->method & IB_MAD_METHOD_RESP_MASK ||
++		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
++#endif
+ }
+ 
+ /*
+@@ -4010,7 +4061,11 @@
+ 		    IN const uint8_t flag)
+ {
+ 	CL_ASSERT(p_rmpp_mad);
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((p_rmpp_mad->rmpp_flags & flag) == flag);
++#else
++	return (boolean_t)((p_rmpp_mad->rmpp_flags & flag) == flag);
++#endif
+ }
+ 
+ /*
+@@ -4231,7 +4286,11 @@
+ */
+ static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
++#else
++	return (boolean_t)((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
++#endif
+ }
+ 
+ /*
+@@ -6507,7 +6566,11 @@
+ static inline boolean_t OSM_API
+ ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
++#else
++	return (boolean_t)((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
++#endif
+ }
+ 
+ /*
+@@ -6591,7 +6654,11 @@
+ static inline boolean_t OSM_API
+ ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+         return ((p_si->life_state & 0x01) == 0x01);
++#else
++        return (boolean_t)((p_si->life_state & 0x01) == 0x01);
++#endif
+ }
+ 
+ /*
+@@ -6653,7 +6720,11 @@
+ static inline boolean_t OSM_API
+ ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((p_si->flags & 0x08) == 0x08);
++#else
++	return (boolean_t)((p_si->flags & 0x08) == 0x08);
++#endif
+ }
+ 
+ /*
+@@ -7947,7 +8018,11 @@
+ static inline boolean_t OSM_API
+ ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return (p_ntc->generic_type & 0x80);
++#else
++	return (boolean_t)(p_ntc->generic_type & 0x80);
++#endif
+ }
+ 
+ /*
+@@ -8951,6 +9026,7 @@
+ * ib_dm_mad_t, ib_svc_entry_t
+ *********/
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ static inline void OSM_API
+ ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
+ 		     OUT uint8_t * const p_slot,
+@@ -8965,6 +9041,27 @@
+ 	if (p_lo)
+ 		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
+ }
++#else
++/*
++ * Due to the way some dependencies have cropped up a solaris 
++ * header included by solaris_set_node_desc has an alternate
++ * define for p_slot and causes problems.
++ */
++static inline void OSM_API
++ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
++		     OUT uint8_t * const psol_slot,
++		     OUT uint8_t * const p_lo, OUT uint8_t * const p_hi)
++{
++	ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi);
++
++	if (psol_slot)
++		*psol_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);
++	if (p_hi)
++		*p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);
++	if (p_lo)
++		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
++}
++#endif
+ 
+ /*
+  *	IBA defined information describing an I/O controller
+diff -r bdcd456aae19 include/opensm/osm_helper.h
+--- a/include/opensm/osm_helper.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/opensm/osm_helper.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -182,7 +182,11 @@
+ */
+ static inline boolean_t ib_gid_is_notzero(IN const ib_gid_t * p_gid)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
++#else
++	return (boolean_t)memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 include/opensm/osm_log.h
+--- a/include/opensm/osm_log.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/opensm/osm_log.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -449,7 +449,11 @@
+ static inline boolean_t osm_log_is_active(IN const osm_log_t * p_log,
+ 					  IN osm_log_level_t level)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	return ((p_log->level & level) != 0);
++#else
++	return (boolean_t)((p_log->level & level) != 0);
++#endif
+ }
+ 
+ /*
+@@ -475,11 +479,19 @@
+ 					     IN osm_log_level_t level,
+ 					     IN const int file_id)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	if ((p_log->level & level) != 0)
+ 		return 1;
+ 	if ((level & p_log->per_mod_log_tbl[file_id]))
+ 		return 1;
+ 	return 0;
++#else
++	if ((p_log->level & level) != 0)
++		return (boolean_t)1;
++	if ((level & p_log->per_mod_log_tbl[file_id]))
++		return (boolean_t)1;
++	return (boolean_t)0;
++#endif
+ }
+ 
+ extern void osm_log_msg_box(osm_log_t *log, osm_log_level_t level,
+diff -r bdcd456aae19 include/opensm/osm_madw.h
+--- a/include/opensm/osm_madw.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/include/opensm/osm_madw.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -524,7 +524,11 @@
+ 	p_madw->mad_size = mad_size;
+ 	if (p_mad_addr)
+ 		p_madw->mad_addr = *p_mad_addr;
++#if !(defined(__SVR4) && defined(__sun))
+ 	p_madw->resp_expected = FALSE;
++#else
++	p_madw->resp_expected = (boolean_t)FALSE;
++#endif
+ }
+ 
+ /*
+diff -r bdcd456aae19 libvendor/Makefile.in
+--- a/libvendor/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/libvendor/Makefile.in	Fri Nov 13 06:01:25 2015 -0800
+@@ -434,7 +434,7 @@
+ 	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)"; \
++	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ 	}
+ 
+ uninstall-libLTLIBRARIES:
+diff -r bdcd456aae19 libvendor/osm_vendor_ibumad.c
+--- a/libvendor/osm_vendor_ibumad.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/libvendor/osm_vendor_ibumad.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -345,7 +345,8 @@
+ 					   &length, -1)) < 0) {
+ 			if (length <= MAD_BLOCK_SIZE) {
+ 				OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5404: "
+-					"recv error on MAD sized umad (%m)\n");
++					"recv error on MAD sized umad (%s)\n",
++					strerror(errno));
+ 				continue;
+ 			} else {
+ 				umad_free(umad);
+@@ -364,8 +365,9 @@
+ 							   -1)) < 0) {
+ 					OSM_LOG(p_ur->p_log, OSM_LOG_ERROR,
+ 						"ERR 5406: "
+-						"recv error on umad length %d (%m)\n",
+-						length);
++						"recv error on umad length %d "
++						"(%s)\n", length,
++						strerror(errno));
+ 					continue;
+ 				}
+ 			}
+@@ -1197,9 +1199,9 @@
+ 			     p_bind->max_retries)) < 0) {
+ 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: "
+ 			"Send p_madw = %p of size %d, Class 0x%x, Method 0x%X, "
+-			"Attr 0x%X, TID 0x%" PRIx64 " failed %d (%m)\n",
++			"Attr 0x%X, TID 0x%" PRIx64 " failed %d (%s)\n",
+ 			p_madw, sent_mad_size, p_mad->mgmt_class,
+-			p_mad->method, cl_ntoh16(p_mad->attr_id), tid, ret);
++			p_mad->method, cl_ntoh16(p_mad->attr_id), tid, ret, strerror(errno));
+ 		if (resp_expected) {
+ 			get_madw(p_vend, &p_mad->trans_id,
+ 				 p_mad->mgmt_class);	/* remove from aging table */
+diff -r bdcd456aae19 opensm/Makefile.am
+--- a/opensm/Makefile.am	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/Makefile.am	Fri Nov 13 06:01:25 2015 -0800
+@@ -25,7 +25,7 @@
+ libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
+ 
+ sbin_PROGRAMS = opensm
+-opensm_LDFLAGS = -rdynamic
++opensm_LDFLAGS =
+ opensm_DEPENDENCIES = libopensm.la
+ opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
+ 		 osm_db_pack.c osm_drop_mgr.c osm_guid_info_rcv.c \
+diff -r bdcd456aae19 opensm/Makefile.in
+--- a/opensm/Makefile.in	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/Makefile.in	Fri Nov 13 06:01:25 2015 -0800
+@@ -297,7 +297,8 @@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ INCLUDES = $(OSMV_INCLUDES)
+-AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
++AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 \
++	-D__EXTENSIONS__
+ lib_LTLIBRARIES = libopensm.la
+ @DEBUG_FALSE@DBGFLAGS = -g
+ @DEBUG_TRUE@DBGFLAGS = -ggdb -D_DEBUG_
+@@ -309,7 +310,7 @@
+ 	-export-dynamic $(libopensm_version_script)
+ 
+ libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
+-opensm_LDFLAGS = -rdynamic
++opensm_LDFLAGS =
+ opensm_DEPENDENCIES = libopensm.la
+ opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
+ 		 osm_db_pack.c osm_drop_mgr.c osm_guid_info_rcv.c \
+@@ -456,7 +457,7 @@
+ 	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)"; \
++	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ 	}
+ 
+ uninstall-libLTLIBRARIES:
+diff -r bdcd456aae19 opensm/osm_db_files.c
+--- a/opensm/osm_db_files.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_db_files.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -415,7 +415,7 @@
+ 					p_accum_val);
+ 
+ 				/* check that the key is a number */
+-				if (!strtouq(p_key, &endptr, 0)
++				if (!strtoull(p_key, &endptr, 0)
+ 				    && *endptr != '\0') {
+ 					OSM_LOG(p_log, OSM_LOG_ERROR,
+ 						"ERR 610B: "
+diff -r bdcd456aae19 opensm/osm_helper.c
+--- a/opensm/osm_helper.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_helper.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -48,6 +48,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <arpa/inet.h>
++#include <netinet/in.h>
+ #include <complib/cl_debug.h>
+ #include <iba/ib_types.h>
+ #include <opensm/osm_file_ids.h>
+diff -r bdcd456aae19 opensm/osm_log.c
+--- a/opensm/osm_log.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_log.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -193,7 +193,7 @@
+ 		    (result.tm_mon <
+ 		     12 ? month_str[result.tm_mon] : "???"),
+ 		    result.tm_mday, result.tm_hour, result.tm_min,
+-		    result.tm_sec, usecs, pid, verbosity, buffer);
++		    result.tm_sec, usecs, (int)pid, verbosity, buffer);
+ #endif
+ 
+ 	/*  flush log */
+diff -r bdcd456aae19 opensm/osm_opensm.c
+--- a/opensm/osm_opensm.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_opensm.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -47,7 +47,11 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <string.h>
++#else
++#include <strings.h>
++#endif
+ #include <complib/cl_dispatcher.h>
+ #include <complib/cl_passivelock.h>
+ #include <opensm/osm_file_ids.h>
+diff -r bdcd456aae19 opensm/osm_qos_parser_y.h
+--- a/opensm/osm_qos_parser_y.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_qos_parser_y.h	Fri Nov 13 06:01:25 2015 -0800
+@@ -1,23 +1,24 @@
+-
+-/* A Bison parser, made by GNU Bison 2.4.1.  */
++/* A Bison parser, made by GNU Bison 2.3.  */
+ 
+ /* Skeleton interface for Bison's Yacc-like parsers in C
+-   
+-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
++
++   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+    Free Software Foundation, Inc.
+-   
+-   This program is free software: you can redistribute it and/or modify
++
++   This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation, either version 3 of the License, or
+-   (at your option) any later version.
+-   
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+-   
++
+    You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++   along with this program; if not, write to the Free Software
++   Foundation, Inc., 51 Franklin Street, Fifth Floor,
++   Boston, MA 02110-1301, USA.  */
+ 
+ /* As a special exception, you may create a larger work that contains
+    part or all of the Bison parser skeleton and distribute that work
+@@ -28,11 +29,10 @@
+    special exception, which will cause the skeleton and the resulting
+    Bison output files to be licensed under the GNU General Public
+    License without this special exception.
+-   
++
+    This special exception was added by the Free Software Foundation in
+    version 2.2 of Bison.  */
+ 
+-
+ /* Tokens.  */
+ #ifndef YYTOKENTYPE
+ # define YYTOKENTYPE
+@@ -202,11 +202,10 @@
+ 
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+ typedef int YYSTYPE;
+-# define YYSTYPE_IS_TRIVIAL 1
+ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
+ # define YYSTYPE_IS_DECLARED 1
++# define YYSTYPE_IS_TRIVIAL 1
+ #endif
+ 
+ extern YYSTYPE yylval;
+ 
+-
+diff -r bdcd456aae19 opensm/osm_qos_policy.c
+--- a/opensm/osm_qos_policy.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/opensm/osm_qos_policy.c	Fri Nov 13 06:01:25 2015 -0800
+@@ -46,7 +46,11 @@
+ #include <stdio.h>
+ #include <assert.h>
+ #include <stdlib.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <string.h>
++#else
++#include <strings.h>
++#endif
+ #include <ctype.h>
+ #include <arpa/inet.h>
+ #include <opensm/osm_file_ids.h>
--- a/components/open-fabrics/opensm/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,717 +0,0 @@
-diff -r -u /tmp/opensm-3.3.9/complib/Makefile.in opensm-3.3.9/complib/Makefile.in
---- /tmp/opensm-3.3.9/complib/Makefile.in	Mon Mar  7 00:01:52 2011
-+++ opensm-3.3.9/complib/Makefile.in	Mon Mar 14 03:17:52 2011
-@@ -239,7 +239,8 @@
- lib_LTLIBRARIES = libosmcomp.la
- @DEBUG_FALSE@DBGFLAGS = -g
- @DEBUG_TRUE@DBGFLAGS = -ggdb -D_DEBUG_
--libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
-+libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 \
-+	-D__EXTENSIONS__
- @HAVE_LD_VERSION_SCRIPT_FALSE@libosmcomp_version_script = 
- @HAVE_LD_VERSION_SCRIPT_TRUE@libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
- complib_api_version = $(shell grep LIBVERSION= $(srcdir)/libosmcomp.ver | sed 's/LIBVERSION=//')
-@@ -343,7 +344,7 @@
- 	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)"; \
-+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
- 	}
- 
- uninstall-libLTLIBRARIES:
-diff -r -u /tmp/opensm-3.3.9/complib/cl_spinlock.c opensm-3.3.9/complib/cl_spinlock.c
---- /tmp/opensm-3.3.9/complib/cl_spinlock.c	Sun Mar  6 23:51:11 2011
-+++ opensm-3.3.9/complib/cl_spinlock.c	Mon Mar 14 03:13:30 2011
-@@ -63,7 +63,21 @@
- void cl_spinlock_destroy(IN cl_spinlock_t * const p_spinlock)
- {
- 	CL_ASSERT(p_spinlock);
-+#if !(defined(__SVR4) && defined(__sun))
-+/* 
-+ * Solaris dumps cores when ibdiagnet is run with any of
-+ * these three options: --help, --version, and --vars.
-+ * The core dumping seems to be triggered by the "exit 0"
-+ * in ibdebug_if.tcl after the appropriate message, such as 
-+ * the help message, is printed. The stack trace from the
-+ * core dump shows the following CL_ASSERT fails with
-+ * p_spinlock->state being 0, an invalid state. It's not
-+ * clear why the TCL "exit 0" dumps cores on Solaris but
-+ * not on Linux. As a workaround, the CL_ASSERT() is skipped
-+ * to avoid dumping cores.
-+ */
- 	CL_ASSERT(cl_is_state_valid(p_spinlock->state));
-+#endif
- 
- 	if (p_spinlock->state == CL_INITIALIZED) {
- 		p_spinlock->state = CL_UNINITIALIZED;
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_qos_policy.c opensm-3.3.9/opensm/osm_qos_policy.c
---- /tmp/opensm-3.3.9/opensm/osm_qos_policy.c	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/opensm/osm_qos_policy.c	Mon Mar 14 03:13:57 2011
-@@ -46,7 +46,11 @@
- #include <stdio.h>
- #include <assert.h>
- #include <stdlib.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <string.h>
-+#else
-+#include <strings.h>
-+#endif
- #include <ctype.h>
- #include <arpa/inet.h>
- #include <opensm/osm_log.h>
-diff -r -u /tmp/opensm-3.3.9/opensm/Makefile.am opensm-3.3.9/opensm/Makefile.am
---- /tmp/opensm-3.3.9/opensm/Makefile.am	Sun Mar  6 23:54:55 2011
-+++ opensm-3.3.9/opensm/Makefile.am	Mon Mar 14 03:13:52 2011
-@@ -25,7 +25,7 @@
- libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
- 
- sbin_PROGRAMS = opensm
--opensm_LDFLAGS = -rdynamic
-+opensm_LDFLAGS =
- opensm_DEPENDENCIES = libopensm.la
- opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
- 		 osm_db_pack.c osm_drop_mgr.c \
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_opensm.c opensm-3.3.9/opensm/osm_opensm.c
---- /tmp/opensm-3.3.9/opensm/osm_opensm.c	Sun Mar  6 23:54:55 2011
-+++ opensm-3.3.9/opensm/osm_opensm.c	Mon Mar 14 03:13:56 2011
-@@ -46,7 +46,11 @@
- 
- #include <stdio.h>
- #include <stdlib.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <string.h>
-+#else
-+#include <strings.h>
-+#endif
- #include <complib/cl_dispatcher.h>
- #include <complib/cl_passivelock.h>
- #include <vendor/osm_vendor_api.h>
-diff -r -u /tmp/opensm-3.3.9/opensm/Makefile.in opensm-3.3.9/opensm/Makefile.in
---- /tmp/opensm-3.3.9/opensm/Makefile.in	Mon Mar  7 00:01:53 2011
-+++ opensm-3.3.9/opensm/Makefile.in	Mon Mar 14 03:17:51 2011
-@@ -284,7 +284,8 @@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
- INCLUDES = $(OSMV_INCLUDES)
--AM_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
-+AM_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 \
-+      -D__EXTENSIONS__
- lib_LTLIBRARIES = libopensm.la
- @DEBUG_FALSE@DBGFLAGS = -g
- @DEBUG_TRUE@DBGFLAGS = -ggdb -D_DEBUG_
-@@ -296,7 +297,7 @@
- 	-export-dynamic $(libopensm_version_script)
- 
- libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map
--opensm_LDFLAGS = -rdynamic
-+opensm_LDFLAGS =
- opensm_DEPENDENCIES = libopensm.la
- opensm_SOURCES = main.c osm_console_io.c osm_console.c osm_db_files.c \
- 		 osm_db_pack.c osm_drop_mgr.c \
-@@ -436,8 +437,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/opensm-3.3.9/opensm/osm_mcast_mgr.c opensm-3.3.9/opensm/osm_mcast_mgr.c
---- /tmp/opensm-3.3.9/opensm/osm_mcast_mgr.c	Sun Mar  6 23:56:08 2011
-+++ opensm-3.3.9/opensm/osm_mcast_mgr.c	Mon Mar 14 03:17:13 2011
-@@ -751,7 +751,7 @@
- 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
- 			"MLID 0x%X has %u members - nothing to do\n",
- 			mbox->mlid, num_ports);
--		drop_port_list(&port_list);
-+				drop_port_list(&port_list);
- 		goto Exit;
- 	}
- 
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_helper.c opensm-3.3.9/opensm/osm_helper.c
---- /tmp/opensm-3.3.9/opensm/osm_helper.c	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/opensm/osm_helper.c	Mon Mar 14 03:13:53 2011
-@@ -48,6 +48,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <arpa/inet.h>
-+#include <netinet/in.h>
- #include <complib/cl_debug.h>
- #include <iba/ib_types.h>
- #include <opensm/osm_helper.h>
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_log.c opensm-3.3.9/opensm/osm_log.c
---- /tmp/opensm-3.3.9/opensm/osm_log.c	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/opensm/osm_log.c	Mon Mar 14 03:13:54 2011
-@@ -191,7 +191,7 @@
- 		    (result.tm_mon <
- 		     12 ? month_str[result.tm_mon] : "???"),
- 		    result.tm_mday, result.tm_hour, result.tm_min,
--		    result.tm_sec, usecs, pid, verbosity, buffer);
-+		    result.tm_sec, usecs, (int)pid, verbosity, buffer);
- #endif
- 
- 	/*  flush log */
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_db_files.c opensm-3.3.9/opensm/osm_db_files.c
---- /tmp/opensm-3.3.9/opensm/osm_db_files.c	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/opensm/osm_db_files.c	Mon Mar 14 03:13:53 2011
-@@ -375,7 +375,7 @@
- 					p_accum_val);
- 
- 				/* check that the key is a number */
--				if (!strtouq(p_key, &endptr, 0)
-+				if (!strtoull(p_key, &endptr, 0)
- 				    && *endptr != '\0') {
- 					OSM_LOG(p_log, OSM_LOG_ERROR,
- 						"ERR 610B: "
-diff -r -u /tmp/opensm-3.3.9/opensm/osm_qos_parser_y.h opensm-3.3.9/opensm/osm_qos_parser_y.h
---- /tmp/opensm-3.3.9/opensm/osm_qos_parser_y.h	Mon Mar  7 00:02:04 2011
-+++ opensm-3.3.9/opensm/osm_qos_parser_y.h	Mon Mar 14 03:18:09 2011
-@@ -1,23 +1,24 @@
-+/* A Bison parser, made by GNU Bison 2.3.  */
- 
--/* A Bison parser, made by GNU Bison 2.4.1.  */
--
- /* Skeleton interface for Bison's Yacc-like parsers in C
--   
--      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-+
-+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-    Free Software Foundation, Inc.
--   
--   This program is free software: you can redistribute it and/or modify
-+
-+   This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
--   the Free Software Foundation, either version 3 of the License, or
--   (at your option) any later version.
--   
-+   the Free Software Foundation; either version 2, or (at your option)
-+   any later version.
-+
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
--   
-+
-    You should have received a copy of the GNU General Public License
--   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-+   Boston, MA 02110-1301, USA.  */
- 
- /* As a special exception, you may create a larger work that contains
-    part or all of the Bison parser skeleton and distribute that work
-@@ -28,11 +29,10 @@
-    special exception, which will cause the skeleton and the resulting
-    Bison output files to be licensed under the GNU General Public
-    License without this special exception.
--   
-+
-    This special exception was added by the Free Software Foundation in
-    version 2.2 of Bison.  */
- 
--
- /* Tokens.  */
- #ifndef YYTOKENTYPE
- # define YYTOKENTYPE
-@@ -198,11 +198,10 @@
- 
- #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
- typedef int YYSTYPE;
--# define YYSTYPE_IS_TRIVIAL 1
- # define yystype YYSTYPE /* obsolescent; will be withdrawn */
- # define YYSTYPE_IS_DECLARED 1
-+# define YYSTYPE_IS_TRIVIAL 1
- #endif
- 
- extern YYSTYPE yylval;
--
- 
-diff -r -u /tmp/opensm-3.3.9/libvendor/Makefile.in opensm-3.3.9/libvendor/Makefile.in
---- /tmp/opensm-3.3.9/libvendor/Makefile.in	Mon Mar  7 00:01:52 2011
-+++ opensm-3.3.9/libvendor/Makefile.in	Mon Mar 14 03:17:51 2011
-@@ -424,8 +424,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/opensm-3.3.9/libvendor/osm_vendor_ibumad.c opensm-3.3.9/libvendor/osm_vendor_ibumad.c
---- /tmp/opensm-3.3.9/libvendor/osm_vendor_ibumad.c	Sun Mar  6 23:54:55 2011
-+++ opensm-3.3.9/libvendor/osm_vendor_ibumad.c	Mon Mar 14 03:13:49 2011
-@@ -265,7 +265,8 @@
- 					   &length, -1)) < 0) {
- 			if (length <= MAD_BLOCK_SIZE) {
- 				OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5404: "
--					"recv error on MAD sized umad (%m)\n");
-+					"recv error on MAD sized umad (%s)\n",
-+					strerror(errno));
- 				continue;
- 			} else {
- 				umad_free(umad);
-@@ -284,8 +285,9 @@
- 							   -1)) < 0) {
- 					OSM_LOG(p_ur->p_log, OSM_LOG_ERROR,
- 						"ERR 5406: "
--						"recv error on umad length %d (%m)\n",
--						length);
-+						"recv error on umad length %d "
-+						"(%s)\n", length,
-+						strerror(errno));
- 					continue;
- 				}
- 			}
-@@ -1073,8 +1075,9 @@
- 			     resp_expected ? p_bind->timeout : 0,
- 			     p_bind->max_retries)) < 0) {
- 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: "
--			"Send p_madw = %p of size %d TID 0x%" PRIx64 " failed %d (%m)\n",
--			p_madw, sent_mad_size, cl_ntoh64(p_mad->trans_id), ret);
-+			"Send p_madw = %p of size %d TID 0x%" PRIx64 "" 
-+			"failed %d (%s)\n", p_madw, sent_mad_size,
-+			cl_ntoh64(p_mad->trans_id), ret, strerror(errno));
- 		if (resp_expected) {
- 			get_madw(p_vend, &p_mad->trans_id);	/* remove from aging table */
- 			p_madw->status = IB_ERROR;
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_map.h opensm-3.3.9/include/complib/cl_map.h
---- /tmp/opensm-3.3.9/include/complib/cl_map.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_map.h	Mon Mar 14 03:13:35 2011
-@@ -275,7 +275,11 @@
- 	 * The map's pool of map items is the last thing initialized.
- 	 * We can therefore use it to test for initialization.
- 	 */
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (cl_is_qpool_inited(&p_map->pool));
-+#else
-+	return (boolean_t)(cl_is_qpool_inited(&p_map->pool));
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_types.h opensm-3.3.9/include/complib/cl_types.h
---- /tmp/opensm-3.3.9/include/complib/cl_types.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_types.h	Mon Mar 14 03:13:37 2011
-@@ -428,8 +428,13 @@
- */
- static inline boolean_t cl_is_state_valid(IN const cl_state_t state)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((state == CL_UNINITIALIZED) || (state == CL_INITIALIZED) ||
- 		(state == CL_DESTROYING) || (state == CL_DESTROYED));
-+#else
-+	return (boolean_t)((state == CL_UNINITIALIZED) || (state == CL_INITIALIZED) ||
-+		(state == CL_DESTROYING) || (state == CL_DESTROYED));
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_thread_osd.h opensm-3.3.9/include/complib/cl_thread_osd.h
---- /tmp/opensm-3.3.9/include/complib/cl_thread_osd.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_thread_osd.h	Mon Mar 14 03:13:37 2011
-@@ -61,7 +61,11 @@
- 
- static inline boolean_t cl_is_blockable(void)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return TRUE;
-+#else
-+	return ((boolean_t)TRUE);
-+#endif
- }
- 
- END_C_DECLS
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_types_osd.h opensm-3.3.9/include/complib/cl_types_osd.h
---- /tmp/opensm-3.3.9/include/complib/cl_types_osd.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_types_osd.h	Mon Mar 14 03:13:37 2011
-@@ -72,7 +72,12 @@
- /*
-  * Types not explicitly defined are native to the platform.
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- typedef int boolean_t;
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
-+
- typedef volatile int32_t atomic32_t;
- 
- #ifndef NULL
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_qlist.h opensm-3.3.9/include/complib/cl_qlist.h
---- /tmp/opensm-3.3.9/include/complib/cl_qlist.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_qlist.h	Mon Mar 14 03:13:36 2011
-@@ -508,7 +508,11 @@
- 	/* CL_ASSERT that the list was initialized. */
- 	CL_ASSERT(p_list->state == CL_INITIALIZED);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (!cl_qlist_count(p_list));
-+#else
-+	return (boolean_t)(!cl_qlist_count(p_list));
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_byteswap_osd.h opensm-3.3.9/include/complib/cl_byteswap_osd.h
---- /tmp/opensm-3.3.9/include/complib/cl_byteswap_osd.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_byteswap_osd.h	Mon Mar 14 03:13:33 2011
-@@ -44,8 +44,12 @@
- /*
-  * This provides defines __LITTLE_ENDIAN, __BIG_ENDIAN and __BYTE_ORDER
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- #include <endian.h>
- #include <byteswap.h>
-+#else
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #ifdef __cplusplus
- #  define BEGIN_C_DECLS extern "C" {
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_debug_osd.h opensm-3.3.9/include/complib/cl_debug_osd.h
---- /tmp/opensm-3.3.9/include/complib/cl_debug_osd.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_debug_osd.h	Mon Mar 14 03:13:34 2011
-@@ -42,7 +42,6 @@
- #define _CL_DEBUG_OSD_H_
- 
- #include <complib/cl_types.h>
--#include <bits/wordsize.h>
- 
- #ifdef __cplusplus
- #  define BEGIN_C_DECLS extern "C" {
-diff -r -u /tmp/opensm-3.3.9/include/complib/cl_qmap.h opensm-3.3.9/include/complib/cl_qmap.h
---- /tmp/opensm-3.3.9/include/complib/cl_qmap.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/complib/cl_qmap.h	Mon Mar 14 03:13:36 2011
-@@ -346,7 +346,11 @@
- 	CL_ASSERT(p_map);
- 	CL_ASSERT(p_map->state == CL_INITIALIZED);
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (p_map->count == 0);
-+#else
-+	return (boolean_t)(p_map->count == 0);
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/opensm/osm_madw.h opensm-3.3.9/include/opensm/osm_madw.h
---- /tmp/opensm-3.3.9/include/opensm/osm_madw.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/opensm/osm_madw.h	Mon Mar 14 03:13:40 2011
-@@ -489,7 +489,11 @@
- 	p_madw->mad_size = mad_size;
- 	if (p_mad_addr)
- 		p_madw->mad_addr = *p_mad_addr;
-+#if !(defined(__SVR4) && defined(__sun))
- 	p_madw->resp_expected = FALSE;
-+#else
-+	p_madw->resp_expected = (boolean_t)FALSE;
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/opensm/osm_log.h opensm-3.3.9/include/opensm/osm_log.h
---- /tmp/opensm-3.3.9/include/opensm/osm_log.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/opensm/osm_log.h	Mon Mar 14 03:13:40 2011
-@@ -355,7 +355,11 @@
- static inline boolean_t osm_log_is_active(IN const osm_log_t * p_log,
- 					  IN osm_log_level_t level)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((p_log->level & level) != 0);
-+#else
-+	return (boolean_t)((p_log->level & level) != 0);
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/opensm/osm_helper.h opensm-3.3.9/include/opensm/osm_helper.h
---- /tmp/opensm-3.3.9/include/opensm/osm_helper.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/opensm/osm_helper.h	Mon Mar 14 03:13:39 2011
-@@ -182,7 +182,11 @@
- */
- static inline boolean_t ib_gid_is_notzero(IN const ib_gid_t * p_gid)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
-+#else
-+	return (boolean_t)memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/iba/ib_types.h opensm-3.3.9/include/iba/ib_types.h
---- /tmp/opensm-3.3.9/include/iba/ib_types.h	Sun Mar  6 23:54:55 2011
-+++ opensm-3.3.9/include/iba/ib_types.h	Mon Mar 14 03:13:38 2011
-@@ -578,8 +578,13 @@
- static inline boolean_t OSM_API
- ib_class_is_vendor_specific_low(IN const uint8_t class_code)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
- 		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
-+#else
-+	return (boolean_t)((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
-+		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
-+#endif
- }
- 
- /*
-@@ -610,8 +615,13 @@
- static inline boolean_t OSM_API
- ib_class_is_vendor_specific_high(IN const uint8_t class_code)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
- 		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
-+#else
-+	return (boolean_t)((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
-+		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
-+#endif
- }
- 
- /*
-@@ -641,8 +651,13 @@
- static inline boolean_t OSM_API
- ib_class_is_vendor_specific(IN const uint8_t class_code)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (ib_class_is_vendor_specific_low(class_code) ||
- 		ib_class_is_vendor_specific_high(class_code));
-+#else
-+	return (boolean_t)(ib_class_is_vendor_specific_low(class_code) ||
-+		ib_class_is_vendor_specific_high(class_code));
-+#endif
- }
- 
- /*
-@@ -671,11 +686,19 @@
- */
- static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((class_code == IB_MCLASS_SUBN_ADM) ||
- 		(class_code == IB_MCLASS_DEV_MGMT) ||
- 		(class_code == IB_MCLASS_DEV_ADM) ||
- 		(class_code == IB_MCLASS_BIS) ||
- 		ib_class_is_vendor_specific_high(class_code));
-+#else
-+	return (boolean_t)((class_code == IB_MCLASS_SUBN_ADM) ||
-+		(class_code == IB_MCLASS_DEV_MGMT) ||
-+		(class_code == IB_MCLASS_DEV_ADM) ||
-+		(class_code == IB_MCLASS_BIS) ||
-+		ib_class_is_vendor_specific_high(class_code));
-+#endif
- }
- 
- /*
-@@ -2186,7 +2209,11 @@
- */
- static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
-+#else
-+	return (boolean_t)((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
-+#endif
- }
- 
- /*
-@@ -2217,7 +2244,11 @@
- */
- static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;
-+#else
-+	return ib_pkey_get_base(pkey) == 0x0000 ? (boolean_t)TRUE : (boolean_t)FALSE;
-+#endif
- }
- 
- /*
-@@ -2280,7 +2311,11 @@
- */
- static inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (p_gid->raw[0] == 0xFF);
-+#else
-+	return (boolean_t)(p_gid->raw[0] == 0xFF);
-+#endif
- }
- 
- /****f* IBA Base: Types/ib_gid_get_scope
-@@ -2388,8 +2423,13 @@
- static inline boolean_t OSM_API
- ib_gid_is_link_local(IN const ib_gid_t * const p_gid)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((ib_gid_get_subnet_prefix(p_gid) &
- 		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
-+#else
-+	return (boolean_t)((ib_gid_get_subnet_prefix(p_gid) &
-+		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
-+#endif
- }
- 
- /*
-@@ -2420,9 +2460,15 @@
- static inline boolean_t OSM_API
- ib_gid_is_site_local(IN const ib_gid_t * const p_gid)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((ib_gid_get_subnet_prefix(p_gid) &
- 		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
- 		CL_HTON64(0xFEC0000000000000ULL));
-+#else
-+	return (boolean_t)((ib_gid_get_subnet_prefix(p_gid) &
-+		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
-+		CL_HTON64(0xFEC0000000000000ULL));
-+#endif
- }
- 
- /*
-@@ -3912,8 +3958,13 @@
- ib_mad_is_response(IN const ib_mad_t * const p_mad)
- {
- 	CL_ASSERT(p_mad);
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||
- 		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
-+#else
-+	return (boolean_t)(p_mad->method & IB_MAD_METHOD_RESP_MASK ||
-+		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
-+#endif
- }
- 
- /*
-@@ -3968,7 +4019,11 @@
- 		    IN const uint8_t flag)
- {
- 	CL_ASSERT(p_rmpp_mad);
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((p_rmpp_mad->rmpp_flags & flag) == flag);
-+#else
-+	return (boolean_t)((p_rmpp_mad->rmpp_flags & flag) == flag);
-+#endif
- }
- 
- /*
-@@ -4189,7 +4244,11 @@
- */
- static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
-+#else
-+	return (boolean_t)((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
-+#endif
- }
- 
- /*
-@@ -6114,7 +6173,11 @@
- static inline boolean_t OSM_API
- ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
-+#else
-+	return (boolean_t)((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
-+#endif
- }
- 
- /*
-@@ -6170,7 +6233,11 @@
- static inline boolean_t OSM_API
- ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)
- {
-+#if !(defined(__SVR4) && defined(__sun))
-         return ((p_si->life_state & 0x01) == 0x01);
-+#else
-+        return (boolean_t)((p_si->life_state & 0x01) == 0x01);
-+#endif
- }
- 
- /*
-@@ -6200,7 +6267,11 @@
- static inline boolean_t OSM_API
- ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return ((p_si->flags & 0x08) == 0x08);
-+#else
-+	return (boolean_t)((p_si->flags & 0x08) == 0x08);
-+#endif
- }
- 
- /*
-@@ -7460,7 +7531,11 @@
- static inline boolean_t OSM_API
- ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	return (p_ntc->generic_type & 0x80);
-+#else
-+	return (boolean_t)(p_ntc->generic_type & 0x80);
-+#endif
- }
- 
- /*
-diff -r -u /tmp/opensm-3.3.9/include/vendor/osm_vendor_ibumad.h opensm-3.3.9/include/vendor/osm_vendor_ibumad.h
---- /tmp/opensm-3.3.9/include/vendor/osm_vendor_ibumad.h	Sun Mar  6 23:51:12 2011
-+++ opensm-3.3.9/include/vendor/osm_vendor_ibumad.h	Mon Mar 24 15:10:20 2014
-@@ -64,7 +64,7 @@
- *
- *********/
- #define OSM_DEFAULT_RETRY_COUNT 3
--#define OSM_UMAD_MAX_CAS	32
-+#define OSM_UMAD_MAX_CAS	UMAD_MAX_HCAS
- #define OSM_UMAD_MAX_PORTS_PER_CA	2
- #define OSM_UMAD_MAX_AGENTS	32
- 
-diff -r -u /tmp/opensm-3.3.9/configure opensm-3.3.9/configure
---- /tmp/opensm-3.3.9/configure	Mon Mar  7 00:01:54 2011
-+++ opensm-3.3.9/configure	Mon Mar 14 03:13:28 2011
-@@ -8022,7 +8022,7 @@
-     # are reset later if shared libraries are not supported. Putting them
-     # here allows them to be overridden if necessary.
-     runpath_var=LD_RUN_PATH
--    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-+    hardcode_libdir_flag_spec='${wl}-R ${wl}$libdir'
-     export_dynamic_flag_spec='${wl}--export-dynamic'
-     # ancient GNU ld didn't support --whole-archive et. al.
-     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-@@ -8245,7 +8245,7 @@
- 	  # DT_RUNPATH tag from executables and libraries.  But doing so
- 	  # requires that you compile everything twice, which is a pain.
- 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
--	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-+	    hardcode_libdir_flag_spec='${wl}-R ${wl}$libdir'
- 	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- 	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- 	  else
-@@ -8493,7 +8493,7 @@
-       ;;
- 
-     bsdi[45]*)
--      export_dynamic_flag_spec=-rdynamic
-+      export_dynamic_flag_spec=
-       ;;
- 
-     cygwin* | mingw* | pw32* | cegcc*)
-@@ -8822,6 +8822,7 @@
- 	;;
-       esac
-       link_all_deplibs=yes
-+      hardcode_libdir_flag_spec=
-       ;;
- 
-     sunos4*)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/perftest.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,39 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license perftest-1.3.0 under the OpenIB.org BSD license.
+
+
+Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+Copyright (c) 2005 Topspin Communications.  All rights reserved.
+Copyright (c) 2009 HNR Consulting.  All rights reserved.
+Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler).
+Copyright (c) 2006 Mellanox Technologies Ltd.  All rights reserved
+
+
+This software is available to you under a choice of one of two
+licenses. You may choose to be licensed under the terms of the GNU
+General Public License (GPL) Version 2, available from the file
+COPYING in the main directory of this source tree, or the
+OpenIB.org BSD license below:
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above
+copyright notice, this list of conditions and the following
+disclaimer.
+
+- Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials
+provided with the distribution.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/perftest/patches/001-perftest-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,1823 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  8cb431a3e51bc17ea032c64d150ea7799c778321
+#
+
+diff -r 8cb431a3e51b Makefile
+--- a/Makefile	Tue Feb 23 22:34:35 2016 -0800
++++ b/Makefile	Tue Feb 23 22:34:53 2016 -0800
+@@ -2,23 +2,25 @@
+ MCAST_TESTS = send_bw send_lat
+ TESTS = write_bw_postlist write_lat write_bw read_lat read_bw
+ UTILS = clock_test
++BINS = ib_write_bw_postlist rdma_lat rdma_bw ib_send_lat ib_send_bw ib_write_lat ib_write_bw ib_read_lat ib_read_bw ib_clock_test
+ 
+ all: ${RDMACM_TESTS} ${MCAST_TESTS} ${TESTS} ${UTILS}
+ 
+-CFLAGS += -Wall -g -D_GNU_SOURCE -O2
++CFLAGS += -Wall -g -D_GNU_SOURCE -O3
+ BASIC_FILES = get_clock.c
+ EXTRA_FILES = perftest_resources.c
+ MCAST_FILES = multicast_resources.c
+ BASIC_HEADERS = get_clock.h
+ EXTRA_HEADERS = perftest_resources.h
+ MCAST_HEADERS = multicast_resources.h
++CC=gcc
+ #The following seems to help GNU make on some platforms
+ LOADLIBES += 
+ LDFLAGS +=
+ 
+-${RDMACM_TESTS}: LOADLIBES += -libverbs -lrdmacm
+-${MCAST_TESTS}: LOADLIBES += -libverbs -libumad -lm
+-${TESTS} ${UTILS}: LOADLIBES += -libverbs
++${RDMACM_TESTS}: LOADLIBES += -lsocket -libverbs -lrdmacm -lrt 
++${MCAST_TESTS}: LOADLIBES += -lsocket -libverbs -lrdmacm -lrt -libumad -lm
++${TESTS} ${UTILS}: LOADLIBES += -lsocket -lrt -libverbs
+ 
+ ${RDMACM_TESTS}: %: %.c ${BASIC_FILES} ${BASIC_HEADERS}
+ 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< ${BASIC_FILES} $(LOADLIBES) $(LDLIBS) -o $@
+@@ -27,6 +29,10 @@
+ ${TESTS} ${UTILS}: %: %.c ${BASIC_FILES} ${EXTRA_FILES} ${BASIC_HEADERS} ${EXTRA_HEADERS}
+ 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< ${BASIC_FILES} ${EXTRA_FILES} $(LOADLIBES) $(LDLIBS) -o ib_$@
+ 
++install: all
++	$(INSTALL) -d $(DESTDIR)$(BINDIR)
++	$(INSTALL) -m 755 -s $(BINS) $(DESTDIR)$(BINDIR)
++
+ clean:
+ 	$(foreach fname,${RDMACM_TESTS}, rm -f ${fname})
+ 	$(foreach fname,${MCAST_TESTS}, rm -f ib_${fname})
+diff -r 8cb431a3e51b clock_test.c
+--- a/clock_test.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/clock_test.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -20,6 +20,10 @@
+ 		c1 = get_cycles();
+ 		sleep(1);
+ 		c2 = get_cycles();
++#if defined(__sparc)
++		printf("1 sec = %g usec\n", (double)((c2 - c1))/1000);
++#else
+ 		printf("1 sec = %g usec\n", (c2 - c1) / mhz);
++#endif
+ 	}
+ }
+diff -r 8cb431a3e51b get_clock.c
+--- a/get_clock.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/get_clock.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -45,6 +45,10 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include "get_clock.h"
++#if defined(__SVR4) && defined(__sun)
++#include <stdlib.h>
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #ifndef DEBUG
+ #define DEBUG 0
+@@ -56,6 +60,8 @@
+ #define MEASUREMENTS 200
+ #define USECSTEP 10
+ #define USECSTART 100
++#define NSECSTART 100000
++#define NSECSTEP 10000
+ 
+ /*
+  Use linear regression to calculate cycles per microsecond.
+@@ -63,14 +69,14 @@
+ */
+ static double sample_get_cpu_mhz(void)
+ {
+-	struct timeval tv1, tv2;
++        struct timeval tv1, tv2;
+ 	cycles_t start;
+ 	double sx = 0, sy = 0, sxx = 0, syy = 0, sxy = 0;
+-	double tx, ty;
++	cycles_t tx, ty;
+ 	int i;
+ 
+ 	/* Regression: y = a + b x */
+-	long x[MEASUREMENTS];
++	cycles_t x[MEASUREMENTS];
+ 	cycles_t y[MEASUREMENTS];
+ 	double a; /* system call overhead in cycles */
+ 	double b; /* cycles per microsecond */
+@@ -78,7 +84,6 @@
+ 
+ 	for (i = 0; i < MEASUREMENTS; ++i) {
+ 		start = get_cycles();
+-
+ 		if (gettimeofday(&tv1, NULL)) {
+ 			fprintf(stderr, "gettimeofday failed.\n");
+ 			return 0;
+@@ -86,7 +91,7 @@
+ 
+ 		do {
+ 			if (gettimeofday(&tv2, NULL)) {
+-				fprintf(stderr, "gettimeofday failed.\n");
++			        fprintf(stderr, "gettimeofday failed.\n");
+ 				return 0;
+ 			}
+ 		} while ((tv2.tv_sec - tv1.tv_sec) * 1000000 +
+@@ -94,9 +99,10 @@
+ 
+ 		x[i] = (tv2.tv_sec - tv1.tv_sec) * 1000000 +
+ 			tv2.tv_usec - tv1.tv_usec;
++
+ 		y[i] = get_cycles() - start;
+ 		if (DEBUG_DATA)
+-			fprintf(stderr, "x=%ld y=%Ld\n", x[i], (long long)y[i]);
++			fprintf(stderr, "x=%lld y=%lld\n", x[i], y[i]);
+ 	}
+ 
+ 	for (i = 0; i < MEASUREMENTS; ++i) {
+@@ -134,10 +140,15 @@
+ 
+ static double proc_get_cpu_mhz(int no_cpu_freq_fail)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	FILE* f;
+ 	char buf[256];
++#else
++	sol_cpu_info_t	*info;
++#endif
+ 	double mhz = 0.0;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	f = fopen("/proc/cpuinfo","r");
+ 	if (!f)
+ 		return 0.0;
+@@ -174,6 +185,13 @@
+ 		}
+ 	}
+ 	fclose(f);
++#else
++	if (sol_get_cpu_info(&info) > 0)
++		mhz = info[0].cpu_mhz;
++	else
++		return (0.0);
++	free(info);
++#endif
+ 	return mhz;
+ }
+ 
+@@ -184,8 +202,9 @@
+ 	sample = sample_get_cpu_mhz();
+ 	proc = proc_get_cpu_mhz(no_cpu_freq_fail);
+ 
+-	if (!proc || !sample)
+-		return 0;
++#if defined(__sparc)
++	return proc;
++#endif
+ 
+ 	delta = proc > sample ? proc - sample : sample - proc;
+ 	if (delta / proc > 0.01) {
+@@ -194,5 +213,6 @@
+ 					sample, proc);
+ 			return sample;
+ 	}
++
+ 	return proc;
+ }
+diff -r 8cb431a3e51b get_clock.h
+--- a/get_clock.h	Tue Feb 23 22:34:35 2016 -0800
++++ b/get_clock.h	Tue Feb 23 22:34:53 2016 -0800
+@@ -36,8 +36,18 @@
+ 
+ #ifndef GET_CLOCK_H
+ #define GET_CLOCK_H
++#if defined(__sparc)
++#include <sys/times.h>
++#include <limits.h>
++#include <sys/time.h>
++typedef unsigned long long cycles_t;
+ 
+-#if defined (__x86_64__) || defined(__i386__)
++static inline cycles_t get_cycles()
++{
++        return (gethrtime());
++}
++
++#elif defined (__x86_64__) || defined(__i386__)
+ /* Note: only x86 CPUs which have rdtsc instruction are supported. */
+ typedef unsigned long long cycles_t;
+ static inline cycles_t get_cycles()
+diff -r 8cb431a3e51b multicast_resources.c
+--- a/multicast_resources.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/multicast_resources.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -4,7 +4,9 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <limits.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <arpa/inet.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+diff -r 8cb431a3e51b multicast_resources.h
+--- a/multicast_resources.h	Tue Feb 23 22:34:35 2016 -0800
++++ b/multicast_resources.h	Tue Feb 23 22:34:53 2016 -0800
+@@ -68,7 +68,7 @@
+ #define DEF_PKEY_IDX        		0
+ #define DEF_SLL              		0
+ #define MAX_POLL_ITERATION_TIMEOUT  1000000
+-#define MCG_GID {255,1,0,0,0,2,201,133,0,0,0,0,0,0,0,0}
++#define MCG_GID {255,21,0,0,0,2,201,133,0,0,0,0,0,0,0,0}
+ 
+ //  Definitions section for MADs 
+ #define SUBN_ADM_ATTR_MC_MEMBER_RECORD 0x38
+@@ -80,10 +80,11 @@
+ #define DEF_TCLASS                     0
+ #define DEF_FLOW_LABLE                 0
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ // Macro for 64 bit variables to switch to from net 
+ #define ntohll(x) (((u_int64_t)(ntohl((int)((x << 32) >> 32))) << 32) | (unsigned int)ntohl(((int)(x >> 32)))) 
+ #define htonll(x) ntohll(x)
+-
++#endif
+ // generate a bit mask S bits width 
+ #define MASK32(S)  ( ((u_int32_t) ~0L) >> (32-(S)) )
+ 
+diff -r 8cb431a3e51b perftest_resources.c
+--- a/perftest_resources.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/perftest_resources.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -11,7 +11,9 @@
+ #include <sys/socket.h>
+ #include <netdb.h>
+ #include <math.h>
++#if !(defined(__SVR4) && defined(__sun))
+ // #include <byteswap.h>
++#endif
+ #include "perftest_resources.h"
+ 
+ 
+@@ -566,8 +568,22 @@
+ 
+ 	// User did not ask for specific mtu.
+ 	if (params->mtu == 0) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		params->curr_mtu = port_attr.active_mtu;
++#else
++		struct ibv_device_attr device_attr;
+ 
++		if (ibv_query_device(context, &device_attr)) {
++                        fprintf(stderr, "Failed to query device props");
++                        return -1;
++                }
++
++		if (device_attr.vendor_part_id == 23108) {
++			params->curr_mtu = IBV_MTU_1024;
++		} else {
++			params->curr_mtu = IBV_MTU_2048;
++		}
++#endif
+ 	} else {
+ 
+ 		switch (params->mtu) {
+@@ -791,7 +807,7 @@
+ 
+ 	n = getaddrinfo(servername, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
+ 		return n;
+ 	}
+@@ -835,7 +851,7 @@
+ 
+ 	n = getaddrinfo(NULL, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
+ 		return n;
+ 	}
+@@ -869,7 +885,6 @@
+ 		close(sockfd);
+ 		return connfd;
+ 	}
+-
+ 	close(sockfd);
+ 	return connfd;
+ }
+@@ -882,6 +897,8 @@
+ 				   struct pingpong_dest *my_dest,
+ 				   struct pingpong_dest *rem_dest) {
+ 
++    int	temp_reads = 0;
++
+     // Client.
+     if (params->machine == CLIENT) {
+ 		if (ctx_write_keys(my_dest,params)) {
+@@ -904,6 +921,21 @@
+ 			return -1;
+ 		}
+     }
++
++    /*
++     * If we have different HCA's at either end of the connection with
++     * different RDMA attributes, then to avoid a modify QP error set
++     * max_rd_atomic to lowest on either side of connection.
++     */
++    if (rem_dest->out_reads > my_dest->out_reads)
++	temp_reads =  my_dest->out_reads;
++
++    if (my_dest->out_reads > rem_dest->out_reads)
++	my_dest->out_reads = rem_dest->out_reads;
++
++    if (temp_reads)
++	rem_dest->out_reads = temp_reads;
++
+     return 0;
+ }
+ 
+diff -r 8cb431a3e51b perftest_resources.h
+--- a/perftest_resources.h	Tue Feb 23 22:34:35 2016 -0800
++++ b/perftest_resources.h	Tue Feb 23 22:34:53 2016 -0800
+@@ -128,10 +128,10 @@
+ #define KEY_MSG_SIZE_GID    98 // Message size with gid (MGID as well).
+ 
+ // The Format of the message we pass through sockets , without passing Gid.
+-#define KEY_PRINT_FMT "%04x:%04x:%06x:%06x:%08x:%016Lx"
++#define KEY_PRINT_FMT "%04x:%04x:%06x:%06x:%08x:%016llx"
+ 
+ // The Format of the message we pass through sockets (With Gid).
+-#define KEY_PRINT_FMT_GID "%04x:%04x:%06x:%06x:%08x:%016Lx:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
++#define KEY_PRINT_FMT_GID "%04x:%04x:%06x:%06x:%08x:%016llx:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
+ 
+ // The Basic print format for all verbs.
+ #define BASIC_ADDR_FMT " %s address: LID %#04x QPN %#06x PSN %#06x"
+@@ -140,7 +140,7 @@
+ #define READ_FMT       " OUT %#04x"
+ 
+ // The print format of the pingpong_dest element for RDMA verbs.
+-#define RDMA_FMT       " RKey %#08x VAddr %#016Lx"
++#define RDMA_FMT       " RKey %#08x VAddr %#016llx"
+ 
+ // The print format of a global address or a multicast address.
+ #define GID_FMT " %s: %02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d\n"
+@@ -154,10 +154,10 @@
+ #define RESULT_FMT_LAT " #bytes #iterations    t_min[usec]    t_max[usec]  t_typical[usec]\n"
+ 
+ // Result print format
+-#define REPORT_FMT     " %-7lu   %d           %-7.2f            %-7.2f\n"
++#define REPORT_FMT     " %-7"PRIu64"   %d           %-7.2f            %-7.2f\n"
+ 
+ // Result print format for latency tests.
+-#define REPORT_FMT_LAT " %-7lu %d          %-7.2f        %-7.2f      %-7.2f\n"
++#define REPORT_FMT_LAT " %-7"PRIu64" %d          %-7.2f        %-7.2f      %-7.2f\n"
+ 
+ // Macro for allocating.
+ #define ALLOCATE(var,type,size)                                  \
+diff -r 8cb431a3e51b rdma_bw.c
+--- a/rdma_bw.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/rdma_bw.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -50,8 +50,11 @@
+ #include <malloc.h>
+ #include <getopt.h>
+ #include <arpa/inet.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <time.h>
++#include <inttypes.h>
+ 
+ #include <infiniband/verbs.h>
+ #include <rdma/rdma_cma.h>
+@@ -142,9 +145,9 @@
+ 
+ 	n = getaddrinfo(data->servername, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%d:%s: %s for %s:%d\n", 
+-				pid, __func__, gai_strerror(n),
++				(int)pid, __func__, gai_strerror(n),
+ 				data->servername, data->port);
+ 		goto err4;
+ 	}
+@@ -157,7 +160,7 @@
+ 		if (rdma_resolve_addr(data->cm_id, NULL,
+ 					 (struct sockaddr *)&sin, 2000)) {
+ 			fprintf(stderr, "%d:%s: rdma_resolve_addr failed\n",
+-					 pid, __func__ );
++					 (int)pid, __func__ );
+ 			goto err2;
+ 		}
+ 	
+@@ -172,7 +175,7 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_ADDR_RESOLVED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);
+@@ -180,7 +183,7 @@
+ retry_route:
+ 		if (rdma_resolve_route(data->cm_id, 2000)) {
+ 			fprintf(stderr, "%d:%s: rdma_resolve_route failed\n", 
+-						pid, __func__);
++						(int)pid, __func__);
+ 			goto err2;
+ 		}
+ 	
+@@ -195,14 +198,14 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+-					pid, __func__, event->event);
++					(int)pid, __func__, event->event);
+ 			rdma_ack_cm_event(event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);
+ 		ctx = pp_init_ctx(data->cm_id, data);
+ 		if (!ctx) {
+-			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", (int)pid, __func__);
+ 			goto err2;
+ 		}
+ 		data->my_dest.psn = lrand48() & 0xffffff;
+@@ -218,7 +221,7 @@
+ 		conn_param.private_data_len = sizeof(data->my_dest);
+ 
+ 		if (rdma_connect(data->cm_id, &conn_param)) {
+-			fprintf(stderr, "%d:%s: rdma_connect failure\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_connect failure\n", (int)pid, __func__);
+ 			goto err2;
+ 		}
+ 	
+@@ -227,13 +230,13 @@
+ 	
+ 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+- 					pid, __func__, event->event);
++ 					(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		if (!event->param.conn.private_data || 
+ 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
+ 			fprintf(stderr, "%d:%s: bad private data ptr %p len %d\n",  
+-				pid, __func__, event->param.conn.private_data, 
++				(int)pid, __func__, event->param.conn.private_data, 
+ 				event->param.conn.private_data_len);
+ 			goto err1;
+ 		}
+@@ -257,7 +260,7 @@
+ 		}
+ 		if (sockfd < 0) {
+ 			fprintf(stderr, "%d:%s: Couldn't connect to %s:%d\n", 
+-				 pid, __func__, data->servername, data->port);
++				 (int)pid, __func__, data->servername, data->port);
+ 			goto err3;
+ 		}
+ 		ctx = pp_init_ctx(data->ib_dev, data);
+@@ -287,20 +290,20 @@
+ 	int parsed;
+ 	
+ 	if (!data->use_cma) {
+-		sprintf(msg, "%04x:%06x:%06x:%08x:%016Lx", data->my_dest.lid, 
++		sprintf(msg, "%04x:%06x:%06x:%08x:%016llx", data->my_dest.lid, 
+ 				data->my_dest.qpn, data->my_dest.psn,
+ 				data->my_dest.rkey, data->my_dest.vaddr);
+ 		if (write(data->sockfd, msg, sizeof msg) != sizeof msg) {
+ 			perror("client write");
+ 			fprintf(stderr, "%d:%s: Couldn't send local address\n", 
+-					pid, __func__);
++					(int)pid, __func__);
+ 			goto err;
+ 		}
+ 	
+ 		if (read(data->sockfd, msg, sizeof msg) != sizeof msg) {
+ 			perror("client read");
+ 			fprintf(stderr, "%d:%s: Couldn't read remote address\n", 
+-					pid, __func__);
++					(int)pid, __func__);
+ 			goto err;
+ 		}
+ 	
+@@ -310,13 +313,13 @@
+ 		if (!data->rem_dest)
+ 			goto err;
+ 	
+-		parsed = sscanf(msg, "%x:%x:%x:%x:%Lx", &data->rem_dest->lid,
++		parsed = sscanf(msg, "%x:%x:%x:%x:%llx", &data->rem_dest->lid,
+ 				&data->rem_dest->qpn, &data->rem_dest->psn,
+ 				&data->rem_dest->rkey, &data->rem_dest->vaddr);
+ 	
+ 		if (parsed != 5) {
+ 			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n",
+-					pid, __func__, (int)sizeof msg, msg);
++					(int)pid, __func__, (int)sizeof msg, msg);
+ 			free(data->rem_dest);
+ 			goto err;
+ 		}
+@@ -346,8 +349,8 @@
+ 	if (asprintf(&service, "%d", data->port) < 0)
+ 		goto err5;
+ 
+-	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
+-		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
++	if ( (n = getaddrinfo(NULL, service, &hints, &res) != 0) ) {
++		fprintf(stderr, "%d:%s: %s for port %d\n", (int)pid, __func__, 
+ 					gai_strerror(n), data->port);
+ 		goto err5;
+ 	}
+@@ -357,12 +360,12 @@
+ 		sin.sin_family = AF_INET;
+ 		sin.sin_port = htons(data->port);
+ 		if (rdma_bind_addr(data->cm_id, (struct sockaddr *)&sin)) {
+-			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", (int)pid, __func__);
+ 			goto err3;
+ 		}
+ 	
+ 		if (rdma_listen(data->cm_id, 0)) {
+-			fprintf(stderr, "%d:%s: rdma_listen failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_listen failed\n", (int)pid, __func__);
+ 			goto err3;
+ 		}
+ 	
+@@ -371,13 +374,13 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
+ 			fprintf(stderr, "%d:%s: bad event waiting for connect request %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err2;
+ 		}
+ 	
+ 		if (!event->param.conn.private_data ||
+ 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
+-			fprintf(stderr, "%d:%s: bad private data len %d\n", pid,
++			fprintf(stderr, "%d:%s: bad private data len %d\n", (int)pid,
+ 				__func__, event->param.conn.private_data_len);
+ 			goto err2;
+ 		}
+@@ -405,18 +408,18 @@
+ 		conn_param.private_data = &data->my_dest;
+ 		conn_param.private_data_len = sizeof(data->my_dest);
+ 		if (rdma_accept(child_cm_id, &conn_param)) {
+-			fprintf(stderr, "%d:%s: rdma_accept failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_accept failed\n", (int)pid, __func__);
+ 			goto err1;
+ 		}	
+ 		rdma_ack_cm_event(event);
+ 		if (rdma_get_cm_event(data->cm_channel, &event)) {
+-			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", (int)pid, __func__);
+ 			rdma_destroy_id(child_cm_id);
+ 			goto err3;
+ 		}
+ 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
+ 			fprintf(stderr, "%d:%s: bad event waiting for established %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);	
+@@ -436,7 +439,7 @@
+ 		}
+ 	
+ 		if (sockfd < 0) {
+-			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", pid,
++			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", (int)pid,
+ 						__func__, data->port);
+ 			goto err4;
+ 		}
+@@ -445,7 +448,7 @@
+ 		connfd = accept(sockfd, NULL, 0);
+ 		if (connfd < 0) {
+ 			perror("server accept");
+-			fprintf(stderr, "%d:%s: accept() failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: accept() failed\n", (int)pid, __func__);
+ 			close(sockfd);
+ 			goto err4;
+ 		}
+@@ -485,7 +488,7 @@
+ 		if (n != sizeof msg) {
+ 			perror("server read");
+ 			fprintf(stderr, "%d:%s: %d/%d Couldn't read remote address\n", 
+-						pid, __func__, n, (int) sizeof msg);
++						(int)pid, __func__, n, (int) sizeof msg);
+ 			goto err;
+ 		}
+ 	
+@@ -495,23 +498,23 @@
+ 		if (!data->rem_dest)
+ 			goto err;
+ 	
+-		parsed = sscanf(msg, "%x:%x:%x:%x:%Lx", &data->rem_dest->lid,
++		parsed = sscanf(msg, "%x:%x:%x:%x:%llx", &data->rem_dest->lid,
+ 			      &data->rem_dest->qpn, &data->rem_dest->psn,
+ 			      &data->rem_dest->rkey, &data->rem_dest->vaddr);
+ 		if (parsed != 5) {
+-			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n", pid,
++			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n", (int)pid,
+ 						 __func__, (int)sizeof msg, msg);
+ 			free(data->rem_dest);
+ 			goto err;
+ 		}
+ 	
+-		sprintf(msg, "%04x:%06x:%06x:%08x:%016Lx", data->my_dest.lid,
++		sprintf(msg, "%04x:%06x:%06x:%08x:%016llx", data->my_dest.lid,
+ 					 data->my_dest.qpn, data->my_dest.psn,
+ 					 data->my_dest.rkey, data->my_dest.vaddr);
+ 		if (write(data->sockfd, msg, sizeof msg) != sizeof msg) {
+ 			perror("server write");
+ 			fprintf(stderr, "%d:%s: Couldn't send local address\n", 
+-					pid, __func__);
++					(int)pid, __func__);
+ 			free(data->rem_dest);
+ 			goto err;
+ 		}
+@@ -538,7 +541,7 @@
+ 	ctx->buf = memalign(page_size, ctx->size * 2);
+ 	if (!ctx->buf) {
+ 		fprintf(stderr, "%d:%s: Couldn't allocate work buf.\n",
+-					 pid, __func__);
++					 (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+@@ -548,7 +551,7 @@
+ 		cm_id = (struct rdma_cm_id *)ptr;
+ 		ctx->context = cm_id->verbs;
+ 		if (!ctx->context) {
+-			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
++			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", (int)pid, 
+ 							__func__);
+ 			return NULL;
+ 		}
+@@ -558,14 +561,14 @@
+ 		ctx->context = ibv_open_device(ib_dev);
+ 		if (!ctx->context) {
+ 			fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
+-				pid, __func__, ibv_get_device_name(ib_dev));
++				(int)pid, __func__, ibv_get_device_name(ib_dev));
+ 			return NULL;
+ 		}
+ 	}
+ 
+ 	ctx->pd = ibv_alloc_pd(ctx->context);
+ 	if (!ctx->pd) {
+-		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+@@ -575,28 +578,28 @@
+ 	ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, ctx->size * 2,
+ 			     IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_LOCAL_WRITE);
+ 	if (!ctx->mr) {
+-		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+ 
+ 	ctx->ch = ibv_create_comp_channel(ctx->context);
+ 	if (!ctx->ch) {
+-		fprintf(stderr, "%d:%s: Couldn't create comp channel\n", pid,
++		fprintf(stderr, "%d:%s: Couldn't create comp channel\n", (int)pid,
+ 								 __func__);
+ 		return NULL;
+ 	}
+ 
+ 	ctx->rcq = ibv_create_cq(ctx->context, 1, NULL, NULL, 0);
+ 	if (!ctx->rcq) {
+-		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", pid,
++		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", (int)pid,
+ 								 __func__);
+ 		return NULL;
+ 	}
+ 
+ 	ctx->scq = ibv_create_cq(ctx->context, ctx->tx_depth, ctx, ctx->ch, 0);
+ 	if (!ctx->scq) {
+-		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", pid,
++		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", (int)pid,
+ 								 __func__);
+ 		return NULL;
+ 	}
+@@ -619,7 +622,7 @@
+ 
+ 	if (data->use_cma) {
+ 		if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
+-			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
++			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
+ 			return NULL;
+ 		}
+ 		ctx->qp = cm_id->qp;
+@@ -628,7 +631,7 @@
+ 	} else {
+ 		ctx->qp = ibv_create_qp(ctx->pd, &attr);
+ 		if (!ctx->qp)  {
+-			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
++			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
+ 			return NULL;
+ 		}
+ 		{
+@@ -645,7 +648,7 @@
+ 					IBV_QP_PORT               |
+ 					IBV_QP_ACCESS_FLAGS)) {
+ 				fprintf(stderr, "%d:%s: Failed to modify QP to INIT\n", 
+-						pid, __func__);
++						(int)pid, __func__);
+ 				return NULL;
+ 			}
+ 		}
+@@ -679,7 +682,7 @@
+ 			  IBV_QP_RQ_PSN             |
+ 			  IBV_QP_MAX_DEST_RD_ATOMIC |
+ 			  IBV_QP_MIN_RNR_TIMER)) {
+-		fprintf(stderr, "%d:%s: Failed to modify QP to RTR\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Failed to modify QP to RTR\n", (int)pid, __func__);
+ 		return 1;
+ 	}
+ 
+@@ -696,7 +699,7 @@
+ 			  IBV_QP_RNR_RETRY          |
+ 			  IBV_QP_SQ_PSN             |
+ 			  IBV_QP_MAX_QP_RD_ATOMIC)) {
+-		fprintf(stderr, "%d:%s: Failed to modify QP to RTS\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Failed to modify QP to RTS\n", (int)pid, __func__);
+ 		return 1;
+ 	}
+ 
+@@ -720,7 +723,7 @@
+         rc = ibv_post_recv(ctx->qp, &wr, &bad_wr);
+         if (rc) {
+                 perror("ibv_post_recv");
+-                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", pid,
++                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", (int)pid,
+ 				 __func__, rc);
+         }
+ }
+@@ -736,13 +739,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (!(wc.opcode & IBV_WC_RECV))
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xdeadbeef) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ }
+ 
+@@ -762,7 +765,7 @@
+ 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+ 	ctx->wr.next       = NULL;
+ 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
+-		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
++		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
+ 		return;
+ 	}
+ 	do {
+@@ -771,13 +774,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 						wc.status);
+ 	if (wc.opcode != IBV_WC_SEND)
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__, 
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__, 
+ 						wc.opcode);
+ 	if (wc.wr_id != 0xcafebabe) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 						(int)wc.wr_id);
+ }
+ 
+@@ -792,13 +795,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (!(wc.opcode & IBV_WC_RECV))
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xdeadbeef) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ 	pp_post_recv(ctx);
+ }
+@@ -819,7 +822,7 @@
+ 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+ 	ctx->wr.next       = NULL;
+ 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
+-		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
++		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
+ 		return;
+ 	}
+ 	do {
+@@ -828,13 +831,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (wc.opcode != IBV_WC_SEND)
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xabbaabba) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ }
+ 
+@@ -847,7 +850,7 @@
+                 rc = rdma_disconnect(data.cm_id);
+                 if (rc) {
+ 			perror("rdma_disconnect");
+-			fprintf(stderr, "%d:%s: rdma disconnect error\n", pid,
++			fprintf(stderr, "%d:%s: rdma disconnect error\n", (int)pid,
+ 								 __func__);
+ 			return;
+                 }
+@@ -856,7 +859,7 @@
+         rdma_get_cm_event(data.cm_channel, &event);
+         if (event->event != RDMA_CM_EVENT_DISCONNECTED)
+                 fprintf(stderr, "%d:%s: unexpected event during disconnect %d\n", 
+-			pid, __func__, event->event);
++			(int)pid, __func__, event->event);
+         rdma_ack_cm_event(event);
+         rdma_destroy_id(data.cm_id);
+         rdma_destroy_event_channel(data.cm_channel);
+@@ -904,22 +907,26 @@
+ 			}
+ 		}
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	cycles_to_units = get_cpu_mhz(0) * 1000000;
++#else
++	cycles_to_units = 1000000000;
++#endif
+ 
+ 	tsize = duplex ? 2 : 1;
+ 	tsize = tsize * size;
+ 
+-	printf("\n%d: Bandwidth peak (#%d to #%d): %g MB/sec\n", pid, 
++	printf("\n%d: Bandwidth peak (#%d to #%d): %g MB/sec\n", (int)pid, 
+ 			 opt_posted, opt_completed,
+ 			 tsize * cycles_to_units / opt_delta / 0x100000);
+-	printf("%d: Bandwidth average: %g MB/sec\n", pid, 
++	printf("%d: Bandwidth average: %g MB/sec\n", (int)pid, 
+ 			 tsize * iters * cycles_to_units /
+ 			 (tcompleted[iters - 1] - tposted[0]) / 0x100000);
+ 
+-	printf("%d: Service Demand peak (#%d to #%d): %ld cycles/KB\n", pid, 
++	printf("%d: Service Demand peak (#%d to #%d): %ld cycles/KB\n", (int)pid, 
+ 			 opt_posted, opt_completed,
+ 			 (unsigned long)opt_delta * 1024 / tsize);
+-	printf("%d: Service Demand Avg  : %ld cycles/KB\n", pid, 
++	printf("%d: Service Demand Avg  : %ld cycles/KB\n", (int)pid, 
+ 			 (unsigned long)(tcompleted[iters - 1] - tposted[0]) *
+ 			 1024 / (tsize * iters));	
+ }
+@@ -1046,7 +1053,7 @@
+ 	pid = getpid();
+ 
+ 	printf("%d: | port=%d | ib_port=%d | size=%d | tx_depth=%d | sl=%d | iters=%d | duplex=%d | cma=%d |\n",
+-		 pid, data.port, data.ib_port, data.size, data.tx_depth,
++		 (int)pid, data.port, data.ib_port, data.size, data.tx_depth,
+ 		 sl, iters, duplex, data.use_cma);
+ 		
+ 	/* Done with parameter parsing. Perform setup. */
+@@ -1059,12 +1066,12 @@
+ 		data.cm_channel = rdma_create_event_channel();
+ 		if (!data.cm_channel) {
+ 			fprintf(stderr, "%d:%s: rdma_create_event_channel failed\n",
+-							 pid, __func__);
++							 (int)pid, __func__);
+ 			return 1;
+ 		}
+ 		if (rdma_create_id(data.cm_channel, &data.cm_id, NULL, RDMA_PS_TCP)) {
+ 			fprintf(stderr, "%d:%s: rdma_create_id failed\n",
+-							 pid, __func__);
++							 (int)pid, __func__);
+ 			return 1;
+ 		}
+ 	
+@@ -1079,12 +1086,17 @@
+ 		}
+ 	} else {
+ 		dev_list = ibv_get_device_list(NULL);
++		if (!dev_list) {
++			fprintf(stderr, "%d:%s: No IB devices found\n",
++			     (int)pid, __func__);
++			return 1;
++		}
+ 	
+ 		if (!ib_devname) {
+ 			data.ib_dev = dev_list[0];
+ 			if (!data.ib_dev) {
+ 				fprintf(stderr, "%d:%s: No IB devices found\n",
+-							 pid, __func__);
++							 (int)pid, __func__);
+ 				return 1;
+ 			}
+ 		} else {
+@@ -1093,7 +1105,7 @@
+ 					break;
+ 			if (!data.ib_dev) {
+ 				fprintf(stderr, "%d:%s: IB device %s not found\n",
+-						 pid, __func__, ib_devname);
++						 (int)pid, __func__, ib_devname);
+ 				return 1;
+ 			}
+ 		}
+@@ -1109,7 +1121,7 @@
+ 		data.my_dest.lid = pp_get_local_lid(ctx, data.ib_port);
+ 		if (!data.my_dest.lid) {
+ 			fprintf(stderr, "%d:%s: Local lid 0x0 detected. Is an SM running?\n",
+-						pid, __func__);
++						(int)pid, __func__);
+ 			return 1;
+ 		}
+ 		data.my_dest.qpn = ctx->qp->qp_num;
+@@ -1129,12 +1141,12 @@
+ 	}
+ 
+ 	printf("%d: Local address:  LID %#04x, QPN %#06x, PSN %#06x "
+-			"RKey %#08x VAddr %#016Lx\n", pid, 
++			"RKey %#08x VAddr %#016llx\n", (int)pid, 
+ 			data.my_dest.lid, data.my_dest.qpn, data.my_dest.psn,
+ 			data.my_dest.rkey, data.my_dest.vaddr);	
+ 
+ 	printf("%d: Remote address: LID %#04x, QPN %#06x, PSN %#06x, "
+-			"RKey %#08x VAddr %#016Lx\n\n", pid, 
++			"RKey %#08x VAddr %#016llx\n\n", (int)pid, 
+ 			data.rem_dest->lid, data.rem_dest->qpn, data.rem_dest->psn,
+ 			data.rem_dest->rkey, data.rem_dest->vaddr);
+ 
+@@ -1219,7 +1231,7 @@
+ 
+ 			if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
+ 				fprintf(stderr, "%d:%s: Couldn't post send: scnt=%d\n",
+-					pid, __func__, scnt);
++					(int)pid, __func__, scnt);
+ 				return 1;
+ 			}
+ 			++scnt;
+@@ -1235,17 +1247,17 @@
+ 			tcompleted[ccnt] = get_cycles();
+ 
+ 			if (ne < 0) {
+-				fprintf(stderr, "%d:%s: poll CQ failed %d\n", pid, 
++				fprintf(stderr, "%d:%s: poll CQ failed %d\n", (int)pid, 
+ 					__func__, ne);
+ 				return 1;
+ 			}
+ 			if (wc.status != IBV_WC_SUCCESS) {
+ 				fprintf(stderr, "%d:%s: Completion with error at %s:\n",
+-					pid, __func__, data.servername ? "client" : "server");
++					(int)pid, __func__, data.servername ? "client" : "server");
+ 				fprintf(stderr, "%d:%s: Failed status %d: wr_id %d\n",
+-					pid, __func__, wc.status, (int) wc.wr_id);
++					(int)pid, __func__, wc.status, (int) wc.wr_id);
+ 				fprintf(stderr, "%d:%s: scnt=%d, ccnt=%d\n",
+-					pid, __func__, scnt, ccnt);
++					(int)pid, __func__, scnt, ccnt);
+ 				return 1;
+ 			}
+ 			ccnt += 1;
+@@ -1265,7 +1277,7 @@
+ 		
+ 		write(data.sockfd, "done", sizeof "done");
+ 		close(data.sockfd);
+-		
++
+ 	}
+ 	
+ 	print_report(iters, data.size, duplex, tposted, tcompleted);
+diff -r 8cb431a3e51b rdma_lat.c
+--- a/rdma_lat.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/rdma_lat.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -50,8 +50,11 @@
+ #include <malloc.h>
+ #include <getopt.h>
+ #include <arpa/inet.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <time.h>
++#include <inttypes.h>
+ 
+ #include <infiniband/verbs.h>
+ #include <rdma/rdma_cma.h>
+@@ -138,6 +141,11 @@
+ 	struct ibv_device *ib_dev = NULL;
+ 
+ 	dev_list = ibv_get_device_list(NULL);
++	if (!dev_list) {
++		fprintf(stderr, "%d:%s: No IB devices found\n",
++		     (int)pid, __func__);
++		return NULL;
++	}
+ 
+ 	if (!ib_devname) {
+ 		ib_dev = dev_list[0];
+@@ -155,7 +163,8 @@
+ }
+ 
+ #define KEY_MSG_SIZE (sizeof "0000:000000:000000:00000000:0000000000000000")
+-#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016Lx"
++#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016" "llx"
++#define KEY_SCAN_FMT "%04x:%06x:%06x:%08x:%016" "llx"
+ 
+ static int pp_write_keys(int sockfd, const struct pingpong_dest *my_dest)
+ {
+@@ -185,7 +194,7 @@
+ 		return -1;
+ 	}
+ 
+-	parsed = sscanf(msg, KEY_PRINT_FMT, &rem_dest->lid, &rem_dest->qpn,
++	parsed = sscanf(msg, KEY_SCAN_FMT, &rem_dest->lid, &rem_dest->qpn,
+ 			&rem_dest->psn, &rem_dest->rkey, &rem_dest->vaddr);
+ 
+ 	if (parsed != 5) {
+@@ -218,9 +227,9 @@
+ 
+ 	n = getaddrinfo(data->servername, service, &hints, &res);
+ 
+-	if (n < 0) {
++	if (n != 0) {
+ 		fprintf(stderr, "%d:%s: %s for %s:%d\n", 
+-				pid, __func__, gai_strerror(n),
++				(int)pid, __func__, gai_strerror(n),
+ 				data->servername, data->port);
+ 		goto err4;
+ 	}
+@@ -233,7 +242,7 @@
+ 		if (rdma_resolve_addr(data->cm_id, NULL,
+ 					 (struct sockaddr *)&sin, 2000)) {
+ 			fprintf(stderr, "%d:%s: rdma_resolve_addr failed\n",
+-					 pid, __func__ );
++					 (int)pid, __func__ );
+ 			goto err2;
+ 		}
+ 	
+@@ -248,7 +257,7 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_ADDR_RESOLVED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);
+@@ -256,7 +265,7 @@
+ retry_route:
+ 		if (rdma_resolve_route(data->cm_id, 2000)) {
+ 			fprintf(stderr, "%d:%s: rdma_resolve_route failed\n", 
+-						pid, __func__);
++						(int)pid, __func__);
+ 			goto err2;
+ 		}
+ 	
+@@ -271,14 +280,14 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+-					pid, __func__, event->event);
++					(int)pid, __func__, event->event);
+ 			rdma_ack_cm_event(event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);
+ 		ctx = pp_init_ctx(data->cm_id, data);
+ 		if (!ctx) {
+-			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", (int)pid, __func__);
+ 			goto err2;
+ 		}
+ 		data->my_dest.psn = lrand48() & 0xffffff;
+@@ -294,7 +303,7 @@
+ 		conn_param.private_data_len = sizeof(data->my_dest);
+ 
+ 		if (rdma_connect(data->cm_id, &conn_param)) {
+-			fprintf(stderr, "%d:%s: rdma_connect failure\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_connect failure\n", (int)pid, __func__);
+ 			goto err2;
+ 		}
+ 	
+@@ -303,13 +312,13 @@
+ 	
+ 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
+ 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
+- 					pid, __func__, event->event);
++ 					(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		if (!event->param.conn.private_data || 
+ 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
+ 			fprintf(stderr, "%d:%s: bad private data ptr %p len %d\n",  
+-				pid, __func__, event->param.conn.private_data, 
++				(int)pid, __func__, event->param.conn.private_data, 
+ 				event->param.conn.private_data_len);
+ 			goto err1;
+ 		}
+@@ -332,7 +341,7 @@
+ 		}
+ 		if (sockfd < 0) {
+ 			fprintf(stderr, "%d:%s: Couldn't connect to %s:%d\n", 
+-				 pid, __func__, data->servername, data->port);
++				 (int)pid, __func__, data->servername, data->port);
+ 			goto err3;
+ 		}
+ 		ctx = pp_init_ctx(data->ib_dev, data);
+@@ -392,8 +401,8 @@
+ 	if (asprintf(&service, "%d", data->port) < 0)
+ 		goto err5;
+ 
+-	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
+-		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
++	if ( (n = getaddrinfo(NULL, service, &hints, &res) != 0) ) {
++		fprintf(stderr, "%d:%s: %s for port %d\n", (int)pid, __func__, 
+ 					gai_strerror(n), data->port);
+ 		goto err5;
+ 	}
+@@ -403,12 +412,12 @@
+ 		sin.sin_family = AF_INET;
+ 		sin.sin_port = htons(data->port);
+ 		if (rdma_bind_addr(data->cm_id, (struct sockaddr *)&sin)) {
+-			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", (int)pid, __func__);
+ 			goto err3;
+ 		}
+ 	
+ 		if (rdma_listen(data->cm_id, 0)) {
+-			fprintf(stderr, "%d:%s: rdma_listen failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_listen failed\n", (int)pid, __func__);
+ 			goto err3;
+ 		}
+ 	
+@@ -417,13 +426,13 @@
+ 
+ 		if (event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
+ 			fprintf(stderr, "%d:%s: bad event waiting for connect request %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err2;
+ 		}
+ 	
+ 		if (!event->param.conn.private_data ||
+ 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
+-			fprintf(stderr, "%d:%s: bad private data len %d\n", pid,
++			fprintf(stderr, "%d:%s: bad private data len %d\n", (int)pid,
+ 				__func__, event->param.conn.private_data_len);
+ 			goto err2;
+ 		}
+@@ -451,18 +460,18 @@
+ 		conn_param.private_data = &data->my_dest;
+ 		conn_param.private_data_len = sizeof(data->my_dest);
+ 		if (rdma_accept(child_cm_id, &conn_param)) {
+-			fprintf(stderr, "%d:%s: rdma_accept failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_accept failed\n", (int)pid, __func__);
+ 			goto err1;
+ 		}	
+ 		rdma_ack_cm_event(event);
+ 		if (rdma_get_cm_event(data->cm_channel, &event)) {
+-			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", pid, __func__);
++			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", (int)pid, __func__);
+ 			rdma_destroy_id(child_cm_id);
+ 			goto err3;
+ 		}
+ 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
+ 			fprintf(stderr, "%d:%s: bad event waiting for established %d\n", 
+-				pid, __func__, event->event);
++				(int)pid, __func__, event->event);
+ 			goto err1;
+ 		}
+ 		rdma_ack_cm_event(event);	
+@@ -482,7 +491,7 @@
+ 		}
+ 	
+ 		if (sockfd < 0) {
+-			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", pid,
++			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", (int)pid,
+ 						__func__, data->port);
+ 			goto err4;
+ 		}
+@@ -491,7 +500,7 @@
+ 		connfd = accept(sockfd, NULL, 0);
+ 		if (connfd < 0) {
+ 			perror("server accept");
+-			fprintf(stderr, "%d:%s: accept() failed\n", pid, __func__);
++			fprintf(stderr, "%d:%s: accept() failed\n", (int)pid, __func__);
+ 			close(sockfd);
+ 			goto err4;
+ 		}
+@@ -551,7 +560,7 @@
+ 	ctx->buf = memalign(page_size, ctx->size * 2);
+ 	if (!ctx->buf) {
+ 		fprintf(stderr, "%d:%s: Couldn't allocate work buf.\n",
+-					 pid, __func__);
++					 (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+@@ -565,7 +574,7 @@
+ 		cm_id = (struct rdma_cm_id *)ptr;
+ 		ctx->context = cm_id->verbs;
+ 		if (!ctx->context) {
+-			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
++			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", (int)pid, 
+ 							__func__);
+ 			return NULL;
+ 		}
+@@ -575,14 +584,14 @@
+ 		ctx->context = ibv_open_device(ib_dev);
+ 		if (!ctx->context) {
+ 			fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
+-				pid, __func__, ibv_get_device_name(ib_dev));
++				(int)pid, __func__, ibv_get_device_name(ib_dev));
+ 			return NULL;
+ 		}
+ 	}
+ 
+ 	ctx->pd = ibv_alloc_pd(ctx->context);
+ 	if (!ctx->pd) {
+-		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+@@ -592,20 +601,20 @@
+ 	ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, ctx->size * 2,
+ 			     IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_LOCAL_WRITE);
+ 	if (!ctx->mr) {
+-		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", pid, __func__);
++		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", (int)pid, __func__);
+ 		return NULL;
+ 	}
+ 
+ 	ctx->rcq = ibv_create_cq(ctx->context, 1, NULL, NULL, 0);
+ 	if (!ctx->rcq) {
+-		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", pid,
++		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", (int)pid,
+ 								 __func__);
+ 		return NULL;
+ 	}
+ 
+ 	ctx->scq = ibv_create_cq(ctx->context, ctx->tx_depth, ctx, NULL, 0);
+ 	if (!ctx->scq) {
+-		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", pid,
++		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", (int)pid,
+ 								 __func__);
+ 		return NULL;
+ 	}
+@@ -628,7 +637,7 @@
+ 
+ 	if (data->use_cma) {
+ 		if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
+-			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
++			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
+ 			return NULL;
+ 		}
+ 		ctx->qp = cm_id->qp;
+@@ -636,7 +645,7 @@
+ 	} else {
+ 		ctx->qp = ibv_create_qp(ctx->pd, &attr);
+ 		if (!ctx->qp)  {
+-			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
++			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
+ 			return NULL;
+ 		}
+ 		{
+@@ -653,7 +662,7 @@
+ 					IBV_QP_PORT               |
+ 					IBV_QP_ACCESS_FLAGS)) {
+ 				fprintf(stderr, "%d:%s: Failed to modify QP to INIT\n", 
+-						pid, __func__);
++						(int)pid, __func__);
+ 				return NULL;
+ 			}
+ 		}
+@@ -710,10 +719,10 @@
+ 	return 0;
+ }
+ 
++#define ADDR_FMT "%8s address: LID %#04x QPN %#06x PSN %#06x RKey %#08x VAddr %#016" "llx" "\n"
++
+ static int pp_open_port(struct pingpong_context *ctx, struct pp_data *data )
+ {
+-	char addr_fmt[] = "%8s address: LID %#04x QPN %#06x PSN %#06x RKey %#08x VAddr %#016Lx\n";
+-
+ 	/* Create connection between client and server.
+ 	 * We do it by exchanging data over a TCP socket connection. */
+ 
+@@ -727,7 +736,7 @@
+ 	data->my_dest.rkey = ctx->mr->rkey;
+ 	data->my_dest.vaddr = (uintptr_t)ctx->buf + ctx->size;
+ 
+-	printf(addr_fmt, "local", data->my_dest.lid, data->my_dest.qpn, data->my_dest.psn,
++	printf(ADDR_FMT, "local", data->my_dest.lid, data->my_dest.qpn, data->my_dest.psn,
+ 			data->my_dest.rkey, data->my_dest.vaddr);
+ 
+ 	if (data->servername) {
+@@ -738,7 +747,7 @@
+ 			return 1;
+ 	}
+ 
+-	printf(addr_fmt, "remote", data->rem_dest->lid, data->rem_dest->qpn,
++	printf(ADDR_FMT, "remote", data->rem_dest->lid, data->rem_dest->qpn,
+ 			data->rem_dest->psn, data->rem_dest->rkey, 
+ 			data->rem_dest->vaddr);
+ 
+@@ -783,7 +792,7 @@
+         rc = ibv_post_recv(ctx->qp, &wr, &bad_wr);
+         if (rc) {
+                 perror("ibv_post_recv");
+-                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", pid,
++                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", (int)pid,
+ 				 __func__, rc);
+         }
+ }
+@@ -799,13 +808,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (!(wc.opcode & IBV_WC_RECV))
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xdeadbeef) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ }
+ 
+@@ -825,7 +834,7 @@
+ 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+ 	ctx->wr.next       = NULL;
+ 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
+-		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
++		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
+ 		return;
+ 	}
+ 	do {
+@@ -834,13 +843,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 						wc.status);
+ 	if (wc.opcode != IBV_WC_SEND)
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__, 
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__, 
+ 						wc.opcode);
+ 	if (wc.wr_id != 0xcafebabe) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 						(int)wc.wr_id);
+ }
+ 
+@@ -855,13 +864,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (!(wc.opcode & IBV_WC_RECV))
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xdeadbeef) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ 	pp_post_recv(ctx);
+ }
+@@ -882,7 +891,7 @@
+ 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+ 	ctx->wr.next       = NULL;
+ 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
+-		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
++		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
+ 		return;
+ 	}
+ 	do {
+@@ -891,13 +900,13 @@
+ 	} while (ne == 0);
+ 
+ 	if (wc.status) 
+-		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
+ 					 wc.status);
+ 	if (wc.opcode != IBV_WC_SEND)
+-		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
+ 					 wc.opcode);
+ 	if (wc.wr_id != 0xabbaabba) 
+-		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
++		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
+ 					 (int)wc.wr_id);
+ }
+ 
+@@ -910,7 +919,7 @@
+                 rc = rdma_disconnect(data.cm_id);
+                 if (rc) {
+ 			perror("rdma_disconnect");
+-			fprintf(stderr, "%d:%s: rdma disconnect error\n", pid,
++			fprintf(stderr, "%d:%s: rdma disconnect error\n", (int)pid,
+ 								 __func__);
+ 			return;
+                 }
+@@ -919,7 +928,7 @@
+         rdma_get_cm_event(data.cm_channel, &event);
+         if (event->event != RDMA_CM_EVENT_DISCONNECTED)
+                 fprintf(stderr, "%d:%s: unexpected event during disconnect %d\n", 
+-			pid, __func__, event->event);
++			(int)pid, __func__, event->event);
+         rdma_ack_cm_event(event);
+         rdma_destroy_id(data.cm_id);
+         rdma_destroy_event_channel(data.cm_channel);
+@@ -989,10 +998,18 @@
+ 
+ 
+ 	if (options->cycles) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		cycles_to_units = 1;
++#else
++		cycles_to_units = (1/get_cpu_mhz(0)) * 1000;
++#endif
+ 		units = "cycles";
+ 	} else {
++#if !(defined(__SVR4) && defined(__sun))
+ 		cycles_to_units = get_cpu_mhz(0);
++#else
++		cycles_to_units = 1000;
++#endif
+ 		units = "usec";
+ 	}
+ 
+@@ -1164,12 +1181,12 @@
+ 		data.cm_channel = rdma_create_event_channel();
+ 		if (!data.cm_channel) {
+ 			fprintf(stderr, "%d:%s: rdma_create_event_channel failed\n",
+-							 pid, __func__);
++							 (int)pid, __func__);
+ 			return 1;
+ 		}
+ 		if (rdma_create_id(data.cm_channel, &data.cm_id, NULL, RDMA_PS_TCP)) {
+ 			fprintf(stderr, "%d:%s: rdma_create_id failed\n",
+-							 pid, __func__);
++							 (int)pid, __func__);
+ 			return 1;
+ 		}
+ 	
+@@ -1184,12 +1201,12 @@
+ 		}
+ 
+ 		printf("%d: Local address:  LID %#04x, QPN %#06x, PSN %#06x "
+-                        "RKey %#08x VAddr %#016Lx\n", pid,
++                        "RKey %#08x VAddr %#016llx\n", (int)pid,
+                         data.my_dest.lid, data.my_dest.qpn, data.my_dest.psn,
+                         data.my_dest.rkey, data.my_dest.vaddr);
+ 
+         	printf("%d: Remote address: LID %#04x, QPN %#06x, PSN %#06x, "
+-                        "RKey %#08x VAddr %#016Lx\n\n", pid,
++                        "RKey %#08x VAddr %#016llx\n\n", (int)pid,
+                         data.rem_dest->lid, data.rem_dest->qpn, data.rem_dest->psn,
+                         data.rem_dest->rkey, data.rem_dest->vaddr);
+ 
+diff -r 8cb431a3e51b read_bw.c
+--- a/read_bw.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/read_bw.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -44,6 +44,7 @@
+ // #include <limits.h>
+ #include <malloc.h>
+ // #include <getopt.h>
++#include <inttypes.h>
+ #include <time.h>
+ #include <infiniband/verbs.h>
+ 
+@@ -336,7 +337,11 @@
+ 			}
+ 	}
+ 
++#if !(defined(__sparc))
+ 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
++#else
++	cycles_to_units = 1000000000;
++#endif
+ 	tsize = user_param->duplex ? 2 : 1;
+ 	tsize = tsize * user_param->size;
+ 	
+@@ -443,6 +448,7 @@
+  ******************************************************************************/
+ int main(int argc, char *argv[]) {
+ 
++	int				ret = 0;
+ 	int                        i = 0;
+ 	struct ibv_device		   *ib_dev = NULL;
+ 	struct pingpong_context    *ctx;
+@@ -553,8 +559,10 @@
+ 
+ 		for (i = 1; i < 24 ; ++i) {
+ 			user_param.size = 1 << i;
+-			if(run_iter(ctx,&user_param,&rem_dest))
+-				return 17;
++			if(run_iter(ctx,&user_param,&rem_dest)) {
++				ret = 17;
++				goto exit;
++			}
+ 			print_report(&user_param);
+ 		}
+ 
+@@ -562,11 +570,13 @@
+ 
+ 	else {
+ 
+-		if(run_iter(ctx,&user_param,&rem_dest))
+-			return 17;
+-		
++		if(run_iter(ctx,&user_param,&rem_dest)) {
++			ret = 17;
++			goto exit;
++		}
+ 		print_report(&user_param);
+ 	}
++exit:
+ 
+ 	if (ctx_close_connection(&user_param,&my_dest,&rem_dest)) {
+ 		fprintf(stderr,"Failed to close connection between server and client\n");
+@@ -575,6 +585,9 @@
+ 	
+ 	printf(RESULT_LINE);
+ 
+-	return destroy_ctx_resources(ctx);
++	if (destroy_ctx_resources(ctx))
++		return 1;
++	else
++		return ret; 
+ 	
+ }
+diff -r 8cb431a3e51b read_lat.c
+--- a/read_lat.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/read_lat.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -46,6 +46,7 @@
+ #include <malloc.h>
+ #include <getopt.h>
+ #include <time.h>
++#include <inttypes.h>
+ #include <infiniband/verbs.h>
+ 
+ #include "get_clock.h"
+@@ -358,10 +359,19 @@
+ 
+ 
+ 	if (user_param->r_flag->cycles) {
++#if !(defined(__sparc))
+ 		cycles_to_units = 1;
++#else
++		cycles_to_units =
++		   (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
++#endif
+ 		units = "cycles";
+ 	} else {
++#if !(defined(__sparc))
+ 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
++#else
++		cycles_to_units = 1000;
++#endif
+ 		units = "usec";
+ 	}
+ 
+diff -r 8cb431a3e51b send_lat.c
+--- a/send_lat.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/send_lat.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -61,7 +61,8 @@
+ 	struct ibv_sge          *sge_list;
+ 	struct ibv_recv_wr      *rwr;
+ 	struct ibv_context      *context;
+-	struct ibv_comp_channel *channel;
++	struct ibv_comp_channel *rx_channel;
++	struct ibv_comp_channel *tx_channel;
+ 	struct ibv_pd           *pd;
+ 	struct ibv_mr           *mr;
+ 	struct ibv_cq           *rcq;
+@@ -259,9 +260,16 @@
+ 		test_result = 1;
+ 	}
+ 
+-	if (ctx->channel) {
+-		if (ibv_destroy_comp_channel(ctx->channel)) {
+-			fprintf(stderr, "failed to destroy channel \n");
++	if (ctx->rx_channel) {
++		if (ibv_destroy_comp_channel(ctx->rx_channel)) {
++			fprintf(stderr, "failed to destroy rx_channel \n");
++			test_result = 1;
++		}
++	}
++	
++	if (ctx->tx_channel) {
++		if (ibv_destroy_comp_channel(ctx->tx_channel)) {
++			fprintf(stderr, "failed to destroy tx_channel \n");
+ 			test_result = 1;
+ 		}
+ 	}
+@@ -328,13 +336,20 @@
+ 	memset(ctx->buf, 0,buff_size);
+ 
+     if (user_parm->use_event) {
+-		ctx->channel = ibv_create_comp_channel(ctx->context);
+-		if (!ctx->channel) {
+-			fprintf(stderr, "Couldn't create completion channel\n");
++		ctx->rx_channel = ibv_create_comp_channel(ctx->context);
++		if (!ctx->rx_channel) {
++			fprintf(stderr, "Couldn't create completion rx_channel\n");
+ 			return NULL;
+ 		}
+-	} else
+-		ctx->channel = NULL;
++		ctx->tx_channel = ibv_create_comp_channel(ctx->context);
++		if (!ctx->rx_channel) {
++			fprintf(stderr, "Couldn't create completion tx_channel\n");
++			return NULL;
++		}
++	} else {
++		ctx->rx_channel = NULL;
++		ctx->tx_channel = NULL;
++	}
+ 
+ 	ctx->pd = ibv_alloc_pd(ctx->context);
+ 	if (!ctx->pd) {
+@@ -348,13 +363,13 @@
+ 		return NULL;
+ 	}
+ 	
+-	ctx->scq = ibv_create_cq(ctx->context,user_parm->tx_depth,NULL,ctx->channel,0);
++	ctx->scq = ibv_create_cq(ctx->context,user_parm->tx_depth,NULL,ctx->tx_channel,0);
+ 	if (!ctx->scq) {
+ 	    fprintf(stderr, "Couldn't create CQ\n");
+ 		return NULL;
+ 	}
+ 
+-	ctx->rcq = ibv_create_cq(ctx->context,user_parm->rx_depth*user_parm->num_of_qps,NULL,ctx->channel,0);
++	ctx->rcq = ibv_create_cq(ctx->context,user_parm->rx_depth*user_parm->num_of_qps,NULL,ctx->rx_channel,0);
+ 	if (!ctx->rcq) {
+ 	    fprintf(stderr, "Couldn't create CQ\n");
+ 		return NULL;
+@@ -581,12 +596,20 @@
+ 	for (i = 0; i < user_param->iters - 1; ++i)
+ 		delta[i] = tstamp[i + 1] - tstamp[i];
+ 
+-
+ 	if (user_param->r_flag->cycles) {
++#if !(defined(__sparc))
+ 		cycles_to_units = 1;
++#else
++		cycles_to_units =
++		        (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
++#endif
+ 		units = "cycles";
+ 	} else {
++#if !(defined(__sparc))
+ 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
++#else
++		cycles_to_units = 1000;
++#endif
+ 		units = "usec";
+ 	}
+ 
+@@ -649,7 +672,7 @@
+ 		  
+ 			// Server is polling on recieve first .
+ 		    if (user_param->use_event) {
+-				if (ctx_notify_events(ctx->rcq,ctx->channel)) {
++				if (ctx_notify_events(ctx->rcq, ctx->rx_channel)) {
+ 					fprintf(stderr , " Failed to notify events to CQ");
+ 					return 1;
+ 				}
+@@ -701,7 +724,7 @@
+ 		    int s_ne;
+ 
+ 		    if (user_param->use_event) {
+-				if (ctx_notify_events(ctx->scq,ctx->channel)) {
++				if (ctx_notify_events(ctx->scq, ctx->tx_channel)) {
+ 					fprintf(stderr , " Failed to notify events to CQ");
+ 					return 1;
+ 				}
+diff -r 8cb431a3e51b write_bw.c
+--- a/write_bw.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/write_bw.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -45,6 +45,7 @@
+ #include <limits.h>
+ #include <malloc.h>
+ #include <getopt.h>
++#include <inttypes.h>
+ #include <time.h>
+ #include <infiniband/verbs.h>
+ 
+@@ -224,9 +225,6 @@
+ 		return NULL;
+ 	}
+ 
+-	if (is_dev_hermon(ctx->context) != NOT_HERMON && user_parm->inline_size != 0)
+-		user_parm->inline_size = 0;
+-
+ 	printf(" Inline data is used up to %d bytes message\n", user_parm->inline_size);
+ 
+ 	ctx->pd = ibv_alloc_pd(ctx->context);
+@@ -368,7 +366,6 @@
+ 	cycles_t t;
+ 	int iters = user_param->iters;
+ 
+-
+ 	opt_delta = tcompleted[opt_posted] - tposted[opt_completed];
+ 
+ 	if (user_param->noPeak == OFF) {
+@@ -384,7 +381,11 @@
+ 		  }
+ 	}
+ 	
++#if !(defined(__sparc))
+ 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
++#else
++	cycles_to_units = 1000000000;
++#endif
+ 
+ 	tsize = user_param->duplex ? 2 : 1;
+ 	tsize = tsize * user_param->size;
+diff -r 8cb431a3e51b write_bw_postlist.c
+--- a/write_bw_postlist.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/write_bw_postlist.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -46,6 +46,7 @@
+ #include <malloc.h>
+ #include <getopt.h>
+ #include <time.h>
++#include <inttypes.h>
+ #include <infiniband/verbs.h>
+ 
+ #include "get_clock.h"
+@@ -323,7 +324,11 @@
+             }
+ 	}
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
++#else
++	cycles_to_units = 1000000000;
++#endif
+ 
+ 	tsize = user_param->duplex ? 2 : 1;
+ 	tsize = tsize * user_param->size;
+diff -r 8cb431a3e51b write_lat.c
+--- a/write_lat.c	Tue Feb 23 22:34:35 2016 -0800
++++ b/write_lat.c	Tue Feb 23 22:34:53 2016 -0800
+@@ -46,6 +46,7 @@
+ #include <malloc.h>
+ #include <getopt.h>
+ #include <time.h>
++#include <inttypes.h>
+ #include <infiniband/verbs.h>
+ 
+ #include "get_clock.h"
+@@ -330,10 +331,19 @@
+ 
+ 
+ 	if (user_param->r_flag->cycles) {
++#if !(defined(__sparc))
+ 		cycles_to_units = 1;
++#else
++		cycles_to_units =
++		    (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
++#endif
+ 		units = "cycles";
+ 	} else {
++#if !(defined(__sparc))
+ 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
++#else
++		cycles_to_units = 1000;
++#endif
+ 		units = "usec";
+ 	}
+ 
--- a/components/open-fabrics/perftest/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1858 +0,0 @@
-# This patch was developed in-house. Since it is Solaris-specific,
-# it is not suitable for upstream.
-#
-diff -r -u /tmp/perftest-1.3.0/Makefile perftest-1.3.0/Makefile
---- /tmp/perftest-1.3.0/Makefile	Thu Jan 20 01:37:35 2011
-+++ perftest-1.3.0/Makefile	Fri Feb 11 04:12:45 2011
-@@ -2,10 +2,11 @@
- MCAST_TESTS = send_bw send_lat
- TESTS = write_bw_postlist write_lat write_bw read_lat read_bw
- UTILS = clock_test
-+BINS = ib_write_bw_postlist rdma_lat rdma_bw ib_send_lat ib_send_bw ib_write_lat ib_write_bw ib_read_lat ib_read_bw ib_clock_test
- 
- all: ${RDMACM_TESTS} ${MCAST_TESTS} ${TESTS} ${UTILS}
- 
--CFLAGS += -Wall -g -D_GNU_SOURCE -O2
-+CFLAGS += -Wall -g -D_GNU_SOURCE -O3
- BASIC_FILES = get_clock.c
- EXTRA_FILES = perftest_resources.c
- MCAST_FILES = multicast_resources.c
-@@ -12,13 +13,14 @@
- BASIC_HEADERS = get_clock.h
- EXTRA_HEADERS = perftest_resources.h
- MCAST_HEADERS = multicast_resources.h
-+CC=gcc
- #The following seems to help GNU make on some platforms
- LOADLIBES += 
- LDFLAGS +=
- 
--${RDMACM_TESTS}: LOADLIBES += -libverbs -lrdmacm
--${MCAST_TESTS}: LOADLIBES += -libverbs -libumad -lm
--${TESTS} ${UTILS}: LOADLIBES += -libverbs
-+${RDMACM_TESTS}: LOADLIBES += -lsocket -libverbs -lrdmacm -lrt 
-+${MCAST_TESTS}: LOADLIBES += -lsocket -libverbs -lrdmacm -lrt -libumad -lm
-+${TESTS} ${UTILS}: LOADLIBES += -lsocket -lrt -libverbs
- 
- ${RDMACM_TESTS}: %: %.c ${BASIC_FILES} ${BASIC_HEADERS}
- 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< ${BASIC_FILES} $(LOADLIBES) $(LDLIBS) -o $@
-@@ -27,6 +29,10 @@
- ${TESTS} ${UTILS}: %: %.c ${BASIC_FILES} ${EXTRA_FILES} ${BASIC_HEADERS} ${EXTRA_HEADERS}
- 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< ${BASIC_FILES} ${EXTRA_FILES} $(LOADLIBES) $(LDLIBS) -o ib_$@
- 
-+install: all
-+	$(INSTALL) -d $(DESTDIR)$(BINDIR)
-+	$(INSTALL) -m 755 -s $(BINS) $(DESTDIR)$(BINDIR)
-+
- clean:
- 	$(foreach fname,${RDMACM_TESTS}, rm -f ${fname})
- 	$(foreach fname,${MCAST_TESTS}, rm -f ib_${fname})
-diff -r -u /tmp/perftest-1.3.0/clock_test.c perftest-1.3.0/clock_test.c
---- /tmp/perftest-1.3.0/clock_test.c	Sun Nov  1 03:09:16 2009
-+++ perftest-1.3.0/clock_test.c	Fri Sep 30 08:08:29 2011
-@@ -20,6 +20,10 @@
- 		c1 = get_cycles();
- 		sleep(1);
- 		c2 = get_cycles();
-+#if defined(__sparc)
-+		printf("1 sec = %g usec\n", (double)((c2 - c1))/1000);
-+#else
- 		printf("1 sec = %g usec\n", (c2 - c1) / mhz);
-+#endif
- 	}
- }
-diff -r -u /tmp/perftest-1.3.0/get_clock.c perftest-1.3.0/get_clock.c
---- /tmp/perftest-1.3.0/get_clock.c	Sun Dec 19 06:36:26 2010
-+++ perftest-1.3.0/get_clock.c	Fri Feb 11 04:12:46 2011
-@@ -45,6 +45,10 @@
- #include <unistd.h>
- #include <stdio.h>
- #include "get_clock.h"
-+#if defined(__SVR4) && defined(__sun)
-+#include <stdlib.h>
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
- #ifndef DEBUG
- #define DEBUG 0
-@@ -56,6 +60,8 @@
- #define MEASUREMENTS 200
- #define USECSTEP 10
- #define USECSTART 100
-+#define NSECSTART 100000
-+#define NSECSTEP 10000
- 
- /*
-  Use linear regression to calculate cycles per microsecond.
-@@ -63,14 +69,14 @@
- */
- static double sample_get_cpu_mhz(void)
- {
--	struct timeval tv1, tv2;
-+        struct timeval tv1, tv2;
- 	cycles_t start;
- 	double sx = 0, sy = 0, sxx = 0, syy = 0, sxy = 0;
--	double tx, ty;
-+	cycles_t tx, ty;
- 	int i;
- 
- 	/* Regression: y = a + b x */
--	long x[MEASUREMENTS];
-+	cycles_t x[MEASUREMENTS];
- 	cycles_t y[MEASUREMENTS];
- 	double a; /* system call overhead in cycles */
- 	double b; /* cycles per microsecond */
-@@ -78,7 +84,6 @@
- 
- 	for (i = 0; i < MEASUREMENTS; ++i) {
- 		start = get_cycles();
--
- 		if (gettimeofday(&tv1, NULL)) {
- 			fprintf(stderr, "gettimeofday failed.\n");
- 			return 0;
-@@ -86,7 +91,7 @@
- 
- 		do {
- 			if (gettimeofday(&tv2, NULL)) {
--				fprintf(stderr, "gettimeofday failed.\n");
-+			        fprintf(stderr, "gettimeofday failed.\n");
- 				return 0;
- 			}
- 		} while ((tv2.tv_sec - tv1.tv_sec) * 1000000 +
-@@ -94,9 +99,10 @@
- 
- 		x[i] = (tv2.tv_sec - tv1.tv_sec) * 1000000 +
- 			tv2.tv_usec - tv1.tv_usec;
-+
- 		y[i] = get_cycles() - start;
- 		if (DEBUG_DATA)
--			fprintf(stderr, "x=%ld y=%Ld\n", x[i], (long long)y[i]);
-+			fprintf(stderr, "x=%lld y=%lld\n", x[i], y[i]);
- 	}
- 
- 	for (i = 0; i < MEASUREMENTS; ++i) {
-@@ -134,10 +140,15 @@
- 
- static double proc_get_cpu_mhz(int no_cpu_freq_fail)
- {
-+#if !(defined(__SVR4) && defined(__sun))
- 	FILE* f;
- 	char buf[256];
-+#else
-+	sol_cpu_info_t	*info;
-+#endif
- 	double mhz = 0.0;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	f = fopen("/proc/cpuinfo","r");
- 	if (!f)
- 		return 0.0;
-@@ -174,6 +185,13 @@
- 		}
- 	}
- 	fclose(f);
-+#else
-+	if (sol_get_cpu_info(&info) > 0)
-+		mhz = info[0].cpu_mhz;
-+	else
-+		return (0.0);
-+	free(info);
-+#endif
- 	return mhz;
- }
- 
-@@ -184,8 +202,9 @@
- 	sample = sample_get_cpu_mhz();
- 	proc = proc_get_cpu_mhz(no_cpu_freq_fail);
- 
--	if (!proc || !sample)
--		return 0;
-+#if defined(__sparc)
-+	return proc;
-+#endif
- 
- 	delta = proc > sample ? proc - sample : sample - proc;
- 	if (delta / proc > 0.01) {
-@@ -194,5 +213,6 @@
- 					sample, proc);
- 			return sample;
- 	}
-+
- 	return proc;
- }
-diff -r -u /tmp/perftest-1.3.0/get_clock.h perftest-1.3.0/get_clock.h
---- /tmp/perftest-1.3.0/get_clock.h	Sun Nov  1 03:09:16 2009
-+++ perftest-1.3.0/get_clock.h	Fri Feb 11 04:12:46 2011
-@@ -36,8 +36,18 @@
- 
- #ifndef GET_CLOCK_H
- #define GET_CLOCK_H
-+#if defined(__sparc)
-+#include <sys/times.h>
-+#include <limits.h>
-+#include <sys/time.h>
-+typedef unsigned long long cycles_t;
- 
--#if defined (__x86_64__) || defined(__i386__)
-+static inline cycles_t get_cycles()
-+{
-+        return (gethrtime());
-+}
-+
-+#elif defined (__x86_64__) || defined(__i386__)
- /* Note: only x86 CPUs which have rdtsc instruction are supported. */
- typedef unsigned long long cycles_t;
- static inline cycles_t get_cycles()
-diff -r -u /tmp/perftest-1.3.0/rdma_bw.c perftest-1.3.0/rdma_bw.c
---- /tmp/perftest-1.3.0/rdma_bw.c	Wed Apr  7 09:44:56 2010
-+++ perftest-1.3.0/rdma_bw.c	Fri Feb 11 04:12:46 2011
-@@ -50,8 +50,11 @@
- #include <malloc.h>
- #include <getopt.h>
- #include <arpa/inet.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <time.h>
-+#include <inttypes.h>
- 
- #include <infiniband/verbs.h>
- #include <rdma/rdma_cma.h>
-@@ -142,9 +145,9 @@
- 
- 	n = getaddrinfo(data->servername, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%d:%s: %s for %s:%d\n", 
--				pid, __func__, gai_strerror(n),
-+				(int)pid, __func__, gai_strerror(n),
- 				data->servername, data->port);
- 		goto err4;
- 	}
-@@ -157,7 +160,7 @@
- 		if (rdma_resolve_addr(data->cm_id, NULL,
- 					 (struct sockaddr *)&sin, 2000)) {
- 			fprintf(stderr, "%d:%s: rdma_resolve_addr failed\n",
--					 pid, __func__ );
-+					 (int)pid, __func__ );
- 			goto err2;
- 		}
- 	
-@@ -172,7 +175,7 @@
- 
- 		if (event->event != RDMA_CM_EVENT_ADDR_RESOLVED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		rdma_ack_cm_event(event);
-@@ -180,7 +183,7 @@
- retry_route:
- 		if (rdma_resolve_route(data->cm_id, 2000)) {
- 			fprintf(stderr, "%d:%s: rdma_resolve_route failed\n", 
--						pid, __func__);
-+						(int)pid, __func__);
- 			goto err2;
- 		}
- 	
-@@ -195,7 +198,7 @@
- 
- 		if (event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
--					pid, __func__, event->event);
-+					(int)pid, __func__, event->event);
- 			rdma_ack_cm_event(event);
- 			goto err1;
- 		}
-@@ -202,7 +205,7 @@
- 		rdma_ack_cm_event(event);
- 		ctx = pp_init_ctx(data->cm_id, data);
- 		if (!ctx) {
--			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", (int)pid, __func__);
- 			goto err2;
- 		}
- 		data->my_dest.psn = lrand48() & 0xffffff;
-@@ -218,7 +221,7 @@
- 		conn_param.private_data_len = sizeof(data->my_dest);
- 
- 		if (rdma_connect(data->cm_id, &conn_param)) {
--			fprintf(stderr, "%d:%s: rdma_connect failure\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_connect failure\n", (int)pid, __func__);
- 			goto err2;
- 		}
- 	
-@@ -227,13 +230,13 @@
- 	
- 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
-- 					pid, __func__, event->event);
-+ 					(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		if (!event->param.conn.private_data || 
- 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
- 			fprintf(stderr, "%d:%s: bad private data ptr %p len %d\n",  
--				pid, __func__, event->param.conn.private_data, 
-+				(int)pid, __func__, event->param.conn.private_data, 
- 				event->param.conn.private_data_len);
- 			goto err1;
- 		}
-@@ -257,7 +260,7 @@
- 		}
- 		if (sockfd < 0) {
- 			fprintf(stderr, "%d:%s: Couldn't connect to %s:%d\n", 
--				 pid, __func__, data->servername, data->port);
-+				 (int)pid, __func__, data->servername, data->port);
- 			goto err3;
- 		}
- 		ctx = pp_init_ctx(data->ib_dev, data);
-@@ -287,13 +290,13 @@
- 	int parsed;
- 	
- 	if (!data->use_cma) {
--		sprintf(msg, "%04x:%06x:%06x:%08x:%016Lx", data->my_dest.lid, 
-+		sprintf(msg, "%04x:%06x:%06x:%08x:%016llx", data->my_dest.lid, 
- 				data->my_dest.qpn, data->my_dest.psn,
- 				data->my_dest.rkey, data->my_dest.vaddr);
- 		if (write(data->sockfd, msg, sizeof msg) != sizeof msg) {
- 			perror("client write");
- 			fprintf(stderr, "%d:%s: Couldn't send local address\n", 
--					pid, __func__);
-+					(int)pid, __func__);
- 			goto err;
- 		}
- 	
-@@ -300,7 +303,7 @@
- 		if (read(data->sockfd, msg, sizeof msg) != sizeof msg) {
- 			perror("client read");
- 			fprintf(stderr, "%d:%s: Couldn't read remote address\n", 
--					pid, __func__);
-+					(int)pid, __func__);
- 			goto err;
- 		}
- 	
-@@ -310,13 +313,13 @@
- 		if (!data->rem_dest)
- 			goto err;
- 	
--		parsed = sscanf(msg, "%x:%x:%x:%x:%Lx", &data->rem_dest->lid,
-+		parsed = sscanf(msg, "%x:%x:%x:%x:%llx", &data->rem_dest->lid,
- 				&data->rem_dest->qpn, &data->rem_dest->psn,
- 				&data->rem_dest->rkey, &data->rem_dest->vaddr);
- 	
- 		if (parsed != 5) {
- 			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n",
--					pid, __func__, (int)sizeof msg, msg);
-+					(int)pid, __func__, (int)sizeof msg, msg);
- 			free(data->rem_dest);
- 			goto err;
- 		}
-@@ -346,8 +349,8 @@
- 	if (asprintf(&service, "%d", data->port) < 0)
- 		goto err5;
- 
--	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
--		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
-+	if ( (n = getaddrinfo(NULL, service, &hints, &res) != 0) ) {
-+		fprintf(stderr, "%d:%s: %s for port %d\n", (int)pid, __func__, 
- 					gai_strerror(n), data->port);
- 		goto err5;
- 	}
-@@ -357,12 +360,12 @@
- 		sin.sin_family = AF_INET;
- 		sin.sin_port = htons(data->port);
- 		if (rdma_bind_addr(data->cm_id, (struct sockaddr *)&sin)) {
--			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", (int)pid, __func__);
- 			goto err3;
- 		}
- 	
- 		if (rdma_listen(data->cm_id, 0)) {
--			fprintf(stderr, "%d:%s: rdma_listen failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_listen failed\n", (int)pid, __func__);
- 			goto err3;
- 		}
- 	
-@@ -371,13 +374,13 @@
- 
- 		if (event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
- 			fprintf(stderr, "%d:%s: bad event waiting for connect request %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err2;
- 		}
- 	
- 		if (!event->param.conn.private_data ||
- 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
--			fprintf(stderr, "%d:%s: bad private data len %d\n", pid,
-+			fprintf(stderr, "%d:%s: bad private data len %d\n", (int)pid,
- 				__func__, event->param.conn.private_data_len);
- 			goto err2;
- 		}
-@@ -405,18 +408,18 @@
- 		conn_param.private_data = &data->my_dest;
- 		conn_param.private_data_len = sizeof(data->my_dest);
- 		if (rdma_accept(child_cm_id, &conn_param)) {
--			fprintf(stderr, "%d:%s: rdma_accept failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_accept failed\n", (int)pid, __func__);
- 			goto err1;
- 		}	
- 		rdma_ack_cm_event(event);
- 		if (rdma_get_cm_event(data->cm_channel, &event)) {
--			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", (int)pid, __func__);
- 			rdma_destroy_id(child_cm_id);
- 			goto err3;
- 		}
- 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
- 			fprintf(stderr, "%d:%s: bad event waiting for established %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		rdma_ack_cm_event(event);	
-@@ -436,7 +439,7 @@
- 		}
- 	
- 		if (sockfd < 0) {
--			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", pid,
-+			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", (int)pid,
- 						__func__, data->port);
- 			goto err4;
- 		}
-@@ -445,7 +448,7 @@
- 		connfd = accept(sockfd, NULL, 0);
- 		if (connfd < 0) {
- 			perror("server accept");
--			fprintf(stderr, "%d:%s: accept() failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: accept() failed\n", (int)pid, __func__);
- 			close(sockfd);
- 			goto err4;
- 		}
-@@ -485,7 +488,7 @@
- 		if (n != sizeof msg) {
- 			perror("server read");
- 			fprintf(stderr, "%d:%s: %d/%d Couldn't read remote address\n", 
--						pid, __func__, n, (int) sizeof msg);
-+						(int)pid, __func__, n, (int) sizeof msg);
- 			goto err;
- 		}
- 	
-@@ -495,23 +498,23 @@
- 		if (!data->rem_dest)
- 			goto err;
- 	
--		parsed = sscanf(msg, "%x:%x:%x:%x:%Lx", &data->rem_dest->lid,
-+		parsed = sscanf(msg, "%x:%x:%x:%x:%llx", &data->rem_dest->lid,
- 			      &data->rem_dest->qpn, &data->rem_dest->psn,
- 			      &data->rem_dest->rkey, &data->rem_dest->vaddr);
- 		if (parsed != 5) {
--			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n", pid,
-+			fprintf(stderr, "%d:%s: Couldn't parse line <%.*s>\n", (int)pid,
- 						 __func__, (int)sizeof msg, msg);
- 			free(data->rem_dest);
- 			goto err;
- 		}
- 	
--		sprintf(msg, "%04x:%06x:%06x:%08x:%016Lx", data->my_dest.lid,
-+		sprintf(msg, "%04x:%06x:%06x:%08x:%016llx", data->my_dest.lid,
- 					 data->my_dest.qpn, data->my_dest.psn,
- 					 data->my_dest.rkey, data->my_dest.vaddr);
- 		if (write(data->sockfd, msg, sizeof msg) != sizeof msg) {
- 			perror("server write");
- 			fprintf(stderr, "%d:%s: Couldn't send local address\n", 
--					pid, __func__);
-+					(int)pid, __func__);
- 			free(data->rem_dest);
- 			goto err;
- 		}
-@@ -538,7 +541,7 @@
- 	ctx->buf = memalign(page_size, ctx->size * 2);
- 	if (!ctx->buf) {
- 		fprintf(stderr, "%d:%s: Couldn't allocate work buf.\n",
--					 pid, __func__);
-+					 (int)pid, __func__);
- 		return NULL;
- 	}
- 
-@@ -548,7 +551,7 @@
- 		cm_id = (struct rdma_cm_id *)ptr;
- 		ctx->context = cm_id->verbs;
- 		if (!ctx->context) {
--			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
-+			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", (int)pid, 
- 							__func__);
- 			return NULL;
- 		}
-@@ -558,7 +561,7 @@
- 		ctx->context = ibv_open_device(ib_dev);
- 		if (!ctx->context) {
- 			fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
--				pid, __func__, ibv_get_device_name(ib_dev));
-+				(int)pid, __func__, ibv_get_device_name(ib_dev));
- 			return NULL;
- 		}
- 	}
-@@ -565,7 +568,7 @@
- 
- 	ctx->pd = ibv_alloc_pd(ctx->context);
- 	if (!ctx->pd) {
--		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", (int)pid, __func__);
- 		return NULL;
- 	}
- 
-@@ -575,7 +578,7 @@
- 	ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, ctx->size * 2,
- 			     IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_LOCAL_WRITE);
- 	if (!ctx->mr) {
--		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", (int)pid, __func__);
- 		return NULL;
- 	}
- 
-@@ -582,7 +585,7 @@
- 
- 	ctx->ch = ibv_create_comp_channel(ctx->context);
- 	if (!ctx->ch) {
--		fprintf(stderr, "%d:%s: Couldn't create comp channel\n", pid,
-+		fprintf(stderr, "%d:%s: Couldn't create comp channel\n", (int)pid,
- 								 __func__);
- 		return NULL;
- 	}
-@@ -589,7 +592,7 @@
- 
- 	ctx->rcq = ibv_create_cq(ctx->context, 1, NULL, NULL, 0);
- 	if (!ctx->rcq) {
--		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", pid,
-+		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", (int)pid,
- 								 __func__);
- 		return NULL;
- 	}
-@@ -596,7 +599,7 @@
- 
- 	ctx->scq = ibv_create_cq(ctx->context, ctx->tx_depth, ctx, ctx->ch, 0);
- 	if (!ctx->scq) {
--		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", pid,
-+		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", (int)pid,
- 								 __func__);
- 		return NULL;
- 	}
-@@ -619,7 +622,7 @@
- 
- 	if (data->use_cma) {
- 		if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
--			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
- 			return NULL;
- 		}
- 		ctx->qp = cm_id->qp;
-@@ -628,7 +631,7 @@
- 	} else {
- 		ctx->qp = ibv_create_qp(ctx->pd, &attr);
- 		if (!ctx->qp)  {
--			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
- 			return NULL;
- 		}
- 		{
-@@ -645,7 +648,7 @@
- 					IBV_QP_PORT               |
- 					IBV_QP_ACCESS_FLAGS)) {
- 				fprintf(stderr, "%d:%s: Failed to modify QP to INIT\n", 
--						pid, __func__);
-+						(int)pid, __func__);
- 				return NULL;
- 			}
- 		}
-@@ -679,7 +682,7 @@
- 			  IBV_QP_RQ_PSN             |
- 			  IBV_QP_MAX_DEST_RD_ATOMIC |
- 			  IBV_QP_MIN_RNR_TIMER)) {
--		fprintf(stderr, "%d:%s: Failed to modify QP to RTR\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Failed to modify QP to RTR\n", (int)pid, __func__);
- 		return 1;
- 	}
- 
-@@ -696,7 +699,7 @@
- 			  IBV_QP_RNR_RETRY          |
- 			  IBV_QP_SQ_PSN             |
- 			  IBV_QP_MAX_QP_RD_ATOMIC)) {
--		fprintf(stderr, "%d:%s: Failed to modify QP to RTS\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Failed to modify QP to RTS\n", (int)pid, __func__);
- 		return 1;
- 	}
- 
-@@ -720,7 +723,7 @@
-         rc = ibv_post_recv(ctx->qp, &wr, &bad_wr);
-         if (rc) {
-                 perror("ibv_post_recv");
--                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", pid,
-+                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", (int)pid,
- 				 __func__, rc);
-         }
- }
-@@ -736,13 +739,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (!(wc.opcode & IBV_WC_RECV))
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xdeadbeef) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- }
- 
-@@ -762,7 +765,7 @@
- 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
- 	ctx->wr.next       = NULL;
- 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
--		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
- 		return;
- 	}
- 	do {
-@@ -771,13 +774,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 						wc.status);
- 	if (wc.opcode != IBV_WC_SEND)
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__, 
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__, 
- 						wc.opcode);
- 	if (wc.wr_id != 0xcafebabe) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 						(int)wc.wr_id);
- }
- 
-@@ -792,13 +795,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (!(wc.opcode & IBV_WC_RECV))
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xdeadbeef) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- 	pp_post_recv(ctx);
- }
-@@ -819,7 +822,7 @@
- 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
- 	ctx->wr.next       = NULL;
- 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
--		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
- 		return;
- 	}
- 	do {
-@@ -828,13 +831,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (wc.opcode != IBV_WC_SEND)
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xabbaabba) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- }
- 
-@@ -847,7 +850,7 @@
-                 rc = rdma_disconnect(data.cm_id);
-                 if (rc) {
- 			perror("rdma_disconnect");
--			fprintf(stderr, "%d:%s: rdma disconnect error\n", pid,
-+			fprintf(stderr, "%d:%s: rdma disconnect error\n", (int)pid,
- 								 __func__);
- 			return;
-                 }
-@@ -856,7 +859,7 @@
-         rdma_get_cm_event(data.cm_channel, &event);
-         if (event->event != RDMA_CM_EVENT_DISCONNECTED)
-                 fprintf(stderr, "%d:%s: unexpected event during disconnect %d\n", 
--			pid, __func__, event->event);
-+			(int)pid, __func__, event->event);
-         rdma_ack_cm_event(event);
-         rdma_destroy_id(data.cm_id);
-         rdma_destroy_event_channel(data.cm_channel);
-@@ -904,22 +907,26 @@
- 			}
- 		}
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	cycles_to_units = get_cpu_mhz(0) * 1000000;
-+#else
-+	cycles_to_units = 1000000000;
-+#endif
- 
- 	tsize = duplex ? 2 : 1;
- 	tsize = tsize * size;
- 
--	printf("\n%d: Bandwidth peak (#%d to #%d): %g MB/sec\n", pid, 
-+	printf("\n%d: Bandwidth peak (#%d to #%d): %g MB/sec\n", (int)pid, 
- 			 opt_posted, opt_completed,
- 			 tsize * cycles_to_units / opt_delta / 0x100000);
--	printf("%d: Bandwidth average: %g MB/sec\n", pid, 
-+	printf("%d: Bandwidth average: %g MB/sec\n", (int)pid, 
- 			 tsize * iters * cycles_to_units /
- 			 (tcompleted[iters - 1] - tposted[0]) / 0x100000);
- 
--	printf("%d: Service Demand peak (#%d to #%d): %ld cycles/KB\n", pid, 
-+	printf("%d: Service Demand peak (#%d to #%d): %ld cycles/KB\n", (int)pid, 
- 			 opt_posted, opt_completed,
- 			 (unsigned long)opt_delta * 1024 / tsize);
--	printf("%d: Service Demand Avg  : %ld cycles/KB\n", pid, 
-+	printf("%d: Service Demand Avg  : %ld cycles/KB\n", (int)pid, 
- 			 (unsigned long)(tcompleted[iters - 1] - tposted[0]) *
- 			 1024 / (tsize * iters));	
- }
-@@ -1046,7 +1053,7 @@
- 	pid = getpid();
- 
- 	printf("%d: | port=%d | ib_port=%d | size=%d | tx_depth=%d | sl=%d | iters=%d | duplex=%d | cma=%d |\n",
--		 pid, data.port, data.ib_port, data.size, data.tx_depth,
-+		 (int)pid, data.port, data.ib_port, data.size, data.tx_depth,
- 		 sl, iters, duplex, data.use_cma);
- 		
- 	/* Done with parameter parsing. Perform setup. */
-@@ -1059,12 +1066,12 @@
- 		data.cm_channel = rdma_create_event_channel();
- 		if (!data.cm_channel) {
- 			fprintf(stderr, "%d:%s: rdma_create_event_channel failed\n",
--							 pid, __func__);
-+							 (int)pid, __func__);
- 			return 1;
- 		}
- 		if (rdma_create_id(data.cm_channel, &data.cm_id, NULL, RDMA_PS_TCP)) {
- 			fprintf(stderr, "%d:%s: rdma_create_id failed\n",
--							 pid, __func__);
-+							 (int)pid, __func__);
- 			return 1;
- 		}
- 	
-@@ -1079,12 +1086,17 @@
- 		}
- 	} else {
- 		dev_list = ibv_get_device_list(NULL);
-+		if (!dev_list) {
-+			fprintf(stderr, "%d:%s: No IB devices found\n",
-+			     (int)pid, __func__);
-+			return 1;
-+		}
- 	
- 		if (!ib_devname) {
- 			data.ib_dev = dev_list[0];
- 			if (!data.ib_dev) {
- 				fprintf(stderr, "%d:%s: No IB devices found\n",
--							 pid, __func__);
-+							 (int)pid, __func__);
- 				return 1;
- 			}
- 		} else {
-@@ -1093,7 +1105,7 @@
- 					break;
- 			if (!data.ib_dev) {
- 				fprintf(stderr, "%d:%s: IB device %s not found\n",
--						 pid, __func__, ib_devname);
-+						 (int)pid, __func__, ib_devname);
- 				return 1;
- 			}
- 		}
-@@ -1109,7 +1121,7 @@
- 		data.my_dest.lid = pp_get_local_lid(ctx, data.ib_port);
- 		if (!data.my_dest.lid) {
- 			fprintf(stderr, "%d:%s: Local lid 0x0 detected. Is an SM running?\n",
--						pid, __func__);
-+						(int)pid, __func__);
- 			return 1;
- 		}
- 		data.my_dest.qpn = ctx->qp->qp_num;
-@@ -1129,12 +1141,12 @@
- 	}
- 
- 	printf("%d: Local address:  LID %#04x, QPN %#06x, PSN %#06x "
--			"RKey %#08x VAddr %#016Lx\n", pid, 
-+			"RKey %#08x VAddr %#016llx\n", (int)pid, 
- 			data.my_dest.lid, data.my_dest.qpn, data.my_dest.psn,
- 			data.my_dest.rkey, data.my_dest.vaddr);	
- 
- 	printf("%d: Remote address: LID %#04x, QPN %#06x, PSN %#06x, "
--			"RKey %#08x VAddr %#016Lx\n\n", pid, 
-+			"RKey %#08x VAddr %#016llx\n\n", (int)pid, 
- 			data.rem_dest->lid, data.rem_dest->qpn, data.rem_dest->psn,
- 			data.rem_dest->rkey, data.rem_dest->vaddr);
- 
-@@ -1219,7 +1231,7 @@
- 
- 			if (ibv_post_send(qp, &ctx->wr, &bad_wr)) {
- 				fprintf(stderr, "%d:%s: Couldn't post send: scnt=%d\n",
--					pid, __func__, scnt);
-+					(int)pid, __func__, scnt);
- 				return 1;
- 			}
- 			++scnt;
-@@ -1235,17 +1247,17 @@
- 			tcompleted[ccnt] = get_cycles();
- 
- 			if (ne < 0) {
--				fprintf(stderr, "%d:%s: poll CQ failed %d\n", pid, 
-+				fprintf(stderr, "%d:%s: poll CQ failed %d\n", (int)pid, 
- 					__func__, ne);
- 				return 1;
- 			}
- 			if (wc.status != IBV_WC_SUCCESS) {
- 				fprintf(stderr, "%d:%s: Completion with error at %s:\n",
--					pid, __func__, data.servername ? "client" : "server");
-+					(int)pid, __func__, data.servername ? "client" : "server");
- 				fprintf(stderr, "%d:%s: Failed status %d: wr_id %d\n",
--					pid, __func__, wc.status, (int) wc.wr_id);
-+					(int)pid, __func__, wc.status, (int) wc.wr_id);
- 				fprintf(stderr, "%d:%s: scnt=%d, ccnt=%d\n",
--					pid, __func__, scnt, ccnt);
-+					(int)pid, __func__, scnt, ccnt);
- 				return 1;
- 			}
- 			ccnt += 1;
-@@ -1265,7 +1277,7 @@
- 		
- 		write(data.sockfd, "done", sizeof "done");
- 		close(data.sockfd);
--		
-+
- 	}
- 	
- 	print_report(iters, data.size, duplex, tposted, tcompleted);
-diff -r -u /tmp/perftest-1.3.0/rdma_lat.c perftest-1.3.0/rdma_lat.c
---- /tmp/perftest-1.3.0/rdma_lat.c	Wed Apr  7 09:44:33 2010
-+++ perftest-1.3.0/rdma_lat.c	Fri Feb 11 04:12:46 2011
-@@ -50,8 +50,11 @@
- #include <malloc.h>
- #include <getopt.h>
- #include <arpa/inet.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <time.h>
-+#include <inttypes.h>
- 
- #include <infiniband/verbs.h>
- #include <rdma/rdma_cma.h>
-@@ -138,6 +141,11 @@
- 	struct ibv_device *ib_dev = NULL;
- 
- 	dev_list = ibv_get_device_list(NULL);
-+	if (!dev_list) {
-+		fprintf(stderr, "%d:%s: No IB devices found\n",
-+		     (int)pid, __func__);
-+		return NULL;
-+	}
- 
- 	if (!ib_devname) {
- 		ib_dev = dev_list[0];
-@@ -155,7 +163,8 @@
- }
- 
- #define KEY_MSG_SIZE (sizeof "0000:000000:000000:00000000:0000000000000000")
--#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016Lx"
-+#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016" "llx"
-+#define KEY_SCAN_FMT "%04x:%06x:%06x:%08x:%016" "llx"
- 
- static int pp_write_keys(int sockfd, const struct pingpong_dest *my_dest)
- {
-@@ -185,7 +194,7 @@
- 		return -1;
- 	}
- 
--	parsed = sscanf(msg, KEY_PRINT_FMT, &rem_dest->lid, &rem_dest->qpn,
-+	parsed = sscanf(msg, KEY_SCAN_FMT, &rem_dest->lid, &rem_dest->qpn,
- 			&rem_dest->psn, &rem_dest->rkey, &rem_dest->vaddr);
- 
- 	if (parsed != 5) {
-@@ -218,9 +227,9 @@
- 
- 	n = getaddrinfo(data->servername, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%d:%s: %s for %s:%d\n", 
--				pid, __func__, gai_strerror(n),
-+				(int)pid, __func__, gai_strerror(n),
- 				data->servername, data->port);
- 		goto err4;
- 	}
-@@ -233,7 +242,7 @@
- 		if (rdma_resolve_addr(data->cm_id, NULL,
- 					 (struct sockaddr *)&sin, 2000)) {
- 			fprintf(stderr, "%d:%s: rdma_resolve_addr failed\n",
--					 pid, __func__ );
-+					 (int)pid, __func__ );
- 			goto err2;
- 		}
- 	
-@@ -248,7 +257,7 @@
- 
- 		if (event->event != RDMA_CM_EVENT_ADDR_RESOLVED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		rdma_ack_cm_event(event);
-@@ -256,7 +265,7 @@
- retry_route:
- 		if (rdma_resolve_route(data->cm_id, 2000)) {
- 			fprintf(stderr, "%d:%s: rdma_resolve_route failed\n", 
--						pid, __func__);
-+						(int)pid, __func__);
- 			goto err2;
- 		}
- 	
-@@ -271,7 +280,7 @@
- 
- 		if (event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
--					pid, __func__, event->event);
-+					(int)pid, __func__, event->event);
- 			rdma_ack_cm_event(event);
- 			goto err1;
- 		}
-@@ -278,7 +287,7 @@
- 		rdma_ack_cm_event(event);
- 		ctx = pp_init_ctx(data->cm_id, data);
- 		if (!ctx) {
--			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: pp_init_ctx failed\n", (int)pid, __func__);
- 			goto err2;
- 		}
- 		data->my_dest.psn = lrand48() & 0xffffff;
-@@ -294,7 +303,7 @@
- 		conn_param.private_data_len = sizeof(data->my_dest);
- 
- 		if (rdma_connect(data->cm_id, &conn_param)) {
--			fprintf(stderr, "%d:%s: rdma_connect failure\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_connect failure\n", (int)pid, __func__);
- 			goto err2;
- 		}
- 	
-@@ -303,13 +312,13 @@
- 	
- 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
- 			fprintf(stderr, "%d:%s: unexpected CM event %d\n", 
-- 					pid, __func__, event->event);
-+ 					(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		if (!event->param.conn.private_data || 
- 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
- 			fprintf(stderr, "%d:%s: bad private data ptr %p len %d\n",  
--				pid, __func__, event->param.conn.private_data, 
-+				(int)pid, __func__, event->param.conn.private_data, 
- 				event->param.conn.private_data_len);
- 			goto err1;
- 		}
-@@ -332,7 +341,7 @@
- 		}
- 		if (sockfd < 0) {
- 			fprintf(stderr, "%d:%s: Couldn't connect to %s:%d\n", 
--				 pid, __func__, data->servername, data->port);
-+				 (int)pid, __func__, data->servername, data->port);
- 			goto err3;
- 		}
- 		ctx = pp_init_ctx(data->ib_dev, data);
-@@ -392,8 +401,8 @@
- 	if (asprintf(&service, "%d", data->port) < 0)
- 		goto err5;
- 
--	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
--		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
-+	if ( (n = getaddrinfo(NULL, service, &hints, &res) != 0) ) {
-+		fprintf(stderr, "%d:%s: %s for port %d\n", (int)pid, __func__, 
- 					gai_strerror(n), data->port);
- 		goto err5;
- 	}
-@@ -403,12 +412,12 @@
- 		sin.sin_family = AF_INET;
- 		sin.sin_port = htons(data->port);
- 		if (rdma_bind_addr(data->cm_id, (struct sockaddr *)&sin)) {
--			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_bind_addr failed\n", (int)pid, __func__);
- 			goto err3;
- 		}
- 	
- 		if (rdma_listen(data->cm_id, 0)) {
--			fprintf(stderr, "%d:%s: rdma_listen failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_listen failed\n", (int)pid, __func__);
- 			goto err3;
- 		}
- 	
-@@ -417,13 +426,13 @@
- 
- 		if (event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
- 			fprintf(stderr, "%d:%s: bad event waiting for connect request %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err2;
- 		}
- 	
- 		if (!event->param.conn.private_data ||
- 		    (event->param.conn.private_data_len < sizeof(*data->rem_dest))) {
--			fprintf(stderr, "%d:%s: bad private data len %d\n", pid,
-+			fprintf(stderr, "%d:%s: bad private data len %d\n", (int)pid,
- 				__func__, event->param.conn.private_data_len);
- 			goto err2;
- 		}
-@@ -451,18 +460,18 @@
- 		conn_param.private_data = &data->my_dest;
- 		conn_param.private_data_len = sizeof(data->my_dest);
- 		if (rdma_accept(child_cm_id, &conn_param)) {
--			fprintf(stderr, "%d:%s: rdma_accept failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_accept failed\n", (int)pid, __func__);
- 			goto err1;
- 		}	
- 		rdma_ack_cm_event(event);
- 		if (rdma_get_cm_event(data->cm_channel, &event)) {
--			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: rdma_get_cm_event error\n", (int)pid, __func__);
- 			rdma_destroy_id(child_cm_id);
- 			goto err3;
- 		}
- 		if (event->event != RDMA_CM_EVENT_ESTABLISHED) {
- 			fprintf(stderr, "%d:%s: bad event waiting for established %d\n", 
--				pid, __func__, event->event);
-+				(int)pid, __func__, event->event);
- 			goto err1;
- 		}
- 		rdma_ack_cm_event(event);	
-@@ -482,7 +491,7 @@
- 		}
- 	
- 		if (sockfd < 0) {
--			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", pid,
-+			fprintf(stderr, "%d:%s: Couldn't listen to port %d\n", (int)pid,
- 						__func__, data->port);
- 			goto err4;
- 		}
-@@ -491,7 +500,7 @@
- 		connfd = accept(sockfd, NULL, 0);
- 		if (connfd < 0) {
- 			perror("server accept");
--			fprintf(stderr, "%d:%s: accept() failed\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: accept() failed\n", (int)pid, __func__);
- 			close(sockfd);
- 			goto err4;
- 		}
-@@ -551,7 +560,7 @@
- 	ctx->buf = memalign(page_size, ctx->size * 2);
- 	if (!ctx->buf) {
- 		fprintf(stderr, "%d:%s: Couldn't allocate work buf.\n",
--					 pid, __func__);
-+					 (int)pid, __func__);
- 		return NULL;
- 	}
- 
-@@ -565,7 +574,7 @@
- 		cm_id = (struct rdma_cm_id *)ptr;
- 		ctx->context = cm_id->verbs;
- 		if (!ctx->context) {
--			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", pid, 
-+			fprintf(stderr, "%d:%s: Unbound cm_id!!\n", (int)pid, 
- 							__func__);
- 			return NULL;
- 		}
-@@ -575,7 +584,7 @@
- 		ctx->context = ibv_open_device(ib_dev);
- 		if (!ctx->context) {
- 			fprintf(stderr, "%d:%s: Couldn't get context for %s\n", 
--				pid, __func__, ibv_get_device_name(ib_dev));
-+				(int)pid, __func__, ibv_get_device_name(ib_dev));
- 			return NULL;
- 		}
- 	}
-@@ -582,7 +591,7 @@
- 
- 	ctx->pd = ibv_alloc_pd(ctx->context);
- 	if (!ctx->pd) {
--		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Couldn't allocate PD\n", (int)pid, __func__);
- 		return NULL;
- 	}
- 
-@@ -592,13 +601,13 @@
- 	ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, ctx->size * 2,
- 			     IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_LOCAL_WRITE);
- 	if (!ctx->mr) {
--		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: Couldn't allocate MR\n", (int)pid, __func__);
- 		return NULL;
- 	}
- 
- 	ctx->rcq = ibv_create_cq(ctx->context, 1, NULL, NULL, 0);
- 	if (!ctx->rcq) {
--		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", pid,
-+		fprintf(stderr, "%d:%s: Couldn't create recv CQ\n", (int)pid,
- 								 __func__);
- 		return NULL;
- 	}
-@@ -605,7 +614,7 @@
- 
- 	ctx->scq = ibv_create_cq(ctx->context, ctx->tx_depth, ctx, NULL, 0);
- 	if (!ctx->scq) {
--		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", pid,
-+		fprintf(stderr, "%d:%s: Couldn't create send CQ\n", (int)pid,
- 								 __func__);
- 		return NULL;
- 	}
-@@ -628,7 +637,7 @@
- 
- 	if (data->use_cma) {
- 		if (rdma_create_qp(cm_id, ctx->pd, &attr)) {
--			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
- 			return NULL;
- 		}
- 		ctx->qp = cm_id->qp;
-@@ -636,7 +645,7 @@
- 	} else {
- 		ctx->qp = ibv_create_qp(ctx->pd, &attr);
- 		if (!ctx->qp)  {
--			fprintf(stderr, "%d:%s: Couldn't create QP\n", pid, __func__);
-+			fprintf(stderr, "%d:%s: Couldn't create QP\n", (int)pid, __func__);
- 			return NULL;
- 		}
- 		{
-@@ -653,7 +662,7 @@
- 					IBV_QP_PORT               |
- 					IBV_QP_ACCESS_FLAGS)) {
- 				fprintf(stderr, "%d:%s: Failed to modify QP to INIT\n", 
--						pid, __func__);
-+						(int)pid, __func__);
- 				return NULL;
- 			}
- 		}
-@@ -710,10 +719,10 @@
- 	return 0;
- }
- 
-+#define ADDR_FMT "%8s address: LID %#04x QPN %#06x PSN %#06x RKey %#08x VAddr %#016" "llx" "\n"
-+
- static int pp_open_port(struct pingpong_context *ctx, struct pp_data *data )
- {
--	char addr_fmt[] = "%8s address: LID %#04x QPN %#06x PSN %#06x RKey %#08x VAddr %#016Lx\n";
--
- 	/* Create connection between client and server.
- 	 * We do it by exchanging data over a TCP socket connection. */
- 
-@@ -727,7 +736,7 @@
- 	data->my_dest.rkey = ctx->mr->rkey;
- 	data->my_dest.vaddr = (uintptr_t)ctx->buf + ctx->size;
- 
--	printf(addr_fmt, "local", data->my_dest.lid, data->my_dest.qpn, data->my_dest.psn,
-+	printf(ADDR_FMT, "local", data->my_dest.lid, data->my_dest.qpn, data->my_dest.psn,
- 			data->my_dest.rkey, data->my_dest.vaddr);
- 
- 	if (data->servername) {
-@@ -738,7 +747,7 @@
- 			return 1;
- 	}
- 
--	printf(addr_fmt, "remote", data->rem_dest->lid, data->rem_dest->qpn,
-+	printf(ADDR_FMT, "remote", data->rem_dest->lid, data->rem_dest->qpn,
- 			data->rem_dest->psn, data->rem_dest->rkey, 
- 			data->rem_dest->vaddr);
- 
-@@ -783,7 +792,7 @@
-         rc = ibv_post_recv(ctx->qp, &wr, &bad_wr);
-         if (rc) {
-                 perror("ibv_post_recv");
--                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", pid,
-+                fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", (int)pid,
- 				 __func__, rc);
-         }
- }
-@@ -799,13 +808,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (!(wc.opcode & IBV_WC_RECV))
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xdeadbeef) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- }
- 
-@@ -825,7 +834,7 @@
- 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
- 	ctx->wr.next       = NULL;
- 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
--		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
- 		return;
- 	}
- 	do {
-@@ -834,13 +843,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 						wc.status);
- 	if (wc.opcode != IBV_WC_SEND)
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__, 
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__, 
- 						wc.opcode);
- 	if (wc.wr_id != 0xcafebabe) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 						(int)wc.wr_id);
- }
- 
-@@ -855,13 +864,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (!(wc.opcode & IBV_WC_RECV))
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xdeadbeef) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- 	pp_post_recv(ctx);
- }
-@@ -882,7 +891,7 @@
- 	ctx->wr.send_flags = IBV_SEND_SIGNALED;
- 	ctx->wr.next       = NULL;
- 	if (ibv_post_send(ctx->qp, &ctx->wr, &bad_wr)) {
--		fprintf(stderr, "%d:%s: ibv_post_send failed\n", pid, __func__);
-+		fprintf(stderr, "%d:%s: ibv_post_send failed\n", (int)pid, __func__);
- 		return;
- 	}
- 	do {
-@@ -891,13 +900,13 @@
- 	} while (ne == 0);
- 
- 	if (wc.status) 
--		fprintf(stderr, "%d:%s: bad wc status %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc status %d\n", (int)pid, __func__,
- 					 wc.status);
- 	if (wc.opcode != IBV_WC_SEND)
--		fprintf(stderr, "%d:%s: bad wc opcode %d\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc opcode %d\n", (int)pid, __func__,
- 					 wc.opcode);
- 	if (wc.wr_id != 0xabbaabba) 
--		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", pid, __func__,
-+		fprintf(stderr, "%d:%s: bad wc wr_id 0x%x\n", (int)pid, __func__,
- 					 (int)wc.wr_id);
- }
- 
-@@ -910,7 +919,7 @@
-                 rc = rdma_disconnect(data.cm_id);
-                 if (rc) {
- 			perror("rdma_disconnect");
--			fprintf(stderr, "%d:%s: rdma disconnect error\n", pid,
-+			fprintf(stderr, "%d:%s: rdma disconnect error\n", (int)pid,
- 								 __func__);
- 			return;
-                 }
-@@ -919,7 +928,7 @@
-         rdma_get_cm_event(data.cm_channel, &event);
-         if (event->event != RDMA_CM_EVENT_DISCONNECTED)
-                 fprintf(stderr, "%d:%s: unexpected event during disconnect %d\n", 
--			pid, __func__, event->event);
-+			(int)pid, __func__, event->event);
-         rdma_ack_cm_event(event);
-         rdma_destroy_id(data.cm_id);
-         rdma_destroy_event_channel(data.cm_channel);
-@@ -989,10 +998,18 @@
- 
- 
- 	if (options->cycles) {
-+#if !(defined(__SVR4) && defined(__sun))
- 		cycles_to_units = 1;
-+#else
-+		cycles_to_units = (1/get_cpu_mhz(0)) * 1000;
-+#endif
- 		units = "cycles";
- 	} else {
-+#if !(defined(__SVR4) && defined(__sun))
- 		cycles_to_units = get_cpu_mhz(0);
-+#else
-+		cycles_to_units = 1000;
-+#endif
- 		units = "usec";
- 	}
- 
-@@ -1164,12 +1181,12 @@
- 		data.cm_channel = rdma_create_event_channel();
- 		if (!data.cm_channel) {
- 			fprintf(stderr, "%d:%s: rdma_create_event_channel failed\n",
--							 pid, __func__);
-+							 (int)pid, __func__);
- 			return 1;
- 		}
- 		if (rdma_create_id(data.cm_channel, &data.cm_id, NULL, RDMA_PS_TCP)) {
- 			fprintf(stderr, "%d:%s: rdma_create_id failed\n",
--							 pid, __func__);
-+							 (int)pid, __func__);
- 			return 1;
- 		}
- 	
-@@ -1184,12 +1201,12 @@
- 		}
- 
- 		printf("%d: Local address:  LID %#04x, QPN %#06x, PSN %#06x "
--                        "RKey %#08x VAddr %#016Lx\n", pid,
-+                        "RKey %#08x VAddr %#016llx\n", (int)pid,
-                         data.my_dest.lid, data.my_dest.qpn, data.my_dest.psn,
-                         data.my_dest.rkey, data.my_dest.vaddr);
- 
-         	printf("%d: Remote address: LID %#04x, QPN %#06x, PSN %#06x, "
--                        "RKey %#08x VAddr %#016Lx\n\n", pid,
-+                        "RKey %#08x VAddr %#016llx\n\n", (int)pid,
-                         data.rem_dest->lid, data.rem_dest->qpn, data.rem_dest->psn,
-                         data.rem_dest->rkey, data.rem_dest->vaddr);
- 
-diff -r -u /tmp/perftest-1.3.0/multicast_resources.h perftest-1.3.0/multicast_resources.h
---- /tmp/perftest-1.3.0/multicast_resources.h	Wed Mar  2 11:01:36 2011
-+++ perftest-1.3.0/multicast_resources.h	Fri Aug 26 05:14:56 2011
-@@ -68,7 +68,7 @@
- #define DEF_PKEY_IDX        		0
- #define DEF_SLL              		0
- #define MAX_POLL_ITERATION_TIMEOUT  1000000
--#define MCG_GID {255,1,0,0,0,2,201,133,0,0,0,0,0,0,0,0}
-+#define MCG_GID {255,21,0,0,0,2,201,133,0,0,0,0,0,0,0,0}
- 
- //  Definitions section for MADs 
- #define SUBN_ADM_ATTR_MC_MEMBER_RECORD 0x38
-@@ -80,10 +80,11 @@
- #define DEF_TCLASS                     0
- #define DEF_FLOW_LABLE                 0
- 
-+#if !(defined(__SVR4) && defined(__sun))
- // Macro for 64 bit variables to switch to from net 
- #define ntohll(x) (((u_int64_t)(ntohl((int)((x << 32) >> 32))) << 32) | (unsigned int)ntohl(((int)(x >> 32)))) 
- #define htonll(x) ntohll(x)
--
-+#endif
- // generate a bit mask S bits width 
- #define MASK32(S)  ( ((u_int32_t) ~0L) >> (32-(S)) )
- 
-diff -r -u /tmp/perftest-1.3.0/perftest_resources.c perftest-1.3.0/perftest_resources.c
---- /tmp/perftest-1.3.0/perftest_resources.c	Tue Jan 25 23:31:57 2011
-+++ perftest-1.3.0/perftest_resources.c	Fri Feb 11 04:12:48 2011
-@@ -11,7 +11,9 @@
- #include <sys/socket.h>
- #include <netdb.h>
- #include <math.h>
-+#if !(defined(__SVR4) && defined(__sun))
- // #include <byteswap.h>
-+#endif
- #include "perftest_resources.h"
- 
- 
-@@ -566,8 +568,22 @@
- 
- 	// User did not ask for specific mtu.
- 	if (params->mtu == 0) {
-+#if !(defined(__SVR4) && defined(__sun))
- 		params->curr_mtu = port_attr.active_mtu;
-+#else
-+		struct ibv_device_attr device_attr;
- 
-+		if (ibv_query_device(context, &device_attr)) {
-+                        fprintf(stderr, "Failed to query device props");
-+                        return -1;
-+                }
-+
-+		if (device_attr.vendor_part_id == 23108) {
-+			params->curr_mtu = IBV_MTU_1024;
-+		} else {
-+			params->curr_mtu = IBV_MTU_2048;
-+		}
-+#endif
- 	} else {
- 
- 		switch (params->mtu) {
-@@ -791,7 +807,7 @@
- 
- 	n = getaddrinfo(servername, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port);
- 		return n;
- 	}
-@@ -835,7 +851,7 @@
- 
- 	n = getaddrinfo(NULL, service, &hints, &res);
- 
--	if (n < 0) {
-+	if (n != 0) {
- 		fprintf(stderr, "%s for port %d\n", gai_strerror(n), port);
- 		return n;
- 	}
-@@ -869,7 +885,6 @@
- 		close(sockfd);
- 		return connfd;
- 	}
--
- 	close(sockfd);
- 	return connfd;
- }
-@@ -882,6 +897,8 @@
- 				   struct pingpong_dest *my_dest,
- 				   struct pingpong_dest *rem_dest) {
- 
-+    int	temp_reads = 0;
-+
-     // Client.
-     if (params->machine == CLIENT) {
- 		if (ctx_write_keys(my_dest,params)) {
-@@ -904,6 +921,21 @@
- 			return -1;
- 		}
-     }
-+
-+    /*
-+     * If we have different HCA's at either end of the connection with
-+     * different RDMA attributes, then to avoid a modify QP error set
-+     * max_rd_atomic to lowest on either side of connection.
-+     */
-+    if (rem_dest->out_reads > my_dest->out_reads)
-+	temp_reads =  my_dest->out_reads;
-+
-+    if (my_dest->out_reads > rem_dest->out_reads)
-+	my_dest->out_reads = rem_dest->out_reads;
-+
-+    if (temp_reads)
-+	rem_dest->out_reads = temp_reads;
-+
-     return 0;
- }
- 
-diff -r -u /tmp/perftest-1.3.0/perftest_resources.h perftest-1.3.0/perftest_resources.h
---- /tmp/perftest-1.3.0/perftest_resources.h	Tue Jan 25 23:31:57 2011
-+++ perftest-1.3.0/perftest_resources.h	Fri Feb 11 04:12:48 2011
-@@ -128,10 +128,10 @@
- #define KEY_MSG_SIZE_GID    98 // Message size with gid (MGID as well).
- 
- // The Format of the message we pass through sockets , without passing Gid.
--#define KEY_PRINT_FMT "%04x:%04x:%06x:%06x:%08x:%016Lx"
-+#define KEY_PRINT_FMT "%04x:%04x:%06x:%06x:%08x:%016llx"
- 
- // The Format of the message we pass through sockets (With Gid).
--#define KEY_PRINT_FMT_GID "%04x:%04x:%06x:%06x:%08x:%016Lx:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
-+#define KEY_PRINT_FMT_GID "%04x:%04x:%06x:%06x:%08x:%016llx:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
- 
- // The Basic print format for all verbs.
- #define BASIC_ADDR_FMT " %s address: LID %#04x QPN %#06x PSN %#06x"
-@@ -140,7 +140,7 @@
- #define READ_FMT       " OUT %#04x"
- 
- // The print format of the pingpong_dest element for RDMA verbs.
--#define RDMA_FMT       " RKey %#08x VAddr %#016Lx"
-+#define RDMA_FMT       " RKey %#08x VAddr %#016llx"
- 
- // The print format of a global address or a multicast address.
- #define GID_FMT " %s: %02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d\n"
-@@ -154,10 +154,10 @@
- #define RESULT_FMT_LAT " #bytes #iterations    t_min[usec]    t_max[usec]  t_typical[usec]\n"
- 
- // Result print format
--#define REPORT_FMT     " %-7lu   %d           %-7.2f            %-7.2f\n"
-+#define REPORT_FMT     " %-7"PRIu64"   %d           %-7.2f            %-7.2f\n"
- 
- // Result print format for latency tests.
--#define REPORT_FMT_LAT " %-7lu %d          %-7.2f        %-7.2f      %-7.2f\n"
-+#define REPORT_FMT_LAT " %-7"PRIu64" %d          %-7.2f        %-7.2f      %-7.2f\n"
- 
- // Macro for allocating.
- #define ALLOCATE(var,type,size)                                  \
-diff -r -u /tmp/perftest-1.3.0/read_bw.c perftest-1.3.0/read_bw.c
---- /tmp/perftest-1.3.0/read_bw.c	Tue Jan 25 23:31:57 2011
-+++ perftest-1.3.0/read_bw.c	Fri Feb 11 04:12:47 2011
-@@ -44,6 +44,7 @@
- // #include <limits.h>
- #include <malloc.h>
- // #include <getopt.h>
-+#include <inttypes.h>
- #include <time.h>
- #include <infiniband/verbs.h>
- 
-@@ -336,7 +337,11 @@
- 			}
- 	}
- 
-+#if !(defined(__sparc))
- 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
-+#else
-+	cycles_to_units = 1000000000;
-+#endif
- 	tsize = user_param->duplex ? 2 : 1;
- 	tsize = tsize * user_param->size;
- 	
-@@ -443,6 +448,7 @@
-  ******************************************************************************/
- int main(int argc, char *argv[]) {
- 
-+	int				ret = 0;
- 	int                        i = 0;
- 	struct ibv_device		   *ib_dev = NULL;
- 	struct pingpong_context    *ctx;
-@@ -553,8 +559,10 @@
- 
- 		for (i = 1; i < 24 ; ++i) {
- 			user_param.size = 1 << i;
--			if(run_iter(ctx,&user_param,&rem_dest))
--				return 17;
-+			if(run_iter(ctx,&user_param,&rem_dest)) {
-+				ret = 17;
-+				goto exit;
-+			}
- 			print_report(&user_param);
- 		}
- 
-@@ -562,11 +570,13 @@
- 
- 	else {
- 
--		if(run_iter(ctx,&user_param,&rem_dest))
--			return 17;
--		
-+		if(run_iter(ctx,&user_param,&rem_dest)) {
-+			ret = 17;
-+			goto exit;
-+		}
- 		print_report(&user_param);
- 	}
-+exit:
- 
- 	if (ctx_close_connection(&user_param,&my_dest,&rem_dest)) {
- 		fprintf(stderr,"Failed to close connection between server and client\n");
-@@ -575,6 +585,9 @@
- 	
- 	printf(RESULT_LINE);
- 
--	return destroy_ctx_resources(ctx);
-+	if (destroy_ctx_resources(ctx))
-+		return 1;
-+	else
-+		return ret; 
- 	
- }
-diff -r -u /tmp/perftest-1.3.0/read_lat.c perftest-1.3.0/read_lat.c
---- /tmp/perftest-1.3.0/read_lat.c	Tue Jan 25 23:31:57 2011
-+++ perftest-1.3.0/read_lat.c	Fri Feb 11 04:12:47 2011
-@@ -46,6 +46,7 @@
- #include <malloc.h>
- #include <getopt.h>
- #include <time.h>
-+#include <inttypes.h>
- #include <infiniband/verbs.h>
- 
- #include "get_clock.h"
-@@ -358,10 +359,19 @@
- 
- 
- 	if (user_param->r_flag->cycles) {
-+#if !(defined(__sparc))
- 		cycles_to_units = 1;
-+#else
-+		cycles_to_units =
-+		   (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
-+#endif
- 		units = "cycles";
- 	} else {
-+#if !(defined(__sparc))
- 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
-+#else
-+		cycles_to_units = 1000;
-+#endif
- 		units = "usec";
- 	}
- 
-diff -r -u /tmp/perftest-1.3.0/send_bw.c perftest-1.3.0/send_bw.c
---- /tmp/perftest-1.3.0/send_bw.c	Thu Jan 20 07:37:18 2011
-+++ perftest-1.3.0/send_bw.c	Fri Feb 11 04:12:47 2011
-@@ -320,9 +320,6 @@
- 		user_parm->size = MTU_SIZE(user_parm->curr_mtu);
- 	}
- 
--	if (is_dev_hermon(ctx->context) != NOT_HERMON && user_parm->inline_size != 0)
--		user_parm->inline_size = 0;
--
- 	printf(" Inline data is used up to %d bytes message\n", user_parm->inline_size);
- 
- 	ctx->size = user_parm->size;
-@@ -649,7 +646,11 @@
- 			}
- 	}
- 
-+#if !(defined(__sparc))
- 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
-+#else
-+	cycles_to_units = 1000000000;
-+#endif
- 
- 	tsize = user_param->duplex ? 2 : 1;
- 	tsize = tsize * user_param->size;
-diff -r -u /tmp/perftest-1.3.0/send_lat.c perftest-1.3.0/send_lat.c
---- /tmp/perftest-1.3.0/send_lat.c	Wed Mar  2 16:04:50 2011
-+++ perftest-1.3.0/send_lat.c	Fri Aug 26 05:29:53 2011
-@@ -61,7 +61,8 @@
- 	struct ibv_sge          *sge_list;
- 	struct ibv_recv_wr      *rwr;
- 	struct ibv_context      *context;
--	struct ibv_comp_channel *channel;
-+	struct ibv_comp_channel *rx_channel;
-+	struct ibv_comp_channel *tx_channel;
- 	struct ibv_pd           *pd;
- 	struct ibv_mr           *mr;
- 	struct ibv_cq           *rcq;
-@@ -259,13 +260,20 @@
- 		test_result = 1;
- 	}
- 
--	if (ctx->channel) {
--		if (ibv_destroy_comp_channel(ctx->channel)) {
--			fprintf(stderr, "failed to destroy channel \n");
-+	if (ctx->rx_channel) {
-+		if (ibv_destroy_comp_channel(ctx->rx_channel)) {
-+			fprintf(stderr, "failed to destroy rx_channel \n");
- 			test_result = 1;
- 		}
- 	}
- 	
-+	if (ctx->tx_channel) {
-+		if (ibv_destroy_comp_channel(ctx->tx_channel)) {
-+			fprintf(stderr, "failed to destroy tx_channel \n");
-+			test_result = 1;
-+		}
-+	}
-+	
- 	if (ibv_close_device(ctx->context)) {
- 		fprintf(stderr, "failed to close device context\n");
- 		test_result = 1;
-@@ -328,13 +336,20 @@
- 	memset(ctx->buf, 0,buff_size);
- 
-     if (user_parm->use_event) {
--		ctx->channel = ibv_create_comp_channel(ctx->context);
--		if (!ctx->channel) {
--			fprintf(stderr, "Couldn't create completion channel\n");
-+		ctx->rx_channel = ibv_create_comp_channel(ctx->context);
-+		if (!ctx->rx_channel) {
-+			fprintf(stderr, "Couldn't create completion rx_channel\n");
- 			return NULL;
- 		}
--	} else
--		ctx->channel = NULL;
-+		ctx->tx_channel = ibv_create_comp_channel(ctx->context);
-+		if (!ctx->rx_channel) {
-+			fprintf(stderr, "Couldn't create completion tx_channel\n");
-+			return NULL;
-+		}
-+	} else {
-+		ctx->rx_channel = NULL;
-+		ctx->tx_channel = NULL;
-+	}
- 
- 	ctx->pd = ibv_alloc_pd(ctx->context);
- 	if (!ctx->pd) {
-@@ -348,13 +363,13 @@
- 		return NULL;
- 	}
- 	
--	ctx->scq = ibv_create_cq(ctx->context,user_parm->tx_depth,NULL,ctx->channel,0);
-+	ctx->scq = ibv_create_cq(ctx->context,user_parm->tx_depth,NULL,ctx->tx_channel,0);
- 	if (!ctx->scq) {
- 	    fprintf(stderr, "Couldn't create CQ\n");
- 		return NULL;
- 	}
- 
--	ctx->rcq = ibv_create_cq(ctx->context,user_parm->rx_depth*user_parm->num_of_qps,NULL,ctx->channel,0);
-+	ctx->rcq = ibv_create_cq(ctx->context,user_parm->rx_depth*user_parm->num_of_qps,NULL,ctx->rx_channel,0);
- 	if (!ctx->rcq) {
- 	    fprintf(stderr, "Couldn't create CQ\n");
- 		return NULL;
-@@ -581,12 +596,20 @@
- 	for (i = 0; i < user_param->iters - 1; ++i)
- 		delta[i] = tstamp[i + 1] - tstamp[i];
- 
--
- 	if (user_param->r_flag->cycles) {
-+#if !(defined(__sparc))
- 		cycles_to_units = 1;
-+#else
-+		cycles_to_units =
-+		        (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
-+#endif
- 		units = "cycles";
- 	} else {
-+#if !(defined(__sparc))
- 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
-+#else
-+		cycles_to_units = 1000;
-+#endif
- 		units = "usec";
- 	}
- 
-@@ -649,7 +672,7 @@
- 		  
- 			// Server is polling on recieve first .
- 		    if (user_param->use_event) {
--				if (ctx_notify_events(ctx->rcq,ctx->channel)) {
-+				if (ctx_notify_events(ctx->rcq, ctx->rx_channel)) {
- 					fprintf(stderr , " Failed to notify events to CQ");
- 					return 1;
- 				}
-@@ -701,7 +724,7 @@
- 		    int s_ne;
- 
- 		    if (user_param->use_event) {
--				if (ctx_notify_events(ctx->scq,ctx->channel)) {
-+				if (ctx_notify_events(ctx->scq, ctx->tx_channel)) {
- 					fprintf(stderr , " Failed to notify events to CQ");
- 					return 1;
- 				}
-diff -r -u /tmp/perftest-1.3.0/multicast_resources.c perftest-1.3.0/multicast_resources.c
---- /tmp/perftest-1.3.0/multicast_resources.c	Thu Dec 16 08:21:05 2010
-+++ perftest-1.3.0/multicast_resources.c	Fri Feb 11 04:12:48 2011
-@@ -4,7 +4,9 @@
- #include <unistd.h>
- #include <string.h>
- #include <limits.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
-+#endif
- #include <arpa/inet.h>
- #include <sys/types.h>
- #include <sys/socket.h>
-diff -r -u /tmp/perftest-1.3.0/write_bw.c perftest-1.3.0/write_bw.c
---- /tmp/perftest-1.3.0/write_bw.c	Wed Mar  2 11:48:20 2011
-+++ perftest-1.3.0/write_bw.c	Tue Mar 15 12:04:28 2011
-@@ -45,6 +45,7 @@
- #include <limits.h>
- #include <malloc.h>
- #include <getopt.h>
-+#include <inttypes.h>
- #include <time.h>
- #include <infiniband/verbs.h>
- 
-@@ -224,9 +225,6 @@
- 		return NULL;
- 	}
- 
--	if (is_dev_hermon(ctx->context) != NOT_HERMON && user_parm->inline_size != 0)
--		user_parm->inline_size = 0;
--
- 	printf(" Inline data is used up to %d bytes message\n", user_parm->inline_size);
- 
- 	ctx->pd = ibv_alloc_pd(ctx->context);
-@@ -368,7 +366,6 @@
- 	cycles_t t;
- 	int iters = user_param->iters;
- 
--
- 	opt_delta = tcompleted[opt_posted] - tposted[opt_completed];
- 
- 	if (user_param->noPeak == OFF) {
-@@ -384,7 +381,11 @@
- 		  }
- 	}
- 	
-+#if !(defined(__sparc))
- 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
-+#else
-+	cycles_to_units = 1000000000;
-+#endif
- 
- 	tsize = user_param->duplex ? 2 : 1;
- 	tsize = tsize * user_param->size;
-diff -r -u /tmp/perftest-1.3.0/write_bw_postlist.c perftest-1.3.0/write_bw_postlist.c
---- /tmp/perftest-1.3.0/write_bw_postlist.c	Thu Mar  3 17:03:54 2011
-+++ perftest-1.3.0/write_bw_postlist.c	Tue Mar 15 11:59:53 2011
-@@ -46,6 +46,7 @@
- #include <malloc.h>
- #include <getopt.h>
- #include <time.h>
-+#include <inttypes.h>
- #include <infiniband/verbs.h>
- 
- #include "get_clock.h"
-@@ -323,7 +324,11 @@
-             }
- 	}
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
-+#else
-+	cycles_to_units = 1000000000;
-+#endif
- 
- 	tsize = user_param->duplex ? 2 : 1;
- 	tsize = tsize * user_param->size;
-diff -r -u /tmp/perftest-1.3.0/write_lat.c perftest-1.3.0/write_lat.c
---- /tmp/perftest-1.3.0/write_lat.c	Sat Feb 26 01:02:48 2011
-+++ perftest-1.3.0/write_lat.c	Tue Mar 15 12:01:35 2011
-@@ -46,6 +46,7 @@
- #include <malloc.h>
- #include <getopt.h>
- #include <time.h>
-+#include <inttypes.h>
- #include <infiniband/verbs.h>
- 
- #include "get_clock.h"
-@@ -330,10 +331,19 @@
- 
- 
- 	if (user_param->r_flag->cycles) {
-+#if !(defined(__sparc))
- 		cycles_to_units = 1;
-+#else
-+		cycles_to_units =
-+		    (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
-+#endif
- 		units = "cycles";
- 	} else {
-+#if !(defined(__sparc))
- 		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
-+#else
-+		cycles_to_units = 1000;
-+#endif
- 		units = "usec";
- 	}
- 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,63 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license qperf 0.4.9 under the OpenIB.org BSD license.
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+Copyright (c) 2002-2009 Johann George.  All rights reserved.
+Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+
+This software is available to you under a choice of one of two
+licenses. You may choose to be licensed under the terms of the GNU
+General Public License (GPL) Version 2, available from the file
+COPYING in the main directory of this source tree, or the
+OpenIB.org BSD license below:
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above
+copyright notice, this list of conditions and the following
+disclaimer.
+
+- Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials
+provided with the distribution.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions:
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization from 
+the X Consortium.
+
+FSF changes to this file are in the public domain.
--- a/components/open-fabrics/qperf/Makefile	Fri Apr 01 14:27:59 2016 -0700
+++ b/components/open-fabrics/qperf/Makefile	Fri Apr 01 15:20:17 2016 -0700
@@ -26,16 +26,17 @@
 include ../ofed-component-macros.mk
 
 COMPONENT_NAME=		qperf
-COMPONENT_VERSION=	0.4.6
-COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.1.gb81434e.tar.gz
+COMPONENT_VERSION=	0.4.9
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:304b89d1b006c959cad3b132346a6d061526fe626953ef99c764df396e43f959
+	sha256:2300e75edffe95d4dfbe576eb5c2f0d0da3142b5e4a96fcd01b535d50a48f07c
 COMPONENT_BUGDB=	utility/ofuv_tools
 
 include ../ofed-component.mk
 
 LIBS += -lkstat -lrdmacm -libverbs
 
+LDFLAGS += -L$(PROTOUSRLIBDIR64)
+
 COMPONENT_INSTALL_ENV +=	INSTALL="$(INSTALL) -m 755"
 
 COMPONENT_PRE_CONFIGURE_ACTION = \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf/patches/001-qperf-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,656 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  6728b98439b2997b8420c1b74055a7a118b2d9af
+qperf solaris specific changes.
+
+diff -r 6728b98439b2 src/qperf.c
+--- a/src/qperf.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/qperf.c	Fri Nov 13 07:33:20 2015 -0800
+@@ -53,6 +53,16 @@
+ #include <sys/utsname.h>
+ #include "qperf.h"
+ 
++#if (defined(__SVR4) && defined(__sun))
++#include <sys/filio.h>
++#include <limits.h>	/* times() */
++#include <sys/types.h>
++#include <sys/processor.h>
++#include <sys/procset.h>
++#include <strings.h>
++#include <infiniband/ofa_solaris.h>
++
++#endif
+ 
+ /*
+  * Configurable parameters.  If your change makes this version of qperf
+@@ -165,6 +175,10 @@
+     char        qperf[STRSIZE];         /* Qperf version */
+ } CONF;
+ 
++char *t_bits[] ={ "bits/sec", "Kb/sec", "Mb/sec", "Gb/sec", "Tb/sec" };
++int s_bits = cardof(t_bits);
++char *t_bytes[] ={ "bytes/sec", "KB/sec", "MB/sec", "GB/sec", "TB/sec" };
++int s_bytes = cardof(t_bytes);
+ 
+ /*
+  * Function prototypes.
+@@ -177,7 +191,9 @@
+ static void      calc_node(RESN *resn, STAT *stat);
+ static void      calc_results(void);
+ static void      client(TEST *test);
++#if !(defined(__SVR4) && defined(__sun))
+ static int       cmpsub(char *s2, char *s1);
++#endif
+ static char     *commify(char *data);
+ static void      dec_req_data(REQ *host);
+ static void      dec_req_version(REQ *host);
+@@ -224,7 +240,9 @@
+ static void      sig_alrm(int signo, siginfo_t *siginfo, void *ucontext);
+ static void      sig_quit(int signo, siginfo_t *siginfo, void *ucontext);
+ static void      sig_urg(int signo, siginfo_t *siginfo, void *ucontext);
+-static char     *skip_colon(char *s);
++#if !(defined(__SVR4) && defined(__sun))
++static char    *skip_colon(char *s);
++#endif
+ static void      start_test_timer(int seconds);
+ static long      str_size(char *arg, char *str);
+ static void      strncopy(char *d, char *s, int n);
+@@ -257,9 +275,11 @@
+ static STAT     IStat;
+ static int      ListenFD;
+ static LOOP    *Loops;
++#if !(defined(__SVR4) && defined(__sun))
+ static int      ProcStatFD;
++#endif
+ static STAT     RStat;
+-static int      ShowIndex;
++volatile static int      ShowIndex = 0;
+ static SHOW     ShowTable[256];
+ static int      UnifyUnits;
+ static int      UnifyNodes;
+@@ -281,7 +301,7 @@
+ int          ServerAddrLen;
+ int          RemoteFD;
+ int          Debug;
+-volatile int Finished;
++volatile int Finished = 0;
+ 
+ 
+ /*
+@@ -603,6 +623,9 @@
+     initialize();
+     set_signals();
+     do_args(&argv[1]);
++#if (defined(__SVR4) && defined(__sun))
++    solaris_fini();
++#endif
+     return 0;
+ }
+ 
+@@ -619,14 +642,19 @@
+     for (i = 0; i < P_N; ++i)
+         if (ParInfo[i].index != i)
+             error(BUG, "initialize: ParInfo: out of order: %d", i);
++#if (defined(__SVR4) && defined(__sun))
++    solaris_init();
++#else
+     ProcStatFD = open("/proc/stat", 0);
+     if (ProcStatFD < 0)
+         error(SYS, "cannot open /proc/stat");
++#endif
+     IStat.no_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+     IStat.no_ticks = sysconf(_SC_CLK_TCK);
+ }
+ 
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ /*
+  * Look for a colon and skip past it and any spaces.
+  */
+@@ -645,12 +673,14 @@
+         s++;
+     return s;
+ }
++#endif
+ 
+ 
+ /*
+  * A case insensitive string compare.  s2 must at least contain all of s1 but
+  * can be longer.
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ static int
+ cmpsub(char *s2, char *s1)
+ {
+@@ -666,6 +696,7 @@
+             return 0;
+     }
+ }
++#endif
+ 
+ 
+ /*
+@@ -1669,13 +1700,18 @@
+ {
+     char count[STRSIZE];
+     char speed[STRSIZE];
++    char cpu[BUFSIZE];
++    int cpus = 0;
++#if !(defined(__SVR4) && defined(__sun))
+     char buf[BUFSIZE];
+-    char cpu[BUFSIZE];
+     char mhz[BUFSIZE];
+-    int cpus = 0;
+     int mixed = 0;
+     FILE *fp = fopen("/proc/cpuinfo", "r");
+-
++#else
++   sol_cpu_info_t	*info;
++#endif
++
++#if !(defined(__SVR4) && defined(__sun))
+     if (!fp)
+         error(0, "cannot open /proc/cpuinfo");
+     cpu[0] = '\0';
+@@ -1734,6 +1770,7 @@
+ 
+     /* CPU speed */
+     speed[0] = '\0';
++
+     if (!mixed) {
+         int n = strlen(cpu);
+         if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
+@@ -1747,6 +1784,23 @@
+             }
+         }
+     }
++#else
++    cpu[0] = '\0';
++    speed[0] = '\0';
++
++    if ((cpus = sol_get_cpu_info(&info)) > 0 ) {
++	(void) strcpy(cpu, info[0].cpu_name);
++
++	if (info[0].cpu_mhz < 1000)
++		snprintf(speed, sizeof(speed), " %dMHz", info[0].cpu_mhz);
++	else
++		snprintf(speed, sizeof(speed), " %.1fGHz",
++		    info[0].cpu_mhz/1000.0);
++	free(info);
++    } else {
++	return;
++    }
++#endif
+ 
+     /* Number of CPUs */
+     if (cpus == 1)
+@@ -2297,6 +2351,7 @@
+     char *tab[] ={ "ns/GB", "us/GB", "ms/GB", "sec/GB" };
+ 
+     value *=  1E9;
++
+     if (!verbose(type, value))
+         return;
+     if (!UnifyUnits) {
+@@ -2372,21 +2427,21 @@
+ view_band(int type, char *pref, char *name, double value)
+ {
+     int n, s;
+-    char **tab;
+-
++    char **tab, **t;
++
++    n = s = 0;
+     if (!verbose(type, value))
+         return;
+     if (UseBitsPerSec) {
+-        static char *t[] ={ "bits/sec", "Kb/sec", "Mb/sec", "Gb/sec", "Tb/sec" };
+-        s = cardof(t);
++	t=&t_bits[0];
++	s = s_bits;
+         tab = t;
+         value *= 8;
+     } else {
+-        static char *t[] ={ "bytes/sec", "KB/sec", "MB/sec", "GB/sec", "TB/sec" };
+-        s = cardof(t);
++	t=&t_bytes[0];
++	s = s_bytes;
+         tab = t;
+     }
+-
+     n = 0;
+     if (!UnifyUnits) {
+         while (value >= 1000 && n < s-1) {
+@@ -2516,10 +2571,13 @@
+ static void
+ place_val(char *pref, char *name, char *unit, double value)
+ {
+-    char *data = qasprintf("%.0f", value);
+-    char *p    = data;
++    char *data;
++    char *p;
+     int   n    = Precision;
+ 
++
++    data = qasprintf("%.0f", value);
++    p = data;
+     if (*p == '-')
+         ++p;
+     while (isdigit(*p++))
+@@ -2571,6 +2629,7 @@
+     for (i = 0; i < ShowIndex; ++i) {
+         int n;
+         SHOW *show = &ShowTable[i];
++
+         n = (show->pref ? strlen(show->pref) : 0) + strlen(show->name);
+         if (n > nameLen)
+             nameLen = n;
+@@ -2616,14 +2675,20 @@
+ static void
+ set_affinity(void)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+     cpu_set_t set;
++#endif
+     int a = Req.affinity;
+ 
+     if (!a)
+         return;
++#if defined(__SVR4) && defined(__sun)
++    if (processor_bind(P_LWPID, P_MYID, a - 1, NULL) != 0)
++#else
+     CPU_ZERO(&set);
+     CPU_SET(a-1, &set);
+     if (sched_setaffinity(0, sizeof(set), &set) < 0)
++#endif
+         error(SYS, "cannot set processor affinity (cpu %d)", a-1);
+ }
+ 
+@@ -2772,6 +2837,33 @@
+ /*
+  * Get various temporal parameters.
+  */
++#if (defined(__SVR4) && defined(__sun))
++
++#define	NSEC_TO_TICK(v)		(v * sysconf(_SC_CLK_TCK)/1000000000)
++
++static void
++get_times(CLOCK timex[T_N])
++{
++	struct tms tms;
++	sol_cpu_stats_t stats;  
++ 
++	timex[T_REAL] = times(&tms);
++
++	if ((sol_get_cpu_stats(&stats)) < 0)
++		return;
++
++	timex[T_USER] = stats.t_user;
++	timex[T_NICE] = 0;
++	timex[T_KERNEL] = stats.t_kernel;
++	timex[T_IDLE] = stats.t_idle;
++	timex[T_IOWAIT] = stats.t_iowait;
++	timex[T_IRQ] = NSEC_TO_TICK(stats.t_intr);	 /* NSEC_TO_TICK */
++	timex[T_SOFTIRQ] = 0;
++	timex[T_STEAL] = 0;
++}
++
++#else
++
+ static void
+ get_times(CLOCK timex[T_N])
+ {
+@@ -2803,6 +2895,7 @@
+     while (n < T_N)
+         timex[n++] = 0;
+ }
++#endif
+ 
+ 
+ /*
+diff -r 6728b98439b2 src/qperf.h
+--- a/src/qperf.h	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/qperf.h	Fri Nov 13 07:33:20 2015 -0800
+@@ -193,6 +193,7 @@
+     uint32_t    no_cpus;                /* Number of processors */
+     uint32_t    no_ticks;               /* Ticks per second */
+     uint32_t    max_cqes;               /* Maximum CQ entries */
++    __attribute__ ((aligned (8)))	/* align with 32-bit & 64-bit binary */
+     CLOCK       time_s[T_N];            /* Start times */
+     CLOCK       time_e[T_N];            /* End times */
+     USTAT       s;                      /* Send statistics */
+diff -r 6728b98439b2 src/rdma.c
+--- a/src/rdma.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/rdma.c	Fri Nov 13 07:33:20 2015 -0800
+@@ -37,7 +37,11 @@
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#if (defined(__SVR4) && defined(__sun))
++#include <strings.h>
++#else
+ #include <string.h>
++#endif
+ #include <unistd.h>
+ #include <netinet/in.h>
+ #include <rdma/rdma_cma.h>
+@@ -110,7 +114,8 @@
+     uint32_t    srqn;                   /* Shared queue number */
+     uint32_t    rkey;                   /* Remote key */
+     uint32_t    alt_lid;                /* Alternate Path Local LID */
+-    uint32_t    rd_atomic;              /* Number of read/atomics supported */
++    uint32_t    rd_atomic               /* Number of read/atomics supported */
++    __attribute__ ((aligned (8)));	/* align struct size to 64-bit binary */
+ } NODE;
+ 
+ 
+@@ -566,11 +571,15 @@
+ void
+ run_client_uc_bi_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     par_use(L_ACCESS_RECV);
+     par_use(R_ACCESS_RECV);
+     rd_params(IBV_QPT_UC, K64, 1, 0);
+     rd_bi_bw(IBV_QPT_UC);
+     show_results(BANDWIDTH_SR);
++#endif
+ }
+ 
+ 
+@@ -580,7 +589,11 @@
+ void
+ run_server_uc_bi_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_bi_bw(IBV_QPT_UC);
++#endif
+ }
+ 
+ 
+@@ -590,6 +603,9 @@
+ void
+ run_client_uc_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     par_use(L_ACCESS_RECV);
+     par_use(R_ACCESS_RECV);
+     par_use(L_NO_MSGS);
+@@ -597,6 +613,7 @@
+     rd_params(IBV_QPT_UC, K64, 1, 0);
+     rd_client_bw(IBV_QPT_UC);
+     show_results(BANDWIDTH_SR);
++#endif
+ }
+ 
+ 
+@@ -606,7 +623,11 @@
+ void
+ run_server_uc_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_server_def(IBV_QPT_UC);
++#endif
+ }
+ 
+ 
+@@ -616,8 +637,12 @@
+ void
+ run_client_uc_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_params(IBV_QPT_UC, 1, 1, 0);
+     rd_pp_lat(IBV_QPT_UC, IO_SR);
++#endif
+ }
+ 
+ 
+@@ -627,7 +652,11 @@
+ void
+ run_server_uc_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_pp_lat(IBV_QPT_UC, IO_SR);
++#endif
+ }
+ 
+ 
+@@ -637,9 +666,13 @@
+ void
+ run_client_uc_rdma_write_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_params(IBV_QPT_UC, K64, 1, 0);
+     rd_client_rdma_bw(IBV_QPT_UC, IBV_WR_RDMA_WRITE_WITH_IMM);
+     show_results(BANDWIDTH_SR);
++#endif
+ }
+ 
+ 
+@@ -649,7 +682,11 @@
+ void
+ run_server_uc_rdma_write_bw(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_server_def(IBV_QPT_UC);
++#endif
+ }
+ 
+ 
+@@ -659,8 +696,12 @@
+ void
+ run_client_uc_rdma_write_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_params(IBV_QPT_UC, 1, 1, 0);
+     rd_pp_lat(IBV_QPT_UC, IO_RDMA);
++#endif
+ }
+ 
+ 
+@@ -670,7 +711,11 @@
+ void
+ run_server_uc_rdma_write_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_pp_lat(IBV_QPT_UC, IO_RDMA);
++#endif
+ }
+ 
+ 
+@@ -680,9 +725,13 @@
+ void
+ run_client_uc_rdma_write_poll_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_params(IBV_QPT_UC, 1, 1, 0);
+     rd_rdma_write_poll_lat(IBV_QPT_UC);
+     show_results(LATENCY);
++#endif
+ }
+ 
+ 
+@@ -692,7 +741,11 @@
+ void
+ run_server_uc_rdma_write_poll_lat(void)
+ {
++#if (defined(__SVR4) && defined(__sun))
++    error(RET, "UC Not Supported");
++#else
+     rd_rdma_write_poll_lat(IBV_QPT_UC);
++#endif
+ }
+ 
+ 
+@@ -1874,10 +1927,16 @@
+         error(0, "rdma_bind_addr failed");
+     port = ntohs(rdma_get_src_port(cm->id));
+     encode_uint32(&port, port);
++#if !(defined(__SVR4) && defined(__sun))
+     send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
++#endif
+ 
+     if (rdma_listen(cm->id, 0) != 0)
+         error(0, "rdma_listen failed");
++
++#if (defined(__SVR4) && defined(__sun))
++    send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
++#endif
+     cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
+     rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
+ 
+diff -r 6728b98439b2 src/rds.c
+--- a/src/rds.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/rds.c	Fri Nov 13 07:33:20 2015 -0800
+@@ -45,6 +45,9 @@
+ #include <netinet/in.h>
+ #include "qperf.h"
+ 
++#if (defined(__SVR4) && defined(__sun))
++#include <sys/rds.h>
++#else
+ 
+ /*
+  * Parameters.
+@@ -90,6 +93,7 @@
+ #define AF_RDS get_af_rds()
+ #endif
+ 
++#endif
+ 
+ /*
+  * Function prototypes.
+@@ -338,13 +342,19 @@
+     if (bind(lfd, (SA *)&laddr, sizeof(laddr)) < 0)
+         error(SYS, "bind INET failed");
+ 
++    /*
++     * OFED generic fix - listen() should be setup first before sending server
++     * port message to the client.  There is a window that the client's
++     * connect() would fail after receiving the "server port" message if the
++     * server hasn't completed the listen().
++     */
++    if (listen(lfd, 1) < 0)
++        error(SYS, "listen failed");
++
+     port = get_socket_port(lfd);
+     encode_uint32(&port, port);
+     send_mesg(&port, sizeof(port), "TCP IPv4 server port");
+ 
+-    if (listen(lfd, 1) < 0)
+-        error(SYS, "listen failed");
+-
+     rlen = sizeof(raddr);
+     fd = accept(lfd, (SA *)&raddr, &rlen);
+     if (fd < 0)
+@@ -392,7 +402,11 @@
+     SS sockaddr;
+     socklen_t socklen;
+ 
++#if (defined(__SVR4) && defined(__sun))
++    sockfd = socket(PF_RDS, SOCK_SEQPACKET, 0);
++#else
+     sockfd = socket(AF_RDS, SOCK_SEQPACKET, 0);
++#endif
+     if (sockfd < 0)
+         error(SYS, "socket failed");
+     setsockopt_one(sockfd, SO_REUSEADDR);
+@@ -413,7 +427,11 @@
+     struct sockaddr_in *sap = (struct sockaddr_in *)addr;
+ 
+     memset(sap, 0, sizeof(*sap));
++#if (defined(__SVR4) && defined(__sun))
++    sap->sin_family = AF_INET_OFFLOAD;
++#else
+     sap->sin_family = AF_INET;
++#endif
+     inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
+     sap->sin_port = htons(port);
+     *len = sizeof(struct sockaddr_in);
+@@ -471,6 +489,14 @@
+ 
+     if (getsockname(fd, (SA *)&sa, &salen) < 0)
+         error(SYS, "getsockname failed");
++#if (defined(__SVR4) && defined(__sun))
++    /*
++     * getnameinfo() does not support AF_INET_OFFLOAD, so 
++     * use ss_family as AF_INET to get port info.
++     */ 
++    if (sa.ss_family == AF_INET_OFFLOAD)
++	sa.ss_family = AF_INET;
++#endif
+     qgetnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV);
+     port = atoi(p);
+     if (!port)
+diff -r 6728b98439b2 src/socket.c
+--- a/src/socket.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/socket.c	Fri Nov 13 07:33:20 2015 -0800
+@@ -44,7 +44,9 @@
+ /*
+  * Parameters.
+  */
++#if !(defined(__SVR4) && defined(__sun))
+ #define AF_INET_SDP 27                  /* Family for SDP */
++#endif
+ 
+ 
+ /*
+@@ -707,10 +709,14 @@
+     ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
+     for (aip = ailist; aip; aip = aip->ai_next) {
+         if (kind == K_SDP) {
++#if (defined(__SVR4) && defined(__sun))
++		aip->ai_protocol = PROTO_SDP;
++#else
+             if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
+                 aip->ai_family = AF_INET_SDP;
+             else
+                 aip->ai_family = 0;
++#endif
+         } else if (kind == K_SCTP) {
+             if (aip->ai_protocol == IPPROTO_TCP)
+                 aip->ai_protocol = IPPROTO_SCTP;
+diff -r 6728b98439b2 src/support.c
+--- a/src/support.c	Wed Oct 14 12:54:37 2015 -0700
++++ b/src/support.c	Fri Nov 13 07:33:20 2015 -0800
+@@ -215,14 +215,14 @@
+     volatile uint64_t *p64 = p;
+ 
+     while (n >= sizeof(*p64)) {
+-        (void) *p64++;
+         n -= sizeof(*p64);
++        *p64++;
+     }
+     if (n) {
+         volatile uint8_t *p8 = (uint8_t *)p64;
+         while (n >= sizeof(*p8)) {
+-            (void) *p8++;
+             n -= sizeof(*p8);
++            *p8++;
+         }
+     }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf/patches/002-qperf-free_pd_before_mr.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,65 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  10ff83daa8b89e664e292c2b716cd5041af246db
+21863652 qperf cannot handle device name with IB port number as argument
+21863393 qperf attempts to free the PD before freeing the MR associated with it
+
+diff -r 10ff83daa8b8 src/qperf.h
+--- a/src/qperf.h	Thu Nov 12 10:14:04 2015 -0800
++++ b/src/qperf.h	Thu Nov 12 10:17:35 2015 -0800
+@@ -49,6 +49,7 @@
+ #define cardof(a)       (sizeof(a)/sizeof(*a))
+ #define endof(a)        (&a[cardof(a)])
+ #define streq(a, b)     (strcmp(a, b) == 0)
++#define streqn(a, b, n)	(strncmp(a, b, n) == 0)
+ #define offset(t, e)    ((long)&((t *)0)->e)
+ #define is_client()     (ServerName != 0)
+ #define is_sender()     (Req.flip ? !is_client() : is_client())
+diff -r 10ff83daa8b8 src/rdma.c
+--- a/src/rdma.c	Thu Nov 12 10:14:04 2015 -0800
++++ b/src/rdma.c	Thu Nov 12 10:17:35 2015 -0800
+@@ -1660,11 +1660,11 @@
+         ibv_destroy_ah(dev->ah);
+     if (dev->cq)
+         ibv_destroy_cq(dev->cq);
++    rd_mrfree(dev);
+     if (dev->pd)
+         ibv_dealloc_pd(dev->pd);
+     if (dev->channel)
+         ibv_destroy_comp_channel(dev->channel);
+-    rd_mrfree(dev);
+ 
+     if (!Req.use_cm)
+         ib_close2(dev);
+@@ -2081,7 +2081,7 @@
+         char *p = index(Req.id, ':');
+ 
+         if (p) {
+-            *p++ = '\0';
++            p++;
+             port = atoi(p);
+             if (port < 1)
+                 error(0, "bad IB port: %d; must be at least 1", port);
+@@ -2119,10 +2119,18 @@
+             device = *dev->ib.devlist;
+         else {
+             struct ibv_device **d = dev->ib.devlist;
+-            while ((device = *d++))
+-                if (streq(ibv_get_device_name(device), name))
++            size_t n = strlen(name);
++            char *p = index(Req.id, ':');
++            if (p) {
++                n = p - Req.id;
++            }
++            while ((device = *d++)) {
++                if (streqn(ibv_get_device_name(device), name, n)) {
+                     break;
++                }
++            }
+         }
++
+         if (!device)
+             error(SYS, "failed to find InfiniBand device");
+         dev->ib.context = ibv_open_device(device);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf/patches/003-qperf-ud_bw_timeout.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,42 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  bed9e1f4976b9258363d26ec587075f77ac65042
+22689609 qperf returns failed to receive results: timed out for ud_bw tests
+
+diff -r bed9e1f4976b src/rdma.c
+--- a/src/rdma.c	Thu Feb 11 05:13:36 2016 -0800
++++ b/src/rdma.c	Tue Feb 23 21:03:12 2016 -0800
+@@ -987,9 +987,14 @@
+ {
+     DEVICE dev;
+ 
+-    rd_open(&dev, transport, 0, NCQE);
++    /*
++     * Post more receive buffers for the server, A fast client can cause receive WR
++     * exhaustion, which in turn can cause packet drop (in case of UD) or cause
++     * re-transmits (in case of RC).
++     */   
++    rd_open(&dev, transport, 0, (4 * NCQE));
+     rd_prep(&dev, 0);
+-    rd_post_recv_std(&dev, NCQE);
++    rd_post_recv_std(&dev, (4 * NCQE));
+     sync_test();
+     while (!Finished) {
+         int i;
+@@ -2574,6 +2579,14 @@
+ {
+     int n;
+ 
++    /*
++     * We will attempt to poll the CQ first.
++     * If CQ is empty we could wait for CQ notification.
++     */
++    n = ibv_poll_cq(dev->cq, nwc, wc);
++    if (n > 0)
++    	return n;
++
+     if (!Req.poll_mode && !Finished) {
+         void *ectx;
+         struct ibv_cq *ecq;
--- a/components/open-fabrics/qperf/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,784 +0,0 @@
-# This patch was developed both in-house and from outside. We plan to submit it
-# upstream, but do not yet have a target date for doing so
-#
-diff -r -u /tmp/730054/qperf-0.4.6/src/socket.c qperf-0.4.6/src/socket.c
---- /tmp/730054/qperf-0.4.6/src/socket.c	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/socket.c	Mon Nov  8 11:10:20 2010
-@@ -44,7 +44,9 @@
- /*
-  * Parameters.
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- #define AF_INET_SDP 27                  /* Family for SDP */
-+#endif
- 
- 
- /*
-@@ -707,10 +709,14 @@
-     ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
-     for (aip = ailist; aip; aip = aip->ai_next) {
-         if (kind == K_SDP) {
-+#if (defined(__SVR4) && defined(__sun))
-+		aip->ai_protocol = PROTO_SDP;
-+#else
-             if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
-                 aip->ai_family = AF_INET_SDP;
-             else
-                 aip->ai_family = 0;
-+#endif
-         } else if (kind == K_SCTP) {
-             if (aip->ai_protocol == IPPROTO_TCP)
-                 aip->ai_protocol = IPPROTO_SCTP;
-diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.c qperf-0.4.6/src/qperf.c
---- /tmp/730054/qperf-0.4.6/src/qperf.c	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/qperf.c	Mon Nov  8 11:10:17 2010
-@@ -53,7 +53,17 @@
- #include <sys/utsname.h>
- #include "qperf.h"
- 
-+#if (defined(__SVR4) && defined(__sun))
-+#include <sys/filio.h>
-+#include <limits.h>	/* times() */
-+#include <sys/types.h>
-+#include <sys/processor.h>
-+#include <sys/procset.h>
-+#include <strings.h>
-+#include <infiniband/ofa_solaris.h>
- 
-+#endif
-+
- /*
-  * Configurable parameters.  If your change makes this version of qperf
-  * incompatible with previous versions (usually a change to the Req structure),
-@@ -165,6 +175,10 @@
-     char        qperf[STRSIZE];         /* Qperf version */
- } CONF;
- 
-+char *t_bits[] ={ "bits/sec", "Kb/sec", "Mb/sec", "Gb/sec", "Tb/sec" };
-+int s_bits = cardof(t_bits);
-+char *t_bytes[] ={ "bytes/sec", "KB/sec", "MB/sec", "GB/sec", "TB/sec" };
-+int s_bytes = cardof(t_bytes);
- 
- /*
-  * Function prototypes.
-@@ -177,7 +191,9 @@
- static void      calc_node(RESN *resn, STAT *stat);
- static void      calc_results(void);
- static void      client(TEST *test);
-+#if !(defined(__SVR4) && defined(__sun))
- static int       cmpsub(char *s2, char *s1);
-+#endif
- static char     *commify(char *data);
- static void      dec_req_data(REQ *host);
- static void      dec_req_version(REQ *host);
-@@ -224,7 +240,9 @@
- static void      sig_alrm(int signo, siginfo_t *siginfo, void *ucontext);
- static void      sig_quit(int signo, siginfo_t *siginfo, void *ucontext);
- static void      sig_urg(int signo, siginfo_t *siginfo, void *ucontext);
--static char     *skip_colon(char *s);
-+#if !(defined(__SVR4) && defined(__sun))
-+static char    *skip_colon(char *s);
-+#endif
- static void      start_test_timer(int seconds);
- static long      str_size(char *arg, char *str);
- static void      strncopy(char *d, char *s, int n);
-@@ -257,9 +275,11 @@
- static STAT     IStat;
- static int      ListenFD;
- static LOOP    *Loops;
-+#if !(defined(__SVR4) && defined(__sun))
- static int      ProcStatFD;
-+#endif
- static STAT     RStat;
--static int      ShowIndex;
-+volatile static int      ShowIndex = 0;
- static SHOW     ShowTable[256];
- static int      UnifyUnits;
- static int      UnifyNodes;
-@@ -281,7 +301,7 @@
- int          ServerAddrLen;
- int          RemoteFD;
- int          Debug;
--volatile int Finished;
-+volatile int Finished = 0;
- 
- 
- /*
-@@ -601,6 +621,9 @@
-     initialize();
-     set_signals();
-     do_args(&argv[1]);
-+#if (defined(__SVR4) && defined(__sun))
-+    solaris_fini();
-+#endif
-     return 0;
- }
- 
-@@ -617,14 +640,19 @@
-     for (i = 0; i < P_N; ++i)
-         if (ParInfo[i].index != i)
-             error(BUG, "initialize: ParInfo: out of order: %d", i);
-+#if (defined(__SVR4) && defined(__sun))
-+    solaris_init();
-+#else
-     ProcStatFD = open("/proc/stat", 0);
-     if (ProcStatFD < 0)
-         error(SYS, "cannot open /proc/stat");
-+#endif
-     IStat.no_cpus = sysconf(_SC_NPROCESSORS_ONLN);
-     IStat.no_ticks = sysconf(_SC_CLK_TCK);
- }
- 
- 
-+#if !(defined(__SVR4) && defined(__sun))
- /*
-  * Look for a colon and skip past it and any spaces.
-  */
-@@ -643,6 +671,7 @@
-         s++;
-     return s;
- }
-+#endif
- 
- 
- /*
-@@ -649,6 +678,7 @@
-  * A case insensitive string compare.  s2 must at least contain all of s1 but
-  * can be longer.
-  */
-+#if !(defined(__SVR4) && defined(__sun))
- static int
- cmpsub(char *s2, char *s1)
- {
-@@ -664,6 +694,7 @@
-             return 0;
-     }
- }
-+#endif
- 
- 
- /*
-@@ -1667,13 +1698,18 @@
- {
-     char count[STRSIZE];
-     char speed[STRSIZE];
--    char buf[BUFSIZE];
-     char cpu[BUFSIZE];
--    char mhz[BUFSIZE];
-     int cpus = 0;
-+#if !(defined(__SVR4) && defined(__sun))
-+    char buf[BUFSIZE];
-+    char mhz[BUFSIZE];
-     int mixed = 0;
-     FILE *fp = fopen("/proc/cpuinfo", "r");
-+#else
-+   sol_cpu_info_t	*info;
-+#endif
- 
-+#if !(defined(__SVR4) && defined(__sun))
-     if (!fp)
-         error(0, "cannot open /proc/cpuinfo");
-     cpu[0] = '\0';
-@@ -1732,6 +1768,7 @@
- 
-     /* CPU speed */
-     speed[0] = '\0';
-+
-     if (!mixed) {
-         int n = strlen(cpu);
-         if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
-@@ -1745,7 +1782,24 @@
-             }
-         }
-     }
-+#else
-+    cpu[0] = '\0';
-+    speed[0] = '\0';
- 
-+    if ((cpus = sol_get_cpu_info(&info)) > 0 ) {
-+	(void) strcpy(cpu, info[0].cpu_name);
-+
-+	if (info[0].cpu_mhz < 1000)
-+		snprintf(speed, sizeof(speed), " %dMHz", info[0].cpu_mhz);
-+	else
-+		snprintf(speed, sizeof(speed), " %.1fGHz",
-+		    info[0].cpu_mhz/1000.0);
-+	free(info);
-+    } else {
-+	return;
-+    }
-+#endif
-+
-     /* Number of CPUs */
-     if (cpus == 1)
-         count[0] = '\0';
-@@ -1776,11 +1830,10 @@
- static void
- run_server_quit(void)
- {
--    int z;
-     char buf[1];
- 
-     sync_test();
--    z = read(RemoteFD, buf, sizeof(buf));
-+    (void)read(RemoteFD, buf, sizeof(buf));
-     kill(getppid(), SIGQUIT);
-     exit(0);
- }
-@@ -2296,6 +2349,7 @@
-     char *tab[] ={ "ns/GB", "us/GB", "ms/GB", "sec/GB" };
- 
-     value *=  1E9;
-+
-     if (!verbose(type, value))
-         return;
-     if (!UnifyUnits) {
-@@ -2371,21 +2425,20 @@
- view_band(int type, char *pref, char *name, double value)
- {
-     int n, s;
--    char **tab;
--
-+    char **tab, **t;
-+    n = s = 0; 
-     if (!verbose(type, value))
-         return;
-     if (UseBitsPerSec) {
--        char *t[] ={ "bits/sec", "Kb/sec", "Mb/sec", "Gb/sec", "Tb/sec" };
--        s = cardof(t);
-+        t=&t_bits[0];
-+        s = s_bits;
-         tab = t;
-         value *= 8;
-     } else {
--        char *t[] ={ "bytes/sec", "KB/sec", "MB/sec", "GB/sec", "TB/sec" };
--        s = cardof(t);
-+        t=&t_bytes[0];
-+        s = s_bytes; 
-         tab = t;
-     }
--
-     n = 0;
-     if (!UnifyUnits) {
-         while (value >= 1000 && n < s-1) {
-@@ -2515,10 +2568,13 @@
- static void
- place_val(char *pref, char *name, char *unit, double value)
- {
--    char *data = qasprintf("%.0f", value);
--    char *p    = data;
-+    char *data;
-+    char *p;
-     int   n    = Precision;
- 
-+
-+    data = qasprintf("%.0f", value);
-+    p = data;
-     if (*p == '-')
-         ++p;
-     while (isdigit(*p++))
-@@ -2570,6 +2626,7 @@
-     for (i = 0; i < ShowIndex; ++i) {
-         int n;
-         SHOW *show = &ShowTable[i];
-+
-         n = (show->pref ? strlen(show->pref) : 0) + strlen(show->name);
-         if (n > nameLen)
-             nameLen = n;
-@@ -2615,14 +2672,20 @@
- static void
- set_affinity(void)
- {
-+#if !(defined(__SVR4) && defined(__sun))
-     cpu_set_t set;
-+#endif
-     int a = Req.affinity;
- 
-     if (!a)
-         return;
-+#if defined(__SVR4) && defined(__sun)
-+    if (processor_bind(P_LWPID, P_MYID, a - 1, NULL) != 0)
-+#else
-     CPU_ZERO(&set);
-     CPU_SET(a-1, &set);
-     if (sched_setaffinity(0, sizeof(set), &set) < 0)
-+#endif
-         error(SYS, "cannot set processor affinity (cpu %d)", a-1);
- }
- 
-@@ -2771,9 +2834,36 @@
- /*
-  * Get various temporal parameters.
-  */
-+#if (defined(__SVR4) && defined(__sun))
-+
-+#define	NSEC_TO_TICK(v)		(v * sysconf(_SC_CLK_TCK)/1000000000)
-+
- static void
- get_times(CLOCK timex[T_N])
- {
-+	struct tms tms;
-+	sol_cpu_stats_t stats;  
-+ 
-+	timex[T_REAL] = times(&tms);
-+
-+	if ((sol_get_cpu_stats(&stats)) < 0)
-+		return;
-+
-+	timex[T_USER] = stats.t_user;
-+	timex[T_NICE] = 0;
-+	timex[T_KERNEL] = stats.t_kernel;
-+	timex[T_IDLE] = stats.t_idle;
-+	timex[T_IOWAIT] = stats.t_iowait;
-+	timex[T_IRQ] = NSEC_TO_TICK(stats.t_intr);	 /* NSEC_TO_TICK */
-+	timex[T_SOFTIRQ] = 0;
-+	timex[T_STEAL] = 0;
-+}
-+
-+#else
-+
-+static void
-+get_times(CLOCK timex[T_N])
-+{
-     int n;
-     char *p;
-     char buf[BUFSIZE];
-@@ -2802,6 +2892,7 @@
-     while (n < T_N)
-         timex[n++] = 0;
- }
-+#endif
- 
- 
- /*
-diff -r -u /tmp/730054/qperf-0.4.6/src/rdma.c qperf-0.4.6/src/rdma.c
---- /tmp/730054/qperf-0.4.6/src/rdma.c	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/rdma.c	Mon Nov  8 11:10:19 2010
-@@ -37,7 +37,11 @@
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
-+#if (defined(__SVR4) && defined(__sun))
-+#include <strings.h>
-+#else
- #include <string.h>
-+#endif
- #include <unistd.h>
- #include <netinet/in.h>
- #include <rdma/rdma_cma.h>
-@@ -110,7 +114,8 @@
-     uint32_t    srqn;                   /* Shared queue number */
-     uint32_t    rkey;                   /* Remote key */
-     uint32_t    alt_lid;                /* Alternate Path Local LID */
--    uint32_t    rd_atomic;              /* Number of read/atomics supported */
-+    uint32_t    rd_atomic               /* Number of read/atomics supported */
-+    __attribute__ ((aligned (8)));	/* align struct size to 64-bit binary */
- } NODE;
- 
- 
-@@ -566,11 +571,15 @@
- void
- run_client_uc_bi_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     par_use(L_ACCESS_RECV);
-     par_use(R_ACCESS_RECV);
-     rd_params(IBV_QPT_UC, K64, 1, 0);
-     rd_bi_bw(IBV_QPT_UC);
-     show_results(BANDWIDTH_SR);
-+#endif
- }
- 
- 
-@@ -580,7 +589,11 @@
- void
- run_server_uc_bi_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_bi_bw(IBV_QPT_UC);
-+#endif
- }
- 
- 
-@@ -590,6 +603,9 @@
- void
- run_client_uc_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     par_use(L_ACCESS_RECV);
-     par_use(R_ACCESS_RECV);
-     par_use(L_NO_MSGS);
-@@ -597,6 +613,7 @@
-     rd_params(IBV_QPT_UC, K64, 1, 0);
-     rd_client_bw(IBV_QPT_UC);
-     show_results(BANDWIDTH_SR);
-+#endif
- }
- 
- 
-@@ -606,7 +623,11 @@
- void
- run_server_uc_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_server_def(IBV_QPT_UC);
-+#endif
- }
- 
- 
-@@ -616,8 +637,12 @@
- void
- run_client_uc_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_params(IBV_QPT_UC, 1, 1, 0);
-     rd_pp_lat(IBV_QPT_UC, IO_SR);
-+#endif
- }
- 
- 
-@@ -627,7 +652,11 @@
- void
- run_server_uc_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_pp_lat(IBV_QPT_UC, IO_SR);
-+#endif
- }
- 
- 
-@@ -637,9 +666,13 @@
- void
- run_client_uc_rdma_write_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_params(IBV_QPT_UC, K64, 1, 0);
-     rd_client_rdma_bw(IBV_QPT_UC, IBV_WR_RDMA_WRITE_WITH_IMM);
-     show_results(BANDWIDTH_SR);
-+#endif
- }
- 
- 
-@@ -649,7 +682,11 @@
- void
- run_server_uc_rdma_write_bw(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_server_def(IBV_QPT_UC);
-+#endif
- }
- 
- 
-@@ -659,8 +696,12 @@
- void
- run_client_uc_rdma_write_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_params(IBV_QPT_UC, 1, 1, 0);
-     rd_pp_lat(IBV_QPT_UC, IO_RDMA);
-+#endif
- }
- 
- 
-@@ -670,7 +711,11 @@
- void
- run_server_uc_rdma_write_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_pp_lat(IBV_QPT_UC, IO_RDMA);
-+#endif
- }
- 
- 
-@@ -680,9 +725,13 @@
- void
- run_client_uc_rdma_write_poll_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_params(IBV_QPT_UC, 1, 1, 0);
-     rd_rdma_write_poll_lat(IBV_QPT_UC);
-     show_results(LATENCY);
-+#endif
- }
- 
- 
-@@ -692,7 +741,11 @@
- void
- run_server_uc_rdma_write_poll_lat(void)
- {
-+#if (defined(__SVR4) && defined(__sun))
-+    error(RET, "UC Not Supported");
-+#else
-     rd_rdma_write_poll_lat(IBV_QPT_UC);
-+#endif
- }
- 
- 
-@@ -1599,11 +1652,11 @@
-         ibv_destroy_ah(dev->ah);
-     if (dev->cq)
-         ibv_destroy_cq(dev->cq);
-+    rd_mrfree(dev);
-     if (dev->pd)
-         ibv_dealloc_pd(dev->pd);
-     if (dev->channel)
-         ibv_destroy_comp_channel(dev->channel);
--    rd_mrfree(dev);
- 
-     if (!Req.use_cm)
-         ib_close2(dev);
-@@ -1864,10 +1917,16 @@
-         error(0, "rdma_bind_addr failed");
-     port = ntohs(rdma_get_src_port(cm->id));
-     encode_uint32(&port, port);
-+#if !(defined(__SVR4) && defined(__sun))
-     send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
-+#endif
- 
-     if (rdma_listen(cm->id, 0) != 0)
-         error(0, "rdma_listen failed");
-+
-+#if (defined(__SVR4) && defined(__sun))
-+    send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
-+#endif
-     cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
-     rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
- 
-@@ -2012,7 +2071,7 @@
-         char *p = index(Req.id, ':');
- 
-         if (p) {
--            *p++ = '\0';
-+            p++;
-             port = atoi(p);
-             if (port < 1)
-                 error(0, "bad IB port: %d; must be at least 1", port);
-@@ -2050,10 +2109,18 @@
-             device = *dev->ib.devlist;
-         else {
-             struct ibv_device **d = dev->ib.devlist;
--            while ((device = *d++))
--                if (streq(ibv_get_device_name(device), name))
-+            size_t n = strlen(name);
-+            char *p = index(Req.id, ':');
-+            if (p) {
-+                n = p - Req.id;
-+            }
-+            while ((device = *d++)) {
-+                if (streqn(ibv_get_device_name(device), name, n)) {
-                     break;
-+                }
-+            }
-         }
-+
-         if (!device)
-             error(SYS, "failed to find InfiniBand device");
-         dev->ib.context = ibv_open_device(device);
-diff -r -u /tmp/730054/qperf-0.4.6/src/rds.c qperf-0.4.6/src/rds.c
---- /tmp/730054/qperf-0.4.6/src/rds.c	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/rds.c	Mon Nov  8 11:10:19 2010
-@@ -44,6 +44,9 @@
- #include <netinet/in.h>
- #include "qperf.h"
- 
-+#if (defined(__SVR4) && defined(__sun))
-+#include <sys/rds.h>
-+#else
- 
- /*
-  * Parameters.
-@@ -50,6 +53,7 @@
-  */
- #define AF_INET_RDS 28                  /* Family for RDS */
- 
-+#endif
- 
- /*
-  * Function prototypes.
-@@ -298,13 +302,19 @@
-     if (bind(lfd, (SA *)&laddr, sizeof(laddr)) < 0)
-         error(SYS, "bind INET failed");
- 
-+    /*
-+     * OFED generic fix - listen() should be setup first before sending server
-+     * port message to the client.  There is a window that the client's
-+     * connect() would fail after receiving the "server port" message if the
-+     * server hasn't completed the listen().
-+     */
-+    if (listen(lfd, 1) < 0)
-+        error(SYS, "listen failed");
-+
-     port = get_socket_port(lfd);
-     encode_uint32(&port, port);
-     send_mesg(&port, sizeof(port), "TCP IPv4 server port");
- 
--    if (listen(lfd, 1) < 0)
--        error(SYS, "listen failed");
--
-     rlen = sizeof(raddr);
-     fd = accept(lfd, (SA *)&raddr, &rlen);
-     if (fd < 0)
-@@ -352,7 +362,11 @@
-     SS sockaddr;
-     socklen_t socklen;
- 
-+#if (defined(__SVR4) && defined(__sun))
-+    sockfd = socket(PF_RDS, SOCK_SEQPACKET, 0);
-+#else
-     sockfd = socket(AF_INET_RDS, SOCK_SEQPACKET, 0);
-+#endif
-     if (sockfd < 0)
-         error(SYS, "socket failed");
-     setsockopt_one(sockfd, SO_REUSEADDR);
-@@ -373,7 +387,11 @@
-     struct sockaddr_in *sap = (struct sockaddr_in *)addr;
- 
-     memset(sap, 0, sizeof(*sap));
-+#if (defined(__SVR4) && defined(__sun))
-+    sap->sin_family = AF_INET_OFFLOAD;
-+#else
-     sap->sin_family = AF_INET;
-+#endif
-     inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
-     sap->sin_port = htons(port);
-     *len = sizeof(struct sockaddr_in);
-@@ -431,6 +449,14 @@
- 
-     if (getsockname(fd, (SA *)&sa, &salen) < 0)
-         error(SYS, "getsockname failed");
-+#if (defined(__SVR4) && defined(__sun))
-+    /*
-+     * getnameinfo() does not support AF_INET_OFFLOAD, so 
-+     * use ss_family as AF_INET to get port info.
-+     */ 
-+    if (sa.ss_family == AF_INET_OFFLOAD)
-+	sa.ss_family = AF_INET;
-+#endif
-     qgetnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV);
-     port = atoi(p);
-     if (!port)
-diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.h qperf-0.4.6/src/qperf.h
---- /tmp/730054/qperf-0.4.6/src/qperf.h	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/qperf.h	Tue Oct 18 16:40:59 2011
-@@ -49,6 +49,7 @@
- #define cardof(a)       (sizeof(a)/sizeof(*a))
- #define endof(a)        (&a[cardof(a)])
- #define streq(a, b)     (strcmp(a, b) == 0)
-+#define streqn(a, b, n)	(strncmp(a, b, n) == 0)
- #define offset(t, e)    ((long)&((t *)0)->e)
- #define is_client()     (ServerName != 0)
- #define is_sender()     (Req.flip ? !is_client() : is_client())
-@@ -193,6 +194,7 @@
-     uint32_t    no_cpus;                /* Number of processors */
-     uint32_t    no_ticks;               /* Ticks per second */
-     uint32_t    max_cqes;               /* Maximum CQ entries */
-+    __attribute__ ((aligned (8)))	/* align with 32-bit & 64-bit binary */
-     CLOCK       time_s[T_N];            /* Start times */
-     CLOCK       time_e[T_N];            /* End times */
-     USTAT       s;                      /* Send statistics */
-diff -r -u /tmp/730054/qperf-0.4.6/src/support.c qperf-0.4.6/src/support.c
---- /tmp/730054/qperf-0.4.6/src/support.c	Mon Aug 31 00:00:40 2009
-+++ qperf-0.4.6/src/support.c	Mon Jun  8 15:01:41 2015
-@@ -212,18 +212,17 @@
- void
- touch_data(void *p, int n)
- {
--    uint64_t a;
-     volatile uint64_t *p64 = p;
- 
-     while (n >= sizeof(*p64)) {
--        a = *p64++;
-         n -= sizeof(*p64);
-+	*p64++;
-     }
-     if (n) {
-         volatile uint8_t *p8 = (uint8_t *)p64;
-         while (n >= sizeof(*p8)) {
--            a = *p8++;
-             n -= sizeof(*p8);
-+	    *p8++;
-         }
-     }
- }
-@@ -419,7 +418,6 @@
- void
- urgent(void)
- {
--    int z;
-     char *p, *q;
-     char buffer[256];
- 
-@@ -471,7 +469,7 @@
-             remote_failure_error();
-         if (s)
-             break;
--        z = read(RemoteFD, p, q-p);
-+        (void)read(RemoteFD, p, q-p);
-     }
- 
-     while (p < q) {
-@@ -484,7 +482,7 @@
-     timeout_end();
- 
-     buf_end(&p, q);
--    z = write(2, buffer, p+1-buffer);
-+    (void)write(2, buffer, p+1-buffer);
-     die();
- }
- 
-@@ -505,7 +503,6 @@
- static void
- remote_failure_error(void)
- {
--    int z;
-     char buffer[256];
-     char *p = buffer;
-     char *q = p + sizeof(buffer);
-@@ -513,7 +510,7 @@
-     buf_app(&p, q, remote_name());
-     buf_app(&p, q, " failure");
-     buf_end(&p, q);
--    z = write(2, buffer, p+1-buffer);
-+    (void)write(2, buffer, p+1-buffer);
-     die();
- }
- 
-@@ -539,7 +536,6 @@
- int
- error(int actions, char *fmt, ...)
- {
--    int z;
-     va_list alist;
-     char buffer[256];
-     char *p = buffer;
-@@ -561,7 +557,7 @@
- 
-     if (RemoteFD >= 0) {
-         send(RemoteFD, "?", 1, MSG_OOB);
--        z = write(RemoteFD, buffer, p-buffer);
-+        (void)write(RemoteFD, buffer, p-buffer);
-         shutdown(RemoteFD, SHUT_WR);
-         timeout_set(ERROR_TIMEOUT, sig_alrm_die);
-         while (read(RemoteFD, buffer, sizeof(buffer)) > 0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/rds-tools.license	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,36 @@
+In accordance with the terms of the Open Fabric Enterprise Distribution 
+licensing scheme as appears below, Oracle is hereby making the election 
+to license rds-tools-2.0.7 under the OpenIB.org BSD license.
+
+Copyright (c) 2006 Oracle.  All rights reserved.
+Copyright (C) 2008 Oracle.  All rights reserved.
+Copyright (c) 2008 Chelsio, Inc. All rights reserved.
+
+
+* This software is available to you under a choice of one of two
+* licenses. You may choose to be licensed under the terms of the GNU
+* General Public License (GPL) Version 2, available from the file
+* COPYING in the main directory of this source tree, or the
+* OpenIB.org BSD license below:
+*
+* Redistribution and use in source and binary forms, with or
+* without modification, are permitted provided that the following
+* conditions are met:
+*
+* - Redistributions of source code must retain the above
+* copyright notice, this list of conditions and the following
+* disclaimer.
+*
+* - Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/rds-tools/patches/001-rds-tools-solaris_port.patch	Fri Apr 01 15:20:17 2016 -0700
@@ -0,0 +1,2853 @@
+#This patch was developed both in-house and from outside. We plan to submit it
+#upstream, but do not yet have a target date for doing so
+#
+# HG changeset patch
+# Parent  1afa90e87b4b0fcc3ccef29f1029fa7d1628f389
+
+diff -r 1afa90e87b4b Makefile.in
+--- a/Makefile.in	Tue Feb 23 22:30:57 2016 -0800
++++ b/Makefile.in	Tue Feb 23 22:30:58 2016 -0800
+@@ -4,18 +4,22 @@
+ mandir		= $(DESTDIR)@mandir@
+ incdir		= $(DESTDIR)@includedir@
+ 
++CC=gcc
++
+ all: all-programs
+ 
+-CFLAGS = -O2 -Wall -Iinclude
+-CPPFLAGS = -DDEBUG_EXE -DRDS_VERSION=\"@VERSION@\" -MD -MP -MF $(@D)/.$(basename $(@F)).d
++CFLAGS += -O2 -Wall -Iinclude
++CPPFLAGS += -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ \
++	-DDEBUG_EXE -DRDS_VERSION=\"@VERSION@\" -MD -MP -MF $(@D)/.$(basename $(@F)).d
++LDFLAGS += -libverbs -lsocket -lnsl -llgrp
+ 
+ HEADERS = kernel-list.h pfhack.h include/rds.h
+-COMMON_SOURCES = pfhack.c
++COMMON_SOURCES = pfhack.c rds-vendor.c
+ SOURCES = $(addsuffix .c,$(PROGRAMS)) $(COMMON_SOURCES)
+ CLEAN_OBJECTS = $(addsuffix .o,$(PROGRAMS)) $(subst .c,.o,$(COMMON_SOURCES))
+ 
+ # This is the default
+-DYNAMIC_PF_RDS = true
++#DYNAMIC_PF_RDS = true
+ 
+ ifneq ($(DYNAMIC_PF_RDS),)
+ CPPFLAGS += -DDYNAMIC_PF_RDS
+@@ -29,14 +33,14 @@
+ all-programs: $(PROGRAMS)
+ 
+ install: $(PROGRAMS)
+-	install -d $(bindir)
+-	install -m 555 -s $(PROGRAMS) $(bindir)
+-	install -d $(mandir)/man1
+-	install -d $(mandir)/man7
+-	install -m 644 *.1 $(mandir)/man1
+-	install -m 644 *.7 $(mandir)/man7
+-	install -d $(incdir)/net
+-	install -m 444 include/rds.h $(incdir)/net
++	$(INSTALL) -d $(bindir)
++	$(INSTALL) -m 755 -s $(PROGRAMS) $(bindir)
++	$(INSTALL) -d $(mandir)/man1
++	$(INSTALL) -d $(mandir)/man7
++	$(INSTALL) -m 644 *.1 $(mandir)/man1
++	$(INSTALL) -m 644 *.7 $(mandir)/man7
++	$(INSTALL) -d $(incdir)/net
++	$(INSTALL) -m 444 include/rds.h $(incdir)/net
+ 
+ clean:
+ 	rm -f $(PROGRAMS) $(CLEAN_OBJECTS)
+@@ -47,7 +51,7 @@
+ 
+ 
+ $(PROGRAMS) : % : %.o $(COMMON_OBJECTS)
+-	gcc $(CFLAGS) $(LDFLAGS) -o $@ $^
++	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^
+ 
+ LOCAL_DFILES := $(wildcard .*.d)
+ ifneq ($(LOCAL_DFILES),)
+@@ -72,8 +76,6 @@
+ 		configure \
+ 		README \
+ 		rds-tools.txt \
+-		stap/rds.stp \
+-		stap/README \
+ 		docs/rds-architecture.txt \
+ 		examples/Makefile \
+ 		examples/rds-sample.c \
+diff -r 1afa90e87b4b configure
+--- a/configure	Tue Feb 23 22:30:57 2016 -0800
++++ b/configure	Tue Feb 23 22:30:58 2016 -0800
+@@ -1215,7 +1215,7 @@
+ 
+ 
+ 
+-VERSION=2.0.4
++VERSION=2.0.7
+ RELEASE=1
+ 
+ 
+diff -r 1afa90e87b4b configure.in
+--- a/configure.in	Tue Feb 23 22:30:57 2016 -0800
++++ b/configure.in	Tue Feb 23 22:30:58 2016 -0800
+@@ -1,7 +1,7 @@
+ AC_PREREQ(2.55)
+ AC_INIT()
+ 
+-VERSION=2.0.4
++VERSION=2.0.7
+ RELEASE=1
+ 
+ AC_SUBST(VERSION)
+diff -r 1afa90e87b4b examples/Makefile
+--- a/examples/Makefile	Tue Feb 23 22:30:57 2016 -0800
++++ b/examples/Makefile	Tue Feb 23 22:30:58 2016 -0800
+@@ -1,6 +1,12 @@
++CC=gcc
++LIBS = -lsocket -lnsl
++CPPFLAGS += -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
+ 
+ all: rds-sample
+ 
+-rds-sample: rds-sample.o
++rds-sample: rds-sample.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -o rds-sample rds-sample.c $(LIBS)
+ 
+-CFLAGS = -I ../include
++clean:
++	rm -rf rds-sample
++
+diff -r 1afa90e87b4b examples/rds-sample.c
+--- a/examples/rds-sample.c	Tue Feb 23 22:30:57 2016 -0800
++++ b/examples/rds-sample.c	Tue Feb 23 22:30:58 2016 -0800
+@@ -26,6 +26,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ /* FIXME - this is a hack to getaround RDS not exporting any header files.
+  * This is a local copy of the file found at net/rds/
+  */
+@@ -33,6 +34,9 @@
+ /* These are defined in rds.h....but that file is not happily included */
+ #define SOL_RDS		272
+ #define PF_RDS		28
++#else
++#include <sys/rds.h>
++#endif
+ 
+ 
+ #define TESTPORT	4000
+@@ -107,12 +111,12 @@
+ 	cmsg->cmsg_type = RDS_CMSG_RDMA_ARGS;
+ 	cmsg->cmsg_len = CMSG_LEN(sizeof(struct rds_rdma_args));
+ 
+-	iov.addr = (uint64_t) buf;
++	iov.addr = (uint64_t)(uintptr_t)buf;
+ 	iov.bytes = sizeof(struct rdss_message);
+ 
+ 	args->remote_vec.addr = 0;
+ 	args->remote_vec.bytes = sizeof(struct rdss_message);
+-	args->local_vec_addr = (uint64_t) &iov;
++	args->local_vec_addr = (uint64_t)(uintptr_t)&iov;
+ 	args->nr_local = 1;
+ 	args->flags = remote_flags ? (RDS_RDMA_READWRITE | RDS_RDMA_FENCE) : 0;
+ 	args->flags |= RDS_RDMA_NOTIFY_ME;
+@@ -244,9 +248,9 @@
+ 	void *ctlbuf;
+ 	struct iovec *iov;
+ 
+-	mr_args.vec.addr = (uint64_t) buf;
++	mr_args.vec.addr = (uint64_t)(uintptr_t)buf;
+ 	mr_args.vec.bytes = sizeof(struct rdss_message);
+-	mr_args.cookie_addr = (uint64_t) cookie;
++	mr_args.cookie_addr = (uint64_t)(uintptr_t)cookie;
+ 	mr_args.flags = RDS_RDMA_USE_ONCE;
+ 
+ 	ctlbuf = calloc(1, CMSG_SPACE(sizeof(mr_args)));
+diff -r 1afa90e87b4b include/rds.h
+--- a/include/rds.h	Tue Feb 23 22:30:57 2016 -0800
++++ b/include/rds.h	Tue Feb 23 22:30:58 2016 -0800
+@@ -84,6 +84,8 @@
+ #define RDS_CMSG_CONG_UPDATE		5
+ #define RDS_CMSG_ATOMIC_FADD		6
+ #define RDS_CMSG_ATOMIC_CSWP		7
++#define	RDS_CMSG_MASKED_ATOMIC_FADD	8
++#define	RDS_CMSG_MASKED_ATOMIC_CSWP	9
+ 
+ #define RDS_INFO_FIRST			10000
+ #define RDS_INFO_COUNTERS		10000
+@@ -252,8 +254,25 @@
+ 	rds_rdma_cookie_t cookie;
+ 	uint64_t 	local_addr;
+ 	uint64_t 	remote_addr;
+-	uint64_t	swap_add;
+-	uint64_t	compare;
++	union {
++		struct {
++			uint64_t	compare;
++			uint64_t	swap;
++		} cswp;
++		struct {
++			uint64_t	add;
++		} fadd;
++		struct {
++			uint64_t	compare;
++			uint64_t	swap;
++			uint64_t	compare_mask;
++			uint64_t	swap_mask;
++		} m_cswp;
++		struct {
++			uint64_t	add;
++			uint64_t	nocarry_mask;
++		} m_fadd;
++	};
+ 	u_int64_t	flags;
+ 	u_int64_t	user_token;
+ };
+@@ -278,5 +297,6 @@
+ #define RDS_RDMA_USE_ONCE	0x0008	/* free MR after use */
+ #define RDS_RDMA_DONTWAIT	0x0010	/* Don't wait in SET_BARRIER */
+ #define RDS_RDMA_NOTIFY_ME	0x0020	/* Notify when operation completes */
++#define RDS_RDMA_SILENT		0x0040	/* Do not interrupt remote */
+ 
+ #endif /* IB_RDS_H */
+diff -r 1afa90e87b4b pfhack.h
+--- a/pfhack.h	Tue Feb 23 22:30:57 2016 -0800
++++ b/pfhack.h	Tue Feb 23 22:30:58 2016 -0800
+@@ -44,9 +44,11 @@
+ #ifndef __PF_HACK_H
+ #define __PF_HACK_H
+ 
++#if !((defined(__SVR4) && defined(__sun)))
+ #define PF_RDS		21
+ #define AF_RDS		21
+ #define SOL_RDS		276
++#endif
+ 
+ extern int discover_pf_rds();
+ extern int discover_sol_rds();
+diff -r 1afa90e87b4b rds-info.1
+--- a/rds-info.1	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-info.1	Tue Feb 23 22:30:58 2016 -0800
+@@ -1,162 +1,160 @@
+-.Dd October 30, 2006
+-.Dt RDS-INFO 1
+-.Os
+-.Sh NAME
+-.Nm rds-info
+-.Nd display information from the RDS kernel module
+-.Pp
+-.Sh SYNOPSIS
+-.Nm rds-info
+-.Op Fl v
+-.Bk -words
+-.Op Fl cknrstIT
++.TH RDS-INFO 1 "October 30, 2006"
++.SH "NAME"
++rds-info - display information from the RDS kernel module
++.SH SYNOPSIS
++.B rds-info [-cknrstIT]
+ 
+-.Sh DESCRIPTION
+-The
+-.Nm
+-utility presents various sources of information that
++.SH DESCRIPTION
++.PP
++The utility presents various sources of information that
+ the RDS kernel module maintains.  When run without any optional arguments
+-.Nm
+ will output all the information it knows of.  When options are specified then
+ only the information associated with those options is displayed.
+ 
+ The options are as follows:
+-.Bl -tag -width Ds
+-.It Fl v
++.SH OPTIONS
++.PP
++.TP 7
++\fB\-v
+ Requests verbose output. When this option is given, some classes of information
+ will display additional data.
+ 
+-.It Fl c
++.TP
++\fB\-c
+ Display global counters.  Each counter increments as its event
+ occurs.  The counters may not be reset.  The set of supported counters
+ may change over time.
+ 
+-.Bl -tag -width 4
+-.It CounterName
++.IP	CounterName
+ The name of the counter.  These names come from the kernel and can change
+ depending on the capability of the kernel module.
+-.It Value
++.IP 	Value
+ The number of times that the counter has been incremented since the kernel
+ module was loaded.
+-.El
+ 
+-.It Fl k
++.TP
++\fB\-k\fR
+ Display all the RDS sockets in the system.  There will always be one socket
+ listed that is neither bound to nor connected to any addresses because
+-.Nm
+ itself uses an unbound socket to collect information.
+ 
+-.Bl -tag -width 4
+-.It BoundAddr, BPort
++.IP	BoundAddr, BPort
+ The IP address and port that the socket is bound to.  0.0.0.0 0 indicates that
+ the socket has not been bound.
+-.It ConnAddr, CPort
++.IP	ConnAddr, CPort
+ The IP address and port that the socket is connected to.  0.0.0.0 0 indicates
+ that the socket has not been connected.
+-.It SndBuf, RcvBuf
++.IP	SndBuf, RcvBuf
+ The number of bytes of message payload which can be queued for sending or
+ receiving on the socket, respectively.
+-.It Inode
++.IP	Inode
+ The number of the inode object associated with the socket. Can be used to
+ locate the process owning a given socket by searching /proc/*/fd for
+ open files referencing a socket with this inode number.
+-.El
+ 
+-.It Fl n
++.TP
++\fB\-n\fR
+ Display all RDS connections.  RDS connections are maintained between
+ nodes by transports.  
+ 
+-.Bl -tag -width 4
+-.It LocalAddr
++.IP	LocalAddr
+ The IP address of this node.  For connections that originate and terminate on
+ the same node the local address indicates which address initiated the
+ connection establishment.
+-.It RemoteAddr
++.IP	RemoteAddr
+ The IP address of the remote end of the connection.  
+-.It NextTX
++.IP	Tos
++The type of service value for this connection.
++.IP	NextTX
+ The sequence number that will be given to the next message that is sent
+ over the connection.
+-.It NextRX
++.IP	NextRX
+ The sequence number that is expected from the next message to arrive over
+ the connection.  Any incoming messages with sequence numbers less than this
+ will be dropped.
+-.It Flg
++.IP	Flg
+ Flags which indicate the state of the connection. 
+-.Bl -tag -width 4
+-.It s
+-A process is currently sending a message down the connection.
+-.It c
+-The transport is attempting to connect to the remote address.
+-.It C
+-The connection to the remote host is connected and active.
+-.El
+-.El
+ 
+-.It Fl r, Fl s, Fl t
++.IP 		s
++	A process is currently sending a message down
++	the connection.
++.IP 		c
++	The transport is attempting to connect to the
++	remote address.
++.IP 		C
++	The connection to the remote host is connected
++	and active.
++.IP 		E
++	The connection to the remote host is in error.
++
++.TP
++\fB\-r\fR, \fB\-s\fR, \fB\-t\fR
+ Display the messages in the receive, send, or retransmit queues respectively.
+-.Bl -tag -width 4
+-.It LocalAddr, LPort
++
++.IP	LocalAddr, LPort
+ The local IP address and port on this node associated with the message. For
+ sent messages this is the source address, for receive messages it is the
+ destination address.
+-.It RemoteAddr, RPort
++.IP	RemoteAddr, RPort
+ The remote IP address and port associated with the message. For sent messages
+ this is the destination address, for receive messages it is the source address.
+-.It Seq
++.IP	Tos
++The type of service for this message.
++.IP	Seq
+ The sequence number of the message.
+-.It Bytes
++.IP	Bytes
+ The number of bytes in the message payload.
+-.El
+ 
++
++.PP
+ The following information sources are dependent on specific transports which
+ may not always be available. 
+ 
+-.It Fl I
++.TP 7
++\fB\-I\fR
+ Display the IB connections which the IB transport is using to provide
+ RDS connections.
+ 
+-.Bl -tag -width 4
+-.It LocalAddr
++.IP	LocalAddr
+ The local IP address of this connection.
+-.It RemoteAddr
++.IP	RemoteAddr
+ The remote IP address of this connection.
+-.It LocalDev
++.IP	Tos
++The type of service value for this connection.
++.IP	SL
++The QoS Service Level for this connection.
++.IP	LocalDev
+ The local IB Global Identifier, printed in IPv6 address syntax.
+-.It RemoteDev
++.IP	RemoteDev
+ The remote IB Global Identifier, printed in IPv6 address syntax.
+-.El
+ 
+ If verbose output is requested, per-connection settings such as the
+ maximum number of send and receive work requests will be displayed
+ in addition.
+ 
+-.It Fl T
++.TP 7
++\fB\-T\fR
+ Display the TCP sockets which the TCP transport is using to provide
+ RDS connections.
+ 
+-.Bl -tag -width 4
+-.It LocalAddr, LPort
++.IP	LocalAddr, LPort
+ The local IP address and port of this socket.
+-.It RemoteAddr, RPort
++.IP	RemoteAddr, RPort
+ The remote IP address and port that this socket is connected to.
+-.It HdrRemain
++.IP	HdrRemain
+ The number of bytes that must be read off the socket to complete the next
+ full RDS header.
+-.It DataRemain
++.IP	DataRemain
+ The number of bytes that must be read off the socket to complete the data
+ payload of the message which is being received.
+-.It SentNxt
++.IP	SentNxt
+ The TCP sequence number of the first byte of the last message that we sent
+ down the connection.
+-.It ExpectedUna
++.IP	ExpectedUna
+ The TCP sequence number of the byte past the last byte of the last message
+ that we sent down the connection.  When we see that the remote side has
+ acked up to this byte then we know that the remote side has received all
+ our RDS messages.
+-.It SeenUna
++.IP	SeenUna
+ The TCP sequence number of the byte past the last byte which has been
+ acked by the remote host.
+-.El
+-
+-.El
+-.Pp
+diff -r 1afa90e87b4b rds-info.c
+--- a/rds-info.c	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-info.c	Tue Feb 23 22:30:58 2016 -0800
+@@ -42,16 +42,28 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <errno.h>
++#if defined(__SVR4) && defined(__sun)
++#include <strings.h>
++#else
+ #include <string.h>
++#endif
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <sys/rds.h>
++#include <infiniband/ofa_solaris.h>
++#else
+ #include "rds.h"
++#endif
+ #include "pfhack.h"
+ 
++/* WHUPS changed the struct rds_info_connection definition b/w rds in 1.4 & 1.5. gotta support both
++   for now. TODO remove check of transport[15] once ofed pre-1.5 is extinct. */
+ #define rds_conn_flag(conn, flag, letter) \
+-	(conn.flags & RDS_INFO_CONNECTION_FLAG_##flag ? letter : '-')
++	(conn.flags & RDS_INFO_CONNECTION_FLAG_##flag \
++	|| conn.transport[15] & RDS_INFO_CONNECTION_FLAG_##flag ? letter : '-')
+ 
+ #define min(a, b) (a < b ? a : b)
+ #define array_size(foo) (sizeof(foo) / sizeof(foo[0]))
+@@ -76,6 +88,10 @@
+ 
+ char *progname = "rds-info";
+ 
++#if defined(__SVR4) && defined(__sun)
++int sol_ioctl(int, int, struct rds_info_arg *, socklen_t *, int *);
++#endif
++
+ /* Like inet_ntoa, but can be re-entered several times without clobbering
+  * the previously returned string. */
+ static const char *paddr(int af, const void *addrp)
+@@ -134,18 +150,20 @@
+ {
+ 	struct rds_info_connection conn;
+ 
+-	printf("\nRDS Connections:\n%15s %15s %16s %16s %3s\n",
+-		"LocalAddr", "RemoteAddr", "NextTX", "NextRX", "Flg");
++	printf("\nRDS Connections:\n%15s %15s %4s %16s %16s %4s\n",
++		"LocalAddr", "RemoteAddr", "Tos", "NextTX", "NextRX", "Flgs");
+ 	
+ 	for_each(conn, data, each, len) {
+-		printf("%15s %15s %16"PRIu64" %16"PRIu64" %c%c%c\n",
++		printf("%15s %15s %4u %16"PRIu64" %16"PRIu64" %c%c%c%c\n",
+ 			ipv4addr(conn.laddr),
+ 			ipv4addr(conn.faddr),
++			conn.tos,
+ 			conn.next_tx_seq,
+ 			conn.next_rx_seq,
+ 			rds_conn_flag(conn, SENDING, 's'),
+ 			rds_conn_flag(conn, CONNECTING, 'c'),
+-			rds_conn_flag(conn, CONNECTED, 'C'));
++			rds_conn_flag(conn, CONNECTED, 'C'),
++			rds_conn_flag(conn, ERROR, 'E'));
+ 	}
+ }
+ 
+@@ -153,16 +171,17 @@
+ {
+ 	struct rds_info_message msg;
+ 
+-	printf("\n%s Message Queue:\n%15s %5s %15s %5s %16s %10s\n",
++	printf("\n%s Message Queue:\n%15s %5s %15s %5s %4s %16s %10s\n",
+ 		(char *)extra,
+-		"LocalAddr", "LPort", "RemoteAddr", "RPort", "Seq", "Bytes");
++		"LocalAddr", "LPort", "RemoteAddr", "RPort", "Tos","Seq", "Bytes");
+ 	
+ 	for_each(msg, data, each, len) {
+-		printf("%15s %5u %15s %5u %16"PRIu64" %10u\n",
++		printf("%15s %5u %15s %5u %4u %16"PRIu64" %10u\n",
+ 			ipv4addr(msg.laddr),
+ 			ntohs(msg.lport),
+ 			ipv4addr(msg.faddr),
+ 			ntohs(msg.fport),
++			msg.tos,
+ 			msg.seq, msg.len);
+ 	}
+ }
+@@ -191,13 +210,14 @@
+ {
+ 	struct rds_info_rdma_connection ic;
+ 
+-	printf("\nRDS IB Connections:\n%15s %15s %32s %32s\n",
+-		"LocalAddr", "RemoteAddr", "LocalDev", "RemoteDev");
++	printf("\nRDS IB Connections:\n%15s %15s %4s %3s %32s %32s\n",
++		"LocalAddr", "RemoteAddr", "Tos", "SL", "LocalDev", "RemoteDev");
+ 
+ 	for_each(ic, data, each, len) {
+-		printf("%15s %15s %32s %32s",
++		printf("%15s %15s %4u %3u %32s %32s",
+ 			ipv4addr(ic.src_addr),
+ 			ipv4addr(ic.dst_addr),
++			ic.tos,ic.sl,
+ 			ipv6addr(ic.src_gid),
+ 			ipv6addr(ic.dst_gid));
+ 
+@@ -234,8 +254,10 @@
+ 		print_msgs, "Send", 0 },
+ 	['t'] = { RDS_INFO_RETRANS_MESSAGES, "retransmit queue messages",
+ 		  print_msgs, "Retransmit", 0 },
++#if !(defined(__SVR4) && defined(__sun))
+ 	['T'] = { RDS_INFO_TCP_SOCKETS, "TCP transport sockets",
+ 		  print_tcp_socks, NULL, 0 },
++#endif
+ 	['I'] = { RDS_INFO_IB_CONNECTIONS, "IB transport connections",
+ 		  print_ib_conns, NULL, 0 },
+ };
+@@ -266,6 +288,9 @@
+ 	char optstring[258] = "v+";
+ 	int given_options = 0;
+ 	socklen_t len = 0;
++#if defined(__SVR4) && defined(__sun)
++	struct rds_info_arg arg;
++#endif
+ 	void *data = NULL;
+ 	int fd;
+ 	int each;
+@@ -322,6 +347,7 @@
+ 		    (given_options && !infos[i].option_given))
+ 			continue;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 		/* read in the info until we get a full snapshot */
+ 		while ((each = getsockopt(fd, sol, infos[i].opt_val, data,
+ 				   &len)) < 0) {
+@@ -345,15 +371,47 @@
+ 				return 1;
+ 			}
+ 		}
++#else
++		int retcode;
++
++		retcode = sol_ioctl(fd, infos[i].opt_val, &arg, &len, &each);
++		if (retcode != 0) {
++			if (retcode == 1) {
++				fprintf(stderr, "%s: Unable get statistics: "
++				    "%s\n", progname, strerror(errno));
++				return 1;
++			} else if (retcode == 2) {
++				fprintf(stderr, "%s: Unable to allocate memory"
++				    " for %u bytes of info: %s\n",
++				    progname, len, strerror(errno));
++				return 1;
++			} else {
++				fprintf(stderr, "%s: Unable to get statistics:"
++				    " %s\n", progname, strerror(errno));
++				return 1;
++			}
++		}
++
++		/* No data at the driver */
++		if (len == 0)
++			invalid_opt = 1;;
++#endif
+ 
+ 		if (invalid_opt)
+ 			continue;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 		infos[i].print(data, each, len, infos[i].extra);
+-
++#else
++		infos[i].print((void *)(uintptr_t)arg.datap, each, len,
++		    infos[i].extra);
++#endif
+ 		if (given_options && --given_options == 0)
+ 			break;
+ 	}
++#if defined(__SVR4) && defined(__sun)
++	free((void *)(uintptr_t)arg.datap);
++#endif
+ 
+ 	return 0;
+ }
+diff -r 1afa90e87b4b rds-ping.1
+--- a/rds-ping.1	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-ping.1	Tue Feb 23 22:30:58 2016 -0800
+@@ -1,69 +1,63 @@
+-.Dd Apr 22, 2008
+-.Dt RDS-PING 1
+-.Os
+-.Sh NAME
+-.Nm rds-ping
+-.Nd test reachability of remote node over RDS
+-.Pp
+-.Sh SYNOPSIS
+-.Nm rds-ping
+-.Bk -words
+-.Op Fl c Ar count
+-.Op Fl i Ar interval
+-.Op Fl I Ar local_addr
+-.Ar remote_addr
++.TH RDS-PING 1 "Apr 22, 2008"
++.SH NAME
++rds-ping - test reachability of remote node over RDS
+ 
+-.Sh DESCRIPTION
+-.Nm rds-ping
+-is used to test whether a remote node is reachable over RDS.
+-Its interface is designed to operate pretty much the standard
+-.Xr ping 8
++.SH SYNOPSIS
++.HP
++.nf
++rds-ping [-c count] [-Q tos] [-i interval] [-I local_addr]
++    remote_addr
++.fi
++
++.SH DESCRIPTION
++.PP
++rds-ping is used to test whether a remote node is reachable over RDS.
++Its interface is designed to operate pretty much the standard ping(1M) 
+ utility, even though the way it works is pretty different.
+-.Pp
+-.Nm rds-ping
+-opens several RDS sockets and sends packets to port 0 on
++.PP
++rds-ping opens several RDS sockets and sends packets to port 0 on
+ the indicated host. This is a special port number to which
+ no socket is bound; instead, the kernel processes incoming
+ packets and responds to them.
+-.Sh OPTIONS
++.SH OPTIONS
+ The following options are available for use on the command line:
+-.Bl -tag -width Ds
+-.It Fl c Ar count
+-Causes
+-.Nm rds-ping
+-to exit after sending (and receiving) the specified number of
++.PP
++.TP 7
++\fB\-c count
++Causes rds-ping to exit after sending (and receiving) the specified number of
+ packets.
+-.It Fl I Ar address
+-By default,
+-.Nm rds-ping
+-will pick the local source address for the RDS socket based
++.TP
++\fB\-Q tos
++By default, rds-ping sends the ping requests on base (tos = 0) RDS connection.
++With this option, the requests are sent on RDS connection with the specified tos
++value.  Valid values are 0-255.
++.TP
++\fB\-I address
++By default, rds-ping will pick the local source address for the RDS socket based
+ on routing information for the destination address (i.e. if
+ packets to the given destination would be routed through interface
+-.Nm ib0 ,
++ib0 ,
+ then it will use the IP address of
+-.Nm ib0
++ib0
+ as source address).
+ Using the
+ .Fl I
+ option, you can override this choice.
+-.It Fl i Ar timeout
+-By default,
+-.Nm rds-ping
+-will wait for one second between sending packets. Use this option
++.TP
++\fB\-i timeout
++By default, rds-ping will wait for one second between sending packets. Use this option
+ to specified a different interval. The timeout value is given in
+ seconds, and can be a floating point number. Optionally, append
+-.Nm msec
++msec
+ or
+-.Nm usec
++usec
+ to specify a timeout in milliseconds or microseconds, respectively.
+-.It
++.IP
+ Specifying a timeout considerably smaller than the packet round-trip
+ time will produce unexpected results.
+-.El
+-.Sh AUTHORS
+-.Nm rds-ping
++
++.SH AUTHORS
++rds-ping
+ was written by Olaf Kirch <[email protected]>.
+-.Sh SEE ALSO
+-.Xr rds 7 ,
+-.Xr rds-info 1 ,
+-.Xr rds-stress 1 .
++.S~ SEE ALSO
++rds 7, rds-info 1, rds-stress 1.
+diff -r 1afa90e87b4b rds-ping.c
+--- a/rds-ping.c	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-ping.c	Tue Feb 23 22:30:58 2016 -0800
+@@ -48,7 +48,12 @@
+ #include <sys/poll.h>
+ #include <fcntl.h>
+ #include <getopt.h>
++#include <sys/ioctl.h>
++#if defined(__SVR4) && defined(__sun)
++#include <sys/rds.h>
++#else
+ #include "rds.h"
++#endif
+ 
+ #include "pfhack.h"
+ 
+@@ -67,6 +72,7 @@
+ static unsigned long	opt_count;
+ static struct in_addr	opt_srcaddr;
+ static struct in_addr	opt_dstaddr;
++static uint8_t		opt_tos = 0;
+ 
+ /* For reasons of simplicity, RDS ping does not use a packet
+  * payload that is being echoed, the way ICMP does.
+@@ -91,13 +97,14 @@
+ static int	parse_timeval(const char *, struct timeval *);
+ static int	parse_long(const char *ptr, unsigned long *);
+ static int	parse_addr(const char *ptr, struct in_addr *);
++static unsigned long long	parse_ull(char *ptr, unsigned long long max);
+ 
+ int
+ main(int argc, char **argv)
+ {
+ 	int c;
+ 
+-	while ((c = getopt(argc, argv, "c:i:I:")) != -1) {
++	while ((c = getopt(argc, argv, "c:i:I:Q:")) != -1) {
+ 		switch (c) {
+ 		case 'c':
+ 			if (!parse_long(optarg, &opt_count))
+@@ -114,6 +121,9 @@
+ 				die("Bad wait time <%s>\n", optarg);
+ 			break;
+ 
++		case 'Q':
++			opt_tos = parse_ull(optarg, 255);
++			break;
+ 		default:
+ 			usage("Unknown option");
+ 		}
+@@ -142,6 +152,9 @@
+ 	struct timeval	next_ts;
+ 	struct socket	socket[NSOCKETS];
+ 	struct pollfd	pfd[NSOCKETS];
++#if !(defined(__SVR4) && defined(__sun))
++	int             pending[NSOCKETS];
++#endif
+ 	int		i, next = 0;
+ 
+ 	for (i = 0; i < NSOCKETS; ++i) {
+@@ -152,10 +165,18 @@
+ 		socket[i].fd = fd;
+ 		pfd[i].fd = fd;
+ 		pfd[i].events = POLLIN;
++#if !(defined(__SVR4) && defined(__sun))
++		pending[i] = 0;
++#endif
+ 	}
+ 
+ 	memset(&sin, 0, sizeof(sin));
++#if defined(__SVR4) && defined(__sun)
++	sin.sin_family = AF_INET_OFFLOAD;
++#else
+ 	sin.sin_family = AF_INET;
++#endif
++
+ 	sin.sin_addr = opt_dstaddr;
+ 
+ 	gettimeofday(&next_ts, NULL);
+@@ -180,13 +201,31 @@
+ 			if (opt_count && sent >= opt_count)
+ 				break;
+ 
+-			timeradd(&next_ts, &opt_wait, &next_ts);
+-			if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)))
+-				err = errno;
+-			sp->sent_id = ++sent;
+-			sp->sent_ts = now;
+-			sp->nreplies = 0;
+-			next = (next + 1) % NSOCKETS;
++			timeradd(&now, &opt_wait, &next_ts);
++#if !(defined(__SVR4) && defined(__sun))
++			if (!pending[next]) {
++#endif
++				memset(&sin, 0, sizeof(sin));
++#if defined(__SVR4) && defined(__sun)
++				sin.sin_family = AF_INET_OFFLOAD;
++#else
++				sin.sin_family = AF_INET;
++#endif
++				sin.sin_addr = opt_dstaddr;
++
++				if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)) < 0)
++					err = errno;
++				sp->sent_id = ++sent;
++				sp->sent_ts = now;
++				sp->nreplies = 0;
++#if !(defined(__SVR4) && defined(__sun))
++				if (!err)
++					pending[next] = 1;
++#endif
++				next = (next + 1) % NSOCKETS;
++#if !(defined(__SVR4) && defined(__sun))
++			}
++#endif
+ 
+ 			if (err) {
+ 				static unsigned int nerrs = 0;
+@@ -223,6 +262,9 @@
+ 					report_packet(sp, &now, NULL, errno);
+ 			} else {
+ 				report_packet(sp, &now, &from.sin_addr, 0);
++#if !(defined(__SVR4) && defined(__sun))
++				pending[i] = 0;
++#endif
+ 				recv++;
+ 			}
+ 		}
+@@ -258,7 +300,11 @@
+ 	int pf;
+ 
+ 	memset(&sin, 0, sizeof(sin));
++#if defined(__SVR4) && defined(__sun)
++	sin.sin_family = AF_INET_OFFLOAD;
++#else
+ 	sin.sin_family = AF_INET;
++#endif
+ 
+ #ifdef DYNAMIC_PF_RDS
+         pf = discover_pf_rds();
+@@ -278,6 +324,9 @@
+ 		if (ufd < 0)
+ 			die_errno("unable to create UDP socket");
+ 		sin.sin_addr = *dst;
++#if defined(__SVR4) && defined(__sun)
++		sin.sin_family = AF_INET;
++#endif
+ 		sin.sin_port = htons(1);
+ 		if (connect(ufd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
+ 			die_errno("unable to connect to %s",
+@@ -289,6 +338,9 @@
+ 
+ 		*src = sin.sin_addr;
+ 		close(ufd);
++#if defined(__SVR4) && defined(__sun)
++		sin.sin_family = AF_INET_OFFLOAD;
++#endif
+ 	}
+ 
+ 	sin.sin_addr = *src;
+@@ -297,6 +349,9 @@
+ 	if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)))
+ 		die_errno("bind() failed");
+ 
++	if (opt_tos && ioctl(fd, SIOCRDSSETTOS, &opt_tos)) 
++		die_errno("ERROR: failed to set TOS\n");
++
+ 	return fd;
+ }
+ 
+@@ -309,7 +364,8 @@
+ 		"%s\nUsage: rds-ping [options] dst_addr\n"
+ 		"Options:\n"
+ 		" -c count      limit packet count\n"
+-		" -I interface  source IP address\n",
++		" -I interface  source IP address\n"
++		" -Q tos	type of service\n",
+ 		complaint);
+ 	exit(1);
+ }
+@@ -384,3 +440,31 @@
+ 	return 0;
+ }
+ 
++static unsigned long long parse_ull(char *ptr, unsigned long long max)
++{
++	unsigned long long val;
++	char *endptr;
++
++	val = strtoull(ptr, &endptr, 0);
++	switch (*endptr) {
++	case 'k': case 'K':
++		val <<= 10;
++		endptr++;
++		break;
++
++	case 'm': case 'M':
++		val <<= 20;
++		endptr++;
++		break;
++
++	case 'g': case 'G':
++		val <<= 30;
++		endptr++;
++		break;
++	}
++
++	if (*ptr && !*endptr && val <= max)
++		return val;
++
++	die("invalid number '%s'\n", ptr);
++}
+diff -r 1afa90e87b4b rds-stress.1
+--- a/rds-stress.1	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-stress.1	Tue Feb 23 22:30:58 2016 -0800
+@@ -1,119 +1,131 @@
+-.Dd May 15, 2007
+-.Dt RDS-STRESS 1
+-.Os
+-.Sh NAME
+-.Nm rds-stress
+-.Nd send messages between processes over RDS sockets
+-.Pp
+-.Sh SYNOPSIS
+-.Nm rds-stress
+-.Bk -words
+-.Op Fl p Ar port_number
+-.Op Fl r Ar receive_address
+-.Op Fl s Ar send_address
+-.Op Fl a Ar ack_bytes
+-.Op Fl q Ar request_bytes
+-.Op Fl D Ar rdma_bytes
+-.Op Fl d Ar queue_depth
+-.Op Fl t Ar nr_tasks
+-.Op Fl c
+-.Op Fl R
+-.Op Fl V
+-.Op Fl v
++.TH RDS-STRESS 1 " May 15, 2007"
++.SH "NAME"
++rds-stress - send messages between processes over RDS sockets
++.PP
++.SH SYNOPSIS
++.HP
++.nf
++rds-stress [-p port_number] -r [receive_address] [-s send_address]
++      [-Q tos] [-a ack_bytes] [-q request_bytes] [-D rdma_bytes]
++      [-d queue_depth] [-t nr_tasks] [-T time] [-c] [-R] [-V] [-v]
++.fi
+ 
+-.Sh DESCRIPTION
+-.Nm rds-stress
++
++.SH DESCRIPTION
++.PP
++.Nm
++rds-stress
+ sends messages between groups tasks, usually running on seperate
+ machines.
+-.Pp
++.PP
+ First a passive receiving instance is started.
+-.Pp
+-.Dl $ rds-stress
+-.Pp
++.RS 12
++
++	$ rds-stress
++.RE
++.PP
+ Then an active sending instance is started, giving it
+ the address and port at which it will find a listening
+ passive receiver.  In addition, it is given configuration options which
+ both instances will use.
+-.Pp
+-.Dl $ rds-stress -s recvhost -p 4000 -t 1 -d 1
+-.Pp
++.PP
++.RS 12
++	$ rds-stress -s recvhost -p 4000 -t 1 -d 1
++.RE
++.PP
+ The active sender will parse the options, connect to the passive receiver, and
+ send the options over this connection.  From this point on both instances
+ exhibit the exact same behaviour.
+-.Pp
++.PP
+ They will create a number of child tasks as specified by the -t option.  Once
+ the children are created the parent sleeps for a second at a time, printing a
+ summary of statistics at each interval. 
+-.Pp
++.PP
+ Each child will open an RDS socket, each binding to a port number in order
+ after the port number given on the command line.  The first child would bind to
+ port 4001 in our example.  Each child sets the send and receive buffers to
+ exactly fit the number of messages, requests and acks, that will be in flight
+ as determind by the command line arguments.
+-.Pp
++.PP
+ The children then enter their loop.  They will keep a number of sent messages
+ outstanding as specified by the -d option.  When they reach this limit they
+ will wait to receive acks which will allow them to send again.  As they receive
+ messages from their peers they immediately send acks.
+-.Pp
++.PP
+ Every second, the parent process will display statistics of the ongoing
+ stress test. The output is described in section OUTPUT below.
+-.Pp
++.PP
+ If the -T option is given, the test will terminate after the specified time,
+ and a summary is printed.
+-.Pp
++.PP
+ Each child maintains outstanding messages to all other children of the other instance.
+ They do not send to their siblings.
+-.Sh OPTIONS
++.SH OPTIONS
++.PP
+ The following options are available for use on the command line:
+-.Bl -tag -width Ds
+-.It Fl p Ar port_number
++
++.TP 7
++\fB\-p  port_number
+ Each parent binds a TCP socket to this port number and their respective
+ address.  They will trade the negotiated options over this socket.  Each
+ child will bind an RDS socket to the range of ports immediately following
+ this port number, for as many children as there are.
+-.It Fl s Ar send_address
++.TP
++\fB\-s send_address
+ A connection attempt is made to this address.  Once its complete and the
+ options are sent over it then children will be created and work will proceed.
+-.It Fl r Ar receive_address
++.TP
++\fB\-r receive_address
+ This specifies the address that messages will be sent from.  If -s is not
+ specified then rds-stress waits for a connection on this address before
+ proceeding.
+-.Pp
++
+ If this option is not given, rds-stress will choose an appropriate address.
+ The passive process will accept connections on all local interfaces, and
+ obtain the address once the control connection is established.
+ The active process will choose a local address based on the interface through
+ which it connects to the destination address.
+-.It Fl a Ar ack_bytes
++.TP
++\fB\-Q tos
++Uses the RDS connection between IP addresses with the specified tos value. By 
++default, the base (tos = 0) RDS connection is used.  Valid values are 0-255.
++.TP
++\fB\-a ack_bytes
+ This specifies the size of the ack messages, in bytes. There is a minimum size
+ which depends on the format of the ack messages, which may change over time.
+ See section "Message Sizes" below.
+-.It Fl q Ar request_bytes
++.TP
++\fB\-q request_bytes
+ This specifies the size of the request messages, in bytes.
+ It also has a minimum size which may change over time.
+ See section "Message Sizes" below.
+-.It Fl D Ar rdma_bytes
++.TP
++\fB\-D rdma_bytes
+ RDSv3 is capable of transmitting part of a message via RDMA directly from
+ application buffer to application buffer. This option enables RDMA support
+ in rds-stress: request packets include parameters for an RDMA READ or WRITE
+ operation, which the receiving process executes at the time the ACK packet
+ is sent.
+ See section "Message Sizes" below.
+-.It Fl d Ar queue_depth
++.TP
++\fB\-d queue_depth
+ Each child will try to maintain this many sent messages outstanding to each
+ of its peers on the remote address.
+-.It Fl t Ar nr_tasks
++.TP
++\fB\-t nr_tasks
+ Each parent will create this many children tasks.
+-.It Fl T Ar seconds
++.TP
++\fB\-T seconds
+ Specify the duration of the test run. After the specified number of seconds,
+ all processes on both ends of the connection will terminate, and the
+ active instance will print a summary. By default, rds-stress will keep
+ on sending and receiving messages.
+-.It Fl z
++.TP
++\fB\-z
+ This flag can be used in conjunction with -T. It suppresses the ongoing
+ display of statistics, and prints a summary only.
+-.It Fl c
++.TP
++\fB\-c
+ This causes rds-stress to create child tasks which just consume CPU cycles.
+ One task is created for each CPU in the system.  First each child observes the
+ maximum rate at which it can consume cycles.  This means that this option
+@@ -121,54 +133,70 @@
+ use of the system by observing the lesser rate at which the children consume
+ cycles.  This option is *not* shared between the active and passive instances.
+ It must be specified on each rds-stress command line.
+-.It Fl R
++.TP
++\fB\-R
+ This tells the rds-stress parent process to run with SCHED_RR priority,
+ giving it precedence over the child processes. This is useful when running
+ with lots of tasks, where there is a risk of the child processes starving
+ the parent, and skewing the results.
+-.It Fl v
++.TP
++\fB\-v
+ With this option enabled, packets are filled with a pattern that is
+ verified by the receiver. This check can help detect data corruption
+ occuring under high load.
+-.El
+-.Pp
++.TP
++.PP
+ 
+-.Ss Message Sizes
++.SS Message Sizes
+ Options which set a message size (such as -a) specify a number of bytes
+ by default. By appending \fBK\fP, \fBM\fP, or \fBG\fP, you can specify the size
+ in kilobytes, megabytes or gigabytes, respectively. For instance,
+ the following will run rds-stress with a message and ACK size of 1024
+ bytes, and an RDMA message size of 1048576 bytes:
+-.Pp
+-.Dl rds-stress ... -q 1K -a 1K -D 1M
+-.Pp
+-.Pp
+-.Sh OUTPUT
++.PP
++.RS 12
++rds-stress ... -q 1K -a 1K -D 1M
++.RE
++.PP
++.PP
++.SH OUTPUT
+ Each parent outputs columns of statistics at a regular interval:
+-.Bl -tag -width Ds
+-.It tsks
++.TP 8
++tsks
+ The number of child tasks which are running.
+-.It tx/s
++.TP
++tx/s
+ The number of sendmsg() calls that all children are executing, per second. 
+-.It tx+rx K/s
++.TP
++rx/s
++The number of recvmsg() calls that all children are executing, per second. 
++.TP
++tx+rx K/s
+ The total number of bytes that are flowing through sendmsg() and recvmsg() for all children.
+ This includes both request and ack messages.
+-.It rw+rr K/s
+-The total number of bytes that are being transferred via RDMA READs and
++.TP
++mbi K/s
++The total number of bytes that are being received via RDMA READs and
+ WRITEs for all children.
+-.It tx us/c
++.TP
++mbo K/s
++The total number of bytes that are being transmited via RDMA READs and
++WRITEs for all children.
++.TP
++tx us/c
+ The average number of microseconds spent in sendmsg() calls.
+-.It rtt us
++.TP
++rtt us
+ The average round trip time for a request and ack message pair.  This measures
+ the total time between when a task sends a request and when it finally receives
+ the ack for that message.  Because it includes the time it takes for the
+ receiver to wake up, receive the message, and send an ack, it can grow to be
+ quite large under load. 
+-.It cpu %
++.TP
++cpu %
+ This is the percentage of available CPU resources on this machine that are being
+ consumed since rds-stress started running.  It will show -1.00 if -c is not
+ given.  It is calculated based on the amount of CPU resources that CPU soaking
+ tasks are able to consume.  This lets it measure CPU use by the system, say in
+ interrupt handlers, that task-based CPU accounting does not include.
+ For this to work rds-stress must be started with -c on an idle system.
+-.El
+diff -r 1afa90e87b4b rds-stress.c
+--- a/rds-stress.c	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds-stress.c	Tue Feb 23 22:30:58 2016 -0800
+@@ -15,17 +15,38 @@
+ #include <sys/time.h>
+ #include <time.h>
+ #include <inttypes.h>
++#if defined(__SVR4) && defined(__sun)
++#include <sys/syscall.h>
++#include <signal.h>
++#include <sys/lgrp_user.h>
++#else
+ #include <syscall.h>
++#endif
+ #include <sys/stat.h>
+ #include <sys/poll.h>
+ #include <ctype.h>
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <getopt.h>
++#include <sys/ioctl.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
+ #include "rds.h"
+-
++#else
++#include <sys/rds.h>
++#endif
+ #include "pfhack.h"
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/ofa_solaris.h>
++#endif
++
++#if defined(__SVR4) && defined(__sun)
++/*
++ * This definition is forward looking and is not yet present
++ * in Solaris rds.h file
++ */
++#define RDS_CMSG_RDMA_SEND_STATUS RDS_CMSG_RDMA_STATUS
++#endif
+ 
+ /*
+  *
+@@ -45,8 +66,9 @@
+         M_RDMA_READ_ONLY,
+         M_RDMA_WRITE_ONLY
+ };
+-
+-struct options {
++#define VERSION_MAX_LEN 16 
++
++struct options_2_0_6 {
+ 	uint32_t	req_depth;
+ 	uint32_t	req_size;
+ 	uint32_t	ack_size;
+@@ -76,8 +98,67 @@
+ 	uint32_t	connect_retries;
+ } __attribute__((packed));
+ 
++struct options {
++	char		version[VERSION_MAX_LEN];
++        uint32_t        req_depth;
++        uint32_t        req_size;
++        uint32_t        ack_size;
++        uint32_t        rdma_size;
++        uint32_t        send_addr;
++        uint32_t        receive_addr;
++        uint16_t        starting_port;
++        uint16_t        nr_tasks;
++        uint32_t        run_time;
++        uint8_t         summary_only;
++        uint8_t         rtprio;
++        uint8_t         tracing;
++        uint8_t         verify;
++        uint8_t         show_params;
++        uint8_t         show_perfdata;
++        uint8_t         use_cong_monitor;
++        uint8_t         rdma_use_once;
++        uint8_t         rdma_use_get_mr;
++        uint8_t         rdma_use_fence;
++        uint8_t         rdma_cache_mrs;
++        uint8_t         rdma_key_o_meter;
++        uint8_t         suppress_warnings;
++        uint8_t         simplex;
++        uint8_t         rw_mode;
++        uint32_t        rdma_vector;
++        uint32_t        rdma_alignment;
++        uint32_t        connect_retries;
++        uint8_t         tos;
++        uint8_t         async;
++} __attribute__((packed));
++
++#define MAX_BUCKETS 16
++
+ static struct options	opt;
+ static int		control_fd;
++static uint64_t         rtt_threshold;
++static int              show_histogram;
++static int		reset_connection;
++static char		peer_version[VERSION_MAX_LEN];
++
++static int get_bucket(uint64_t rtt_time)
++{
++  int i;
++  uint64_t l_rtt_time = rtt_time;
++
++  if (!l_rtt_time)
++    i = 0;
++  else
++  {
++    i = -1;
++    while (l_rtt_time)
++    {
++      i++;
++      l_rtt_time = (l_rtt_time >> 1);
++    }
++  }
++
++  return i;
++}
+ 
+ struct counter {
+ 	uint64_t	nr;
+@@ -102,6 +183,10 @@
+ 
+ #define NR_STATS S__LAST
+ 
++#if defined(__SVR4) && defined(__sun)
++int sol_ioctl(int, int, struct rds_info_arg *, socklen_t *, int *);
++#endif
++
+ /*
+  * Parents share a mapped array of these with their children.  Each child
+  * gets one.  It's used to communicate between the child and the parent
+@@ -110,9 +195,11 @@
+ struct child_control {
+ 	pid_t pid;
+ 	int ready;
++	int stopping;
+ 	struct timeval start;
+ 	struct counter cur[NR_STATS];
+ 	struct counter last[NR_STATS];
++        uint64_t       latency_histogram[MAX_BUCKETS];
+ } __attribute__((aligned (256))); /* arbitrary */
+ 
+ struct soak_control {
+@@ -132,6 +219,7 @@
+  */
+ #define OP_REQ		1
+ #define OP_ACK		2
++#define OP_DUMP		3
+ 
+ #define RDMA_OP_READ	1
+ #define RDMA_OP_WRITE	2
+@@ -148,7 +236,7 @@
+ 	uint16_t	from_port;
+ 	uint16_t	to_port;
+ 	uint16_t	index;
+-	uint8_t		op;
++	uint8_t         op;
+ 
+ 	/* RDMA related.
+ 	 * rdma_op must be the first field, because we
+@@ -162,12 +250,21 @@
+ 	uint32_t	rdma_size;
+ 	uint32_t        rdma_vector;
+ 
+-	uint8_t		data[0];
++	/* Async send related. */
++	uint8_t         retry;
++	uint8_t         rdma_remote_err;
++	uint8_t         pending;
++
++	uint8_t         data[0];
+ } __attribute__((packed));
+ 
+ #define MIN_MSG_BYTES		(sizeof(struct header))
+ #define BASIC_HEADER_SIZE	(size_t)(&((struct header *) 0)->rdma_op)
+ 
++#define print_outlier(...) do {         \
++        fprintf(stderr, __VA_ARGS__);   \
++} while (0)
++
+ #define die(fmt...) do {		\
+ 	fprintf(stderr, fmt);		\
+ 	exit(1);			\
+@@ -254,6 +351,19 @@
+ 
+ 	die("invalid host name or dotted quad '%s'\n", ptr);
+ }
++#if defined(__SVR4) && defined(__sun)
++static lgrp_id_t lgrp_id = -1;
++
++static void
++set_my_lgrp(void)
++{
++	if (lgrp_id != -1) {
++		lgrp_affinity_set(P_LWPID, P_MYID, lgrp_id,
++			LGRP_AFF_STRONG);
++		yield(); /* force a context switch */
++	}
++}
++#endif
+ 
+ static void usage(void)
+ {
+@@ -273,6 +383,7 @@
+ 	" -d [depth, 1]     request pipeline depth, nr outstanding\n"
+ 	" -t [nr, 1]        number of child tasks\n"
+ 	" -T [seconds, 0]   runtime of test, 0 means infinite\n"
++	" -Q [tos, 0]       Type of Service\n"
+ 	" -D [bytes]        RDMA: size\n"
+ 	" -I [iovecs, 1]    RDMA: number of user buffers to target (max 512)\n"
+         " -M [nr, 0]        RDMA: mode (0=readwrite,1=readonly,2=writeonly)\n"
+@@ -281,6 +392,9 @@
+ 	" -c                measure cpu use with per-cpu soak processes\n"
+ 	" -V                trace execution\n"
+ 	" -z                print a summary at end of test only\n"
++#if defined(__SVR4) && defined(__sun)
++	" -g [lgrpid]       bind the process to the specified lgrp\n"
++#endif
+ 	"\n"
+ 	"Example:\n"
+ 	"  recv$ rds-stress\n"
+@@ -310,7 +424,7 @@
+ static void check_parent(pid_t pid)
+ {
+ 	if (pid != getppid())
+-		die("parent %u exited\n", pid);
++		die("parent %u exited\n", (int)pid);
+ }
+ 
+ /*
+@@ -334,6 +448,7 @@
+ 		msg_pattern[i] = k;
+ }
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define htonll(x)	bswap_64(x)
+ #define ntohll(x)	bswap_64(x)
+@@ -341,6 +456,7 @@
+ #define htonll(x)	(x)
+ #define ntohll(x)	(x)
+ #endif
++#endif /* Not sun */
+ 
+ static void encode_hdr(struct header *dst, const struct header *hdr)
+ {
+@@ -361,6 +477,7 @@
+ 	dst->rdma_key = htonll(hdr->rdma_key);
+ 	dst->rdma_size = htonl(hdr->rdma_size);
+ 	dst->rdma_vector = htonl(hdr->rdma_vector);
++	dst->retry = hdr->retry;
+ }
+ 
+ static void decode_hdr(struct header *dst, const struct header *hdr)
+@@ -382,6 +499,7 @@
+ 	dst->rdma_key = ntohll(hdr->rdma_key);
+ 	dst->rdma_size = ntohl(hdr->rdma_size);
+ 	dst->rdma_vector = ntohl(hdr->rdma_vector);
++	dst->retry = hdr->retry;
+ }
+ 
+ static void fill_hdr(void *message, uint32_t bytes, struct header *hdr)
+@@ -412,11 +530,19 @@
+  * Compare incoming message header with expected header. All header fields
+  * are in host byte order except for address and port fields.
+  */
+-static int check_hdr(void *message, uint32_t bytes, const struct header *hdr)
++static int check_hdr(void *message, uint32_t bytes, struct header *hdr, struct options *opts)
+ {
+ 	struct header msghdr;
++	uint32_t	inc_seq;
++	uint32_t	my_seq;
+ 
+ 	decode_hdr(&msghdr, message);
++	inc_seq = msghdr.seq;
++	my_seq = hdr->seq;
++
++	if (msghdr.retry && (inc_seq < my_seq))
++		return -1;
++
+ 	if (memcmp(&msghdr, hdr, BASIC_HEADER_SIZE)) {
+ #define bleh(var, disp)					\
+ 		disp(hdr->var),				\
+@@ -428,7 +554,7 @@
+ 		 * with stdout() and we don't get things stomping on each
+ 		 * other
+ 		 */
+-		printf( "An incoming message had a header which\n"
++		printf( "An incoming message had a %s header which\n"
+ 			"didn't contain the fields we expected:\n"
+ 			"    member        expected eq             got\n"
+ 			"       seq %15u %s %15u\n"
+@@ -438,6 +564,7 @@
+ 			"   to_port %15u %s %15u\n"
+ 			"     index %15u %s %15u\n"
+ 			"        op %15u %s %15u\n",
++			(msghdr.retry) ? "RETRY" : "",
+ 			bleh(seq, /**/),
+ 			bleh(from_addr, inet_ntoa_32),
+ 			bleh(from_port, ntohs),
+@@ -569,6 +696,9 @@
+ 
+ 	fcntl(fd, F_SETFL, O_NONBLOCK);
+ 
++	if (opts->tos && ioctl(fd, SIOCRDSSETTOS, &opts->tos)) 
++		die_errno("ERROR: failed to set TOS\n");
++
+ 	return fd;
+ }
+ 
+@@ -584,7 +714,11 @@
+ 	if (opts->receive_addr == 0)
+ 		return 1;
+ 
++#if defined(__SVR4) && defined(__sun)
++	sin.sin_family = AF_INET_OFFLOAD;
++#else
+ 	sin.sin_family = AF_INET;
++#endif
+ 	sin.sin_port = htons(opts->starting_port);
+ 	sin.sin_addr.s_addr = htonl(opts->receive_addr);
+ 
+@@ -639,7 +773,7 @@
+ 	mr_args.flags = RDS_FREE_MR_ARGS_INVALIDATE;
+ #endif
+ 	if (setsockopt(fd, sol, RDS_FREE_MR, &mr_args, sizeof(mr_args)))
+-		die_errno("setsockopt(RDS_FREE_MR) failed");
++		return;
+ 	mrs_allocated--;
+ }
+ 
+@@ -677,7 +811,11 @@
+ 	size = sizeof(struct rdma_key_o_meter)
+ 			+ 2 * nr_tasks * sizeof(*kt)
+ 			+ 2 * RDMA_MAX_TRACKED_KEYS * sizeof(*ks);
++#if defined(__SVR4) && defined(__sun)
++	base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0);
++#else
+ 	base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, 0, 0);
++#endif
+ 	if (base == MAP_FAILED)
+ 		die_errno("alloc_rdma_buffers: mmap failed");
+ 
+@@ -828,13 +966,20 @@
+ 	}
+ 
+ 	if (!failed)
+-		trace("compare pass pattern %Lx addr %p\n",
++		trace("compare pass pattern 0x%Lx addr %p\n",
+ 			(unsigned long long) pattern, addr);
+ }
+ 
++struct retry_entry {
++	uint32_t	retries;
++	uint32_t	seq;
++	int		status;
++};
++
+ struct task {
+ 	unsigned int		nr;
+ 	unsigned int		pending;
++	int			trace;
+ 	unsigned int		unacked;
+ 	struct sockaddr_in	src_addr;	/* same for all tasks */
+ 	struct sockaddr_in	dst_addr;
+@@ -846,6 +991,13 @@
+ 	uint16_t		recv_index;
+ 	struct timeval *	send_time;
+ 	struct header *		ack_header;
++	struct header *         ack2_header;
++	struct header *         req_header;
++	uint64_t *		retry_token;
++	uint32_t		retries;
++	uint32_t            	last_retry_seq;
++	uint32_t		retry_index;
++
+ 
+ 	/* RDMA related stuff */
+ 	uint64_t **		local_buf;
+@@ -865,7 +1017,11 @@
+ 	/* We use mmap here rather than malloc, because it is always
+ 	 * page aligned. */
+ 	len = 2 * opts->nr_tasks * opts->req_depth * (opts->rdma_vector * opts->rdma_size) + sys_page_size;
++#if defined(__SVR4) && defined(__sun)
++	base = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
++#else	
+ 	base = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
++#endif
+ 	if (base == MAP_FAILED)
+ 		die_errno("alloc_rdma_buffers: mmap failed");
+ 	memset(base, 0x2f, len);
+@@ -915,17 +1071,16 @@
+ 	if (RDMA_OP_READ == hdr->rdma_op) {
+ 		if (opt.verify)
+ 			rds_fill_buffer(rdma_addr, rdma_size, hdr->rdma_pattern);
+-		trace("Requesting RDMA read for pattern %Lx "
+-				"local addr to rdma read %p\n",
+-				(unsigned long long) hdr->rdma_pattern,
++		trace("Requesting RDMA read for pattern 0x%Lx"
++				"local addr to rdma read 0x%p\n",
++				hdr->rdma_pattern,
+ 				rdma_addr);
+ 	} else {
+ 		if (opt.verify)
+ 			rds_fill_buffer(rdma_addr, rdma_size, 0);
+-		trace("Requesting RDMA write for pattern %Lx "
+-				"local addr to rdma write %p\n",
+-				(unsigned long long) hdr->rdma_pattern,
+-				rdma_addr);
++
++		trace("Requesting RDMA write for pattern 0x%Lx",
++				hdr->rdma_pattern);
+ 	}
+ }
+ 
+@@ -947,7 +1102,7 @@
+ 		die("Unexpected RDMA op %u in request\n", in_hdr->rdma_op);
+ 
+ 
+-	trace("RDS received request to issue rdma %s len %lu rva %Lx key %Lx pattern %Lx\n",
++	trace("RDS received request to issue rdma %s len %lu rva 0x%Lx key 0x%Lx pattern 0x%Lx\n",
+ 		in_hdr->rdma_op == RDMA_OP_WRITE? "write to" : "read from",
+ 		rdma_size,
+ 		(unsigned long long) in_hdr->rdma_addr,
+@@ -966,20 +1121,32 @@
+ 	hdr->rdma_vector = in_hdr->rdma_vector;
+ }
+ 
+-static inline unsigned int rdma_user_token(struct task *t, unsigned int qindex)
++static inline uint64_t rdma_user_token(struct task *t, unsigned int qindex,  unsigned int type, uint32_t seq)
+ {
+-	return t->nr * opt.req_depth + qindex;
++	uint64_t tmp = seq;
++	return (tmp << 32) | ((t->nr * opt.req_depth + qindex) << 2 | type);
+ }
+ 
+-static void rdma_mark_completed(struct task *tasks, unsigned int token, int status)
++static void rdma_mark_completed(struct task *tasks, uint64_t token, int status, struct options *opts)
+ {
+ 	struct task *t;
+ 	unsigned int i;
+-
+-	trace("RDS rdma completion for token %x\n", token);
+-
+-	t = &tasks[token / opt.req_depth];
+-	i = token % opt.req_depth;
++	struct header *hdr = NULL;
++	uint32_t seq = token >> 32;
++	unsigned int type = token & 0x03;
++	unsigned int index = (token & 0xFFFFFFFF) >> 2;
++
++	trace("RDS rdma completion for token 0x%lx\n", token);
++
++	t = &tasks[index / opt.req_depth];
++	i = index % opt.req_depth;
++
++	if (opts->async) {
++		if (type == OP_REQ)
++			hdr = &t->req_header[i];
++		else
++			hdr = &t->ack2_header[i];
++	}
+ 
+ 	if (status) {
+ 		const char *errmsg;
+@@ -987,26 +1154,59 @@
+ 		switch (status) {
+ 		case RDS_RDMA_REMOTE_ERROR:
+ 			errmsg = "remote error"; break;
+-		case RDS_RDMA_CANCELED:
++		case RDS_RDMA_SEND_DROPPED:
++			errmsg = "operation was dropped"; break;
++		case RDS_RDMA_SEND_CANCELED:
+ 			errmsg = "operation was cancelled"; break;
+-		case RDS_RDMA_DROPPED:
+-			errmsg = "operation was dropped"; break;
+-		case RDS_RDMA_OTHER_ERROR:
++		case RDS_RDMA_SEND_OTHER_ERROR:
+ 			errmsg = "other error"; break;
+ 		default:
+ 			errmsg = "unknown error"; break;
+ 		}
+ 
+-		printf("%s:%u: RDMA op %u failed: %s\n",
++		trace("%s:%u: %s failed: %s\n",
+ 				inet_ntoa(t->dst_addr.sin_addr),
+ 				ntohs(t->dst_addr.sin_port),
+-				i, errmsg);
++				type ? "SEND" : "RDMA",
++				errmsg);
++
++		if (hdr &&
++			(status == RDS_RDMA_SEND_DROPPED ||
++			 status == RDS_RDMA_REMOTE_ERROR)) {
++
++			if (hdr->seq == seq) {
++				hdr->retry = 1;
++				if (hdr->seq > t->last_retry_seq) {
++					if (status == RDS_RDMA_REMOTE_ERROR)
++						hdr->rdma_remote_err = 1;
++					t->retry_token[t->retry_index] = token;
++					t->retry_index = (t->retry_index + 1) %
++						(2 * opts->req_depth);
++					t->retries += 1;
++					t->last_retry_seq = hdr->seq;
++					if (t->retries > 2 * opts->req_depth)
++						die("Exceeded MAX retry entries..\n");
++				}
++			} else
++				die("SEQ Out-Of-Sync: %u/%u\n", hdr->seq, seq);
++		} else if (hdr) {
++			hdr->pending = 0;
++			hdr->retry = 0;
++			hdr->rdma_remote_err = 0;
++		}
++	} else if (hdr) {
++		hdr->pending = 0;
++		hdr->retry = 0;
++		hdr->rdma_remote_err = 0;
+ 	}
+ 
+ 	t->rdma_inflight[i] = 0;
+ 	t->drain_rdmas = 0;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++#undef MSG_MAXIOVLEN
++#endif
+ #define MSG_MAXIOVLEN 2
+ 
+ /*
+@@ -1018,11 +1218,14 @@
+ 	static char ctlbuf[1024];
+ 	struct cmsghdr *cmsg;
+ 
+-	msg->msg_control = ctlbuf;
+-	msg->msg_controllen = CMSG_SPACE(size);
+-
+-	cmsg = CMSG_FIRSTHDR(msg);
+-	cmsg->cmsg_level = sol;
++	if (!msg->msg_control) {
++		msg->msg_control = ctlbuf;
++		msg->msg_controllen = CMSG_SPACE(size);
++		cmsg = CMSG_FIRSTHDR(msg);
++	} else {
++		cmsg = (struct cmsghdr *)((char *)msg->msg_control + msg->msg_controllen);
++		msg->msg_controllen += CMSG_SPACE(size);
++	}cmsg->cmsg_level = sol;
+ 	cmsg->cmsg_type = type;
+ 	cmsg->cmsg_len = CMSG_LEN(size);
+ 	memcpy(CMSG_DATA(cmsg), ptr, size);
+@@ -1034,7 +1237,7 @@
+  * the ACK packet.
+  */
+ static void rdma_build_cmsg_xfer(struct msghdr *msg, const struct header *hdr,
+-		unsigned int user_token, void *local_buf)
++		uint64_t user_token, void *local_buf)
+ {
+ 
+ #define RDS_MAX_IOV 512 /* FIX_ME - put this into rds.h or use socket max ?*/
+@@ -1048,7 +1251,7 @@
+ 	rdma_size = hdr->rdma_size;
+ 	rdma_vector = hdr->rdma_vector;
+ 
+-	trace("RDS issuing rdma for token %x key %Lx len %u local_buf %p vector %u\n",
++	trace("RDS issuing rdma for token 0x%lx key 0x%llx len %d local_buf %p vector %d\n",
+ 			user_token,
+ 			(unsigned long long) hdr->rdma_key,
+ 			rdma_size, local_buf,
+@@ -1102,6 +1305,15 @@
+ 	rdma_put_cmsg(msg, RDS_CMSG_RDMA_ARGS, &args, sizeof(args));
+ }
+ 
++static void build_cmsg_async_send(struct msghdr *msg, uint64_t user_token)
++{
++	struct rds_asend_args  args;
++
++	args.flags |= RDS_SEND_NOTIFY_ME;
++	args.user_token = user_token;
++	rdma_put_cmsg(msg, RDS_CMSG_ASYNC_SEND, &args, sizeof(args));
++}
++
+ static void rdma_build_cmsg_dest(struct msghdr *msg, rds_rdma_cookie_t rdma_dest)
+ {
+ 	rdma_put_cmsg(msg, RDS_CMSG_RDMA_DEST, &rdma_dest, sizeof(rdma_dest));
+@@ -1174,19 +1386,17 @@
+ 	hdr->index = qindex;
+ }
+ 
+-static int send_packet(int fd, struct task *t,
+-		struct header *hdr, unsigned int size)
++static int send_msg(int fd, struct task *t, struct header *hdr,
++		    unsigned int size, struct options *opts, 
++		    struct child_control *ctl)
+ {
+-	unsigned char buf[size], *rdma_flight_recorder = NULL;
++	unsigned char buf[size];
++	uint8_t *rdma_flight_recorder = NULL;
+ 	rds_rdma_cookie_t cookie = 0;
+ 	struct msghdr msg;
+ 	struct iovec iov;
+ 	ssize_t ret;
+ 
+-	/* Make sure we always have the current sequence number.
+-	 * When we send ACK packets, the seq that gets filled in is
+-	 * stale. */
+-	hdr->seq = t->send_seq;
+ 	fill_hdr(buf, size, hdr);
+ 
+ 	memset(&msg, 0, sizeof(msg));
+@@ -1198,27 +1408,10 @@
+ 	iov.iov_base = buf;
+ 	iov.iov_len = size;
+ 
+-	/* If this is a REQ packet in which we pass the MR to the
+-	 * peer, extract the RDMA cookie and pass it on in the control
+-	 * message for now. */
+-	if (hdr->op == OP_REQ && hdr->rdma_op != 0) {
+-		if (hdr->rdma_key != 0) {
+-			/* We used GET_MR to obtain a key */
+-			rdma_build_cmsg_dest(&msg, hdr->rdma_key);
+-			cookie = hdr->rdma_key;
+-			hdr->rdma_key = 0;
+-		} else {
+-			/* Use the RDMA_MAP cmsg to have sendmsg do the
+-			 * mapping on the fly. */
+-			rdma_build_cmsg_map(&msg, hdr->rdma_addr,
+-					    hdr->rdma_size * hdr->rdma_vector,
+-					    &cookie);
+-		}
+-	}
+ 
+ 	/* If this is an ACK packet with RDMA, build the cmsg
+-	 * header that goes with it. */
+-	if (hdr->op == OP_ACK && hdr->rdma_op != 0) {
++	   * header that goes with it. */
++	if (hdr->op == OP_ACK && hdr->rdma_op != 0 && !hdr->rdma_remote_err) {
+ 		unsigned int qindex = hdr->index;
+ 
+ 		if (t->rdma_inflight[qindex] != 0) {
+@@ -1230,14 +1423,33 @@
+ 			 *
+ 			 * We return one of the more obscure error messages,
+ 			 * which we recognize and handle in the top loop. */
+-			trace("Drain RDMA 0x%x\n", rdma_user_token(t, qindex));
++			trace("Drain RDMA 0x%lx\n", rdma_user_token(t, qindex, 0, hdr->seq));
+ 			errno = EBADSLT;
+ 			return -1;
+ 		}
+ 		rdma_build_cmsg_xfer(&msg, hdr,
+-				rdma_user_token(t, qindex),
++				rdma_user_token(t, qindex, 0, hdr->seq),
+ 				t->local_buf[qindex]);
+ 		rdma_flight_recorder = &t->rdma_inflight[qindex];
++	} else if (opts->async) {
++		if (hdr->op == OP_REQ)
++			build_cmsg_async_send(&msg,
++				rdma_user_token(t, hdr->index, OP_REQ, hdr->seq));
++		else
++			build_cmsg_async_send(&msg,
++				rdma_user_token(t, hdr->index, OP_ACK, hdr->seq));
++	}
++
++	if (hdr->op == OP_REQ && hdr->rdma_op != 0) {
++		if (hdr->rdma_key != 0) {
++			rdma_build_cmsg_dest(&msg, hdr->rdma_key);
++			cookie = hdr->rdma_key;
++			hdr->rdma_key = 0;
++		} else {
++			rdma_build_cmsg_map(&msg, hdr->rdma_addr,
++					hdr->rdma_size * hdr->rdma_vector,
++					&cookie);
++		}
+ 	}
+ 
+ 	ret = sendmsg(fd, &msg, 0);
+@@ -1256,22 +1468,57 @@
+ 		 * lower 32bit of the cookie */
+ 		rdma_key_o_meter_add(cookie);
+ 	}
++
++	hdr->pending = 1;
++
++	return ret;
++}
++
++static int send_packet(int fd, struct task *t,
++		struct header *hdr, unsigned int size,
++		struct options *opts, struct child_control *ctl)
++{
++	ssize_t ret;
++
++	/* Make sure we always have the current sequence number.
++	 * When we send ACK packets, the seq that gets filled in is
++	 * stale. */
++	hdr->seq = t->send_seq;
++
++	ret = send_msg(fd, t, hdr, size, opts, ctl);
++	if (ret < 0) return ret;
++
+ 	t->send_seq++;
+ 	return ret;
+ }
+ 
++static int resend_packet(int fd, struct task *t,
++		struct header *hdr, unsigned int size,
++		struct options *opts, struct child_control *ctl)
++{
++	ssize_t ret;
++
++	ret = send_msg(fd, t, hdr, size, opts, ctl);
++
++	return ret;
++}
++
+ static int send_one(int fd, struct task *t,
+ 		struct options *opts,
+ 		struct child_control *ctl)
+ {
+ 	struct timeval start;
+ 	struct timeval stop;
+-	struct header hdr;
++	struct header *hdr = &t->req_header[t->send_index]; 
+ 	int ret;
+ 
+-	build_header(t, &hdr, OP_REQ, t->send_index);
++	if (opts->async && hdr->pending) {
++		return -1;
++	}
++
++	build_header(t, hdr, OP_REQ, t->send_index);
+ 	if (opts->rdma_size && t->send_seq > 10)
+-		rdma_build_req(fd, &hdr, t,
++		rdma_build_req(fd, hdr, t,
+ 				opts->rdma_size,
+ 				opts->req_depth,
+ 				opts->rw_mode,
+@@ -1279,7 +1526,7 @@
+ 
+ 
+ 	gettimeofday(&start, NULL);
+-	ret = send_packet(fd, t, &hdr, opts->req_size);
++	ret = send_packet(fd, t, hdr, opts->req_size, opts, ctl);
+ 	gettimeofday(&stop, NULL);
+ 
+ 	if (ret < 0)
+@@ -1302,10 +1549,15 @@
+ 		struct child_control *ctl)
+ {
+ 	struct header *hdr = &t->ack_header[qindex];
++	struct header *hdr2 = &t->ack2_header[qindex];
+ 	ssize_t ret;
+ 
++	if (opts->async && hdr2->pending) {
++		return -1;
++	}
++
+ 	/* send an ack in response to the req we just got */
+-	ret = send_packet(fd, t, hdr, opts->ack_size);
++	ret = send_packet(fd, t, hdr, opts->ack_size, opts, ctl);
+ 	if (ret < 0)
+ 		return ret;
+ 	if (ret != opts->ack_size)
+@@ -1324,6 +1576,8 @@
+ 		break;
+ 	}
+ 
++	memcpy(hdr2, hdr, sizeof(struct header));
++
+ 	return ret;
+ }
+ 
+@@ -1354,8 +1608,49 @@
+ 			struct child_control *ctl,
+ 			int can_send, int do_work)
+ {
++	struct header *hdr;
++	unsigned int index;
++	int req_size;
++	int num_retries = t->retries;
++	uint64_t token;
++	unsigned int type;
++	unsigned int index2;
++	unsigned int i;
++
++	while (opts->async && num_retries > 0) {
++		index = (t->retry_index - num_retries +
++			(2 * opts->req_depth)) % (2 * opts->req_depth);
++
++		token = t->retry_token[index];
++		type = token & 0x03;
++		index2 = (token & 0xFFFFFFFF) >> 2;
++		i = index2 % opts->req_depth;
++
++		if (type == OP_REQ)
++			hdr = &t->req_header[i];
++		else
++			hdr = &t->ack2_header[i];
++
++		if (!hdr->retry)
++			goto next;
++
++		if (hdr->op == OP_REQ)
++			req_size = opts->req_size;
++		else
++			req_size = opts->ack_size;
++
++		if (resend_packet(fd, t, hdr, req_size, opts, ctl) < 0) {
++			return -1;
++		}
++		hdr->retry = 0;
++next:
++		num_retries--;
++	}
++	t->last_retry_seq = t->retries = 0;
++
+ 	if (ack_anything(fd, t, opts, ctl, can_send) < 0)
+ 		return -1;
++
+ 	while (do_work && t->pending < opts->req_depth) {
+ 		if (!can_send)
+ 			goto eagain;
+@@ -1375,7 +1670,8 @@
+ 		rds_rdma_cookie_t *cookie,
+ 		struct sockaddr_in *sin,
+ 		struct timeval *tstamp,
+-		struct task *tasks)
++		struct task *tasks,
++		struct options *opts)
+ {
+ 	struct cmsghdr *cmsg;
+ 	char cmsgbuf[256];
+@@ -1398,15 +1694,16 @@
+ 
+ 	if (ret < 0)
+ 		return ret;
+-	if (ret && ret < sizeof(struct header))
++	if (ret && !strcmp(RDS_VERSION, peer_version) &&
++		ret < sizeof(struct header))
+ 		die("recvmsg() returned short data: %zd", ret);
+-	if (msg.msg_namelen < sizeof(struct sockaddr_in))
++	if (ret && msg.msg_namelen < sizeof(struct sockaddr_in))
+ 		die("socklen = %d < sizeof(sin) (%zu)\n",
+ 		    msg.msg_namelen, sizeof(struct sockaddr_in));
+ 
+ 	/* See if the message comes with a RDMA destination */
+ 	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+-		struct rds_rdma_notify notify;
++		struct rds_rdma_send_notify notify;
+ 
+ 		if (cmsg->cmsg_level != sol)
+ 			continue;
+@@ -1432,11 +1729,11 @@
+ 			memcpy(cookie, CMSG_DATA(cmsg), sizeof(*cookie));
+ 			break;
+ 
+-		case RDS_CMSG_RDMA_STATUS:
++		case RDS_CMSG_RDMA_SEND_STATUS:
+ 			if (cmsg->cmsg_len < CMSG_LEN(sizeof(notify)))
+ 				die("RDS_CMSG_RDMA_DEST data too small");
+ 			memcpy(&notify, CMSG_DATA(cmsg), sizeof(notify));
+-			rdma_mark_completed(tasks, notify.user_token, notify.status);
++			rdma_mark_completed(tasks, notify.user_token, notify.status, opts);
+ 			break;
+ 		}
+ 	}
+@@ -1445,7 +1742,8 @@
+ 
+ static int recv_one(int fd, struct task *tasks,
+ 			struct options *opts,
+-		struct child_control *ctl)
++		struct child_control *ctl,
++		struct child_control *all_ctl)
+ {
+ 	char buf[max(opts->req_size, opts->ack_size)];
+ 	rds_rdma_cookie_t rdma_dest = 0;
+@@ -1456,15 +1754,18 @@
+ 	uint16_t expect_index;
+ 	int task_index;
+ 	ssize_t ret;
+-
+-	ret = recv_message(fd, buf, sizeof(buf), &rdma_dest, &sin, &tstamp, tasks);
++	int	check_status;
++
++
++	ret = recv_message(fd, buf, sizeof(buf), &rdma_dest, &sin, &tstamp, tasks, opts);
+ 	if (ret < 0)
+ 		return ret;
+ 
+ 	/* If we received only RDMA completions or cong updates,
+ 	 * ret will be 0 */
+-	if (ret == 0)
++	if (ret == 0) {
+ 		return 0;
++	}
+ 
+ 	/* check the incoming sequence number */
+ 	task_index = ntohs(sin.sin_port) - opts->starting_port - 1;
+@@ -1508,15 +1809,31 @@
+ 	hdr.to_port = t->src_addr.sin_port;
+ 	hdr.index = expect_index;
+ 
+-	if (check_hdr(buf, ret, &hdr))
+-		die("header from %s:%u to id %u bogus\n",
+-		    inet_ntoa(sin.sin_addr), htons(sin.sin_port),
+-		    ntohs(t->src_addr.sin_port));
++	check_status = check_hdr(buf, ret, &hdr, opts);
++	if (check_status) {
++		if (check_status > 0) {
++			die("header from %s:%u to id %u bogus\n",
++		    	inet_ntoa(sin.sin_addr), htons(sin.sin_port),
++		    	ntohs(t->src_addr.sin_port));
++		} else
++			return 0;
++	}
+ 
+ 	if (hdr.op == OP_ACK) {
+-		stat_inc(&ctl->cur[S_RTT_USECS],
+-			 usec_sub(&tstamp, &t->send_time[expect_index]));
+-		t->pending -= 1;
++                uint64_t rtt_time = 
++                  usec_sub(&tstamp, &t->send_time[expect_index]);
++
++		stat_inc(&ctl->cur[S_RTT_USECS], rtt_time);
++                if (rtt_time > rtt_threshold)
++			print_outlier("Found RTT = 0x%lx\n", rtt_time);
++
++                if (show_histogram)
++                {
++                  ctl->latency_histogram[get_bucket(rtt_time)]++;
++                }
++
++		if (t->pending > 0)
++			t->pending -= 1;
+ 
+ 		if (in_hdr.rdma_key)
+ 			rdma_process_ack(fd, &in_hdr, ctl);
+@@ -1549,6 +1866,7 @@
+ }
+ 
+ static void run_child(pid_t parent_pid, struct child_control *ctl,
++			struct child_control *all_ctl,
+ 		      struct options *opts, uint16_t id, int active)
+ {
+ 	struct sockaddr_in sin;
+@@ -1559,8 +1877,15 @@
+ 	struct task tasks[opts->nr_tasks];
+ 	struct timeval start;
+         int do_work = opts->simplex ? active : 1;
+-
++	int j;
++
++
++#if defined(__SVR4) && defined(__sun)
++	set_my_lgrp();
++	sin.sin_family = AF_INET_OFFLOAD;
++#else
+ 	sin.sin_family = AF_INET;
++#endif
+ 	sin.sin_port = htons(opts->starting_port + 1 + id);
+ 	sin.sin_addr.s_addr = htonl(opts->receive_addr);
+ 
+@@ -1572,7 +1897,11 @@
+ 	for (i = 0; i < opts->nr_tasks; i++) {
+ 		tasks[i].nr = i;
+ 		tasks[i].src_addr = sin;
++#if defined(__SVR4) && defined(__sun)
++		tasks[i].dst_addr.sin_family = AF_INET_OFFLOAD;
++#else
+ 		tasks[i].dst_addr.sin_family = AF_INET;
++#endif
+ 		tasks[i].dst_addr.sin_addr.s_addr = htonl(opts->send_addr);
+ 		tasks[i].dst_addr.sin_port = htons(opts->starting_port + 1 + i);
+ 		tasks[i].send_time = alloca(opts->req_depth * sizeof(struct timeval));
+@@ -1581,6 +1910,15 @@
+ 		tasks[i].rdma_buf = alloca(opts->req_depth * sizeof(uint64_t *));
+ 		tasks[i].local_buf = alloca(opts->req_depth * sizeof(uint64_t *));
+ 		tasks[i].ack_header = alloca(opts->req_depth * sizeof(struct header));
++		tasks[i].ack2_header = alloca(opts->req_depth * sizeof(struct header));
++		for (j=0;j<opts->req_depth;j++)
++			tasks[i].ack2_header[j].pending = 0;
++
++		tasks[i].req_header = alloca(opts->req_depth * sizeof(struct header));
++		for (j=0;j<opts->req_depth;j++)
++			tasks[i].req_header[j].pending = 0;
++
++		tasks[i].retry_token = alloca(2 * opts->req_depth * sizeof(uint64_t));
+ 		tasks[i].rdma_next_op = (i & 1)? RDMA_OP_READ : RDMA_OP_WRITE;
+ 	}
+ 
+@@ -1611,7 +1949,7 @@
+ 
+ 		check_parent(parent_pid);
+ 
+-		ret = poll(&pfd, 1, -1);
++		ret = poll(&pfd, 1, 1000);
+ 		if (ret < 0) {
+ 			if (errno == EINTR)
+ 				continue;
+@@ -1621,10 +1959,14 @@
+ 		pfd.events = POLLIN;
+ 
+ 		if (pfd.revents & POLLIN) {
+-			while (recv_one(fd, tasks, opts, ctl) >= 0)
++			while (recv_one(fd, tasks, opts, ctl, all_ctl) >= 0)
+ 				;
+ 		}
+ 
++		/* stop sending if in shutdown phase */
++		if (ctl->stopping)
++			continue;
++
+ 		/* keep the pipeline full */
+ 		can_send = !!(pfd.revents & POLLOUT);
+ 		for (i = 0, t = tasks; i < opts->nr_tasks; i++, t++) {
+@@ -1633,6 +1975,7 @@
+ 			if (t->drain_rdmas)
+ 				continue;
+ 			if (send_anything(fd, t, opts, ctl, can_send, do_work) < 0) {
++
+ 				pfd.events |= POLLOUT;
+ 
+ 				/* If the send queue is full, we will see EAGAIN.
+@@ -1665,8 +2008,12 @@
+ 	uint32_t i;
+ 
+ 	len = opts->nr_tasks * sizeof(*ctl);
++#if defined(__SVR4) && defined(__sun)
++	ctl = (struct child_control *)mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0);
++#else
+ 	ctl = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED,
+ 		   0, 0);
++#endif
+ 	if (ctl == MAP_FAILED)
+ 		die("mmap of %u child control structs failed", opts->nr_tasks);
+ 
+@@ -1688,7 +2035,7 @@
+ 				control_fd = -1;
+ 			}
+ 			rdma_key_o_meter_set_self(i);
+-			run_child(parent, ctl + i, opts, i, active);
++			run_child(parent, ctl + i, ctl, opts, i, active);
+ 			exit(0);
+ 		}
+ 		ctl[i].pid = pid;
+@@ -1699,7 +2046,7 @@
+ 			continue;
+ 		pid = waitpid(-1, NULL, WNOHANG);
+ 		if (pid)
+-			die("child %u (pid %u) exited\n", i, pid);
++			die("child %u (pid %u) exited\n", i, (int)pid);
+ 		sleep(1);
+ 		i--; /* try this child again */
+ 	}
+@@ -1823,6 +2170,7 @@
+ 
+ 	if (disable)
+ 		return;
++#if !(defined(__SVR4) && defined(__sun))
+ 	if ((fp = fopen("/proc/stat", "r")) == NULL) {
+ 		fprintf(stderr, "Cannot open /proc/stat (%s) - "
+ 				"not printing cpu stats\n",
+@@ -1856,10 +2204,37 @@
+ 		}
+ 	}
+ 	fclose(fp);
++#else
++#define NSEC_TO_TICK(v)		(v * sysconf(_SC_CLK_TCK)/1000000000)
++	sol_cpu_stats_t		stats;	
++
++	solaris_init();
++	if ((sol_get_cpu_stats(&stats)) < 0) {
++		disable = 1;
++		return;
++	}
++	solaris_fini();
++	current.times[0] = stats.t_user;
++	current.times[1] = 0;
++	current.times[2] = stats.t_kernel;
++	current.times[3] = stats.t_idle;
++	current.times[4] = stats.t_iowait;
++	current.times[5] = 0;
++	current.times[6] = 0;
++	current.times[7] = 0;
++	current.intr = NSEC_TO_TICK(stats.t_intr);	/* NSEC_TO_TICK */
++
++#endif
+ 
+ 	if (initialize) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		printf(",user:percent,system:percent,idle:percent"
+ 		       ",irq:percent,intr:count");
++#else
++		/* Solaris kstat doesn't provide irq/softirq info. */
++		printf(",user:percent,system:percent,idle:percent"
++		       ",intr:count");
++#endif
+ 	} else {
+ 		struct sys_stats sys;
+ 		unsigned long sum = 0;
+@@ -1884,12 +2259,21 @@
+ 		 *  5	irq
+ 		 *  6	softirq
+ 		 */
++#if !(defined(__SVR4) && defined(__sun))
+ 		printf(",%f,%f,%f,%f,%Lu",
+ 			(sys.times[0] + sys.times[1]) * scale,
+ 			sys.times[2] * scale,
+ 			(sys.times[3] + sys.times[4]) * scale,
+ 			(sys.times[5] + sys.times[6]) * scale,
+ 			sys.intr);
++#else
++		/* Solaris kstat doesn't provide irq/softirq info. */
++		printf(",%f,%f,%f,%Lu",
++			(sys.times[0] + sys.times[1]) * scale,
++			sys.times[2] * scale,
++			(sys.times[3] + sys.times[4]) * scale,
++			sys.intr);
++#endif
+ 	}
+ 	prev = current;
+ }
+@@ -1903,6 +2287,10 @@
+ 	static socklen_t buflen = 0;
+ 	static int sock_fd = -1;
+ 	int i, count, item_size;
++#if defined(__SVR4) && defined(__sun)
++	socklen_t len;
++	struct rds_info_arg arg;
++#endif
+ 
+ 	if (sock_fd < 0) {
+ 		sock_fd = socket(pf, SOCK_SEQPACKET, 0);
+@@ -1912,6 +2300,7 @@
+ 
+ 	/* We should only loop once on the first call; after that the
+ 	 * buffer requirements for RDS counters should not change. */
++#if !(defined(__SVR4) && defined(__sun))
+ 	while ((item_size = getsockopt(sock_fd, sol, RDS_INFO_COUNTERS, curr, &buflen)) < 0) {
+ 		if (errno != ENOSPC)
+ 			die_errno("getsockopt(RDS_INFO_COUNTERS) failed");
+@@ -1919,6 +2308,28 @@
+ 		if (!curr)
+ 			die_errno("Cannot allocate buffer for stats counters");
+ 	}
++#else
++	int retcode;
++
++	retcode = sol_ioctl(
++	    sock_fd, RDS_INFO_COUNTERS, &arg, &buflen, &item_size);
++	if (retcode != 0) {
++		if (retcode == 1) {
++			die_errno("ioctl(RDS_INFO_COUNTERS) failed");
++		} else if (retcode == 2) {
++			fprintf(stderr, "%s: Unable to allocate memory "
++			    "for %u bytes of info: %s\n",
++			    "rds-stress", buflen, strerror(errno));
++			return;
++		} else {
++			fprintf(stderr, "%s: Unable to access "
++			    "RDS_INFO_COUNTERS statistics: %s\n",
++			    "rds-stress", strerror(errno));
++			return;
++		}
++	}
++
++#endif
+ 
+ 	if (item_size > sizeof(*ctr))
+ 		die("Bad counter item size in RDS_INFO_COUNTERS (got %d, max %zd)\n",
+@@ -1932,8 +2343,11 @@
+ 	}
+ 
+ 	for (i = 0; i < count; ++i)
++#if !(defined(__SVR4) && defined(__sun))
+ 		memcpy(ctr + i, curr + i * item_size, item_size);
+-
++#else
++		memcpy(ctr + i, ((void *)(uintptr_t)arg.datap) + i * item_size, item_size);
++#endif
+ 	gettimeofday(&now, NULL);
+ 
+ 	if (initialize) {
+@@ -1957,6 +2371,10 @@
+ 	memcpy(prev, ctr, count * sizeof(*ctr));
+ 	last_ts = now;
+ 
++#if defined(__SVR4) && defined(__sun)
++	free((void *)(uintptr_t)arg.datap);
++#endif
++
+ 	get_stats(initialize);
+ }
+ 
+@@ -1967,7 +2385,7 @@
+ 
+ 	pid = waitpid(-1, &status, wflags);
+ 	if (pid < 0)
+-		die("waitpid returned %u", pid);
++		die("waitpid returned %u", (int)pid);
+ 	if (pid == 0)
+ 		return 0;
+ 
+@@ -1975,15 +2393,15 @@
+ 		if (WEXITSTATUS(status) == 0)
+ 			return 1;
+ 		die("child pid %u exited with status %d\n",
+-				pid, WEXITSTATUS(status));
++				(int)pid, WEXITSTATUS(status));
+ 	}
+ 	if (WIFSIGNALED(status)) {
+ 		if (WTERMSIG(status) == SIGTERM)
+ 			return 1;
+ 		die("child pid %u exited with signal %d\n",
+-				pid, WTERMSIG(status));
++				(int)pid, WTERMSIG(status));
+ 	}
+-	die("child pid %u wait status %d\n", pid, status);
++	die("child pid %u wait status %d\n", (int)pid, status);
+ }
+ 
+ static void release_children_and_wait(struct options *opts,
+@@ -1995,8 +2413,12 @@
+ 	struct counter summary[NR_STATS];
+ 	struct timeval start, end, now, first_ts, last_ts;
+ 	double cpu_total = 0;
+-	uint16_t i, cpu_samples = 0;
++	uint16_t i, j, cpu_samples = 0;
+ 	uint16_t nr_running;
++        uint64_t latency_histogram[MAX_BUCKETS];
++
++	if (show_histogram) 
++	        memset(latency_histogram, 0, sizeof(latency_histogram));
+ 
+ 	gettimeofday(&start, NULL);
+ 	start.tv_sec += 2;
+@@ -2139,6 +2561,11 @@
+ 	control_fd = -1;
+ 
+ 	if (nr_running) {
++		/* let everything gracefully stop before we kill the chillins */
++		for (i = 0; i < opts->nr_tasks; i++)
++			ctl[i].stopping = 1;
++		sleep(1);
++
+ 		for (i = 0; i < opts->nr_tasks; i++)
+ 			kill(ctl[i].pid, SIGTERM);
+ 		stop_soakers(soak_arr);
+@@ -2167,6 +2594,19 @@
+ 			avg(&summary[S_SENDMSG_USECS]),
+ 			avg(&summary[S_RTT_USECS]),
+ 			soak_arr? scale * cpu_total : -1.0);
++
++		if (show_histogram) 
++		{
++			for (i = 0; i < opts->nr_tasks; i++)
++			  for (j=0;j < MAX_BUCKETS; j++)
++			    latency_histogram[j] += ctl[i].latency_histogram[j];
++			    
++			printf("\nRTT histogram\n");
++			printf("RTT (us)        \t\t    Count\n");
++			for (i=0;i < MAX_BUCKETS; i++)
++			  printf("[%6u - %6u] \t\t %8u\n", 1 << i, 1 << (i+1), 
++			         (unsigned int)latency_histogram[i]);
++		}
+ 	}
+ }
+ 
+@@ -2220,6 +2660,21 @@
+ {
+ 	ssize_t ret;
+ 
++	if (size == sizeof(struct options)) {
++		memset(ptr, 0, size);
++		ret = read(fd, peer_version, VERSION_MAX_LEN);
++		if (ret != VERSION_MAX_LEN)
++			die_errno("Failed to read version");
++
++		if (strcmp(peer_version, RDS_VERSION)) {
++			ptr += ret;
++			memcpy(ptr, peer_version, VERSION_MAX_LEN);
++			size = sizeof(struct options_2_0_6) - ret;
++		} else
++			size -= ret;
++		ptr += ret;
++	}
++
+ 	while (size) {
+ 		ret = read(fd, ptr, size);
+ 		if (ret < 0)
+@@ -2233,6 +2688,7 @@
+ 
+ static void encode_options(struct options *dst, const struct options *src)
+ {
++	memcpy(dst->version, src->version, VERSION_MAX_LEN);
+ 	dst->req_depth = htonl(src->req_depth);
+ 	dst->req_size = htonl(src->req_size);
+ 	dst->ack_size = htonl(src->ack_size);
+@@ -2262,10 +2718,13 @@
+         dst->simplex = src->simplex;                    /* byte sized */
+         dst->rw_mode = src->rw_mode;                    /* byte sized */
+         dst->rdma_vector = htonl(src->rdma_vector);
++	dst->tos = src->tos;
++	dst->async = src->async;
+ }
+ 
+ static void decode_options(struct options *dst, const struct options *src)
+ {
++	memcpy(dst->version, src->version, VERSION_MAX_LEN);
+ 	dst->req_depth = ntohl(src->req_depth);
+ 	dst->req_size = ntohl(src->req_size);
+ 	dst->ack_size = ntohl(src->ack_size);
+@@ -2295,6 +2754,8 @@
+         dst->simplex = src->simplex;                    /* byte sized */
+         dst->rw_mode = src->rw_mode;                    /* byte sized */
+ 	dst->rdma_vector = ntohl(src->rdma_vector);
++	dst->tos = src->tos;
++	dst->async = src->async;
+ }
+ 
+ static void verify_option_encdec(const struct options *opts)
+@@ -2316,6 +2777,25 @@
+ 		die("encode/decode check of options struct failed");
+ }
+ 
++static void reset_conn(struct options *opts)
++{
++	struct rds_reset val;
++	int fd;
++	struct sockaddr_in sin;
++
++	sin.sin_family = AF_INET;
++	sin.sin_port = htons(opts->starting_port);
++	sin.sin_addr.s_addr = htonl(opts->receive_addr);
++
++	fd = bound_socket(pf, SOCK_SEQPACKET, 0, &sin);
++
++	val.tos = opts->tos;
++	val.src.s_addr = htonl(opts->receive_addr);
++	val.dst.s_addr = htonl(opts->send_addr);
++	if (setsockopt(fd, sol, RDS_CONN_RESET, &val, sizeof(val)))
++		die_errno("setsockopt RDS_CONN_RESET failed");
++}
++
+ static int active_parent(struct options *opts, struct soak_control *soak_arr)
+ {
+ 	struct options enc_options;
+@@ -2324,6 +2804,11 @@
+ 	int fd;
+ 	uint8_t ok;
+ 
++	if (reset_connection) {
++		reset_conn(opts);
++		return 0;
++	}
++
+ 	if (opts->show_params) {
+ 		unsigned int k;
+ 
+@@ -2387,7 +2872,11 @@
+ 	 * We just tell the peer what options to use.
+ 	 */
+ 	encode_options(&enc_options, opts);
+-	peer_send(fd, &enc_options, sizeof(struct options));
++	if (opts->tos || opts->async)
++		peer_send(fd, &enc_options, sizeof(struct options));
++	else
++		peer_send(fd, &enc_options.req_depth,
++				sizeof(struct options_2_0_6));
+ 
+ 	printf("negotiated options, tasks will start in 2 seconds\n");
+ 	ctl = start_children(opts, 1);
+@@ -2517,7 +3006,11 @@
+ 	/* an extra terminating entry which will be all 0s */
+ 	len = (nr_soak + 1) * sizeof(struct soak_control);
+ 	soak_arr = mmap(NULL, len, PROT_READ|PROT_WRITE,
++#if defined(__SVR4) && defined(__sun)
++			MAP_ANONYMOUS|MAP_SHARED, -1, 0);
++#else
+ 			MAP_ANONYMOUS|MAP_SHARED, 0, 0);
++#endif
+ 	if (soak_arr == MAP_FAILED)
+ 		die("mmap of %ld soak control structs failed", nr_soak);
+ 
+@@ -2572,6 +3065,10 @@
+ 	OPT_CONNECT_RETRIES,
+ 	OPT_USE_CONG_MONITOR,
+ 	OPT_PERFDATA,
++        OPT_SHOW_OUTLIERS,
++        OPT_SHOW_HISTOGRAM,
++	OPT_RESET,
++	OPT_ASYNC,
+ };
+ 
+ static struct option long_options[] = {
+@@ -2584,11 +3081,13 @@
+ { "send-addr",		required_argument,	NULL,	's'	},
+ { "port",		required_argument,	NULL,	'p'	},
+ { "time",		required_argument,	NULL,	'T'	},
++{ "tos",                required_argument,      NULL,   'Q'     },
+ { "report-cpu",		no_argument,		NULL,	'c'	},
+ { "report-summary",	no_argument,		NULL,	'z'	},
+ { "rtprio",		no_argument,		NULL,	'R'	},
+ { "verify",		no_argument,		NULL,	'v'	},
+ { "trace",		no_argument,		NULL,	'V'	},
++{ "lgrpid",		required_argument,	NULL,	'g'	},
+ 
+ { "rdma-use-once",	required_argument,	NULL,	OPT_RDMA_USE_ONCE },
+ { "rdma-use-get-mr",	required_argument,	NULL,	OPT_RDMA_USE_GET_MR },
+@@ -2601,6 +3100,10 @@
+ { "show-perfdata",	no_argument,		NULL,	OPT_PERFDATA },
+ { "connect-retries",	required_argument,	NULL,	OPT_CONNECT_RETRIES },
+ { "use-cong-monitor",	required_argument,	NULL,	OPT_USE_CONG_MONITOR },
++{ "show-outliers",      required_argument,      NULL,   OPT_SHOW_OUTLIERS    },
++{ "show-histogram",     no_argument,            NULL,   OPT_SHOW_HISTOGRAM   },
++{ "reset",              no_argument,            NULL,   OPT_RESET },
++{ "async",              no_argument,            NULL,   OPT_ASYNC },
+ 
+ { NULL }
+ };
+@@ -2640,6 +3143,8 @@
+ 	opts.use_cong_monitor = 1;
+ 	opts.rdma_use_fence = 1;
+ 	opts.rdma_cache_mrs = 0;
++	opts.rdma_use_once = 0;
++	opts.rdma_use_get_mr = 0;
+ 	opts.rdma_alignment = 0;
+ 	opts.rdma_key_o_meter = 0;
+ 	opts.show_params = 0;
+@@ -2648,11 +3153,17 @@
+         opts.simplex = 0;
+         opts.rw_mode = 0;
+ 	opts.rdma_vector = 1;
++        rtt_threshold = ~0U;
++        show_histogram = 0;
++	opts.tos = 0;
++	reset_connection = 0;
++	opts.async = 0;
++	strcpy(opts.version, RDS_VERSION);
+ 
+ 	while(1) {
+ 		int c, index;
+ 
+-		c = getopt_long(argc, argv, "+a:cD:d:hI:M:op:q:Rr:s:t:T:vVz",
++		c = getopt_long(argc, argv, "+a:cD:d:hI:M:op:q:Rr:s:t:T:Q:vVg:z",
+ 				long_options, &index);
+ 		if (c == -1)
+ 			break;
+@@ -2702,6 +3213,9 @@
+ 			case 'T':
+ 				opts.run_time = parse_ull(optarg, (uint32_t)~0);
+ 				break;
++			case 'Q':
++				opts.tos = parse_ull(optarg, (uint8_t)~0);
++				break;
+ 			case 'z':
+ 				opts.summary_only = 1;
+ 				break;
+@@ -2711,9 +3225,25 @@
+ 			case 'V':
+ 				opts.tracing = 1;
+ 				break;
++			case 'g':
++				lgrp_id = (lgrp_id_t)parse_ull(optarg,
++				    (uint32_t)~0);
++				break;
++                        case OPT_SHOW_OUTLIERS:
++                                rtt_threshold = parse_ull(optarg, ~0U);
++                                break;
++                        case OPT_SHOW_HISTOGRAM:
++                                show_histogram = 1;
++                                break;
+ 			case OPT_USE_CONG_MONITOR:
+ 				opts.use_cong_monitor = parse_ull(optarg, 1);
+ 				break;
++			case OPT_RESET:
++				reset_connection = 1;
++				break;
++			case OPT_ASYNC:
++				opts.async = 1;
++				break;
+ 			case OPT_RDMA_USE_ONCE:
+ 				opts.rdma_use_once = parse_ull(optarg, 1);
+ 				break;
+@@ -2786,6 +3316,7 @@
+ 	if (opts.rdma_size && 0)
+ 		opts.rdma_size = (opts.rdma_size + 4095) & ~4095;
+ 
++	set_my_lgrp();
+ 	opt = opts;
+ 	return active_parent(&opts, soak_arr);
+ }
+diff -r 1afa90e87b4b rds.7
+--- a/rds.7	Tue Feb 23 22:30:57 2016 -0800
++++ b/rds.7	Tue Feb 23 22:30:58 2016 -0800
+@@ -6,6 +6,7 @@
+ .nf
+ .B #include <sys/socket.h>
+ .B #include <netinet/in.h>
++.B #include <sys/rds.h>
+ .fi
+ .SH DESCRIPTION
+ This is an implementation of the RDS socket API. It provides reliable,
+@@ -14,18 +15,13 @@
+ Currently, RDS can be transported over Infiniband, and loopback.
+ RDS over TCP is disabled, but will be re-enabled in the near future.
+ .PP
+-RDS uses standard
+-.B AF_INET
+-addresses as described in
+-.BR ip (7)
++RDS uses 
++.B AF_INET_OFFLOAD address family 
+ to identify end points.
+ .\"------------------------------------------------------------------
+ .SS Socket Creation
+ RDS is still in development and as such does not have a reserved protocol
+-family constant. Applications must read the string representation of the
+-protocol family value from the
+-.B pf_rds
+-sysctl parameter file described below.
++family constant.  Applications should use AF_INET_OFFLOAD.
+ .PP
+ .nf
+ .B rds_socket = socket(pf_rds, SOCK_SEQPACKET, 0);
+@@ -58,9 +54,6 @@
+ .BR SOL_RDS ).
+ Just as with the RDS protocol family, an official value has not been
+ assigned yet, so the kernel will assign a value dynamically.
+-The assigned value can be retrieved from the
+-.B sol_rds
+-sysctl parameter file.
+ .PP
+ RDS specific socket options will be described in a separate section
+ below.
+@@ -77,7 +70,7 @@
+ .PP
+ For instance, when binding to the address of an Infiniband interface
+ such as
+-.BR ib0 ,
++.BR ibd0 ,
+ the socket will use the Infiniband transport. If RDS is not able
+ to associate a transport with the given address, it will return
+ .BR EADDRNOTAVAIL .
+@@ -394,47 +387,6 @@
+ be delivered in the order they're sent. Messages sent from different
+ sockets, or to different destinations, may be delivered in any order.
+ .\"------------------------------------------------------------------
+-.SH SYSCTL VALUES
+-These parameteres may only be accessed through their files in
+-.BR /proc/sys/net/rds .
+-Access through
+-.BR sysctl (2)
+-is not supported.
+-.TP
+-.B pf_rds
+-This file contains the string representation of the protocol family
+-constant passed to
+-.BR socket (2)
+-to create a new RDS socket.
+-.TP
+-.B sol_rds
+-This file contains the string representation of the socket level parameter
+-that is passed to
+-.BR getsockopt (2)
+-and
+-.BR setsockopt (2)
+-to manipulate RDS socket options.
+-.TP
+-.BR max_unacked_bytes " and " max_unacked_packets
+-These parameters are used to tune the generation of acknowledgements. By
+-default, the system receiving RDS messages does not send back explicit
+-acknowledgements unless it transmits a message of its own (in which
+-case the ACK is piggybacked onto the outgoing message), or when the sending
+-system requests an ACK.
+-.IP
+-However, the sender needs to see an ACK from time to time so that it
+-can purge old messages from the send queue. The unacked bytes and
+-packet counters are used to keep track of how much data has been
+-sent without requesting an ACK. The default is to request an acknowledgement
+-every 16 packets, or every 16 MB, whichever comes first.
+-.TP
+-.BR reconnect_delay_min_ms " and " reconnect_delay_max_ms
+-RDS uses host-to-host connections to transport RDS messages (both for the TCP
+-and the Infiniband transport). If this connection breaks, RDS will try to
+-re-establish the connection. Because this reconnect may be triggered by
+-both hosts at the same time and fail, RDS uses a random backoff before attempting
+-a reconnect. These two parameters specify the minimum and maximum delay in
+-milliseconds. The default values are 1 and 1000, respectively.
+ .SH SEE ALSO
+ .BR rds-rdma (7),
+ .BR socket (2),
--- a/components/open-fabrics/rds-tools/patches/base.patch	Fri Apr 01 14:27:59 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2862 +0,0 @@
-diff -r -u /tmp/rds-tools-2.0.4/rds-stress.c rds-tools-2.0.7/rds-stress.c
---- /tmp/rds-tools-2.0.4/rds-stress.c	Wed Aug  4 15:25:10 2010
-+++ rds-tools-2.0.7/rds-stress.c	Thu Feb 24 13:27:52 2011
-@@ -15,7 +15,13 @@
- #include <sys/time.h>
- #include <time.h>
- #include <inttypes.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/syscall.h>
-+#include <signal.h>
-+#include <sys/lgrp_user.h>
-+#else
- #include <syscall.h>
-+#endif
- #include <sys/stat.h>
- #include <sys/poll.h>
- #include <ctype.h>
-@@ -22,12 +28,27 @@
- #include <fcntl.h>
- #include <sched.h>
- #include <getopt.h>
-+#include <sys/ioctl.h>
-+#if !(defined(__SVR4) && defined(__sun))
- #include <byteswap.h>
- #include "rds.h"
--
-+#else
-+#include <sys/rds.h>
-+#endif
- #include "pfhack.h"
-+#if defined(__SVR4) && defined(__sun)
-+#include <infiniband/ofa_solaris.h>
-+#endif
- 
-+#if defined(__SVR4) && defined(__sun)
- /*
-+ * This definition is forward looking and is not yet present
-+ * in Solaris rds.h file
-+ */
-+#define RDS_CMSG_RDMA_SEND_STATUS RDS_CMSG_RDMA_STATUS
-+#endif
-+
-+/*
-  *
-  * TODO
-  *  - checksum the data some day.
-@@ -45,8 +66,9 @@
-         M_RDMA_READ_ONLY,
-         M_RDMA_WRITE_ONLY
- };
-+#define VERSION_MAX_LEN 16 
- 
--struct options {
-+struct options_2_0_6 {
- 	uint32_t	req_depth;
- 	uint32_t	req_size;
- 	uint32_t	ack_size;
-@@ -76,9 +98,68 @@
- 	uint32_t	connect_retries;
- } __attribute__((packed));
- 
-+struct options {
-+	char		version[VERSION_MAX_LEN];
-+        uint32_t        req_depth;
-+        uint32_t        req_size;
-+        uint32_t        ack_size;
-+        uint32_t        rdma_size;
-+        uint32_t        send_addr;
-+        uint32_t        receive_addr;
-+        uint16_t        starting_port;
-+        uint16_t        nr_tasks;
-+        uint32_t        run_time;
-+        uint8_t         summary_only;
-+        uint8_t         rtprio;
-+        uint8_t         tracing;
-+        uint8_t         verify;
-+        uint8_t         show_params;
-+        uint8_t         show_perfdata;
-+        uint8_t         use_cong_monitor;
-+        uint8_t         rdma_use_once;
-+        uint8_t         rdma_use_get_mr;
-+        uint8_t         rdma_use_fence;
-+        uint8_t         rdma_cache_mrs;
-+        uint8_t         rdma_key_o_meter;
-+        uint8_t         suppress_warnings;
-+        uint8_t         simplex;
-+        uint8_t         rw_mode;
-+        uint32_t        rdma_vector;
-+        uint32_t        rdma_alignment;
-+        uint32_t        connect_retries;
-+        uint8_t         tos;
-+        uint8_t         async;
-+} __attribute__((packed));
-+
-+#define MAX_BUCKETS 16
-+
- static struct options	opt;
- static int		control_fd;
-+static uint64_t         rtt_threshold;
-+static int              show_histogram;
-+static int		reset_connection;
-+static char		peer_version[VERSION_MAX_LEN];
- 
-+static int get_bucket(uint64_t rtt_time)
-+{
-+  int i;
-+  uint64_t l_rtt_time = rtt_time;
-+
-+  if (!l_rtt_time)
-+    i = 0;
-+  else
-+  {
-+    i = -1;
-+    while (l_rtt_time)
-+    {
-+      i++;
-+      l_rtt_time = (l_rtt_time >> 1);
-+    }
-+  }
-+
-+  return i;
-+}
-+
- struct counter {
- 	uint64_t	nr;
- 	uint64_t	sum;
-@@ -102,6 +183,10 @@
- 
- #define NR_STATS S__LAST
- 
-+#if defined(__SVR4) && defined(__sun)
-+int sol_ioctl(int, int, struct rds_info_arg *, socklen_t *, int *);
-+#endif
-+
- /*
-  * Parents share a mapped array of these with their children.  Each child
-  * gets one.  It's used to communicate between the child and the parent
-@@ -110,9 +195,11 @@
- struct child_control {
- 	pid_t pid;
- 	int ready;
-+	int stopping;
- 	struct timeval start;
- 	struct counter cur[NR_STATS];
- 	struct counter last[NR_STATS];
-+        uint64_t       latency_histogram[MAX_BUCKETS];
- } __attribute__((aligned (256))); /* arbitrary */
- 
- struct soak_control {
-@@ -132,6 +219,7 @@
-  */
- #define OP_REQ		1
- #define OP_ACK		2
-+#define OP_DUMP		3
- 
- #define RDMA_OP_READ	1
- #define RDMA_OP_WRITE	2
-@@ -148,7 +236,7 @@
- 	uint16_t	from_port;
- 	uint16_t	to_port;
- 	uint16_t	index;
--	uint8_t		op;
-+	uint8_t         op;
- 
- 	/* RDMA related.
- 	 * rdma_op must be the first field, because we
-@@ -162,12 +250,21 @@
- 	uint32_t	rdma_size;
- 	uint32_t        rdma_vector;
- 
--	uint8_t		data[0];
-+	/* Async send related. */
-+	uint8_t         retry;
-+	uint8_t         rdma_remote_err;
-+	uint8_t         pending;
-+
-+	uint8_t         data[0];
- } __attribute__((packed));
- 
- #define MIN_MSG_BYTES		(sizeof(struct header))
- #define BASIC_HEADER_SIZE	(size_t)(&((struct header *) 0)->rdma_op)
- 
-+#define print_outlier(...) do {         \
-+        fprintf(stderr, __VA_ARGS__);   \
-+} while (0)
-+
- #define die(fmt...) do {		\
- 	fprintf(stderr, fmt);		\
- 	exit(1);			\
-@@ -254,7 +351,20 @@
- 
- 	die("invalid host name or dotted quad '%s'\n", ptr);
- }
-+#if defined(__SVR4) && defined(__sun)
-+static lgrp_id_t lgrp_id = -1;
- 
-+static void
-+set_my_lgrp(void)
-+{
-+	if (lgrp_id != -1) {
-+		lgrp_affinity_set(P_LWPID, P_MYID, lgrp_id,
-+			LGRP_AFF_STRONG);
-+		yield(); /* force a context switch */
-+	}
-+}
-+#endif
-+
- static void usage(void)
- {
-         fprintf(stderr, "rds-stress version %s\n", RDS_VERSION);
-@@ -273,6 +383,7 @@
- 	" -d [depth, 1]     request pipeline depth, nr outstanding\n"
- 	" -t [nr, 1]        number of child tasks\n"
- 	" -T [seconds, 0]   runtime of test, 0 means infinite\n"
-+	" -Q [tos, 0]       Type of Service\n"
- 	" -D [bytes]        RDMA: size\n"
- 	" -I [iovecs, 1]    RDMA: number of user buffers to target (max 512)\n"
-         " -M [nr, 0]        RDMA: mode (0=readwrite,1=readonly,2=writeonly)\n"
-@@ -281,6 +392,9 @@
- 	" -c                measure cpu use with per-cpu soak processes\n"
- 	" -V                trace execution\n"
- 	" -z                print a summary at end of test only\n"
-+#if defined(__SVR4) && defined(__sun)
-+	" -g [lgrpid]       bind the process to the specified lgrp\n"
-+#endif
- 	"\n"
- 	"Example:\n"
- 	"  recv$ rds-stress\n"
-@@ -310,7 +424,7 @@
- static void check_parent(pid_t pid)
- {
- 	if (pid != getppid())
--		die("parent %u exited\n", pid);
-+		die("parent %u exited\n", (int)pid);
- }
- 
- /*
-@@ -334,6 +448,7 @@
- 		msg_pattern[i] = k;
- }
- 
-+#if !(defined(__SVR4) && defined(__sun))
- #if __BYTE_ORDER == __LITTLE_ENDIAN
- #define htonll(x)	bswap_64(x)
- #define ntohll(x)	bswap_64(x)
-@@ -341,6 +456,7 @@
- #define htonll(x)	(x)
- #define ntohll(x)	(x)
- #endif
-+#endif /* Not sun */
- 
- static void encode_hdr(struct header *dst, const struct header *hdr)
- {
-@@ -361,6 +477,7 @@
- 	dst->rdma_key = htonll(hdr->rdma_key);
- 	dst->rdma_size = htonl(hdr->rdma_size);
- 	dst->rdma_vector = htonl(hdr->rdma_vector);
-+	dst->retry = hdr->retry;
- }
- 
- static void decode_hdr(struct header *dst, const struct header *hdr)
-@@ -382,6 +499,7 @@
- 	dst->rdma_key = ntohll(hdr->rdma_key);
- 	dst->rdma_size = ntohl(hdr->rdma_size);
- 	dst->rdma_vector = ntohl(hdr->rdma_vector);
-+	dst->retry = hdr->retry;
- }
- 
- static void fill_hdr(void *message, uint32_t bytes, struct header *hdr)
-@@ -412,11 +530,19 @@
-  * Compare incoming message header with expected header. All header fields
-  * are in host byte order except for address and port fields.
-  */
--static int check_hdr(void *message, uint32_t bytes, const struct header *hdr)
-+static int check_hdr(void *message, uint32_t bytes, struct header *hdr, struct options *opts)
- {
- 	struct header msghdr;
-+	uint32_t	inc_seq;
-+	uint32_t	my_seq;
- 
- 	decode_hdr(&msghdr, message);
-+	inc_seq = msghdr.seq;
-+	my_seq = hdr->seq;
-+
-+	if (msghdr.retry && (inc_seq < my_seq))
-+		return -1;
-+
- 	if (memcmp(&msghdr, hdr, BASIC_HEADER_SIZE)) {
- #define bleh(var, disp)					\
- 		disp(hdr->var),				\
-@@ -428,7 +554,7 @@
- 		 * with stdout() and we don't get things stomping on each
- 		 * other
- 		 */
--		printf( "An incoming message had a header which\n"
-+		printf( "An incoming message had a %s header which\n"
- 			"didn't contain the fields we expected:\n"
- 			"    member        expected eq             got\n"
- 			"       seq %15u %s %15u\n"
-@@ -438,6 +564,7 @@
- 			"   to_port %15u %s %15u\n"
- 			"     index %15u %s %15u\n"
- 			"        op %15u %s %15u\n",
-+			(msghdr.retry) ? "RETRY" : "",
- 			bleh(seq, /**/),
- 			bleh(from_addr, inet_ntoa_32),
- 			bleh(from_port, ntohs),
-@@ -569,6 +696,9 @@
- 
- 	fcntl(fd, F_SETFL, O_NONBLOCK);
- 
-+	if (opts->tos && ioctl(fd, SIOCRDSSETTOS, &opts->tos)) 
-+		die_errno("ERROR: failed to set TOS\n");
-+
- 	return fd;
- }
- 
-@@ -584,7 +714,11 @@
- 	if (opts->receive_addr == 0)
- 		return 1;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	sin.sin_family = AF_INET_OFFLOAD;
-+#else
- 	sin.sin_family = AF_INET;
-+#endif
- 	sin.sin_port = htons(opts->starting_port);
- 	sin.sin_addr.s_addr = htonl(opts->receive_addr);
- 
-@@ -639,7 +773,7 @@
- 	mr_args.flags = RDS_FREE_MR_ARGS_INVALIDATE;
- #endif
- 	if (setsockopt(fd, sol, RDS_FREE_MR, &mr_args, sizeof(mr_args)))
--		die_errno("setsockopt(RDS_FREE_MR) failed");
-+		return;
- 	mrs_allocated--;
- }
- 
-@@ -677,7 +811,11 @@
- 	size = sizeof(struct rdma_key_o_meter)
- 			+ 2 * nr_tasks * sizeof(*kt)
- 			+ 2 * RDMA_MAX_TRACKED_KEYS * sizeof(*ks);
-+#if defined(__SVR4) && defined(__sun)
-+	base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0);
-+#else
- 	base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, 0, 0);
-+#endif
- 	if (base == MAP_FAILED)
- 		die_errno("alloc_rdma_buffers: mmap failed");
- 
-@@ -828,13 +966,20 @@
- 	}
- 
- 	if (!failed)
--		trace("compare pass pattern %Lx addr %p\n",
-+		trace("compare pass pattern 0x%Lx addr %p\n",
- 			(unsigned long long) pattern, addr);
- }
- 
-+struct retry_entry {
-+	uint32_t	retries;
-+	uint32_t	seq;
-+	int		status;
-+};
-+
- struct task {
- 	unsigned int		nr;
- 	unsigned int		pending;
-+	int			trace;
- 	unsigned int		unacked;
- 	struct sockaddr_in	src_addr;	/* same for all tasks */
- 	struct sockaddr_in	dst_addr;
-@@ -846,7 +991,14 @@
- 	uint16_t		recv_index;
- 	struct timeval *	send_time;
- 	struct header *		ack_header;
-+	struct header *         ack2_header;
-+	struct header *         req_header;
-+	uint64_t *		retry_token;
-+	uint32_t		retries;
-+	uint32_t            	last_retry_seq;
-+	uint32_t		retry_index;
- 
-+
- 	/* RDMA related stuff */
- 	uint64_t **		local_buf;
- 	uint64_t **		rdma_buf;
-@@ -865,7 +1017,11 @@
- 	/* We use mmap here rather than malloc, because it is always
- 	 * page aligned. */
- 	len = 2 * opts->nr_tasks * opts->req_depth * (opts->rdma_vector * opts->rdma_size) + sys_page_size;
-+#if defined(__SVR4) && defined(__sun)
-+	base = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-+#else	
- 	base = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
-+#endif
- 	if (base == MAP_FAILED)
- 		die_errno("alloc_rdma_buffers: mmap failed");
- 	memset(base, 0x2f, len);
-@@ -915,17 +1071,16 @@
- 	if (RDMA_OP_READ == hdr->rdma_op) {
- 		if (opt.verify)
- 			rds_fill_buffer(rdma_addr, rdma_size, hdr->rdma_pattern);
--		trace("Requesting RDMA read for pattern %Lx "
--				"local addr to rdma read %p\n",
--				(unsigned long long) hdr->rdma_pattern,
-+		trace("Requesting RDMA read for pattern 0x%Lx"
-+				"local addr to rdma read 0x%p\n",
-+				hdr->rdma_pattern,
- 				rdma_addr);
- 	} else {
- 		if (opt.verify)
- 			rds_fill_buffer(rdma_addr, rdma_size, 0);
--		trace("Requesting RDMA write for pattern %Lx "
--				"local addr to rdma write %p\n",
--				(unsigned long long) hdr->rdma_pattern,
--				rdma_addr);
-+
-+		trace("Requesting RDMA write for pattern 0x%Lx",
-+				hdr->rdma_pattern);
- 	}
- }
- 
-@@ -947,7 +1102,7 @@
- 		die("Unexpected RDMA op %u in request\n", in_hdr->rdma_op);
- 
- 
--	trace("RDS received request to issue rdma %s len %lu rva %Lx key %Lx pattern %Lx\n",
-+	trace("RDS received request to issue rdma %s len %lu rva 0x%Lx key 0x%Lx pattern 0x%Lx\n",
- 		in_hdr->rdma_op == RDMA_OP_WRITE? "write to" : "read from",
- 		rdma_size,
- 		(unsigned long long) in_hdr->rdma_addr,
-@@ -966,21 +1121,33 @@
- 	hdr->rdma_vector = in_hdr->rdma_vector;
- }
- 
--static inline unsigned int rdma_user_token(struct task *t, unsigned int qindex)
-+static inline uint64_t rdma_user_token(struct task *t, unsigned int qindex,  unsigned int type, uint32_t seq)
- {
--	return t->nr * opt.req_depth + qindex;
-+	uint64_t tmp = seq;
-+	return (tmp << 32) | ((t->nr * opt.req_depth + qindex) << 2 | type);
- }
- 
--static void rdma_mark_completed(struct task *tasks, unsigned int token, int status)
-+static void rdma_mark_completed(struct task *tasks, uint64_t token, int status, struct options *opts)
- {
- 	struct task *t;
- 	unsigned int i;
-+	struct header *hdr = NULL;
-+	uint32_t seq = token >> 32;
-+	unsigned int type = token & 0x03;
-+	unsigned int index = (token & 0xFFFFFFFF) >> 2;
- 
--	trace("RDS rdma completion for token %x\n", token);
-+	trace("RDS rdma completion for token 0x%lx\n", token);
- 
--	t = &tasks[token / opt.req_depth];
--	i = token % opt.req_depth;
-+	t = &tasks[index / opt.req_depth];
-+	i = index % opt.req_depth;
- 
-+	if (opts->async) {
-+		if (type == OP_REQ)
-+			hdr = &t->req_header[i];
-+		else
-+			hdr = &t->ack2_header[i];
-+	}
-+
- 	if (status) {
- 		const char *errmsg;
- 
-@@ -987,20 +1154,50 @@
- 		switch (status) {
- 		case RDS_RDMA_REMOTE_ERROR:
- 			errmsg = "remote error"; break;
--		case RDS_RDMA_CANCELED:
--			errmsg = "operation was cancelled"; break;
--		case RDS_RDMA_DROPPED:
-+		case RDS_RDMA_SEND_DROPPED:
- 			errmsg = "operation was dropped"; break;
--		case RDS_RDMA_OTHER_ERROR:
-+		case RDS_RDMA_SEND_CANCELED:
-+			errmsg = "operation was cancelled"; break;
-+		case RDS_RDMA_SEND_OTHER_ERROR:
- 			errmsg = "other error"; break;
- 		default:
- 			errmsg = "unknown error"; break;
- 		}
- 
--		printf("%s:%u: RDMA op %u failed: %s\n",
-+		trace("%s:%u: %s failed: %s\n",
- 				inet_ntoa(t->dst_addr.sin_addr),
- 				ntohs(t->dst_addr.sin_port),
--				i, errmsg);
-+				type ? "SEND" : "RDMA",
-+				errmsg);
-+
-+		if (hdr &&
-+			(status == RDS_RDMA_SEND_DROPPED ||
-+			 status == RDS_RDMA_REMOTE_ERROR)) {
-+
-+			if (hdr->seq == seq) {
-+				hdr->retry = 1;
-+				if (hdr->seq > t->last_retry_seq) {
-+					if (status == RDS_RDMA_REMOTE_ERROR)
-+						hdr->rdma_remote_err = 1;
-+					t->retry_token[t->retry_index] = token;
-+					t->retry_index = (t->retry_index + 1) %
-+						(2 * opts->req_depth);
-+					t->retries += 1;
-+					t->last_retry_seq = hdr->seq;
-+					if (t->retries > 2 * opts->req_depth)
-+						die("Exceeded MAX retry entries..\n");
-+				}
-+			} else
-+				die("SEQ Out-Of-Sync: %u/%u\n", hdr->seq, seq);
-+		} else if (hdr) {
-+			hdr->pending = 0;
-+			hdr->retry = 0;
-+			hdr->rdma_remote_err = 0;
-+		}
-+	} else if (hdr) {
-+		hdr->pending = 0;
-+		hdr->retry = 0;
-+		hdr->rdma_remote_err = 0;
- 	}
- 
- 	t->rdma_inflight[i] = 0;
-@@ -1007,6 +1204,9 @@
- 	t->drain_rdmas = 0;
- }
- 
-+#if defined(__SVR4) && defined(__sun)
-+#undef MSG_MAXIOVLEN
-+#endif
- #define MSG_MAXIOVLEN 2
- 
- /*
-@@ -1018,11 +1218,14 @@
- 	static char ctlbuf[1024];
- 	struct cmsghdr *cmsg;
- 
--	msg->msg_control = ctlbuf;
--	msg->msg_controllen = CMSG_SPACE(size);
--
--	cmsg = CMSG_FIRSTHDR(msg);
--	cmsg->cmsg_level = sol;
-+	if (!msg->msg_control) {
-+		msg->msg_control = ctlbuf;
-+		msg->msg_controllen = CMSG_SPACE(size);
-+		cmsg = CMSG_FIRSTHDR(msg);
-+	} else {
-+		cmsg = (struct cmsghdr *)((char *)msg->msg_control + msg->msg_controllen);
-+		msg->msg_controllen += CMSG_SPACE(size);
-+	}cmsg->cmsg_level = sol;
- 	cmsg->cmsg_type = type;
- 	cmsg->cmsg_len = CMSG_LEN(size);
- 	memcpy(CMSG_DATA(cmsg), ptr, size);
-@@ -1034,7 +1237,7 @@
-  * the ACK packet.
-  */
- static void rdma_build_cmsg_xfer(struct msghdr *msg, const struct header *hdr,
--		unsigned int user_token, void *local_buf)
-+		uint64_t user_token, void *local_buf)
- {
- 
- #define RDS_MAX_IOV 512 /* FIX_ME - put this into rds.h or use socket max ?*/
-@@ -1048,7 +1251,7 @@
- 	rdma_size = hdr->rdma_size;
- 	rdma_vector = hdr->rdma_vector;
- 
--	trace("RDS issuing rdma for token %x key %Lx len %u local_buf %p vector %u\n",
-+	trace("RDS issuing rdma for token 0x%lx key 0x%llx len %d local_buf %p vector %d\n",
- 			user_token,
- 			(unsigned long long) hdr->rdma_key,
- 			rdma_size, local_buf,
-@@ -1102,6 +1305,15 @@
- 	rdma_put_cmsg(msg, RDS_CMSG_RDMA_ARGS, &args, sizeof(args));
- }
- 
-+static void build_cmsg_async_send(struct msghdr *msg, uint64_t user_token)
-+{
-+	struct rds_asend_args  args;
-+
-+	args.flags |= RDS_SEND_NOTIFY_ME;
-+	args.user_token = user_token;
-+	rdma_put_cmsg(msg, RDS_CMSG_ASYNC_SEND, &args, sizeof(args));
-+}
-+
- static void rdma_build_cmsg_dest(struct msghdr *msg, rds_rdma_cookie_t rdma_dest)
- {
- 	rdma_put_cmsg(msg, RDS_CMSG_RDMA_DEST, &rdma_dest, sizeof(rdma_dest));
-@@ -1174,19 +1386,17 @@
- 	hdr->index = qindex;
- }
- 
--static int send_packet(int fd, struct task *t,
--		struct header *hdr, unsigned int size)
-+static int send_msg(int fd, struct task *t, struct header *hdr,
-+		    unsigned int size, struct options *opts, 
-+		    struct child_control *ctl)
- {
--	unsigned char buf[size], *rdma_flight_recorder = NULL;
-+	unsigned char buf[size];
-+	uint8_t *rdma_flight_recorder = NULL;
- 	rds_rdma_cookie_t cookie = 0;
- 	struct msghdr msg;
- 	struct iovec iov;
- 	ssize_t ret;
- 
--	/* Make sure we always have the current sequence number.
--	 * When we send ACK packets, the seq that gets filled in is
--	 * stale. */
--	hdr->seq = t->send_seq;
- 	fill_hdr(buf, size, hdr);
- 
- 	memset(&msg, 0, sizeof(msg));
-@@ -1198,27 +1408,10 @@
- 	iov.iov_base = buf;
- 	iov.iov_len = size;
- 
--	/* If this is a REQ packet in which we pass the MR to the
--	 * peer, extract the RDMA cookie and pass it on in the control
--	 * message for now. */
--	if (hdr->op == OP_REQ && hdr->rdma_op != 0) {
--		if (hdr->rdma_key != 0) {
--			/* We used GET_MR to obtain a key */
--			rdma_build_cmsg_dest(&msg, hdr->rdma_key);
--			cookie = hdr->rdma_key;
--			hdr->rdma_key = 0;
--		} else {
--			/* Use the RDMA_MAP cmsg to have sendmsg do the
--			 * mapping on the fly. */
--			rdma_build_cmsg_map(&msg, hdr->rdma_addr,
--					    hdr->rdma_size * hdr->rdma_vector,
--					    &cookie);
--		}
--	}
- 
- 	/* If this is an ACK packet with RDMA, build the cmsg
--	 * header that goes with it. */
--	if (hdr->op == OP_ACK && hdr->rdma_op != 0) {
-+	   * header that goes with it. */
-+	if (hdr->op == OP_ACK && hdr->rdma_op != 0 && !hdr->rdma_remote_err) {
- 		unsigned int qindex = hdr->index;
- 
- 		if (t->rdma_inflight[qindex] != 0) {
-@@ -1230,16 +1423,35 @@
- 			 *
- 			 * We return one of the more obscure error messages,
- 			 * which we recognize and handle in the top loop. */
--			trace("Drain RDMA 0x%x\n", rdma_user_token(t, qindex));
-+			trace("Drain RDMA 0x%lx\n", rdma_user_token(t, qindex, 0, hdr->seq));
- 			errno = EBADSLT;
- 			return -1;
- 		}
- 		rdma_build_cmsg_xfer(&msg, hdr,
--				rdma_user_token(t, qindex),
-+				rdma_user_token(t, qindex, 0, hdr->seq),
- 				t->local_buf[qindex]);
- 		rdma_flight_recorder = &t->rdma_inflight[qindex];
-+	} else if (opts->async) {
-+		if (hdr->op == OP_REQ)
-+			build_cmsg_async_send(&msg,
-+				rdma_user_token(t, hdr->index, OP_REQ, hdr->seq));
-+		else
-+			build_cmsg_async_send(&msg,
-+				rdma_user_token(t, hdr->index, OP_ACK, hdr->seq));
- 	}
- 
-+	if (hdr->op == OP_REQ && hdr->rdma_op != 0) {
-+		if (hdr->rdma_key != 0) {
-+			rdma_build_cmsg_dest(&msg, hdr->rdma_key);
-+			cookie = hdr->rdma_key;
-+			hdr->rdma_key = 0;
-+		} else {
-+			rdma_build_cmsg_map(&msg, hdr->rdma_addr,
-+					hdr->rdma_size * hdr->rdma_vector,
-+					&cookie);
-+		}
-+	}
-+
- 	ret = sendmsg(fd, &msg, 0);
- 	if (ret < 0) {
- 		if (errno != EAGAIN && errno != ENOBUFS)
-@@ -1256,10 +1468,41 @@
- 		 * lower 32bit of the cookie */
- 		rdma_key_o_meter_add(cookie);
- 	}
-+
-+	hdr->pending = 1;
-+
-+	return ret;
-+}
-+
-+static int send_packet(int fd, struct task *t,
-+		struct header *hdr, unsigned int size,
-+		struct options *opts, struct child_control *ctl)
-+{
-+	ssize_t ret;
-+
-+	/* Make sure we always have the current sequence number.
-+	 * When we send ACK packets, the seq that gets filled in is
-+	 * stale. */
-+	hdr->seq = t->send_seq;
-+
-+	ret = send_msg(fd, t, hdr, size, opts, ctl);
-+	if (ret < 0) return ret;
-+
- 	t->send_seq++;
- 	return ret;
- }
- 
-+static int resend_packet(int fd, struct task *t,
-+		struct header *hdr, unsigned int size,
-+		struct options *opts, struct child_control *ctl)
-+{
-+	ssize_t ret;
-+
-+	ret = send_msg(fd, t, hdr, size, opts, ctl);
-+
-+	return ret;
-+}
-+
- static int send_one(int fd, struct task *t,
- 		struct options *opts,
- 		struct child_control *ctl)
-@@ -1266,12 +1509,16 @@
- {
- 	struct timeval start;
- 	struct timeval stop;
--	struct header hdr;
-+	struct header *hdr = &t->req_header[t->send_index]; 
- 	int ret;
- 
--	build_header(t, &hdr, OP_REQ, t->send_index);
-+	if (opts->async && hdr->pending) {
-+		return -1;
-+	}
-+
-+	build_header(t, hdr, OP_REQ, t->send_index);
- 	if (opts->rdma_size && t->send_seq > 10)
--		rdma_build_req(fd, &hdr, t,
-+		rdma_build_req(fd, hdr, t,
- 				opts->rdma_size,
- 				opts->req_depth,
- 				opts->rw_mode,
-@@ -1279,7 +1526,7 @@
- 
- 
- 	gettimeofday(&start, NULL);
--	ret = send_packet(fd, t, &hdr, opts->req_size);
-+	ret = send_packet(fd, t, hdr, opts->req_size, opts, ctl);
- 	gettimeofday(&stop, NULL);
- 
- 	if (ret < 0)
-@@ -1302,10 +1549,15 @@
- 		struct child_control *ctl)
- {
- 	struct header *hdr = &t->ack_header[qindex];
-+	struct header *hdr2 = &t->ack2_header[qindex];
- 	ssize_t ret;
- 
-+	if (opts->async && hdr2->pending) {
-+		return -1;
-+	}
-+
- 	/* send an ack in response to the req we just got */
--	ret = send_packet(fd, t, hdr, opts->ack_size);
-+	ret = send_packet(fd, t, hdr, opts->ack_size, opts, ctl);
- 	if (ret < 0)
- 		return ret;
- 	if (ret != opts->ack_size)
-@@ -1324,6 +1576,8 @@
- 		break;
- 	}
- 
-+	memcpy(hdr2, hdr, sizeof(struct header));
-+
- 	return ret;
- }
- 
-@@ -1354,8 +1608,49 @@
- 			struct child_control *ctl,
- 			int can_send, int do_work)
- {
-+	struct header *hdr;
-+	unsigned int index;
-+	int req_size;
-+	int num_retries = t->retries;
-+	uint64_t token;
-+	unsigned int type;
-+	unsigned int index2;
-+	unsigned int i;
-+
-+	while (opts->async && num_retries > 0) {
-+		index = (t->retry_index - num_retries +
-+			(2 * opts->req_depth)) % (2 * opts->req_depth);
-+
-+		token = t->retry_token[index];
-+		type = token & 0x03;
-+		index2 = (token & 0xFFFFFFFF) >> 2;
-+		i = index2 % opts->req_depth;
-+
-+		if (type == OP_REQ)
-+			hdr = &t->req_header[i];
-+		else
-+			hdr = &t->ack2_header[i];
-+
-+		if (!hdr->retry)
-+			goto next;
-+
-+		if (hdr->op == OP_REQ)
-+			req_size = opts->req_size;
-+		else
-+			req_size = opts->ack_size;
-+
-+		if (resend_packet(fd, t, hdr, req_size, opts, ctl) < 0) {
-+			return -1;
-+		}
-+		hdr->retry = 0;
-+next:
-+		num_retries--;
-+	}
-+	t->last_retry_seq = t->retries = 0;
-+
- 	if (ack_anything(fd, t, opts, ctl, can_send) < 0)
- 		return -1;
-+
- 	while (do_work && t->pending < opts->req_depth) {
- 		if (!can_send)
- 			goto eagain;
-@@ -1375,7 +1670,8 @@
- 		rds_rdma_cookie_t *cookie,
- 		struct sockaddr_in *sin,
- 		struct timeval *tstamp,
--		struct task *tasks)
-+		struct task *tasks,
-+		struct options *opts)
- {
- 	struct cmsghdr *cmsg;
- 	char cmsgbuf[256];
-@@ -1398,15 +1694,16 @@
- 
- 	if (ret < 0)
- 		return ret;
--	if (ret && ret < sizeof(struct header))
-+	if (ret && !strcmp(RDS_VERSION, peer_version) &&
-+		ret < sizeof(struct header))
- 		die("recvmsg() returned short data: %zd", ret);
--	if (msg.msg_namelen < sizeof(struct sockaddr_in))
-+	if (ret && msg.msg_namelen < sizeof(struct sockaddr_in))
- 		die("socklen = %d < sizeof(sin) (%zu)\n",
- 		    msg.msg_namelen, sizeof(struct sockaddr_in));
- 
- 	/* See if the message comes with a RDMA destination */
- 	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
--		struct rds_rdma_notify notify;
-+		struct rds_rdma_send_notify notify;
- 
- 		if (cmsg->cmsg_level != sol)
- 			continue;
-@@ -1432,11 +1729,11 @@
- 			memcpy(cookie, CMSG_DATA(cmsg), sizeof(*cookie));
- 			break;
- 
--		case RDS_CMSG_RDMA_STATUS:
-+		case RDS_CMSG_RDMA_SEND_STATUS:
- 			if (cmsg->cmsg_len < CMSG_LEN(sizeof(notify)))
- 				die("RDS_CMSG_RDMA_DEST data too small");
- 			memcpy(&notify, CMSG_DATA(cmsg), sizeof(notify));
--			rdma_mark_completed(tasks, notify.user_token, notify.status);
-+			rdma_mark_completed(tasks, notify.user_token, notify.status, opts);
- 			break;
- 		}
- 	}
-@@ -1445,7 +1742,8 @@
- 
- static int recv_one(int fd, struct task *tasks,
- 			struct options *opts,
--		struct child_control *ctl)
-+		struct child_control *ctl,
-+		struct child_control *all_ctl)
- {
- 	char buf[max(opts->req_size, opts->ack_size)];
- 	rds_rdma_cookie_t rdma_dest = 0;
-@@ -1456,15 +1754,18 @@
- 	uint16_t expect_index;
- 	int task_index;
- 	ssize_t ret;
-+	int	check_status;
- 
--	ret = recv_message(fd, buf, sizeof(buf), &rdma_dest, &sin, &tstamp, tasks);
-+
-+	ret = recv_message(fd, buf, sizeof(buf), &rdma_dest, &sin, &tstamp, tasks, opts);
- 	if (ret < 0)
- 		return ret;
- 
- 	/* If we received only RDMA completions or cong updates,
- 	 * ret will be 0 */
--	if (ret == 0)
-+	if (ret == 0) {
- 		return 0;
-+	}
- 
- 	/* check the incoming sequence number */
- 	task_index = ntohs(sin.sin_port) - opts->starting_port - 1;
-@@ -1508,16 +1809,32 @@
- 	hdr.to_port = t->src_addr.sin_port;
- 	hdr.index = expect_index;
- 
--	if (check_hdr(buf, ret, &hdr))
--		die("header from %s:%u to id %u bogus\n",
--		    inet_ntoa(sin.sin_addr), htons(sin.sin_port),
--		    ntohs(t->src_addr.sin_port));
-+	check_status = check_hdr(buf, ret, &hdr, opts);
-+	if (check_status) {
-+		if (check_status > 0) {
-+			die("header from %s:%u to id %u bogus\n",
-+		    	inet_ntoa(sin.sin_addr), htons(sin.sin_port),
-+		    	ntohs(t->src_addr.sin_port));
-+		} else
-+			return 0;
-+	}
- 
- 	if (hdr.op == OP_ACK) {
--		stat_inc(&ctl->cur[S_RTT_USECS],
--			 usec_sub(&tstamp, &t->send_time[expect_index]));
--		t->pending -= 1;
-+                uint64_t rtt_time = 
-+                  usec_sub(&tstamp, &t->send_time[expect_index]);
- 
-+		stat_inc(&ctl->cur[S_RTT_USECS], rtt_time);
-+                if (rtt_time > rtt_threshold)
-+			print_outlier("Found RTT = 0x%lx\n", rtt_time);
-+
-+                if (show_histogram)
-+                {
-+                  ctl->latency_histogram[get_bucket(rtt_time)]++;
-+                }
-+
-+		if (t->pending > 0)
-+			t->pending -= 1;
-+
- 		if (in_hdr.rdma_key)
- 			rdma_process_ack(fd, &in_hdr, ctl);
- 	} else {
-@@ -1549,6 +1866,7 @@
- }
- 
- static void run_child(pid_t parent_pid, struct child_control *ctl,
-+			struct child_control *all_ctl,
- 		      struct options *opts, uint16_t id, int active)
- {
- 	struct sockaddr_in sin;
-@@ -1559,8 +1877,15 @@
- 	struct task tasks[opts->nr_tasks];
- 	struct timeval start;
-         int do_work = opts->simplex ? active : 1;
-+	int j;
- 
-+
-+#if defined(__SVR4) && defined(__sun)
-+	set_my_lgrp();
-+	sin.sin_family = AF_INET_OFFLOAD;
-+#else
- 	sin.sin_family = AF_INET;
-+#endif
- 	sin.sin_port = htons(opts->starting_port + 1 + id);
- 	sin.sin_addr.s_addr = htonl(opts->receive_addr);
- 
-@@ -1572,7 +1897,11 @@
- 	for (i = 0; i < opts->nr_tasks; i++) {
- 		tasks[i].nr = i;
- 		tasks[i].src_addr = sin;
-+#if defined(__SVR4) && defined(__sun)
-+		tasks[i].dst_addr.sin_family = AF_INET_OFFLOAD;
-+#else
- 		tasks[i].dst_addr.sin_family = AF_INET;
-+#endif
- 		tasks[i].dst_addr.sin_addr.s_addr = htonl(opts->send_addr);
- 		tasks[i].dst_addr.sin_port = htons(opts->starting_port + 1 + i);
- 		tasks[i].send_time = alloca(opts->req_depth * sizeof(struct timeval));
-@@ -1581,6 +1910,15 @@
- 		tasks[i].rdma_buf = alloca(opts->req_depth * sizeof(uint64_t *));
- 		tasks[i].local_buf = alloca(opts->req_depth * sizeof(uint64_t *));
- 		tasks[i].ack_header = alloca(opts->req_depth * sizeof(struct header));
-+		tasks[i].ack2_header = alloca(opts->req_depth * sizeof(struct header));
-+		for (j=0;j<opts->req_depth;j++)
-+			tasks[i].ack2_header[j].pending = 0;
-+
-+		tasks[i].req_header = alloca(opts->req_depth * sizeof(struct header));
-+		for (j=0;j<opts->req_depth;j++)
-+			tasks[i].req_header[j].pending = 0;
-+
-+		tasks[i].retry_token = alloca(2 * opts->req_depth * sizeof(uint64_t));
- 		tasks[i].rdma_next_op = (i & 1)? RDMA_OP_READ : RDMA_OP_WRITE;
- 	}
- 
-@@ -1611,7 +1949,7 @@
- 
- 		check_parent(parent_pid);
- 
--		ret = poll(&pfd, 1, -1);
-+		ret = poll(&pfd, 1, 1000);
- 		if (ret < 0) {
- 			if (errno == EINTR)
- 				continue;
-@@ -1621,10 +1959,14 @@
- 		pfd.events = POLLIN;
- 
- 		if (pfd.revents & POLLIN) {
--			while (recv_one(fd, tasks, opts, ctl) >= 0)
-+			while (recv_one(fd, tasks, opts, ctl, all_ctl) >= 0)
- 				;
- 		}
- 
-+		/* stop sending if in shutdown phase */
-+		if (ctl->stopping)
-+			continue;
-+
- 		/* keep the pipeline full */
- 		can_send = !!(pfd.revents & POLLOUT);
- 		for (i = 0, t = tasks; i < opts->nr_tasks; i++, t++) {
-@@ -1633,6 +1975,7 @@
- 			if (t->drain_rdmas)
- 				continue;
- 			if (send_anything(fd, t, opts, ctl, can_send, do_work) < 0) {
-+
- 				pfd.events |= POLLOUT;
- 
- 				/* If the send queue is full, we will see EAGAIN.
-@@ -1665,8 +2008,12 @@
- 	uint32_t i;
- 
- 	len = opts->nr_tasks * sizeof(*ctl);
-+#if defined(__SVR4) && defined(__sun)
-+	ctl = (struct child_control *)mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0);
-+#else
- 	ctl = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED,
- 		   0, 0);
-+#endif
- 	if (ctl == MAP_FAILED)
- 		die("mmap of %u child control structs failed", opts->nr_tasks);
- 
-@@ -1688,7 +2035,7 @@
- 				control_fd = -1;
- 			}
- 			rdma_key_o_meter_set_self(i);
--			run_child(parent, ctl + i, opts, i, active);
-+			run_child(parent, ctl + i, ctl, opts, i, active);
- 			exit(0);
- 		}
- 		ctl[i].pid = pid;
-@@ -1699,7 +2046,7 @@
- 			continue;
- 		pid = waitpid(-1, NULL, WNOHANG);
- 		if (pid)
--			die("child %u (pid %u) exited\n", i, pid);
-+			die("child %u (pid %u) exited\n", i, (int)pid);
- 		sleep(1);
- 		i--; /* try this child again */
- 	}
-@@ -1823,6 +2170,7 @@
- 
- 	if (disable)
- 		return;
-+#if !(defined(__SVR4) && defined(__sun))
- 	if ((fp = fopen("/proc/stat", "r")) == NULL) {
- 		fprintf(stderr, "Cannot open /proc/stat (%s) - "
- 				"not printing cpu stats\n",
-@@ -1856,10 +2204,37 @@
- 		}
- 	}
- 	fclose(fp);
-+#else
-+#define NSEC_TO_TICK(v)		(v * sysconf(_SC_CLK_TCK)/1000000000)
-+	sol_cpu_stats_t		stats;	
- 
-+	solaris_init();
-+	if ((sol_get_cpu_stats(&stats)) < 0) {
-+		disable = 1;
-+		return;
-+	}
-+	solaris_fini();
-+	current.times[0] = stats.t_user;
-+	current.times[1] = 0;
-+	current.times[2] = stats.t_kernel;
-+	current.times[3] = stats.t_idle;
-+	current.times[4] = stats.t_iowait;
-+	current.times[5] = 0;
-+	current.times[6] = 0;
-+	current.times[7] = 0;
-+	current.intr = NSEC_TO_TICK(stats.t_intr);	/* NSEC_TO_TICK */
-+
-+#endif
-+
- 	if (initialize) {
-+#if !(defined(__SVR4) && defined(__sun))
- 		printf(",user:percent,system:percent,idle:percent"
- 		       ",irq:percent,intr:count");
-+#else
-+		/* Solaris kstat doesn't provide irq/softirq info. */
-+		printf(",user:percent,system:percent,idle:percent"
-+		       ",intr:count");
-+#endif
- 	} else {
- 		struct sys_stats sys;
- 		unsigned long sum = 0;
-@@ -1884,6 +2259,7 @@
- 		 *  5	irq
- 		 *  6	softirq
- 		 */
-+#if !(defined(__SVR4) && defined(__sun))
- 		printf(",%f,%f,%f,%f,%Lu",
- 			(sys.times[0] + sys.times[1]) * scale,
- 			sys.times[2] * scale,
-@@ -1890,6 +2266,14 @@
- 			(sys.times[3] + sys.times[4]) * scale,
- 			(sys.times[5] + sys.times[6]) * scale,
- 			sys.intr);
-+#else
-+		/* Solaris kstat doesn't provide irq/softirq info. */
-+		printf(",%f,%f,%f,%Lu",
-+			(sys.times[0] + sys.times[1]) * scale,
-+			sys.times[2] * scale,
-+			(sys.times[3] + sys.times[4]) * scale,
-+			sys.intr);
-+#endif
- 	}
- 	prev = current;
- }
-@@ -1903,6 +2287,10 @@
- 	static socklen_t buflen = 0;
- 	static int sock_fd = -1;
- 	int i, count, item_size;
-+#if defined(__SVR4) && defined(__sun)
-+	socklen_t len;
-+	struct rds_info_arg arg;
-+#endif
- 
- 	if (sock_fd < 0) {
- 		sock_fd = socket(pf, SOCK_SEQPACKET, 0);
-@@ -1912,6 +2300,7 @@
- 
- 	/* We should only loop once on the first call; after that the
- 	 * buffer requirements for RDS counters should not change. */
-+#if !(defined(__SVR4) && defined(__sun))
- 	while ((item_size = getsockopt(sock_fd, sol, RDS_INFO_COUNTERS, curr, &buflen)) < 0) {
- 		if (errno != ENOSPC)
- 			die_errno("getsockopt(RDS_INFO_COUNTERS) failed");
-@@ -1919,7 +2308,29 @@
- 		if (!curr)
- 			die_errno("Cannot allocate buffer for stats counters");
- 	}
-+#else
-+	int retcode;
- 
-+	retcode = sol_ioctl(
-+	    sock_fd, RDS_INFO_COUNTERS, &arg, &buflen, &item_size);
-+	if (retcode != 0) {
-+		if (retcode == 1) {
-+			die_errno("ioctl(RDS_INFO_COUNTERS) failed");
-+		} else if (retcode == 2) {
-+			fprintf(stderr, "%s: Unable to allocate memory "
-+			    "for %u bytes of info: %s\n",
-+			    "rds-stress", buflen, strerror(errno));
-+			return;
-+		} else {
-+			fprintf(stderr, "%s: Unable to access "
-+			    "RDS_INFO_COUNTERS statistics: %s\n",
-+			    "rds-stress", strerror(errno));
-+			return;
-+		}
-+	}
-+
-+#endif
-+
- 	if (item_size > sizeof(*ctr))
- 		die("Bad counter item size in RDS_INFO_COUNTERS (got %d, max %zd)\n",
- 				item_size, sizeof(*ctr));
-@@ -1932,8 +2343,11 @@
- 	}
- 
- 	for (i = 0; i < count; ++i)
-+#if !(defined(__SVR4) && defined(__sun))
- 		memcpy(ctr + i, curr + i * item_size, item_size);
--
-+#else
-+		memcpy(ctr + i, ((void *)(uintptr_t)arg.datap) + i * item_size, item_size);
-+#endif
- 	gettimeofday(&now, NULL);
- 
- 	if (initialize) {
-@@ -1957,6 +2371,10 @@
- 	memcpy(prev, ctr, count * sizeof(*ctr));
- 	last_ts = now;
- 
-+#if defined(__SVR4) && defined(__sun)
-+	free((void *)(uintptr_t)arg.datap);
-+#endif
-+
- 	get_stats(initialize);
- }
- 
-@@ -1967,7 +2385,7 @@
- 
- 	pid = waitpid(-1, &status, wflags);
- 	if (pid < 0)
--		die("waitpid returned %u", pid);
-+		die("waitpid returned %u", (int)pid);
- 	if (pid == 0)
- 		return 0;
- 
-@@ -1975,15 +2393,15 @@
- 		if (WEXITSTATUS(status) == 0)
- 			return 1;
- 		die("child pid %u exited with status %d\n",
--				pid, WEXITSTATUS(status));
-+				(int)pid, WEXITSTATUS(status));
- 	}
- 	if (WIFSIGNALED(status)) {
- 		if (WTERMSIG(status) == SIGTERM)
- 			return 1;
- 		die("child pid %u exited with signal %d\n",
--				pid, WTERMSIG(status));
-+				(int)pid, WTERMSIG(status));
- 	}
--	die("child pid %u wait status %d\n", pid, status);
-+	die("child pid %u wait status %d\n", (int)pid, status);
- }
- 
- static void release_children_and_wait(struct options *opts,
-@@ -1995,9 +2413,13 @@
- 	struct counter summary[NR_STATS];
- 	struct timeval start, end, now, first_ts, last_ts;
- 	double cpu_total = 0;
--	uint16_t i, cpu_samples = 0;
-+	uint16_t i, j, cpu_samples = 0;
- 	uint16_t nr_running;
-+        uint64_t latency_histogram[MAX_BUCKETS];
- 
-+	if (show_histogram) 
-+	        memset(latency_histogram, 0, sizeof(latency_histogram));
-+
- 	gettimeofday(&start, NULL);
- 	start.tv_sec += 2;
- 	for (i = 0; i < opts->nr_tasks; i++)
-@@ -2139,7 +2561,12 @@
- 	control_fd = -1;
- 
- 	if (nr_running) {
-+		/* let everything gracefully stop before we kill the chillins */
- 		for (i = 0; i < opts->nr_tasks; i++)
-+			ctl[i].stopping = 1;
-+		sleep(1);
-+
-+		for (i = 0; i < opts->nr_tasks; i++)
- 			kill(ctl[i].pid, SIGTERM);
- 		stop_soakers(soak_arr);
- 	}
-@@ -2167,6 +2594,19 @@
- 			avg(&summary[S_SENDMSG_USECS]),
- 			avg(&summary[S_RTT_USECS]),
- 			soak_arr? scale * cpu_total : -1.0);
-+
-+		if (show_histogram) 
-+		{
-+			for (i = 0; i < opts->nr_tasks; i++)
-+			  for (j=0;j < MAX_BUCKETS; j++)
-+			    latency_histogram[j] += ctl[i].latency_histogram[j];
-+			    
-+			printf("\nRTT histogram\n");
-+			printf("RTT (us)        \t\t    Count\n");
-+			for (i=0;i < MAX_BUCKETS; i++)
-+			  printf("[%6u - %6u] \t\t %8u\n", 1 << i, 1 << (i+1), 
-+			         (unsigned int)latency_histogram[i]);
-+		}
- 	}
- }
- 
-@@ -2220,6 +2660,21 @@
- {
- 	ssize_t ret;
- 
-+	if (size == sizeof(struct options)) {
-+		memset(ptr, 0, size);
-+		ret = read(fd, peer_version, VERSION_MAX_LEN);
-+		if (ret != VERSION_MAX_LEN)
-+			die_errno("Failed to read version");
-+
-+		if (strcmp(peer_version, RDS_VERSION)) {
-+			ptr += ret;
-+			memcpy(ptr, peer_version, VERSION_MAX_LEN);
-+			size = sizeof(struct options_2_0_6) - ret;
-+		} else
-+			size -= ret;
-+		ptr += ret;
-+	}
-+
- 	while (size) {
- 		ret = read(fd, ptr, size);
- 		if (ret < 0)
-@@ -2233,6 +2688,7 @@
- 
- static void encode_options(struct options *dst, const struct options *src)
- {
-+	memcpy(dst->version, src->version, VERSION_MAX_LEN);
- 	dst->req_depth = htonl(src->req_depth);
- 	dst->req_size = htonl(src->req_size);
- 	dst->ack_size = htonl(src->ack_size);
-@@ -2262,10 +2718,13 @@
-         dst->simplex = src->simplex;                    /* byte sized */
-         dst->rw_mode = src->rw_mode;                    /* byte sized */
-         dst->rdma_vector = htonl(src->rdma_vector);
-+	dst->tos = src->tos;
-+	dst->async = src->async;
- }
- 
- static void decode_options(struct options *dst, const struct options *src)
- {
-+	memcpy(dst->version, src->version, VERSION_MAX_LEN);
- 	dst->req_depth = ntohl(src->req_depth);
- 	dst->req_size = ntohl(src->req_size);
- 	dst->ack_size = ntohl(src->ack_size);
-@@ -2295,6 +2754,8 @@
-         dst->simplex = src->simplex;                    /* byte sized */
-         dst->rw_mode = src->rw_mode;                    /* byte sized */
- 	dst->rdma_vector = ntohl(src->rdma_vector);
-+	dst->tos = src->tos;
-+	dst->async = src->async;
- }
- 
- static void verify_option_encdec(const struct options *opts)
-@@ -2316,6 +2777,25 @@
- 		die("encode/decode check of options struct failed");
- }
- 
-+static void reset_conn(struct options *opts)
-+{
-+	struct rds_reset val;
-+	int fd;
-+	struct sockaddr_in sin;
-+
-+	sin.sin_family = AF_INET;
-+	sin.sin_port = htons(opts->starting_port);
-+	sin.sin_addr.s_addr = htonl(opts->receive_addr);
-+
-+	fd = bound_socket(pf, SOCK_SEQPACKET, 0, &sin);
-+
-+	val.tos = opts->tos;
-+	val.src.s_addr = htonl(opts->receive_addr);
-+	val.dst.s_addr = htonl(opts->send_addr);
-+	if (setsockopt(fd, sol, RDS_CONN_RESET, &val, sizeof(val)))
-+		die_errno("setsockopt RDS_CONN_RESET failed");
-+}
-+
- static int active_parent(struct options *opts, struct soak_control *soak_arr)
- {
- 	struct options enc_options;
-@@ -2324,6 +2804,11 @@
- 	int fd;
- 	uint8_t ok;
- 
-+	if (reset_connection) {
-+		reset_conn(opts);
-+		return 0;
-+	}
-+
- 	if (opts->show_params) {
- 		unsigned int k;
- 
-@@ -2387,7 +2872,11 @@
- 	 * We just tell the peer what options to use.
- 	 */
- 	encode_options(&enc_options, opts);
--	peer_send(fd, &enc_options, sizeof(struct options));
-+	if (opts->tos || opts->async)
-+		peer_send(fd, &enc_options, sizeof(struct options));
-+	else
-+		peer_send(fd, &enc_options.req_depth,
-+				sizeof(struct options_2_0_6));
- 
- 	printf("negotiated options, tasks will start in 2 seconds\n");
- 	ctl = start_children(opts, 1);
-@@ -2517,7 +3006,11 @@
- 	/* an extra terminating entry which will be all 0s */
- 	len = (nr_soak + 1) * sizeof(struct soak_control);
- 	soak_arr = mmap(NULL, len, PROT_READ|PROT_WRITE,
-+#if defined(__SVR4) && defined(__sun)
-+			MAP_ANONYMOUS|MAP_SHARED, -1, 0);
-+#else
- 			MAP_ANONYMOUS|MAP_SHARED, 0, 0);
-+#endif
- 	if (soak_arr == MAP_FAILED)
- 		die("mmap of %ld soak control structs failed", nr_soak);
- 
-@@ -2572,6 +3065,10 @@
- 	OPT_CONNECT_RETRIES,
- 	OPT_USE_CONG_MONITOR,
- 	OPT_PERFDATA,
-+        OPT_SHOW_OUTLIERS,
-+        OPT_SHOW_HISTOGRAM,
-+	OPT_RESET,
-+	OPT_ASYNC,
- };
- 
- static struct option long_options[] = {
-@@ -2584,11 +3081,13 @@
- { "send-addr",		required_argument,	NULL,	's'	},
- { "port",		required_argument,	NULL,	'p'	},
- { "time",		required_argument,	NULL,	'T'	},
-+{ "tos",                required_argument,      NULL,   'Q'     },
- { "report-cpu",		no_argument,		NULL,	'c'	},
- { "report-summary",	no_argument,		NULL,	'z'	},
- { "rtprio",		no_argument,		NULL,	'R'	},
- { "verify",		no_argument,		NULL,	'v'	},
- { "trace",		no_argument,		NULL,	'V'	},
-+{ "lgrpid",		required_argument,	NULL,	'g'	},
- 
- { "rdma-use-once",	required_argument,	NULL,	OPT_RDMA_USE_ONCE },
- { "rdma-use-get-mr",	required_argument,	NULL,	OPT_RDMA_USE_GET_MR },
-@@ -2601,6 +3100,10 @@
- { "show-perfdata",	no_argument,		NULL,	OPT_PERFDATA },
- { "connect-retries",	required_argument,	NULL,	OPT_CONNECT_RETRIES },
- { "use-cong-monitor",	required_argument,	NULL,	OPT_USE_CONG_MONITOR },
-+{ "show-outliers",      required_argument,      NULL,   OPT_SHOW_OUTLIERS    },
-+{ "show-histogram",     no_argument,            NULL,   OPT_SHOW_HISTOGRAM   },
-+{ "reset",              no_argument,            NULL,   OPT_RESET },
-+{ "async",              no_argument,            NULL,   OPT_ASYNC },
- 
- { NULL }
- };
-@@ -2640,6 +3143,8 @@
- 	opts.use_cong_monitor = 1;
- 	opts.rdma_use_fence = 1;
- 	opts.rdma_cache_mrs = 0;
-+	opts.rdma_use_once = 0;
-+	opts.rdma_use_get_mr = 0;
- 	opts.rdma_alignment = 0;
- 	opts.rdma_key_o_meter = 0;
- 	opts.show_params = 0;
-@@ -2648,11 +3153,17 @@
-         opts.simplex = 0;
-         opts.rw_mode = 0;
- 	opts.rdma_vector = 1;
-+        rtt_threshold = ~0U;
-+        show_histogram = 0;
-+	opts.tos = 0;
-+	reset_connection = 0;
-+	opts.async = 0;
-+	strcpy(opts.version, RDS_VERSION);
- 
- 	while(1) {
- 		int c, index;
- 
--		c = getopt_long(argc, argv, "+a:cD:d:hI:M:op:q:Rr:s:t:T:vVz",
-+		c = getopt_long(argc, argv, "+a:cD:d:hI:M:op:q:Rr:s:t:T:Q:vVg:z",
- 				long_options, &index);
- 		if (c == -1)
- 			break;
-@@ -2702,6 +3213,9 @@
- 			case 'T':
- 				opts.run_time = parse_ull(optarg, (uint32_t)~0);
- 				break;
-+			case 'Q':
-+				opts.tos = parse_ull(optarg, (uint8_t)~0);
-+				break;
- 			case 'z':
- 				opts.summary_only = 1;
- 				break;
-@@ -2711,9 +3225,25 @@
- 			case 'V':
- 				opts.tracing = 1;
- 				break;
-+			case 'g':
-+				lgrp_id = (lgrp_id_t)parse_ull(optarg,
-+				    (uint32_t)~0);
-+				break;
-+                        case OPT_SHOW_OUTLIERS:
-+                                rtt_threshold = parse_ull(optarg, ~0U);
-+                                break;
-+                        case OPT_SHOW_HISTOGRAM:
-+                                show_histogram = 1;
-+                                break;
- 			case OPT_USE_CONG_MONITOR:
- 				opts.use_cong_monitor = parse_ull(optarg, 1);
- 				break;
-+			case OPT_RESET:
-+				reset_connection = 1;
-+				break;
-+			case OPT_ASYNC:
-+				opts.async = 1;
-+				break;
- 			case OPT_RDMA_USE_ONCE:
- 				opts.rdma_use_once = parse_ull(optarg, 1);
- 				break;
-@@ -2786,6 +3316,7 @@
- 	if (opts.rdma_size && 0)
- 		opts.rdma_size = (opts.rdma_size + 4095) & ~4095;
- 
-+	set_my_lgrp();
- 	opt = opts;
- 	return active_parent(&opts, soak_arr);
- }
-diff -r -u /tmp/rds-tools-2.0.4/pfhack.h rds-tools-2.0.7/pfhack.h
---- /tmp/rds-tools-2.0.4/pfhack.h	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/pfhack.h	Thu Feb 24 13:27:51 2011
-@@ -44,9 +44,11 @@
- #ifndef __PF_HACK_H
- #define __PF_HACK_H
- 
-+#if !((defined(__SVR4) && defined(__sun)))
- #define PF_RDS		21
- #define AF_RDS		21
- #define SOL_RDS		276
-+#endif
- 
- extern int discover_pf_rds();
- extern int discover_sol_rds();
-diff -r -u /tmp/rds-tools-2.0.4/rds-info.c rds-tools-2.0.7/rds-info.c
---- /tmp/rds-tools-2.0.4/rds-info.c	Wed Aug  4 15:25:10 2010
-+++ rds-tools-2.0.7/rds-info.c	Thu Feb 24 13:27:51 2011
-@@ -42,16 +42,28 @@
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <errno.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <strings.h>
-+#else
- #include <string.h>
-+#endif
- #include <inttypes.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- 
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/rds.h>
-+#include <infiniband/ofa_solaris.h>
-+#else
- #include "rds.h"
-+#endif
- #include "pfhack.h"
- 
-+/* WHUPS changed the struct rds_info_connection definition b/w rds in 1.4 & 1.5. gotta support both
-+   for now. TODO remove check of transport[15] once ofed pre-1.5 is extinct. */
- #define rds_conn_flag(conn, flag, letter) \
--	(conn.flags & RDS_INFO_CONNECTION_FLAG_##flag ? letter : '-')
-+	(conn.flags & RDS_INFO_CONNECTION_FLAG_##flag \
-+	|| conn.transport[15] & RDS_INFO_CONNECTION_FLAG_##flag ? letter : '-')
- 
- #define min(a, b) (a < b ? a : b)
- #define array_size(foo) (sizeof(foo) / sizeof(foo[0]))
-@@ -76,6 +88,10 @@
- 
- char *progname = "rds-info";
- 
-+#if defined(__SVR4) && defined(__sun)
-+int sol_ioctl(int, int, struct rds_info_arg *, socklen_t *, int *);
-+#endif
-+
- /* Like inet_ntoa, but can be re-entered several times without clobbering
-  * the previously returned string. */
- static const char *paddr(int af, const void *addrp)
-@@ -134,18 +150,20 @@
- {
- 	struct rds_info_connection conn;
- 
--	printf("\nRDS Connections:\n%15s %15s %16s %16s %3s\n",
--		"LocalAddr", "RemoteAddr", "NextTX", "NextRX", "Flg");
-+	printf("\nRDS Connections:\n%15s %15s %4s %16s %16s %4s\n",
-+		"LocalAddr", "RemoteAddr", "Tos", "NextTX", "NextRX", "Flgs");
- 	
- 	for_each(conn, data, each, len) {
--		printf("%15s %15s %16"PRIu64" %16"PRIu64" %c%c%c\n",
-+		printf("%15s %15s %4u %16"PRIu64" %16"PRIu64" %c%c%c%c\n",
- 			ipv4addr(conn.laddr),
- 			ipv4addr(conn.faddr),
-+			conn.tos,
- 			conn.next_tx_seq,
- 			conn.next_rx_seq,
- 			rds_conn_flag(conn, SENDING, 's'),
- 			rds_conn_flag(conn, CONNECTING, 'c'),
--			rds_conn_flag(conn, CONNECTED, 'C'));
-+			rds_conn_flag(conn, CONNECTED, 'C'),
-+			rds_conn_flag(conn, ERROR, 'E'));
- 	}
- }
- 
-@@ -153,16 +171,17 @@
- {
- 	struct rds_info_message msg;
- 
--	printf("\n%s Message Queue:\n%15s %5s %15s %5s %16s %10s\n",
-+	printf("\n%s Message Queue:\n%15s %5s %15s %5s %4s %16s %10s\n",
- 		(char *)extra,
--		"LocalAddr", "LPort", "RemoteAddr", "RPort", "Seq", "Bytes");
-+		"LocalAddr", "LPort", "RemoteAddr", "RPort", "Tos","Seq", "Bytes");
- 	
- 	for_each(msg, data, each, len) {
--		printf("%15s %5u %15s %5u %16"PRIu64" %10u\n",
-+		printf("%15s %5u %15s %5u %4u %16"PRIu64" %10u\n",
- 			ipv4addr(msg.laddr),
- 			ntohs(msg.lport),
- 			ipv4addr(msg.faddr),
- 			ntohs(msg.fport),
-+			msg.tos,
- 			msg.seq, msg.len);
- 	}
- }
-@@ -191,13 +210,14 @@
- {
- 	struct rds_info_rdma_connection ic;
- 
--	printf("\nRDS IB Connections:\n%15s %15s %32s %32s\n",
--		"LocalAddr", "RemoteAddr", "LocalDev", "RemoteDev");
-+	printf("\nRDS IB Connections:\n%15s %15s %4s %3s %32s %32s\n",
-+		"LocalAddr", "RemoteAddr", "Tos", "SL", "LocalDev", "RemoteDev");
- 
- 	for_each(ic, data, each, len) {
--		printf("%15s %15s %32s %32s",
-+		printf("%15s %15s %4u %3u %32s %32s",
- 			ipv4addr(ic.src_addr),
- 			ipv4addr(ic.dst_addr),
-+			ic.tos,ic.sl,
- 			ipv6addr(ic.src_gid),
- 			ipv6addr(ic.dst_gid));
- 
-@@ -234,8 +254,10 @@
- 		print_msgs, "Send", 0 },
- 	['t'] = { RDS_INFO_RETRANS_MESSAGES, "retransmit queue messages",
- 		  print_msgs, "Retransmit", 0 },
-+#if !(defined(__SVR4) && defined(__sun))
- 	['T'] = { RDS_INFO_TCP_SOCKETS, "TCP transport sockets",
- 		  print_tcp_socks, NULL, 0 },
-+#endif
- 	['I'] = { RDS_INFO_IB_CONNECTIONS, "IB transport connections",
- 		  print_ib_conns, NULL, 0 },
- };
-@@ -266,6 +288,9 @@
- 	char optstring[258] = "v+";
- 	int given_options = 0;
- 	socklen_t len = 0;
-+#if defined(__SVR4) && defined(__sun)
-+	struct rds_info_arg arg;
-+#endif
- 	void *data = NULL;
- 	int fd;
- 	int each;
-@@ -322,6 +347,7 @@
- 		    (given_options && !infos[i].option_given))
- 			continue;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 		/* read in the info until we get a full snapshot */
- 		while ((each = getsockopt(fd, sol, infos[i].opt_val, data,
- 				   &len)) < 0) {
-@@ -345,15 +371,47 @@
- 				return 1;
- 			}
- 		}
-+#else
-+		int retcode;
- 
-+		retcode = sol_ioctl(fd, infos[i].opt_val, &arg, &len, &each);
-+		if (retcode != 0) {
-+			if (retcode == 1) {
-+				fprintf(stderr, "%s: Unable get statistics: "
-+				    "%s\n", progname, strerror(errno));
-+				return 1;
-+			} else if (retcode == 2) {
-+				fprintf(stderr, "%s: Unable to allocate memory"
-+				    " for %u bytes of info: %s\n",
-+				    progname, len, strerror(errno));
-+				return 1;
-+			} else {
-+				fprintf(stderr, "%s: Unable to get statistics:"
-+				    " %s\n", progname, strerror(errno));
-+				return 1;
-+			}
-+		}
-+
-+		/* No data at the driver */
-+		if (len == 0)
-+			invalid_opt = 1;;
-+#endif
-+
- 		if (invalid_opt)
- 			continue;
- 
-+#if !(defined(__SVR4) && defined(__sun))
- 		infos[i].print(data, each, len, infos[i].extra);
--
-+#else
-+		infos[i].print((void *)(uintptr_t)arg.datap, each, len,
-+		    infos[i].extra);
-+#endif
- 		if (given_options && --given_options == 0)
- 			break;
- 	}
-+#if defined(__SVR4) && defined(__sun)
-+	free((void *)(uintptr_t)arg.datap);
-+#endif
- 
- 	return 0;
- }
-diff -r -u /tmp/rds-tools-2.0.4/rds.7 rds-tools-2.0.7/rds.7
---- /tmp/rds-tools-2.0.4/rds.7	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/rds.7	Thu Feb 24 13:27:52 2011
-@@ -6,6 +6,7 @@
- .nf
- .B #include <sys/socket.h>
- .B #include <netinet/in.h>
-+.B #include <sys/rds.h>
- .fi
- .SH DESCRIPTION
- This is an implementation of the RDS socket API. It provides reliable,
-@@ -14,18 +15,13 @@
- Currently, RDS can be transported over Infiniband, and loopback.
- RDS over TCP is disabled, but will be re-enabled in the near future.
- .PP
--RDS uses standard
--.B AF_INET
--addresses as described in
--.BR ip (7)
-+RDS uses 
-+.B AF_INET_OFFLOAD address family 
- to identify end points.
- .\"------------------------------------------------------------------
- .SS Socket Creation
- RDS is still in development and as such does not have a reserved protocol
--family constant. Applications must read the string representation of the
--protocol family value from the
--.B pf_rds
--sysctl parameter file described below.
-+family constant.  Applications should use AF_INET_OFFLOAD.
- .PP
- .nf
- .B rds_socket = socket(pf_rds, SOCK_SEQPACKET, 0);
-@@ -58,9 +54,6 @@
- .BR SOL_RDS ).
- Just as with the RDS protocol family, an official value has not been
- assigned yet, so the kernel will assign a value dynamically.
--The assigned value can be retrieved from the
--.B sol_rds
--sysctl parameter file.
- .PP
- RDS specific socket options will be described in a separate section
- below.
-@@ -77,7 +70,7 @@
- .PP
- For instance, when binding to the address of an Infiniband interface
- such as
--.BR ib0 ,
-+.BR ibd0 ,
- the socket will use the Infiniband transport. If RDS is not able
- to associate a transport with the given address, it will return
- .BR EADDRNOTAVAIL .
-@@ -394,47 +387,6 @@
- be delivered in the order they're sent. Messages sent from different
- sockets, or to different destinations, may be delivered in any order.
- .\"------------------------------------------------------------------
--.SH SYSCTL VALUES
--These parameteres may only be accessed through their files in
--.BR /proc/sys/net/rds .
--Access through
--.BR sysctl (2)
--is not supported.
--.TP
--.B pf_rds
--This file contains the string representation of the protocol family
--constant passed to
--.BR socket (2)
--to create a new RDS socket.
--.TP
--.B sol_rds
--This file contains the string representation of the socket level parameter
--that is passed to
--.BR getsockopt (2)
--and
--.BR setsockopt (2)
--to manipulate RDS socket options.
--.TP
--.BR max_unacked_bytes " and " max_unacked_packets
--These parameters are used to tune the generation of acknowledgements. By
--default, the system receiving RDS messages does not send back explicit
--acknowledgements unless it transmits a message of its own (in which
--case the ACK is piggybacked onto the outgoing message), or when the sending
--system requests an ACK.
--.IP
--However, the sender needs to see an ACK from time to time so that it
--can purge old messages from the send queue. The unacked bytes and
--packet counters are used to keep track of how much data has been
--sent without requesting an ACK. The default is to request an acknowledgement
--every 16 packets, or every 16 MB, whichever comes first.
--.TP
--.BR reconnect_delay_min_ms " and " reconnect_delay_max_ms
--RDS uses host-to-host connections to transport RDS messages (both for the TCP
--and the Infiniband transport). If this connection breaks, RDS will try to
--re-establish the connection. Because this reconnect may be triggered by
--both hosts at the same time and fail, RDS uses a random backoff before attempting
--a reconnect. These two parameters specify the minimum and maximum delay in
--milliseconds. The default values are 1 and 1000, respectively.
- .SH SEE ALSO
- .BR rds-rdma (7),
- .BR socket (2),
-diff -r -u /tmp/rds-tools-2.0.4/rds-info.1 rds-tools-2.0.7/rds-info.1
---- /tmp/rds-tools-2.0.4/rds-info.1	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/rds-info.1	Thu Feb 24 13:27:51 2011
-@@ -1,162 +1,160 @@
--.Dd October 30, 2006
--.Dt RDS-INFO 1
--.Os
--.Sh NAME
--.Nm rds-info
--.Nd display information from the RDS kernel module
--.Pp
--.Sh SYNOPSIS
--.Nm rds-info
--.Op Fl v
--.Bk -words
--.Op Fl cknrstIT
-+.TH RDS-INFO 1 "October 30, 2006"
-+.SH "NAME"
-+rds-info - display information from the RDS kernel module
-+.SH SYNOPSIS
-+.B rds-info [-cknrstIT]
- 
--.Sh DESCRIPTION
--The
--.Nm
--utility presents various sources of information that
-+.SH DESCRIPTION
-+.PP
-+The utility presents various sources of information that
- the RDS kernel module maintains.  When run without any optional arguments
--.Nm
- will output all the information it knows of.  When options are specified then
- only the information associated with those options is displayed.
- 
- The options are as follows:
--.Bl -tag -width Ds
--.It Fl v
-+.SH OPTIONS
-+.PP
-+.TP 7
-+\fB\-v
- Requests verbose output. When this option is given, some classes of information
- will display additional data.
- 
--.It Fl c
-+.TP
-+\fB\-c
- Display global counters.  Each counter increments as its event
- occurs.  The counters may not be reset.  The set of supported counters
- may change over time.
- 
--.Bl -tag -width 4
--.It CounterName
-+.IP	CounterName
- The name of the counter.  These names come from the kernel and can change
- depending on the capability of the kernel module.
--.It Value
-+.IP 	Value
- The number of times that the counter has been incremented since the kernel
- module was loaded.
--.El
- 
--.It Fl k
-+.TP
-+\fB\-k\fR
- Display all the RDS sockets in the system.  There will always be one socket
- listed that is neither bound to nor connected to any addresses because
--.Nm
- itself uses an unbound socket to collect information.
- 
--.Bl -tag -width 4
--.It BoundAddr, BPort
-+.IP	BoundAddr, BPort
- The IP address and port that the socket is bound to.  0.0.0.0 0 indicates that
- the socket has not been bound.
--.It ConnAddr, CPort
-+.IP	ConnAddr, CPort
- The IP address and port that the socket is connected to.  0.0.0.0 0 indicates
- that the socket has not been connected.
--.It SndBuf, RcvBuf
-+.IP	SndBuf, RcvBuf
- The number of bytes of message payload which can be queued for sending or
- receiving on the socket, respectively.
--.It Inode
-+.IP	Inode
- The number of the inode object associated with the socket. Can be used to
- locate the process owning a given socket by searching /proc/*/fd for
- open files referencing a socket with this inode number.
--.El
- 
--.It Fl n
-+.TP
-+\fB\-n\fR
- Display all RDS connections.  RDS connections are maintained between
- nodes by transports.  
- 
--.Bl -tag -width 4
--.It LocalAddr
-+.IP	LocalAddr
- The IP address of this node.  For connections that originate and terminate on
- the same node the local address indicates which address initiated the
- connection establishment.
--.It RemoteAddr
-+.IP	RemoteAddr
- The IP address of the remote end of the connection.  
--.It NextTX
-+.IP	Tos
-+The type of service value for this connection.
-+.IP	NextTX
- The sequence number that will be given to the next message that is sent
- over the connection.
--.It NextRX
-+.IP	NextRX
- The sequence number that is expected from the next message to arrive over
- the connection.  Any incoming messages with sequence numbers less than this
- will be dropped.
--.It Flg
-+.IP	Flg
- Flags which indicate the state of the connection. 
--.Bl -tag -width 4
--.It s
--A process is currently sending a message down the connection.
--.It c
--The transport is attempting to connect to the remote address.
--.It C
--The connection to the remote host is connected and active.
--.El
--.El
- 
--.It Fl r, Fl s, Fl t
-+.IP 		s
-+	A process is currently sending a message down
-+	the connection.
-+.IP 		c
-+	The transport is attempting to connect to the
-+	remote address.
-+.IP 		C
-+	The connection to the remote host is connected
-+	and active.
-+.IP 		E
-+	The connection to the remote host is in error.
-+
-+.TP
-+\fB\-r\fR, \fB\-s\fR, \fB\-t\fR
- Display the messages in the receive, send, or retransmit queues respectively.
--.Bl -tag -width 4
--.It LocalAddr, LPort
-+
-+.IP	LocalAddr, LPort
- The local IP address and port on this node associated with the message. For
- sent messages this is the source address, for receive messages it is the
- destination address.
--.It RemoteAddr, RPort
-+.IP	RemoteAddr, RPort
- The remote IP address and port associated with the message. For sent messages
- this is the destination address, for receive messages it is the source address.
--.It Seq
-+.IP	Tos
-+The type of service for this message.
-+.IP	Seq
- The sequence number of the message.
--.It Bytes
-+.IP	Bytes
- The number of bytes in the message payload.
--.El
- 
-+
-+.PP
- The following information sources are dependent on specific transports which
- may not always be available. 
- 
--.It Fl I
-+.TP 7
-+\fB\-I\fR
- Display the IB connections which the IB transport is using to provide
- RDS connections.
- 
--.Bl -tag -width 4
--.It LocalAddr
-+.IP	LocalAddr
- The local IP address of this connection.
--.It RemoteAddr
-+.IP	RemoteAddr
- The remote IP address of this connection.
--.It LocalDev
-+.IP	Tos
-+The type of service value for this connection.
-+.IP	SL
-+The QoS Service Level for this connection.
-+.IP	LocalDev
- The local IB Global Identifier, printed in IPv6 address syntax.
--.It RemoteDev
-+.IP	RemoteDev
- The remote IB Global Identifier, printed in IPv6 address syntax.
--.El
- 
- If verbose output is requested, per-connection settings such as the
- maximum number of send and receive work requests will be displayed
- in addition.
- 
--.It Fl T
-+.TP 7
-+\fB\-T\fR
- Display the TCP sockets which the TCP transport is using to provide
- RDS connections.
- 
--.Bl -tag -width 4
--.It LocalAddr, LPort
-+.IP	LocalAddr, LPort
- The local IP address and port of this socket.
--.It RemoteAddr, RPort
-+.IP	RemoteAddr, RPort
- The remote IP address and port that this socket is connected to.
--.It HdrRemain
-+.IP	HdrRemain
- The number of bytes that must be read off the socket to complete the next
- full RDS header.
--.It DataRemain
-+.IP	DataRemain
- The number of bytes that must be read off the socket to complete the data
- payload of the message which is being received.
--.It SentNxt
-+.IP	SentNxt
- The TCP sequence number of the first byte of the last message that we sent
- down the connection.
--.It ExpectedUna
-+.IP	ExpectedUna
- The TCP sequence number of the byte past the last byte of the last message
- that we sent down the connection.  When we see that the remote side has
- acked up to this byte then we know that the remote side has received all
- our RDS messages.
--.It SeenUna
-+.IP	SeenUna
- The TCP sequence number of the byte past the last byte which has been
- acked by the remote host.
--.El
--
--.El
--.Pp
-diff -r -u /tmp/rds-tools-2.0.4/rds-ping.1 rds-tools-2.0.7/rds-ping.1
---- /tmp/rds-tools-2.0.4/rds-ping.1	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/rds-ping.1	Thu Feb 24 13:27:52 2011
-@@ -1,69 +1,63 @@
--.Dd Apr 22, 2008
--.Dt RDS-PING 1
--.Os
--.Sh NAME
--.Nm rds-ping
--.Nd test reachability of remote node over RDS
--.Pp
--.Sh SYNOPSIS
--.Nm rds-ping
--.Bk -words
--.Op Fl c Ar count
--.Op Fl i Ar interval
--.Op Fl I Ar local_addr
--.Ar remote_addr
-+.TH RDS-PING 1 "Apr 22, 2008"
-+.SH NAME
-+rds-ping - test reachability of remote node over RDS
- 
--.Sh DESCRIPTION
--.Nm rds-ping
--is used to test whether a remote node is reachable over RDS.
--Its interface is designed to operate pretty much the standard
--.Xr ping 8
-+.SH SYNOPSIS
-+.HP
-+.nf
-+rds-ping [-c count] [-Q tos] [-i interval] [-I local_addr]
-+    remote_addr
-+.fi
-+
-+.SH DESCRIPTION
-+.PP
-+rds-ping is used to test whether a remote node is reachable over RDS.
-+Its interface is designed to operate pretty much the standard ping(1M) 
- utility, even though the way it works is pretty different.
--.Pp
--.Nm rds-ping
--opens several RDS sockets and sends packets to port 0 on
-+.PP
-+rds-ping opens several RDS sockets and sends packets to port 0 on
- the indicated host. This is a special port number to which
- no socket is bound; instead, the kernel processes incoming
- packets and responds to them.
--.Sh OPTIONS
-+.SH OPTIONS
- The following options are available for use on the command line:
--.Bl -tag -width Ds
--.It Fl c Ar count
--Causes
--.Nm rds-ping
--to exit after sending (and receiving) the specified number of
-+.PP
-+.TP 7
-+\fB\-c count
-+Causes rds-ping to exit after sending (and receiving) the specified number of
- packets.
--.It Fl I Ar address
--By default,
--.Nm rds-ping
--will pick the local source address for the RDS socket based
-+.TP
-+\fB\-Q tos
-+By default, rds-ping sends the ping requests on base (tos = 0) RDS connection.
-+With this option, the requests are sent on RDS connection with the specified tos
-+value.  Valid values are 0-255.
-+.TP
-+\fB\-I address
-+By default, rds-ping will pick the local source address for the RDS socket based
- on routing information for the destination address (i.e. if
- packets to the given destination would be routed through interface
--.Nm ib0 ,
-+ib0 ,
- then it will use the IP address of
--.Nm ib0
-+ib0
- as source address).
- Using the
- .Fl I
- option, you can override this choice.
--.It Fl i Ar timeout
--By default,
--.Nm rds-ping
--will wait for one second between sending packets. Use this option
-+.TP
-+\fB\-i timeout
-+By default, rds-ping will wait for one second between sending packets. Use this option
- to specified a different interval. The timeout value is given in
- seconds, and can be a floating point number. Optionally, append
--.Nm msec
-+msec
- or
--.Nm usec
-+usec
- to specify a timeout in milliseconds or microseconds, respectively.
--.It
-+.IP
- Specifying a timeout considerably smaller than the packet round-trip
- time will produce unexpected results.
--.El
--.Sh AUTHORS
--.Nm rds-ping
-+
-+.SH AUTHORS
-+rds-ping
- was written by Olaf Kirch <[email protected]>.
--.Sh SEE ALSO
--.Xr rds 7 ,
--.Xr rds-info 1 ,
--.Xr rds-stress 1 .
-+.S~ SEE ALSO
-+rds 7, rds-info 1, rds-stress 1.
-diff -r -u /tmp/rds-tools-2.0.4/configure.in rds-tools-2.0.7/configure.in
---- /tmp/rds-tools-2.0.4/configure.in	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/configure.in	Thu Feb 24 13:27:51 2011
-@@ -1,7 +1,7 @@
- AC_PREREQ(2.55)
- AC_INIT()
- 
--VERSION=2.0.4
-+VERSION=2.0.7
- RELEASE=1
- 
- AC_SUBST(VERSION)
-diff -r -u /tmp/rds-tools-2.0.4/rds-ping.c rds-tools-2.0.7/rds-ping.c
---- /tmp/rds-tools-2.0.4/rds-ping.c	Wed Aug  4 15:25:10 2010
-+++ rds-tools-2.0.7/rds-ping.c	Thu Feb 24 13:27:52 2011
-@@ -48,7 +48,12 @@
- #include <sys/poll.h>
- #include <fcntl.h>
- #include <getopt.h>
-+#include <sys/ioctl.h>
-+#if defined(__SVR4) && defined(__sun)
-+#include <sys/rds.h>
-+#else
- #include "rds.h"
-+#endif
- 
- #include "pfhack.h"
- 
-@@ -67,6 +72,7 @@
- static unsigned long	opt_count;
- static struct in_addr	opt_srcaddr;
- static struct in_addr	opt_dstaddr;
-+static uint8_t		opt_tos = 0;
- 
- /* For reasons of simplicity, RDS ping does not use a packet
-  * payload that is being echoed, the way ICMP does.
-@@ -91,6 +97,7 @@
- static int	parse_timeval(const char *, struct timeval *);
- static int	parse_long(const char *ptr, unsigned long *);
- static int	parse_addr(const char *ptr, struct in_addr *);
-+static unsigned long long	parse_ull(char *ptr, unsigned long long max);
- 
- int
- main(int argc, char **argv)
-@@ -97,7 +104,7 @@
- {
- 	int c;
- 
--	while ((c = getopt(argc, argv, "c:i:I:")) != -1) {
-+	while ((c = getopt(argc, argv, "c:i:I:Q:")) != -1) {
- 		switch (c) {
- 		case 'c':
- 			if (!parse_long(optarg, &opt_count))
-@@ -114,6 +121,9 @@
- 				die("Bad wait time <%s>\n", optarg);
- 			break;
- 
-+		case 'Q':
-+			opt_tos = parse_ull(optarg, 255);
-+			break;
- 		default:
- 			usage("Unknown option");
- 		}
-@@ -142,6 +152,9 @@
- 	struct timeval	next_ts;
- 	struct socket	socket[NSOCKETS];
- 	struct pollfd	pfd[NSOCKETS];
-+#if !(defined(__SVR4) && defined(__sun))
-+	int             pending[NSOCKETS];
-+#endif
- 	int		i, next = 0;
- 
- 	for (i = 0; i < NSOCKETS; ++i) {
-@@ -152,10 +165,18 @@
- 		socket[i].fd = fd;
- 		pfd[i].fd = fd;
- 		pfd[i].events = POLLIN;
-+#if !(defined(__SVR4) && defined(__sun))
-+		pending[i] = 0;
-+#endif
- 	}
- 
- 	memset(&sin, 0, sizeof(sin));
-+#if defined(__SVR4) && defined(__sun)
-+	sin.sin_family = AF_INET_OFFLOAD;
-+#else
- 	sin.sin_family = AF_INET;
-+#endif
-+
- 	sin.sin_addr = opt_dstaddr;
- 
- 	gettimeofday(&next_ts, NULL);
-@@ -180,14 +201,32 @@
- 			if (opt_count && sent >= opt_count)
- 				break;
- 
--			timeradd(&next_ts, &opt_wait, &next_ts);
--			if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)))
--				err = errno;
--			sp->sent_id = ++sent;
--			sp->sent_ts = now;
--			sp->nreplies = 0;
--			next = (next + 1) % NSOCKETS;
-+			timeradd(&now, &opt_wait, &next_ts);
-+#if !(defined(__SVR4) && defined(__sun))
-+			if (!pending[next]) {
-+#endif
-+				memset(&sin, 0, sizeof(sin));
-+#if defined(__SVR4) && defined(__sun)
-+				sin.sin_family = AF_INET_OFFLOAD;
-+#else
-+				sin.sin_family = AF_INET;
-+#endif
-+				sin.sin_addr = opt_dstaddr;
- 
-+				if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)) < 0)
-+					err = errno;
-+				sp->sent_id = ++sent;
-+				sp->sent_ts = now;
-+				sp->nreplies = 0;
-+#if !(defined(__SVR4) && defined(__sun))
-+				if (!err)
-+					pending[next] = 1;
-+#endif
-+				next = (next + 1) % NSOCKETS;
-+#if !(defined(__SVR4) && defined(__sun))
-+			}
-+#endif
-+
- 			if (err) {
- 				static unsigned int nerrs = 0;
- 
-@@ -223,6 +262,9 @@
- 					report_packet(sp, &now, NULL, errno);
- 			} else {
- 				report_packet(sp, &now, &from.sin_addr, 0);
-+#if !(defined(__SVR4) && defined(__sun))
-+				pending[i] = 0;
-+#endif
- 				recv++;
- 			}
- 		}
-@@ -258,7 +300,11 @@
- 	int pf;
- 
- 	memset(&sin, 0, sizeof(sin));
-+#if defined(__SVR4) && defined(__sun)
-+	sin.sin_family = AF_INET_OFFLOAD;
-+#else
- 	sin.sin_family = AF_INET;
-+#endif
- 
- #ifdef DYNAMIC_PF_RDS
-         pf = discover_pf_rds();
-@@ -278,6 +324,9 @@
- 		if (ufd < 0)
- 			die_errno("unable to create UDP socket");
- 		sin.sin_addr = *dst;
-+#if defined(__SVR4) && defined(__sun)
-+		sin.sin_family = AF_INET;
-+#endif
- 		sin.sin_port = htons(1);
- 		if (connect(ufd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
- 			die_errno("unable to connect to %s",
-@@ -289,6 +338,9 @@
- 
- 		*src = sin.sin_addr;
- 		close(ufd);
-+#if defined(__SVR4) && defined(__sun)
-+		sin.sin_family = AF_INET_OFFLOAD;
-+#endif
- 	}
- 
- 	sin.sin_addr = *src;
-@@ -297,6 +349,9 @@
- 	if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)))
- 		die_errno("bind() failed");
- 
-+	if (opt_tos && ioctl(fd, SIOCRDSSETTOS, &opt_tos)) 
-+		die_errno("ERROR: failed to set TOS\n");
-+
- 	return fd;
- }
- 
-@@ -309,7 +364,8 @@
- 		"%s\nUsage: rds-ping [options] dst_addr\n"
- 		"Options:\n"
- 		" -c count      limit packet count\n"
--		" -I interface  source IP address\n",
-+		" -I interface  source IP address\n"
-+		" -Q tos	type of service\n",
- 		complaint);
- 	exit(1);
- }
-@@ -384,3 +440,31 @@
- 	return 0;
- }
- 
-+static unsigned long long parse_ull(char *ptr, unsigned long long max)
-+{
-+	unsigned long long val;
-+	char *endptr;
-+
-+	val = strtoull(ptr, &endptr, 0);
-+	switch (*endptr) {
-+	case 'k': case 'K':
-+		val <<= 10;
-+		endptr++;
-+		break;
-+
-+	case 'm': case 'M':
-+		val <<= 20;
-+		endptr++;
-+		break;
-+
-+	case 'g': case 'G':
-+		val <<= 30;
-+		endptr++;
-+		break;
-+	}
-+
-+	if (*ptr && !*endptr && val <= max)
-+		return val;
-+
-+	die("invalid number '%s'\n", ptr);
-+}
-diff -r -u /tmp/rds-tools-2.0.4/Makefile.in rds-tools-2.0.7/Makefile.in
---- /tmp/rds-tools-2.0.4/Makefile.in	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/Makefile.in	Thu Feb 24 13:27:51 2011
-@@ -4,18 +4,22 @@
- mandir		= $(DESTDIR)@mandir@
- incdir		= $(DESTDIR)@includedir@
- 
-+CC=gcc
-+
- all: all-programs
- 
--CFLAGS = -O2 -Wall -Iinclude
--CPPFLAGS = -DDEBUG_EXE -DRDS_VERSION=\"@VERSION@\" -MD -MP -MF $(@D)/.$(basename $(@F)).d
-+CFLAGS += -O2 -Wall -Iinclude
-+CPPFLAGS += -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ \
-+	-DDEBUG_EXE -DRDS_VERSION=\"@VERSION@\" -MD -MP -MF $(@D)/.$(basename $(@F)).d
-+LDFLAGS += -libverbs -lsocket -lnsl -llgrp
- 
- HEADERS = kernel-list.h pfhack.h include/rds.h
--COMMON_SOURCES = pfhack.c
-+COMMON_SOURCES = pfhack.c rds-vendor.c
- SOURCES = $(addsuffix .c,$(PROGRAMS)) $(COMMON_SOURCES)
- CLEAN_OBJECTS = $(addsuffix .o,$(PROGRAMS)) $(subst .c,.o,$(COMMON_SOURCES))
- 
- # This is the default
--DYNAMIC_PF_RDS = true
-+#DYNAMIC_PF_RDS = true
- 
- ifneq ($(DYNAMIC_PF_RDS),)
- CPPFLAGS += -DDYNAMIC_PF_RDS
-@@ -29,14 +33,14 @@
- all-programs: $(PROGRAMS)
- 
- install: $(PROGRAMS)
--	install -d $(bindir)
--	install -m 555 -s $(PROGRAMS) $(bindir)
--	install -d $(mandir)/man1
--	install -d $(mandir)/man7
--	install -m 644 *.1 $(mandir)/man1
--	install -m 644 *.7 $(mandir)/man7
--	install -d $(incdir)/net
--	install -m 444 include/rds.h $(incdir)/net
-+	$(INSTALL) -d $(bindir)
-+	$(INSTALL) -m 755 -s $(PROGRAMS) $(bindir)
-+	$(INSTALL) -d $(mandir)/man1
-+	$(INSTALL) -d $(mandir)/man7
-+	$(INSTALL) -m 644 *.1 $(mandir)/man1
-+	$(INSTALL) -m 644 *.7 $(mandir)/man7
-+	$(INSTALL) -d $(incdir)/net
-+	$(INSTALL) -m 444 include/rds.h $(incdir)/net
- 
- clean:
- 	rm -f $(PROGRAMS) $(CLEAN_OBJECTS)
-@@ -47,7 +51,7 @@
- 
- 
- $(PROGRAMS) : % : %.o $(COMMON_OBJECTS)
--	gcc $(CFLAGS) $(LDFLAGS) -o $@ $^
-+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^
- 
- LOCAL_DFILES := $(wildcard .*.d)
- ifneq ($(LOCAL_DFILES),)
-@@ -72,8 +76,6 @@
- 		configure \
- 		README \
- 		rds-tools.txt \
--		stap/rds.stp \
--		stap/README \
- 		docs/rds-architecture.txt \
- 		examples/Makefile \
- 		examples/rds-sample.c \
-diff -r -u /tmp/rds-tools-2.0.4/examples/rds-sample.c rds-tools-2.0.7/examples/rds-sample.c
---- /tmp/rds-tools-2.0.4/examples/rds-sample.c	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/examples/rds-sample.c	Thu Feb 24 13:27:53 2011
-@@ -26,6 +26,7 @@
- #include <string.h>
- #include <stdlib.h>
- 
-+#if !(defined(__SVR4) && defined(__sun))
- /* FIXME - this is a hack to getaround RDS not exporting any header files.
-  * This is a local copy of the file found at net/rds/
-  */
-@@ -33,6 +34,9 @@
- /* These are defined in rds.h....but that file is not happily included */
- #define SOL_RDS		272
- #define PF_RDS		28
-+#else
-+#include <sys/rds.h>
-+#endif
- 
- 
- #define TESTPORT	4000
-@@ -107,12 +111,12 @@
- 	cmsg->cmsg_type = RDS_CMSG_RDMA_ARGS;
- 	cmsg->cmsg_len = CMSG_LEN(sizeof(struct rds_rdma_args));
- 
--	iov.addr = (uint64_t) buf;
-+	iov.addr = (uint64_t)(uintptr_t)buf;
- 	iov.bytes = sizeof(struct rdss_message);
- 
- 	args->remote_vec.addr = 0;
- 	args->remote_vec.bytes = sizeof(struct rdss_message);
--	args->local_vec_addr = (uint64_t) &iov;
-+	args->local_vec_addr = (uint64_t)(uintptr_t)&iov;
- 	args->nr_local = 1;
- 	args->flags = remote_flags ? (RDS_RDMA_READWRITE | RDS_RDMA_FENCE) : 0;
- 	args->flags |= RDS_RDMA_NOTIFY_ME;
-@@ -244,9 +248,9 @@
- 	void *ctlbuf;
- 	struct iovec *iov;
- 
--	mr_args.vec.addr = (uint64_t) buf;
-+	mr_args.vec.addr = (uint64_t)(uintptr_t)buf;
- 	mr_args.vec.bytes = sizeof(struct rdss_message);
--	mr_args.cookie_addr = (uint64_t) cookie;
-+	mr_args.cookie_addr = (uint64_t)(uintptr_t)cookie;
- 	mr_args.flags = RDS_RDMA_USE_ONCE;
- 
- 	ctlbuf = calloc(1, CMSG_SPACE(sizeof(mr_args)));
-diff -r -u /tmp/rds-tools-2.0.4/examples/Makefile rds-tools-2.0.7/examples/Makefile
---- /tmp/rds-tools-2.0.4/examples/Makefile	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/examples/Makefile	Thu Feb 24 13:27:52 2011
-@@ -1,6 +1,12 @@
-+CC=gcc
-+LIBS = -lsocket -lnsl
-+CPPFLAGS += -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
- 
- all: rds-sample
- 
--rds-sample: rds-sample.o
-+rds-sample: rds-sample.c
-+	$(CC) $(CPPFLAGS) $(CFLAGS) -o rds-sample rds-sample.c $(LIBS)
- 
--CFLAGS = -I ../include
-+clean:
-+	rm -rf rds-sample
-+
-diff -r -u /tmp/rds-tools-2.0.4/configure rds-tools-2.0.7/configure
---- /tmp/rds-tools-2.0.4/configure	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/configure	Thu Feb 24 13:27:51 2011
-@@ -1215,7 +1215,7 @@
- 
- 
- 
--VERSION=2.0.4
-+VERSION=2.0.7
- RELEASE=1
- 
- 
-diff -r -u /tmp/rds-tools-2.0.4/rds-stress.1 rds-tools-2.0.7/rds-stress.1
---- /tmp/rds-tools-2.0.4/rds-stress.1	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/rds-stress.1	Thu Feb 24 13:27:52 2011
-@@ -1,99 +1,106 @@
--.Dd May 15, 2007
--.Dt RDS-STRESS 1
--.Os
--.Sh NAME
--.Nm rds-stress
--.Nd send messages between processes over RDS sockets
--.Pp
--.Sh SYNOPSIS
--.Nm rds-stress
--.Bk -words
--.Op Fl p Ar port_number
--.Op Fl r Ar receive_address
--.Op Fl s Ar send_address
--.Op Fl a Ar ack_bytes
--.Op Fl q Ar request_bytes
--.Op Fl D Ar rdma_bytes
--.Op Fl d Ar queue_depth
--.Op Fl t Ar nr_tasks
--.Op Fl c
--.Op Fl R
--.Op Fl V
--.Op Fl v
-+.TH RDS-STRESS 1 " May 15, 2007"
-+.SH "NAME"
-+rds-stress - send messages between processes over RDS sockets
-+.PP
-+.SH SYNOPSIS
-+.HP
-+.nf
-+rds-stress [-p port_number] -r [receive_address] [-s send_address]
-+      [-Q tos] [-a ack_bytes] [-q request_bytes] [-D rdma_bytes]
-+      [-d queue_depth] [-t nr_tasks] [-T time] [-c] [-R] [-V] [-v]
-+.fi
- 
--.Sh DESCRIPTION
--.Nm rds-stress
-+
-+.SH DESCRIPTION
-+.PP
-+.Nm
-+rds-stress
- sends messages between groups tasks, usually running on seperate
- machines.
--.Pp
-+.PP
- First a passive receiving instance is started.
--.Pp
--.Dl $ rds-stress
--.Pp
-+.RS 12
-+
-+	$ rds-stress
-+.RE
-+.PP
- Then an active sending instance is started, giving it
- the address and port at which it will find a listening
- passive receiver.  In addition, it is given configuration options which
- both instances will use.
--.Pp
--.Dl $ rds-stress -s recvhost -p 4000 -t 1 -d 1
--.Pp
-+.PP
-+.RS 12
-+	$ rds-stress -s recvhost -p 4000 -t 1 -d 1
-+.RE
-+.PP
- The active sender will parse the options, connect to the passive receiver, and
- send the options over this connection.  From this point on both instances
- exhibit the exact same behaviour.
--.Pp
-+.PP
- They will create a number of child tasks as specified by the -t option.  Once
- the children are created the parent sleeps for a second at a time, printing a
- summary of statistics at each interval. 
--.Pp
-+.PP
- Each child will open an RDS socket, each binding to a port number in order
- after the port number given on the command line.  The first child would bind to
- port 4001 in our example.  Each child sets the send and receive buffers to
- exactly fit the number of messages, requests and acks, that will be in flight
- as determind by the command line arguments.
--.Pp
-+.PP
- The children then enter their loop.  They will keep a number of sent messages
- outstanding as specified by the -d option.  When they reach this limit they
- will wait to receive acks which will allow them to send again.  As they receive
- messages from their peers they immediately send acks.
--.Pp
-+.PP
- Every second, the parent process will display statistics of the ongoing
- stress test. The output is described in section OUTPUT below.
--.Pp
-+.PP
- If the -T option is given, the test will terminate after the specified time,
- and a summary is printed.
--.Pp
-+.PP
- Each child maintains outstanding messages to all other children of the other instance.
- They do not send to their siblings.
--.Sh OPTIONS
-+.SH OPTIONS
-+.PP
- The following options are available for use on the command line:
--.Bl -tag -width Ds
--.It Fl p Ar port_number
-+
-+.TP 7
-+\fB\-p  port_number
- Each parent binds a TCP socket to this port number and their respective
- address.  They will trade the negotiated options over this socket.  Each
- child will bind an RDS socket to the range of ports immediately following
- this port number, for as many children as there are.
--.It Fl s Ar send_address
-+.TP
-+\fB\-s send_address
- A connection attempt is made to this address.  Once its complete and the
- options are sent over it then children will be created and work will proceed.
--.It Fl r Ar receive_address
-+.TP
-+\fB\-r receive_address
- This specifies the address that messages will be sent from.  If -s is not
- specified then rds-stress waits for a connection on this address before
- proceeding.
--.Pp
-+
- If this option is not given, rds-stress will choose an appropriate address.
- The passive process will accept connections on all local interfaces, and
- obtain the address once the control connection is established.
- The active process will choose a local address based on the interface through
- which it connects to the destination address.
--.It Fl a Ar ack_bytes
-+.TP
-+\fB\-Q tos
-+Uses the RDS connection between IP addresses with the specified tos value. By 
-+default, the base (tos = 0) RDS connection is used.  Valid values are 0-255.
-+.TP
-+\fB\-a ack_bytes
- This specifies the size of the ack messages, in bytes. There is a minimum size
- which depends on the format of the ack messages, which may change over time.
- See section "Message Sizes" below.
--.It Fl q Ar request_bytes
-+.TP
-+\fB\-q request_bytes
- This specifies the size of the request messages, in bytes.
- It also has a minimum size which may change over time.
- See section "Message Sizes" below.
--.It Fl D Ar rdma_bytes
-+.TP
-+\fB\-D rdma_bytes
- RDSv3 is capable of transmitting part of a message via RDMA directly from
- application buffer to application buffer. This option enables RDMA support
- in rds-stress: request packets include parameters for an RDMA READ or WRITE
-@@ -100,20 +107,25 @@
- operation, which the receiving process executes at the time the ACK packet
- is sent.
- See section "Message Sizes" below.
--.It Fl d Ar queue_depth
-+.TP
-+\fB\-d queue_depth
- Each child will try to maintain this many sent messages outstanding to each
- of its peers on the remote address.
--.It Fl t Ar nr_tasks
-+.TP
-+\fB\-t nr_tasks
- Each parent will create this many children tasks.
--.It Fl T Ar seconds
-+.TP
-+\fB\-T seconds
- Specify the duration of the test run. After the specified number of seconds,
- all processes on both ends of the connection will terminate, and the
- active instance will print a summary. By default, rds-stress will keep
- on sending and receiving messages.
--.It Fl z
-+.TP
-+\fB\-z
- This flag can be used in conjunction with -T. It suppresses the ongoing
- display of statistics, and prints a summary only.
--.It Fl c
-+.TP
-+\fB\-c
- This causes rds-stress to create child tasks which just consume CPU cycles.
- One task is created for each CPU in the system.  First each child observes the
- maximum rate at which it can consume cycles.  This means that this option
-@@ -121,50 +133,67 @@
- use of the system by observing the lesser rate at which the children consume
- cycles.  This option is *not* shared between the active and passive instances.
- It must be specified on each rds-stress command line.
--.It Fl R
-+.TP
-+\fB\-R
- This tells the rds-stress parent process to run with SCHED_RR priority,
- giving it precedence over the child processes. This is useful when running
- with lots of tasks, where there is a risk of the child processes starving
- the parent, and skewing the results.
--.It Fl v
-+.TP
-+\fB\-v
- With this option enabled, packets are filled with a pattern that is
- verified by the receiver. This check can help detect data corruption
- occuring under high load.
--.El
--.Pp
-+.TP
-+.PP
- 
--.Ss Message Sizes
-+.SS Message Sizes
- Options which set a message size (such as -a) specify a number of bytes
- by default. By appending \fBK\fP, \fBM\fP, or \fBG\fP, you can specify the size
- in kilobytes, megabytes or gigabytes, respectively. For instance,
- the following will run rds-stress with a message and ACK size of 1024
- bytes, and an RDMA message size of 1048576 bytes:
--.Pp
--.Dl rds-stress ... -q 1K -a 1K -D 1M
--.Pp
--.Pp
--.Sh OUTPUT
-+.PP
-+.RS 12
-+rds-stress ... -q 1K -a 1K -D 1M
-+.RE
-+.PP
-+.PP
-+.SH OUTPUT
- Each parent outputs columns of statistics at a regular interval:
--.Bl -tag -width Ds
--.It tsks
-+.TP 8
-+tsks
- The number of child tasks which are running.
--.It tx/s
-+.TP
-+tx/s
- The number of sendmsg() calls that all children are executing, per second. 
--.It tx+rx K/s
-+.TP
-+rx/s
-+The number of recvmsg() calls that all children are executing, per second. 
-+.TP
-+tx+rx K/s
- The total number of bytes that are flowing through sendmsg() and recvmsg() for all children.
- This includes both request and ack messages.
--.It rw+rr K/s
--The total number of bytes that are being transferred via RDMA READs and
-+.TP
-+mbi K/s
-+The total number of bytes that are being received via RDMA READs and
- WRITEs for all children.
--.It tx us/c
-+.TP
-+mbo K/s
-+The total number of bytes that are being transmited via RDMA READs and
-+WRITEs for all children.
-+.TP
-+tx us/c
- The average number of microseconds spent in sendmsg() calls.
--.It rtt us
-+.TP
-+rtt us
- The average round trip time for a request and ack message pair.  This measures
- the total time between when a task sends a request and when it finally receives
- the ack for that message.  Because it includes the time it takes for the
- receiver to wake up, receive the message, and send an ack, it can grow to be
- quite large under load. 
--.It cpu %
-+.TP
-+cpu %
- This is the percentage of available CPU resources on this machine that are being
- consumed since rds-stress started running.  It will show -1.00 if -c is not
- given.  It is calculated based on the amount of CPU resources that CPU soaking
-@@ -171,4 +200,3 @@
- tasks are able to consume.  This lets it measure CPU use by the system, say in
- interrupt handlers, that task-based CPU accounting does not include.
- For this to work rds-stress must be started with -c on an idle system.
--.El
-diff -r -u /tmp/rds-tools-2.0.4/include/rds.h rds-tools-2.0.7/include/rds.h
---- /tmp/rds-tools-2.0.4/include/rds.h	Wed Aug  4 15:25:11 2010
-+++ rds-tools-2.0.7/include/rds.h	Thu Feb 24 13:30:23 2011
-@@ -84,6 +84,8 @@
- #define RDS_CMSG_CONG_UPDATE		5
- #define RDS_CMSG_ATOMIC_FADD		6
- #define RDS_CMSG_ATOMIC_CSWP		7
-+#define	RDS_CMSG_MASKED_ATOMIC_FADD	8
-+#define	RDS_CMSG_MASKED_ATOMIC_CSWP	9
- 
- #define RDS_INFO_FIRST			10000
- #define RDS_INFO_COUNTERS		10000
-@@ -252,8 +254,25 @@
- 	rds_rdma_cookie_t cookie;
- 	uint64_t 	local_addr;
- 	uint64_t 	remote_addr;
--	uint64_t	swap_add;
--	uint64_t	compare;
-+	union {
-+		struct {
-+			uint64_t	compare;
-+			uint64_t	swap;
-+		} cswp;
-+		struct {
-+			uint64_t	add;
-+		} fadd;
-+		struct {
-+			uint64_t	compare;
-+			uint64_t	swap;
-+			uint64_t	compare_mask;
-+			uint64_t	swap_mask;
-+		} m_cswp;
-+		struct {
-+			uint64_t	add;
-+			uint64_t	nocarry_mask;
-+		} m_fadd;
-+	};
- 	u_int64_t	flags;
- 	u_int64_t	user_token;
- };
-@@ -278,5 +297,6 @@
- #define RDS_RDMA_USE_ONCE	0x0008	/* free MR after use */
- #define RDS_RDMA_DONTWAIT	0x0010	/* Don't wait in SET_BARRIER */
- #define RDS_RDMA_NOTIFY_ME	0x0020	/* Notify when operation completes */
-+#define RDS_RDMA_SILENT		0x0040	/* Do not interrupt remote */
- 
- #endif /* IB_RDS_H */