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;