changeset 369:cc8c00719da9

PSARC 2011/165 OFUV update of existing components 7012194 Need to upgrade OFUV libraries and utilities to OFED 1.5.latest 7012718 Solaris OFED libraries need to be Zone aware 6979775 libibverbs should be DR capable 7039238 ofuv library functions should return fail not exit if no IB hardware found. 7045481 some text in the man page of ibdiagnet is messed up
author Boris Chiu <Boris.Chiu@Sun.COM>
date Tue, 05 Jul 2011 19:16:33 -0700
parents 9a01d3a61f01
children db873833a34f
files components/open-fabrics/Makefile components/open-fabrics/ibutils/Makefile components/open-fabrics/ibutils/patches/base.patch components/open-fabrics/infiniband-diags/Makefile components/open-fabrics/infiniband-diags/manpages/set_nodedesc.sh.1m components/open-fabrics/infiniband-diags/patches/base.patch components/open-fabrics/infiniband-diags/solaris_set_nodedesc.c components/open-fabrics/libibmad/Makefile components/open-fabrics/libibmad/patches/base.patch components/open-fabrics/libibumad/Makefile components/open-fabrics/libibumad/patches/base.patch components/open-fabrics/libibverbs/Makefile components/open-fabrics/libibverbs/ofa_solaris.h components/open-fabrics/libibverbs/patches/base.patch components/open-fabrics/libibverbs/solaris_compatibility.c components/open-fabrics/libmlx4/Makefile components/open-fabrics/libmlx4/patches/base.patch components/open-fabrics/libmthca/Makefile components/open-fabrics/libmthca/patches/base.patch components/open-fabrics/librdmacm/Makefile components/open-fabrics/librdmacm/patches/base.patch components/open-fabrics/libsdp/Makefile components/open-fabrics/libsdp/manpages/libsdp.3lib components/open-fabrics/libsdp/manpages/libsdp.conf.4 components/open-fabrics/libsdp/patches/base.patch components/open-fabrics/ofed.mk components/open-fabrics/open-fabrics.license components/open-fabrics/open-fabrics.p5m components/open-fabrics/opensm/Makefile components/open-fabrics/opensm/patches/base.patch components/open-fabrics/perftest/Makefile components/open-fabrics/perftest/manpages/ib_clock_test.1 components/open-fabrics/perftest/patches/base.patch components/open-fabrics/qperf/Makefile components/open-fabrics/qperf/patches/base.patch components/open-fabrics/rds-tools/Makefile components/open-fabrics/rds-tools/patches/base.patch make-rules/ips.mk make-rules/shared-macros.mk
diffstat 39 files changed, 23164 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,71 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../make-rules/shared-macros.mk
+include ../../make-rules/ips.mk
+include ofed.mk
+
+LD_Z_IGNORE =
+
+COMPONENT_VERSION=1.5.3
+COMPONENT_ARCHIVE_URL=http://www.openfabrics/org/downloads/OFED/ofed-1.5.3/OFED-1.5.3.tgz
+
+# for now, everything with a Makefile should be built
+SUBDIRS =	$(shell echo */Makefile | sed -e 's;/Makefile;;g')
+
+.PHONY:	$(SUBDIRS)
+
+download:		TARGET = download
+prep:			TARGET = prep
+install:		TARGET = install
+clean:			TARGET = clean
+clobber:		TARGET = clobber
+test:			TARGET = test
+
+build:		install
+
+.DEFAULT:	publish
+
+download prep install test: $(SUBDIRS)
+
+clean:	$(SUBDIRS)
+	$(RM) -r prototype build
+
+clobber:	$(SUBDIRS) clean
+
+$(SUBDIRS):	FORCE
+	@cd $@ && echo "$(TARGET) $@" && $(MAKE) $(TARGET)
+
+# declare module dependencies
+librdmacm:		libibverbs
+libmlx4:		libibverbs
+libmthca:		libibverbs
+rds-tools:		libibverbs
+perftest:		libibverbs librdmacm libibverbs
+qperf:			libibverbs librdmacm
+libibumad:		libibverbs
+libibmad:		libibumad
+opensm:			libibumad libibmad
+ibutils:		opensm
+infiniband-diags:	libibverbs opensm
+
+FORCE:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ibutils/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,104 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		ibutils
+COMPONENT_VERSION=	1.5.7
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:25c7fe1135bf8dc4c572a9462710c17902259015
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/ibutils/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS +=	-lsocket -lnsl -lopensm -losmvendor -losmcomp -libumad -libmad
+
+# we want to use the libcheck here
+DISABLE_LIBCHECK=
+
+CONFIGURE_ENV +=	INSTALL_DATA="$(INSTALL) -m 644"
+
+CONFIGURE_OPTIONS +=	--with-osm=$(PROTO_DIR)/usr
+
+PROTOMAN =	$(PROTO_DIR)/$(CONFIGURE_MANDIR)
+
+CLEANUP_FILES =\
+	$(PROTOUSRLIBDIR)/libibdm.la\
+	$(PROTOUSRLIBDIR)/libibdmcom.la\
+	$(PROTOUSRLIBDIR)/libibdm.a\
+	$(PROTOUSRLIBDIR)/libibdm.so\
+	$(PROTOUSRLIBDIR)/libibdm.so.1 \
+	$(PROTOUSRLIBDIR)/libibdmcom.a\
+	$(PROTOUSRLIBDIR)/libibdm.so.1.1.1 \
+	$(PROTOUSRLIBDIR)/libibdmcom.so\
+	$(PROTOUSRLIBDIR)/libibdmcom.so.1 \
+	$(PROTOUSRLIBDIR)/libibdmcom.so.1.1.1\
+	$(PROTOUSRLIBDIR)/libibsysapi.a\
+	$(PROTOUSRLIBDIR)/libibsysapi.la \
+	$(PROTOUSRLIBDIR)/libibsysapi.so\
+	$(PROTOUSRLIBDIR)/libibsysapi.so.1 \
+	$(PROTOUSRLIBDIR)/libibsysapi.so.1.0.0 \
+	$(PROTOUSRBINDIR)/ibtopodiff\
+	$(PROTOUSRBINDIR)/git_version.tcl \
+	$(PROTOUSRBINDIR)/ibdmsh*\
+	$(PROTOUSRBINDIR)/ibdmtr* \
+	$(PROTOUSRBINDIR)/ibdmchk*\
+	$(PROTOUSRBINDIR)/ibdiagui* \
+	$(PROTOUSRBINDIR)/ibnlparse*\
+	$(PROTOUSRBINDIR)/ibdiagpath* \
+	$(PROTOMAN)/man1//ibdmsh.1 \
+	$(PROTOMAN)/man1//ibdmtr.1\
+	$(PROTOMAN)/man1//ibdmchk.1\
+	$(PROTOMAN)/man1//ibdiagui.1 \
+	$(PROTOMAN)/man1//ibdiagpath.1\
+	$(PROTOMAN)/man1//ibtopodiff.1 \
+	$(PROTOMAN)/man1//ibdm-ibnl-file.1\
+	$(PROTOMAN)/man1//ibdm-topo-file.1 \
+	$(PROTOMAN)/man3//ibnd_discover_fabric.3\
+	$(PROTOMAN)/man3//ibnd_find_node_dr.3 \
+	$(PROTOMAN)/man3//ibnd_find_node_guid.3\
+	$(PROTOMAN)/man3//ibnd_iter_nodes.3 \
+	$(PROTOMAN)/man3//ibnd_iter_nodes_type.3\
+	$(PROTOMAN)/man3//ibnd_show_progress.3 \
+
+CLEANUP_DIRS=\
+	$(PROTOUSRINCDIR)/ibdm\
+	$(PROTOUSRLIBDIR)/ibdiagui1.*\
+	$(PROTOUSRLIBDIR)/ibdiagpath1.*
+
+COMPONENT_POST_INSTALL_ACTION=\
+	$(RM) $(CLEANUP_FILES);\
+	$(RM) -r $(CLEANUP_DIRS)
+
+# common targets
+build:		$(BUILD_32)
+
+install:	$(INSTALL_32)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ibutils/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1288 @@
+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,7 +154,6 @@
+ 
+ =over
+ 
+-=item
+ Specifies the topology file name
+ 
+ =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/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/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)
+@@ -96,7 +96,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(bindir)"
++am__installdirs = "$(DESTDIR)$(sbindir)"
+ SCRIPTS = $(bin_SCRIPTS)
+ SOURCES =
+ DIST_SOURCES =
+@@ -224,8 +224,8 @@
+ $(am__aclocal_m4_deps):
+ install-binSCRIPTS: $(bin_SCRIPTS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do \
+ 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ 	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+@@ -243,19 +243,19 @@
+ 	while read type dir files; do \
+ 	     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 $$?; \
++	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	       $(INSTALL_SCRIPT) -m 755 $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	     } \
+ 	; done
+ 
+ uninstall-binSCRIPTS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
++	@list='$(bin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	       sed -e 's,.*/,,;$(transform)'`; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ tags: TAGS
+ TAGS:
+ 
+@@ -297,7 +297,7 @@
+ check: check-am
+ all-am: Makefile $(SCRIPTS)
+ installdirs:
+-	for dir in "$(DESTDIR)$(bindir)"; do \
++	for dir in "$(DESTDIR)$(sbindir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+@@ -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)
+@@ -105,7 +105,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
++am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
+ 	"$(DESTDIR)$(pkgincludedir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ libibsysapi_la_DEPENDENCIES =
+@@ -369,8 +369,8 @@
+ 	$(libibsysapi_la_LINK) -rpath $(libdir) $(libibsysapi_la_OBJECTS) $(libibsysapi_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do echo "$$p $$p"; done | \
+ 	sed 's/$(EXEEXT)$$//' | \
+ 	while read p p1; do if test -f $$p || test -f $$p1; \
+@@ -387,20 +387,20 @@
+ 	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) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	    } \
+ 	; done
+ 
+ uninstall-binPROGRAMS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ 	      -e 's/$$/$(EXEEXT)/' `; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ 
+ clean-binPROGRAMS:
+ 	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+@@ -573,7 +573,7 @@
+ install-binPROGRAMS: install-libLTLIBRARIES
+ 
+ installdirs:
+-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)"; do \
++	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+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.am ibutils-1.5.7/ibdm/scripts/Makefile.am
+--- /tmp/ibutils-1.5.7/ibdm/scripts/Makefile.am	Mon Nov  1 16:03:44 2010
++++ ibutils-1.5.7/ibdm/scripts/Makefile.am	Thu Feb 24 16:51:17 2011
+@@ -37,5 +37,5 @@
+ EXTRA_DIST = $(pkgdata_DATA)
+ 
+ install-data-am:
+-	for s in $(pkgdata_DATA); do cp $$s $(DESTDIR)$(bindir)/; done
++	for s in $(pkgdata_DATA); do cp $$s $(DESTDIR)$(sbindir)/; done
+ 
+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)
+@@ -447,7 +447,7 @@
+ 
+ 
+ install-data-am:
+-	for s in $(pkgdata_DATA); do cp $$s $(DESTDIR)$(bindir)/; done
++	for s in $(pkgdata_DATA); do cp $$s $(DESTDIR)$(sbindir)/; done
+ 
+ # 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.
+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)
+@@ -102,7 +102,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
++am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
+ 	"$(DESTDIR)$(pkgincludedir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ am__DEPENDENCIES_1 =
+@@ -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) 
+@@ -402,8 +402,8 @@
+ 	$(libibdmcom_la_LINK) -rpath $(libdir) $(libibdmcom_la_OBJECTS) $(libibdmcom_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do echo "$$p $$p"; done | \
+ 	sed 's/$(EXEEXT)$$//' | \
+ 	while read p p1; do if test -f $$p || test -f $$p1; \
+@@ -420,20 +420,20 @@
+ 	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) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	    } \
+ 	; done
+ 
+ uninstall-binPROGRAMS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ 	      -e 's/$$/$(EXEEXT)/' `; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ 
+ clean-binPROGRAMS:
+ 	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+@@ -628,7 +628,7 @@
+ install-binPROGRAMS: install-libLTLIBRARIES
+ 
+ installdirs:
+-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)"; do \
++	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+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)
+@@ -113,7 +113,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"
++am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ libibis_la_LIBADD =
+ am_libibis_la_OBJECTS = ibis_wrap.lo ibbbm.lo ibcr.lo ibis.lo \
+@@ -420,8 +420,8 @@
+ 	$(libibis_la_LINK) -rpath $(libdir) $(libibis_la_OBJECTS) $(libibis_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do echo "$$p $$p"; done | \
+ 	sed 's/$(EXEEXT)$$//' | \
+ 	while read p p1; do if test -f $$p || test -f $$p1; \
+@@ -438,20 +438,20 @@
+ 	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) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	    } \
+ 	; done
+ 
+ uninstall-binPROGRAMS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ 	      -e 's/$$/$(EXEEXT)/' `; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ 
+ clean-binPROGRAMS:
+ 	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+@@ -754,7 +754,7 @@
+ install-binPROGRAMS: install-libLTLIBRARIES
+ 
+ installdirs:
+-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \
++	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+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_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 */
+ 
+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 */
+ 
+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]*)
+@@ -15295,7 +15297,8 @@
+    { $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"
++   with_osm_libs=`echo "$with_osm_libs" | $SED -e "s/64//g"`
++   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 +15381,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)
+@@ -103,7 +103,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
++am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
+ 	"$(DESTDIR)$(pkgincludedir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+ libibmscli_la_LIBADD =
+@@ -430,8 +430,8 @@
+ 	$(libibmscli_la_LINK) -rpath $(libdir) $(libibmscli_la_OBJECTS) $(libibmscli_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do echo "$$p $$p"; done | \
+ 	sed 's/$(EXEEXT)$$//' | \
+ 	while read p p1; do if test -f $$p || test -f $$p1; \
+@@ -455,13 +455,13 @@
+ 
+ uninstall-binPROGRAMS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
++	@list='$(bin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ 	      -e 's/$$/$(EXEEXT)/' `; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ 
+ clean-binPROGRAMS:
+ 	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+@@ -693,7 +693,7 @@
+ install-binPROGRAMS: install-libLTLIBRARIES
+ 
+ installdirs:
+-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)"; do \
++	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+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)
+@@ -99,7 +99,7 @@
+ am__base_list = \
+   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(bindir)"
++am__installdirs = "$(DESTDIR)$(sbindir)"
+ SCRIPTS = $(bin_SCRIPTS)
+ SOURCES =
+ DIST_SOURCES =
+@@ -275,8 +275,8 @@
+ $(am__aclocal_m4_deps):
+ install-binSCRIPTS: $(bin_SCRIPTS)
+ 	@$(NORMAL_INSTALL)
+-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+-	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
++	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
++	@list='$(bin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
+ 	for p in $$list; do \
+ 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ 	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+@@ -294,19 +294,19 @@
+ 	while read type dir files; do \
+ 	     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 $$?; \
++	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
++	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ 	     } \
+ 	; done
+ 
+ uninstall-binSCRIPTS:
+ 	@$(NORMAL_UNINSTALL)
+-	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
++	@list='$(bin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \
+ 	files=`for p in $$list; do echo "$$p"; done | \
+ 	       sed -e 's,.*/,,;$(transform)'`; \
+ 	test -n "$$list" || exit 0; \
+-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
++	echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
++	cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+ 
+ mostlyclean-libtool:
+ 	-rm -f *.lo
+@@ -354,7 +354,7 @@
+ check: check-am
+ all-am: Makefile $(SCRIPTS)
+ installdirs:
+-	for dir in "$(DESTDIR)$(bindir)"; do \
++	for dir in "$(DESTDIR)$(sbindir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+ install: install-am
+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	Thu Mar 10 18:33:24 2011
+@@ -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/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,89 @@
+
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		infiniband-diags
+COMPONENT_VERSION=	1.5.8
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:76e399d95b25fbef4f109305e07e35eba6b1547e
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+MAN1MFILES = set_nodedesc.sh.1m
+
+include $(WS_TOP)/make-rules/shared-targets.mk
+
+CFLAGS += -I$(PROTO_DIR)/usr/include/infiniband
+LIBS +=	-lsocket -lnsl -lopensm -losmvendor -losmcomp -libumad -libmad -libverbs -ldevinfo
+
+COMPONENT_PREP_ACTION = \
+        cp solaris_set_nodedesc.c $(@D)/src
+
+COMPONENT_INSTALL_ENV +=	PERL=$(PERL)
+
+CONFIGURE_ENV +=	PERL=$(PERL)
+
+# it apears that configure is broken
+COMPONENT_BUILD_ARGS  +=	LIBS="$(LIBS)"
+
+COMPONENT_PRE_CONFIGURE_ACTION =\
+	$(SYMLINK) ../../$(COMPONENT_SRC)/include $(@D)/include
+
+COMPONENT_POST_CONFIGURE_ACTION=\
+	$(SYMLINK) ../../../$(COMPONENT_SRC)/scripts/IBswcountlimits.pm $(@D)/scripts
+
+PROTOMAN = $(PROTO_DIR)/$(CONFIGURE_MANDIR)
+
+CLEANUP_FILES =\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libibnetdisc.la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libibnetdisc.so \
+	$(PROTOUSRBINDIR)/vendstat\
+	$(PROTOUSRBINDIR)/dump_lfts.sh \
+	$(PROTOUSRBINDIR)/dump_mfts.sh\
+	$(PROTOUSRBINDIR)/ibidsverify.pl \
+	$(PROTOUSRBINDIR)/ibfindnodesusing.pl\
+	$(PROTOMAN)/man1m/vendstat.1m \
+	$(PROTOMAN)/man1m/dump_lfts.1m\
+	$(PROTOMAN)/man1m/dump_mfts.1m \
+	$(PROTOMAN)/man1m/ibidsverify.1m\
+	$(PROTOMAN)/man1m/ibfindnodesusing.1m \
+	$(PROTOUSRINCDIR)/infiniband/ibnetdisc.h\
+
+COMPONENT_POST_INSTALL_ACTION =\
+	$(RM) $(CLEANUP_FILES);\
+	$(INSTALL) -m 644 manpages/set_nodedesc.sh.1m $(PROTOMAN)/man1m
+
+# common targets
+build:		$(BUILD_32)
+
+install:	$(INSTALL_32) $(PROTOMAN1MFILES)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags/manpages/set_nodedesc.sh.1m	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,84 @@
+'\" t
+.\" Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+.\" Modified for Solaris to add the Solaris stability classification,
+.\" and to add a note about source availability.
+.\"
+.TH SET_NODEDESC.SH 1M "4 April 2011" "USER COMMANDS"
+
+.SH "NAME"
+set_nodedesc.sh \- Set/View Node Description String for Infiniband Host Controller Adapters (HCA)s
+.SH "SYNOPSIS"
+.PP
+\fBset_nodedesc.sh\fR
+.sp
+\fBset_nodedesc.sh\fR -N <\fBCommonString\fR>
+.sp
+\fBset_nodedesc.sh\fR -H <\fBHCAString\fR> -G \fBGUID\fR
+.sp
+\fBset_nodedesc.sh\fR -H <\fBHCAString\fR> -G \fBGUID\fR -N <\fBCommonString\fR>
+.sp
+\fBset_nodedesc.sh\fR -v
+.sp
+.SH "DESCRIPTION"
+The \fBset_nodedesc.sh\fR utility can be used to set or view  Node description
+strings for \fBInfiniBand(IB)\fR Host Controller \fBAdapters(HCA)\fR. The node
+description string can consist of two parts :
+
+	1. Node Description String common to all HCAs.
+.br
+	2. Node Description String specific to an HCA.
+.sp
+The complete Node Description string will be :
+.sp
+	<CommonNodeDescriptionString><HCANodeDescriptionString>
+.sp
+The common Node Description String is used if no HCA specific Node descr-
+iption string is set. The Node Descriptor string from the HCA firmware
+will be used if common node descriptor is not set.
+.sp
+\fBset_nodedesc.sh\fR called without arguments, sets the common node descriptor
+string to the \fBhostname\fR(1M) of the system. The common Node descriptor string
+can be set to a string other than the \fBhostname\fR(1M) using the -N option.
+.sp
+The HCA specific Node Description String can be set using the -H and -G
+option. The Global Unique IDentifier (GUID) specified with -G identifies
+the HCA to set the HCA specific Node Description string.  The options
+-H and -G can be combined together with -N, to specify the common Node
+description String.
+.sp
+The -v option can be used to view the Node descriptors for all HCAs on the
+system.
+.sp
+.SH "EXAMPLES"
+.TP
+\fB1. Set Node descriptor string to hostname(1M) for all HCAs:\fR
+.PP
+	set_nodedesc.sh
+.PP
+.nf
+\fB2. Set Node descriptor string to string "test":\fR
+.PP
+	#set_nodedesc.sh -N "test"
+.PP
+.nf
+\fB3. Setting the HCA specific Node Description for HCA with\fR
+\fB   GUID 0x0002c903000008d0 to " hca_test" :\fR
+.PP
+	#set_nodedesc.sh -H " hca_test" -G 0x0002c903000008d0
+.PP
+.nf
+\fB4. Setting the HCA specific Node Description for HCA with GUID\fR
+\fB   0x0002c903000008d0 to " hca_test1" and set the common node\fR
+\fB   descriptor to "test1" :\fR
+.PP
+	#set_nodedesc.sh -H " hca_test" -G 0x0002c903000008d0 -N "test1"
+.PP
+.nf
+\fB5. Read all Node descriptiors :\fR
+.PP
+	#set_nodedesc.sh -v
+.PP
+.nf
+.sp
+.SH "See Also"
+.PP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1668 @@
+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)/man1m
+ 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='1m'; \
++	  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='1m'; \
++	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,119 @@
+ 	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)
++		if (hacid_in != "+" && port_in != "+" && port_hit == 0)
++ 			printf("Fatal error: port '\''%s:%d'\'' not found\n\n", hcaid_in, port_in)
++	}' $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 0
++fi
+ 
+-ib_status() {
+-	ports_dir="$infiniband_base/$1/ports"
++rm -rf $ibvdevinfo_results
+ 
+-	if ! [ -d "$ports_dir" ]; then
+-		fatal "device '$1': sys files not found ($ports_dir)"
+-	fi
++# Run ibv_devinfo and direct the output to $ibvdevinfo_results.
++$ibvdevinfo -v > $ibvdevinfo_results
++if [ $? != 0 ]; then
++	echo "$ibvdevinfo failed!"
++	exit 0
++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!"
++	exit 0
+ fi
+ 
++egrep "port:|hca_id:|_lid|GID|state:|active_|link_layer:" $ibvdevinfo_results |grep -v _mtu | sed -e 's/(//' -e 's/)//' > $tmpout
++
+ if [ -z "$1" ]; then
+-	cd $infiniband_base 2>/dev/null || fatal No devices
+-	for dev in *; do
+-		ib_status $dev "+";
+-	done
++	get_status_ports "+" "+"
+ 	exit 0
+ fi
+ 
+@@ -73,6 +135,7 @@
+ 		port="+"
+ 	fi
+ 
+-	ib_status $dev $port
++	get_status_ports $dev $port
++
+ 	shift
+ done
+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/man/ibstat.8 infiniband-diags-1.5.8/man/ibstat.8
+--- /tmp/infiniband-diags-1.5.8/man/ibstat.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibstat.8	Thu Feb 24 11:26:48 2011
+@@ -1,4 +1,4 @@
+-.TH IBSTAT 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBSTAT 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibstat \- query basic status of InfiniBand device(s)
+@@ -103,7 +103,7 @@
+ ibstat mthca0 2   # show status of port 2 of 'mthca0'
+ 
+ .SH SEE ALSO
+-.BR ibstatus (8)
++.BR ibstatus (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/vendstat.8 infiniband-diags-1.5.8/man/vendstat.8
+--- /tmp/infiniband-diags-1.5.8/man/vendstat.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/vendstat.8	Thu Feb 24 11:26:50 2011
+@@ -1,4 +1,4 @@
+-.TH VENDSTAT 8 "February 10, 2010" "OpenIB" "OpenIB Diagnostics"
++.TH VENDSTAT 1m "February 10, 2010" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ vendstat \- query InfiniBand vendor specific functions
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckportstate.8 infiniband-diags-1.5.8/man/ibcheckportstate.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckportstate.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckportstate.8	Thu Feb 24 11:26:42 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKPORTSTATE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKPORTSTATE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckportstate \- validate IB port for LinkUp and not Active state
+@@ -35,8 +35,8 @@
+ ibcheckportstate 2 3         # check lid 2 port 3
+ 
+ .SH SEE ALSO
+-.BR smpquery(8),
+-.BR ibaddr(8)
++.BR smpquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibnodes.8 infiniband-diags-1.5.8/man/ibnodes.8
+--- /tmp/infiniband-diags-1.5.8/man/ibnodes.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibnodes.8	Thu Feb 24 11:26:46 2011
+@@ -1,4 +1,4 @@
+-.TH IBNODES 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBNODES 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibnodes \- show InfiniBand nodes in topology
+@@ -23,7 +23,7 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ .SH SEE ALSO
+ 
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibchecknode.8 infiniband-diags-1.5.8/man/ibchecknode.8
+--- /tmp/infiniband-diags-1.5.8/man/ibchecknode.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibchecknode.8	Thu Feb 24 11:26:42 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKNODE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKNODE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibchecknode \- validate IB node and report errors
+@@ -34,8 +34,8 @@
+ ibchecknode 2           # check node via lid 2
+ 
+ .SH SEE ALSO
+-.BR smpquery(8),
+-.BR ibaddr(8)
++.BR smpquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckport.8 infiniband-diags-1.5.8/man/ibcheckport.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckport.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckport.8	Thu Feb 24 11:26:42 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKPORT 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKPORT 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckport \- validate IB port and report errors
+@@ -34,8 +34,8 @@
+ ibcheckport 2 3         # check lid 2 port 3
+ 
+ .SH SEE ALSO
+-.BR smpquery(8),
+-.BR ibaddr(8)
++.BR smpquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckstate.8 infiniband-diags-1.5.8/man/ibcheckstate.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckstate.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckstate.8	Thu Feb 24 11:26:43 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKSTATE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKSTATE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckstate \- find ports in IB subnet which are link up but not active
+@@ -26,9 +26,9 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR ibchecknode(8),
+-.BR ibcheckportstate(8)
++.BR ibnetdiscover(1m),
++.BR ibchecknode(1m),
++.BR ibcheckportstate(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/smpquery.8 infiniband-diags-1.5.8/man/smpquery.8
+--- /tmp/infiniband-diags-1.5.8/man/smpquery.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/smpquery.8	Thu Feb 24 11:26:50 2011
+@@ -1,4 +1,4 @@
+-.TH SMPQUERY 8 "March 14, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH SMPQUERY 1m "March 14, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ smpquery \- query InfiniBand subnet management attributes
+@@ -34,7 +34,7 @@
+ \fB\-\-node\-name\-map\fR <node-name-map>
+ Specify a node name map.  The node name map file maps GUIDs to more
+ user friendly names.  See
+-.B ibnetdiscover(8)
++.B ibnetdiscover(1m)
+ for node name map file format.
+ 
+ .SH COMMON OPTIONS
+@@ -108,7 +108,7 @@
+ smpquery -c nodeinfo 6 0,12  # nodeinfo by combined route
+ 
+ .SH SEE ALSO
+-.BR smpdump (8)
++.BR smpdump (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckerrors.8 infiniband-diags-1.5.8/man/ibcheckerrors.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckerrors.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckerrors.8	Thu Feb 24 11:26:41 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKERRORS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKERRORS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckerrors \- validate IB subnet and report errors
+@@ -30,10 +30,10 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR ibchecknode(8),
+-.BR ibcheckport(8),
+-.BR ibcheckerrs(8)
++.BR ibnetdiscover(1m),
++.BR ibchecknode(1m),
++.BR ibcheckport(1m),
++.BR ibcheckerrs(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintca.8 infiniband-diags-1.5.8/man/ibprintca.8
+--- /tmp/infiniband-diags-1.5.8/man/ibprintca.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibprintca.8	Thu Feb 24 11:26:47 2011
+@@ -1,4 +1,4 @@
+-.TH IBPRINTCA 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBPRINTCA 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibprintca.pl \- print either the ca specified or the list of cas from the ibnetdiscover output
+diff -r -u /tmp/infiniband-diags-1.5.8/man/sminfo.8 infiniband-diags-1.5.8/man/sminfo.8
+--- /tmp/infiniband-diags-1.5.8/man/sminfo.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/sminfo.8	Thu Feb 24 11:26:50 2011
+@@ -1,4 +1,4 @@
+-.TH SMINFO 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH SMINFO 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ sminfo \- query InfiniBand SMInfo attribute
+@@ -99,7 +99,7 @@
+ sminfo  -G 0x8f1040023  # same but using guid address
+ 
+ .SH SEE ALSO
+-.BR smpdump (8)
++.BR smpdump (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdiscover.8 infiniband-diags-1.5.8/man/ibdiscover.8
+--- /tmp/infiniband-diags-1.5.8/man/ibdiscover.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibdiscover.8	Thu Feb 24 11:26:44 2011
+@@ -1,4 +1,4 @@
+-.TH IBDISCOVER.PL 8 "September 21, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBDISCOVER.PL 1m "September 21, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibdiscover.pl \- annotate and compare InfiniBand topology
+@@ -42,7 +42,7 @@
+ ibnetdiscover | ibdiscover.pl
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/iblinkinfo.8 infiniband-diags-1.5.8/man/iblinkinfo.8
+--- /tmp/infiniband-diags-1.5.8/man/iblinkinfo.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/iblinkinfo.8	Fri Feb 25 03:09:26 2011
+@@ -1,4 +1,4 @@
+-.TH IBLINKINFO 8 "Jan 24, 2008" "OpenIB" "OpenIB Diagnostics"
++.TH IBLINKINFO 1m "Jan 24, 2008" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ iblinkinfo \- report link info for all links in the fabric
+diff -r -u /tmp/infiniband-diags-1.5.8/man/dump_mfts.8 infiniband-diags-1.5.8/man/dump_mfts.8
+--- /tmp/infiniband-diags-1.5.8/man/dump_mfts.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/dump_mfts.8	Thu Feb 24 11:26:41 2011
+@@ -1,4 +1,4 @@
+-.TH DUMP_MFTS.SH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH DUMP_MFTS.SH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ dump_lfts.sh \- dump InfiniBand multicast forwarding tables
+@@ -34,10 +34,10 @@
+ 
+ 
+ .SH SEE ALSO
+-.BR dump_lfts(8),
+-.BR ibroute(8),
+-.BR ibswitches(8),
+-.BR opensm(8)
++.BR dump_lfts(1m),
++.BR ibroute(1m),
++.BR ibswitches(1m),
++.BR opensm(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibclearerrors.8 infiniband-diags-1.5.8/man/ibclearerrors.8
+--- /tmp/infiniband-diags-1.5.8/man/ibclearerrors.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibclearerrors.8	Thu Feb 24 11:26:44 2011
+@@ -1,4 +1,4 @@
+-.TH IBCLEARERRORS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCLEARERRORS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibclearerrors \- clear error counters in IB subnet
+@@ -25,8 +25,8 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR perfquery(8)
++.BR ibnetdiscover(1m),
++.BR perfquery(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibhosts.8 infiniband-diags-1.5.8/man/ibhosts.8
+--- /tmp/infiniband-diags-1.5.8/man/ibhosts.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibhosts.8	Thu Feb 24 11:26:45 2011
+@@ -1,4 +1,4 @@
+-.TH IBHOSTS 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBHOSTS 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibhosts \- show InfiniBand host nodes in topology
+@@ -23,7 +23,7 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckportwidth.8 infiniband-diags-1.5.8/man/ibcheckportwidth.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckportwidth.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckportwidth.8	Thu Feb 24 11:26:43 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKPORTWIDTH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKPORTWIDTH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckportwidth \- validate IB port for 1x link width
+@@ -34,8 +34,8 @@
+ ibcheckportwidth 2 3         # check lid 2 port 3
+ 
+ .SH SEE ALSO
+-.BR smpquery(8),
+-.BR ibaddr(8)
++.BR smpquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/check_lft_balance.8 infiniband-diags-1.5.8/man/check_lft_balance.8
+--- /tmp/infiniband-diags-1.5.8/man/check_lft_balance.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/check_lft_balance.8	Thu Feb 24 11:26:40 2011
+@@ -1,4 +1,4 @@
+-.TH CHECK_LFT_BALANCE.SH 8 "March 1, 2008" "OpenIB" "OpenIB Diagnostics"
++.TH CHECK_LFT_BALANCE.SH 1m "March 1, 2008" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ check_lft_balance.sh \- check InfiniBand unicast forwarding tables balance
+@@ -12,9 +12,9 @@
+ .PP
+ check_lft_balance.sh is a script which checks for balancing in Infiniband
+ unicast forwarding tables.  It analyzes the output of
+-.BR dump_lfts(8)
++.BR dump_lfts(1m)
+ and
+-.BR iblinkinfo(8).
++.BR iblinkinfo(1m).
+ 
+ .SH OPTIONS
+ 
+@@ -33,8 +33,8 @@
+ verbose output
+ 
+ .SH SEE ALSO
+-.BR dump_lfts(8),
+-.BR iblinkinfo(8)
++.BR dump_lfts(1m),
++.BR iblinkinfo(1m)
+ 
+ .SH AUTHORS
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibidsverify.8 infiniband-diags-1.5.8/man/ibidsverify.8
+--- /tmp/infiniband-diags-1.5.8/man/ibidsverify.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibidsverify.8	Thu Feb 24 11:26:45 2011
+@@ -1,4 +1,4 @@
+-.TH IBIDSVERIFY 8 "June 1, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBIDSVERIFY 1m "June 1, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibidsverify.pl \- validate IB identifiers in subnet and report errors
+@@ -28,7 +28,7 @@
+ fabric has changed.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibqueryerrors.8 infiniband-diags-1.5.8/man/ibqueryerrors.8
+--- /tmp/infiniband-diags-1.5.8/man/ibqueryerrors.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibqueryerrors.8	Thu Feb 24 11:26:47 2011
+@@ -1,4 +1,4 @@
+-.TH IBQUERYERRORS 8 "Dec 31, 2009" "OpenIB" "OpenIB Diagnostics"
++.TH IBQUERYERRORS 1m "Dec 31, 2009" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibqueryerrors \- query and report non-zero IB port counters
+diff -r -u /tmp/infiniband-diags-1.5.8/man/dump_lfts.8 infiniband-diags-1.5.8/man/dump_lfts.8
+--- /tmp/infiniband-diags-1.5.8/man/dump_lfts.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/dump_lfts.8	Thu Feb 24 11:26:40 2011
+@@ -1,4 +1,4 @@
+-.TH DUMP_LFTS.SH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH DUMP_LFTS.SH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ dump_lfts.sh \- dump InfiniBand unicast forwarding tables
+@@ -37,10 +37,10 @@
+ override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR dump_mfts(8),
+-.BR ibroute(8),
+-.BR ibswitches(8),
+-.BR opensm(8)
++.BR dump_mfts(1m),
++.BR ibroute(1m),
++.BR ibswitches(1m),
++.BR opensm(1m)
+ 
+ .SH AUTHORS
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibnetdiscover.8 infiniband-diags-1.5.8/man/ibnetdiscover.8
+--- /tmp/infiniband-diags-1.5.8/man/ibnetdiscover.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibnetdiscover.8	Thu Feb 24 11:26:46 2011
+@@ -1,4 +1,4 @@
+-.TH IBNETDISCOVER 8 "May 13, 2009" "OpenIB" "OpenIB Diagnostics"
++.TH IBNETDISCOVER 1m "May 13, 2009" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibnetdiscover \- discover InfiniBand topology
+diff -r -u /tmp/infiniband-diags-1.5.8/man/saquery.8 infiniband-diags-1.5.8/man/saquery.8
+--- /tmp/infiniband-diags-1.5.8/man/saquery.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/saquery.8	Thu Feb 24 11:26:50 2011
+@@ -1,4 +1,4 @@
+-.TH SAQUERY 8 "October 19, 2008" "OpenIB" "OpenIB Diagnostics"
++.TH SAQUERY 1m "October 19, 2008" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ saquery \- query InfiniBand subnet administration attributes
+@@ -99,7 +99,7 @@
+ \fB\-\-node\-name\-map\fR <node-name-map>
+ Specify a node name map.  The node name map file maps GUIDs to more
+ user friendly names.  See
+-.B ibnetdiscover(8)
++.B ibnetdiscover(1m)
+ for node name map file format.  Only used with the \fB\-O\fR and \fB\-U\fR
+ options.
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibtracert.8 infiniband-diags-1.5.8/man/ibtracert.8
+--- /tmp/infiniband-diags-1.5.8/man/ibtracert.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibtracert.8	Fri Feb 25 03:09:26 2011
+@@ -1,4 +1,4 @@
+-.TH IBTRACERT 8 "September 14, 2010" "OpenIB" "OpenIB Diagnostics"
++.TH IBTRACERT 1m "September 14, 2010" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibtracert\- trace InfiniBand path
+@@ -31,7 +31,7 @@
+ \fB\-\-node\-name\-map\fR <node-name-map>
+ Specify a node name map.  The node name map file maps GUIDs to more
+ user friendly names.  See
+-.B ibnetdiscover(8)
++.B ibnetdiscover(1m)
+ for node name map file format.
+ 
+ .SH COMMON OPTIONS
+@@ -97,7 +97,7 @@
+ ibtracert -m 0xc000 4 16    # show multicast path of mlid 0xc000 between lids 4 and 16
+ 
+ .SH SEE ALSO
+-.BR ibroute (8)
++.BR ibroute (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibaddr.8 infiniband-diags-1.5.8/man/ibaddr.8
+--- /tmp/infiniband-diags-1.5.8/man/ibaddr.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibaddr.8	Thu Feb 24 11:26:41 2011
+@@ -1,4 +1,4 @@
+-.TH IBADDR 8 "June 18, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBADDR 1m "June 18, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibaddr \- query InfiniBand address(es)
+@@ -102,8 +102,8 @@
+ ibaddr -g 32            # show gid address only
+ 
+ .SH SEE ALSO
+-.BR ibroute (8),
+-.BR ibtracert (8)
++.BR ibroute (1m),
++.BR ibtracert (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/perfquery.8 infiniband-diags-1.5.8/man/perfquery.8
+--- /tmp/infiniband-diags-1.5.8/man/perfquery.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/perfquery.8	Thu Feb 24 11:26:49 2011
+@@ -1,4 +1,4 @@
+-.TH PERFQUERY 8 "Jun 16, 2010" "OpenIB" "OpenIB Diagnostics"
++.TH PERFQUERY 1m "Jun 16, 2010" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ perfquery \- query InfiniBand port counters
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibroute.8 infiniband-diags-1.5.8/man/ibroute.8
+--- /tmp/infiniband-diags-1.5.8/man/ibroute.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibroute.8	Thu Feb 24 11:26:47 2011
+@@ -1,4 +1,4 @@
+-.TH IBROUTE 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBROUTE 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibroute \- query InfiniBand switch forwarding tables
+@@ -114,7 +114,7 @@
+ ibroute -M -n 4 # simple dump format
+ 
+ .SH SEE ALSO
+-.BR ibtracert (8)
++.BR ibtracert (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibsysstat.8 infiniband-diags-1.5.8/man/ibsysstat.8
+--- /tmp/infiniband-diags-1.5.8/man/ibsysstat.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibsysstat.8	Thu Feb 24 11:26:49 2011
+@@ -1,4 +1,4 @@
+-.TH IBSYSSTAT 8 "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBSYSSTAT 1m "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibsysstat \- system status on an InfiniBand address
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckwidth.8 infiniband-diags-1.5.8/man/ibcheckwidth.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckwidth.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckwidth.8	Thu Feb 24 11:26:43 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKWIDTH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKWIDTH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckwidth \- find 1x links in IB subnet
+@@ -26,9 +26,9 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR ibchecknode(8),
+-.BR ibcheckportwidth(8)
++.BR ibnetdiscover(1m),
++.BR ibchecknode(1m),
++.BR ibcheckportwidth(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcacheedit.8 infiniband-diags-1.5.8/man/ibcacheedit.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcacheedit.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcacheedit.8	Thu Feb 24 11:26:41 2011
+@@ -1,4 +1,4 @@
+-.TH IBCACHEEDIT 8 "Apr 15, 2010" "OpenIB" "OpenIB Diagnostics"
++.TH IBCACHEEDIT 1m "Apr 15, 2010" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcacheedit \- edit an ibnetdiscover cache
+@@ -13,7 +13,7 @@
+ .PP
+ ibcacheedit allows users to edit an ibnetdiscover cache created through the
+ \fB\-\-cache\fR option in
+-.B ibnetdiscover(8).
++.B ibnetdiscover(1m).
+ 
+ .SH OPTIONS
+ 
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibswitches.8 infiniband-diags-1.5.8/man/ibswitches.8
+--- /tmp/infiniband-diags-1.5.8/man/ibswitches.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibswitches.8	Thu Feb 24 11:26:48 2011
+@@ -1,4 +1,4 @@
+-.TH IBSWITCHES 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBSWITCHES 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibswitches\- show InfiniBand switch nodes in topology
+@@ -23,7 +23,7 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibfindnodesusing.8 infiniband-diags-1.5.8/man/ibfindnodesusing.8
+--- /tmp/infiniband-diags-1.5.8/man/ibfindnodesusing.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibfindnodesusing.8	Thu Feb 24 11:26:45 2011
+@@ -1,4 +1,4 @@
+-.TH IBFINDNODESUSING 8 "May 22, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBFINDNODESUSING 1m "May 22, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibfindnodesusing.pl \- find a list of end nodes which are routed through
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintrt.8 infiniband-diags-1.5.8/man/ibprintrt.8
+--- /tmp/infiniband-diags-1.5.8/man/ibprintrt.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibprintrt.8	Thu Feb 24 11:26:47 2011
+@@ -1,4 +1,4 @@
+-.TH IBPRINTRT 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBPRINTRT 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibprintrt.pl \- print either only the router specified or a list of routers
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibswportwatch.8 infiniband-diags-1.5.8/man/ibswportwatch.8
+--- /tmp/infiniband-diags-1.5.8/man/ibswportwatch.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibswportwatch.8	Thu Feb 24 11:26:49 2011
+@@ -1,4 +1,4 @@
+-.TH IBSWPORTWATCH 8 "September 27, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBSWPORTWATCH 1m "September 27, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibswportwatch.pl \- poll the counters on the specified switch/port and
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintswitch.8 infiniband-diags-1.5.8/man/ibprintswitch.8
+--- /tmp/infiniband-diags-1.5.8/man/ibprintswitch.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibprintswitch.8	Thu Feb 24 11:26:47 2011
+@@ -1,4 +1,4 @@
+-.TH IBPRINTSWITCH 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBPRINTSWITCH 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibprintswitch.pl \- print either the switch specified or a list of switches
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibchecknet.8 infiniband-diags-1.5.8/man/ibchecknet.8
+--- /tmp/infiniband-diags-1.5.8/man/ibchecknet.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibchecknet.8	Thu Feb 24 11:26:42 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKNET 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKNET 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibchecknet \- validate IB subnet and report errors
+@@ -25,10 +25,10 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR ibchecknode(8),
+-.BR ibcheckport(8),
+-.BR ibcheckerrs(8)
++.BR ibnetdiscover(1m),
++.BR ibchecknode(1m),
++.BR ibcheckport(1m),
++.BR ibcheckerrs(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibclearcounters.8 infiniband-diags-1.5.8/man/ibclearcounters.8
+--- /tmp/infiniband-diags-1.5.8/man/ibclearcounters.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibclearcounters.8	Thu Feb 24 11:26:44 2011
+@@ -1,4 +1,4 @@
+-.TH IBCLEARCOUNTERS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCLEARCOUNTERS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibclearcounters \- clear port counters in IB subnet
+@@ -21,8 +21,8 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR perfquery(8)
++.BR ibnetdiscover(1m),
++.BR perfquery(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdatacounters.8 infiniband-diags-1.5.8/man/ibdatacounters.8
+--- /tmp/infiniband-diags-1.5.8/man/ibdatacounters.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibdatacounters.8	Thu Feb 24 11:26:44 2011
+@@ -1,4 +1,4 @@
+-.TH IBDATACOUNTERS 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBDATACOUNTERS 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibdatacounters \- query IB subnet for data counters
+@@ -30,8 +30,8 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8),
+-.BR ibdatacounts(8)
++.BR ibnetdiscover(1m),
++.BR ibdatacounts(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibping.8 infiniband-diags-1.5.8/man/ibping.8
+--- /tmp/infiniband-diags-1.5.8/man/ibping.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibping.8	Thu Feb 24 11:26:46 2011
+@@ -1,4 +1,4 @@
+-.TH IBPING 8 "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBPING 1m "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibping \- ping an InfiniBand address
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckerrs.8 infiniband-diags-1.5.8/man/ibcheckerrs.8
+--- /tmp/infiniband-diags-1.5.8/man/ibcheckerrs.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibcheckerrs.8	Thu Feb 24 11:26:42 2011
+@@ -1,4 +1,4 @@
+-.TH IBCHECKERRS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBCHECKERRS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibcheckerrs \- validate IB port (or node) and report errors in counters above threshold
+@@ -50,8 +50,8 @@
+ ibcheckerrs -T xxx 2    # check node using xxx threshold file
+ 
+ .SH SEE ALSO
+-.BR perfquery(8),
+-.BR ibaddr(8)
++.BR perfquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/smpdump.8 infiniband-diags-1.5.8/man/smpdump.8
+--- /tmp/infiniband-diags-1.5.8/man/smpdump.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/smpdump.8	Thu Feb 24 11:26:50 2011
+@@ -1,4 +1,4 @@
+-.TH SMPDUMP 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH SMPDUMP 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ smpdump \- dump InfiniBand subnet management attributes
+@@ -91,7 +91,7 @@
+ smpdump 0xa0 0x11       # NODE INFO, lid 0xa0
+ 
+ .SH SEE ALSO
+-.BR smpquery (8)
++.BR smpquery (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibrouters.8 infiniband-diags-1.5.8/man/ibrouters.8
+--- /tmp/infiniband-diags-1.5.8/man/ibrouters.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibrouters.8	Thu Feb 24 11:26:48 2011
+@@ -1,4 +1,4 @@
+-.TH IBROUTERS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBROUTERS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibrouters \- show InfiniBand router nodes in topology
+@@ -23,7 +23,7 @@
+ \-t <timeout_ms> override the default timeout for the solicited mads.
+ 
+ .SH SEE ALSO
+-.BR ibnetdiscover(8)
++.BR ibnetdiscover(1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibportstate.8 infiniband-diags-1.5.8/man/ibportstate.8
+--- /tmp/infiniband-diags-1.5.8/man/ibportstate.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibportstate.8	Thu Feb 24 11:26:46 2011
+@@ -1,4 +1,4 @@
+-.TH IBPORTSTATE 8 "Jan 13, 2010" "OpenIB" "OpenIB Diagnostics"
++.TH IBPORTSTATE 1m "Jan 13, 2010" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibportstate \- handle port (physical) state and link speed of an InfiniBand port
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibstatus.8 infiniband-diags-1.5.8/man/ibstatus.8
+--- /tmp/infiniband-diags-1.5.8/man/ibstatus.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibstatus.8	Thu Feb 24 11:26:48 2011
+@@ -1,4 +1,4 @@
+-.TH IBSTATUS 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
++.TH IBSTATUS 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibstatus \- query basic status of InfiniBand device(s)
+@@ -33,7 +33,7 @@
+ ibstatus mthca1:1 mthca0:2      # show status of specified ports
+ 
+ .SH SEE ALSO
+-.BR ibstat (8)
++.BR ibstat (1m)
+ 
+ .SH AUTHOR
+ .TP
+diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdatacounts.8 infiniband-diags-1.5.8/man/ibdatacounts.8
+--- /tmp/infiniband-diags-1.5.8/man/ibdatacounts.8	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/man/ibdatacounts.8	Thu Feb 24 11:26:44 2011
+@@ -1,4 +1,4 @@
+-.TH IBDATACOUNTS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
++.TH IBDATACOUNTS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+ 
+ .SH NAME
+ ibdatacounts \- get IB port data counters
+@@ -39,8 +39,8 @@
+ ibdatacounts 2   4       # show data counters for lid 2 port 4
+ 
+ .SH SEE ALSO
+-.BR perfquery(8),
+-.BR ibaddr(8)
++.BR perfquery(1m),
++.BR ibaddr(1m)
+ 
+ .SH AUTHOR
+ .TP
+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/infiniband-diags.spec.in infiniband-diags-1.5.8/infiniband-diags.spec.in
+--- /tmp/infiniband-diags-1.5.8/infiniband-diags.spec.in	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/infiniband-diags.spec.in	Thu Feb 24 11:26:32 2011
+@@ -52,7 +52,7 @@
+ %{_includedir}/infiniband/*.h
+ %define _perldir %(perl -e 'use Config; $T=$Config{installsitearch}; $T=~/(.*)\\/site_perl.*/; print $1;')
+ %{_perldir}/*
+-%{_mandir}/man8/*
++%{_mandir}/man1m/*
+ %{_mandir}/man3/*
+ %doc README COPYING ChangeLog
+ 
+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
+@@ -1757,7 +1757,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;
+@@ -431,6 +432,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 +447,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
+@@ -245,7 +245,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
+@@ -330,7 +330,7 @@
+ 
+ 	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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/infiniband-diags/solaris_set_nodedesc.c	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,595 @@
+/*
+ * Copyright (c) 2010, 2011, 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
+ * 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.
+ */
+
+/*
+ * OFED Solaris wrapper
+ */
+#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>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <sys/queue.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <strings.h>
+#include <getopt.h>
+#include <libdevinfo.h>
+#include <sys/utsname.h>
+
+#include <infiniband/verbs.h>
+#include <infiniband/arch.h>
+
+#include <sys/ib/adapters/tavor/tavor_ioctl.h>
+#include <sys/ib/adapters/hermon/hermon_ioctl.h>
+
+/*
+ * Local defines for HCA driver IOCTLs, used while
+ * building on build system without the change in
+ * header files.
+ */
+#ifdef	HERMON_NODEDESC_UPDATE_STR
+#define	HERMON_NODEDESC_UPDATE_STRING		0x00000001
+#endif
+#ifndef	HERMON_NODEDESC_UPDATE_HCA_STRING
+#define	HERMON_NODEDESC_UPDATE_HCA_STRING	0x00000002
+#undef	HERMON_NODEDESC_UPDATE_HCA_MAP
+#endif
+#ifndef HERMON_IOCTL_GET_NODEDESC
+#define	HERMON_IOCTL_GET_NODEDESC	(('t' << 8) | 0x31)
+#endif
+
+#ifdef	TAVOR_NODEDESC_UPDATE_STR
+#define	TAVOR_NODEDESC_UPDATE_STRING		0x00000001
+#endif
+#ifndef	TAVOR_NODEDESC_UPDATE_HCA_STRING
+#define	TAVOR_NODEDESC_UPDATE_HCA_STRING	0x00000002
+#undef	TAVOR_NODEDESC_UPDATE_HCA_MAP
+#endif
+#ifndef TAVOR_IOCTL_GET_NODEDESC
+#define	TAVOR_IOCTL_GET_NODEDESC	(('t' << 8) | 0x31)
+#endif
+
+#define	NODEDESC_UPDATE_STRING		0x00000001
+#define	NODEDESC_UPDATE_HCA_STRING	0x00000002
+#define	NODEDESC_READ			0x80000000
+
+#include "ibdiag_common.h"
+
+static char *devpath_prefix = "/devices";
+static char *devpath_suffix = ":devctl";
+static char *ib_hca_driver_list[] = {
+	"tavor", "hermon", NULL
+};
+static di_node_t	di_rootnode;
+char *argv0 = "solaris_set_nodedesc";
+
+#define	MAX_HCAS	32
+static struct nodedesc_read_info_s {
+	boolean_t	info_valid;
+	uint64_t	guid;
+	char		nd_string[64];
+	boolean_t	ofuv_name_valid;
+	char		ofuv_name[64];
+} nd_read_info_arr[MAX_HCAS];
+int	nd_read_info_cnt;
+
+static void
+print_read_info()
+{
+	int	j;
+
+	for (j = 0; j < nd_read_info_cnt; j++) {
+		if (nd_read_info_arr[j].info_valid == B_FALSE ||
+		    nd_read_info_arr[j].ofuv_name_valid == B_FALSE)
+			continue;
+		printf("%s: %-16s\n",
+		    nd_read_info_arr[j].ofuv_name,
+		    nd_read_info_arr[j].nd_string);
+	}
+}
+
+static void
+update_read_info_hwnames()
+{
+	struct ibv_device **dev_list;
+	int num_devices, i;
+	uint64_t	dev_guid;
+	char		*dev_name;
+	size_t		dev_name_len;
+
+	dev_list = ibv_get_device_list(&num_devices);
+	if (!dev_list) {
+		fprintf(stderr, "No IB devices found\n");
+		return;
+	}
+
+	for (i = 0; i < num_devices; ++i) {
+		int	j;
+
+		dev_guid = (uint64_t)ntohll(ibv_get_device_guid(dev_list[i]));
+		dev_name = (char *)ibv_get_device_name(dev_list[i]);
+		dev_name_len = strlen(dev_name) + 1;
+		for (j = 0; j < nd_read_info_cnt; j++) {
+			if (nd_read_info_arr[j].info_valid == B_TRUE &&
+			    nd_read_info_arr[j].guid == dev_guid) {
+				memcpy(nd_read_info_arr[j].ofuv_name,
+				    dev_name, dev_name_len);
+				nd_read_info_arr[j].ofuv_name_valid = B_TRUE;
+				break;
+			}
+		}
+	}
+
+	ibv_free_device_list(dev_list);
+}
+
+static void
+add_read_info_arr(char *nd_str, uint64_t guid)
+{
+	size_t	nd_len;
+
+	nd_len = strlen(nd_str) + 1;
+	nd_read_info_arr[nd_read_info_cnt].info_valid = B_TRUE;
+	nd_read_info_arr[nd_read_info_cnt].guid = guid;
+	memcpy(nd_read_info_arr[nd_read_info_cnt].nd_string, nd_str, nd_len);
+	nd_read_info_cnt++;
+
+}
+
+static void
+do_driver_read_ioctl(char *drivername)
+{
+	di_node_t	hcanode, childnode;
+	char		*devpath;
+	char		*access_devname;
+	int		devlength, devfd, rc = -1;
+	uint64_t	*hca_guid;
+
+	if ((hcanode = di_drv_first_node(drivername, di_rootnode))
+	    == DI_NODE_NIL) {
+		return;
+	}
+
+	while (hcanode != DI_NODE_NIL) {
+		childnode = di_child_node(hcanode);
+		while (childnode != DI_NODE_NIL) {
+			if (di_prop_lookup_int64(DDI_DEV_T_ANY,
+			    childnode, "hca-guid",
+			    (int64_t **)&hca_guid) != 1) {
+				childnode = di_sibling_node(childnode);
+				continue;
+			} else {
+				break;
+			}
+		}
+		if (childnode == DI_NODE_NIL) {
+			hcanode = di_drv_next_node(hcanode);
+			continue;
+		}
+
+		devpath = di_devfs_path(hcanode);
+		devlength = strlen(devpath_prefix) + strlen(devpath) +
+		    strlen(devpath_suffix) + 2;
+		access_devname = malloc(devlength);
+		(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);
+			free(access_devname);
+			hcanode = di_drv_next_node(hcanode);
+			continue;
+		}
+		if (strcmp(drivername, "tavor") == 0) {
+			tavor_nodedesc_ioctl_t		nodedesc_ioctl;
+
+			if ((rc = ioctl(devfd, TAVOR_IOCTL_GET_NODEDESC,
+			    (void *)&nodedesc_ioctl)) != 0) {
+				IBERROR("tavor ioctl failure");
+				free(access_devname);
+				close(devfd);
+				hcanode = di_drv_next_node(hcanode);
+				continue;
+			}
+			add_read_info_arr((char *)nodedesc_ioctl.node_desc_str,
+			    *hca_guid);
+		} else if (strcmp(drivername, "hermon") == 0) {
+			hermon_nodedesc_ioctl_t		nodedesc_ioctl;
+
+			if ((rc = ioctl(devfd, HERMON_IOCTL_GET_NODEDESC,
+			    (void *)&nodedesc_ioctl)) != 0) {
+				IBERROR("hermon ioctl failure");
+				free(access_devname);
+				close(devfd);
+				hcanode = di_drv_next_node(hcanode);
+				continue;
+			}
+			add_read_info_arr((char *)nodedesc_ioctl.node_desc_str,
+			    *hca_guid);
+		}
+
+		free(access_devname);
+		close(devfd);
+		hcanode = di_drv_next_node(hcanode);
+	}
+
+}
+
+static int
+do_driver_update_ioctl(char *drivername, char *node_desc, char *hca_desc,
+    uint64_t inp_hca_guid, uint32_t update_flag)
+{
+	di_node_t	hcanode, childnode;
+	char		*devpath;
+	char		*access_devname;
+	int		devlength, devfd, rc = -1;
+	uint64_t	*hca_guid;
+	char		*desc_str = (node_desc ? node_desc : hca_desc);
+
+	if ((hcanode = di_drv_first_node(drivername, di_rootnode))
+	    == DI_NODE_NIL) {
+		return (-1);
+	}
+
+	while (hca_desc && hcanode != DI_NODE_NIL) {
+		childnode = di_child_node(hcanode);
+		while (childnode != DI_NODE_NIL) {
+			if (di_prop_lookup_int64(DDI_DEV_T_ANY,
+			    childnode, "hca-guid",
+			    (int64_t **)&hca_guid) != 1) {
+				childnode = di_sibling_node(childnode);
+				continue;
+			} else {
+				break;
+			}
+		}
+		if (*hca_guid == inp_hca_guid)
+			break;
+		hcanode = di_drv_next_node(hcanode);
+	}
+
+	if ((hca_desc && childnode == DI_NODE_NIL) ||
+	    hcanode == DI_NODE_NIL) {
+		IBERROR("matching GUID not found");
+		return (-1);
+	}
+
+	devpath = di_devfs_path(hcanode);
+	devlength = strlen(devpath_prefix) + strlen(devpath) +
+	    strlen(devpath_suffix) + 2;
+	access_devname = malloc(devlength);
+	(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);
+		free(access_devname);
+		return (rc);
+	}
+	if (strcmp(drivername, "tavor") == 0) {
+		tavor_nodedesc_ioctl_t		nodedesc_ioctl;
+
+		strncpy(nodedesc_ioctl.node_desc_str, desc_str, 64);
+		if (update_flag & NODEDESC_UPDATE_STRING)
+			nodedesc_ioctl.node_desc_update_flag =
+			    TAVOR_NODEDESC_UPDATE_STRING;
+		else if (update_flag & NODEDESC_UPDATE_HCA_STRING)
+			nodedesc_ioctl.node_desc_update_flag =
+			    TAVOR_NODEDESC_UPDATE_HCA_STRING;
+		else {
+			IBERROR("Invalid option");
+			exit(-1);
+		}
+		if ((rc = ioctl(devfd, TAVOR_IOCTL_SET_NODEDESC,
+		    (void *)&nodedesc_ioctl)) != 0) {
+			IBERROR("tavor ioctl failure");
+		}
+	} else if (strcmp(drivername, "hermon") == 0) {
+		hermon_nodedesc_ioctl_t		nodedesc_ioctl;
+
+		strncpy(nodedesc_ioctl.node_desc_str, desc_str, 64);
+		if (update_flag & NODEDESC_UPDATE_STRING)
+			nodedesc_ioctl.node_desc_update_flag =
+			    HERMON_NODEDESC_UPDATE_STRING;
+		else if (update_flag & NODEDESC_UPDATE_HCA_STRING)
+			nodedesc_ioctl.node_desc_update_flag =
+			    HERMON_NODEDESC_UPDATE_HCA_STRING;
+		else {
+			IBERROR("Invalid option");
+			exit(-1);
+		}
+		if ((rc = ioctl(devfd, HERMON_IOCTL_SET_NODEDESC,
+		    (void *)&nodedesc_ioctl)) != 0) {
+			IBERROR("hermon ioctl failure");
+		}
+	}
+
+	free(access_devname);
+	close(devfd);
+	return (rc);
+}
+
+static void
+read_nodedesc()
+{
+	int	i;
+
+	if ((di_rootnode = di_init("/", DINFOCPYALL | DINFOFORCE))
+	    == DI_NODE_NIL) {
+		IBERROR("read_nodedesc di_init failure");
+		return;
+	}
+	for (i = 0; ib_hca_driver_list[i]; i++)
+		do_driver_read_ioctl(ib_hca_driver_list[i]);
+	di_fini(di_rootnode);
+}
+
+static int
+update_nodedesc(char *cmn_nodedesc, char *hca_nodedesc, uint64_t guid,
+    uint32_t update_flag)
+{
+	int	i, rc = 0;
+
+	if ((di_rootnode = di_init("/", DINFOCPYALL | DINFOFORCE))
+	    == DI_NODE_NIL) {
+		IBERROR("di_init failure");
+		return (-1);
+	}
+	for (i = 0; ib_hca_driver_list[i]; i++) {
+		rc = do_driver_update_ioctl(ib_hca_driver_list[i],
+		    cmn_nodedesc, hca_nodedesc, guid,
+		    update_flag);
+		if (!rc)
+			break;
+	}
+	if (rc)
+		IBERROR("Updated failed for all HCA drivers");
+
+	di_fini(di_rootnode);
+	return (rc);
+}
+
+static void
+usage(void)
+{
+	char *basename;
+
+	if (!(basename = strrchr(argv0, '/')))
+		basename = argv0;
+	else
+		basename++;
+
+	fprintf(stderr, "Usage: %s \n", basename);
+	fprintf(stderr, "\t\t %s [-N(ode_Descriptor) CmnString]\n",
+	    basename);
+	fprintf(stderr, "\t\t %s [-H(CA_Description) HCAString "
+	    "-G(UID) HCA_GUID]\n", basename);
+	fprintf(stderr, "\t\t %s [-H(CA_Description) HCAString "
+	    "-G(UID) HCA_GUID -N(ode_Descriptor) CmnString]\n",
+	    basename);
+	fprintf(stderr, "\t\t %s [-v]\n", basename);
+}
+
+/*
+ * Return the Node descriptor string by concatinating
+ * many substrings. The first substring is "optarg" and
+ * the index of the last sub-string is "optind".
+ *
+ * For common nodedescription, add a space at the end,
+ * if there is none.
+ */
+static char *
+nodedesc_substr_cat(char **argv, int argc, boolean_t space_at_end)
+{
+	int	i, start_opt, end_opt;
+	char	*nodedesc_str;
+
+	/* Get the index for first sub-string. */
+	for (start_opt = 0, i = optind; i; i--) {
+		if (argv[i] == NULL)
+			continue;
+
+		if (strcmp(argv[i], optarg) == 0) {
+			start_opt = i;
+			break;
+		}
+	}
+	if (start_opt == 0)
+		return (NULL);
+
+	/* Get the index for last sub-string */
+	for (end_opt = 0, i = optind; i <= argc; i++) {
+		if (i == argc || argv[i][0] == '-') {
+			end_opt = i - 1;
+			break;
+		}
+	}
+	if (end_opt == 0)
+		return (NULL);
+
+	nodedesc_str = malloc(64);
+	strncpy(nodedesc_str, optarg, 64);
+	start_opt++;
+
+	/*
+	 * strcat a space string and then strcat the
+	 * next sub-string.
+	 */
+	for (i = start_opt; i <= end_opt; i++) {
+		strncat(nodedesc_str, " ", 64);
+		strncat(nodedesc_str, argv[i], 64);
+	}
+
+	/*
+	 * Add a space at the end, if the caller has set
+	 * space_at_end and the nodedesc string doesn't
+	 * contain a space at the end.
+	 */
+	if (space_at_end == B_TRUE &&
+	    nodedesc_str[strlen(nodedesc_str)] != ' ')
+		strncat(nodedesc_str, " ", 64);
+	return (nodedesc_str);
+}
+
+int
+main(int argc, char **argv)
+{
+	int		rc;
+	char		*nodedesc = NULL, *hcadesc = NULL;
+	uint32_t	update_flag = 0;
+	struct utsname	uts_name;
+	uint64_t	hca_guid;
+	boolean_t	guid_inited = B_FALSE;
+	extern int ibdebug;
+
+	static char const str_opts[] = "N:H:G:vd";
+	static const struct option long_opts[] = {
+		{ "Node_Descriptor", 1, 0, 'N'},
+		{ "HCA_Description", 1, 0, 'H'},
+		{ "GUID", 1, 0, 'G'},
+		{ "verbose", 0, 0, 'v'},
+		{ "debug", 0, 0, 'd'},
+		{ }
+	};
+
+	argv0 = argv[0];
+	while (1) {
+		int ch = getopt_long(argc, argv, str_opts,
+		    long_opts, NULL);
+		if (ch == -1)
+			break;
+		switch (ch) {
+		case 'N':
+			nodedesc = nodedesc_substr_cat(argv, argc, B_TRUE);
+			if (!nodedesc) {
+				usage();
+				rc = -1;
+				goto free_and_ret;
+			}
+			update_flag |= NODEDESC_UPDATE_STRING;
+			break;
+		case 'H':
+			hcadesc = nodedesc_substr_cat(argv, argc, B_FALSE);
+			if (!hcadesc) {
+				usage();
+				rc = -1;
+				goto free_and_ret;
+			}
+			update_flag |= NODEDESC_UPDATE_HCA_STRING;
+			break;
+		case 'G':
+			guid_inited = B_TRUE;
+			hca_guid = (uint64_t)strtoull(optarg, 0, 0);
+			break;
+		case 'v' :
+			update_flag |= NODEDESC_READ;
+			break;
+		case 'd':
+			ibdebug++;
+			break;
+		default:
+			usage();
+			rc = -1;
+			goto free_and_ret;
+		}
+	}
+
+	if (update_flag & NODEDESC_READ) {
+		if (nodedesc || hcadesc || guid_inited == B_TRUE) {
+			usage();
+			rc = -1;
+			goto free_and_ret;
+		}
+
+		read_nodedesc();
+		update_read_info_hwnames();
+		print_read_info();
+		return (0);
+	}
+
+	if (hcadesc && guid_inited == B_FALSE) {
+		IBERROR("No GUID specified for HCA Node descriptor");
+		usage();
+		rc = -1;
+		goto free_and_ret;
+	}
+
+	if (nodedesc) {
+		rc = update_nodedesc(nodedesc, NULL, 0,
+		    NODEDESC_UPDATE_STRING);
+		if (rc) {
+			IBERROR("write common node descriptor "
+			    "failed");
+			rc = -1;
+			goto free_and_ret;
+		}
+	}
+
+	if (hcadesc) {
+		rc = update_nodedesc(NULL, hcadesc, hca_guid,
+		    NODEDESC_UPDATE_HCA_STRING);
+		if (rc) {
+			IBERROR("update_hca_noddesc failed");
+			rc = -1;
+			goto free_and_ret;
+		}
+		return (0);
+	}
+
+
+	if (nodedesc == NULL) {
+		if (uname(&uts_name) < 0) {
+			IBERROR("Node descriptor unspecified"
+			    "& uts_name failed");
+			rc = -1;
+			goto free_and_ret;
+		}
+	}
+
+	rc = update_nodedesc((char *)uts_name.nodename, NULL,
+	    0, NODEDESC_UPDATE_STRING);
+
+free_and_ret:
+	if (nodedesc)
+		free(nodedesc);
+	if (hcadesc)
+		free(hcadesc);
+
+	return (rc);
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibmad/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,51 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libibmad
+COMPONENT_VERSION=	1.3.7
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:ed9a8f3cc27a2e5ae55629c0cc90ab43ee450fc4
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS +=	-lsocket -lnsl -libumad
+
+COMPONENT_POST_INSTALL_ACTION =\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la;\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la;\
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibmad/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,275 @@
+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
+@@ -1036,6 +1036,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 +1067,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 +1076,14 @@
+ #define ALIGN(l, size) (((l) + ((size) - 1)) / (size) * (size))
+ 
+ /** printf style warning MACRO, includes name of function and pid */
+-#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
++#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
+ 
+-#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
++#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
+ 
+-#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
++#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
+ 
+ #define IBPANIC(fmt, ...) do { \
+-	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", getpid(), __func__, ## __VA_ARGS__); \
++	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", (int)getpid(), __func__, ## __VA_ARGS__); \
+ 	exit(-1); \
+ } while(0)
+ 
+diff -r -u /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h libibmad-1.3.7/include/infiniband/mad_osd.h
+--- /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h	Wed Feb 16 02:12:53 2011
++++ libibmad-1.3.7/include/infiniband/mad_osd.h	Thu Feb 24 11:27:11 2011
+@@ -39,7 +39,9 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
++#endif
+ #include <inttypes.h>
+ #include <arpa/inet.h>
+ 
+diff -r -u /tmp/libibmad-1.3.7/src/fields.c libibmad-1.3.7/src/fields.c
+--- /tmp/libibmad-1.3.7/src/fields.c	Wed Feb 16 02:12:53 2011
++++ libibmad-1.3.7/src/fields.c	Thu Feb 24 13:27:00 2011
+@@ -514,7 +514,7 @@
+ 	uint64_t nval;
+ 
+ 	nval = htonll(val);
+-	memcpy((char *)buf + base_offs + f->bitoffs / 8, &nval,
++	memcpy( (void*)((char *)buf + base_offs + f->bitoffs / 8), (void *)&nval,
+ 	       sizeof(uint64_t));
+ }
+ 
+@@ -521,7 +521,7 @@
+ static uint64_t _get_field64(void *buf, int base_offs, const ib_field_t * f)
+ {
+ 	uint64_t val;
+-	memcpy(&val, ((char *)buf + base_offs + f->bitoffs / 8),
++	memcpy( (void *)&val, (void *)((char *)buf + base_offs + f->bitoffs / 8),
+ 	       sizeof(uint64_t));
+ 	return ntohll(val);
+ }
+diff -r -u /tmp/libibmad-1.3.7/src/dump.c libibmad-1.3.7/src/dump.c
+--- /tmp/libibmad-1.3.7/src/dump.c	Wed Feb 16 02:12:53 2011
++++ libibmad-1.3.7/src/dump.c	Thu Feb 24 11:27:11 2011
+@@ -46,12 +46,24 @@
+ 
+ void mad_dump_int(char *buf, int bufsz, void *val, int valsz)
+ {
++	/*
++	 * the val pointer passed to the dump routines are always 32 bit
++	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
++	 * uint8_t or uint16_t. This is because mad_decode_field always returns
++	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
++	 */
+ 	switch (valsz) {
+ 	case 1:
+-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint8_t *)val) + 3;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%d", *(uint8_t *) val & 0xff);
+ 		break;
+ 	case 2:
+-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xffff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint16_t *)val) + 1;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%d", *(uint16_t *) val & 0xffff);
+ 		break;
+ 	case 3:
+ 	case 4:
+@@ -71,12 +83,24 @@
+ 
+ void mad_dump_uint(char *buf, int bufsz, void *val, int valsz)
+ {
++	/*
++	 * the val pointer passed to the dump routines are always 32 bit
++	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
++	 * uint8_t or uint16_t. This is because mad_decode_field always returns
++	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
++	 */
+ 	switch (valsz) {
+ 	case 1:
+-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint8_t *)val) + 3;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%u", *(uint8_t *) val & 0xff);
+ 		break;
+ 	case 2:
+-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xffff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint16_t *)val) + 1;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%u", *(uint16_t *) val & 0xffff);
+ 		break;
+ 	case 3:
+ 	case 4:
+@@ -96,15 +120,28 @@
+ 
+ void mad_dump_hex(char *buf, int bufsz, void *val, int valsz)
+ {
++	/*
++	 * the val pointer passed to the dump routines are always 32 bit
++	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
++	 * uint8_t or uint16_t. This is because mad_decode_field always returns
++	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
++	 */
+ 	switch (valsz) {
+ 	case 1:
+-		snprintf(buf, bufsz, "0x%02x", *(uint32_t *) val & 0xff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint8_t *)val) + 3;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "0x%02x", *(uint8_t *) val & 0xff);
+ 		break;
+ 	case 2:
+-		snprintf(buf, bufsz, "0x%04x", *(uint32_t *) val & 0xffff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint16_t *)val) + 1;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "0x%04x", *(uint16_t *) val & 0xffff);
+ 		break;
+ 	case 3:
+-		snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
++		//snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
++		snprintf(buf, bufsz, "0x%x", *(uint32_t *)val & 0xffffff);
+ 		break;
+ 	case 4:
+ 		snprintf(buf, bufsz, "0x%08x", *(uint32_t *) val);
+@@ -132,12 +169,24 @@
+ 
+ void mad_dump_rhex(char *buf, int bufsz, void *val, int valsz)
+ {
++	/*
++	 * the val pointer passed to the dump routines are always 32 bit
++	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
++	 * uint8_t or uint16_t. This is because mad_decode_field always returns
++	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
++	 */
+ 	switch (valsz) {
+ 	case 1:
+-		snprintf(buf, bufsz, "%02x", *(uint32_t *) val & 0xff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint8_t *)val) + 3;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%02x", *(uint8_t *) val & 0xff);
+ 		break;
+ 	case 2:
+-		snprintf(buf, bufsz, "%04x", *(uint32_t *) val & 0xffff);
++#if defined(_BIG_ENDIAN)
++		val = ((uint16_t *)val) + 1;
++#endif /* _BIG_ENDIAN */
++		snprintf(buf, bufsz, "%04x", *(uint16_t *) val & 0xffff);
+ 		break;
+ 	case 3:
+ 		snprintf(buf, bufsz, "%06x", *(uint32_t *) val & 0xffffff);
+diff -r -u /tmp/libibmad-1.3.7/src/rpc.c libibmad-1.3.7/src/rpc.c
+--- /tmp/libibmad-1.3.7/src/rpc.c	Wed Feb 16 02:12:53 2011
++++ libibmad-1.3.7/src/rpc.c	Thu Feb 24 11:27:14 2011
+@@ -152,7 +152,7 @@
+ 
+ 		length = len;
+ 		if (umad_send(port_id, agentid, sndbuf, length, timeout, 0) < 0) {
+-			IBWARN("send failed; %m");
++			IBWARN("send failed; %s", strerror(errno));
+ 			return -1;
+ 		}
+ 
+@@ -161,7 +161,7 @@
+ 		do {
+ 			length = len;
+ 			if (umad_recv(port_id, rcvbuf, &length, timeout) < 0) {
+-				IBWARN("recv failed: %m");
++				IBWARN("recv failed: %s", strerror(errno));
+ 				return -1;
+ 			}
+ 
+@@ -337,7 +337,7 @@
+ 		IBPANIC("can't init UMAD library");
+ 
+ 	if ((fd = umad_open_port(dev_name, dev_port)) < 0)
+-		IBPANIC("can't open UMAD port (%s:%d)", dev_name, dev_port);
++		IBPANIC("can't open UMAD port (%s:%d)", dev_name?dev_name:"(nil)", dev_port);
+ 
+ 	if (num_classes >= MAX_CLASS)
+ 		IBPANIC("too many classes %d requested", num_classes);
+diff -r -u /tmp/libibmad-1.3.7/src/serv.c libibmad-1.3.7/src/serv.c
+--- /tmp/libibmad-1.3.7/src/serv.c	Wed Feb 16 02:12:53 2011
++++ libibmad-1.3.7/src/serv.c	Thu Feb 24 11:27:14 2011
+@@ -38,6 +38,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <errno.h>
+ 
+ #include <infiniband/umad.h>
+ #include <infiniband/mad.h>
+@@ -75,7 +76,7 @@
+ 	if (umad_send(srcport->port_id, srcport->class_agents[rpc->mgtclass],
+ 		      umad, IB_MAD_SIZE, mad_get_timeout(srcport, rpc->timeout),
+ 		      0) < 0) {
+-		IBWARN("send failed; %m");
++		IBWARN("send failed; %s", strerror(errno));
+ 		return -1;
+ 	}
+ 
+@@ -157,7 +158,7 @@
+ 	if (umad_send
+ 	    (srcport->port_id, srcport->class_agents[rpc.mgtclass], umad,
+ 	     IB_MAD_SIZE, mad_get_timeout(srcport, rpc.timeout), 0) < 0) {
+-		DEBUG("send failed; %m");
++		DEBUG("send failed; %s", strerror(errno));
+ 		return -1;
+ 	}
+ 
+@@ -179,7 +180,7 @@
+ 			       mad_get_timeout(srcport, timeout))) < 0) {
+ 		if (!umad)
+ 			umad_free(mad);
+-		DEBUG("recv failed: %m");
++		DEBUG("recv failed: %s", strerror(errno));
+ 		return 0;
+ 	}
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibumad/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,87 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libibumad
+COMPONENT_VERSION=	1.3.7
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:a27f1dd161ed77339d9979bf1d8500150638db9b
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS +=	-lsocket -lnsl -libverbs
+
+CLEANUP_FILES = $(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_free.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_done.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_send.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_recv.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_init.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_dump.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_poll.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_size.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_debug.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_alloc.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_ca.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_fd.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_status.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_mad.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_set_grh.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_set_addr.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_pkey.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_port.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_set_pkey.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_register.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_addr_dump.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_open_port.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_release_ca.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_close_port.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_unregister.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_set_grh_net.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_mad_addr.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_set_addr_net.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_release_port.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_register_oui.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_cas_names.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_issm_path.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/umad_get_ca_portguids.3
+
+COMPONENT_POST_INSTALL_ACTION = \
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la;\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la;\
+	$(RM) $(CLEANUP_FILES)
+
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibumad/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,285 @@
+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
+@@ -96,7 +96,11 @@
+ 
+ #define UMAD_MAX_PORTS		64
+ 
++#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,10 @@
+ 
+ #include "umad.h"
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/verbs.h>
++#endif
++
+ #define IB_OPENIB_OUI                 (0x001405)
+ 
+ #ifdef HAVE_VALGRIND_MEMCHECK_H
+@@ -82,7 +86,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
+@@ -172,6 +176,82 @@
+ 	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_device	**root_dev_list, **dev_list = NULL;
++		struct ibv_context	*ctx = NULL;
++		struct ibv_port_attr	port_attr;
++		int			num_dev;
++
++		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
++		if (!dev_list) {
++			IBWARN("No HCA devices found");
++			goto clean;
++		}
++
++		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);
++			goto clean;
++		}
++
++		if (!(ctx = ibv_open_device(*dev_list))) {
++			IBWARN("failed to open device \"%s\"", ca_name);
++			ibv_free_device_list(root_dev_list);
++			goto clean;
++		}
++
++		if (ibv_query_port(ctx, portnum, &port_attr)) {
++			IBWARN("Could not query \"%s\" port %d", ca_name,
++			    portnum);
++			ibv_close_device(ctx);
++			ibv_free_device_list(root_dev_list);
++			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);
++			ibv_close_device(ctx);
++			ibv_free_device_list(root_dev_list);
++			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) {
++			/*
++			 * have to do one at a time.
++			 */
++			portnum &= 0x7f;
++			for (i = 0; i < port_attr.pkey_tbl_len; i++) {
++				if (ibv_query_pkey(ctx, portnum, i,
++				    &(port->pkeys[i]))) {
++					IBWARN("Could not retrieve pkeys for "
++					    "\"%s\"", ca_name);
++					ibv_close_device(ctx);
++					ibv_free_device_list(root_dev_list);
++					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 +273,8 @@
+ 	port->pkeys_size = num_pkeys;
+ 	free(namelist);
+ 	namelist = NULL;
++#endif
++
+ 	port_dir[len] = '\0';
+ 
+ 	/* FIXME: handle gids */
+@@ -384,6 +466,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 +508,41 @@
+ 	free(namelist);
+ 
+ 	closedir(dir);
++#else
++	// TODO: hardcoded 2 ports
++	ca->numports = 0;
++	memset(ca->ports, 0, sizeof ca->ports);
++
++	for (portnum = 1 /* HERE */; portnum <= 2 /* HERE */; portnum++) {
++
++		if (!(ca->ports[portnum] = calloc(1, sizeof(*ca->ports[portnum])))) {
++			ret = -ENOMEM;
++			goto clean;
++		}
++		if (get_port(ca_name, dir_name, portnum, ca->ports[portnum]) < 0) {
++			free(ca->ports[portnum]);
++			ca->ports[portnum] = NULL;
++			ret = -EIO;
++			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;
+@@ -522,6 +631,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 +678,7 @@
+ 	}
+ 	if (n >= 0)
+ 		free(namelist);
++#endif
+ 	return j;
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,81 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libibverbs
+COMPONENT_VERSION=	1.1.4
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-1.22.g7257cd3.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:7d7d466278ce5e18f74dd50ca14c3bba544f1e13
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/libibverbs/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+# add flags to get at extra bits from other components' source trees
+CPPFLAGS +=	-I$(PWD)/../libmthca/libmthca-1.0.5/src
+CPPFLAGS +=	-I$(PWD)/../libmlx4/libmlx4-1.0.1/src
+CPPFLAGS +=	-I$(PWD)/../librdmacm/librdmacm-1.0.14.1/include
+
+LIBS +=	-lsocket -lnsl -lkstat
+
+# --disable-libcheck is not a supported option for this component
+DISABLE_LIBCHECK=
+
+COMPONENT_PREP_ACTION = \
+	cp ofa_solaris.h $(@D)/include/infiniband ; \
+	cp solaris_compatibility.c $(@D)/src ; \
+	cd ../libmthca; gmake prep; \
+	cd ../libmlx4; gmake prep; \
+	cd ../librdmacm; gmake prep
+
+COMPONENT_POST_INSTALL_ACTION = \
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_BINDIR.$(BITS))/ibv_uc_pingpong; \
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_devices \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_devinfo \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_asyncwatch \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_rc_pingpong \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_uc_pingpong \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_ud_pingpong \
+	$(PROTO_DIR)/$(CONFIGURE_BINDIR.64)/ibv_srq_pingpong \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man1/ibv_uc_pingpong.1 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_reg_xrc_rcv_qp.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_create_xrc_srq.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_open_xrc_domain.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_close_xrc_domain.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_unreg_xrc_rcv_qp.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_query_xrc_rcv_qp.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_create_xrc_rcv_qp.3 \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/ibv_modify_xrc_rcv_qp.3
+	
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/ofa_solaris.h	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2010, 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
+ * 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.
+ */
+
+/*
+ * NAME: ofa_solaris.h
+ * DESC: OFED Solaris wrapper
+ */
+#ifndef _OFA_SOLARIS_H
+#define _OFA_SOLARIS_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/byteorder.h>
+#include <sys/sockio.h>
+#include <sys/mman.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <alloca.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef		uint8_t 	__u8;
+typedef		uint16_t	__u16;
+typedef		uint32_t	__u32;
+typedef		uint64_t	__u64;
+typedef		int32_t		__s32;
+typedef		int64_t		__s64;
+
+typedef		uint8_t 	u8;
+typedef		uint16_t	u16;
+typedef		uint32_t	u32;
+typedef		uint64_t	u64;
+typedef		int32_t		s32;
+
+typedef		__u8		u_int8_t;
+typedef		__u16		u_int16_t;
+typedef		__u32		u_int32_t;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef		__u64		u_int64_t;
+typedef		__s64		int64_t;
+#endif
+
+typedef        uint8_t         __be8;
+typedef        uint16_t        __be16;
+typedef        uint32_t        __be32;
+typedef        uint64_t        __be64;
+
+/* Size of a pointer */
+#if defined(_LP64) || defined(_I32LPx)
+#define __WORDSIZE 64
+#else
+#define __WORDSIZE 32
+#endif
+
+
+/*
+ * Endian definitions
+ */
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN    4321
+
+#ifdef _BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#elif defined _LITTLE_ENDIAN
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#else
+#error unknown endianness
+#endif
+
+/*
+ * byteswap functions.
+ */
+#define	bswap_8(x)	((x) & 0xff)
+
+#if !defined(__i386) && !defined(__amd64)
+#define bswap_16(x)	((bswap_8(x) << 8) | bswap_8((x) >> 8))
+#define bswap_32(x)     (((uint32_t)(x) << 24) | \
+                        (((uint32_t)(x) << 8) & 0xff0000) | \
+                        (((uint32_t)(x) >> 8) & 0xff00) | \
+                        ((uint32_t)(x)  >> 24))
+#else /* x86 */
+#define bswap_16(x)     htons(x)
+#define bswap_32(x)     htonl(x)
+#endif  /* !__i386 && !__amd64 */
+
+#if defined(_LP64) || defined(_LONGLONG_TYPE)
+#if (!defined(__i386) && !defined(__amd64))
+#define bswap_64(x)     (((uint64_t)(x) << 56) | \
+                        (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
+                        (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
+                        (((uint64_t)(x) << 8)  & 0xff00000000ULL) | \
+                        (((uint64_t)(x) >> 8)  & 0xff000000ULL) | \
+                        (((uint64_t)(x) >> 24) & 0xff0000ULL) | \
+                        (((uint64_t)(x) >> 40) & 0xff00ULL) | \
+                        ((uint64_t)(x)  >> 56))
+#else /* x86 */
+#define bswap_64(x)	htonll(x)
+#endif  /* !__i386 && !__amd64 */
+#else /* no uint64_t */ 
+#define bswap_64(x)	((bswap_32(x) << 32) | bswap_32((x) >> 32))
+#endif
+
+typedef struct sol_cpu_info_s {
+	char	cpu_name[64];
+	uint_t	cpu_mhz;
+	uint_t	cpu_num;
+} sol_cpu_info_t;
+
+int sol_get_cpu_info(sol_cpu_info_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OFA_SOLARIS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1434 @@
+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_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,
+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
+@@ -8,7 +8,7 @@
+ 
+ .SH DESCRIPTION
+ .PP
+-Display asynchronous events forwarded to userspace for an RDMA device.
++Display asynchronous events forwarded to userspace for an InfiniBand device.
+ 
+ .SH AUTHORS
+ .TP
+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,7 +8,7 @@
+ 
+ .SH DESCRIPTION
+ .PP
+-List RDMA devices available for use from userspace.
++List InfiniBand devices available for use from userspace.
+ 
+ .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
+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,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/sysmacros.h>
++#endif
+ 
+ #include "ibverbs.h"
+ 
+@@ -93,6 +98,44 @@
+ int __ibv_query_gid(struct ibv_context *context, uint8_t port_num,
+ 		    int index, union ibv_gid *gid)
+ {
++#if defined(__SVR4) && defined(__sun)
++	struct ibv_query_gid          cmd;
++	struct ibv_query_gid_resp     resp;
++
++	/*
++	 * Not exported via sysfs, use uverbs command.
++	 */
++	if (!context || !gid || (index < 0)) 
++		return -1;
++
++	if (port_num & 0x80) {
++		if (!index) 
++			return -1;
++
++		IBV_INIT_CMD_RESP(&cmd, sizeof cmd, QUERY_GID, gid,
++		    sizeof (union ibv_gid) * index);
++
++		cmd.gid_index = index;
++		cmd.port_num  = port_num;
++
++		if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++			return -1;
++		else
++			return 0;
++	} else {
++		IBV_INIT_CMD_RESP(&cmd, sizeof cmd, QUERY_GID, &resp,
++		    sizeof resp);
++
++		cmd.gid_index = index;
++		cmd.port_num  = port_num;
++
++		if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++			return -1;
++
++		memcpy(gid, resp.gid, sizeof resp.gid);	
++		return 0;
++	}
++#else
+ 	char name[24];
+ 	char attr[41];
+ 	uint16_t val;
+@@ -112,6 +155,7 @@
+ 	}
+ 
+ 	return 0;
++#endif
+ }
+ default_symver(__ibv_query_gid, ibv_query_gid);
+ 
+@@ -118,6 +162,44 @@
+ int __ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
+ 		     int index, uint16_t *pkey)
+ {
++#if defined(__SVR4) && defined(__sun)
++	struct ibv_query_pkey         cmd;
++	struct ibv_query_pkey_resp    resp;
++
++	/*
++	 * Not exported via sysfs, use uverbs command.
++	 */
++	if (!context || !pkey || (index < 0)) 
++		return -1;
++
++	if (port_num & 0x80) {
++		IBV_INIT_CMD_RESP(&cmd, sizeof cmd, QUERY_PKEY, pkey,
++		    sizeof (uint16_t) * index);
++
++		if (!index)
++			 return -1;
++		cmd.pkey_index = index;
++		cmd.port_num   = port_num;
++
++		if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++			return -1;
++		else
++			return 0;
++	} else {
++
++		IBV_INIT_CMD_RESP(&cmd, sizeof cmd, QUERY_PKEY, &resp,
++		    sizeof resp);
++
++		cmd.pkey_index = index;
++		cmd.port_num   = port_num;
++
++		if (write(context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
++			return -1;
++
++		*pkey = resp.pkey;
++		return 0;
++	}
++#else
+ 	char name[24];
+ 	char attr[8];
+ 	uint16_t val;
+@@ -133,6 +215,7 @@
+ 
+ 	*pkey = htons(val);
+ 	return 0;
++#endif
+ }
+ default_symver(__ibv_query_pkey, ibv_query_pkey);
+ 
+@@ -212,6 +295,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 +308,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 +331,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
+@@ -128,8 +128,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
+@@ -163,6 +168,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 +180,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 -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
+@@ -71,6 +71,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/sysmacros.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,9 +96,20 @@
+ 
+ 	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);
++#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);
+ 
+@@ -87,13 +127,28 @@
+ 			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);
++#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);
+ 
+@@ -100,6 +155,16 @@
+ 	context->async_fd         = resp->async_fd;
+ 	context->num_comp_vectors = resp->num_comp_vectors;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * 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
+ 	return 0;
+ }
+ 
+@@ -315,7 +380,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)
+@@ -637,7 +714,19 @@
+ 	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;
++	} 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 ?
+@@ -1406,4 +1495,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
+@@ -79,6 +79,9 @@
+ 
+ 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 +89,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 +128,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 +137,7 @@
+ 
+ 		if (!S_ISDIR(buf.st_mode))
+ 			continue;
++#endif
+ 
+ 		snprintf(sysfs_dev->sysfs_name, sizeof sysfs_dev->sysfs_name,
+ 			"%s", dent->d_name);
+@@ -409,6 +430,7 @@
+ 
+ static void check_memlock_limit(void)
+ {
++#if !(defined(__SVR4) && defined(__sun))
+ 	struct rlimit rlim;
+ 
+ 	if (!geteuid())
+@@ -423,6 +445,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/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,20 @@
+ 			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);
++
++	if (len < 0)
++		free(path);
++#else
+ 	fd = open(path, O_RDONLY);
+ 	if (fd < 0) {
+ 		free(path);
+@@ -98,6 +110,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; }
+@@ -8721,6 +8723,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++	 hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -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,10 @@
+ 	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
+ 	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
+ 	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
++#if defined(__SVR4) && defined(__sun)
++	IB_USER_VERBS_CMD_QUERY_GID,
++	IB_USER_VERBS_CMD_QUERY_PKEY
++#endif
+ };
+ 
+ /*
+@@ -235,6 +243,38 @@
+ 	__u8  reserved[2];
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++struct ibv_query_gid {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u64 response;
++	__u32 gid_index;
++	__u8  port_num;
++	__u8  reserved[3];
++	__u64 driver_data;
++};
++
++struct ibv_query_gid_resp {
++	__u8  gid[16];
++};
++
++struct ibv_query_pkey {
++	__u32 command;
++	__u16 in_words;
++	__u16 out_words;
++	__u64 response;
++	__u32 pkey_index;
++	__u8  port_num;
++	__u8  reserved[3];
++	__u64 driver_data;
++};
++
++struct ibv_query_pkey_resp {
++	__u16 pkey;
++	__u16 reserved;
++};
++#endif
+ struct ibv_alloc_pd {
+ 	__u32 command;
+ 	__u16 in_words;
+@@ -243,9 +283,24 @@
+ 	__u64 driver_data[0];
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * PD responses may pass opaque data to userspace drivers, we choose a value
++ * larger than what any HCA requires.
++ */
++#define SOL_UVERBS_PD_DATA_OUT_SIZE          24
++typedef __u64 ofuv_pd_drv_data_out_t[SOL_UVERBS_PD_DATA_OUT_SIZE];
++
+ struct ibv_alloc_pd_resp {
++        __u32 pd_handle;
++        __u32 reserved;
++        ofuv_pd_drv_data_out_t drv_out;
++};
++#else
++struct ibv_alloc_pd_resp {
+ 	__u32 pd_handle;
+ };
++#endif
+ 
+ struct ibv_dealloc_pd {
+ 	__u32 command;
+@@ -304,10 +359,25 @@
+ 	__u64 driver_data[0];
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * CQ responses pass opaque data to userspace drivers, we choose a value
++ * larger than what any HCA requires.
++ */
++#define SOL_UVERBS_CQ_DATA_OUT_SIZE          24
++typedef __u64 ofuv_cq_drv_data_out_t[SOL_UVERBS_CQ_DATA_OUT_SIZE];
++
+ struct ibv_create_cq_resp {
+ 	__u32 cq_handle;
+ 	__u32 cqe;
++	ofuv_cq_drv_data_out_t   drv_out;
+ };
++#else
++struct ibv_create_cq_resp {
++	__u32 cq_handle;
++	__u32 cqe;
++};
++#endif
+ 
+ struct ibv_kern_wc {
+ 	__u64  wr_id;
+@@ -363,7 +433,11 @@
+ struct ibv_resize_cq_resp {
+ 	__u32 cqe;
+ 	__u32 reserved;
++#if defined(__SVR4) && defined(__sun)
++        ofuv_cq_drv_data_out_t   drv_out;
++#else
+ 	__u64 driver_data[0];
++#endif
+ };
+ 
+ struct ibv_destroy_cq {
+@@ -460,6 +534,14 @@
+ 	__u64 driver_data[0];
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * QP responses pass opaque data to userspace drivers, we choose a value
++ * larger than what any HCA requires.
++ */
++#define SOL_UVERBS_QP_DATA_OUT_SIZE          24
++typedef __u64 ofuv_qp_drv_data_out_t[SOL_UVERBS_QP_DATA_OUT_SIZE];
++
+ struct ibv_create_qp_resp {
+ 	__u32 qp_handle;
+ 	__u32 qpn;
+@@ -469,7 +551,20 @@
+ 	__u32 max_recv_sge;
+ 	__u32 max_inline_data;
+ 	__u32 reserved;
++	ofuv_qp_drv_data_out_t drv_out;
+ };
++#else
++struct ibv_create_qp_resp {
++	__u32 qp_handle;
++	__u32 qpn;
++	__u32 max_send_wr;
++	__u32 max_recv_wr;
++	__u32 max_send_sge;
++	__u32 max_recv_sge;
++	__u32 max_inline_data;
++	__u32 reserved;
++};
++#endif
+ 
+ struct ibv_qp_dest {
+ 	__u8  dgid[16];
+@@ -817,12 +912,29 @@
+ 	__u64 driver_data[0];
+ };
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * QP responses pass opaque data to userspace drivers, we choose a value
++ * larger than what any HCA requires.
++ */
++#define SOL_UVERBS_SRQ_DATA_OUT_SIZE          24
++typedef __u64 ofuv_srq_drv_data_out_t[SOL_UVERBS_SRQ_DATA_OUT_SIZE];
++
+ struct ibv_create_srq_resp {
+ 	__u32 srq_handle;
+ 	__u32 max_wr;
+ 	__u32 max_sge;
+ 	__u32 reserved;
++	ofuv_srq_drv_data_out_t drv_out;
+ };
++#else
++struct ibv_create_srq_resp {
++	__u32 srq_handle;
++	__u32 max_wr;
++	__u32 max_sge;
++	__u32 reserved;
++};
++#endif
+ 
+ struct ibv_modify_srq {
+ 	__u32 command;
+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
+@@ -164,8 +164,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" {
+@@ -297,7 +300,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 {
+@@ -425,6 +429,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;
+@@ -749,6 +761,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;
+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/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,8 +35,10 @@
+ #endif /* HAVE_CONFIG_H */
+ 
+ #include <stdio.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ 
+ #include <infiniband/verbs.h>
+ 
+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
+@@ -171,6 +171,12 @@
+ 		return NULL;
+ 	}
+ 
++	if (n == EAI_NONAME) {
++		fprintf(stderr, "Name or service not known for %s:%d\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) {
+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
+@@ -149,6 +149,12 @@
+ 		return NULL;
+ 	}
+ 
++	if (n == EAI_NONAME) {
++		fprintf(stderr, "Name or service not known for %s:%d\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) {
+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
+@@ -161,6 +161,12 @@
+ 		return NULL;
+ 	}
+ 
++	if (n == EAI_NONAME) {
++		fprintf(stderr, "Name or service not known for %s:%d\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) {
+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,8 +36,10 @@
+ 
+ #include <stdio.h>
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ #include <endian.h>
+ #include <byteswap.h>
++#endif
+ 
+ #include <infiniband/verbs.h>
+ #include <infiniband/arch.h>
+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>
+@@ -292,8 +294,12 @@
+ 		       port_state_str(port_attr.state), port_attr.state);
+ 		printf("\t\t\tmax_mtu:\t\t%s (%d)\n",
+ 		       mtu_str(port_attr.max_mtu), port_attr.max_mtu);
++#if !(defined(__SVR4) && defined(__sun))
+ 		printf("\t\t\tactive_mtu:\t\t%s (%d)\n",
+ 		       mtu_str(port_attr.active_mtu), port_attr.active_mtu);
++#else
++		 printf("\t\t\tactive_mtu:\t\t%s\n", "Unknown");
++#endif
+ 		printf("\t\t\tsm_lid:\t\t\t%d\n", port_attr.sm_lid);
+ 		printf("\t\t\tport_lid:\t\t%d\n", port_attr.lid);
+ 		printf("\t\t\tport_lmc:\t\t0x%02x\n", port_attr.lmc);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libibverbs/solaris_compatibility.c	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1633 @@
+/*
+ * Copyright (c) 2010, 2011, 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
+ * 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 */
+
+/*
+ * OFED Solaris wrapper
+ */
+#if defined(__SVR4) && defined(__sun)
+
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/processor.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <sys/param.h>
+#include <sys/ib/adapters/hermon/hermon_ioctl.h>
+#include <sys/ib/adapters/tavor/tavor_ioctl.h>
+
+#include <alloca.h>
+#include "../include/infiniband/arch.h"
+#include "../include/infiniband/verbs.h"
+#include <errno.h>
+#include <pthread.h>
+#include <kstat.h>
+
+/*
+ * The followings will be removed when sol_uverbs_ioctl.h and sol_umad_ioctl.h
+ * are delivered through ON.
+ */
+
+#define	UVERBS_IOCTL		('v' << 8)
+
+#define	IB_USER_VERBS_SOLARIS_ABI_VERSION	1
+
+typedef enum {
+	UVERBS_IOCTL_GET_HCA_INFO	= UVERBS_IOCTL | 0x01
+} uverbs_ioctl_enum_t;
+
+typedef struct sol_uverbs_hca_info_s {
+	char		uverbs_hca_psid_string[MAXNAMELEN];
+	char		uverbs_hca_ibdev_name[MAXNAMELEN];
+	char		uverbs_hca_driver_name[MAXNAMELEN];
+	uint32_t	uverbs_hca_driver_instance;
+	uint32_t	uverbs_hca_vendorid;
+	uint16_t	uverbs_hca_deviceid;
+	uint8_t		uverbs_hca_devidx;
+	uint8_t		uverbs_hca_pad1[5];
+} sol_uverbs_hca_info_t;
+
+typedef struct sol_uverbs_info_s {
+	int32_t			uverbs_abi_version;
+	int32_t			uverbs_solaris_abi_version;
+	int16_t			uverbs_hca_cnt;
+	int8_t			uverbs_pad1[6];    /* Padding for alignment */
+	sol_uverbs_hca_info_t	uverbs_hca_info[];
+} sol_uverbs_info_t;
+
+#define	UMAD_IOCTL		('m' << 8)
+
+#define	IB_USER_MAD_SOLARIS_ABI_VERSION	1
+
+typedef enum {
+	IB_USER_MAD_GET_PORT_INFO	= UMAD_IOCTL | 0x01
+} umad_ioctl_enum_t;
+
+typedef struct sol_umad_ioctl_port_info_s {
+	char		umad_port_ibdev_name[MAXNAMELEN];
+	uint32_t	umad_port_num;
+	uint16_t	umad_port_idx;
+	uint8_t		umad_port_pad1[2];
+} sol_umad_ioctl_port_info_t;
+
+typedef struct sol_umad_ioctl_info_s {
+	int32_t				umad_abi_version;
+	int32_t				umad_solaris_abi_version;
+	int16_t				umad_port_cnt;
+	int8_t				umad_pad1[6];    /* alignment padding */
+	sol_umad_ioctl_port_info_t	umad_port_info[];
+} sol_umad_ioctl_info_t;
+
+/* end of sol_uverbs_ioctl.h and sol_umad_ioctl.h contents */
+
+/*
+ * duplicate ABI definitions for HCAs as the HCA abi headers are not
+ * installed in proto.
+ */ 
+#define	MTHCA_UVERBS_ABI_VERSION	1 /* mthca-abi.h */
+#define	MLX4_UVERBS_MAX_ABI_VERSION	3 /* mlx4-abi.h */
+#define	RDMA_USER_CM_MIN_ABI_VERSION	3 /* rdma_cma_abi.h */
+#define	RDMA_USER_CM_MAX_ABI_VERSION	4 /* rdma_cma_abi.h */
+
+#define	MLX4	0
+#define	MTHCA	1
+#define	MAX_HCAS				16
+#define	MAX_HCA_PORTS				16
+#define	HW_DRIVER_MAX_NAME_LEN			20
+#define	UVERBS_KERNEL_SYSFS_NAME_BASE		"uverbs"
+#define	UMAD_KERNEL_SYSFS_NAME_BASE		"umad"
+#define	IB_HCA_DEVPATH_PREFIX			"/dev/infiniband/hca"
+#define	IB_OFS_DEVPATH_PREFIX			"/dev/infiniband/ofs"
+#define	CONNECTX_NAME				"mlx4_"
+#define	INFINIHOST_NAME				"mthca"
+
+#define	MELLANOX_VENDOR_ID			0x15b3
+#define	PCI_DEVICE_ID_MELLANOX_TAVOR		0x5a44
+#define	PCI_DEVICE_ID_MELLANOX_ARBEL		0x6282
+#define	PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT	0x6278
+#define	PCI_DEVICE_ID_MELLANOX_HERMON_SDR	0x6340
+#define	PCI_DEVICE_ID_MELLANOX_HERMON_DDR	0x634a
+#define	PCI_DEVICE_ID_MELLANOX_HERMON_QDR	0x6354
+#define	PCI_DEVICE_ID_MELLANOX_HERMON_DDR_PCIE2	0x6732
+#define	PCI_DEVICE_ID_MELLANOX_HERMON_QDR_PCIE2	0x673c
+#define	INFINIHOST_DEVICE_ID_2			0x5a45
+#define	INFINIHOST_DEVICE_ID_4			0x6279
+
+/*
+ * sol_uverbs_drv_status is the status of what libibverbs knows
+ * about the status of sol_uverbs driver.
+ */
+#define	SOL_UVERBS_DRV_STATUS_UNKNOWN	0x0
+#define	SOL_UVERBS_DRV_STATUS_LOADED	0x1
+#define	SOL_UVERBS_DRV_STATUS_UNLOADED	0x02
+
+static kstat_ctl_t	*kc = NULL;	/* libkstat cookie */
+static int sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_UNKNOWN;
+static int sol_uverbs_minor_dev = -1;
+
+/*
+ * check_path() prefixs
+ */
+typedef enum cp_prefix_e {
+	CP_SOL_UVERBS		= 1,
+	CP_DEVICE		= 2,
+	CP_D			= 3,
+	CP_GIDS			= 4,
+	CP_PKEYS		= 5,
+	CP_MTHCA		= 6,
+	CP_MLX4			= 7,
+	CP_PORTS		= 8,
+	CP_UMAD			= 9,
+	CP_SLASH		= 10,
+	CP_SYS			= 11,
+	CP_CLASS		= 12,
+	CP_INFINIBAND_VERBS	= 13,
+	CP_INFINIBAND		= 14,
+	CP_INFINIBAND_MAD	= 15,
+	CP_MISC			= 16,
+	CP_RDMA_CM		= 17
+} cp_prefix_t;
+
+/*
+ * Some temporary cache code, until things are cleaned up as part of DR
+ * work. This will speed up the sysfs emulation.
+ */
+typedef struct ibdev_cache_info_s {
+	uint_t		ibd_valid;
+	uint_t		ibd_hw_rev;
+	char		ibd_node_guid_str[20];
+	char		ibd_sys_image_guid[20];
+	char		ibd_fw_ver[16];
+	char		ibd_name[8];
+	int		ibd_boardid_index;
+} ibdev_cache_info_t;
+
+/* tavor and hermon - hence 2 */
+static ibdev_cache_info_t ibdev_cache[2][MAX_HCAS];
+
+typedef struct uverbs_cache_info_s {
+	uint_t		uvc_valid;
+	uint_t		uvc_ibdev_abi_version;
+	uint_t		uvc_vendor_id;
+	uint_t		uvc_device_id;
+	int		uvc_hca_instance;
+	char		uvc_ibdev_name[8];
+	char		uvc_ibdev_hca_path[MAXPATHLEN];
+} uverbs_cache_info_t;
+static uverbs_cache_info_t	uverbs_dev_cache[MAX_HCAS];
+static int			uverbs_abi_version = -1;
+
+typedef struct umad_cache_info_s {
+	uint_t		umc_valid;
+	int		umc_port;
+	char		umc_ib_dev[16];
+} umad_cache_info_t;
+static umad_cache_info_t	umad_dev_cache[MAX_HCAS * MAX_HCA_PORTS];
+static int			umad_abi_version = -1;
+
+/*
+ * Structure to hold the part number  & PSID for an HCA card
+ * This is a sub-set of the file :
+ * /ws/onnv-clone/usr/src/cmd/fwflash/plugins/hdrs/MELLANOX.h
+ */
+typedef struct mlx_mdr_s {
+	char *mlx_pn;
+	char *mlx_psid;
+} mlx_mdr_t;
+
+/*
+ * Magic decoder ring for matching HCA hardware/firmware.
+ * Part Number / PSID / String ID
+ */
+mlx_mdr_t mlx_mdr[] = {
+	/* For failure case, use unknown as "board-id" */
+	{ "unknown",		"unknown"	},
+
+	/* Part No		PSID		*/
+	{ "375-3605-01",	"SUN0160000001" },
+	{ "375-3382-01",	"SUN0030000001" },
+	{ "375-3481-01",	"SUN0040000001" },
+	{ "375-3418-01",	"SUN0040000001" },
+	{ "375-3259-01",	"SUN0010000001" },
+	{ "375-3259-03",	"SUN0010000001" },
+	{ "X1289A-Z",		"SUN0010010001" },
+	{ "375-3548-01",	"SUN0060000001" },
+	{ "375-3549-01",	"SUN0070000001" },
+	{ "375-3549-01",	"SUN0070130001" },
+	{ "375-3481-01",	"SUN0050000001" },
+	{ "375-3439-01",	"SUN0051000001" },
+	{ "375-3260-03",	"SUN0020000001" },
+	{ "375-3605-01",	"SUN0160000002" },
+	{ "375-3697-01",	"SUN0160000002" },
+	{ "375-3606-01",	"SUN0150000001" },
+	{ "375-3606-02",	"SUN0150000009" },
+	{ "375-3606-03",	"SUN0150000009" },
+	{ "375-3606-02",	"SUN0170000009" },
+	{ "375-3696-01",	"SUN0170000009" },
+	{ "375-3551-05",	"SUN0080000001" },
+	{ "MHEA28-XS",		"MT_0250000001" },
+	{ "MHEA28-XSC",		"MT_0390110001" },
+	{ "MHEA28-XT",		"MT_0150000001" },
+	{ "MHEA28-XTC",		"MT_0370110001" },
+	{ "MHGA28-XT",		"MT_0150000002" },
+	{ "MHGA28-XTC",		"MT_0370110002" },
+	{ "MHGA28-XTC",		"MT_0370130002" },
+	{ "MHGA28-XS",		"MT_0250000002" },
+	{ "MHGA28-XSC",		"MT_0390110002" },
+	{ "MHGA28-XSC",		"MT_0390130002" },
+	{ "MHEL-CF128",		"MT_0190000001" },
+	{ "MHEL-CF128-T",	"MT_00A0000001" },
+	{ "MTLP25208-CF128T",	"MT_00A0000001" },
+	{ "MHEL-CF128-TC",	"MT_00A0010001" },
+	{ "MHEL-CF128-TC",	"MT_0140010001" },
+	{ "MHEL-CF128-SC",	"MT_0190010001" },
+	{ "MHEA28-1TC",		"MT_02F0110001" },
+	{ "MHEA28-1SC",		"MT_0330110001" },
+	{ "MHGA28-1T",		"MT_0200000001" },
+	{ "MHGA28-1TC",		"MT_02F0110002" },
+	{ "MHGA28-1SC",		"MT_0330110002" },
+	{ "MHGA28-1S",		"MT_0430000001" },
+	{ "MHEL-CF256-T",	"MT_00B0000001" },
+	{ "MTLP25208-CF256T",	"MT_00B0000001" },
+	{ "MHEL-CF256-TC",	"MT_00B0010001" },
+	{ "MHEA28-2TC",		"MT_0300110001" },
+	{ "MHEA28-2SC",		"MT_0340110001" },
+	{ "MHGA28-2T",		"MT_0210000001" },
+	{ "MHGA28-2TC",		"MT_0300110002" },
+	{ "MHGA28-2SC",		"MT_0340110002" },
+	{ "MHEL-CF512-T",	"MT_00C0000001" },
+	{ "MTLP25208-CF512T",	"MT_00C0000001" },
+	{ "MHGA28-5T",		"MT_0220000001" },
+	{ "MHES14-XSC",		"MT_0410110001" },
+	{ "MHES14-XT",		"MT_01F0000001" },
+	{ "MHES14-XTC",		"MT_03F0110001" },
+	{ "MHES18-XS",		"MT_0260000001" },
+	{ "MHES18-XS",		"MT_0260010001" },
+	{ "MHES18-XSC",		"MT_03D0110001" },
+	{ "MHES18-XSC",		"MT_03D0120001" },
+	{ "MHES18-XSC",		"MT_03D0130001" },
+	{ "MHES18-XT",		"MT_0230000002" },
+	{ "MHES18-XT",		"MT_0230010002" },
+	{ "MHES18-XTC",		"MT_03B0110001" },
+	{ "MHES18-XTC",		"MT_03B0120001" },
+	{ "MHES18-XTC",		"MT_03B0140001" },
+	{ "MHGS18-XS",		"MT_0260000002" },
+	{ "MHGS18-XSC",		"MT_03D0110002" },
+	{ "MHGS18-XSC",		"MT_03D0120002" },
+	{ "MHGS18-XSC",		"MT_03D0130002" },
+	{ "MHGS18-XT",		"MT_0230000001" },
+	{ "MHGS18-XTC",		"MT_03B0110002" },
+	{ "MHGS18-XTC",		"MT_03B0120002" },
+	{ "MHGS18-XTC",		"MT_03B0140002" },
+	{ "MHXL-CF128",		"MT_0180000001" },
+	{ "MHXL-CF128-T",	"MT_0030000001" },
+	{ "MTLP23108-CF128T",	"MT_0030000001" },
+	{ "MHET2X-1SC",		"MT_0280110001" },
+	{ "MHET2X-1SC",		"MT_0280120001" },
+	{ "MHET2X-1TC",		"MT_0270110001" },
+	{ "MHET2X-1TC",		"MT_0270120001" },
+	{ "MHXL-CF256-T",	"MT_0040000001" },
+	{ "MHET2X-2SC",		"MT_02D0110001" },
+	{ "MHET2X-2SC",		"MT_02D0120001" },
+	{ "MHET2X-2TC",		"MT_02B0110001" },
+	{ "MHET2X-2TC",		"MT_02B0120001" },
+	{ "MHX-CE128-T",	"MT_0000000001" },
+	{ "MTPB23108-CE128",	"MT_0000000001" },
+	{ "MHX-CE256-T",	"MT_0010000001" },
+	{ "MTPB23108-CE256",	"MT_0010000001" },
+	{ "MHX-CE512-T",	"MT_0050000001" },
+	{ "MTPB23108-CE512",	"MT_0050000001" },
+	{ "MHEH28-XSC",		"MT_04C0110001" },
+	{ "MHEH28-XSC",		"MT_04C0130005" },
+	{ "MHEH28-XTC",		"MT_04A0110001" },
+	{ "MHEH28-XTC",		"MT_04A0130005" },
+	{ "MHGH28-XSC",		"MT_04C0110002" },
+	{ "MHGH28-XSC",		"MT_04C0120002" },
+	{ "MHGH28-XSC",		"MT_04C0140005" },
+	{ "MHGH28-XTC",		"MT_04A0110002" },
+	{ "MHGH28-XTC",		"MT_04A0120002" },
+	{ "MHGH28-XTC",		"MT_04A0140005" },
+	{ "MHGH29-XSC",		"MT_0A60110002" },
+	{ "MHGH29-XSC",		"MT_0A60120005" },
+	{ "MHGH29-XTC",		"MT_0A50110002" },
+	{ "MHGH29-XTC",		"MT_0A50120005" },
+	{ "MHJH29-XTC",		"MT_04E0110003" },
+	{ "MHJH29-XSC",		"MT_0500120005" },
+	{ "MHQH29-XTC",		"MT_04E0120005" },
+	{ "MHQH19-XTC",		"MT_0C40110009" },
+	{ "MHQH29-XTC",		"MT_0BB0110003" },
+	{ "MHQH29-XTC",		"MT_0BB0120003" },
+	{ "MHEH28B-XSR",	"MT_0D10110001" },
+	{ "MHEH28B-XTR",	"MT_0D20110001" },
+	{ "MHGH28B-XSR",	"MT_0D10110002" },
+	{ "MHGH28B-XTR",	"MT_0D20110002" },
+	{ "MHGH18B-XTR",	"MT_0D30110002" },
+	{ "MNEH28B-XSR",	"MT_0D40110004" },
+	{ "MNEH28B-XTR",	"MT_0D50110004" },
+	{ "MNEH29B-XSR",	"MT_0D40110010" },
+	{ "MNEH29B-XTR",	"MT_0D50110010" },
+	{ "MHGH29B-XSR",	"MT_0D10110008" },
+	{ "MHGH29B-XTR",	"MT_0D20110008" },
+	{ "MHJH29B-XSR",	"MT_0D10110009" },
+	{ "MHJH29B-XSR",	"MT_0D10120009" },
+	{ "MHJH29B-XTR",	"MT_0D20110009" },
+	{ "MHJH29B-XTR",	"MT_0D20120009" },
+	{ "MHGH19B-XSR",	"MT_0D60110008" },
+	{ "MHGH19B-XTR",	"MT_0D30110008" },
+	{ "MHJH19B-XTR",	"MT_0D30110009" },
+	{ "MHQH29B-XSR",	"MT_0D70110009" },
+	{ "MHQH29B-XTR",	"MT_0D80110009" },
+	{ "MHQH29B-XTR",	"MT_0D80120009" },
+	{ "MHQH29B-XTR",	"MT_0D80130009" },
+	{ "MHQH29B-XTR",	"MT_0E30110009" },
+	{ "MHRH29B-XSR",	"MT_0D70110008" },
+	{ "MHRH29B-XTR",	"MT_0D80110008" },
+	{ "MHQH19B-XTR",	"MT_0D90110009" },
+	{ "MHRH19B-XSR",	"MT_0E40110009" },
+	{ "MHRH19B-XTR",	"MT_0D90110008" },
+	{ "MNPH28C-XSR",	"MT_0DA0110004" },
+	{ "MNPH28C-XTR",	"MT_0DB0110004" },
+	{ "MNPH29C-XSR",	"MT_0DA0110010" },
+	{ "MNPH29C-XTR",	"MT_0DB0110010" },
+	{ "MNPH29C-XTR",	"MT_0DB0120010" },
+	{ "MNPH29C-XTR",	"MT_0DB0130010" },
+	{ "MNZH29-XSR",		"MT_0DC0110009" },
+	{ "MNZH29-XTR",		"MT_0DD0110009" },
+	{ "MNZH29-XTR",		"MT_0DD0120009" },
+	{ "MHQH19B-XNR",	"MT_0DF0110009" },
+	{ "MHQH19B-XNR",	"MT_0DF0120009" },
+	{ "MNQH19-XTR",		"MT_0D80110017" },
+	{ "MNQH19C-XTR",	"MT_0E20110017" },
+	{ "MHZH29B-XSR",	"MT_0E80110009" },
+	{ "MHZH29B-XTR",	"MT_0E90110009" },
+	{ "MHZH29B-XTR",	"MT_0E90110009" },
+	{ "MHQA19-XTR",		"MT_0EA0110009" },
+	{ "MHRA19-XTR",		"MT_0EB0110008" },
+	{ "MHQH29C-XTR",	"MT_0EF0110009" },
+	{ "MHQH29C-XSR",	"MT_0F00110009" },
+	{ "MHRH29C-XTR",	"MT_0F10110008" },
+	{ "MHRH29C-XSR",	"MT_0F20110008" },
+	{ "MHPH29D-XTR",	"MT_0F30110010" },
+	{ "MHPH29D-XSR",	"MT_0F40110010" },
+	{ "MNPA19-XTR",		"MT_0F60110010" },
+	{ "MNPA19-XSR",		"MT_0F70110010" },
+
+	/* Ethernet cards */
+	{ "MNEH28B-XTR",	"MT_0D50110004" },
+	{ "MNEH29B-XSR",	"MT_0D40110010" },
+	{ "MNEH29B-XTR",	"MT_0D50110010" },
+	{ "MNPH28C-XSR",	"MT_0DA0110004" },
+	{ "MNPH28C-XTR",	"MT_0DB0110004" },
+	{ "MNPH29C-XSR",	"MT_0DA0110010" },
+	{ "MNPH29C-XTR",	"MT_0DB0110010" },
+	{ "X6275 M2 10GbE",	"X6275M2_10G"   }
+};
+
+/* Get mlx_mdr[] array size */
+#define	MLX_SZ_MLX_MDR		sizeof (mlx_mdr)
+#define	MLX_SZ_MLX_MDR_STRUCT	sizeof (mlx_mdr[0])
+#define	MLX_MAX_ID		(MLX_SZ_MLX_MDR / MLX_SZ_MLX_MDR_STRUCT)
+
+pthread_once_t		oneTimeInit = PTHREAD_ONCE_INIT;
+static int 		umad_cache_cnt = 0;
+static int 		ibdev_cache_cnt = 0;
+static int 		uverbs_cache_cnt = 0;
+static boolean_t	initialized = B_FALSE;
+static boolean_t	umad_cache_initialized = B_FALSE;
+static boolean_t	ibdev_cache_initialized = B_FALSE;
+static boolean_t	uverbs_cache_initialized = B_FALSE;
+static pthread_mutex_t	umad_cache_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t	ibdev_cache_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t	uverbs_cache_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+void __attribute__((constructor))solaris_init(void);
+void __attribute__((destructor))solaris_fini(void);
+
+void
+solaris_init(void)
+{
+	while ((kc = kstat_open()) == NULL) {
+		if (errno == EAGAIN)
+			(void) poll(NULL, 0, 200);
+		else
+			fprintf(stderr, "cannot open /dev/kstat: %s\n",
+			    strerror(errno));
+	}
+}
+
+void
+solaris_fini(void)
+{
+	(void) kstat_close(kc);
+}
+
+static int
+umad_cache_add(uint_t dev_num, int port, char *ibdev)
+{
+	if ((dev_num >= (MAX_HCAS  * MAX_HCA_PORTS)) ||
+	    (umad_cache_cnt >= (MAX_HCAS  * MAX_HCA_PORTS))) {
+		fprintf(stderr, "dev %d: exceeds umad cache size\n", dev_num);
+		return (1);
+	}
+
+	umad_dev_cache[dev_num].umc_port = port;
+	strcpy(umad_dev_cache[dev_num].umc_ib_dev, ibdev);
+	umad_dev_cache[dev_num].umc_valid = 1;
+	umad_cache_cnt++;
+	return (0);
+}
+
+static int
+ibdev_cache_add(uint_t dev_num, ibdev_cache_info_t *info_p)
+{
+	if ((dev_num >= MAX_HCAS) || (ibdev_cache_cnt >= (MAX_HCAS * 2))) {
+		fprintf(stderr, "dev %d: exceeds hca cache size\n", dev_num);
+		return (1);
+	}
+
+	if (!(strncmp(info_p->ibd_name, "mlx4", 4))) {
+		memcpy(&(ibdev_cache[MLX4][dev_num]), info_p,
+		    sizeof (ibdev_cache_info_t));
+		ibdev_cache[MLX4][dev_num].ibd_valid = 1;
+	} else {
+		memcpy(&(ibdev_cache[MTHCA][dev_num]), info_p,
+		    sizeof (ibdev_cache_info_t));
+		ibdev_cache[MTHCA][dev_num].ibd_valid = 1;
+	}
+
+	ibdev_cache_cnt++;
+	return (0);
+}
+
+static int
+uverbs_cache_add(uint_t dev_num, uverbs_cache_info_t *info_p)
+{
+	if ((dev_num >= MAX_HCAS) || (uverbs_cache_cnt >= MAX_HCAS)) {
+		fprintf(stderr, "dev %d: exceeds uverbs cache size\n", dev_num);
+		return (1);
+	}
+
+	memcpy(&(uverbs_dev_cache[dev_num]), info_p,
+	    sizeof (uverbs_cache_info_t));
+
+	uverbs_dev_cache[dev_num].uvc_valid = 1;
+	uverbs_cache_cnt++;
+	return (0);
+}
+
+static int
+ibdev_cache_init()
+{
+	ibdev_cache_info_t	info;
+	struct ibv_device	**root_dev_list, **dev_list = NULL;
+	struct ibv_context	*ctx = NULL;
+	struct ibv_device_attr	device_attr;
+	int			i, num_dev, dev_num, ret = 1;
+	uint64_t		guid;
+	const char		*p, *ibdev;
+
+
+	root_dev_list = dev_list = ibv_get_device_list(&num_dev);
+	if (!dev_list) {
+		fprintf(stderr, "No HCA devices found");
+		goto error_exit1;
+	}
+
+	for (i = 0; i < num_dev; i++, dev_list++) {
+
+		if (!(ctx = ibv_open_device(*dev_list))) {
+			fprintf(stderr, "failed to open device %p\n",
+			    *dev_list);
+			goto error_exit2;
+		}
+
+		if (ibv_query_device(ctx, &device_attr)) {
+			fprintf(stderr, "failed to query device %p\n", ctx);
+			goto error_exit3;
+		}
+
+		guid = ntohll(device_attr.node_guid);
+		sprintf(info.ibd_node_guid_str, "%04x:%04x:%04x:%04x",
+		    (unsigned)(guid >> 48) & 0xffff,
+		    (unsigned)(guid >> 32) & 0xffff,
+		    (unsigned)(guid >> 16) & 0xffff,
+		    (unsigned)(guid >>  0) & 0xffff);
+
+		guid = ntohll(device_attr.sys_image_guid);
+		sprintf(info.ibd_sys_image_guid, "%04x:%04x:%04x:%04x",
+		    (unsigned)(guid >> 48) & 0xffff,
+		    (unsigned)(guid >> 32) & 0xffff,
+		    (unsigned)(guid >> 16) & 0xffff,
+		    (unsigned)(guid >>  0) & 0xffff);
+
+		(void) strcpy(info.ibd_fw_ver, device_attr.fw_ver);
+		info.ibd_hw_rev = device_attr.hw_ver;
+
+		ibdev = ibv_get_device_name(*dev_list);
+		p = ibdev + (strlen(ibdev)-1);
+		dev_num = atoi(p);
+		(void) strcpy(info.ibd_name, ibdev);
+
+		info.ibd_boardid_index = -1;
+
+		if (ibdev_cache_add(dev_num, &info)) {
+			fprintf(stderr, "failed to add dev %d to ibdev cache\n",
+			    dev_num);
+			goto error_exit3;
+		}
+	}
+
+	ret = 0;
+
+	/* clean up and Return */
+error_exit3:
+	if (ctx)
+		ibv_close_device(ctx);
+error_exit2:
+	if (root_dev_list)
+		ibv_free_device_list(root_dev_list);
+error_exit1:
+	return (ret);
+}
+
+static int
+uverbs_cache_init()
+{
+	uverbs_cache_info_t	info;
+	int			dev_num, fd, i, bufsize, hca_cnt;
+	char			uverbs_devpath[MAXPATHLEN];
+	sol_uverbs_info_t	*uverbs_infop;
+	sol_uverbs_hca_info_t	*hca_infop;
+	char *buf;
+
+	snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s%d",
+	    IB_OFS_DEVPATH_PREFIX, UVERBS_KERNEL_SYSFS_NAME_BASE,
+		    sol_uverbs_minor_dev);
+
+	/*
+	 * using the first sol_uverbs minor node that can be opened to get
+	 * all the HCA information
+	 */
+	if ((fd = open(uverbs_devpath, O_RDWR)) < 0) {
+		fprintf(stderr, "sol_uverbs failed to open: %s\n",
+		    strerror(errno));
+		goto error_exit1;
+	}
+	
+	bufsize = sizeof(sol_uverbs_info_t) + sizeof(sol_uverbs_hca_info_t) *
+	    MAX_HCAS;
+ 
+	buf = malloc(bufsize);
+	memset(buf, 0, bufsize);
+	uverbs_infop = (sol_uverbs_info_t *)buf;
+	uverbs_infop->uverbs_hca_cnt = MAX_HCAS;
+
+	if (ioctl(fd, UVERBS_IOCTL_GET_HCA_INFO, uverbs_infop) != 0) {
+		fprintf(stderr, "sol_uverbs ioctl failed: %s\n",
+		    strerror(errno));
+		
+		goto error_exit2;
+	}
+
+	if (uverbs_infop->uverbs_solaris_abi_version !=
+	    IB_USER_VERBS_SOLARIS_ABI_VERSION) {
+		fprintf(stderr, "sol_uverbs solaris_abi_version !="
+		    "IB_USER_VERBS_SOLARIS_ABI_VERSION : %d\n",
+		    uverbs_infop->uverbs_solaris_abi_version);
+		goto error_exit2;
+	}
+
+	hca_cnt = uverbs_infop->uverbs_hca_cnt;	/* hca count returned */
+	hca_infop = uverbs_infop->uverbs_hca_info;
+
+	if (uverbs_abi_version == -1)
+		uverbs_abi_version = uverbs_infop->uverbs_abi_version;
+
+	for (i = 0; i < hca_cnt; i++, hca_infop++) {
+		info.uvc_vendor_id = hca_infop->uverbs_hca_vendorid;
+		info.uvc_device_id = hca_infop->uverbs_hca_deviceid;
+		info.uvc_hca_instance =
+		    hca_infop->uverbs_hca_driver_instance;
+
+		snprintf(info.uvc_ibdev_hca_path, sizeof (info.uvc_ibdev_hca_path),
+		    "%s/%s%d", IB_HCA_DEVPATH_PREFIX,
+		    hca_infop->uverbs_hca_driver_name,
+		    hca_infop->uverbs_hca_driver_instance);
+
+		if (! strncmp(hca_infop->uverbs_hca_ibdev_name, "mlx4_", 5))
+			info.uvc_ibdev_abi_version =
+			    MLX4_UVERBS_MAX_ABI_VERSION;
+		else
+			info.uvc_ibdev_abi_version = MTHCA_UVERBS_ABI_VERSION;
+
+		strcpy(info.uvc_ibdev_name, hca_infop->uverbs_hca_ibdev_name);
+
+		dev_num = hca_infop->uverbs_hca_devidx;
+		if (uverbs_cache_add(dev_num, &info)) {
+			fprintf(stderr, "failed to add dev %d to uverbs "
+			    "cache\n", dev_num);
+			goto error_exit2;
+		}
+	}
+
+	free(buf);
+	close(fd);
+	return (1);
+
+error_exit2:
+	free(buf);
+	close(fd);
+
+error_exit1:
+	return(0);
+}
+
+static int
+umad_cache_init()
+{
+	int				i, fd, minor;
+	int				save_errno = 0;
+	int				port_cnt, bufsize;
+	char				umad_devpath[MAXPATHLEN], *buf;
+	sol_umad_ioctl_info_t		*umad_infop;
+	sol_umad_ioctl_port_info_t	*port_infop;
+
+	for (minor = 0; minor < MAX_HCAS * MAX_HCA_PORTS; minor++) {
+		snprintf(umad_devpath, MAXPATHLEN, "%s/%s%d",
+		    IB_OFS_DEVPATH_PREFIX, UMAD_KERNEL_SYSFS_NAME_BASE,
+		    minor);
+
+		if ((fd = open(umad_devpath, O_RDWR)) > 0)
+			break;
+
+		if ((! save_errno) && (errno != ENOENT))
+			save_errno = errno;
+	}
+
+	if ((minor == MAX_HCAS * MAX_HCA_PORTS) && (fd < 0)) {
+		if (! save_errno)
+			save_errno = errno;
+		fprintf(stderr, "failed to open sol_umad: %s\n",
+		    strerror(save_errno));
+		return (0);
+	}
+
+	bufsize = sizeof(sol_umad_ioctl_info_t) +
+	    (sizeof(sol_umad_ioctl_port_info_t) * MAX_HCAS * MAX_HCA_PORTS);
+ 
+	buf = malloc(bufsize);
+	memset(buf, 0, bufsize);
+	umad_infop = (sol_umad_ioctl_info_t *)buf;
+	umad_infop->umad_port_cnt = MAX_HCAS * MAX_HCA_PORTS;
+
+	if (ioctl(fd, IB_USER_MAD_GET_PORT_INFO, umad_infop) != 0) {
+		fprintf(stderr, "sol_umad ioctl failed: %s\n",
+		    strerror(errno));
+		
+		goto error_exit;
+	}
+
+	if (umad_infop->umad_solaris_abi_version !=
+	    IB_USER_MAD_SOLARIS_ABI_VERSION) {
+		fprintf(stderr, "sol_umad solaris_abi_version !="
+		    "IB_USER_MAD_SOLARIS_ABI_VERSION : %d\n",
+		    umad_infop->umad_solaris_abi_version);
+		goto error_exit;
+	}
+
+	/*
+	 * set port_cnt to the number of total ports for all HCAs returned
+	 */
+	port_cnt = umad_infop->umad_port_cnt;
+	port_infop = umad_infop->umad_port_info;
+
+	if (umad_abi_version == -1)
+		umad_abi_version = umad_infop->umad_abi_version;
+
+	for (i = 0; i < port_cnt; i++, port_infop++) {
+		if (umad_cache_add(port_infop->umad_port_idx,
+		    port_infop->umad_port_num,
+		    port_infop->umad_port_ibdev_name)) {
+			fprintf(stderr, "failed to add dev %d to umad cache",
+			    port_infop->umad_port_idx);
+			goto error_exit;
+		}
+	}
+
+	free(buf);
+	close(fd);
+	return (1);
+
+error_exit:
+	free(buf);
+	close(fd);
+	return (0);
+}
+
+void
+initialize(void)
+{
+	int		fd, minor;
+	char		uverbs_devpath[MAXPATHLEN];
+
+	/*
+	 * find the first sol_uverbs minor node that can be opened successfully
+	 * and set sol_uverbs_mino_dev to that minor no.
+	 */
+	for (minor = 0; minor < MAX_HCAS; minor++) {
+		snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s%d",
+		    IB_OFS_DEVPATH_PREFIX, UVERBS_KERNEL_SYSFS_NAME_BASE,
+		    minor);
+
+		if ((fd = open(uverbs_devpath, O_RDWR)) < 0) {
+			continue;
+		} else {
+			sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_LOADED;
+			sol_uverbs_minor_dev = minor;
+			close(fd);
+			break;
+		}
+	}
+
+	/*
+	 * All minor nodes failed to open, so set sol_uverbs_drv_status to
+	 * SOL_UVERBS_DRV_STATUS_UNLOADED to reflect that
+	 */
+	if (minor == MAX_HCAS && sol_uverbs_minor_dev == -1) {
+		sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_UNLOADED;
+		return;
+	}
+
+	memset(&uverbs_dev_cache, 0, (sizeof (uverbs_cache_info_t) * MAX_HCAS));
+	memset(&ibdev_cache, 0, (sizeof (ibdev_cache_info_t) * MAX_HCAS * 2));
+	memset(&umad_dev_cache, 0,
+	    (sizeof (umad_cache_info_t) * MAX_HCAS * MAX_HCA_PORTS));
+
+	initialized = B_TRUE;
+}
+
+/*
+ * Some sysfs emulation software
+ */
+
+
+/*
+ * Check whether a path starts with prefix, and if it does, remove it
+ * from the string. The prefix can also contain one %d scan argument.
+ */
+static int
+check_path(char *path, cp_prefix_t prefix, unsigned int *arg)
+{
+	int	ret, pos = 0;
+
+	switch (prefix) {
+		case CP_SOL_UVERBS:
+			ret = sscanf(path, "uverbs%d%n/", arg,
+			    &pos);
+			break;
+		case CP_DEVICE:
+			ret = sscanf(path, "device%n/", &pos);
+			break;
+		case CP_D:
+			ret = sscanf(path, "%d%n/", arg, &pos);
+			break;
+		case CP_GIDS:
+			ret = sscanf(path, "gids%n/", &pos);
+			break;
+		case CP_PKEYS:
+			ret = sscanf(path, "pkeys%n/", &pos);
+			break;
+		case CP_MTHCA:
+			ret = sscanf(path, "mthca%d%n/", arg, &pos);
+			break;
+		case CP_MLX4:
+			ret = sscanf(path, "mlx4_%d%n/", arg, &pos);
+			break;
+		case CP_PORTS:
+			ret = sscanf(path, "ports%n/", &pos);
+			break;
+		case CP_UMAD:
+			ret = sscanf(path, "umad%d%n/", arg, &pos);
+			break;
+		case CP_SLASH:
+			ret = sscanf(path, "%n/", &pos);
+			break;
+		case CP_SYS:
+			ret = sscanf(path, "sys%n/", &pos);
+			break;
+		case CP_CLASS:
+			ret = sscanf(path, "class%n/", &pos);
+			break;
+		case CP_INFINIBAND_VERBS:
+			ret = sscanf(path, "infiniband_verbs%n/", &pos);
+			break;
+		case CP_INFINIBAND:
+			ret = sscanf(path, "infiniband%n/", &pos);
+			break;
+		case CP_INFINIBAND_MAD:
+			ret = sscanf(path, "infiniband_mad%n/", &pos);
+			break;
+		case CP_MISC:
+			ret = sscanf(path, "misc%n/", &pos);
+			break;
+		case CP_RDMA_CM:
+			ret = sscanf(path, "rdma_cm%n/", &pos);
+			break;
+		default:
+			/* Unkown prefix */
+			return (0);
+	}
+
+	if (path[pos] == '/') {
+		/* Some requests have several consecutive slashes. */
+		while (path[pos] == '/')
+			pos ++;
+
+		memmove(path, &path[pos], strlen(path)-pos+1);
+		return (1);
+	}
+
+	return (0);
+}
+
+static ibdev_cache_info_t *
+get_device_info(const char *devname)
+{
+	ibdev_cache_info_t 	*info;
+	const char		*p = devname;
+	int			dev_num;
+
+	if (pthread_mutex_lock(&ibdev_cache_mutex) != 0) {
+		fprintf(stderr, "failed: to acquire ibdev_cache_mutex %s\n",
+		    strerror(errno));
+		return (NULL);
+	}
+
+	if (!ibdev_cache_initialized) {
+		if (ibdev_cache_init()) {
+			(void) pthread_mutex_unlock(&ibdev_cache_mutex);
+			fprintf(stderr, "failed to init ibdev_cache\n");
+			return (NULL);
+		} else {
+			ibdev_cache_initialized = B_TRUE;
+		}
+	}
+	(void) pthread_mutex_unlock(&ibdev_cache_mutex);
+
+	p = p+(strlen(p)-1);
+	dev_num = atoi(p);
+
+	if (dev_num >= MAX_HCAS) {
+		fprintf(stderr, "Invalid device %s\n", devname);
+		return (NULL);
+	}
+
+	if (strncmp(devname, "mlx4", 4) == 0) {
+		if (ibdev_cache[MLX4][dev_num].ibd_valid)
+			info = &(ibdev_cache[MLX4][dev_num]);
+		else
+			info = NULL;
+	} else {
+		if (ibdev_cache[MTHCA][dev_num].ibd_valid)
+			info = &(ibdev_cache[MTHCA][dev_num]);
+		else
+			info = NULL;
+	}
+
+	return (info);
+}
+
+/*
+ * Get the IB user verbs port info attributes for the specified device/port.
+ * If the address of a gid pointer is passed for "gid_table", the memory
+ * will be allocated and the ports gid table and returned as well. The caller
+ * must free this memory on successful completion.  If the address of a
+ * pkey pointer is passed for "pkey_table", the memory will be allocated
+ * and the ports pkey table returned as well.  The caller must free this
+ * memory on successful completion.
+ */
+static int
+get_port_info(const char *devname, uint8_t port_num,
+    struct ibv_port_attr *port_attr, union ibv_gid **gid_table,
+    uint16_t **pkey_table)
+{
+	struct ibv_device 	**root_dev_list, **dev_list = NULL;
+	struct ibv_context 	*ctx = NULL;
+	union ibv_gid 		*gids = NULL;
+	uint16_t		*pkeys = NULL;
+	int 			i, num_dev, rv, ret = 1;
+
+	root_dev_list = dev_list = ibv_get_device_list(&num_dev);
+	if (!dev_list) {
+		fprintf(stderr, "No HCA devices found\n");
+		goto error_exit1;
+	}
+
+	for (i = 0; i < num_dev; i++, dev_list++) {
+		if (strcmp(ibv_get_device_name(*dev_list), devname) == 0) {
+			break;
+		}
+	}
+
+	if (i == num_dev) {
+		fprintf(stderr, "failed to find %s\n", devname);
+		goto error_exit2;
+	}
+
+	if (!(ctx = ibv_open_device(*dev_list))) {
+		fprintf(stderr, "failed to open device %p\n", *dev_list);
+		goto error_exit2;
+	}
+
+	if (ibv_query_port(ctx, port_num, port_attr)) {
+		fprintf(stderr, "failed to query dev %p, port %d\n",
+		    ctx, port_num);
+		goto error_exit3;
+	}
+
+	if (gid_table) {
+		*gid_table = NULL;
+		gids = malloc(sizeof (union ibv_gid) * port_attr->gid_tbl_len);
+		if (!gids)
+			goto error_exit3;
+		/*
+		 * set high bit of port_num, and try get all gids in one go.
+		 */
+		port_num |= 0x80;
+		rv = ibv_query_gid(ctx, port_num, port_attr->gid_tbl_len, gids);
+
+		if (rv != 0) {
+			/*
+			 * Quering all gids didn't work try one at a time.
+			 */
+			port_num &= 0x7f;
+
+			for (i = 0; i < port_attr->gid_tbl_len; i++) {
+				if (ibv_query_gid(ctx, port_num, i, &gids[i]))
+					goto error_exit4;
+			}
+		}
+		*gid_table = gids;
+		gids = NULL;
+	}
+
+	if (pkey_table) {
+		*pkey_table = NULL;
+		pkeys = malloc(sizeof (uint16_t) * port_attr->pkey_tbl_len);
+		if (!pkeys)
+			goto error_exit4;
+
+		port_num |= 0x80;
+
+		rv = ibv_query_pkey(ctx, port_num, port_attr->pkey_tbl_len,
+		    pkeys);
+
+		if (rv != 0) {
+			/*
+			 * Quering all gids didn't work try one at a time.
+			 */
+			port_num &= 0x7f;
+
+			for (i = 0; i < port_attr->pkey_tbl_len; i++) {
+				if (ibv_query_pkey(ctx, port_num, i, &pkeys[i]))
+					goto error_exit5;
+			}
+		}
+		*pkey_table = pkeys;
+		pkeys = NULL;
+	}
+
+	ret = 0;
+
+	/*
+	 * clean up and Return
+	 */
+error_exit5:
+	if (pkeys)
+		free(pkeys);
+error_exit4:
+	if (gids)
+		free(gids);
+error_exit3:
+	if (ctx)
+		ibv_close_device(ctx);
+error_exit2:
+	if (root_dev_list)
+		ibv_free_device_list(root_dev_list);
+error_exit1:
+	return (ret);
+}
+
+/*
+ * In Solaris environments, the underlying hardware driver is opened to
+ * perform the memory mapping operations of kernel allocated memory
+ * into the users address space.
+ */
+int
+ibv_open_mmap_driver(char *dev_name)
+{
+	int			fd;
+#ifndef _LP64
+	int			tmpfd;
+#endif
+	int			uverbs_indx;
+
+	/*
+	 * Map the user verbs device (uverbs) to the associated 
+	 * hca device. 
+	 */
+	uverbs_indx = strtol(dev_name + strlen(UVERBS_KERNEL_SYSFS_NAME_BASE),
+	    NULL, 0);
+	if (uverbs_indx >= MAX_HCAS) {
+		fprintf(stderr, "Invalid device %s\n", dev_name);
+		goto err_dev;
+	}
+
+	if (!uverbs_dev_cache[uverbs_indx].uvc_valid) {
+		fprintf(stderr, "Invalid Device %s\n", dev_name);
+		goto err_dev;
+	}
+
+	fd = open(uverbs_dev_cache[uverbs_indx].uvc_ibdev_hca_path, O_RDWR);
+	if (fd < 0) {
+		goto err_dev;
+	}
+
+#ifndef _LP64
+	/*
+	 * libc can't handle fd's greater than 255,  in order to
+	 * ensure that these values remain available make fd > 255.
+	 * Note: not needed for LP64
+	 */
+	tmpfd = fcntl(fd, F_DUPFD, 256);
+	if (tmpfd >=  0) {
+		(void) close(fd);
+		fd = tmpfd;
+	}
+#endif  /* _LP64 */
+
+	if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+		fprintf(stderr, "FD_CLOEXEC failed: %s\n", strerror(errno));
+		goto err_close;
+	}
+	return (fd);
+
+err_close:
+	close(fd);
+err_dev:
+	return (-1);
+}
+
+static int
+infiniband_verbs(char *path, char *buf, size_t size)
+{
+	unsigned int		device_num;
+	int 			len = -1;
+	uverbs_cache_info_t	*info_p;
+
+	if (pthread_mutex_lock(&uverbs_cache_mutex) != 0) {
+		fprintf(stderr, "failed: to acquire uverbs_cache_mutex %s\n",
+		    strerror(errno));
+		goto exit;
+	}
+
+	if (!uverbs_cache_initialized) {
+		if (uverbs_cache_init())
+			uverbs_cache_initialized = B_TRUE;
+		else
+			goto exit;
+	}
+	(void) pthread_mutex_unlock(&uverbs_cache_mutex);
+
+	if (check_path(path, CP_SOL_UVERBS, &device_num)) {
+
+		if (device_num >= MAX_HCAS) {
+			fprintf(stderr, "Invalid path%s\n", path);
+			goto exit;
+		}
+
+		if (!uverbs_dev_cache[device_num].uvc_valid) {
+			goto exit;
+		}
+
+		info_p = &uverbs_dev_cache[device_num];
+
+		if (check_path(path, CP_DEVICE, NULL)) {
+			/*
+			 * Under Linux, this is a link to the PCI device entry
+			 * in /sys/devices/pci...../....
+			 */
+			if (strcmp(path, "vendor") == 0) {
+				len = 1 + sprintf(buf, "0x%x",
+				    info_p->uvc_vendor_id);
+			} else if (strcmp(path, "device") == 0) {
+				len = 1 + sprintf(buf, "0x%x",
+				    info_p->uvc_device_id);
+			}
+		} else if (strcmp(path, "ibdev") == 0) {
+			len = 1 + sprintf(buf, "%s",
+			    info_p->uvc_ibdev_name);
+		} else if (strcmp(path, "abi_version") == 0) {
+			len = 1 + sprintf(buf, "%d",
+			    info_p->uvc_ibdev_abi_version);
+		}
+	} else if (strcmp(path, "abi_version") == 0) {
+
+		if (uverbs_abi_version == -1) {
+			fprintf(stderr, "UVerbs ABI Version invalid\n");
+
+			goto exit;
+		}
+
+		len = 1 + sprintf(buf, "%d", uverbs_abi_version); 
+	} else {
+		fprintf(stderr, "Unsupported read: %s\n", path);
+	}
+exit:
+	return (len);
+}
+
+static int
+infiniband_ports(char *path, char *buf, size_t size, char *dev_name)
+{
+	int 			len = -1;
+	unsigned int		port_num;
+	unsigned int		gid_num;
+	union ibv_gid		*gids;
+	uint64_t		subnet_prefix;
+	uint64_t		interface_id;
+	uint16_t		*pkeys;
+	unsigned int		pkey_num;
+	struct ibv_port_attr	port_attr;
+	float			rate;
+
+	if (!(check_path(path, CP_D, &port_num)))
+		goto exit;
+
+	if (check_path(path, CP_GIDS, NULL)) {
+		if (get_port_info(dev_name, port_num, &port_attr, &gids, NULL))
+				goto exit;
+
+		gid_num = atoi(path);
+
+		if (gid_num <  port_attr.gid_tbl_len) {
+
+			subnet_prefix =
+			    htonll(gids[gid_num].global.subnet_prefix);
+			interface_id =
+			    htonll(gids[gid_num].global.interface_id);
+			len = 1 + sprintf(buf,
+			    "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
+			    (unsigned)(subnet_prefix >>  48) & 0xffff,
+			    (unsigned)(subnet_prefix >>  32) & 0xffff,
+			    (unsigned)(subnet_prefix >>  16) & 0xffff,
+			    (unsigned)(subnet_prefix >>   0) & 0xffff,
+			    (unsigned)(interface_id  >>  48) & 0xffff,
+			    (unsigned)(interface_id  >>  32) & 0xffff,
+			    (unsigned)(interface_id  >>  16) & 0xffff,
+			    (unsigned)(interface_id  >>   0) & 0xffff);
+		}
+		if (gids)
+			free(gids);
+
+	} else if (check_path(path, CP_PKEYS, NULL)) {
+		if (get_port_info(dev_name, port_num, &port_attr, NULL, &pkeys))
+				goto exit;
+
+		pkey_num = atoi(path);
+		if (pkey_num <  port_attr.pkey_tbl_len)
+			len = 1 + sprintf(buf, "0x%04x", pkeys[pkey_num]);
+
+		if (pkeys)
+			free(pkeys);
+	} else {
+
+		if (get_port_info(dev_name, port_num, &port_attr, NULL, NULL))
+				goto exit;
+
+		if (strcmp(path, "lid_mask_count") == 0) {
+			len = 1 + sprintf(buf, "%d", port_attr.lmc);
+		} else if (strcmp(path, "sm_lid") == 0) {
+			len = 1 + sprintf(buf, "0x%x", port_attr.sm_lid);
+		} else if (strcmp(path, "sm_sl") == 0) {
+			len = 1 + sprintf(buf, "%d", port_attr.sm_sl);
+		} else if (strcmp(path, "lid") == 0) {
+			len = 1 + sprintf(buf, "0x%x", port_attr.lid);
+		} else if (strcmp(path, "state") == 0) {
+			switch (port_attr.state) {
+				case IBV_PORT_NOP:
+					len = 1 + sprintf(buf, "%d: NOP",
+					    port_attr.state);
+					break;
+				case IBV_PORT_DOWN:
+					len = 1 + sprintf(buf, "%d: DOWN",
+					    port_attr.state);
+					break;
+				case IBV_PORT_INIT:
+					len = 1 + sprintf(buf, "%d: INIT",
+					    port_attr.state);
+					break;
+				case IBV_PORT_ARMED:
+					len = 1 + sprintf(buf, "%d: ARMED",
+					    port_attr.state);
+					break;
+				case IBV_PORT_ACTIVE:
+					len = 1 + sprintf(buf, "%d: ACTIVE",
+					    port_attr.state);
+					break;
+				case IBV_PORT_ACTIVE_DEFER:
+					len = 1 + sprintf(buf,
+					    "%d: ACTIVE_DEFER",
+					    port_attr.state);
+					break;
+				default:
+					len = 1 + sprintf(buf, "%d: INVALID",
+					    port_attr.state);
+					break;
+			}
+		} else if (strcmp(path, "phys_state") == 0) {
+			switch (port_attr.phys_state) {
+				case 1:
+					len = 1 + sprintf(buf, "%d: Sleep",
+					    port_attr.phys_state);
+					break;
+				case 2:
+					len = 1 + sprintf(buf, "%d: Polling",
+					    port_attr.phys_state);
+					break;
+				case 3:
+					len = 1 + sprintf(buf, "%d: Disabled",
+					    port_attr.phys_state);
+					break;
+				case 4:
+					len = 1 + sprintf(buf,
+					    "%d: PortConfigurationTraining",
+					    port_attr.phys_state);
+					break;
+				case 5:
+					len = 1 + sprintf(buf, "%d: LinkUp",
+					    port_attr.phys_state);
+					break;
+				case 6:
+					len = 1 + sprintf(buf,
+					    "%d: LinkErrorRecovery",
+					    port_attr.phys_state);
+					break;
+				case 7:
+					len = 1 + sprintf(buf,
+					    "%d: Phy Test",
+					    port_attr.phys_state);
+					break;
+				default:
+					len = 1 + sprintf(buf, "%d: <unknown>",
+					    port_attr.phys_state);
+					break;
+			}
+		} else if (strcmp(path, "rate") == 0) {
+			/* rate = speed * width */
+			switch (port_attr.active_speed) {
+			case 1:
+				rate = 2.5;
+				break;
+			case 2:
+				rate = 5;
+				break;
+			case 4:
+				rate = 10;
+				break;
+			default:
+				rate = 0;
+			}
+			switch (port_attr.active_width) {
+			case 1:
+				break;
+			case 2:
+				rate = 4 * rate;
+				break;
+			case 4:
+				rate = 8 * rate;
+				break;
+			case 8:
+				rate = 12 * rate;
+				break;
+			default:
+				rate = 0;
+			}
+			len = 1 + sprintf(buf, "%f", rate);
+		} else if (strcmp(path, "cap_mask") == 0) {
+			len = 1 + sprintf(buf, "0x%08x",
+			    port_attr.port_cap_flags);
+		}
+	}
+exit:
+	return (len);
+}
+
+
+/*
+ * This function passes the HW Part number string obtained from driver
+ * IOCTL. The memory for "hca_hwpn" argument has to be passed by the
+ * caller and has to be at least 64 bytes in size.
+ */
+static int
+get_hca_hwpn_str(char *ibd_name, int fd, char *hca_hwpn)
+{
+	hermon_flash_init_ioctl_t	hermon_flash_info;
+	tavor_flash_init_ioctl_t	tavor_flash_info;
+	int				rc;
+
+	if (strncmp(ibd_name, "mthca", 5) == 0) {
+		if ((rc = ioctl(fd, TAVOR_IOCTL_FLASH_INIT,
+		    &tavor_flash_info)) != 0)
+			return (rc);
+		strncpy(hca_hwpn, tavor_flash_info.tf_hwpn, 64);
+	} else {
+		if ((rc = ioctl(fd, HERMON_IOCTL_FLASH_INIT,
+		    &hermon_flash_info)) != 0)
+			return (rc);
+		strncpy(hca_hwpn, hermon_flash_info.af_hwpn, 64);
+	}
+	return (0);
+}
+
+static void
+init_boardid_index(ibdev_cache_info_t *ibd_info)
+{
+	int	i;
+	int	fd;
+	char	hca_hwpn[64];
+	char	*hwpnp;
+
+
+	if (pthread_mutex_lock(&uverbs_cache_mutex) != 0) {
+		fprintf(stderr, "failed: to acquire "
+		    "uverbs_cache_mutex %s\n",
+		    strerror(errno));
+		goto boardid_err;
+	}
+	if (!uverbs_cache_initialized) {
+		uverbs_cache_init();
+		uverbs_cache_initialized = B_TRUE;
+	}
+	(void) pthread_mutex_unlock(&uverbs_cache_mutex);
+
+	for (i = 0; i < MAX_HCAS; i++) {
+		if (uverbs_dev_cache[i].uvc_valid &&
+		    strcmp(uverbs_dev_cache[i].uvc_ibdev_name,
+		    ibd_info->ibd_name) == 0) {
+			break;
+		}
+	}
+
+	if (i == MAX_HCAS) {
+		fprintf(stderr, "failed to find uverbs_dev for %s\n",
+		    ibd_info->ibd_name);
+		goto boardid_err;
+	}
+
+	fd = open(uverbs_dev_cache[i].uvc_ibdev_hca_path, O_RDWR);
+	if (fd < 0) {
+		goto boardid_err;
+	}
+
+	if (get_hca_hwpn_str(ibd_info->ibd_name, fd, hca_hwpn)) {
+		close(fd);
+		goto boardid_err;
+	}
+	close(fd);
+	if ((hwpnp = strchr(hca_hwpn, ' ')) != NULL)
+		*hwpnp = '\0';
+
+	/*
+	 * Find part number, set the boardid_index,
+	 * Skip index 0, as it is for failure "unknown"
+	 * case.
+	 */
+	for (i = 1; i < MLX_MAX_ID; i++) {
+		if (strcmp((const char *)hca_hwpn,
+		    mlx_mdr[i].mlx_pn) == 0) {
+
+			/* Set boardid_index */
+			ibd_info->ibd_boardid_index = i;
+			return;
+		}
+	}
+
+boardid_err:
+	/* Failure case, default to "unknown" */
+	ibd_info->ibd_boardid_index = 0;
+}
+
+static int
+infiniband(char *path, char *buf, size_t size)
+{
+	int			len = -1;
+	unsigned int		device_num;
+	char			dev_name[10];
+	ibdev_cache_info_t	*info;
+
+	memset(dev_name, 0, 10);
+
+	if (check_path(path, CP_MTHCA, &device_num)) {
+		sprintf(dev_name, "mthca%d", device_num);
+	} else if (check_path(path, CP_MLX4, &device_num)) {
+		sprintf(dev_name, "mlx4_%d", device_num);
+	} else {
+		goto exit;
+	}
+
+	if (check_path(path, CP_PORTS, NULL)) {
+		len = infiniband_ports(path, buf, size, dev_name);
+	} else if (strcmp(path, "node_type") == 0) {
+		len = 1 + sprintf(buf, "%d", IBV_NODE_CA);
+	} else {
+		if (!(info = get_device_info(dev_name)))
+			goto exit;
+
+		if (strcmp(path, "node_guid") == 0) {
+			len = 1 + sprintf(buf, "%s", info->ibd_node_guid_str);
+		} else if (strcmp(path, "sys_image_guid") == 0) {
+			len = 1 + sprintf(buf, "%s", info->ibd_sys_image_guid);
+		} else if (strcmp(path, "fw_ver") == 0) {
+			len = 1 + sprintf(buf, "%s", info->ibd_fw_ver);
+		} else if (strcmp(path, "hw_rev") == 0) {
+			len = 1 + sprintf(buf, "%d", info->ibd_hw_rev);
+		} else if (strcmp(path, "hca_type") == 0) {
+			if (!(strncmp(info->ibd_name, "mlx4", 4)))
+				len = 1 + sprintf(buf, "%d", 0);
+			else
+				len = 1 + sprintf(buf, "unavailable");
+		} else if (strcmp(path, "board_id") == 0) {
+			if (info->ibd_boardid_index == -1)
+				init_boardid_index(info);
+
+			len = 1 + sprintf(buf, "%s",
+			    mlx_mdr[info->ibd_boardid_index].mlx_psid);
+		}
+	}
+exit:
+	return (len);
+}
+
+static int
+infiniband_mad(char *path, char *buf, size_t size)
+{
+	int		len = -1;
+	unsigned int	dev_num;
+
+	if (pthread_mutex_lock(&umad_cache_mutex) != 0) {
+		fprintf(stderr, "failed: to acquire umad_cache_mutex %s\n",
+		    strerror(errno));
+		goto exit;
+	}
+	if (!umad_cache_initialized) {
+		if (umad_cache_init())
+			umad_cache_initialized = B_TRUE;
+		else
+			goto exit;
+	}
+	(void) pthread_mutex_unlock(&umad_cache_mutex);
+
+	if (check_path(path, CP_UMAD, &dev_num)) {
+		if (dev_num >= MAX_HCAS * MAX_HCA_PORTS) {
+			fprintf(stderr, "Invalid Path: %s\n", path);
+			goto exit;
+		}
+		if (!umad_dev_cache[dev_num].umc_valid) {
+			goto exit;
+		}
+		if (strcmp(path, "ibdev") == 0) {
+			len = strlcpy(buf, umad_dev_cache[dev_num].umc_ib_dev,
+			    size) + 1;
+		} else if (strcmp(path, "port") == 0) {
+			len = 1 + sprintf(buf, "%d",
+			    umad_dev_cache[dev_num].umc_port);
+		}
+	} else if (strcmp(path, "abi_version") == 0) {
+		if (umad_abi_version == -1) {
+			fprintf(stderr, "UMAD ABI Version invalid\n");
+			goto exit;
+		}
+		len =
+		    1 + sprintf(buf, "%d", umad_abi_version);
+	}
+exit:
+	return (len);
+}
+
+/*
+ * Return -1 on error, or the length of the data (buf) on success.
+ */
+int
+sol_read_sysfs_file(char *path, char *buf, size_t size)
+{
+	int 			len = -1;
+
+	if (!initialized) {
+		if (pthread_once(&oneTimeInit, initialize)) {
+			fprintf(stderr, "failed to initialize: %s\n",
+			    strerror(errno));
+			goto exit;
+		}
+		if (!initialized)
+			/*
+			 * There was a problem in initialize()
+			 */
+			goto exit;
+	}
+
+	if (!check_path(path, CP_SLASH, NULL))
+		goto exit;
+
+	if (!check_path(path, CP_SYS, NULL))
+		goto exit;
+
+	if (!check_path(path, CP_CLASS, NULL))
+		goto exit;
+
+	if (check_path(path, CP_INFINIBAND_VERBS, NULL)) {
+		len = infiniband_verbs(path, buf, size);
+	} else if (check_path(path, CP_INFINIBAND, NULL)) {
+		len = infiniband(path, buf, size);
+	} else if (check_path(path, CP_INFINIBAND_MAD, NULL)) {
+		len = infiniband_mad(path, buf, size);
+	} else if (check_path(path, CP_MISC, NULL)) {
+		if (check_path(path, CP_RDMA_CM, NULL)) {
+			if (strcmp(path, "abi_version") == 0) {
+				len = 1 + sprintf(buf, "%d",
+				    RDMA_USER_CM_MAX_ABI_VERSION);
+			}
+		}
+	}
+exit:
+	return (len);
+}
+
+
+int
+sol_get_cpu_info(sol_cpu_info_t *info)
+{
+	kstat_t		*ksp;
+	kstat_named_t	*knp;
+
+	/*
+	 * We should check all CPUS, and make sure they
+	 * are all the same or return an array of structs.
+	 */
+	ksp = kstat_lookup(kc, "cpu_info", 0, NULL);
+	if (ksp == NULL)
+		return (-1);
+
+	if (kstat_read(kc, ksp, NULL) == -1)
+		return (-1);
+
+	knp = (kstat_named_t *)kstat_data_lookup(ksp, "brand");
+	if (knp == NULL)
+		return (-1);
+
+	(void) strlcpy(info->cpu_name, knp->value.str.addr.ptr,
+	    knp->value.str.len);
+
+	knp = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz");
+	if (knp == NULL)
+		return -1;
+
+	info->cpu_mhz = knp->value.ui64;	
+	info->cpu_num = sysconf(_SC_NPROCESSORS_ONLN);
+	return (0);
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,59 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libmlx4
+COMPONENT_VERSION=	1.0.1
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-1.18.gb810a27.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:fd6742451eb6efaad87c6feb78fc01d0e962387d
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/libmlx4/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+# --disable-libcheck is not a supported option for this component
+DISABLE_LIBCHECK=
+
+LIBS +=	-libverbs
+LDFLAGS +=	-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))
+
+CONFIGURE_ENV +=	CPPFLAGS="$(CPPFLAGS)"
+
+CONFIGURE_OPTIONS +=	LDFLAGS="$(LDFLAGS)"
+
+COMPONENT_POST_INSTALL_ACTION =\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la;\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la;\
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmlx4/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1402 @@
+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
+ 
+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,15 @@
+ 	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;
+@@ -79,6 +88,9 @@
+ 	struct ibv_alloc_pd       cmd;
+ 	struct mlx4_alloc_pd_resp resp;
+ 	struct mlx4_pd		 *pd;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_pd_data_out_t   *mdd;
++#endif
+ 
+ 	pd = malloc(sizeof *pd);
+ 	if (!pd)
+@@ -90,7 +102,16 @@
+ 		return NULL;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * The kernel driver passes back the PD table index as opaque data.  This
++	 * index is required for specifying the PD in user space address vectors.
++	 */
++	mdd     = (mlnx_umap_pd_data_out_t *) &resp.ibv_resp.drv_out;
++	pd->pdn = mdd->mpd_pdnum;
++#else
+ 	pd->pdn = resp.pdn;
++#endif
+ 
+ 	return &pd->ibv_pd;
+ }
+@@ -168,6 +189,10 @@
+ 	struct mlx4_create_cq_resp resp;
+ 	struct mlx4_cq		  *cq;
+ 	int			   ret;
++#if defined(__SVR4) && defined(__sun)
++	void                      *cqbuf;
++	mlnx_umap_cq_data_out_t   *mdd;
++#endif
+ 
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 0x3fffff)
+@@ -184,7 +209,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 +224,84 @@
+ 
+ 	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 defined(__SVR4) && defined(__sun)
++	if (ret) {
++		goto err;
++	}
++#else
+ 	if (ret)
+ 		goto err_db;
++#endif
+ 
+ 	cq->cqn = resp.cqn;
+ 
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * For Solaris the kernel driver passes back mmap information for
++	 *  mapping the CQ memory it allocated.
++         */
++        mdd = (mlnx_umap_cq_data_out_t *) &resp.ibv_resp.drv_out;
++	if (mdd->mcq_rev < MLNX_UMAP_IF_VERSION) {
++		fprintf(stderr, PFX "libmlx4_create_cq: libmlx4/hermon umap "
++				"rev mismatch (kernel rev=%d)\n", mdd->mcq_rev);
++		goto err_destroy;
++	}
++
++        cqbuf = mmap64((void *)0, mdd->mcq_maplen, (PROT_READ | PROT_WRITE),
++                    MAP_SHARED, context->mmap_fd, 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            = mdd->mcq_numcqe;
++        cq->cqn        = mdd->mcq_cqnum;
++        cq->buf.buf    = cqbuf;
++        cq->buf.length = 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 bumpts 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),
++	                              mdd->mcq_polldbr_mapoffset,
++	                              mdd->mcq_polldbr_maplen,
++	                              mdd->mcq_polldbr_offset);
++        if (cq->set_ci_db == NULL) {
++                goto err_buf;
++        }
++
++	cq->arm_db = mlx4_alloc_db(to_mctx(context),
++	                           mdd->mcq_armdbr_mapoffset,
++	                           mdd->mcq_armdbr_maplen,
++	                           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 +310,22 @@
+ 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);
+ 
+@@ -225,12 +336,17 @@
+ {
+ 	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)
++	void			*cqbuf;
++	mlnx_umap_cq_data_out_t	*mdd;
++#endif
++	
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 0x3fffff)
+-		return EINVAL;
++ 		return EINVAL;
+ 
+ 	pthread_spin_lock(&cq->lock);
+ 
+@@ -247,32 +363,65 @@
+ 		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;
++        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,
+ 					&resp, sizeof resp);
+-	}
+ #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);
++#endif
+ 		goto out;
+ 	}
+ 
+-	mlx4_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * For Solaris the kernel driver passes back mmap information for
++	 * mapping the CQ memory it allocated.
++	 */
++	mdd = (mlnx_umap_cq_data_out_t *) &resp.drv_out;
++	if (mdd->mcq_rev < MLNX_UMAP_IF_VERSION) {
++		fprintf(stderr, PFX "libmlx4_resize_cq: libmlx4/hermon umap "
++		    "rev mismatch (kernel rev=%d)\n", mdd->mcq_rev);
++		ret = EINVAL;
++		goto out;
++	}
+ 
+-	mlx4_free_buf(&cq->buf);
+-	cq->buf = buf;
++	cqbuf = mmap64((void *)0, mdd->mcq_maplen, (PROT_READ | PROT_WRITE),
++	     MAP_SHARED, ibcq->context->mmap_fd, mdd->mcq_mapoffset);
+ 
++	if (cqbuf == MAP_FAILED) {
++		ret = EINVAL;
++		goto out;
++	}
++#endif
++
++        mlx4_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
++
++#if !(defined(__SVR4) && defined(__sun))
++        mlx4_free_buf(&cq->buf);
++#endif
++        cq->buf = buf;
++
++#if defined(__SVR4) && defined(__sun)
++	cqe            = mdd->mcq_numcqe;
++	cq->cqn        = mdd->mcq_cqnum;
++	cq->buf.buf    = cqbuf;
++	cq->buf.length = mdd->mcq_maplen;
++	cq->ibv_cq.cqe = cqe-1;
++#endif
+ out:
+ 	pthread_spin_unlock(&cq->lock);
+ 	return ret;
+@@ -287,6 +436,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 +452,10 @@
+ 	struct mlx4_create_srq_resp resp;
+ 	struct mlx4_srq		   *srq;
+ 	int			    ret;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_srq_data_out_t   *mdd;
++	void                       *srqbuf;
++#endif
+ 
+ 	/* Sanity check SRQ size before proceeding */
+ 	if (attr->attr.max_wr > 1 << 16 || attr->attr.max_sge > 64)
+@@ -312,6 +468,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;
+@@ -324,7 +481,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->attr.max_wr += 1;
++#endif
+ 	cmd.buf_addr = (uintptr_t) srq->buf.buf;
+ 	cmd.db_addr  = (uintptr_t) srq->db;
+ 
+@@ -331,19 +504,97 @@
+ 	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.
++         */
++	mdd = (mlnx_umap_srq_data_out_t *) &resp.ibv_resp.drv_out;
++	if (mdd->msrq_rev < 1) {
++		fprintf(stderr, PFX "libmlx4_create_srq libmlx4/hermon umap "
++			"rev mismatch (kernel rev=%d)\n", mdd->msrq_rev);
++		goto err_destroy;
++	}
++
++        srqbuf = mmap64((void *)0, mdd->msrq_maplen, (PROT_READ | PROT_WRITE),
++                    MAP_SHARED, pd->context->mmap_fd, mdd->msrq_mapoffset);
++
++        if (srqbuf == MAP_FAILED) {
++                goto err_destroy;
++        }
++
++	srq->buf.buf    = srqbuf;
++	srq->buf.length = mdd->msrq_maplen;
++	srq->max	= resp.ibv_resp.max_wr;
++	srq->max_gs	= resp.ibv_resp.max_sge;
++	srq->srqn       = mdd->msrq_srqnum;
++	srq->counter 	= 0;
++
++	srq->db = mlx4_alloc_db(to_mctx(pd->context),
++	                        mdd->msrq_rdbr_mapoffset,
++	                        mdd->msrq_rdbr_maplen,
++	                        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, mdd->msrq_wqesz, 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 +608,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 +625,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)
+@@ -414,7 +684,11 @@
+ 		return -1;
+ 
+ 	if (attr->cap.max_inline_data) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		nsegs = num_inline_segs(attr->cap.max_inline_data, attr->qp_type);
++#else
++		nsegs = mlx4_num_inline_segs(attr->cap.max_inline_data, attr->qp_type);
++#endif
+ 		size = MLX4_MAX_WQE_SIZE - nsegs * sizeof (struct mlx4_wqe_inline_seg);
+ 		switch (attr->qp_type) {
+ 		case IBV_QPT_UD:
+@@ -447,6 +721,12 @@
+ 	struct mlx4_qp		 *qp;
+ 	int			  ret;
+ 	struct mlx4_context	 *context = to_mctx(pd->context);
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_qp_data_out_t	*mdd;
++	void			*qpbuf;
++	int			max_send_sge;
++	int			max_inline_data;
++#endif
+ 
+ 
+ 	/* Sanity check QP size before proceeding */
+@@ -457,6 +737,7 @@
+ 	if (!qp)
+ 		return NULL;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	mlx4_calc_sq_wqe_size(&attr->cap, attr->qp_type, qp);
+ 
+ 	/*
+@@ -466,6 +747,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 +758,46 @@
+ 			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;
++	}
++
++	/*
++	 * We adjust the number of send SGL entries to force the kernel to
++	 * allocate a larger WQE that will fit the inline data requested.
++	 * The Solaris Hermon driver does not look at inline data size when
++	 * calculating the send WQE size, so this allows us to get closer
++	 * to what the user has requested.
++	 */
++	max_send_sge = align(attr->cap.max_inline_data +
++			mlx4_num_inline_segs(attr->cap.max_inline_data,
++			attr->qp_type) * sizeof (struct mlx4_wqe_inline_seg),
++			sizeof( struct mlx4_wqe_data_seg)) /
++	                          sizeof(struct mlx4_wqe_data_seg);
++
++
++	if (max_send_sge > attr->cap.max_send_sge) 
++		attr->cap.max_send_sge = max_send_sge;
++
++	if (attr->cap.max_send_sge > context->max_sge) {
++		free(qp);
++		return (NULL);
++	};
++
++
++	/*
++	 * 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,11 +827,120 @@
+ 		; /* 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,
+ 				&resp, sizeof resp);
++
++#if defined(__SVR4) && defined(__sun)
++	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.
++         */
++        mdd = (mlnx_umap_qp_data_out_t *) &resp.drv_out;
++	if (mdd->mqp_rev < 2) {
++		fprintf(stderr, PFX "libmlx4_create_qp: libmlx4/hermon umap "
++				"rev mismatch (kernel rev=%d)\n", mdd->mqp_rev);
++		goto err_destroy;
++	}
++	qpbuf = mmap64((void *)0, mdd->mqp_maplen, (PROT_READ | PROT_WRITE),
++	                MAP_SHARED, pd->context->mmap_fd, 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	= mdd->mqp_maplen;
++
++	if (!attr->srq && attr->qp_type != IBV_QPT_XRC) {
++		qp->db = mlx4_alloc_db(to_mctx(pd->context),
++		                       mdd->mqp_rdbr_mapoffset,
++		                       mdd->mqp_rdbr_maplen,
++		                       mdd->mqp_rdbr_offset);
++		if (qp->db == NULL) {
++			goto err_buf;
++		}
++		*qp->db = 0;
++	}
++
++	/*
++	 * Calculate the official maximum inline data size, this is not done
++	 * by the kernel driver, so we do it here and update the qp struct.
++	 */
++	max_inline_data =
++			mdd->mqp_sq_wqesz - sizeof(struct mlx4_wqe_inline_seg);
++	max_inline_data -= sizeof(struct mlx4_wqe_ctrl_seg);
++
++	switch (attr->qp_type) {
++	case IBV_QPT_UD:
++		max_inline_data -= sizeof(struct mlx4_wqe_datagram_seg);
++		break;
++
++	case IBV_QPT_UC:
++		max_inline_data -= sizeof(struct mlx4_wqe_raddr_seg);
++		break;
++
++	case IBV_QPT_RC:
++		max_inline_data -= sizeof(struct mlx4_wqe_raddr_seg);
++		if (max_inline_data > (sizeof(struct mlx4_wqe_atomic_seg) +
++		                       sizeof(struct mlx4_wqe_raddr_seg) +
++		                       sizeof(struct mlx4_wqe_data_seg))) {
++			max_inline_data -= sizeof(struct mlx4_wqe_atomic_seg) +
++		                           sizeof(struct mlx4_wqe_raddr_seg) +
++		                           sizeof(struct mlx4_wqe_data_seg);
++		} else {
++			max_inline_data = 0;
++		}
++		break;
++
++	default:
++		break;
++	}
++
++	attr->cap.max_inline_data = max_inline_data;
++
++	/*
++	 * 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 = mdd->mqp_sq_headroomwqes;
++	qp->sq.wqe_cnt    = mdd->mqp_sq_numwqe;
++
++	if (attr->srq) {
++		qp->rq.wqe_cnt  = 0;
++	} else {
++		qp->rq.wqe_cnt  = mdd->mqp_rq_numwqe;
++	}
++
++	if (mlx4_set_qp_buf(pd, qp, qpbuf, mdd->mqp_maplen,
++	                    mdd->mqp_rq_wqesz, mdd->mqp_rq_off,
++	                    mdd->mqp_sq_wqesz, 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;
++	}
++#else
+ 	if (ret)
+ 		goto err_rq_db;
+ 
+@@ -516,6 +947,7 @@
+ 	ret = mlx4_store_qp(to_mctx(pd->context), qp->ibv_qp.qp_num, qp);
+ 	if (ret)
+ 		goto err_destroy;
++#endif
+ 	pthread_mutex_unlock(&to_mctx(pd->context)->qp_table_mutex);
+ 
+ 	qp->rq.wqe_cnt = attr->cap.max_recv_wr;
+@@ -536,9 +968,42 @@
+ 
+ 	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 +1017,7 @@
+ 
+ err:
+ 	free(qp);
++#endif
+ 
+ 	return NULL;
+ }
+@@ -745,6 +1211,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 +1280,7 @@
+ 	free(srq);
+ 
+ 	return NULL;
++#endif
+ }
+ 
+ struct ibv_xrc_domain *mlx4_open_xrc_domain(struct ibv_context *context,
+@@ -893,5 +1367,4 @@
+ {
+ 	return ibv_cmd_unreg_xrc_rcv_qp(xrc_domain, xrc_qp_num);
+ }
+-
+ #endif
+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
+@@ -511,7 +511,17 @@
+ 	return ret;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++/*
++ * Create a non-static version that can be called externally;
++ * default file local calls to now use the name of the non-static
++ * version.
++ */
++#define	num_inline_segs mlx4_num_inline_segs
++int mlx4_num_inline_segs(int data, enum ibv_qp_type type)
++#else
+ int num_inline_segs(int data, enum ibv_qp_type type)
++#endif
+ {
+ 	/*
+ 	 * Inline data segments are not allowed to cross 64 byte
+@@ -589,6 +599,58 @@
+ 		; /* 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 %d < user buf size %d\n",
++		        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,
+@@ -388,8 +397,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,
+@@ -399,6 +413,9 @@
+ 		       struct mlx4_srq *srq);
+ void mlx4_clear_xrc_srq(struct mlx4_context *ctx, uint32_t xrc_srqn);
+ 
++#if defined(__SVR4) && defined(__sun)
++int mlx4_num_inline_segs(int data, enum ibv_qp_type type);
++#endif
+ struct ibv_qp *mlx4_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
+ int mlx4_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+ 		   int attr_mask,
+@@ -415,8 +432,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
+@@ -144,6 +144,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 +155,32 @@
+ 		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 +198,44 @@
+ 	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 +264,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 +271,7 @@
+ 			"Kernel does not support XRC. Exiting.\n");
+ 		goto query_free;
+ 	}
++#endif
+ 
+ 	return &context->ibv_ctx;
+ 
+@@ -227,7 +279,6 @@
+ 	munmap(context->uar, to_mdev(ibdev)->page_size);
+ 	if (context->bf_page)
+ 		munmap(context->bf_page, to_mdev(ibdev)->page_size);
+-
+ err_free:
+ 	free(context);
+ 	return NULL;
+@@ -240,6 +291,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,6 @@
+ fi
+ AC_SUBST(MLX4_VERSION_SCRIPT)
+ 
+-SHAVE_INIT([], [enable])
++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/mlx4/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
+@@ -8890,6 +8890,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++	hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -11616,6 +11617,14 @@
+ # This bug is HP SR number 8606223364.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+ $as_echo_n "checking size of long... " >&6; }
++
++echo $CFLAGS | grep 64 > /dev/null
++if [ $? -eq 0 ]; then
++	ac_cv_sizeof_long=8
++else
++	ac_cv_sizeof_long=4
++fi
++
+ if test "${ac_cv_sizeof_long+set}" = set; then :
+   $as_echo_n "(cached) " >&6
+ else
+@@ -11654,11 +11663,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/libmthca/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libmthca
+COMPONENT_VERSION=	1.0.5
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.1.gbe5eef3.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:5d118728fd57982d5c7fe21ea7b4e6b0c3884c08
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/libmthca/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS +=	-libverbs
+LDFLAGS +=	-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))
+
+CONFIGURE_ENV +=	CPPFLAGS="$(CPPFLAGS)"
+
+CONFIGURE_OPTIONS +=	LDFLAGS="$(LDFLAGS)"
+
+COMPONENT_POST_INSTALL_ACTION =\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la;\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la;\
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libmthca/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1247 @@
+diff -r -u /tmp/909901/libmthca-1.0.5/configure libmthca-1.0.5/configure
+--- /tmp/909901/libmthca-1.0.5/configure	Sun Aug 30 06:43:33 2009
++++ libmthca-1.0.5/configure	Fri Feb 11 04:07:25 2011
+@@ -8698,6 +8698,7 @@
+ 	;;
+       esac
+       link_all_deplibs=yes
++      hardcode_libdir_flag_spec=
+       ;;
+ 
+     sunos4*)
+@@ -21267,6 +21268,14 @@
+ # This bug is HP SR number 8606223364.
+ { echo "$as_me:$LINENO: checking size of long" >&5
+ echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
++
++echo $CFLAGS | grep 64 > /dev/null
++if [ $? -eq 0 ]; then
++	ac_cv_sizeof_long=8
++else
++	ac_cv_sizeof_long=4
++fi
++
+ if test "${ac_cv_sizeof_long+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+diff -r -u /tmp/909901/libmthca-1.0.5/src/srq.c libmthca-1.0.5/src/srq.c
+--- /tmp/909901/libmthca-1.0.5/src/srq.c	Sun Aug 30 06:43:15 2009
++++ libmthca-1.0.5/src/srq.c	Fri Feb 11 04:07:30 2011
+@@ -250,6 +250,62 @@
+ 	return err;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++int mthca_set_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
++		      struct mthca_srq *srq, void *srqbuf, 
++                      uint64_t buflen, uint32_t srq_wqesz,
++                      uint32_t srq_numwqe)
++{
++	struct mthca_data_seg *scatter;
++	void *wqe;
++	int i;
++
++	srq->buf.buf    = srqbuf;
++	srq->buf.length = buflen;
++	srq->max        = srq_numwqe;
++
++	srq->wrid = malloc(srq->max * sizeof (uint64_t));
++	if (!srq->wrid)
++		return -1;
++
++	for (srq->wqe_shift = 6; 1 << srq->wqe_shift < srq_wqesz; ++srq->wqe_shift)
++		; /* nothing */
++
++	srq->buf_size = srq->buf.length;
++	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.  In addition, set the
++	 * scatter list L_Keys to the sentry value of 0x100.
++	 */
++
++	for (i = 0; i < srq->max; ++i) {
++		struct mthca_next_seg *next;
++
++		next = wqe = get_wqe(srq, i);
++
++		if (i < srq->max - 1) {
++			*wqe_to_link(wqe) = i + 1;
++			next->nda_op = htonl(((i + 1) << srq->wqe_shift) | 1);
++		} else {
++			*wqe_to_link(wqe) = -1;
++			next->nda_op = 0;
++		}
++
++		for (scatter = wqe + sizeof (struct mthca_next_seg);
++		     (void *) scatter < wqe + (1 << srq->wqe_shift);
++		     ++scatter)
++			scatter->lkey = htonl(MTHCA_INVAL_LKEY);
++	}
++
++	srq->first_free = 0;
++	srq->last_free  = srq->max - 1;
++	srq->last       = get_wqe(srq, srq->max - 1);
++
++	return 0;
++}
++#else
+ int mthca_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
+ 		       struct mthca_srq *srq)
+ {
+@@ -310,3 +366,4 @@
+ 
+ 	return 0;
+ }
++#endif
+diff -r -u /tmp/909901/libmthca-1.0.5/src/verbs.c libmthca-1.0.5/src/verbs.c
+--- /tmp/909901/libmthca-1.0.5/src/verbs.c	Tue May 27 13:32:43 2008
++++ libmthca-1.0.5/src/verbs.c	Tue May  3 13:50:07 2011
+@@ -44,6 +44,9 @@
+ 
+ #include "mthca.h"
+ #include "mthca-abi.h"
++#if defined(__SVR4) && defined(__sun)
++#include "wqe.h"
++#endif
+ 
+ int mthca_query_device(struct ibv_context *context, struct ibv_device_attr *attr)
+ {
+@@ -56,6 +59,13 @@
+ 	if (ret)
+ 		return ret;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * So that the queue operations in srq.c work we need to report
++	 * the max as actual max  less 1.
++	 */
++	attr->max_srq_wr -=1;
++#endif
+ 	major     = (raw_fw_ver >> 32) & 0xffff;
+ 	minor     = (raw_fw_ver >> 16) & 0xffff;
+ 	sub_minor = raw_fw_ver & 0xffff;
+@@ -79,6 +89,9 @@
+ 	struct ibv_alloc_pd        cmd;
+ 	struct mthca_alloc_pd_resp resp;
+ 	struct mthca_pd           *pd;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_pd_data_out_t   *mdd;
++#endif
+ 
+ 	pd = malloc(sizeof *pd);
+ 	if (!pd)
+@@ -98,7 +111,16 @@
+ 		return NULL;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * The kernel driver passes back the PD table index as opaque data.  This
++	 * index is required for specifying the PD in user space address vectors.
++	 */
++	mdd     = (mlnx_umap_pd_data_out_t *) &resp.ibv_resp.drv_out;
++	pd->pdn = mdd->mpd_pdnum;
++#else
+ 	pd->pdn = resp.pdn;
++#endif
+ 
+ 	return &pd->ibv_pd;
+ }
+@@ -117,7 +139,7 @@
+ 
+ static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr,
+ 				     size_t length, uint64_t hca_va,
+-				     enum ibv_access_flags access,
++				     int access,
+ 				     int dma_sync)
+ {
+ 	struct ibv_mr *mr;
+@@ -157,7 +179,7 @@
+ }
+ 
+ struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
+-			    size_t length, enum ibv_access_flags access)
++			    size_t length, int access)
+ {
+ 	return __mthca_reg_mr(pd, addr, length, (uintptr_t) addr, access, 0);
+ }
+@@ -190,8 +212,12 @@
+ {
+ 	struct mthca_create_cq      cmd;
+ 	struct mthca_create_cq_resp resp;
+-	struct mthca_cq      	   *cq;
+-	int                  	    ret;
++	struct mthca_cq            *cq;
++	int                         ret;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_cq_data_out_t       *mdd;
++	void                          *cqbuf;
++#endif
+ 
+ 	/* Sanity check CQ size before proceeding */
+ 	if (cqe > 131072)
+@@ -207,6 +233,16 @@
+ 		goto err;
+ 
+ 	cqe = align_cq_size(cqe);
++
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Solaris CQ buffer is supplied by kernel, so we don't allocate
++	 * memory here.
++	 */
++	cq->buf.buf    = NULL;
++	cq->buf.length = 0;
++	cq->mr         = NULL;
++#else
+ 	if (mthca_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe))
+ 		goto err;
+ 
+@@ -217,6 +253,7 @@
+ 		goto err_buf;
+ 
+ 	cq->mr->context = context;
++#endif
+ 
+ 	if (mthca_is_memfree(context)) {
+ 		cq->arm_sn          = 1;
+@@ -241,7 +278,11 @@
+ 		cmd.arm_db_index = cmd.set_db_index = 0;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	cmd.lkey   = 0;
++#else
+ 	cmd.lkey   = cq->mr->lkey;
++#endif
+ 	cmd.pdn    = to_mpd(to_mctx(context)->pd)->pdn;
+ 	ret = ibv_cmd_create_cq(context, cqe - 1, channel, comp_vector,
+ 				&cq->ibv_cq, &cmd.ibv_cmd, sizeof cmd,
+@@ -249,7 +290,9 @@
+ 	if (ret)
+ 		goto err_arm_db;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	cq->cqn = resp.cqn;
++#endif
+ 
+ 	if (mthca_is_memfree(context)) {
+ 		mthca_set_db_qn(cq->set_ci_db, MTHCA_DB_TYPE_CQ_SET_CI, cq->cqn);
+@@ -256,8 +299,58 @@
+ 		mthca_set_db_qn(cq->arm_db,    MTHCA_DB_TYPE_CQ_ARM,    cq->cqn);
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * The kernel driver passes back mmap information for mapping the
++	 * CQ memory it allocated into user space.  This is part of the
++	 * HCA generic opaque data.
++	 */
++	mdd = (mlnx_umap_cq_data_out_t *) &resp.ibv_resp.drv_out;
++	cqbuf = mmap64((void *)0, mdd->mcq_maplen, (PROT_READ | PROT_WRITE),
++		    MAP_SHARED, context->mmap_fd, mdd->mcq_mapoffset);
++
++	if (cqbuf == MAP_FAILED) {
++		goto err_destroy;
++	}
++
++	/*
++	 * Extract hardware driver settins for number of CQE and the hardware
++	 * CQ number to use (needed for user space doorbells).
++	 */
++	cqe            = mdd->mcq_numcqe;
++	cq->cqn        = mdd->mcq_cqnum;
++	cq->buf.buf    = cqbuf;
++	cq->buf.length = mdd->mcq_maplen;
++
++	/*
++	 * NOTE: The following call will not allocate memory for solaris, it
++	 * only performs required initialization.
++	 */
++	if (mthca_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe)) {
++		goto err_unmap;
++	}
++#endif
++
+ 	return &cq->ibv_cq;
+ 
++#if defined(__SVR4) && defined(__sun)
++err_unmap:
++	munmap(cq->buf.buf, cq->buf.length);
++
++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_arm_db:
+ 	if (mthca_is_memfree(context))
+ 		mthca_free_db(to_mctx(context)->db_tab, MTHCA_DB_TYPE_CQ_ARM,
+@@ -269,10 +362,12 @@
+ 			      cq->set_ci_db_index);
+ 
+ err_unreg:
++#if !(defined(__SVR4) && defined(__sun))
+ 	mthca_dereg_mr(cq->mr);
+ 
+ err_buf:
+ 	mthca_free_buf(&cq->buf);
++#endif
+ 
+ err:
+ 	free(cq);
+@@ -284,8 +379,14 @@
+ {
+ 	struct mthca_cq *cq = to_mcq(ibcq);
+ 	struct mthca_resize_cq cmd;
++	struct ibv_resize_cq_resp resp;;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_cq_data_out_t      *mdd;
++	void                         *cqbuf;
++#else
+ 	struct ibv_mr *mr;
+ 	struct mthca_buf buf;
++#endif
+ 	int old_cqe;
+ 	int ret;
+ 
+@@ -301,6 +402,18 @@
+ 		goto out;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Solaris CQ buffer is supplied by the kernel, so we don't allocate
++	 * memory here.
++	 */
++	if (cq->buf.buf != NULL) {
++		ret = munmap((char *)cq->buf.buf, cq->buf.length);
++		if (ret) {
++			goto out;
++		}
++	}
++#else
+ 	ret = mthca_alloc_cq_buf(to_mdev(ibcq->context->device), &buf, cqe);
+ 	if (ret)
+ 		goto out;
+@@ -315,10 +428,16 @@
+ 	}
+ 
+ 	mr->context = ibcq->context;
++#endif
+ 
+ 	old_cqe = ibcq->cqe;
+ 
++#if defined(__SVR4) && defined(__sun)
++	cmd.lkey = 0;
++#else
+ 	cmd.lkey = mr->lkey;
++#endif
++
+ #ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS
+ 	{
+ 		struct ibv_resize_cq_resp resp;
+@@ -329,11 +448,31 @@
+ 	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd);
+ #endif
+ 	if (ret) {
++#if !(defined(__SVR4) && defined(__sun))
+ 		mthca_dereg_mr(mr);
+ 		mthca_free_buf(&buf);
++#endif
+ 		goto out;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*	
++	 * The kernel driver passes back mmap information for mapping the
++	 * CQ memory it allocated to use space.
++	 */
++	mdd = (mlnx_umap_cq_data_out_t *) &resp.drv_out;
++        cqbuf = mmap64((void *)0, mdd->mcq_maplen, (PROT_READ | PROT_WRITE), MAP_SHARED,
++                        ibcq->context->mmap_fd, mdd->mcq_mapoffset);
++        if (cqbuf == MAP_FAILED) {
++		ret = -1;  /* XXXX SFW need something better than this */
++                goto out;
++        }
++
++	cq->mr         = NULL;
++        cq->buf.buf    = cqbuf;
++	cq->buf.length = mdd->mcq_maplen;
++/*	mthca_cq_resize_copy_cqes(cq, buf.buf, old_cqe); ??? */
++#else
+ 	mthca_cq_resize_copy_cqes(cq, buf.buf, old_cqe);
+ 
+ 	mthca_dereg_mr(cq->mr);
+@@ -341,6 +480,7 @@
+ 
+ 	cq->buf = buf;
+ 	cq->mr  = mr;
++#endif
+ 
+ out:
+ 	pthread_spin_unlock(&cq->lock);
+@@ -355,6 +495,13 @@
+ 	if (ret)
+ 		return ret;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Unmap memory allocated by the kernel for the CQ from our process.
++	 */
++	munmap(to_mcq(cq)->buf.buf, to_mcq(cq)->buf.length);
++#endif
++
+ 	if (mthca_is_memfree(cq->context)) {
+ 		mthca_free_db(to_mctx(cq->context)->db_tab, MTHCA_DB_TYPE_CQ_SET_CI,
+ 			      to_mcq(cq)->set_ci_db_index);
+@@ -362,8 +509,10 @@
+ 			      to_mcq(cq)->arm_db_index);
+ 	}
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	mthca_dereg_mr(to_mcq(cq)->mr);
+ 	mthca_free_buf(&to_mcq(cq)->buf);
++#endif
+ 	free(to_mcq(cq));
+ 
+ 	return 0;
+@@ -396,6 +545,10 @@
+ 	struct mthca_create_srq_resp resp;
+ 	struct mthca_srq            *srq;
+ 	int                          ret;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_srq_data_out_t     *mdd;
++	void                         *srqbuf;
++#endif
+ 
+ 	/* Sanity check SRQ size before proceeding */
+ 	if (attr->attr.max_wr > 1 << 16 || attr->attr.max_sge > 64)
+@@ -407,7 +560,26 @@
+ 
+ 	if (pthread_spin_init(&srq->lock, PTHREAD_PROCESS_PRIVATE))
+ 		goto err;
++ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Solaris SRQ WQE memory is supplied by the kernel, so we
++	 * don't allocate memory here.
++	 */
++	srq->buf.buf	= NULL;
++	srq->buf.length	= 0;
++	srq->mr		= NULL;	
++	srq->wrid	= 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;
++
++#else
+ 	srq->max     = align_queue_size(pd->context, attr->attr.max_wr, 1);
+ 	srq->max_gs  = attr->attr.max_sge;
+ 	srq->counter = 0;
+@@ -420,6 +592,7 @@
+ 		goto err_free;
+ 
+ 	srq->mr->context = pd->context;
++#endif
+ 
+ 	if (mthca_is_memfree(pd->context)) {
+ 		srq->db_index = mthca_alloc_db(to_mctx(pd->context)->db_tab,
+@@ -433,7 +606,11 @@
+ 		cmd.db_page  = cmd.db_index = 0;
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	cmd.lkey = 0;
++#else
+ 	cmd.lkey = srq->mr->lkey;
++#endif
+ 
+ 	ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr,
+ 				 &cmd.ibv_cmd, sizeof cmd,
+@@ -446,8 +623,64 @@
+ 	if (mthca_is_memfree(pd->context))
+ 		mthca_set_db_qn(srq->db, MTHCA_DB_TYPE_SRQ, srq->srqn);
+ 
++#if defined(__SVR4) && defined(__sun)
++        /*
++         * The kernel driver passes back mmap information for mapping the
++         * SRQ WQE memory it allocated back into user space.  This is part
++         * of the HCA generic data.
++         */    
++        mdd = (mlnx_umap_srq_data_out_t *) &resp.ibv_resp.drv_out;
++        srqbuf = mmap64((void *)0, mdd->msrq_maplen,
++                        PROT_READ|PROT_WRITE, MAP_SHARED,
++                        pd->context->mmap_fd,
++                        mdd->msrq_mapoffset);
++
++        if (srqbuf == MAP_FAILED) {
++                goto err_destroy;
++        }
++	srq->max        = resp.ibv_resp.max_wr;
++	srq->max_gs     = resp.ibv_resp.max_sge;
++	srq->counter    = 0;
++	srq->srqn       = mdd->msrq_srqnum;
++
++	/*
++	 * The following call only initializes memory and ccontrol structures,
++	 * it utilizes the memory allocated by the kernel in Solaris.
++	 */
++	if (mthca_set_srq_buf(pd, &attr->attr, srq, srqbuf, mdd->msrq_maplen,
++	                      mdd->msrq_wqesz, mdd->msrq_numwqe)) {
++		goto err_unmap;
++	}
++
++	/*
++	 * 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;
++
++#endif
+ 	return &srq->ibv_srq;
+ 
++#if defined(__SVR4) && defined(__sun)
++err_unmap:
++	munmap(srq->buf.buf, srq->buf.length);
++
++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);
++#endif
++
+ err_db:
+ 	if (mthca_is_memfree(pd->context))
+ 		mthca_free_db(to_mctx(pd->context)->db_tab, MTHCA_DB_TYPE_SRQ,
+@@ -454,11 +687,19 @@
+ 			      srq->db_index);
+ 
+ err_unreg:
++#if !(defined(__SVR4) && defined(__sun))
+ 	mthca_dereg_mr(srq->mr);
+ 
+ err_free:
+ 	free(srq->wrid);
++#else
++	if (srq->wrid)
++		free(srq->wrid);
++#endif
++
++#if !(defined(__SVR4) && defined(__sun))
+ 	mthca_free_buf(&srq->buf);
++#endif
+ 
+ err:
+ 	free(srq);
+@@ -467,12 +708,21 @@
+ }
+ 
+ int mthca_modify_srq(struct ibv_srq *srq,
+-		     struct ibv_srq_attr *attr,
+-		     enum ibv_srq_attr_mask attr_mask)
++                     struct ibv_srq_attr *attr,
++		     int attr_mask)
+ {
+ 	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 mthca_query_srq(struct ibv_srq *srq,
+@@ -480,7 +730,16 @@
+ {
+ 	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 mthca_destroy_srq(struct ibv_srq *srq)
+@@ -495,9 +754,16 @@
+ 		mthca_free_db(to_mctx(srq->context)->db_tab, MTHCA_DB_TYPE_SRQ,
+ 			      to_msrq(srq)->db_index);
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Unmap kernel allocated SRQ WQE memory.
++	 */
++	munmap(to_msrq(srq)->buf.buf, to_msrq(srq)->buf.length);
++#else
+ 	mthca_dereg_mr(to_msrq(srq)->mr);
+ 
+ 	mthca_free_buf(&to_msrq(srq)->buf);
++#endif
+ 	free(to_msrq(srq)->wrid);
+ 	free(to_msrq(srq));
+ 
+@@ -508,8 +774,14 @@
+ {
+ 	struct mthca_create_qp    cmd;
+ 	struct ibv_create_qp_resp resp;
+-	struct mthca_qp          *qp;
++	struct mthca_qp           *qp;
+ 	int                       ret;
++#if defined(__SVR4) && defined(__sun)
++	mlnx_umap_qp_data_out_t     *mdd;
++	void                        *qpbuf;
++	int                         max_send_sge;
++	int                         max_inline_data;
++#endif
+ 
+ 	/* Sanity check QP size before proceeding */
+ 	if (attr->cap.max_send_wr     > 65536 ||
+@@ -526,6 +798,35 @@
+ 	qp->sq.max = align_queue_size(pd->context, attr->cap.max_send_wr, 0);
+ 	qp->rq.max = align_queue_size(pd->context, attr->cap.max_recv_wr, 0);
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Solaris QP work queue memory is supplied by the kernel, so we
++	 * don't allocate memory here.
++	 */
++	qp->buf.buf	= NULL;
++	qp->buf.length	= 0;
++	qp->mr		= NULL;
++	qp->wrid	= NULL;
++	cmd.lkey	= 0;
++	cmd.reserved	= 0;
++
++	/*
++	 * We adjust the number of send SGL entries to force the kernel to
++	 * allocate a larger WQE that will fit the inline data requested.
++	 * The Solaris Tavor driver does not look at inline data size when
++	 * calculating the send WQE size, so this allows us to get closer
++	 * to what the user has requested.
++	 */
++	max_send_sge = align(attr->cap.max_inline_data +
++				sizeof(struct mthca_inline_seg),
++				sizeof( struct mthca_data_seg)) /
++					sizeof(struct mthca_data_seg);
++
++	if (max_send_sge > attr->cap.max_send_sge) {
++		attr->cap.max_send_sge = max_send_sge;
++	}
++	
++#else
+ 	if (mthca_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp))
+ 		goto err;
+ 
+@@ -543,6 +844,7 @@
+ 
+ 	cmd.lkey     = qp->mr->lkey;
+ 	cmd.reserved = 0;
++#endif
+ 
+ 	if (mthca_is_memfree(pd->context)) {
+ 		qp->sq.db_index = mthca_alloc_db(to_mctx(pd->context)->db_tab,
+@@ -577,6 +879,73 @@
+ 		mthca_set_db_qn(qp->rq.db, MTHCA_DB_TYPE_RQ, qp->ibv_qp.qp_num);
+ 	}
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * The kernel driver passes back mmap information for mapping the
++	 * QP work queue memory it allocated back into user space.  This is part
++	 * of the HCA generic data.
++	 */
++	mdd = (mlnx_umap_qp_data_out_t *) &resp.drv_out;
++	qpbuf = mmap64((void *)0, mdd->mqp_maplen,
++			PROT_READ|PROT_WRITE, MAP_SHARED,
++			pd->context->mmap_fd,
++			mdd->mqp_mapoffset);
++
++	if (qpbuf == MAP_FAILED) {
++		goto err_destroy;
++	}
++
++	/*
++	 * Calculate the official maximum inline data size, this is not done
++	 * by the kernel driver, so we do it here and update the qp struct.
++	 */
++	max_inline_data = mdd->mqp_sq_wqesz - sizeof(struct mthca_inline_seg);
++	max_inline_data -= sizeof(struct mthca_next_seg);
++
++	if (attr->qp_type == IBV_QPT_UD) {
++		if (mthca_is_memfree(pd->context)) {
++			max_inline_data -= sizeof(struct mthca_arbel_ud_seg);
++		} else {
++			max_inline_data -= sizeof(struct mthca_tavor_ud_seg);
++		}
++	} else {
++		max_inline_data -= sizeof(struct mthca_raddr_seg);
++	}
++	attr->cap.max_inline_data = max_inline_data;
++
++	qp->sq.max      = resp.max_send_wr;
++	qp->sq.max_gs   = resp.max_send_sge;
++	if (attr->srq) {
++		qp->rq.max      = 0;
++		qp->rq.max_gs   = 0;
++	} else {
++		qp->rq.max      = resp.max_recv_wr;
++		qp->rq.max_gs   = resp.max_recv_sge;
++	}
++
++	if (mthca_set_qp_buf(pd, qp, qpbuf, mdd->mqp_maplen,
++				mdd->mqp_rq_wqesz, mdd->mqp_rq_off,
++				mdd->mqp_sq_wqesz, mdd->mqp_sq_off)) {
++		goto err_destroy;
++	}
++
++	/*
++	 * Solaris clears the receive queue max work requests and max
++	 * scatter/gather entries when a SRQ is used since they are
++	 * ignored in that case.  To maintain consistency with what OFED
++	 * will return, we set them back to their requested values here.
++	 * Note that the SRQ values will be used by OFED as expected.
++	 */
++	if (attr->srq) {
++		resp.max_recv_wr   = attr->cap.max_recv_wr;
++		resp.max_recv_sge  = attr->cap.max_recv_sge;
++	}
++	mthca_init_qp_indices(qp);
++
++	if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) ||
++	    pthread_spin_init(&qp->rq.lock, PTHREAD_PROCESS_PRIVATE))
++		goto err_unmap;
++#endif
+ 	ret = mthca_store_qp(to_mctx(pd->context), qp->ibv_qp.qp_num, qp);
+ 	if (ret)
+ 		goto err_destroy;
+@@ -590,7 +959,23 @@
+ 
+ 	return &qp->ibv_qp;
+ 
++
++#if defined(__SVR4) && defined(__sun)
++err_unmap:
++	munmap(qp->buf.buf, qp->buf.length);
++	/*
++	 * 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.
++	 */
+ err_destroy:
++	pthread_mutex_init(&(qp->ibv_qp.mutex), NULL);
++	pthread_cond_init(&(qp->ibv_qp.cond), NULL);
++	qp->ibv_qp.events_completed = 0;
++#else
++err_destroy:
++#endif
+ 	ibv_cmd_destroy_qp(&qp->ibv_qp);
+ 
+ err_rq_db:
+@@ -605,13 +990,18 @@
+ 			      qp->sq.db_index);
+ 
+ err_unreg:
++#if !(defined(__SVR4) && defined(__sun))
+ 	mthca_dereg_mr(qp->mr);
+ 
+ err_free:
+ 	free(qp->wrid);
+ 	mthca_free_buf(&qp->buf);
+-
+ err:
++
++#else
++	if (qp->wrid)
++		free(qp->wrid);
++#endif
+ 	free(qp);
+ 
+ 	return NULL;
+@@ -618,16 +1008,31 @@
+ }
+ 
+ int mthca_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+-		   enum ibv_qp_attr_mask attr_mask,
++		   int attr_mask,
+ 		   struct ibv_qp_init_attr *init_attr)
+ {
+ 	struct ibv_query_qp cmd;
++#if defined(__SVR4) && defined(__sun)
++	int ret;
+ 
++	ret = ibv_cmd_query_qp(qp, attr, attr_mask, init_attr, &cmd,
++								sizeof cmd);
++	if (ret)
++		return (ret);
++	/*
++	 * Need to do this until solaris HCAs report max inline data on
++	 * QP creation.
++	 */
++	init_attr->cap.max_inline_data = to_mqp(qp)->max_inline_data;
++	attr->cap.max_inline_data = to_mqp(qp)->max_inline_data;
++	return (0);
++#else
+ 	return ibv_cmd_query_qp(qp, attr, attr_mask, init_attr, &cmd, sizeof cmd);
++#endif
+ }
+ 
+ int mthca_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+-		    enum ibv_qp_attr_mask attr_mask)
++		    int attr_mask)
+ {
+ 	struct ibv_modify_qp cmd;
+ 	int ret;
+@@ -715,10 +1120,17 @@
+ 			      to_mqp(qp)->sq.db_index);
+ 	}
+ 
+-	mthca_dereg_mr(to_mqp(qp)->mr);
+-	mthca_free_buf(&to_mqp(qp)->buf);
+-	free(to_mqp(qp)->wrid);
+-	free(to_mqp(qp));
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Unmap kernel allocated QP work queue memeory.
++	 */
++	munmap(to_mqp(qp)->buf.buf, to_mqp(qp)->buf.length);
++#else
++        mthca_dereg_mr(to_mqp(qp)->mr);
++        mthca_free_buf(&to_mqp(qp)->buf);
++#endif
++        free(to_mqp(qp)->wrid);
++        free(to_mqp(qp));
+ 
+ 	return 0;
+ }
+@@ -747,12 +1159,12 @@
+ 	return 0;
+ }
+ 
+-int mthca_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
++int mthca_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid)
+ {
+ 	return ibv_cmd_attach_mcast(qp, gid, lid);
+ }
+ 
+-int mthca_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
++int mthca_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid)
+ {
+ 	return ibv_cmd_detach_mcast(qp, gid, lid);
+ }
+diff -r -u /tmp/909901/libmthca-1.0.5/src/mthca.c libmthca-1.0.5/src/mthca.c
+--- /tmp/909901/libmthca-1.0.5/src/mthca.c	Sun Aug 30 06:43:15 2009
++++ libmthca-1.0.5/src/mthca.c	Fri Feb 11 04:07:29 2011
+@@ -35,6 +35,12 @@
+ #  include <config.h>
+ #endif /* HAVE_CONFIG_H */
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <inttypes.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -137,6 +143,11 @@
+ 	struct ibv_get_context           cmd;
+ 	struct mthca_alloc_ucontext_resp resp;
+ 	int                              i;
++#if defined(__SVR4) && defined(__sun)
++	pid_t                            cur_pid;
++	off64_t                          uarpg_offset;
++	int                              temp_qp_num;
++#endif
+ 
+ 	context = calloc(1, sizeof *context);
+ 	if (!context)
+@@ -144,10 +155,23 @@
+ 
+ 	context->ibv_ctx.cmd_fd = cmd_fd;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Need to set ibv_ctx.device because mthca_is_memfree() will
++	 * look at it to figure out the HCA type.
++	 */
++	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)
++	/* Expects power of two, round up */
++	for (temp_qp_num = 1; temp_qp_num< resp.qp_tab_size; temp_qp_num <<= 1)
++		;
++	resp.qp_tab_size = temp_qp_num;
++#endif
+ 	context->num_qps        = resp.qp_tab_size;
+ 	context->qp_table_shift = ffs(context->num_qps) - 1 - MTHCA_QP_TABLE_BITS;
+ 	context->qp_table_mask  = (1 << context->qp_table_shift) - 1;
+@@ -169,8 +193,22 @@
+ 	for (i = 0; i < MTHCA_QP_TABLE_SIZE; ++i)
+ 		context->qp_table[i].refcnt = 0;
+ 
++#if defined(__SVR4) && defined(__sun)
++	/*
++	 * Map the user access region page into process memory.
++	 */
++	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 | PROT_READ, 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_db_tab;
+ 
+diff -r -u /tmp/909901/libmthca-1.0.5/src/mthca.h libmthca-1.0.5/src/mthca.h
+--- /tmp/909901/libmthca-1.0.5/src/mthca.h	Tue May 27 13:32:43 2008
++++ libmthca-1.0.5/src/mthca.h	Tue May  3 13:50:07 2011
+@@ -208,6 +208,9 @@
+ 	struct mthca_buf buf;
+ 	uint64_t        *wrid;
+ 	int              send_wqe_offset;
++#if defined(__SVR4) && defined(__sun)
++	int              recv_wqe_offset;
++#endif
+ 	int              max_inline_data;
+ 	int              buf_size;
+ 	struct mthca_wq  sq;
+@@ -309,7 +312,7 @@
+ int mthca_free_pd(struct ibv_pd *pd);
+ 
+ struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
+-			    size_t length, enum ibv_access_flags access);
++			    size_t length, int access);
+ int mthca_dereg_mr(struct ibv_mr *mr);
+ 
+ struct ibv_cq *mthca_create_cq(struct ibv_context *context, int cqe,
+@@ -330,12 +333,18 @@
+ 				 struct ibv_srq_init_attr *attr);
+ int mthca_modify_srq(struct ibv_srq *srq,
+ 		     struct ibv_srq_attr *attr,
+-		     enum ibv_srq_attr_mask mask);
++		     int mask);
+ int mthca_query_srq(struct ibv_srq *srq,
+ 			   struct ibv_srq_attr *attr);
+ int mthca_destroy_srq(struct ibv_srq *srq);
++#if defined(__SVR4) && defined(__sun)
++int mthca_set_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
++                      struct mthca_srq *srq, void *srqbuf, uint64_t buflen,
++                      uint32_t srq_wqesz, uint32_t srq_numwqe);
++#else
+ int mthca_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
+ 			struct mthca_srq *srq);
++#endif
+ void mthca_free_srq_wqe(struct mthca_srq *srq, int ind);
+ int mthca_tavor_post_srq_recv(struct ibv_srq *ibsrq,
+ 			      struct ibv_recv_wr *wr,
+@@ -346,10 +355,10 @@
+ 
+ struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
+ int mthca_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+-		   enum ibv_qp_attr_mask attr_mask,
++		   int attr_mask,
+ 		   struct ibv_qp_init_attr *init_attr);
+ int mthca_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+-		    enum ibv_qp_attr_mask attr_mask);
++		    int attr_mask);
+ int mthca_destroy_qp(struct ibv_qp *qp);
+ void mthca_init_qp_indices(struct mthca_qp *qp);
+ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
+@@ -360,8 +369,14 @@
+ 			  struct ibv_send_wr **bad_wr);
+ int mthca_arbel_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
+ 			  struct ibv_recv_wr **bad_wr);
++#if defined(__SVR4) && defined(__sun)
++int mthca_set_qp_buf(struct ibv_pd *pd, struct mthca_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 mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
+ 		       enum ibv_qp_type type, struct mthca_qp *qp);
++#endif
+ struct mthca_qp *mthca_find_qp(struct mthca_context *ctx, uint32_t qpn);
+ int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn, struct mthca_qp *qp);
+ void mthca_clear_qp(struct mthca_context *ctx, uint32_t qpn);
+@@ -372,7 +387,7 @@
+ int mthca_alloc_av(struct mthca_pd *pd, struct ibv_ah_attr *attr,
+ 		   struct mthca_ah *ah);
+ void mthca_free_av(struct mthca_ah *ah);
+-int mthca_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
+-int mthca_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
++int mthca_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
++int mthca_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
+ 
+ #endif /* MTHCA_H */
+diff -r -u /tmp/909901/libmthca-1.0.5/src/qp.c libmthca-1.0.5/src/qp.c
+--- /tmp/909901/libmthca-1.0.5/src/qp.c	Sun Aug 30 06:43:15 2009
++++ libmthca-1.0.5/src/qp.c	Fri Feb 11 04:07:30 2011
+@@ -60,7 +60,11 @@
+ 
+ static void *get_recv_wqe(struct mthca_qp *qp, int n)
+ {
++#if defined(__SVR4) && defined(__sun)
++	return qp->buf.buf + qp->recv_wqe_offset + (n << qp->rq.wqe_shift);
++#else
+ 	return qp->buf.buf + (n << qp->rq.wqe_shift);
++#endif
+ }
+ 
+ static void *get_send_wqe(struct mthca_qp *qp, int n)
+@@ -387,6 +391,14 @@
+ 
+ 		qp->wrid[ind] = wr->wr_id;
+ 
++#if defined(__SVR4) && defined(__sun)
++		((struct mthca_next_seg *) prev_wqe)->nda_op =
++			htonl(((ind << qp->rq.wqe_shift) +
++			qp->recv_wqe_offset) | 1);
++#else
++		((struct mthca_next_seg *) prev_wqe)->nda_op =
++			htonl((ind << qp->rq.wqe_shift) | 1);
++#endif
+ 		((struct mthca_next_seg *) prev_wqe)->ee_nds =
+ 			htonl(MTHCA_NEXT_DBD | size);
+ 
+@@ -401,7 +413,12 @@
+ 		if (nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
+ 			nreq = 0;
+ 
++#if defined(__SVR4) && defined(__sun)
++			doorbell[0] = htonl(((qp->rq.next_ind << qp->rq.wqe_shift) +
++			                    qp->recv_wqe_offset) | size0);
++#else
+ 			doorbell[0] = htonl((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
++#endif
+ 			doorbell[1] = htonl(ibqp->qp_num << 8);
+ 
+ 			/*
+@@ -420,7 +437,12 @@
+ 
+ out:
+ 	if (nreq) {
++#if defined(__SVR4) && defined(__sun)
++		doorbell[0] = htonl(((qp->rq.next_ind << qp->rq.wqe_shift) +
++		                    qp->recv_wqe_offset) | size0);
++#else
+ 		doorbell[0] = htonl((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
++#endif
+ 		doorbell[1] = htonl((ibqp->qp_num << 8) | nreq);
+ 
+ 		/*
+@@ -777,6 +799,81 @@
+ 	return ret;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++
++int mthca_set_qp_buf(struct ibv_pd *pd, struct mthca_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->wrid = malloc((qp->rq.max + qp->sq.max) * sizeof(uint64_t));
++        if (!qp->wrid) {
++                return -1;
++        }
++
++        for (qp->rq.wqe_shift = 6; 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->send_wqe_offset = sq_off;
++        qp->recv_wqe_offset = rq_off;
++
++        if (qp->recv_wqe_offset < qp->send_wqe_offset) {
++                qp->buf_size =
++		    qp->send_wqe_offset + (qp->sq.max << qp->sq.wqe_shift);
++        } else {
++                qp->buf_size =
++		    qp->recv_wqe_offset + (qp->rq.max << qp->rq.wqe_shift);
++        }
++
++        if ((long int)qp->buf.length < (long int)qp->buf_size) {
++                fprintf(stderr, "warning kernel buf size %d < user buf size "
++		    "%d\n", (int)qp->buf.length, qp->buf_size);
++        }
++
++        memset(qp->buf.buf, 0, qp->buf_size);
++
++	if (mthca_is_memfree(pd->context)) {
++		struct mthca_next_seg *next;
++		struct mthca_data_seg *scatter;
++		int i;
++		uint32_t sz;
++
++		sz = htonl((sizeof (struct mthca_next_seg) +
++		    qp->rq.max_gs * sizeof (struct mthca_data_seg)) / 16);
++
++		for (i = 0; i < qp->rq.max; ++i) {
++			next = get_recv_wqe(qp, i);
++			next->nda_op = htonl(((i + 1) & (qp->rq.max - 1)) <<
++					     qp->rq.wqe_shift);
++			next->ee_nds = sz;
++
++			for (scatter = (void *) (next + 1);
++			    (void *) scatter < (void *) next +
++			    (1 << qp->rq.wqe_shift); ++scatter)
++				scatter->lkey = htonl(MTHCA_INVAL_LKEY);
++		}
++
++		for (i = 0; i < qp->sq.max; ++i) {
++			next = get_send_wqe(qp, i);
++			next->nda_op = htonl((((i + 1) & (qp->sq.max - 1)) <<
++					      qp->sq.wqe_shift) +
++					     qp->send_wqe_offset);
++		}
++	}
++
++	qp->sq.last = get_send_wqe(qp, qp->sq.max - 1);
++	qp->rq.last = get_recv_wqe(qp, qp->rq.max - 1);
++	return 0;
++}
++#else
+ int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
+ 		       enum ibv_qp_type type, struct mthca_qp *qp)
+ {
+@@ -895,6 +992,7 @@
+ 
+ 	return 0;
+ }
++#endif
+ 
+ struct mthca_qp *mthca_find_qp(struct mthca_context *ctx, uint32_t qpn)
+ {
+diff -r -u /tmp/909901/libmthca-1.0.5/src/cq.c libmthca-1.0.5/src/cq.c
+--- /tmp/909901/libmthca-1.0.5/src/cq.c	Sun Aug 30 06:43:15 2009
++++ libmthca-1.0.5/src/cq.c	Fri Feb 11 04:07:29 2011
+@@ -351,7 +351,11 @@
+ 		int32_t wqe;
+ 		wq = &(*cur_qp)->rq;
+ 		wqe = ntohl(cqe->wqe);
++#if defined(__SVR4) && defined(__sun)
++		wqe_index = ((ntohl(cqe->wqe) - (*cur_qp)->recv_wqe_offset) >> wq->wqe_shift);
++#else
+ 		wqe_index = wqe >> wq->wqe_shift;
++#endif
+ 		/*
+ 		 * WQE addr == base - 1 might be reported by Sinai FW
+ 		 * 1.0.800 and Arbel FW 5.1.400 in receive completion
+@@ -622,10 +626,15 @@
+ {
+ 	int i;
+ 
++#if !(defined(__SVR4) && defined(__sun))
++	/*
++	 * Memory allocated by kernel for Solaris
++	 */
+ 	if (mthca_alloc_buf(buf, align(nent * MTHCA_CQ_ENTRY_SIZE, dev->page_size),
+ 		    dev->page_size))
+ 		return -1;
+ 
++#endif
+ 	for (i = 0; i < nent; ++i)
+ 		((struct mthca_cqe *) buf->buf)[i].owner = MTHCA_CQ_ENTRY_OWNER_HW;
+ 
+diff -r -u /tmp/909901/libmthca-1.0.5/src/mthca-abi.h libmthca-1.0.5/src/mthca-abi.h
+--- /tmp/909901/libmthca-1.0.5/src/mthca-abi.h	Tue May 27 13:32:43 2008
++++ libmthca-1.0.5/src/mthca-abi.h	Tue May  3 13:50:07 2011
+@@ -35,6 +35,9 @@
+ #define MTHCA_ABI_H
+ 
+ #include <infiniband/kern-abi.h>
++#if defined(__SVR4) && defined(__sun)
++#include <sys/ib/adapters/mlnx_umap.h>
++#endif
+ 
+ #define MTHCA_UVERBS_ABI_VERSION	1
+ 
+diff -r -u /tmp/909901/libmthca-1.0.5/Makefile.am libmthca-1.0.5/Makefile.am
+--- /tmp/909901/libmthca-1.0.5/Makefile.am	Sun Aug 30 06:43:15 2009
++++ libmthca-1.0.5/Makefile.am	Fri Feb 11 04:07:23 2011
+@@ -10,7 +10,7 @@
+     src_libmthca_la_SOURCES = $(MTHCA_SOURCES)
+     src_libmthca_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
+         $(mthca_version_script)
+-    mthcaconfdir = $(sysconfdir)/libibverbs.d
++    mthcaconfdir = $(datadir)/libibverbs.d
+     mthcaconf_DATA = mthca.driver
+ else
+     mthcalibdir = $(libdir)/infiniband
+diff -r -u /tmp/909901/libmthca-1.0.5/Makefile.in libmthca-1.0.5/Makefile.in
+--- /tmp/909901/libmthca-1.0.5/Makefile.in	Sun Aug 30 06:43:33 2009
++++ libmthca-1.0.5/Makefile.in	Fri Feb 11 04:07:24 2011
+@@ -57,7 +57,7 @@
+ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(mthcalibdir)" \
+ 	"$(DESTDIR)$(mthcaconfdir)"
+-libLTLIBRARIES_INSTALL = $(INSTALL)
++libLTLIBRARIES_INSTALL = $(INSTALL) -m 755
+ mthcalibLTLIBRARIES_INSTALL = $(INSTALL)
+ LTLIBRARIES = $(lib_LTLIBRARIES) $(mthcalib_LTLIBRARIES)
+ src_libmthca_la_LIBADD =
+@@ -235,7 +235,7 @@
+ @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@src_libmthca_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
+ @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@        $(mthca_version_script)
+ 
+-@HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mthcaconfdir = $(sysconfdir)/libibverbs.d
++@HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mthcaconfdir = $(datadir)/libibverbs.d
+ @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@mthcaconf_DATA = mthca.driver
+ @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@mthcalibdir = $(libdir)/infiniband
+ @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@mthcalib_LTLIBRARIES = src/mthca.la
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,72 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		librdmacm
+COMPONENT_VERSION=	1.0.14.1
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:fbb6e1daea52194482913e6971700b79f7ebade1
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/rdmacm/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS += -libverbs -lsocket -lnsl
+
+CLEANUP_FILES =\
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man1/rdma_server.1\
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man1/rdma_client.1\
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man3/rdma_set_option.3\
+	$(PROTOUSRBINDIR)/rdma_server\
+	$(PROTOUSRBINDIR)/rdma_client\
+	$(PROTOUSRBINDIR)/$(MACH64)/rdma_server\
+	$(PROTOUSRBINDIR)/$(MACH64)/rdma_client\
+	$(PROTOUSRBINDIR)/$(MACH64)/mckey\
+	$(PROTOUSRBINDIR)/$(MACH64)/rping\
+	$(PROTOUSRBINDIR)/$(MACH64)/udaddy\
+	$(PROTOUSRBINDIR)/$(MACH64)/ucmatose\
+	$(PROTOUSRINCDIR)/infiniband/ib.h\
+	$(PROTOUSRINCDIR)/rdma/rdma_cma_abi.h\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la
+	
+COMPONENT_PREP_ACTION = \
+	$(TOUCH) $(COMPONENT_SRC)/Makefile.in
+
+COMPONENT_POST_INSTALL_ACTION = \
+	$(RM) $(CLEANUP_FILES);
+
+#COMPONENT_PRE_CONFIGURE_ACTION
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/librdmacm/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,496 @@
+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)
+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,15 @@
+ #include <poll.h>
+ #include <unistd.h>
+ #include <pthread.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #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>
+@@ -354,9 +357,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;
+@@ -1186,6 +1198,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 +1803,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) {
+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_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.
+@@ -63,12 +63,7 @@
+ .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 +173,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 +188,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/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 May 25 14:46:30 2011
+@@ -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/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,72 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libsdp
+COMPONENT_VERSION=	1.1.108
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.15.gd7fdb72.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:95b056c499dec6af17696f3f1b40338f30b4046c
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/libsdp/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+MAN3FILES = libsdp.3lib
+MAN4FILES = libsdp.conf.4
+
+include $(WS_TOP)/make-rules/shared-targets.mk
+
+SUFFIX.64 = $(MACH64)
+
+CFLAGS += -D_POSIX_PTHREAD_SEMANTICS
+
+LIBS += -lsocket -lnsl
+
+CONFIGURE_OPTIONS += --sysconfdir=/etc
+CONFIGURE_OPTIONS += --libdir=/usr/lib/secure/$(SUFFIX.$(BITS))
+
+CLEANUP_DIRS =	$(PROTOUSRBINDIR)/linux
+CLEANUP_FILES =\
+	$(PROTO_DIR)/$(CONFIGURE_PREFIX)/lib/secure/$(COMPONENT_NAME).la\
+	$(PROTO_DIR)/$(CONFIGURE_PREFIX)/lib/secure/$(MACH64)/$(COMPONENT_NAME).la\
+
+COMPONENT_PREP_ACTION = \
+	$(MKDIR) $(@D)/man ; \
+	cp manpages/$(MAN3FILES) manpages/$(MAN4FILES) $(@D)/man ; \
+
+COMPONENT_POST_INSTALL_ACTION=\
+	$(RM) $(CLEANUP_FILES);\
+	$(RM) $(CLEANUP_DIRS)
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsdp/manpages/libsdp.3lib	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,103 @@
+'\" te
+.TH libsdp 3LIB " Sep 20, 2010"
+.SH "NAME"
+libsdp - Sockets Direct Protocol library 
+.PP
+.SH DESCRIPTION
+.PP
+
+libsdp is a LD_PRELOAD-able library that can be used to migrate existing
+applications use InfiniBand Sockets Direct Protocol (SDP) instead of
+TCP sockets, transparently and without recompilations. To setup libsdp
+please follow the instructions below.
+
+.PP
+.SS SETUP
+libsdp.so isn't setup automatically. it can be used in one of 2 ways:
+
+.TP
+\fB\1)
+LD_PRELOAD environment variable. Setting this to the name of the library you
+want to use will cause it to be preloaded.
+.TP
+\fB\2)
+Adding the name of the library  using crle(1).
+.PP
+
+The library should be installed in a directory in which the dynamic loader
+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.
+
+If you have multiple library versions (e.g. 64/32 bit) and want the linker to
+select between them automatically. This done for eample using LD_LIBRARY_PATH
+to point to both the lib (the 32 bit version) and lib/64 directories and
+LD_RELOAD the libsdp.so. This way the correct 32/64bit libsdp.so will be
+selected. For example using bash this can be written:
+.PP
+LD_LIBRARY_PATH=/usr/lib/secure/64/:/usr/lib/secure LD_PRELOAD=libsdp.so ssh
+.RE
+.PP
+.SS CONFIGURATION
+libsdp supports two modes of configuration:
+.TP
+\fB\1)
+simple operation where it converts all calls to socket(2) with a family
+of AF_INET(6) and a type of SOCK_STREAM into family of AF_INET_SDP.
+.TP
+\fB\2)
+selective mode where it uses a configuration file to select which sockets
+will be using SDP and which will not.
+.PP
+ 
+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.)
+.PP
+
+For real world applications where communication with X, authentication,
+DNS and other servers connected through TCP is required the selective mode
+is required. Simple mode will be selected in one of the following conditions: 
+.PP
+.TP
+\fB\1)
+The environment variable SIMPLE_LIBSDP to a non-empty value
+.TP
+\fB\2)
+No configuration file is defined or is un-readble
+.TP
+\fB\3)
+The configuration file does not include any address family rule
+For information on how to configure libsdp, see libsdp.conf(4), installed
+in /etc/libsdp.conf  The user can further control the file to be used for
+configuration by setting the environment variable: LIBSDP_CONFIG_FILE
+.SH FILES
+.sp
+.ne 2
+.mk
+.na
+\fB\fB/usr/lib/secure/libsdp.so\fR\fR
+.ad
+.RS 30n
+.rt
+shared object
+.RE
+.ne 2
+.mk
+.na
+\fB\fB/usr/lib/secure/64/libsdp.so\fR\fR
+.ad
+.RS 30n
+.rt
+64 bit shared object
+.RE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBsocket(3SOCKET), \fBcrel(1), \fBattributes\fR(5), \fBlibsdp.conf(4)
+.SH NOTES
+.sp
+.LP
+Non-blocking connect in "both" mode defaults to SDP. Specific rules might be
+needed for applications to operate properly.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsdp/manpages/libsdp.conf.4	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,310 @@
+'\" te
+.TH libsdp.conf 4 "20 Jun 2010"
+.SH NAME
+libsdp.conf \- configuration file for libsdp(3LIB) 
+.SH SYNOPSIS
+.LP
+.nf
+/etc/libsdp.conf
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The \fB/etc/libsdp.conf\fR file is the configuration file for libsdp(3LIB), and is used to select which sockets will be using SDP and which will not.
+There are 2 main types of statements supported by this configuration file:
+.TP
+\fB\ "use")
+which defines the address family to be used for the sockets that match the line
+.TP
+\fB\ "log")
+for setting logging related configuration. As the log settings takes immidiate effect we define these at the beggining of the file.
+
+.SH DEAFUALT SETTINGS:
+Get errors printed into the files /tmp/libsdp.log.<uid>
+or /var/log/<filename> for root:
+.sp
+.in +2
+.nf
+
+log min-level 9 destination file libsdp.log
+.fi
+.in -2
+
+By default we let all servers and client try SDP first.
+to exclude SDP add "use tcp" rules before these defaults.
+.sp
+.in +2
+.nf
+use both server * *:*
+use both client * *:*
+.fi
+.in -2
+
+.SS LOG CONFIGURATION:
+The log directive allows the user to specify which and where debug and error
+messages get sent. The log statement format is:
+.sp
+.in +2
+.nf
+log [destination stderr|syslog|file <filename>] [min-level <1-9>]
+.fi
+.in -2
+.sp
+.LP
+The fields are defined as follows:
+.sp
+.ne 2
+.mk
+.na
+\fB\fIdestination\fR\fR
+.ad
+.sp .6
+.RS 4n
+defines the destination of the log messages:
+.TP 5
+\fB\ "stderr")
+messages will be forwarded to the stderr
+
+.TP 5
+\fB\ "syslog")
+messages sent to the  syslog  service
+
+.TP 5
+\fB\ "file <filename>")
+messages will be written to the file /var/log/<filename> for root.
+for regular user, if full path is requsted <filename with path>.<uid>
+or /tmp/<filename>.<uid> if no path is requested
+.RE
+.ne 2
+.mk
+.na
+\fB\fImin-level\fR\fR
+.ad
+.sp .6
+.RS 4n
+defines the verbosity of the log:
+.TP 5
+\fB\9)
+only errors are printed
+.TP 5
+\fB\8)
+warnings
+.TP 5
+\fB\7)
+connect and listen summary (useful for tracking SDP usage)
+.TP 5
+\fB\4)
+positive match summary (useful for config file debug)
+.TP 5
+\fB\3)
+negative match summary (useful for config file debug)
+.TP 5
+\fB\2)
+function calls and return values
+.TP 5
+\fB\1)
+debug messages
+
+.SH SOCKET ADDRESS FAMILY CONTROL
+
+The socket control statements allows the user to specify when libsdp will
+replace AF_INET_SDP/SOCK_STREAM sockets with AF_SDP/SOCK_STREAM
+sockets. Each control statement specifies a matching rule that all its
+subexpressions must evaluate as true (logical and) to apply.
+.PP
+The statements that control which type of sockets to open are made
+of the following:
+
+.sp
+.in +2
+.nf
+use <address-family> <role> <program name> <address|*>:<port range|*>
+.fi
+.in -2
+.PP
+where
+
+.ne 2
+.mk
+.na
+\fB\fI<address-family>\fR\fR
+.ad
+.sp .6
+.RS 4n
+can be one of:
+.TP 5
+\fB\ "sdp")
+for specifying when an SDP should be used
+.TP 5
+\fB\ "tcp")
+for specifying when SDP socket should not be matched
+.TP 5
+\fB\ "both")
+for specifying when both SDP and AF_INET sockets should be used.
+.PP
+Note: that "both" semantics is different between "server" and "client" roles:
+For a "server" is means that the server will be listening on both sdp and tcp
+For a "client" the connect will prefer using sdp but will silently
+fall back to tcp if the sdp connection failed.
+.RE
+
+.ne 2
+.mk
+.na
+\fB\fI<role>\fR\fR
+.ad
+.sp .6
+.RS 4n
+can be one of:
+.TP 5
+\fB\ "server" or "listen")
+for defining the listening port address family
+.TP 5
+\fB\ "client" or "connect")
+for defining the connected port address family
+.RE
+
+
+.ne 2
+.mk
+.na
+\fB\fI<program-name|*>\fR\fR
+.ad
+.sp .6
+.RS 4n
+Defines the program name (not including the path) the rule applies to.
+Wildcards with same semantics as "ls" are supported (* and ?).
+So db2* would match on any program with a name starting with db2.
+t?cp would match on ttcp, etc.
+If not provided (default) the statement matches all programs.
+.RE
+
+.ne 2
+.mk
+.na
+\fB\fI<address|*>\fR\fR
+.ad
+.sp .6
+.RS 4n
+Either the local address the server is bound to or the remote server
+address the client connects to. Syntax for address matching is:
+.PP
+<IPv4 address>[/<prefix_length>]|*
+.PP
+IPv4 address = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ each sub number < 255
+.PP
+prefix_length = [0-9]+ and with value <= 32. A prefix_length of 24
+matches the subnet mask 255.255.255.0 . A prefix_length of 32
+requires matching of the exact IP.
+.RE
+
+.ne 2
+.mk
+.na
+\fB\fI<port range>\fR\fR
+.ad
+.sp .6
+.RS 4n
+start-port[-end-port] where port numbers are >0 and < 65536
+.RE
+.PP
+Rules are evaluated in order of definition. So the first match wins.
+If no match is made libsdp will default to "both".
+.SH EXAMPLES
+.HP
+LOG CONFIGURATION:
+.Br
+.br
+.PP
+.LP
+
+
+.TP 1
+\fB\ Example 1:
+Get SDP usage per connect and listen into stderr
+.sp
+.in +5
+log min-level 7 destination stderr
+.nf
+.in -5
+
+.TP 1
+\fB\ Example 2:
+Send errors only into syslog
+.sp
+.in +5
+log min-level 9 destination syslog
+.nf
+.in -5
+.RE
+
+.HP
+SOCKET ADDRESS FAMILY CONTROL
+
+.TP 1
+\fB\ Example 1:
+Use SDP by clients connecting to machines that belongs to subnet 192.168.1.*
+.sp
+.in +5
+.nf
+#   family role    program   address:port[-range]
+use sdp    connect *         192.168.1.0/24:*
+.in -5
+
+.TP 1
+\fB\ Example 2:
+Use SDP by ttcp when it connects to port 5001 of any machine
+.sp
+.in +5
+.nf
+#   family role    program   address:port[-range]
+use sdp    listen  ttcp      *:5001
+.in -5
+
+.TP 1
+\fB\ Example 3:
+Use TCP for any program with name starting with ttcp* serving ports 22 to
+25
+.sp
+.in +5
+.nf
+#   family role    program   address:port[-range]
+use tcp    server  ttcp*     *:22-25
+.in -5
+
+.TP 1
+\fB\ Example 4:
+Listen on both TCP and SDP by any server that listen on port 8080
+.sp
+.in +5
+.nf
+#   family role    program   address:port[-range]
+use both   server  *         *:8080
+.in -5
+
+.TP 1
+\fB\ Example 5:
+Connect ssh through SDP and fallback to TCP to hosts on 11.4.8.* port 22
+.sp
+.in +5
+.nf
+#   family role    program   address:port[-range]
+use both   connect *         11.4.8.0/24:22
+.in -5
+
+.RE
+.PP
+
+NOTE: If all "use" rules are commented SDP will take "simple SDP"
+mode and use SDP for all connections
+
+ 
+.RE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBlibsdp\fR(3LIB), \fBattributes\fR(5)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsdp/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1011 @@
+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)$(man4dir)"
++man3libdir = $(mandir)/man3lib
++man4dir = $(mandir)/man4
++NROFF = nroff
++man_MANS = man/libsdp.3lib man/libsdp.conf.4
++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.4
+ all: config.h
+ 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+ 
+@@ -252,6 +253,96 @@
+ distclean-libtool:
+ 	-rm -f libtool
+ uninstall-info-am:
++install-man4: $(man4_MANS) $(man_MANS)
++	@$(NORMAL_INSTALL)
++	test -z "$(man4dir)" || $(mkdir_p) "$(DESTDIR)$(man4dir)"
++	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.4*) 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 \
++	    4*) ;; \
++	    *) ext='4' ;; \
++	  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)$(man4dir)/$$inst'"; \
++	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man4dir)/$$inst"; \
++	done
++uninstall-man4:
++	@$(NORMAL_UNINSTALL)
++	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
++	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
++	for i in $$l2; do \
++	  case "$$i" in \
++	    *.4*) list="$$list $$i" ;; \
++	  esac; \
++	done; \
++	for i in $$list; do \
++	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
++	  case "$$ext" in \
++	    4*) ;; \
++	    *) ext='4' ;; \
++	  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)$(man4dir)/$$inst'"; \
++	  rm -f "$(DESTDIR)$(man4dir)/$$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)$(man4dir)"; 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-man4 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-man4 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-man4 \
++	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-man4
+ 
+ 
+ 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)/man4 && \
++	$(RM) libssdp.conf.4
+ # 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:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/ofed.mk	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,65 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+# Since we are building these as a set and not packaging them individually at
+# this time, each OFED component should install in a common prototype directory
+# so we override PROTO_DIR
+PROTO_DIR = $(WS_COMPONENTS)/open-fabrics/prototype/$(MACH)
+
+# OFED only builds with GCC
+COMPILER=gcc
+
+CPPFLAGS += "-Wformat=2"
+CFLAGS += -D_REENTRANT
+
+# Since we are not currently packaging the various OFED components separately
+# and we still need headers and to link with the components that we are
+# building, we need to point the compiler and linker at a common proto area
+# for OFED component headers and libraries.
+SHARED_INCLUDES += -I$(PROTO_DIR)/usr/include
+
+# We need to insert the shared "proto" area include directories at the front
+# of any compile line to preempt the system headers.  It seems that the "best"
+# way to do this is to augment the C/C++ compiler macros. YUCK!!!!
+CC += $(SHARED_INCLUDES)
+CXX += $(SHARED_INCLUDES)
+
+
+# This is generally required, but must be overridable
+DISABLE_LIBCHECK =	--disable-libcheck
+
+CONFIGURE_ENV +=	CFLAGS="$(CFLAGS)"
+CONFIGURE_ENV +=	LD_OPTIONS="-R$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))"
+
+COMPONENT_INSTALL_ENV +=	LDFLAGS="-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))"
+
+COMPONENT_BUILD_ENV +=	CPPFLAGS="$(CPPFLAGS)"
+COMPONENT_BUILD_ENV +=	LIBS="$(LIBS)"
+COMPONENT_BUILD_ENV +=	LDFLAGS="-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS)) $(LIBS)"
+
+COMPONENT_BUILD_ARGS +=	LDFLAGS="-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS)) $(LIBS)"
+
+CONFIGURE_OPTIONS +=	--disable-static
+CONFIGURE_OPTIONS +=	$(DISABLE_LIBCHECK)
+
+CLEAN_PATHS += $(BUILD_DIR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/open-fabrics.license	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,3282 @@
+DO NOT TRANSLATE OR LOCALIZE.
+
+Oracle elects to use this software under and governed by the  OpenIB.org BSD
+license (see below for details) for any software where a choice of
+OpenIB.org BSD license or the GNU General Public License (GPL) Version 2 are
+made available with the language indicating that OpenIB.org BSD license or the
+GNU General Public License (GPL) Version 2 may be used.  Unless specifically
+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
+
+
+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.
+
+
+* 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.
+
+libmthca-1.0.5:
+
+In accordance with the terms of the Open Fabric Enterprise Distribution
+licensing scheme as appears below, Oracle is hereby making the election to
+license libmthca-1.0.5 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 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.
+
+==================================================================
+
+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
+
+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.
+
+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.
+
+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
+
+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.
+
+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) 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.
+
+
+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, 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.
+
+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.
+
+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.
+
+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.
+
+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.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/open-fabrics.p5m	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,413 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+
+set name=pkg.fmri \
+    value=pkg:/network/open-fabrics@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary \
+    value="Oracle Solaris OpenFabrics userland libraries and applications"
+set name=info.classification \
+    value="org.opensolaris.category.2008:System/Administration and Configuration"
+set name=info.upstream_url value=http://ant.apache.org
+set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
+set name=opensolaris.arc_url value=htp://arc.opensolaris.org/caselog/PSARC/2010/346
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+set name=variant.opensolaris.zone value=global value=nonglobal
+
+#depend fmri=runtime/perl-512 type=require
+#depend fmri=runtime/tcl-8 type=require
+#depend fmri=shell/bash type=require
+legacy pkg=SUNWofusr \
+    name="Oracle Solaris OpenFabrics userland libraries and applications" \
+    desc="Oracle Solaris OpenFabrics userland libraries and applications"
+
+dir path=etc
+dir path=usr
+dir path=usr/bin
+dir path=usr/bin/$(MACH64)
+dir path=usr/include
+dir path=usr/include/infiniband
+dir path=usr/include/rdma
+dir path=usr/lib
+dir path=usr/lib/amd64
+dir path=usr/lib/ibdiagnet1.5.7 variant.opensolaris.zone=global
+dir path=usr/lib/ibdm1.5.7 variant.opensolaris.zone=global
+dir path=usr/lib/ibdm1.5.7/ibnl variant.opensolaris.zone=global
+dir path=usr/lib/ibis1.5.7 variant.opensolaris.zone=global
+dir path=usr/lib/secure
+dir path=usr/lib/secure/$(MACH64)
+dir path=usr/lib/$(MACH64)
+dir path=usr/sbin
+dir path=usr/sbin/$(MACH64)
+dir path=usr/share
+dir path=usr/share/libibverbs.d
+dir path=usr/share/man
+dir path=usr/share/man/man1
+dir path=usr/share/man/man1m variant.opensolaris.zone=global
+dir path=usr/share/man/man3 variant.opensolaris.zone=global
+dir path=usr/share/man/man3lib variant.opensolaris.zone=global
+dir path=usr/share/man/man4 variant.opensolaris.zone=global
+dir path=usr/share/man/man7 variant.opensolaris.zone=global
+dir path=usr/perl5/site_perl/5.12/i86pc-solaris-64int variant.arch=i386 variant.opensolaris.zone=global
+dir path=usr/perl5/site_perl/5.12/sun4-solaris-64int variant.arch=sparc variant.opensolaris.zone=global
+file path=usr/perl5/site_perl/5.12/i86pc-solaris-64int/IBswcountlimits.pm variant.arch=i386 group=root mode=0444 variant.opensolaris.zone=global
+file path=usr/perl5/site_perl/5.12/sun4-solaris-64int/IBswcountlimits.pm variant.arch=sparc group=root mode=0444 variant.opensolaris.zone=global
+file path=etc/libsdp.conf mode=0644 preserve=renameold
+file path=usr/bin/$(MACH64)/ib_clock_test
+file path=usr/bin/$(MACH64)/ib_read_bw
+file path=usr/bin/$(MACH64)/ib_read_lat
+file path=usr/bin/$(MACH64)/ib_send_bw
+file path=usr/bin/$(MACH64)/ib_send_lat
+file path=usr/bin/$(MACH64)/ib_write_bw
+file path=usr/bin/$(MACH64)/ib_write_bw_postlist
+file path=usr/bin/$(MACH64)/ib_write_lat
+file path=usr/bin/$(MACH64)/qperf
+file path=usr/bin/$(MACH64)/rdma_bw
+file path=usr/bin/$(MACH64)/rdma_lat
+file path=usr/bin/$(MACH64)/rds-info
+file path=usr/bin/$(MACH64)/rds-ping
+file path=usr/bin/$(MACH64)/rds-stress
+file path=usr/bin/ib_clock_test
+file path=usr/bin/ib_read_bw
+file path=usr/bin/ib_read_lat
+file path=usr/bin/ib_send_bw
+file path=usr/bin/ib_send_lat
+file path=usr/bin/ib_write_bw
+file path=usr/bin/ib_write_bw_postlist
+file path=usr/bin/ib_write_lat
+file path=usr/bin/ibv_asyncwatch
+file path=usr/bin/ibv_devices
+file path=usr/bin/ibv_devinfo variant.opensolaris.zone=global
+file path=usr/bin/ibv_rc_pingpong
+file path=usr/bin/ibv_srq_pingpong
+file path=usr/bin/ibv_ud_pingpong
+file path=usr/bin/mckey
+file path=usr/bin/qperf
+file path=usr/bin/rdma_bw
+file path=usr/bin/rdma_lat
+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
+file path=usr/include/infiniband/arch.h variant.opensolaris.zone=global
+file path=usr/include/infiniband/driver.h variant.opensolaris.zone=global
+file path=usr/include/infiniband/kern-abi.h variant.opensolaris.zone=global
+file path=usr/include/infiniband/ofa_solaris.h variant.opensolaris.zone=global
+file path=usr/include/infiniband/sa.h variant.opensolaris.zone=global
+file path=usr/include/infiniband/verbs.h variant.opensolaris.zone=global
+file path=usr/include/rdma/rdma_cma.h variant.opensolaris.zone=global
+file path=usr/include/rdma/rdma_verbs.h variant.opensolaris.zone=global
+file path=usr/lib/$(MACH64)/libibmad.so.5.1.2 variant.opensolaris.zone=global
+file path=usr/lib/$(MACH64)/libibumad.so.3.0.2
+file path=usr/lib/$(MACH64)/libibverbs.so.1.0.0
+file path=usr/lib/$(MACH64)/libmlx4-rdmav2.so
+file path=usr/lib/$(MACH64)/libmthca-rdmav2.so
+file path=usr/lib/$(MACH64)/libopensm.so.4.0.2 variant.opensolaris.zone=global
+file path=usr/lib/$(MACH64)/libosmcomp.so.3.0.4 variant.opensolaris.zone=global
+file path=usr/lib/$(MACH64)/libosmvendor.so.3.0.5 variant.opensolaris.zone=global
+file path=usr/lib/$(MACH64)/librdmacm.so.1.0.0
+file path=usr/lib/ibdiagnet1.5.7/git_version.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibdiagnet1.5.7/ibdebug_if.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibdiagnet1.5.7/ibdebug.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibdiagnet1.5.7/ibdiagnet.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibdiagnet1.5.7/pkgIndex.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Buffalo.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Buffalo8.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Cheetah.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Cougar.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Eagle.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/FullGnu.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Gazelle.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Gnu.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/IS4_NATIVE.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/IS5100.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/IS5200.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/IS5300.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/Lion.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/LionMini.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MIS5600.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS14400-48.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS14400-DDR.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS14400-IntraDDR.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS14400.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS2400-12T4.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS2400-24.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS3600.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/MTS3610.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/PartialGazelle.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/RhinoBased512.lst variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/RhinoBased512.no_sp2-3.lst variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/RhinoBased512.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SingleGazelle.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SingleRhino.topo variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/subnet.lst variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SUNBQNEM48.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SUNDCS36QDR.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SUNDCS648QDR.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/ibnl/SUNDCS72QDR.ibnl variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/libibdm.so.1.5.7 variant.opensolaris.zone=global
+file path=usr/lib/ibdm1.5.7/pkgIndex.tcl variant.opensolaris.zone=global
+file path=usr/lib/ibis1.5.7/libibis.so.1.5.7 variant.opensolaris.zone=global
+file path=usr/lib/ibis1.5.7/pkgIndex.tcl variant.opensolaris.zone=global
+file path=usr/lib/libibmad.so.5.1.2 variant.opensolaris.zone=global
+file path=usr/lib/libibnetdisc.so.5.0.1 variant.opensolaris.zone=global
+file path=usr/lib/libibumad.so.3.0.2
+file path=usr/lib/libibverbs.so.1.0.0
+file path=usr/lib/libmlx4-rdmav2.so
+file path=usr/lib/libmthca-rdmav2.so
+file path=usr/lib/libopensm.so.4.0.2 variant.opensolaris.zone=global
+file path=usr/lib/libosmcomp.so.3.0.4 variant.opensolaris.zone=global
+file path=usr/lib/libosmvendor.so.3.0.5 variant.opensolaris.zone=global
+file path=usr/lib/librdmacm.so.1.0.0
+file path=usr/lib/secure/$(MACH64)/libsdp.so.1.0.0
+file path=usr/lib/secure/libsdp.so.1.0.0
+file path=usr/sbin/dump2psl.pl variant.opensolaris.zone=global
+file path=usr/sbin/dump2slvl.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibaddr variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckerrors variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckerrs variant.opensolaris.zone=global
+file path=usr/sbin/ibchecknet variant.opensolaris.zone=global
+file path=usr/sbin/ibchecknode variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckport variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckportstate variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckportwidth variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckstate variant.opensolaris.zone=global
+file path=usr/sbin/ibcheckwidth variant.opensolaris.zone=global
+file path=usr/sbin/ibclearcounters variant.opensolaris.zone=global
+file path=usr/sbin/ibclearerrors variant.opensolaris.zone=global
+file path=usr/sbin/ibdatacounters variant.opensolaris.zone=global
+file path=usr/sbin/ibdatacounts variant.opensolaris.zone=global
+file path=usr/sbin/ibdiagnet variant.opensolaris.zone=global
+file path=usr/sbin/ibdiscover.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibhosts variant.opensolaris.zone=global
+file path=usr/sbin/ibis variant.opensolaris.zone=global
+file path=usr/sbin/iblinkinfo variant.opensolaris.zone=global
+file path=usr/sbin/iblinkinfo.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibnetdiscover variant.opensolaris.zone=global
+file path=usr/sbin/ibnodes variant.opensolaris.zone=global
+file path=usr/sbin/ibping variant.opensolaris.zone=global
+file path=usr/sbin/ibportstate variant.opensolaris.zone=global
+file path=usr/sbin/ibprintca.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibprintrt.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibprintswitch.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibqueryerrors variant.opensolaris.zone=global
+file path=usr/sbin/ibqueryerrors.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibroute variant.opensolaris.zone=global
+file path=usr/sbin/ibrouters variant.opensolaris.zone=global
+file path=usr/sbin/ibstat variant.opensolaris.zone=global
+file path=usr/sbin/ibstatus variant.opensolaris.zone=global
+file path=usr/sbin/ibswitches variant.opensolaris.zone=global
+file path=usr/sbin/ibswportwatch.pl variant.opensolaris.zone=global
+file path=usr/sbin/ibsysstat variant.opensolaris.zone=global
+file path=usr/sbin/ibtracert variant.opensolaris.zone=global
+file path=usr/sbin/perfquery variant.opensolaris.zone=global
+file path=usr/sbin/saquery variant.opensolaris.zone=global
+file path=usr/sbin/set_nodedesc.sh variant.opensolaris.zone=global
+file path=usr/sbin/sminfo variant.opensolaris.zone=global
+file path=usr/sbin/smpdump variant.opensolaris.zone=global
+file path=usr/sbin/smpquery variant.opensolaris.zone=global
+file path=usr/sbin/solaris_set_nodedesc variant.opensolaris.zone=global
+file path=usr/share/libibverbs.d/mlx4.driver
+file path=usr/share/libibverbs.d/mthca.driver
+file path=usr/share/man/man1/ib_clock_test.1
+file path=usr/share/man/man1/ibdiagnet.1 variant.opensolaris.zone=global
+file path=usr/share/man/man1/ibis.1 variant.opensolaris.zone=global
+file path=usr/share/man/man1/ibv_asyncwatch.1
+file path=usr/share/man/man1/ibv_devices.1
+file path=usr/share/man/man1/ibv_devinfo.1 variant.opensolaris.zone=global
+file path=usr/share/man/man1/ibv_rc_pingpong.1
+file path=usr/share/man/man1/ibv_srq_pingpong.1
+file path=usr/share/man/man1/ibv_ud_pingpong.1
+file path=usr/share/man/man1/mckey.1
+file path=usr/share/man/man1/qperf.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
+file path=usr/share/man/man1/rping.1
+file path=usr/share/man/man1/ucmatose.1
+file path=usr/share/man/man1/udaddy.1
+file path=usr/share/man/man1m/ibaddr.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckerrors.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckerrs.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibchecknet.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibchecknode.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckport.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckportstate.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckportwidth.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckstate.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibcheckwidth.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibclearcounters.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibclearerrors.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibdatacounters.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibdatacounts.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibdiscover.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibhosts.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/iblinkinfo.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibnetdiscover.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibnodes.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibping.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibportstate.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibprintca.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibprintrt.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibprintswitch.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibqueryerrors.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibroute.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibrouters.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibstat.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibstatus.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibswitches.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibswportwatch.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibsysstat.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/ibtracert.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/perfquery.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/saquery.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/set_nodedesc.sh.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/sminfo.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/smpdump.1m variant.opensolaris.zone=global
+file path=usr/share/man/man1m/smpquery.1m variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibnd_debug.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibnd_destroy_fabric.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_alloc_pd.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_attach_mcast.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_ah_from_wc.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_ah.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_comp_channel.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_cq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_qp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_create_srq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_event_type_str.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_fork_init.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_get_async_event.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_get_cq_event.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_get_device_guid.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_get_device_list.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_get_device_name.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_modify_qp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_modify_srq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_node_type_str.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_open_device.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_poll_cq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_port_state_str.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_post_recv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_post_send.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_post_srq_recv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_device.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_gid.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_pkey.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_port.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_qp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_query_srq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_rate_to_mult.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_reg_mr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_req_notify_cq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/ibv_resize_cq.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_accept.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_ack_cm_event.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_bind_addr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_connect.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_create_ep.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_create_event_channel.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_create_id.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_create_qp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_dereg_mr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_destroy_ep.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_destroy_event_channel.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_destroy_id.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_destroy_qp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_disconnect.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_event_str.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_free_devices.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_cm_event.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_devices.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_dst_port.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_local_addr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_peer_addr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_recv_comp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_request.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_send_comp.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_get_src_port.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_getaddrinfo.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_join_multicast.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_leave_multicast.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_listen.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_migrate_id.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_notify.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_read.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_readv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_recv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_recvv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_send.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_sendv.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_ud_send.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_write.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_post_writev.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_reg_msgs.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_reg_read.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_reg_write.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_reject.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_resolve_addr.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3/rdma_resolve_route.3 variant.opensolaris.zone=global
+file path=usr/share/man/man3lib/libsdp.3lib variant.opensolaris.zone=global
+file path=usr/share/man/man4/libsdp.conf.4 variant.opensolaris.zone=global
+file path=usr/share/man/man7/rdma_cm.7 variant.opensolaris.zone=global
+file path=usr/share/man/man7/verbs.7 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/libibmad.so.5 target=libibmad.so.5.1.2 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/libibumad.so.3 target=libibumad.so.3.0.2
+link path=usr/lib/$(MACH64)/libibverbs.so target=libibverbs.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/libibverbs.so.1 target=libibverbs.so.1.0.0
+link path=usr/lib/$(MACH64)/libopensm.so.4 target=libopensm.so.4.0.2 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/libosmcomp.so.3 target=libosmcomp.so.3.0.4 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/libosmvendor.so.3 target=libosmvendor.so.3.0.5 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/librdmacm.so target=librdmacm.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/$(MACH64)/librdmacm.so.1 target=librdmacm.so.1.0.0
+link path=usr/lib/libibmad.so.5 target=libibmad.so.5.1.2 variant.opensolaris.zone=global
+link path=usr/lib/libibnetdisc.so.5 target=libibnetdisc.so.5.0.1 variant.opensolaris.zone=global
+link path=usr/lib/libibumad.so.3 target=libibumad.so.3.0.2
+link path=usr/lib/libibverbs.so target=libibverbs.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/libibverbs.so.1 target=libibverbs.so.1.0.0 
+link path=usr/lib/libopensm.so.4 target=libopensm.so.4.0.2  variant.opensolaris.zone=global
+link path=usr/lib/libosmcomp.so.3 target=libosmcomp.so.3.0.4  variant.opensolaris.zone=global
+link path=usr/lib/libosmvendor.so.3 target=libosmvendor.so.3.0.5  variant.opensolaris.zone=global
+link path=usr/lib/librdmacm.so target=librdmacm.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/librdmacm.so.1 target=librdmacm.so.1.0.0
+link path=usr/lib/secure/$(MACH64)/libsdp.so target=libsdp.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/secure/$(MACH64)/libsdp.so.1 target=libsdp.so.1.0.0
+link path=usr/lib/secure/libsdp.so target=libsdp.so.1.0.0 variant.opensolaris.zone=global
+link path=usr/lib/secure/libsdp.so.1 target=libsdp.so.1.0.0
+link path=usr/share/man/man3/ibv_ack_async_event.3 target=ibv_get_async_event.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_ack_cq_events.3 target=ibv_get_cq_event.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_close_device.3 target=ibv_open_device.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_dealloc_pd.3 target=ibv_alloc_pd.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_dereg_mr.3 target=ibv_reg_mr.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_destroy_ah.3 target=ibv_create_ah.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_destroy_comp_channel.3 target=ibv_create_comp_channel.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_destroy_cq.3 target=ibv_create_cq.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_destroy_qp.3 target=ibv_create_qp.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_destroy_srq.3 target=ibv_create_srq.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_detach_mcast.3 target=ibv_attach_mcast.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_free_device_list.3 target=ibv_get_device_list.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/ibv_init_ah_from_wc.3 target=ibv_create_ah_from_wc.3 variant.opensolaris.zone=global
+link path=usr/share/man/man3/mult_to_ibv_rate.3 target=ibv_rate_to_mult.3 variant.opensolaris.zone=global
+license open-fabrics.license license='open-fabrics'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/opensm/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,81 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		opensm
+COMPONENT_VERSION=	3.3.9
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:9b8a37da3471bd17aa5b86ac7804a48fdc4a4efa
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/management/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+CFLAGS += -std=gnu99
+LIBS +=	-libverbs -lsocket -lnsl -libumad -libmad
+
+CONFIGURE_ENV	+=	CPPFLAGS="$(CPPFLAGS)"
+
+CLEANUP_FILES = \
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libosmcomp.la \
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/libosmcomp.la \
+        $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libosmvendor.la \
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/libosmvendor.la \
+        $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libopensm.la \
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/libopensm.la \
+	$(PROTOUSRSBINDIR)/opensm \
+	$(PROTOUSRSBINDIR)/osmtest \
+        $(PROTO_DIR)/usr/etc/init.d/opensmd \
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man8/opensm.8 \
+        $(PROTO_DIR)/$(CONFIGURE_MANDIR)/man8/osmtest.8
+
+COMPONENT_POST_INSTALL_ACTION = \
+	$(RM) $(CLEANUP_FILES);\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/$(COMPONENT_NAME).la;\
+	$(RM) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/$(COMPONENT_NAME).la;\
+	$(RM) -r $(PROTO_DIR)/usr/etc
+
+COMPONENT_PRE_BUILD_ACTION =\
+	$(MV) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libibverbs.la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/.libibverbs.la;\
+	$(MV) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/libibverbs.la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/.libibverbs.la
+
+COMPONENT_POST_BUILD_ACTION =\
+	$(MV) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/.libibverbs.la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.32)/libibverbs.la;\
+	$(MV) $(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/.libibverbs.la\
+	$(PROTO_DIR)/$(CONFIGURE_LIBDIR.64)/libibverbs.la
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/opensm/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,705 @@
+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/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/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,71 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		perftest
+COMPONENT_VERSION=	1.3.0
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.42.gf350d3d.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:dbafe012922d88db2f22c83b1dda8ee8ccc50f1c
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/perftest/$(COMPONENT_ARCHIVE)
+
+$(BUILD_32):	BITS=32
+$(BUILD_64):	BITS=64
+$(INSTALL_32):	BITS=32
+$(INSTALL_64):	BITS=64
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+MAN1FILES =	ib_clock_test.1
+
+include $(WS_TOP)/make-rules/shared-targets.mk
+
+LIBS +=         -lsocket -lnsl -lkstat -lrdmacm -libverbs -libumad -libmad
+
+LDFLAGS +=	-L$(PROTO_DIR)/$(CONFIGURE_LIBDIR.$(BITS))
+CFLAGS +=	$(SHARED_INCLUDES)
+
+COMMON_ARGS  +=	CC="$(CC)"
+COMMON_ARGS  +=	CFLAGS="$(CFLAGS)"
+COMMON_ARGS  +=	LDFLAGS="$(LDFLAGS) $(LIBS)"
+COMMON_ARGS  +=	INSTALL=$(INSTALL)
+COMMON_ARGS  +=  BINDIR=$(CONFIGURE_BINDIR.$(BITS))
+COMPONENT_BUILD_ARGS  +=	$(COMMON_ARGS)
+COMPONENT_INSTALL_ARGS  +=	$(COMMON_ARGS)
+
+COMPONENT_PREP_ACTION = $(TOUCH) $(@D)/configure
+
+COMPONENT_PRE_CONFIGURE_ACTION = ($(CLONEY) $(SOURCE_DIR) $(@D))
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64) $(PROTOMAN1FILES)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/perftest/manpages/ib_clock_test.1	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,40 @@
+'\" t
+.\" Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+.\" Modified for Solaris to add the Solaris stability classification,
+.\" and to add a note about source availability.
+.\"
+.TH "IB_CLOCK_TEST" 1 "4 April 2011" "User Commands"
+
+.SH "NAME"
+ib_clock_test \- Test accuracy of system clock used in conjunction with
+other IB perftest utilities
+.SH "SYNOPSIS"
+.sp
+.nf
+\fBib_clock_test\fR
+.fi
+.SH "DESCRIPTION"
+.sp
+The \fBib_clock_test\fR() test utility is part of the \fB"perftest"\fR
+utilities that are used for InfiniBand related performance testing. The
+\fB"perftest"\fR utilities (See \fBib_read_lat\fR(1), 
+\fBib_write_bw_postlist\fR(1), \fBib_write_bw\fR(1), etc.) are micro
+bench mark utilities. Users of the these can use \fBib_clock_test\fR(1M)
+to test accuracy of system clock.
+.sp
+The \fBib_clock_test\fR(1M) utility, tests the accuracy of the system clock,
+takes no parameters and provides the following output:
+          #ib_clock_test
+          Type CTRL-C to cancel.
+          1 sec = 1.00004e+06 usec
+          1 sec = 1.00004e+06 usec
+          1 sec = 1.00004e+06 usec
+          1 sec = 1.00004e+06 usec
+          1 sec = 1.00004e+06 usec
+          ...
+.sp
+.SH "SEE ALSO"
+.PP
+\fBib_write_bw\fR(1), \fBib_send_bw\fR(1), \fBib_rdma_lat\fR(1),
+\fBib_read_bw\fR(1), \fBib_read_lat\fR(1), \fBib_write_bw_postlist\fR(1),
+\fBib_rdma_bw\fR(1), \fBib_write_lat\fR(1), \fBib_send_lat\fR(1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/perftest/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,3688 @@
+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,6 +2,7 @@
+ 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}
+ 
+@@ -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/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,9 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include "get_clock.h"
++#if defined(__SVR4) && defined(__sun)
++#include <infiniband/ofa_solaris.h>
++#endif
+ 
+ #ifndef DEBUG
+ #define DEBUG 0
+@@ -137,7 +140,11 @@
+ 	FILE* f;
+ 	char buf[256];
+ 	double mhz = 0.0;
++#if defined(__SVR4) && defined(__sun)
++	sol_cpu_info_t	info;
++#endif
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 	f = fopen("/proc/cpuinfo","r");
+ 	if (!f)
+ 		return 0.0;
+@@ -174,6 +181,12 @@
+ 		}
+ 	}
+ 	fclose(f);
++#else
++	if (!sol_get_cpu_info(&info))
++		mhz = info.cpu_mhz;
++	else
++		return (0.0);
++#endif
+ 	return mhz;
+ }
+ 
+@@ -184,9 +197,6 @@
+ 	sample = sample_get_cpu_mhz();
+ 	proc = proc_get_cpu_mhz(no_cpu_freq_fail);
+ 
+-	if (!proc || !sample)
+-		return 0;
+-
+ 	delta = proc > sample ? proc - sample : sample - proc;
+ 	if (delta / proc > 0.01) {
+ 			fprintf(stderr, "Warning: measured timestamp frequency "
+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
+@@ -71,6 +71,23 @@
+ 	return ret;
+ }
+ 
++#elif defined(__sparc)
++#include <sys/times.h>
++#include <limits.h>
++typedef long	cycles_t;
++
++static inline cycles_t get_cycles()
++{
++	struct timespec tp;
++	long   time;
++
++	if (clock_gettime(CLOCK_HIGHRES, &tp))
++		return -1;
++
++	time = (tp.tv_sec * 1000000) + (tp.tv_nsec / 1000);
++	return time;
++}
++
+ #else
+ #warning get_cycles not implemented for this architecture: attempt asm/timex.h
+ #include <asm/timex.h>
+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>
+@@ -144,7 +147,7 @@
+ 
+ 	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,7 +313,7 @@
+ 		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);
+ 	
+@@ -347,7 +350,7 @@
+ 		goto err5;
+ 
+ 	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
+-		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
++		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);
+@@ -909,17 +912,17 @@
+ 	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 +1049,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 +1062,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;
+ 		}
+ 	
+@@ -1084,7 +1087,7 @@
+ 			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 +1096,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 +1112,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 +1132,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 +1222,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 +1238,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;
+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>
+@@ -59,7 +62,11 @@
+ #include "get_clock.h"
+ 
+ #define PINGPONG_RDMA_WRID	3
++#if defined(__SVR4) && defined(__sun)
++#define MAX_INLINE 372
++#else
+ #define MAX_INLINE 400
++#endif
+ 
+ static int inline_size = MAX_INLINE;
+ static int sl = 0;
+@@ -155,7 +162,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 +193,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) {
+@@ -220,7 +228,7 @@
+ 
+ 	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 +241,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 +256,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 +264,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 +279,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 +286,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 +302,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 +311,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 +340,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);
+@@ -393,7 +401,7 @@
+ 		goto err5;
+ 
+ 	if ( (n = getaddrinfo(NULL, service, &hints, &res)) < 0 ) {
+-		fprintf(stderr, "%d:%s: %s for port %d\n", pid, __func__, 
++		fprintf(stderr, "%d:%s: %s for port %d\n", (int)pid, __func__, 
+ 					gai_strerror(n), data->port);
+ 		goto err5;
+ 	}
+@@ -403,12 +411,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 +425,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 +459,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 +490,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 +499,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 +559,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 +573,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 +583,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 +590,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 +600,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 +613,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 +636,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 +644,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 +661,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 +718,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 +735,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 +746,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 +791,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 +807,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 +833,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 +842,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 +863,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 +890,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 +899,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 +918,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 +927,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);
+@@ -1164,12 +1172,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 +1192,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/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) {
+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
+@@ -78,7 +78,11 @@
+ #define DEF_GID_INDEX (-1)
+ #define DEF_NUM_QPS   (1)
+ #define DEF_INLINE_BW (0)
++#if defined(__SVR4) && defined(__sun)
++#define DEF_INLINE_LT (372)
++#else
+ #define DEF_INLINE_LT (400)
++#endif
+ #define DEF_RX_RDMA   (1)
+ #define DEF_RX_SEND   (600)
+ 
+@@ -96,7 +100,11 @@
+ #define MIN_QP_NUM    (1)
+ #define MAX_QP_NUM	  (8)
+ #define MIN_INLINE 	  (0)
++#if defined(__SVR4) && defined(__sun)
++#define MAX_INLINE 	  (372)
++#else
+ #define MAX_INLINE 	  (400)
++#endif
+ #define MIN_QP_MCAST  (1)
+ #define MAX_QP_MCAST  (56)
+ #define MIN_RX		  (1)
+@@ -128,10 +136,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 +148,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 +162,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>
+ 
+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"
+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
+@@ -1,1162 +1,1162 @@
+-/*
+- * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+- * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+- * Copyright (c) 2009 HNR Consulting.  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.
+- *
+- * $Id$
+- */
+-
+-#if HAVE_CONFIG_H
+-#  include <config.h>
+-#endif /* HAVE_CONFIG_H */
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <unistd.h>
+-#include <string.h>
+-#include <limits.h>
+-#include <malloc.h>
+-#include <getopt.h>
+-#include <time.h>
+-#include <errno.h>
+-#include <infiniband/verbs.h>
+-
+-#include "get_clock.h"
+-#include "multicast_resources.h"
+-#include "perftest_resources.h"
+-
+-#define VERSION 2.1
+-
+-static int page_size;
+-cycles_t	*tposted;
+-cycles_t	*tcompleted;
+-
+-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;
+-	struct ibv_sge      	list;
+-	struct ibv_send_wr  	wr;
+-	struct ibv_sge 			*sge_list;
+-	struct ibv_recv_wr  	*rwr;
+-	struct ibv_ah			*ah;
+-	void               		**buf;
+-	unsigned            	size;
+-	uint64_t				*my_addr;
+-};
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int set_mcast_group(struct pingpong_context *ctx,
+-						   struct perftest_parameters *user_parm,
+-						   struct mcast_parameters *mcg_params) {
+-
+-	struct ibv_port_attr port_attr;
+-
+-	if (ibv_query_gid(ctx->context,user_parm->ib_port,user_parm->gid_index,&mcg_params->port_gid)) {
+-			return 1;
+-	}
+-		
+-	if (ibv_query_pkey(ctx->context,user_parm->ib_port,DEF_PKEY_IDX,&mcg_params->pkey)) {
+-		return 1;
+-	}
+-
+-	if (ibv_query_port(ctx->context,user_parm->ib_port,&port_attr)) {
+-		return 1;
+-	}
+-	mcg_params->sm_lid  = port_attr.sm_lid;
+-	mcg_params->sm_sl   = port_attr.sm_sl;
+-	mcg_params->ib_port = user_parm->ib_port;
+-	
+-	if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
+-		// Request for Mcast group create registery in SM.
+-		if (join_multicast_group(SUBN_ADM_METHOD_SET,mcg_params)) {
+-			fprintf(stderr,"Couldn't Register the Mcast group on the SM\n");
+-			return 1;
+-		}
+-	}
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int set_up_connection(struct pingpong_context *ctx,
+-							 struct perftest_parameters *user_parm,
+-							 struct pingpong_dest *my_dest,
+-							 struct mcast_parameters *mcg_params) {
+-
+-	int i = (user_parm->duplex) ? 1 : 0;
+-
+-	if (user_parm->use_mcg && (user_parm->duplex || user_parm->machine == SERVER)) {
+-
+-		set_multicast_gid(mcg_params,ctx->qp[0]->qp_num,(int)user_parm->machine);
+-		if (set_mcast_group(ctx,user_parm,mcg_params)) {
+-			return 1;
+-		}
+-		
+-		while (i < user_parm->num_of_qps) {
+-			if (ibv_attach_mcast(ctx->qp[i],&mcg_params->mgid,mcg_params->mlid)) {
+-				fprintf(stderr, "Couldn't attach QP to MultiCast group");
+-				return 1;
+-			}
+-			i++;
+-		}
+-
+-		mcg_params->mcast_state |= MCAST_IS_ATTACHED;
+-		my_dest->gid = mcg_params->mgid;
+-		my_dest->lid = mcg_params->mlid;
+-		my_dest->qpn = QPNUM_MCAST;
+-
+-	} else {
+-		if (user_parm->gid_index != -1) {
+-			if (ibv_query_gid(ctx->context,user_parm->ib_port,user_parm->gid_index,&my_dest->gid)) {
+-				return -1;
+-			}
+-		}
+-		my_dest->lid = ctx_get_local_lid(ctx->context,user_parm->ib_port);
+-		my_dest->qpn = ctx->qp[0]->qp_num;
+-	}
+-	my_dest->psn  = lrand48() & 0xffffff;
+-
+-	// We do not fail test upon lid above RoCE.
+-
+-	if (user_parm->gid_index < 0) {
+-		if (!my_dest->lid) {
+-			fprintf(stderr," Local lid 0x0 detected,without any use of gid. Is SM running?\n");
+-			return -1;
+-		}
+-	}
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int init_connection(struct perftest_parameters *params,
+- 						   struct pingpong_dest *my_dest) {
+-
+-	params->side = LOCAL;
+-	ctx_print_pingpong_data(my_dest,params);
+-	
+-	if (params->machine == CLIENT) 
+-		params->sockfd = ctx_client_connect(params->servername,params->port);
+-	else 
+-		params->sockfd = ctx_server_connect(params->port);
+-	
+-		
+-	if(params->sockfd < 0) {
+-		fprintf(stderr,"Unable to open file descriptor for socket connection");
+-		return 1;
+-	}
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int destroy_ctx_resources(struct pingpong_context    *ctx, 
+-								 struct perftest_parameters *user_parm,
+-								 struct pingpong_dest		*my_dest,
+-								 struct pingpong_dest		*rem_dest,
+-								 struct mcast_parameters    *mcg_params)  {
+-
+-	int test_result = 0;
+-	int i = (user_parm->duplex) ? 1 : 0;
+-
+-	if (user_parm->use_mcg) {
+-
+-		if (user_parm->machine == SERVER || user_parm->duplex) {
+-			
+-			while (i < user_parm->num_of_qps) {
+-				if (ibv_detach_mcast(ctx->qp[i],&my_dest->gid,my_dest->lid)) {
+-					fprintf(stderr, "Couldn't deattach QP from MultiCast group\n");
+-					return 1;
+-				}
+-				i++;
+-			}
+-			mcg_params->mgid = my_dest->gid;
+-			if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
+-				if (join_multicast_group(SUBN_ADM_METHOD_DELETE,mcg_params)) {
+-					fprintf(stderr,"Couldn't Unregister the Mcast group on the SM\n");
+-					return 1;
+-				}
+-			}
+-		}
+-
+-		if (user_parm->machine == CLIENT || user_parm->duplex) {
+-
+-			mcg_params->mgid = rem_dest->gid;
+-			if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
+-				if (join_multicast_group(SUBN_ADM_METHOD_DELETE,mcg_params)) {
+-					fprintf(stderr,"Couldn't Unregister the Mcast group on the SM\n");
+-					return 1;
+-				}
+-			}
+-
+-		}
+-	}	
+-
+-	if (ctx->ah) {
+-		if (ibv_destroy_ah(ctx->ah)) {
+-			fprintf(stderr, "failed to destroy AH\n");
+-			test_result = 1;
+-		}
+-	}
+-
+-	for(i = 0; i < user_parm->num_of_qps; i++) {
+-		if (ibv_destroy_qp(ctx->qp[i])) {
+-			test_result = 1;
+-		}
+-	}
+-	free(ctx->qp);
+-
+-	if (ibv_destroy_cq(ctx->cq)) {
+-		test_result = 1;
+-	}
+-
+-	for(i = 0; i < user_parm->num_of_qps; i++) {
+-
+-		if (ibv_dereg_mr(ctx->mr[i])) {
+-			test_result = 1;
+-		}
+-		free(ctx->buf[i]);
+-	}
+-	
+-	if (ibv_dealloc_pd(ctx->pd)) {
+-		test_result = 1;
+-	}
+-
+-	if (ctx->channel) {
+-		if (ibv_destroy_comp_channel(ctx->channel)) {
+-			test_result = 1;
+-		}
+-	}
+-	
+-	if (ibv_close_device(ctx->context)) {
+-		test_result = 1;
+-	}
+-
+-	if (user_parm->machine == SERVER || user_parm->duplex) {
+-		free(ctx->rwr);
+-		free(ctx->sge_list);
+-		free(ctx->my_addr);
+-	}
+-
+-	free(ctx->mr);
+-	free(ctx->buf);
+-	free(ctx);
+-	free(tposted);
+-    free(tcompleted);
+-	return test_result;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev,
+-											struct perftest_parameters *user_parm) {
+-
+-	int i,m_size;
+-	int duplex_ind;
+-	struct pingpong_context *ctx;
+-
+-	ALLOCATE(ctx,struct pingpong_context,1);
+-	ALLOCATE(ctx->buf,void*,user_parm->num_of_qps);
+-	ALLOCATE(ctx->mr,struct ibv_mr*,user_parm->num_of_qps);
+-
+-	ctx->ah       = NULL;
+-	ctx->channel  = NULL;
+-
+-	duplex_ind = (user_parm->duplex && !user_parm->use_mcg) ? 2 : 1;
+-
+-	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;
+-	}
+-
+-	// Configure the Link MTU acoording to the user or the active mtu.
+-	if (ctx_set_mtu(ctx->context,user_parm)) {
+-		fprintf(stderr, "Couldn't set the link layer\n");
+-		return NULL;
+-	}
+-
+-	if (user_parm->connection_type == UD && user_parm->size > MTU_SIZE(user_parm->curr_mtu)) {	 
+-		printf(" Max msg size in UD is MTU - %d . changing to MTU\n",MTU_SIZE(user_parm->curr_mtu));
+-		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;
+-
+-	// Finds the link type and configure the HCA accordingly.
+-	if (ctx_set_link_layer(ctx->context,user_parm)) {
+-		fprintf(stderr, " Couldn't set the link layer\n");
+-		return NULL;
+-	}
+-	
+-	if (user_parm->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;
+-	}
+-
+-	for (i = 0; i < user_parm->num_of_qps; i++) {
+-
+-		m_size = (BUFF_SIZE(user_parm->size) + IF_UD_ADD(user_parm->connection_type))*duplex_ind;
+-		ctx->buf[i] = memalign(page_size,m_size);
+-		if (!ctx->buf[i]) {
+-			fprintf(stderr, "Couldn't allocate work buf.\n");
+-			return NULL;
+-		}
+-		memset(ctx->buf[i],0,m_size);
+-
+-		// We dont really want IBV_ACCESS_LOCAL_WRITE, but IB spec says :
+-		// The Consumer is not allowed to assign Remote Write or Remote Atomic to
+-		// a Memory Region that has not been assigned Local Write. 
+-		ctx->mr[i] = ibv_reg_mr(ctx->pd,
+-								ctx->buf[i],
+-								m_size,
+-								IBV_ACCESS_REMOTE_WRITE | 
+-								IBV_ACCESS_LOCAL_WRITE);
+-
+-		if (!ctx->mr[i]) {
+-			fprintf(stderr, "Couldn't allocate MR\n");
+-			return NULL;
+-		}
+-	}
+-
+-	// Create the CQ according to Client/Server or Duplex setting.
+-	ctx->cq = ctx_cq_create(ctx->context,ctx->channel,user_parm);
+-	if (ctx->cq == NULL) {
+-		fprintf(stderr, "Couldn't create CQ \n");
+-		return NULL;
+-	}
+-
+-	ALLOCATE(ctx->qp,struct ibv_qp*,user_parm->num_of_qps);
+-	
+-	for(i=0; i < user_parm->num_of_qps; i++) {
+-		ctx->qp[i] = ctx_qp_create(ctx->pd,ctx->cq,ctx->cq,user_parm);
+-		if (ctx->qp[i] == NULL) {
+-			return NULL;
+-		}
+-
+-		if(ctx_modify_qp_to_init(ctx->qp[i],user_parm)) {
+-			return NULL;
+-		}
+-	}
+-
+-	return ctx;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int pp_connect_ctx(struct pingpong_context *ctx,int my_psn,
+-			              struct pingpong_dest *dest, 
+-						  struct perftest_parameters *user_parm)
+-{
+-	struct ibv_qp_attr attr;
+-	memset(&attr, 0, sizeof attr);
+-	int i;
+-
+-	attr.qp_state 		= IBV_QPS_RTR;
+-	attr.path_mtu       = user_parm->curr_mtu;
+-    attr.dest_qp_num    = dest->qpn;
+-	attr.rq_psn         = dest->psn;
+-	attr.ah_attr.dlid   = dest->lid;
+-	if (user_parm->connection_type == RC) {
+-		attr.max_dest_rd_atomic     = 1;
+-		attr.min_rnr_timer          = 12;
+-	}
+-	if (user_parm->gid_index < 0) {
+-		attr.ah_attr.is_global  = 0;
+-		attr.ah_attr.sl         = user_parm->sl;
+-	} else {
+-		attr.ah_attr.is_global  = 1;
+-		attr.ah_attr.grh.dgid   = dest->gid;
+-		attr.ah_attr.grh.sgid_index = user_parm->gid_index;
+-		attr.ah_attr.grh.hop_limit = 1;
+-		attr.ah_attr.sl         = 0;
+-	}
+-	attr.ah_attr.src_path_bits = 0;
+-	attr.ah_attr.port_num   = user_parm->ib_port;
+-	
+-	if (user_parm->connection_type == RC) {
+-		if (ibv_modify_qp(ctx->qp[0], &attr,
+-				  IBV_QP_STATE              |
+-				  IBV_QP_AV                 |
+-				  IBV_QP_PATH_MTU           |
+-				  IBV_QP_DEST_QPN           |
+-				  IBV_QP_RQ_PSN             |
+-				  IBV_QP_MIN_RNR_TIMER      |
+-				  IBV_QP_MAX_DEST_RD_ATOMIC)) {
+-			fprintf(stderr, "Failed to modify RC QP to RTR\n");
+-			return 1;
+-		}
+-		attr.timeout            = user_parm->qp_timeout;
+-		attr.retry_cnt          = 7;
+-		attr.rnr_retry          = 7;
+-	} else if (user_parm->connection_type == UC) {
+-		if (ibv_modify_qp(ctx->qp[0], &attr,
+-				  IBV_QP_STATE              |
+-				  IBV_QP_AV                 |
+-				  IBV_QP_PATH_MTU           |
+-				  IBV_QP_DEST_QPN           |
+-				  IBV_QP_RQ_PSN)) {
+-			fprintf(stderr, "Failed to modify UC QP to RTR\n");
+-			return 1;
+-		}
+-	} 
+-	 
+-	else {
+-		for (i = 0; i < user_parm->num_of_qps; i++) {
+-			if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE )) {
+-				fprintf(stderr, "Failed to modify UD QP to RTR\n");
+-				return 1;
+-			}
+-		}
+-		if (user_parm->machine == CLIENT || user_parm->duplex) {
+-			ctx->ah = ibv_create_ah(ctx->pd,&attr.ah_attr);
+-			if (!ctx->ah) {
+-				fprintf(stderr, "Failed to create AH for UD\n");
+-				return 1;
+-			}
+-		}
+-	}
+-
+-	if (user_parm->machine == CLIENT || user_parm->duplex) {
+-
+-		attr.qp_state 	    = IBV_QPS_RTS;
+-		attr.sq_psn 	    = my_psn;
+-		if (user_parm->connection_type == RC) {
+-			attr.max_rd_atomic  = 1;
+-			if (ibv_modify_qp(ctx->qp[0], &attr,
+-					IBV_QP_STATE              |
+-					IBV_QP_SQ_PSN             |
+-					IBV_QP_TIMEOUT            |
+-					IBV_QP_RETRY_CNT          |
+-					IBV_QP_RNR_RETRY          |
+-					IBV_QP_MAX_QP_RD_ATOMIC)) {
+-				fprintf(stderr, "Failed to modify RC QP to RTS\n");
+-				return 1;
+-			}
+-
+-		} else {
+-			if(ibv_modify_qp(ctx->qp[0],&attr,IBV_QP_STATE |IBV_QP_SQ_PSN)) {
+-				fprintf(stderr, "Failed to modify UC QP to RTS\n");
+-				return 1;
+-			}
+-		}
+-	}
+-
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int set_recv_wqes(struct pingpong_context *ctx,
+-						 struct perftest_parameters *user_param) {
+-						
+-	int					i,j,buff_size;
+-	int 				duplex_ind;
+-	struct ibv_recv_wr  *bad_wr_recv;
+-
+-	i = (user_param->duplex && user_param->use_mcg) ? 1 : 0;
+-	duplex_ind = (user_param->duplex && !user_param->use_mcg) ? 1 : 0;
+-
+-	buff_size = BUFF_SIZE(ctx->size) + IF_UD_ADD(user_param->connection_type);
+-
+-	while (i < user_param->num_of_qps) {
+-
+-		ctx->sge_list[i].addr   = (uintptr_t)ctx->buf[i] + duplex_ind*buff_size;
+-
+-		if (user_param->connection_type == UD) 
+-			ctx->sge_list[i].addr += (CACHE_LINE_SIZE - UD_ADDITION);
+-
+-		ctx->sge_list[i].length = SIZE(user_param->connection_type,user_param->size);
+-		ctx->sge_list[i].lkey   = ctx->mr[i]->lkey;
+-		ctx->rwr[i].sg_list     = &ctx->sge_list[i];
+-		ctx->rwr[i].wr_id       = i;
+-		ctx->rwr[i].next        = NULL;
+-		ctx->rwr[i].num_sge	    = MAX_RECV_SGE;
+-		ctx->my_addr[i]		    = (uintptr_t)ctx->buf[i] + duplex_ind*buff_size;
+-		
+-		for (j = 0; j < user_param->rx_depth; ++j) {
+-
+-			if (ibv_post_recv(ctx->qp[i],&ctx->rwr[i],&bad_wr_recv)) {
+-				fprintf(stderr, "Couldn't post recv Qp = %d: counter=%d\n",i,j);
+-				return 1;
+-			}
+-
+-			if (user_param->size <= (CYCLE_BUFFER / 2))
+-				increase_loc_addr(&ctx->sge_list[i],user_param->size,j,ctx->my_addr[i],user_param->connection_type);
+-		}
+-		i++;
+-	}
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static void set_send_wqe(struct pingpong_context *ctx,int rem_qpn,
+-						 struct perftest_parameters *user_param) {
+-
+-	ctx->list.addr     = (uintptr_t)ctx->buf[0];
+-	ctx->list.lkey 	   = ctx->mr[0]->lkey;
+-
+-	ctx->wr.sg_list    = &ctx->list;
+-	ctx->wr.num_sge    = 1;
+-	ctx->wr.opcode     = IBV_WR_SEND;
+-	ctx->wr.next       = NULL;
+-	ctx->wr.wr_id      = PINGPONG_SEND_WRID;
+-	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+-
+-	if (user_param->connection_type == UD) {
+-		ctx->wr.wr.ud.ah          = ctx->ah;
+-		ctx->wr.wr.ud.remote_qkey = DEF_QKEY;
+-		ctx->wr.wr.ud.remote_qpn  = rem_qpn;
+-	}
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static int pp_drain_qp(struct pingpong_context *ctx,
+-						struct perftest_parameters *user_param,
+-						int psn,struct pingpong_dest *dest,
+-						struct mcast_parameters *mcg_params) {
+-
+-	struct ibv_qp_attr attr;
+-	struct ibv_wc      wc;
+-	int                i;
+-
+-	memset(&attr, 0, sizeof attr);
+-	attr.qp_state = IBV_QPS_ERR;
+-
+-	for (i = 0; i <  user_param->num_of_qps; i++) {
+-
+-		if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE)) {
+-			fprintf(stderr, "Failed to modify RC QP to ERR\n");
+-			return 1;
+-		}
+-
+-		while (ibv_poll_cq(ctx->cq,1,&wc));
+-   
+-		attr.qp_state = IBV_QPS_RESET;
+-
+-		if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE)) {
+-			fprintf(stderr, "Failed to modify RC QP to RESET\n");
+-			return 1;
+-		}
+-
+-		if(ctx_modify_qp_to_init(ctx->qp[i],user_param)) {
+-			return 1;
+-		}
+-
+-		if (user_param->use_mcg) {
+-
+-			if ((!user_param->duplex && user_param->machine == SERVER) || (user_param->duplex && i > 0)) {
+-				if (ibv_attach_mcast(ctx->qp[i],&mcg_params->mgid,mcg_params->mlid)) {
+-					fprintf(stderr, "Couldn't attach QP to MultiCast group");
+-					return 1;
+-				}
+-			}
+-		}
+-	}
+-
+-	if (pp_connect_ctx(ctx,psn,dest,user_param)) {
+-		return 1;
+-	}
+-
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-static void print_report(struct perftest_parameters *user_param) {
+-
+-	double cycles_to_units;
+-	unsigned long tsize;	/* Transferred size, in megabytes */
+-	int i, j;
+-	int opt_posted = 0, opt_completed = 0;
+-	cycles_t opt_delta;
+-	cycles_t t;
+-
+-
+-	opt_delta = tcompleted[opt_posted] - tposted[opt_completed];
+-
+-	if (user_param->noPeak == OFF) {
+-		/* Find the peak bandwidth, unless asked not to in command line */
+-		for (i = 0; i < user_param->iters; ++i)
+-			for (j = i; j < user_param->iters; ++j) {
+-				t = (tcompleted[j] - tposted[i]) / (j - i + 1);
+-				if (t < opt_delta) {
+-					opt_delta  = t;
+-					opt_posted = i;
+-					opt_completed = j;
+-				}
+-			}
+-	}
+-
+-	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
+-
+-	tsize = user_param->duplex ? 2 : 1;
+-	tsize = tsize * user_param->size;
+-	printf(REPORT_FMT,user_param->size,user_param->iters,(user_param->noPeak == OFF) * tsize * cycles_to_units / opt_delta / 0x100000,
+-	       tsize * user_param->iters * cycles_to_units /(tcompleted[user_param->iters - 1] - tposted[0]) / 0x100000);
+-}
+-
+-/****************************************************************************** 
+- * Important note :															  
+- * In case of UD/UC this is NOT the way to measureBW since we are running with 
+- * loop on the send side , while we should run on the recieve side or enable 
+- * retry in SW , Since the sender may be faster than the reciver.
+- * Although	we had posted recieve it is not enough and might end this will
+- * result in deadlock of test since both sides are stuck on poll cq.
+- * In this test i do not solve this for the general test ,need to write
+- * seperate test for UC/UD but in case the tx_depth is ~1/3 from the
+- * number of iterations this should be ok .
+- * Also note that the sender is limited in the number of send, ans
+- * i try to make the reciver full .
+- ******************************************************************************/
+-int run_iter_bi(struct pingpong_context *ctx, 
+-				struct perftest_parameters *user_param)  {
+-
+-	int                     scnt    = 0;
+-	int 					ccnt    = 0;
+-	int 					rcnt    = 0;
+-	int 					i       = 0;
+-	int 					num_of_qps = user_param->num_of_qps;
+-	int 					ne;
+-	struct ibv_wc 			*wc          = NULL;
+-	int 					*rcnt_for_qp = NULL;
+-	struct ibv_recv_wr      *bad_wr_recv = NULL;
+-	struct ibv_send_wr 		*bad_wr      = NULL;
+-
+-	ALLOCATE(rcnt_for_qp,int,user_param->num_of_qps);
+-	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
+-	memset(rcnt_for_qp,0,sizeof(int)*user_param->num_of_qps);
+-
+-	if (user_param->use_mcg)
+-		num_of_qps--; 
+-	
+-	// Set the length of the scatter in case of ALL option.
+-	ctx->list.length = user_param->size;
+-	ctx->list.addr   = (uintptr_t)ctx->buf[0];
+-	ctx->wr.send_flags = IBV_SEND_SIGNALED;
+-	
+-	if (user_param->size <= user_param->inline_size) 
+-		ctx->wr.send_flags |= IBV_SEND_INLINE; 
+-
+-	while (ccnt < user_param->iters || rcnt < user_param->iters) {
+-                
+-		while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth / 2) {
+-
+-			if (scnt %  CQ_MODERATION == 0 && CQ_MODERATION > 1)
+-				ctx->wr.send_flags &= ~IBV_SEND_SIGNALED;
+-
+-			tposted[scnt] = get_cycles();
+-			if (ibv_post_send(ctx->qp[0],&ctx->wr, &bad_wr)) {
+-				fprintf(stderr, "Couldn't post send: scnt=%d\n",scnt);
+-				return 1;
+-			}
+-
+-			if (user_param->size <= (CYCLE_BUFFER / 2))
+-				increase_loc_addr(&ctx->list,user_param->size,scnt,(uintptr_t)ctx->buf[0],0);
+-
+-			++scnt;
+-
+-			if ((scnt % CQ_MODERATION) == (CQ_MODERATION - 1) || scnt == (user_param->iters - 1)) 
+-				ctx->wr.send_flags |= IBV_SEND_SIGNALED;
+-		}
+-
+-		if (user_param->use_event) {
+-
+-			if (ctx_notify_events(ctx->cq,ctx->channel)) {
+-				fprintf(stderr,"Failed to notify events to CQ");
+-				return 1;
+-			}
+-		}
+-
+-		do {
+-			ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
+-			if (ne > 0) {
+-				for (i = 0; i < ne; i++) {
+-					
+-					if (wc[i].status != IBV_WC_SUCCESS)
+-						 NOTIFY_COMP_ERROR_SEND(wc[i],scnt,ccnt);
+-
+-					if ((int) wc[i].wr_id == PINGPONG_SEND_WRID) {
+-						ccnt += CQ_MODERATION;
+-						if (ccnt >= user_param->iters - 1) 
+-							tcompleted[user_param->iters - 1] = get_cycles();
+-
+-						else 
+-							tcompleted[ccnt - 1] = get_cycles();
+-					}
+-
+-					else {
+-
+-						rcnt_for_qp[wc[i].wr_id]++;
+-						rcnt++;
+-						if (ibv_post_recv(ctx->qp[wc[i].wr_id],&ctx->rwr[wc[i].wr_id],&bad_wr_recv)) {
+-							fprintf(stderr, "Couldn't post recv Qp=%d rcnt=%d\n",(int)wc[i].wr_id , rcnt_for_qp[wc[i].wr_id]);
+-							return 15;
+-						}
+-
+-						if (user_param->size <= (CYCLE_BUFFER / 2))
+-							increase_loc_addr(&ctx->sge_list[wc[i].wr_id],
+-							  user_param->size,rcnt_for_qp[wc[i].wr_id] + user_param->rx_depth - 1,
+-							  ctx->my_addr[wc[i].wr_id],user_param->connection_type);	
+-					}
+-				}
+-			}
+-		} while (ne > 0);
+-
+-		if (ne < 0) {
+-			fprintf(stderr, "poll CQ failed %d\n", ne);
+-			return 1;
+-		}
+-	}
+-	
+-	if (user_param->size <= user_param->inline_size) 
+-		ctx->wr.send_flags &= ~IBV_SEND_INLINE;
+-	
+-	free(rcnt_for_qp);
+-	free(wc);
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-int run_iter_uni_server(struct pingpong_context *ctx, 
+-						struct perftest_parameters *user_param) {
+-
+-	int 				rcnt = 0;
+-	int 				ne,i;
+-	int                 *rcnt_for_qp = NULL;
+-	struct ibv_wc 		*wc          = NULL;
+-	struct ibv_recv_wr  *bad_wr_recv = NULL;
+-
+-	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
+-	ALLOCATE(rcnt_for_qp,int,user_param->num_of_qps);
+-
+-	memset(rcnt_for_qp,0,sizeof(int)*user_param->num_of_qps);
+-
+-	while (rcnt < user_param->iters) {
+-
+-		if (user_param->use_event) {
+-			if (ctx_notify_events(ctx->cq,ctx->channel)) {
+-				fprintf(stderr ," Failed to notify events to CQ");
+-				return 1;
+-			}
+-		}
+-		
+-		do {
+-			ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
+-			if (ne > 0) {
+-				for (i = 0; i < ne; i++) {
+-					
+-					if (wc[i].status != IBV_WC_SUCCESS) 
+-						NOTIFY_COMP_ERROR_RECV(wc[i],rcnt_for_qp[wc[i].wr_id]);
+-						
+-					rcnt_for_qp[wc[i].wr_id]++;
+-					tcompleted[rcnt++] = get_cycles();
+-
+-				   	if (ibv_post_recv(ctx->qp[wc[i].wr_id],&ctx->rwr[wc[i].wr_id],&bad_wr_recv)) {
+-						fprintf(stderr, "Couldn't post recv Qp=%d rcnt=%d\n",(int)wc[i].wr_id,rcnt_for_qp[wc[i].wr_id]);
+-						return 15;
+-					}
+-
+-					if (user_param->size <= (CYCLE_BUFFER / 2))
+-						increase_loc_addr(&ctx->sge_list[wc[i].wr_id],user_param->size,
+-										  rcnt_for_qp[wc[i].wr_id] + user_param->rx_depth,
+-										  ctx->my_addr[wc[i].wr_id],user_param->connection_type);						
+-				}
+-			}
+-		} while (ne > 0);
+-
+-		if (ne < 0) {
+-			fprintf(stderr, "Poll Recieve CQ failed %d\n", ne);
+-			return 1;
+-		}
+-	}
+-
+-	tposted[0] = tcompleted[0];
+-	free(wc);
+-	free(rcnt_for_qp);
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-int run_iter_uni_client(struct pingpong_context *ctx, 
+-						struct perftest_parameters *user_param) {
+-
+-	int 		       ne;
+-	int 			   i    = 0;
+-	int                scnt = 0;
+-	int                ccnt = 0;
+-	struct ibv_wc      *wc     = NULL;
+-	struct ibv_send_wr *bad_wr = NULL;
+-
+-	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
+-
+-	// Set the lenght of the scatter in case of ALL option.
+-	ctx->list.length = user_param->size;
+-	ctx->list.addr   = (uintptr_t)ctx->buf[0];
+-	ctx->wr.send_flags = IBV_SEND_SIGNALED; 
+-
+-	if (user_param->size <= user_param->inline_size) 
+-		ctx->wr.send_flags |= IBV_SEND_INLINE; 
+-	
+-
+-	while (scnt < user_param->iters || ccnt < user_param->iters) {
+-		while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) {
+-
+-			if (scnt %  CQ_MODERATION == 0 && CQ_MODERATION > 1)
+-				ctx->wr.send_flags &= ~IBV_SEND_SIGNALED;
+-
+-			tposted[scnt] = get_cycles();
+-			if (ibv_post_send(ctx->qp[0], &ctx->wr, &bad_wr)) {
+-				fprintf(stderr, "Couldn't post send: scnt=%d\n",scnt);
+-				return 1;
+-			}
+-
+-			if (user_param->size <= (CYCLE_BUFFER / 2))
+-				increase_loc_addr(&ctx->list,user_param->size,scnt,(uintptr_t)ctx->buf[0],0);
+-
+-			scnt++;
+-
+-			if ((scnt % CQ_MODERATION) == (CQ_MODERATION - 1) || scnt == (user_param->iters - 1)) 
+-				ctx->wr.send_flags |= IBV_SEND_SIGNALED;
+-		}
+-
+-		if (ccnt < user_param->iters) {	
+-			
+-			if (user_param->use_event) {
+-				if (ctx_notify_events(ctx->cq,ctx->channel)) {
+-					fprintf(stderr , " Failed to notify events to CQ");
+-					return 1;
+-				}
+-			} 
+-			do {
+-				ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
+-				if (ne > 0) {
+-					for (i = 0; i < DEF_WC_SIZE; i++) {
+-
+-						if (wc[i].status != IBV_WC_SUCCESS) 
+-							NOTIFY_COMP_ERROR_SEND(wc[i],scnt,ccnt);
+-			
+-						ccnt += CQ_MODERATION;
+-						if (ccnt >= user_param->iters - 1) 
+-							tcompleted[user_param->iters - 1] = get_cycles();
+-
+-						else 
+-							tcompleted[ccnt - 1] = get_cycles();
+-					}
+-				}
+-                         
+-					
+-			} while (ne > 0);
+-
+-			if (ne < 0) {
+-				fprintf(stderr, "poll CQ failed\n");
+-				return 1;
+-			}
+-		}
+-	}
+-
+-	if (user_param->size <= user_param->inline_size) 
+-		ctx->wr.send_flags &= ~IBV_SEND_INLINE;
+-
+-	free(wc);
+-	return 0;
+-}
+-
+-/****************************************************************************** 
+- *
+- ******************************************************************************/
+-int main(int argc, char *argv[])
+-{
+-	struct ibv_device		 	*ib_dev = NULL;
+-	struct pingpong_context  	*ctx;
+-	struct pingpong_dest	 	my_dest,rem_dest;
+-	struct perftest_parameters  user_param;
+-	struct mcast_parameters     mcg_params;
+-	int                      	i = 0;
+-	int                      	size_max_pow = 24;
+-	int							size_of_arr;
+-
+-	// Pointer to The relevent function of run_iter according to machine type.
+-	int (*ptr_to_run_iter_uni)(struct pingpong_context*,struct perftest_parameters*);
+-
+-	/* init default values to user's parameters */
+-	memset(&user_param, 0 , sizeof(struct perftest_parameters));
+-	memset(&mcg_params, 0 , sizeof(struct mcast_parameters));
+-	memset(&my_dest   , 0 , sizeof(struct pingpong_dest));
+-	memset(&rem_dest   , 0 , sizeof(struct pingpong_dest));
+- 
+-	user_param.verb    = SEND;
+-	user_param.tst     = BW;
+-	user_param.version = VERSION;
+-
+-	if (parser(&user_param,argv,argc)) 
+-		return 1;
+-
+-	printf(RESULT_LINE);
+-
+-	user_param.rx_depth = (user_param.iters < user_param.rx_depth) ? user_param.iters : user_param.rx_depth ;
+-
+-    if (user_param.use_mcg) {
+-
+-		user_param.connection_type = UD;
+-		if (user_param.duplex) {
+-			user_param.num_of_qps++;
+-			printf("                    Send Bidirectional BW  -  Multicast Test\n");
+-		}
+-		else {
+-			printf("                    Send BW  -  Multicast Test\n");
+-			if (user_param.machine == CLIENT)
+-				user_param.num_of_qps = 1;
+-		}
+-    }
+-
+-	else if (user_param.duplex) {
+-		    printf("                    Send Bidirectional BW Test\n");
+-	} else 
+-		    printf("                    Send BW Test\n");
+-
+-	if (user_param.use_event) 
+-		printf(" Test with events.\n");
+-
+-	if (user_param.connection_type == RC)
+-		printf(" Connection type : RC\n");
+-	else if (user_param.connection_type == UC)
+-		printf(" Connection type : UC\n");
+-	else{
+-		printf(" Connection type : UD\n");
+-	}
+-	
+-	// Done with parameter parsing. Perform setup.
+-	if (user_param.all == ON) {
+-		// since we run all sizes 
+-		user_param.size = MAX_SIZE;
+-	}
+-
+-	srand48(getpid() * time(NULL));
+-	page_size = sysconf(_SC_PAGESIZE);
+-
+-	ib_dev = ctx_find_dev(user_param.ib_devname);
+-	if (!ib_dev)
+-		return 7;
+-
+-	mcg_params.ib_devname = ibv_get_device_name(ib_dev);
+-
+-	ctx = pp_init_ctx(ib_dev,&user_param);
+-	if (!ctx)
+-		return 1;
+-
+-	// Set up the Connection.
+-	if (set_up_connection(ctx,&user_param,&my_dest,&mcg_params)) {
+-		fprintf(stderr," Unable to set up socket connection\n");
+-		return 1;
+-	}	
+-
+-	// Init the connection and print the local data.
+-	if (init_connection(&user_param,&my_dest)) {
+-		fprintf(stderr," Unable to init the socket connection\n");
+-		return 1;
+-	}
+-
+-	// shaking hands and gather the other side info.
+-    if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
+-        fprintf(stderr,"Failed to exchange date between server and clients\n");
+-        return 1;
+-        
+-    }
+-	// For printing only MGID in the remote side.
+-	user_param.side = REMOTE;
+-	ctx_print_pingpong_data(&rem_dest,&user_param);
+-
+-	// Joining the Send side port the Mcast gid
+-	if (user_param.use_mcg && (user_param.machine == CLIENT || user_param.duplex)) {
+-		memcpy(mcg_params.mgid.raw, rem_dest.gid.raw, 16);
+-		if (set_mcast_group(ctx,&user_param,&mcg_params)) {
+-			fprintf(stderr," Unable to Join Sender to Mcast gid\n");
+-			return 1;
+-		}
+-	}
+-
+-	// Prepare IB resources for rtr/rts.
+-	if (pp_connect_ctx(ctx,my_dest.psn,&rem_dest,&user_param)) {
+-		fprintf(stderr," Unable to Connect the HCA's through the link\n");
+-		return 1;
+-	}
+-	
+-	// shaking hands and gather the other side info.
+-    if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
+-        fprintf(stderr,"Failed to exchange date between server and clients\n");
+-        return 1;
+-        
+-    }
+-
+-	if (user_param.use_event) {
+-		if (ibv_req_notify_cq(ctx->cq, 0)) {
+-			fprintf(stderr, " Couldn't request CQ notification\n");
+-			return 1;
+-		} 
+-	}
+-
+-	printf(RESULT_LINE);
+-	printf(RESULT_FMT);
+-
+-	size_of_arr = (user_param.duplex) ? 1 : user_param.num_of_qps;
+-
+-	ALLOCATE(tposted,cycles_t,user_param.iters*size_of_arr);
+-	ALLOCATE(tcompleted,cycles_t,user_param.iters*size_of_arr);
+-
+-	if (user_param.machine == SERVER || user_param.duplex) {
+-		ALLOCATE(ctx->rwr,struct ibv_recv_wr,user_param.num_of_qps);
+-		ALLOCATE(ctx->sge_list,struct ibv_sge,user_param.num_of_qps);
+-		ALLOCATE(ctx->my_addr ,uint64_t ,user_param.num_of_qps);
+-	}
+-
+-	ptr_to_run_iter_uni = (user_param.machine == CLIENT) ?	&run_iter_uni_client : &run_iter_uni_server;
+-	
+-	if (user_param.machine == SERVER && !user_param.duplex) {
+-		user_param.noPeak = ON;
+-	}
+-
+-	if (user_param.machine == CLIENT || user_param.duplex) {
+-		set_send_wqe(ctx,rem_dest.qpn,&user_param);
+-	}
+-
+-	if (user_param.all == ON) {
+-
+-		if (user_param.connection_type == UD) 
+-		   size_max_pow =  (int)UD_MSG_2_EXP(MTU_SIZE(user_param.curr_mtu)) + 1;
+-
+-		for (i = 1; i < size_max_pow ; ++i) {
+-			user_param.size = 1 << i;
+-
+-			if (user_param.machine == SERVER || user_param.duplex) {
+-				if (set_recv_wqes(ctx,&user_param)) {
+-					fprintf(stderr," Failed to post receive recv_wqes\n");
+-					return 1;
+-				}
+-			}
+-
+-			if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
+-				fprintf(stderr,"Failed to exchange date between server and clients\n");
+-				return 1;
+-			}
+-
+-			if (user_param.duplex) {
+-				if(run_iter_bi(ctx,&user_param))
+-					return 17;
+-			} else {
+-				if((*ptr_to_run_iter_uni)(ctx,&user_param))
+-					return 17;
+-			}
+-			print_report(&user_param);
+-
+-			if (pp_drain_qp(ctx,&user_param,my_dest.psn,&rem_dest,&mcg_params)) {
+-				fprintf(stderr,"Failed to drain Recv queue (performance optimization)\n");
+-				return 1;
+-			}
+-
+-			if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
+-				fprintf(stderr,"Failed to exchange date between server and clients\n");
+-				return 1;
+-			}
+-        
+-		}
+-
+-	} else {
+-
+-		if (user_param.machine == SERVER || user_param.duplex) {
+-			if (set_recv_wqes(ctx,&user_param)) {
+-				fprintf(stderr," Failed to post receive recv_wqes\n");
+-				return 1;
+-			}
+-		}
+-
+-		if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
+-			fprintf(stderr,"Failed to exchange date between server and clients\n");
+-			return 1;
+-		}
+-
+-		if (user_param.duplex) {
+-			if(run_iter_bi(ctx,&user_param))
+-				return 18;
+-
+-		} else {
+-			if((*ptr_to_run_iter_uni)(ctx,&user_param))
+-				return 18;
+-		}
+-
+-		print_report(&user_param);	
+-	}
+-		
+-	if (ctx_close_connection(&user_param,&my_dest,&rem_dest)) {
+-		fprintf(stderr," Failed to close connection between server and client\n");
+-		return 1;
+-	}
+-
+-	printf(RESULT_LINE);
+-	return destroy_ctx_resources(ctx,&user_param,&my_dest,&rem_dest,&mcg_params);
+-}
++/*
++ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
++ * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
++ * Copyright (c) 2009 HNR Consulting.  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.
++ *
++ * $Id$
++ */
++
++#if HAVE_CONFIG_H
++#  include <config.h>
++#endif /* HAVE_CONFIG_H */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <limits.h>
++#include <malloc.h>
++#include <getopt.h>
++#include <time.h>
++#include <errno.h>
++#include <infiniband/verbs.h>
++
++#include "get_clock.h"
++#include "multicast_resources.h"
++#include "perftest_resources.h"
++
++#define VERSION 2.1
++
++static int page_size;
++cycles_t	*tposted;
++cycles_t	*tcompleted;
++
++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;
++	struct ibv_sge      	list;
++	struct ibv_send_wr  	wr;
++	struct ibv_sge 			*sge_list;
++	struct ibv_recv_wr  	*rwr;
++	struct ibv_ah			*ah;
++	void               		**buf;
++	unsigned            	size;
++	uint64_t				*my_addr;
++};
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int set_mcast_group(struct pingpong_context *ctx,
++						   struct perftest_parameters *user_parm,
++						   struct mcast_parameters *mcg_params) {
++
++	struct ibv_port_attr port_attr;
++
++	if (ibv_query_gid(ctx->context,user_parm->ib_port,user_parm->gid_index,&mcg_params->port_gid)) {
++			return 1;
++	}
++		
++	if (ibv_query_pkey(ctx->context,user_parm->ib_port,DEF_PKEY_IDX,&mcg_params->pkey)) {
++		return 1;
++	}
++
++	if (ibv_query_port(ctx->context,user_parm->ib_port,&port_attr)) {
++		return 1;
++	}
++	mcg_params->sm_lid  = port_attr.sm_lid;
++	mcg_params->sm_sl   = port_attr.sm_sl;
++	mcg_params->ib_port = user_parm->ib_port;
++	
++	if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
++		// Request for Mcast group create registery in SM.
++		if (join_multicast_group(SUBN_ADM_METHOD_SET,mcg_params)) {
++			fprintf(stderr,"Couldn't Register the Mcast group on the SM\n");
++			return 1;
++		}
++	}
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int set_up_connection(struct pingpong_context *ctx,
++							 struct perftest_parameters *user_parm,
++							 struct pingpong_dest *my_dest,
++							 struct mcast_parameters *mcg_params) {
++
++	int i = (user_parm->duplex) ? 1 : 0;
++
++	if (user_parm->use_mcg && (user_parm->duplex || user_parm->machine == SERVER)) {
++
++		set_multicast_gid(mcg_params,ctx->qp[0]->qp_num,(int)user_parm->machine);
++		if (set_mcast_group(ctx,user_parm,mcg_params)) {
++			return 1;
++		}
++		
++		while (i < user_parm->num_of_qps) {
++			if (ibv_attach_mcast(ctx->qp[i],&mcg_params->mgid,mcg_params->mlid)) {
++				fprintf(stderr, "Couldn't attach QP to MultiCast group");
++				return 1;
++			}
++			i++;
++		}
++
++		mcg_params->mcast_state |= MCAST_IS_ATTACHED;
++		my_dest->gid = mcg_params->mgid;
++		my_dest->lid = mcg_params->mlid;
++		my_dest->qpn = QPNUM_MCAST;
++
++	} else {
++		if (user_parm->gid_index != -1) {
++			if (ibv_query_gid(ctx->context,user_parm->ib_port,user_parm->gid_index,&my_dest->gid)) {
++				return -1;
++			}
++		}
++		my_dest->lid = ctx_get_local_lid(ctx->context,user_parm->ib_port);
++		my_dest->qpn = ctx->qp[0]->qp_num;
++	}
++	my_dest->psn  = lrand48() & 0xffffff;
++
++	// We do not fail test upon lid above RoCE.
++
++	if (user_parm->gid_index < 0) {
++		if (!my_dest->lid) {
++			fprintf(stderr," Local lid 0x0 detected,without any use of gid. Is SM running?\n");
++			return -1;
++		}
++	}
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int init_connection(struct perftest_parameters *params,
++ 						   struct pingpong_dest *my_dest) {
++
++	params->side = LOCAL;
++	ctx_print_pingpong_data(my_dest,params);
++	
++	if (params->machine == CLIENT) 
++		params->sockfd = ctx_client_connect(params->servername,params->port);
++	else 
++		params->sockfd = ctx_server_connect(params->port);
++	
++		
++	if(params->sockfd < 0) {
++		fprintf(stderr,"Unable to open file descriptor for socket connection");
++		return 1;
++	}
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int destroy_ctx_resources(struct pingpong_context    *ctx, 
++								 struct perftest_parameters *user_parm,
++								 struct pingpong_dest		*my_dest,
++								 struct pingpong_dest		*rem_dest,
++								 struct mcast_parameters    *mcg_params)  {
++
++	int test_result = 0;
++	int i = (user_parm->duplex) ? 1 : 0;
++
++	if (user_parm->use_mcg) {
++
++		if (user_parm->machine == SERVER || user_parm->duplex) {
++			
++			while (i < user_parm->num_of_qps) {
++				if (ibv_detach_mcast(ctx->qp[i],&my_dest->gid,my_dest->lid)) {
++					fprintf(stderr, "Couldn't deattach QP from MultiCast group\n");
++					return 1;
++				}
++				i++;
++			}
++			mcg_params->mgid = my_dest->gid;
++			if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
++				if (join_multicast_group(SUBN_ADM_METHOD_DELETE,mcg_params)) {
++					fprintf(stderr,"Couldn't Unregister the Mcast group on the SM\n");
++					return 1;
++				}
++			}
++		}
++
++		if (user_parm->machine == CLIENT || user_parm->duplex) {
++
++			mcg_params->mgid = rem_dest->gid;
++			if (!strcmp(link_layer_str(user_parm->link_type),"IB")) {
++				if (join_multicast_group(SUBN_ADM_METHOD_DELETE,mcg_params)) {
++					fprintf(stderr,"Couldn't Unregister the Mcast group on the SM\n");
++					return 1;
++				}
++			}
++
++		}
++	}	
++
++	if (ctx->ah) {
++		if (ibv_destroy_ah(ctx->ah)) {
++			fprintf(stderr, "failed to destroy AH\n");
++			test_result = 1;
++		}
++	}
++
++	for(i = 0; i < user_parm->num_of_qps; i++) {
++		if (ibv_destroy_qp(ctx->qp[i])) {
++			test_result = 1;
++		}
++	}
++	free(ctx->qp);
++
++	if (ibv_destroy_cq(ctx->cq)) {
++		test_result = 1;
++	}
++
++	for(i = 0; i < user_parm->num_of_qps; i++) {
++
++		if (ibv_dereg_mr(ctx->mr[i])) {
++			test_result = 1;
++		}
++		free(ctx->buf[i]);
++	}
++	
++	if (ibv_dealloc_pd(ctx->pd)) {
++		test_result = 1;
++	}
++
++	if (ctx->channel) {
++		if (ibv_destroy_comp_channel(ctx->channel)) {
++			test_result = 1;
++		}
++	}
++	
++	if (ibv_close_device(ctx->context)) {
++		test_result = 1;
++	}
++
++	if (user_parm->machine == SERVER || user_parm->duplex) {
++		free(ctx->rwr);
++		free(ctx->sge_list);
++		free(ctx->my_addr);
++	}
++
++	free(ctx->mr);
++	free(ctx->buf);
++	free(ctx);
++	free(tposted);
++    free(tcompleted);
++	return test_result;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev,
++											struct perftest_parameters *user_parm) {
++
++	int i,m_size;
++	int duplex_ind;
++	struct pingpong_context *ctx;
++
++	ALLOCATE(ctx,struct pingpong_context,1);
++	ALLOCATE(ctx->buf,void*,user_parm->num_of_qps);
++	ALLOCATE(ctx->mr,struct ibv_mr*,user_parm->num_of_qps);
++
++	ctx->ah       = NULL;
++	ctx->channel  = NULL;
++
++	duplex_ind = (user_parm->duplex && !user_parm->use_mcg) ? 2 : 1;
++
++	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;
++	}
++
++	// Configure the Link MTU acoording to the user or the active mtu.
++	if (ctx_set_mtu(ctx->context,user_parm)) {
++		fprintf(stderr, "Couldn't set the link layer\n");
++		return NULL;
++	}
++
++	if (user_parm->connection_type == UD && user_parm->size > MTU_SIZE(user_parm->curr_mtu)) {	 
++		printf(" Max msg size in UD is MTU - %d . changing to MTU\n",MTU_SIZE(user_parm->curr_mtu));
++		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;
++
++	// Finds the link type and configure the HCA accordingly.
++	if (ctx_set_link_layer(ctx->context,user_parm)) {
++		fprintf(stderr, " Couldn't set the link layer\n");
++		return NULL;
++	}
++	
++	if (user_parm->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;
++	}
++
++	for (i = 0; i < user_parm->num_of_qps; i++) {
++
++		m_size = (BUFF_SIZE(user_parm->size) + IF_UD_ADD(user_parm->connection_type))*duplex_ind;
++		ctx->buf[i] = memalign(page_size,m_size);
++		if (!ctx->buf[i]) {
++			fprintf(stderr, "Couldn't allocate work buf.\n");
++			return NULL;
++		}
++		memset(ctx->buf[i],0,m_size);
++
++		// We dont really want IBV_ACCESS_LOCAL_WRITE, but IB spec says :
++		// The Consumer is not allowed to assign Remote Write or Remote Atomic to
++		// a Memory Region that has not been assigned Local Write. 
++		ctx->mr[i] = ibv_reg_mr(ctx->pd,
++								ctx->buf[i],
++								m_size,
++								IBV_ACCESS_REMOTE_WRITE | 
++								IBV_ACCESS_LOCAL_WRITE);
++
++		if (!ctx->mr[i]) {
++			fprintf(stderr, "Couldn't allocate MR\n");
++			return NULL;
++		}
++	}
++
++	// Create the CQ according to Client/Server or Duplex setting.
++	ctx->cq = ctx_cq_create(ctx->context,ctx->channel,user_parm);
++	if (ctx->cq == NULL) {
++		fprintf(stderr, "Couldn't create CQ \n");
++		return NULL;
++	}
++
++	ALLOCATE(ctx->qp,struct ibv_qp*,user_parm->num_of_qps);
++	
++	for(i=0; i < user_parm->num_of_qps; i++) {
++		ctx->qp[i] = ctx_qp_create(ctx->pd,ctx->cq,ctx->cq,user_parm);
++		if (ctx->qp[i] == NULL) {
++			return NULL;
++		}
++
++		if(ctx_modify_qp_to_init(ctx->qp[i],user_parm)) {
++			return NULL;
++		}
++	}
++
++	return ctx;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int pp_connect_ctx(struct pingpong_context *ctx,int my_psn,
++			              struct pingpong_dest *dest, 
++						  struct perftest_parameters *user_parm)
++{
++	struct ibv_qp_attr attr;
++	memset(&attr, 0, sizeof attr);
++	int i;
++
++	attr.qp_state 		= IBV_QPS_RTR;
++	attr.path_mtu       = user_parm->curr_mtu;
++    attr.dest_qp_num    = dest->qpn;
++	attr.rq_psn         = dest->psn;
++	attr.ah_attr.dlid   = dest->lid;
++	if (user_parm->connection_type == RC) {
++		attr.max_dest_rd_atomic     = 1;
++		attr.min_rnr_timer          = 12;
++	}
++	if (user_parm->gid_index < 0) {
++		attr.ah_attr.is_global  = 0;
++		attr.ah_attr.sl         = user_parm->sl;
++	} else {
++		attr.ah_attr.is_global  = 1;
++		attr.ah_attr.grh.dgid   = dest->gid;
++		attr.ah_attr.grh.sgid_index = user_parm->gid_index;
++		attr.ah_attr.grh.hop_limit = 1;
++		attr.ah_attr.sl         = 0;
++	}
++	attr.ah_attr.src_path_bits = 0;
++	attr.ah_attr.port_num   = user_parm->ib_port;
++	
++	if (user_parm->connection_type == RC) {
++		if (ibv_modify_qp(ctx->qp[0], &attr,
++				  IBV_QP_STATE              |
++				  IBV_QP_AV                 |
++				  IBV_QP_PATH_MTU           |
++				  IBV_QP_DEST_QPN           |
++				  IBV_QP_RQ_PSN             |
++				  IBV_QP_MIN_RNR_TIMER      |
++				  IBV_QP_MAX_DEST_RD_ATOMIC)) {
++			fprintf(stderr, "Failed to modify RC QP to RTR\n");
++			return 1;
++		}
++		attr.timeout            = user_parm->qp_timeout;
++		attr.retry_cnt          = 7;
++		attr.rnr_retry          = 7;
++	} else if (user_parm->connection_type == UC) {
++		if (ibv_modify_qp(ctx->qp[0], &attr,
++				  IBV_QP_STATE              |
++				  IBV_QP_AV                 |
++				  IBV_QP_PATH_MTU           |
++				  IBV_QP_DEST_QPN           |
++				  IBV_QP_RQ_PSN)) {
++			fprintf(stderr, "Failed to modify UC QP to RTR\n");
++			return 1;
++		}
++	} 
++	 
++	else {
++		for (i = 0; i < user_parm->num_of_qps; i++) {
++			if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE )) {
++				fprintf(stderr, "Failed to modify UD QP to RTR\n");
++				return 1;
++			}
++		}
++		if (user_parm->machine == CLIENT || user_parm->duplex) {
++			ctx->ah = ibv_create_ah(ctx->pd,&attr.ah_attr);
++			if (!ctx->ah) {
++				fprintf(stderr, "Failed to create AH for UD\n");
++				return 1;
++			}
++		}
++	}
++
++	if (user_parm->machine == CLIENT || user_parm->duplex) {
++
++		attr.qp_state 	    = IBV_QPS_RTS;
++		attr.sq_psn 	    = my_psn;
++		if (user_parm->connection_type == RC) {
++			attr.max_rd_atomic  = 1;
++			if (ibv_modify_qp(ctx->qp[0], &attr,
++					IBV_QP_STATE              |
++					IBV_QP_SQ_PSN             |
++					IBV_QP_TIMEOUT            |
++					IBV_QP_RETRY_CNT          |
++					IBV_QP_RNR_RETRY          |
++					IBV_QP_MAX_QP_RD_ATOMIC)) {
++				fprintf(stderr, "Failed to modify RC QP to RTS\n");
++				return 1;
++			}
++
++		} else {
++			if(ibv_modify_qp(ctx->qp[0],&attr,IBV_QP_STATE |IBV_QP_SQ_PSN)) {
++				fprintf(stderr, "Failed to modify UC QP to RTS\n");
++				return 1;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int set_recv_wqes(struct pingpong_context *ctx,
++						 struct perftest_parameters *user_param) {
++						
++	int					i,j,buff_size;
++	int 				duplex_ind;
++	struct ibv_recv_wr  *bad_wr_recv;
++
++	i = (user_param->duplex && user_param->use_mcg) ? 1 : 0;
++	duplex_ind = (user_param->duplex && !user_param->use_mcg) ? 1 : 0;
++
++	buff_size = BUFF_SIZE(ctx->size) + IF_UD_ADD(user_param->connection_type);
++
++	while (i < user_param->num_of_qps) {
++
++		ctx->sge_list[i].addr   = (uintptr_t)ctx->buf[i] + duplex_ind*buff_size;
++
++		if (user_param->connection_type == UD) 
++			ctx->sge_list[i].addr += (CACHE_LINE_SIZE - UD_ADDITION);
++
++		ctx->sge_list[i].length = SIZE(user_param->connection_type,user_param->size);
++		ctx->sge_list[i].lkey   = ctx->mr[i]->lkey;
++		ctx->rwr[i].sg_list     = &ctx->sge_list[i];
++		ctx->rwr[i].wr_id       = i;
++		ctx->rwr[i].next        = NULL;
++		ctx->rwr[i].num_sge	    = MAX_RECV_SGE;
++		ctx->my_addr[i]		    = (uintptr_t)ctx->buf[i] + duplex_ind*buff_size;
++		
++		for (j = 0; j < user_param->rx_depth; ++j) {
++
++			if (ibv_post_recv(ctx->qp[i],&ctx->rwr[i],&bad_wr_recv)) {
++				fprintf(stderr, "Couldn't post recv Qp = %d: counter=%d\n",i,j);
++				return 1;
++			}
++
++			if (user_param->size <= (CYCLE_BUFFER / 2))
++				increase_loc_addr(&ctx->sge_list[i],user_param->size,j,ctx->my_addr[i],user_param->connection_type);
++		}
++		i++;
++	}
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static void set_send_wqe(struct pingpong_context *ctx,int rem_qpn,
++						 struct perftest_parameters *user_param) {
++
++	ctx->list.addr     = (uintptr_t)ctx->buf[0];
++	ctx->list.lkey 	   = ctx->mr[0]->lkey;
++
++	ctx->wr.sg_list    = &ctx->list;
++	ctx->wr.num_sge    = 1;
++	ctx->wr.opcode     = IBV_WR_SEND;
++	ctx->wr.next       = NULL;
++	ctx->wr.wr_id      = PINGPONG_SEND_WRID;
++	ctx->wr.send_flags = IBV_SEND_SIGNALED;
++
++	if (user_param->connection_type == UD) {
++		ctx->wr.wr.ud.ah          = ctx->ah;
++		ctx->wr.wr.ud.remote_qkey = DEF_QKEY;
++		ctx->wr.wr.ud.remote_qpn  = rem_qpn;
++	}
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static int pp_drain_qp(struct pingpong_context *ctx,
++						struct perftest_parameters *user_param,
++						int psn,struct pingpong_dest *dest,
++						struct mcast_parameters *mcg_params) {
++
++	struct ibv_qp_attr attr;
++	struct ibv_wc      wc;
++	int                i;
++
++	memset(&attr, 0, sizeof attr);
++	attr.qp_state = IBV_QPS_ERR;
++
++	for (i = 0; i <  user_param->num_of_qps; i++) {
++
++		if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE)) {
++			fprintf(stderr, "Failed to modify RC QP to ERR\n");
++			return 1;
++		}
++
++		while (ibv_poll_cq(ctx->cq,1,&wc));
++   
++		attr.qp_state = IBV_QPS_RESET;
++
++		if (ibv_modify_qp(ctx->qp[i],&attr,IBV_QP_STATE)) {
++			fprintf(stderr, "Failed to modify RC QP to RESET\n");
++			return 1;
++		}
++
++		if(ctx_modify_qp_to_init(ctx->qp[i],user_param)) {
++			return 1;
++		}
++
++		if (user_param->use_mcg) {
++
++			if ((!user_param->duplex && user_param->machine == SERVER) || (user_param->duplex && i > 0)) {
++				if (ibv_attach_mcast(ctx->qp[i],&mcg_params->mgid,mcg_params->mlid)) {
++					fprintf(stderr, "Couldn't attach QP to MultiCast group");
++					return 1;
++				}
++			}
++		}
++	}
++
++	if (pp_connect_ctx(ctx,psn,dest,user_param)) {
++		return 1;
++	}
++
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++static void print_report(struct perftest_parameters *user_param) {
++
++	double cycles_to_units;
++	unsigned long tsize;	/* Transferred size, in megabytes */
++	int i, j;
++	int opt_posted = 0, opt_completed = 0;
++	cycles_t opt_delta;
++	cycles_t t;
++
++
++	opt_delta = tcompleted[opt_posted] - tposted[opt_completed];
++
++	if (user_param->noPeak == OFF) {
++		/* Find the peak bandwidth, unless asked not to in command line */
++		for (i = 0; i < user_param->iters; ++i)
++			for (j = i; j < user_param->iters; ++j) {
++				t = (tcompleted[j] - tposted[i]) / (j - i + 1);
++				if (t < opt_delta) {
++					opt_delta  = t;
++					opt_posted = i;
++					opt_completed = j;
++				}
++			}
++	}
++
++	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
++
++	tsize = user_param->duplex ? 2 : 1;
++	tsize = tsize * user_param->size;
++	printf(REPORT_FMT,user_param->size,user_param->iters,(user_param->noPeak == OFF) * tsize * cycles_to_units / opt_delta / 0x100000,
++	       tsize * user_param->iters * cycles_to_units /(tcompleted[user_param->iters - 1] - tposted[0]) / 0x100000);
++}
++
++/****************************************************************************** 
++ * Important note :															  
++ * In case of UD/UC this is NOT the way to measureBW since we are running with 
++ * loop on the send side , while we should run on the recieve side or enable 
++ * retry in SW , Since the sender may be faster than the reciver.
++ * Although	we had posted recieve it is not enough and might end this will
++ * result in deadlock of test since both sides are stuck on poll cq.
++ * In this test i do not solve this for the general test ,need to write
++ * seperate test for UC/UD but in case the tx_depth is ~1/3 from the
++ * number of iterations this should be ok .
++ * Also note that the sender is limited in the number of send, ans
++ * i try to make the reciver full .
++ ******************************************************************************/
++int run_iter_bi(struct pingpong_context *ctx, 
++				struct perftest_parameters *user_param)  {
++
++	int                     scnt    = 0;
++	int 					ccnt    = 0;
++	int 					rcnt    = 0;
++	int 					i       = 0;
++	int 					num_of_qps = user_param->num_of_qps;
++	int 					ne;
++	struct ibv_wc 			*wc          = NULL;
++	int 					*rcnt_for_qp = NULL;
++	struct ibv_recv_wr      *bad_wr_recv = NULL;
++	struct ibv_send_wr 		*bad_wr      = NULL;
++
++	ALLOCATE(rcnt_for_qp,int,user_param->num_of_qps);
++	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
++	memset(rcnt_for_qp,0,sizeof(int)*user_param->num_of_qps);
++
++	if (user_param->use_mcg)
++		num_of_qps--; 
++	
++	// Set the length of the scatter in case of ALL option.
++	ctx->list.length = user_param->size;
++	ctx->list.addr   = (uintptr_t)ctx->buf[0];
++	ctx->wr.send_flags = IBV_SEND_SIGNALED;
++	
++	if (user_param->size <= user_param->inline_size) 
++		ctx->wr.send_flags |= IBV_SEND_INLINE; 
++
++	while (ccnt < user_param->iters || rcnt < user_param->iters) {
++                
++		while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth / 2) {
++
++			if (scnt %  CQ_MODERATION == 0 && CQ_MODERATION > 1)
++				ctx->wr.send_flags &= ~IBV_SEND_SIGNALED;
++
++			tposted[scnt] = get_cycles();
++			if (ibv_post_send(ctx->qp[0],&ctx->wr, &bad_wr)) {
++				fprintf(stderr, "Couldn't post send: scnt=%d\n",scnt);
++				return 1;
++			}
++
++			if (user_param->size <= (CYCLE_BUFFER / 2))
++				increase_loc_addr(&ctx->list,user_param->size,scnt,(uintptr_t)ctx->buf[0],0);
++
++			++scnt;
++
++			if ((scnt % CQ_MODERATION) == (CQ_MODERATION - 1) || scnt == (user_param->iters - 1)) 
++				ctx->wr.send_flags |= IBV_SEND_SIGNALED;
++		}
++
++		if (user_param->use_event) {
++
++			if (ctx_notify_events(ctx->cq,ctx->channel)) {
++				fprintf(stderr,"Failed to notify events to CQ");
++				return 1;
++			}
++		}
++
++		do {
++			ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
++			if (ne > 0) {
++				for (i = 0; i < ne; i++) {
++					
++					if (wc[i].status != IBV_WC_SUCCESS)
++						 NOTIFY_COMP_ERROR_SEND(wc[i],scnt,ccnt);
++
++					if ((int) wc[i].wr_id == PINGPONG_SEND_WRID) {
++						ccnt += CQ_MODERATION;
++						if (ccnt >= user_param->iters - 1) 
++							tcompleted[user_param->iters - 1] = get_cycles();
++
++						else 
++							tcompleted[ccnt - 1] = get_cycles();
++					}
++
++					else {
++
++						rcnt_for_qp[wc[i].wr_id]++;
++						rcnt++;
++						if (ibv_post_recv(ctx->qp[wc[i].wr_id],&ctx->rwr[wc[i].wr_id],&bad_wr_recv)) {
++							fprintf(stderr, "Couldn't post recv Qp=%d rcnt=%d\n",(int)wc[i].wr_id , rcnt_for_qp[wc[i].wr_id]);
++							return 15;
++						}
++
++						if (user_param->size <= (CYCLE_BUFFER / 2))
++							increase_loc_addr(&ctx->sge_list[wc[i].wr_id],
++							  user_param->size,rcnt_for_qp[wc[i].wr_id] + user_param->rx_depth - 1,
++							  ctx->my_addr[wc[i].wr_id],user_param->connection_type);	
++					}
++				}
++			}
++		} while (ne > 0);
++
++		if (ne < 0) {
++			fprintf(stderr, "poll CQ failed %d\n", ne);
++			return 1;
++		}
++	}
++	
++	if (user_param->size <= user_param->inline_size) 
++		ctx->wr.send_flags &= ~IBV_SEND_INLINE;
++	
++	free(rcnt_for_qp);
++	free(wc);
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++int run_iter_uni_server(struct pingpong_context *ctx, 
++						struct perftest_parameters *user_param) {
++
++	int 				rcnt = 0;
++	int 				ne,i;
++	int                 *rcnt_for_qp = NULL;
++	struct ibv_wc 		*wc          = NULL;
++	struct ibv_recv_wr  *bad_wr_recv = NULL;
++
++	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
++	ALLOCATE(rcnt_for_qp,int,user_param->num_of_qps);
++
++	memset(rcnt_for_qp,0,sizeof(int)*user_param->num_of_qps);
++
++	while (rcnt < user_param->iters) {
++
++		if (user_param->use_event) {
++			if (ctx_notify_events(ctx->cq,ctx->channel)) {
++				fprintf(stderr ," Failed to notify events to CQ");
++				return 1;
++			}
++		}
++		
++		do {
++			ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
++			if (ne > 0) {
++				for (i = 0; i < ne; i++) {
++					
++					if (wc[i].status != IBV_WC_SUCCESS) 
++						NOTIFY_COMP_ERROR_RECV(wc[i],rcnt_for_qp[wc[i].wr_id]);
++						
++					rcnt_for_qp[wc[i].wr_id]++;
++					tcompleted[rcnt++] = get_cycles();
++
++				   	if (ibv_post_recv(ctx->qp[wc[i].wr_id],&ctx->rwr[wc[i].wr_id],&bad_wr_recv)) {
++						fprintf(stderr, "Couldn't post recv Qp=%d rcnt=%d\n",(int)wc[i].wr_id,rcnt_for_qp[wc[i].wr_id]);
++						return 15;
++					}
++
++					if (user_param->size <= (CYCLE_BUFFER / 2))
++						increase_loc_addr(&ctx->sge_list[wc[i].wr_id],user_param->size,
++										  rcnt_for_qp[wc[i].wr_id] + user_param->rx_depth,
++										  ctx->my_addr[wc[i].wr_id],user_param->connection_type);						
++				}
++			}
++		} while (ne > 0);
++
++		if (ne < 0) {
++			fprintf(stderr, "Poll Recieve CQ failed %d\n", ne);
++			return 1;
++		}
++	}
++
++	tposted[0] = tcompleted[0];
++	free(wc);
++	free(rcnt_for_qp);
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++int run_iter_uni_client(struct pingpong_context *ctx, 
++						struct perftest_parameters *user_param) {
++
++	int 		       ne;
++	int 			   i    = 0;
++	int                scnt = 0;
++	int                ccnt = 0;
++	struct ibv_wc      *wc     = NULL;
++	struct ibv_send_wr *bad_wr = NULL;
++
++	ALLOCATE(wc,struct ibv_wc,DEF_WC_SIZE);
++
++	// Set the lenght of the scatter in case of ALL option.
++	ctx->list.length = user_param->size;
++	ctx->list.addr   = (uintptr_t)ctx->buf[0];
++	ctx->wr.send_flags = IBV_SEND_SIGNALED; 
++
++	if (user_param->size <= user_param->inline_size) 
++		ctx->wr.send_flags |= IBV_SEND_INLINE; 
++	
++
++	while (scnt < user_param->iters || ccnt < user_param->iters) {
++		while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) {
++
++			if (scnt %  CQ_MODERATION == 0 && CQ_MODERATION > 1)
++				ctx->wr.send_flags &= ~IBV_SEND_SIGNALED;
++
++			tposted[scnt] = get_cycles();
++			if (ibv_post_send(ctx->qp[0], &ctx->wr, &bad_wr)) {
++				fprintf(stderr, "Couldn't post send: scnt=%d\n",scnt);
++				return 1;
++			}
++
++			if (user_param->size <= (CYCLE_BUFFER / 2))
++				increase_loc_addr(&ctx->list,user_param->size,scnt,(uintptr_t)ctx->buf[0],0);
++
++			scnt++;
++
++			if ((scnt % CQ_MODERATION) == (CQ_MODERATION - 1) || scnt == (user_param->iters - 1)) 
++				ctx->wr.send_flags |= IBV_SEND_SIGNALED;
++		}
++
++		if (ccnt < user_param->iters) {	
++			
++			if (user_param->use_event) {
++				if (ctx_notify_events(ctx->cq,ctx->channel)) {
++					fprintf(stderr , " Failed to notify events to CQ");
++					return 1;
++				}
++			} 
++			do {
++				ne = ibv_poll_cq(ctx->cq,DEF_WC_SIZE,wc);
++				if (ne > 0) {
++					for (i = 0; i < DEF_WC_SIZE; i++) {
++
++						if (wc[i].status != IBV_WC_SUCCESS) 
++							NOTIFY_COMP_ERROR_SEND(wc[i],scnt,ccnt);
++			
++						ccnt += CQ_MODERATION;
++						if (ccnt >= user_param->iters - 1) 
++							tcompleted[user_param->iters - 1] = get_cycles();
++
++						else 
++							tcompleted[ccnt - 1] = get_cycles();
++					}
++				}
++                         
++					
++			} while (ne > 0);
++
++			if (ne < 0) {
++				fprintf(stderr, "poll CQ failed\n");
++				return 1;
++			}
++		}
++	}
++
++	if (user_param->size <= user_param->inline_size) 
++		ctx->wr.send_flags &= ~IBV_SEND_INLINE;
++
++	free(wc);
++	return 0;
++}
++
++/****************************************************************************** 
++ *
++ ******************************************************************************/
++int main(int argc, char *argv[])
++{
++	struct ibv_device		 	*ib_dev = NULL;
++	struct pingpong_context  	*ctx;
++	struct pingpong_dest	 	my_dest,rem_dest;
++	struct perftest_parameters  user_param;
++	struct mcast_parameters     mcg_params;
++	int                      	i = 0;
++	int                      	size_max_pow = 24;
++	int							size_of_arr;
++
++	// Pointer to The relevent function of run_iter according to machine type.
++	int (*ptr_to_run_iter_uni)(struct pingpong_context*,struct perftest_parameters*);
++
++	/* init default values to user's parameters */
++	memset(&user_param, 0 , sizeof(struct perftest_parameters));
++	memset(&mcg_params, 0 , sizeof(struct mcast_parameters));
++	memset(&my_dest   , 0 , sizeof(struct pingpong_dest));
++	memset(&rem_dest   , 0 , sizeof(struct pingpong_dest));
++ 
++	user_param.verb    = SEND;
++	user_param.tst     = BW;
++	user_param.version = VERSION;
++
++	if (parser(&user_param,argv,argc)) 
++		return 1;
++
++	printf(RESULT_LINE);
++
++	user_param.rx_depth = (user_param.iters < user_param.rx_depth) ? user_param.iters : user_param.rx_depth ;
++
++    if (user_param.use_mcg) {
++
++		user_param.connection_type = UD;
++		if (user_param.duplex) {
++			user_param.num_of_qps++;
++			printf("                    Send Bidirectional BW  -  Multicast Test\n");
++		}
++		else {
++			printf("                    Send BW  -  Multicast Test\n");
++			if (user_param.machine == CLIENT)
++				user_param.num_of_qps = 1;
++		}
++    }
++
++	else if (user_param.duplex) {
++		    printf("                    Send Bidirectional BW Test\n");
++	} else 
++		    printf("                    Send BW Test\n");
++
++	if (user_param.use_event) 
++		printf(" Test with events.\n");
++
++	if (user_param.connection_type == RC)
++		printf(" Connection type : RC\n");
++	else if (user_param.connection_type == UC)
++		printf(" Connection type : UC\n");
++	else{
++		printf(" Connection type : UD\n");
++	}
++	
++	// Done with parameter parsing. Perform setup.
++	if (user_param.all == ON) {
++		// since we run all sizes 
++		user_param.size = MAX_SIZE;
++	}
++
++	srand48(getpid() * time(NULL));
++	page_size = sysconf(_SC_PAGESIZE);
++
++	ib_dev = ctx_find_dev(user_param.ib_devname);
++	if (!ib_dev)
++		return 7;
++
++	mcg_params.ib_devname = ibv_get_device_name(ib_dev);
++
++	ctx = pp_init_ctx(ib_dev,&user_param);
++	if (!ctx)
++		return 1;
++
++	// Set up the Connection.
++	if (set_up_connection(ctx,&user_param,&my_dest,&mcg_params)) {
++		fprintf(stderr," Unable to set up socket connection\n");
++		return 1;
++	}	
++
++	// Init the connection and print the local data.
++	if (init_connection(&user_param,&my_dest)) {
++		fprintf(stderr," Unable to init the socket connection\n");
++		return 1;
++	}
++
++	// shaking hands and gather the other side info.
++    if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
++        fprintf(stderr,"Failed to exchange date between server and clients\n");
++        return 1;
++        
++    }
++	// For printing only MGID in the remote side.
++	user_param.side = REMOTE;
++	ctx_print_pingpong_data(&rem_dest,&user_param);
++
++	// Joining the Send side port the Mcast gid
++	if (user_param.use_mcg && (user_param.machine == CLIENT || user_param.duplex)) {
++		memcpy(mcg_params.mgid.raw, rem_dest.gid.raw, 16);
++		if (set_mcast_group(ctx,&user_param,&mcg_params)) {
++			fprintf(stderr," Unable to Join Sender to Mcast gid\n");
++			return 1;
++		}
++	}
++
++	// Prepare IB resources for rtr/rts.
++	if (pp_connect_ctx(ctx,my_dest.psn,&rem_dest,&user_param)) {
++		fprintf(stderr," Unable to Connect the HCA's through the link\n");
++		return 1;
++	}
++	
++	// shaking hands and gather the other side info.
++    if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
++        fprintf(stderr,"Failed to exchange date between server and clients\n");
++        return 1;
++        
++    }
++
++	if (user_param.use_event) {
++		if (ibv_req_notify_cq(ctx->cq, 0)) {
++			fprintf(stderr, " Couldn't request CQ notification\n");
++			return 1;
++		} 
++	}
++
++	printf(RESULT_LINE);
++	printf(RESULT_FMT);
++
++	size_of_arr = (user_param.duplex) ? 1 : user_param.num_of_qps;
++
++	ALLOCATE(tposted,cycles_t,user_param.iters*size_of_arr);
++	ALLOCATE(tcompleted,cycles_t,user_param.iters*size_of_arr);
++
++	if (user_param.machine == SERVER || user_param.duplex) {
++		ALLOCATE(ctx->rwr,struct ibv_recv_wr,user_param.num_of_qps);
++		ALLOCATE(ctx->sge_list,struct ibv_sge,user_param.num_of_qps);
++		ALLOCATE(ctx->my_addr ,uint64_t ,user_param.num_of_qps);
++	}
++
++	ptr_to_run_iter_uni = (user_param.machine == CLIENT) ?	&run_iter_uni_client : &run_iter_uni_server;
++	
++	if (user_param.machine == SERVER && !user_param.duplex) {
++		user_param.noPeak = ON;
++	}
++
++	if (user_param.machine == CLIENT || user_param.duplex) {
++		set_send_wqe(ctx,rem_dest.qpn,&user_param);
++	}
++
++	if (user_param.all == ON) {
++
++		if (user_param.connection_type == UD) 
++		   size_max_pow =  (int)UD_MSG_2_EXP(MTU_SIZE(user_param.curr_mtu)) + 1;
++
++		for (i = 1; i < size_max_pow ; ++i) {
++			user_param.size = 1 << i;
++
++			if (user_param.machine == SERVER || user_param.duplex) {
++				if (set_recv_wqes(ctx,&user_param)) {
++					fprintf(stderr," Failed to post receive recv_wqes\n");
++					return 1;
++				}
++			}
++
++			if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
++				fprintf(stderr,"Failed to exchange date between server and clients\n");
++				return 1;
++			}
++
++			if (user_param.duplex) {
++				if(run_iter_bi(ctx,&user_param))
++					return 17;
++			} else {
++				if((*ptr_to_run_iter_uni)(ctx,&user_param))
++					return 17;
++			}
++			print_report(&user_param);
++
++			if (pp_drain_qp(ctx,&user_param,my_dest.psn,&rem_dest,&mcg_params)) {
++				fprintf(stderr,"Failed to drain Recv queue (performance optimization)\n");
++				return 1;
++			}
++
++			if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
++				fprintf(stderr,"Failed to exchange date between server and clients\n");
++				return 1;
++			}
++        
++		}
++
++	} else {
++
++		if (user_param.machine == SERVER || user_param.duplex) {
++			if (set_recv_wqes(ctx,&user_param)) {
++				fprintf(stderr," Failed to post receive recv_wqes\n");
++				return 1;
++			}
++		}
++
++		if (ctx_hand_shake(&user_param,&my_dest,&rem_dest)) {
++			fprintf(stderr,"Failed to exchange date between server and clients\n");
++			return 1;
++		}
++
++		if (user_param.duplex) {
++			if(run_iter_bi(ctx,&user_param))
++				return 18;
++
++		} else {
++			if((*ptr_to_run_iter_uni)(ctx,&user_param))
++				return 18;
++		}
++
++		print_report(&user_param);	
++	}
++		
++	if (ctx_close_connection(&user_param,&my_dest,&rem_dest)) {
++		fprintf(stderr," Failed to close connection between server and client\n");
++		return 1;
++	}
++
++	printf(RESULT_LINE);
++	return destroy_ctx_resources(ctx,&user_param,&my_dest,&rem_dest,&mcg_params);
++}
+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>
+ 
+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"
+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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,53 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		qperf
+COMPONENT_VERSION=	0.4.6
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC)-0.1.gb81434e.tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:9f9d8fcc06ac8393ed74498ca391bbb5c76a7798
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/qperf/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+LIBS +=         -lsocket -lnsl -lkstat -lrdmacm -libverbs
+
+COMPONENT_INSTALL_ENV +=	INSTALL="$(INSTALL) -m 755"
+
+COMPONENT_PRE_CONFIGURE_ACTION = \
+        (mkdir $(@D)/src ; cd $(@D)/src ; ln -s $(SOURCE_DIR)/src/help.txt ; \
+         ln -s $(SOURCE_DIR)/src/mkhelp ; ln -s $(SOURCE_DIR)/src/mkman)
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/qperf/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,511 @@
+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,16 @@
+     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_family = AF_INET;
++		aip->ai_socktype = SOCK_STREAM;
++		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,19 @@
+ #include <sys/utsname.h>
+ #include "qperf.h"
+ 
++#if (defined(__SVR4) && defined(__sun))
++#include <sys/filio.h>
++#include <limits.h>	/* times() */
++#include <kstat.h>	/* libkstat */
++#include <sys/types.h>
++#include <sys/processor.h>
++#include <sys/procset.h>
++#include <strings.h>
++#include <infiniband/ofa_solaris.h>
+ 
++static kstat_ctl_t	*kc = NULL;	/* libkstat cookie */
++#endif
++
+ /*
+  * Configurable parameters.  If your change makes this version of qperf
+  * incompatible with previous versions (usually a change to the Req structure),
+@@ -224,7 +236,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,7 +271,9 @@
+ static STAT     IStat;
+ static int      ListenFD;
+ static LOOP    *Loops;
++#if !(defined(__SVR4) && defined(__sun))
+ static int      ProcStatFD;
++#endif
+ static STAT     RStat;
+ static int      ShowIndex;
+ static SHOW     ShowTable[256];
+@@ -601,6 +617,9 @@
+     initialize();
+     set_signals();
+     do_args(&argv[1]);
++#if (defined(__SVR4) && defined(__sun))
++    (void) kstat_close(kc);
++#endif
+     return 0;
+ }
+ 
+@@ -617,14 +636,24 @@
+     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))
++    while ((kc = kstat_open()) == NULL) {
++	if (errno == EAGAIN)
++	    (void) poll(NULL, 0, 200);
++	else
++	    error(SYS, "cannot open /dev/kstat");
++    }
++#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 +672,7 @@
+         s++;
+     return s;
+ }
++#endif
+ 
+ 
+ /*
+@@ -1667,13 +1697,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 +1767,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 +1781,23 @@
+             }
+         }
+     }
++#else
++    cpu[0] = '\0';
++    speed[0] = '\0';
+ 
++    if (!sol_get_cpu_info(&info)) {
++	(void) strcpy(cpu, info.cpu_name);
++	cpus = info.cpu_num;
++
++	if (info.cpu_mhz < 1000)
++		snprintf(speed, sizeof(speed), " %dMHz", info.cpu_mhz);
++	else
++		snprintf(speed, sizeof(speed), " %.1fGHz", info.cpu_mhz/1000.0);
++    } else {
++	return;
++    }
++#endif
++
+     /* Number of CPUs */
+     if (cpus == 1)
+         count[0] = '\0';
+@@ -2615,14 +2667,22 @@
+ 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 +2831,74 @@
+ /*
+  * 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;
++	size_t	i, nr_cpus;
++	kstat_t	*ksp;
++	kstat_named_t	*knp;
++	uint64_t	t_user = 0, t_kernel = 0, t_idle = 0;
++	uint64_t	t_irq = 0, t_iowait = 0;
++
++	timex[T_REAL] = times(&tms);
++
++	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
++
++	/* Aggregate the value of all CPUs */
++	for (i = 0; i < nr_cpus; i++) {
++		ksp = kstat_lookup(kc, "cpu", i, "sys");
++		if (ksp == NULL)
++	        	return;
++
++		if (kstat_read(kc, ksp, NULL) == -1)
++	        	return;
++
++		knp = (kstat_named_t *)kstat_data_lookup(ksp, "cpu_ticks_user");
++		if (knp == NULL)
++			return;
++		t_user += knp->value.ui64;
++
++		knp = (kstat_named_t *)kstat_data_lookup(ksp,
++		    "cpu_ticks_kernel");
++		if (knp == NULL)
++			return;
++		t_kernel += knp->value.ui64;
++
++		knp = (kstat_named_t *)kstat_data_lookup(ksp, "cpu_ticks_idle");
++		if (knp == NULL)
++			return;
++		t_idle += knp->value.ui64;
++
++		knp = (kstat_named_t *)kstat_data_lookup(ksp, "cpu_ticks_wait");
++		if (knp == NULL)
++			return;
++		t_iowait += knp->value.ui64;
++
++		knp = (kstat_named_t *)kstat_data_lookup(ksp, "cpu_nsec_intr");
++		if (knp == NULL)
++			return;
++		t_irq += knp->value.ui64;	/* This is in NSEC */
++	}
++	timex[T_USER] = t_user;
++	timex[T_NICE] = 0;
++	timex[T_KERNEL] = t_kernel;
++	timex[T_IDLE] = t_idle;
++	timex[T_IOWAIT] = t_iowait;
++	timex[T_IRQ] = NSEC_TO_TICK(t_irq);	 /* 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 +2927,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>
+@@ -566,11 +570,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 +588,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 +602,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 +612,7 @@
+     rd_params(IBV_QPT_UC, K64, 1, 0);
+     rd_client_bw(IBV_QPT_UC);
+     show_results(BANDWIDTH_SR);
++#endif
+ }
+ 
+ 
+@@ -606,7 +622,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 +636,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 +651,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 +665,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 +681,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 +695,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 +710,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 +724,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 +740,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
+ }
+ 
+ 
+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.
+@@ -352,7 +356,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 +381,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 +443,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)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/rds-tools/Makefile	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,64 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		rds-tools
+COMPONENT_VERSION=	2.0.4
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:f8ee78327cfaa74eb13232b0276db297d6d5cdbe
+COMPONENT_ARCHIVE_URL=	http://www.openfabrics.org/downloads/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE)
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include ../ofed.mk
+
+CFLAGS +=	-O2 -Wall -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ $(CPPFLAGS)
+
+LIBS +=	-lsocket -lnsl -llgrp -lkstat
+
+CLEANUP_DIRS =	$(PROTOUSRBINDIR)/net
+
+CLEANUP_FILES =\
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man7/rds.7\
+	$(PROTO_DIR)/$(CONFIGURE_MANDIR)/man7rds-rdma.7
+
+COMPONENT_POST_INSTALL_ACTION =\
+	$(RM) $(CLEANUP_FILES);\
+	$(RM) $(CLEANUP_DIRS)
+
+COMPONENT_BUILD_ENV += CFLAGS="$(CFLAGS)"
+COMPONENT_INSTALL_ENV += INSTALL=$(INSTALL)
+
+COMPONENT_PRE_CONFIGURE_ACTION =	($(CLONEY) $(SOURCE_DIR) $(@D))
+
+# common targets
+build:		$(BUILD_32_and_64)
+
+install:	$(INSTALL_32_and_64)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+test:		$(NO_TESTS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/rds-tools/patches/base.patch	Tue Jul 05 19:16:33 2011 -0700
@@ -0,0 +1,1466 @@
+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,8 +28,13 @@
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <getopt.h>
++#if !(defined(__SVR4) && defined(__sun))
+ #include <byteswap.h>
+ #include "rds.h"
++#else
++#include <infiniband/ofa_solaris.h>
++#include <sys/rds.h>
++#endif
+ 
+ #include "pfhack.h"
+ 
+@@ -110,6 +121,7 @@
+ struct child_control {
+ 	pid_t pid;
+ 	int ready;
++	int stopping;
+ 	struct timeval start;
+ 	struct counter cur[NR_STATS];
+ 	struct counter last[NR_STATS];
+@@ -254,7 +266,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);
+@@ -281,6 +306,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 +338,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 +362,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 +370,7 @@
+ #define htonll(x)	(x)
+ #define ntohll(x)	(x)
+ #endif
++#endif /* Not sun */
+ 
+ static void encode_hdr(struct header *dst, const struct header *hdr)
+ {
+@@ -584,7 +614,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);
+ 
+@@ -677,7 +711,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,7 +866,7 @@
+ 	}
+ 
+ 	if (!failed)
+-		trace("compare pass pattern %Lx addr %p\n",
++		trace("compare pass pattern 0x%Lx addr %p\n",
+ 			(unsigned long long) pattern, addr);
+ }
+ 
+@@ -865,7 +903,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 +957,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 +988,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,
+@@ -1007,6 +1048,9 @@
+ 	t->drain_rdmas = 0;
+ }
+ 
++#if defined(__SVR4) && defined(__sun)
++#undef MSG_MAXIOVLEN
++#endif
+ #define MSG_MAXIOVLEN 2
+ 
+ /*
+@@ -1560,7 +1604,12 @@
+ 	struct timeval start;
+         int do_work = opts->simplex ? active : 1;
+ 
++#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 +1621,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));
+@@ -1625,6 +1678,10 @@
+ 				;
+ 		}
+ 
++		/* 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++) {
+@@ -1665,8 +1722,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);
+ 
+@@ -1699,7 +1760,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 */
+ 	}
+@@ -1967,7 +2028,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 +2036,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,
+@@ -2139,7 +2200,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);
+ 	}
+@@ -2517,7 +2583,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);
+ 
+@@ -2589,6 +2659,7 @@
+ { "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 },
+@@ -2652,7 +2723,7 @@
+ 	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:vVg:z",
+ 				long_options, &index);
+ 		if (c == -1)
+ 			break;
+@@ -2711,6 +2782,10 @@
+ 			case 'V':
+ 				opts.tracing = 1;
+ 				break;
++			case 'g':
++				lgrp_id = (lgrp_id_t)parse_ull(optarg,
++				    (uint32_t)~0);
++				break;
+ 			case OPT_USE_CONG_MONITOR:
+ 				opts.use_cong_monitor = parse_ull(optarg, 1);
+ 				break;
+@@ -2786,6 +2861,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,27 @@
+ #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>
++#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]))
+@@ -234,8 +245,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 +279,10 @@
+ 	char optstring[258] = "v+";
+ 	int given_options = 0;
+ 	socklen_t len = 0;
++#if defined(__SVR4) && defined(__sun)
++	socklen_t ulen;
++	struct rds_info_arg arg;
++#endif
+ 	void *data = NULL;
+ 	int fd;
+ 	int each;
+@@ -322,6 +339,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 +363,60 @@
+ 				return 1;
+ 			}
+ 		}
++#else
++		/* 1st call gets the length of the data available */
++		ulen = 0;
++		bzero(&arg, sizeof (struct rds_info_arg));
++		arg.lenp = (uint64_t)(uintptr_t)&ulen;
++		arg.datap = NULL;
++		each = ioctl(fd, infos[i].opt_val, &arg);
++		if ((each < 0) && (errno != ENOSPC)) {
++			verbosef(0, stderr, "%s: Unable get statistics: %s\n",
++			    progname, strerror(errno));
++			return 1;
++		}
+ 
++		/* No data at the driver */
++		if (ulen == 0)
++			invalid_opt = 1;;
++#endif
++
+ 		if (invalid_opt)
+ 			continue;
+ 
++#if !(defined(__SVR4) && defined(__sun))
+ 		infos[i].print(data, each, len, infos[i].extra);
++#else
++		do {
++			arg.datap = (uint64_t)(uintptr_t)realloc(
++			    (char *)(uintptr_t)arg.datap, ulen);
++			if (arg.datap == NULL) {
++			    verbosef(0, stderr, "%s: Unable to allocate memory "
++				"for %u bytes of info: %s\n",
++				progname, ulen, strerror(errno));
++				return 1;
++			}
+ 
++			/* 2nd call gets the data */
++			len = ulen;
++			each = ioctl(fd, infos[i].opt_val, &arg);
++			if ((each < 0) && (errno != ENOSPC)) {
++				verbosef(0, stderr,
++				    "%s: Unable get statistics: %s\n",
++				    progname, strerror(errno));
++				return 1;
++			}
++		} while (ulen > len);
++
++		infos[i].print((void *)(uintptr_t)arg.datap, each, ulen,
++		    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,150 @@
+-.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	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.
++
++.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	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	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,54 @@
+-.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
++.B rds-ping [-c count] [-i interval] [-I local_addr] remote_addr
++
++.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\-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 <olaf.kirch@oracle.com>.
+-.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,11 @@
+ #include <sys/poll.h>
+ #include <fcntl.h>
+ #include <getopt.h>
++#if defined(__SVR4) && defined(__sun)
++#include <sys/rds.h>
++#else
+ #include "rds.h"
++#endif
+ 
+ #include "pfhack.h"
+ 
+@@ -155,7 +159,12 @@
+ 	}
+ 
+ 	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);
+@@ -181,7 +190,7 @@
+ 				break;
+ 
+ 			timeradd(&next_ts, &opt_wait, &next_ts);
+-			if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)))
++			if (sendto(sp->fd, NULL, 0, 0, (struct sockaddr *) &sin, sizeof(sin)) < 0)
+ 				err = errno;
+ 			sp->sent_id = ++sent;
+ 			sp->sent_ts = now;
+@@ -258,7 +267,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 +291,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 +305,9 @@
+ 
+ 		*src = sin.sin_addr;
+ 		close(ufd);
++#if defined(__SVR4) && defined(__sun)
++		sin.sin_family = AF_INET_OFFLOAD;
++#endif
+ 	}
+ 
+ 	sin.sin_addr = *src;
+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,10 +4,14 @@
+ 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 += -lsocket -lnsl -llgrp
+ 
+ HEADERS = kernel-list.h pfhack.h include/rds.h
+ COMMON_SOURCES = pfhack.c
+@@ -15,7 +19,7 @@
+ 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,103 @@
+-.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]
++      [-a ack_bytes] [-q request_bytes] [-D rdma_bytes]
++      [-d queue_depth] [-t Ar nr_tasks] [-c] [-R] [-V] [-v] [-o] 
++      [-I iovecs] -M [nr] [-z] [-g lgrpid]
++.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\-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 +104,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 +130,78 @@
+ 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
++\fB\-o
++Datagrams sent one way only (default is both)
++.TP
++\fB\-I iovecs
++RDMA: number of user buffers to target (default is 1, max is 512)
++.TP
++\fB\-M nr
++RDMA: mode (0=readwrite,1=readonly,2=writeonly)
++.TP
++\fB\-g lgrpid
++bind the process to the specified lgrp
++.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
++mbi 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 +208,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 */
--- a/make-rules/ips.mk	Wed Jul 06 02:16:21 2011 +0200
+++ b/make-rules/ips.mk	Tue Jul 05 19:16:33 2011 -0700
@@ -120,13 +120,13 @@
 	cat $(METADATA_TEMPLATE) $< >$@
 
 # mogrify the manifest
-$(MANIFEST_BASE)-%.mogrified:	%.p5m canonical-manifests
+$(MANIFEST_BASE)-%.mogrified:	%.p5m $(BUILD_DIR) canonical-manifests
 	$(PKGMOGRIFY) $(PKG_OPTIONS) $< \
 		$(PUBLISH_TRANSFORMS) | \
 		sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
 
 # mangle the file contents
-$(MANGLED_DIR):
+$(BUILD_DIR) $(MANGLED_DIR):
 	$(MKDIR) $@
 
 PKGMANGLE_OPTIONS = -D $(MANGLED_DIR) $(PKG_PROTO_DIRS:%=-d %)
--- a/make-rules/shared-macros.mk	Wed Jul 06 02:16:21 2011 +0200
+++ b/make-rules/shared-macros.mk	Tue Jul 05 19:16:33 2011 -0700
@@ -184,6 +184,9 @@
 MACH64_1 =	$(MACH:sparc=sparcv9)
 MACH64 =	$(MACH64_1:i386=amd64)
 
+CONFIGURE_32 =		$(BUILD_DIR_32)/.configured
+CONFIGURE_64 =		$(BUILD_DIR_64)/.configured
+
 BUILD_DIR_32 =		$(BUILD_DIR)/$(MACH32)
 BUILD_DIR_64 =		$(BUILD_DIR)/$(MACH64)