[Pkg-ofed-commits] [libpsm2] 03/04: New upstream version 10.3-17

Brian Smith bsmith-guest at moszumanska.debian.org
Tue Nov 21 22:12:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

bsmith-guest pushed a commit to branch master
in repository libpsm2.

commit 79991d3a268816439b639c8b30367b1fd5248dd8
Author: Brian T. Smith <bsmith at systemfabricworks.com>
Date:   Tue Nov 21 16:04:55 2017 -0600

    New upstream version 10.3-17
---
 COMMIT                       |   2 +-
 Makefile                     |  31 +++++++-----
 buildflags.mak               |   6 +--
 makesdeb.sh                  | 102 +++++++++++++++++++++++++++++++--------
 opa/opa_debug.c              |   6 +--
 opa/opa_utils.c              |   8 +++-
 psm_context.c                |  38 +++++++++++++++
 psm_ep.c                     |  16 +++++++
 psm_log.h                    |  76 ++++++++++++++++--------------
 psm_mq_recv.c                |   6 +--
 psm_utils.c                  | 110 +++++++++++++++++++++++++------------------
 ptl.h                        |   5 ++
 ptl_ips/ips_proto_expected.c |  10 ++--
 ptl_ips/ips_proto_mq.c       |   8 ++--
 ptl_ips/ptl.c                |  14 ++++++
 ptl_ips/ptl_fwd.h            |   2 +
 ptl_ips/ptl_ips.h            |   1 +
 ptl_ips/ptl_rcvthread.c      |  21 +++++++--
 rpm_release_extension        |   2 +-
 19 files changed, 327 insertions(+), 137 deletions(-)

diff --git a/COMMIT b/COMMIT
index b6b4b33..d81e4f3 100644
--- a/COMMIT
+++ b/COMMIT
@@ -1 +1 @@
-6ca1de91a1ee2604096449942bbed93e0ad9311e
\ No newline at end of file
+f8df7f0de7139df384ea8b94dc8567885bf76070
\ No newline at end of file
diff --git a/Makefile b/Makefile
index f0a539d..8db7c1d 100644
--- a/Makefile
+++ b/Makefile
@@ -177,29 +177,34 @@ endif
 export 	LIBPSM2_COMPAT_CONF_DIR
 
 # The desired version number comes from the most recent tag starting with "v"
-ifeq (true, $(shell git rev-parse --is-inside-work-tree))
+ifeq (true, $(shell git rev-parse --is-inside-work-tree 2>/dev/null))
 ISGIT := 1 # Cache the result for later
 # Note, we don't define ISGIT if we are not in a git folder
 VERSION := $(shell git describe --tags --abbrev=0 --match='psm-v*' | sed -e 's/^psm-v//' -e 's/-/_/')
 else
+ISGIT := 0
 VERSION := version
 endif
 
 # If we have a file called 'rpm_release_extension' (as on github),
 # we take the release extension number from this file
-RELEASE_EXT := $(shell if [ -e rpm_release_extension ] ; then cat rpm_release_extension; fi)
-CURRENTSHA := $(shell if [ $(ISGIT) -a -f rpm_release_extension ] ; then git log --pretty=format:'%h' -n 1; fi)
-RPMEXTHASH := $(shell if [ $(ISGIT) -a -f rpm_release_extension ] ; then git log --pretty=format:'%h' -n 1 rpm_release_extension; fi)
+RELEASE_EXT := $(shell if [ -e rpm_release_extension ] ;\
+                       then cat rpm_release_extension; fi)
+CURRENTSHA := $(shell if [ $(ISGIT) = 1 -a -f rpm_release_extension ] ;\
+                      then git log --pretty=format:'%h' -n 1; fi)
+RPMEXTHASH := $(shell if [ $(ISGIT) = 1 -a -f rpm_release_extension ] ;\
+                      then git log --pretty=format:'%h' -n 1 rpm_release_extension; fi)
 
+# This logic should kick-in only on github
+ifdef RELEASE_EXT
+ifneq ($(CURRENTSHA), $(RPMEXTHASH))
 # On github, the last commit for each release should be the one to bump up
 # the release extension number in 'rpm_release_extension'. Further commits
 # are counted here and appended to the final rpm name to distinguish commits
 # present only on github
-NCOMMITS := $(shell if [ $(ISGIT) -a -f rpm_release_extension ] ; then git log --children $(RPMEXTHASH)..$(CURRENTSHA) . --pretty=oneline | wc -l; fi)
-
-# This logic should kick-in only on github
-ifdef RELEASE_EXT
-ifneq ($(CURRENTSHA), $(RPMEXTHASH))
+NCOMMITS := $(shell if [ $(ISGIT) = 1 -a -f rpm_release_extension ] ;\
+                    then git log --children $(RPMEXTHASH)..$(CURRENTSHA) \
+                    --pretty=oneline . | wc -l; fi)
 RELEASE := $(RELEASE_EXT)_$(NCOMMITS)
 endif
 endif
@@ -209,11 +214,11 @@ endif
 ifndef RELEASE
 RELTAG := "psm-v$(VERSION)"
 RELEASE := $(shell if [ -f rpm_release_extension ]; then cat rpm_release_extension;\
-		   elif [ $ISGIT ] ; then git rev-list $(RELTAG)..HEAD -- . | wc -l; \
+		   elif [ $(ISGIT) = 1 ] ; then git rev-list $(RELTAG)..HEAD -- . | wc -l; \
 		   else echo "release" ; fi)
 endif
 
-DIST_SHA := ${shell if [ $(ISGIT) ] ; then git log -n1 --pretty=format:%H .; \
+DIST_SHA := ${shell if [ $(ISGIT) = 1 ] ; then git log -n1 --pretty=format:%H .; \
 		else echo DIST_SHA ; fi}
 
 # Concatenated version and release
@@ -223,7 +228,7 @@ else
 VERSION_RELEASE := ${VERSION_RELEASE_OVERRIDE}
 endif
 
-LDLIBS := -lrt -lpthread -ldl -lnuma ${EXTRA_LIBS}
+LDLIBS := -lrt -ldl -lnuma ${EXTRA_LIBS} -pthread
 
 PKG_CONFIG ?= pkg-config
 
@@ -404,7 +409,7 @@ dist: distclean
 		mkdir -p ${OUTDIR}/${DIST}/$$dir; \
 		[ ! -d $$x ] && cp $$x ${OUTDIR}/${DIST}/$$dir; \
 	done
-	if [ $(ISGIT) ] ; then git log -n1 --pretty=format:%H . > ${OUTDIR}/${DIST}/COMMIT ; fi
+	if [ $(ISGIT) = 1 ] ; then git log -n1 --pretty=format:%H . > ${OUTDIR}/${DIST}/COMMIT ; fi
 	echo ${RELEASE} > ${OUTDIR}/${DIST}/rpm_release_extension
 	cd ${OUTDIR}; tar czvf ${DIST}.tar.gz ${DIST}
 	@echo "${DIST}.tar.gz is located in ${OUTDIR}/${DIST}.tar.gz"
diff --git a/buildflags.mak b/buildflags.mak
index 78efd70..67593f5 100644
--- a/buildflags.mak
+++ b/buildflags.mak
@@ -80,7 +80,7 @@ else
 	anerr := $(error Unknown Fortran compiler arch: ${FCARCH})
 endif # gfortran
 
-BASECFLAGS += $(BASE_FLAGS)
+BASECFLAGS += $(BASE_FLAGS) -pthread
 LDFLAGS += $(BASE_FLAGS)
 ASFLAGS += $(BASE_FLAGS)
 
@@ -155,9 +155,9 @@ ifneq (,${PSM_COVERAGE}) # This check must come after PSM_DEBUG to override opti
   LDFLAGS += -fprofile-arcs
 endif
 ifneq (,${PSM_LOG})
-   BASECFLAGS += -DPSM_LOG
+   BASECFLAGS += -DPSM2_LOG
 ifneq (,${PSM_LOG_FAST_IO})
-   BASECFLAGS += -DPSM_LOG_FAST_IO
+   BASECFLAGS += -DPSM2_LOG_FAST_IO
    PSM2_ADDITIONAL_GLOBALS += psmi_log_fini;psmi_log_message;
 endif
 endif
diff --git a/makesdeb.sh b/makesdeb.sh
index 072f741..6f3572b 100755
--- a/makesdeb.sh
+++ b/makesdeb.sh
@@ -21,7 +21,7 @@
 #
 #  BSD LICENSE
 #
-#  Copyright(c) 2016 Intel Corporation.
+#  Copyright(c) 2017 Intel Corporation.
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions
@@ -53,8 +53,17 @@
 # Stop on error
 set -e
 
-BUILD_OPTS="gFGbBAS"
-BUILD_OPT=F
+BUILD_OPTS="gGbBAS"
+BUILD_OPT=
+DEB_NAME=libpsm2
+
+# OUT_DIR is where the Makefile places its meta-data
+OUT_DIR=build_release
+
+# Set BUILD_DIR first, so user control can override the value
+# This is where this script places deb(s) and uses its build meta-data.
+# It can be set the same as OUT_DIR, and work just fine if desired.
+BUILD_DIR=temp.$$
 
 function literate()
 {
@@ -63,21 +72,61 @@ function literate()
 
 function usage()
 {
-    echo "Usage: ${0##*/} [-h] [debuild -($(literate $BUILD_OPTS '|'))]"
+    SCRIPT=${0##*/}
+    echo "Usage: $SCRIPT [OPTIONS]"
+    echo
+    echo "Creates tar ball of source and source rpms by default."
+    echo "Optionally generates binary rpm(s) "
+    echo
+    echo "     $(literate $BUILD_OPTS ',')"
+    echo "           Optional, default is full build (source and binary)"
+    echo "           Set single extension letter for dpkg-buildpackage argument"
+    echo "     -r <name>"
+    echo "           Optional, set the output deb name"
+    echo "     -e <basename ext>"
+    echo "           Optional, set a base name extension"
+    echo "           This only appends an extra string onto the base DEB name"
+    echo "           Does not affect supporting DEBs"
+    echo "     -c"
+    echo "           Optional, default is unset"
+    echo "           Sets PSM_CUDA=1, creating -cuda based manifest and debs"
+    echo "     -d <path>"
+    echo "           Optionally sets output folder for dpkg-buildpackage to use"
+    echo "     -h"
+    echo "           Shows this screen"
+    echo "     Examples:"
+    echo "           $SCRIPT b"
+    echo "           $SCRIPT s -c"
+    echo "           $SCRIPT -"
+    echo "           $SCRIPT -d ./temp"
+    echo "           $SCRIPT b -c -d output"
     exit $1
 }
 
-while getopts "h$BUILD_OPTS" OPT; do
+while getopts "r:e:cd:h$BUILD_OPTS" OPT; do
     case $OPT in
+        r)
+            DEB_NAME=$OPTARG
+            ;;
+        e)
+            BASE_EXT=$OPTARG
+            ;;
+        c)
+            export PSM_CUDA=1
+            DEB_EXT="-cuda"
+            ;;
+        d)
+            BUILD_DIR=$OPTARG
+            ;;
         h)
-            usage
-                ;;
+            usage 0
+            ;;
         \?)
             usage 1
-                ;;
+            ;;
         *)
-            BUILD_OPT=$OPT
-                ;;
+            BUILD_OPT=-$OPT
+            ;;
     esac
 done
 
@@ -87,19 +136,34 @@ shift $((OPTIND-1))
 # Check if we have any non-option parameters
 test ! $# -eq 0 && usage
 
-# Annotate changelog
-cat debian/changelog.in > debian/changelog
+# Generic cleanup, build, and tmp folder creation
+make distclean OUTDIR=$OUT_DIR
 
-GIT_TAG_PREFIX=v
-GIT_TAG_RELEASE=$(git describe --tags --long --match="$GIT_TAG_PREFIX*")
-VERSION=$(sed -e "s/^$GIT_TAG_PREFIX\(.\+\)-\(.\+\)-.\+/\1_\2/" -e 's/_/./g' <<< "$GIT_TAG_RELEASE")
+make RPM_NAME=$DEB_NAME RPM_NAME_BASEEXT=$BASE_EXT dist OUTDIR=$OUT_DIR
 
-debchange --newversion=$VERSION "Bump up version to $VERSION"
+# Prepare build area
+mkdir -p $BUILD_DIR/{build,binary,sources,dists}
+
+# Differnet paths based on DEB_EXT
+cp $OUT_DIR/$DEB_NAME-*.tar.gz $BUILD_DIR/dists/
 
-debchange --release ""
+FILE_BASE=$(basename $BUILD_DIR/dists/$DEB_NAME-*.tar.gz .tar.gz)
+VERSION=${FILE_BASE##$DEB_NAME-}
+
+echo Building $DEB_NAME version $VERSION...
+
+tar xzf $BUILD_DIR/dists/$DEB_NAME-$VERSION.tar.gz -C $BUILD_DIR/build
+
+(cd $BUILD_DIR/build/$DEB_NAME-$VERSION
+
+# Annotate changelog
+mv debian/changelog.in debian/changelog
+debchange --newversion=$VERSION "Bump up version to $VERSION"
 
 # Build package
-debuild -$BUILD_OPT -tc
+dpkg-buildpackage $BUILD_OPT -us -uc -tc)
 
-echo "The deb package(s) is (are) in parent directory"
+mv $BUILD_DIR/build/$DEB_NAME*{.tar.xz,.dsc,.changes} $BUILD_DIR/sources/
+mv $BUILD_DIR/build/$DEB_NAME*{.deb,.ddeb} $BUILD_DIR/binary/
 
+echo "The deb package(s) is (are) in $BUILD_DIR/binary/$(ls $BUILD_DIR/binary)"
diff --git a/opa/opa_debug.c b/opa/opa_debug.c
index 71b0003..7170dff 100644
--- a/opa/opa_debug.c
+++ b/opa/opa_debug.c
@@ -173,10 +173,10 @@ static void hfi_sighdlr(int sig, siginfo_t *p1, void *ucv)
 	static char buf[150], hname[64], fname[128];
 	static int i, j, fd, id;
 	extern char *__progname;
-	PSM_LOG_DECLARE_BT_BUFFER();
+	PSM2_LOG_DECLARE_BT_BUFFER();
 
-	/* CALLS UNSAFE FUNCTION when PSM_LOG is defined. */
-	PSM_LOG_BT(100,__FUNCTION__);
+	/* CALLS UNSAFE FUNCTION when PSM2_LOG is defined. */
+	PSM2_LOG_BT(100,__FUNCTION__);
 	/* If this is a SIGINT do not display backtrace. Just invoke exit
 	   handlers */
 	if ((sig == SIGINT) || (sig == SIGTERM))
diff --git a/opa/opa_utils.c b/opa/opa_utils.c
index 2b66b77..6de9c6d 100644
--- a/opa/opa_utils.c
+++ b/opa/opa_utils.c
@@ -191,10 +191,14 @@ int hfi_set_pkey(struct _hfi_ctrl *ctrl, uint16_t pkey)
 	cmd.len = 0;
 	cmd.addr = (uint64_t) pkey;
 
+	_HFI_VDBG("Setting context pkey to %x.\n", (unsigned int) pkey);
 	if (hfi_cmd_write(ctrl->fd, &cmd, sizeof(cmd)) == -1) {
-		if (errno != EINVAL)
-			_HFI_INFO("set pkey failed: %s\n", strerror(errno));
+		_HFI_INFO("Setting context pkey to %x failed: %s\n",
+			  (unsigned int) pkey, strerror(errno));
 		return -1;
+	} else {
+		_HFI_VDBG("Successfully set context pkey to %x.\n",
+			(unsigned int) pkey);
 	}
 	return 0;
 }
diff --git a/psm_context.c b/psm_context.c
index 21bc893..e87b69e 100644
--- a/psm_context.c
+++ b/psm_context.c
@@ -494,6 +494,44 @@ ret:
 psm2_error_t psmi_context_close(psmi_context_t *context)
 {
 	if (context->fd >= 0) {
+		struct hfi1_base_info *binfo;
+		struct hfi1_ctxt_info *cinfo;
+		int __hfi_pg_sz = sysconf(_SC_PAGESIZE);
+		binfo = &context->ctrl->base_info;
+		cinfo = &context->ctrl->ctxt_info;
+
+		munmap((void*)PSMI_ALIGNDOWN(binfo->sc_credits_addr, __hfi_pg_sz),
+		       __hfi_pg_sz);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->pio_bufbase_sop, __hfi_pg_sz),
+		       cinfo->credits * 64);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->pio_bufbase, __hfi_pg_sz),
+		       cinfo->credits * 64);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->rcvhdr_bufbase, __hfi_pg_sz),
+		       cinfo->rcvhdrq_cnt * cinfo->rcvhdrq_entsize);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->rcvegr_bufbase, __hfi_pg_sz),
+		       cinfo->egrtids * cinfo->rcvegr_size);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->sdma_comp_bufbase, __hfi_pg_sz),
+		       cinfo->sdma_ring_size * sizeof(struct hfi1_sdma_comp_entry));
+		/* only unmap the RTAIL if it was enabled in the first place */
+		if (cinfo->runtime_flags & HFI1_CAP_DMA_RTAIL) {
+			munmap((void*)PSMI_ALIGNDOWN(binfo->rcvhdrtail_base, __hfi_pg_sz),
+			       __hfi_pg_sz);
+		}
+		munmap((void*)PSMI_ALIGNDOWN(binfo->events_bufbase, __hfi_pg_sz),
+		       __hfi_pg_sz);
+		munmap((void*)PSMI_ALIGNDOWN(binfo->status_bufbase, __hfi_pg_sz),
+		       __hfi_pg_sz);
+
+		/* only unmap subcontext-related stuff it subcontexts are enabled */
+		if (context->user_info.subctxt_cnt > 0) {
+			munmap((void*)PSMI_ALIGNDOWN(binfo->subctxt_uregbase, __hfi_pg_sz),
+			       __hfi_pg_sz);
+			munmap((void*)PSMI_ALIGNDOWN(binfo->subctxt_rcvhdrbuf, __hfi_pg_sz),
+			       __hfi_pg_sz);
+			munmap((void*)PSMI_ALIGNDOWN(binfo->subctxt_rcvegrbuf, __hfi_pg_sz),
+			       __hfi_pg_sz);
+		}
+
 		hfi_context_close(context->fd);
 		context->fd = -1;
 	}
diff --git a/psm_ep.c b/psm_ep.c
index d01c9aa..957aed9 100644
--- a/psm_ep.c
+++ b/psm_ep.c
@@ -1205,6 +1205,22 @@ psm2_error_t __psm2_ep_close(psm2_ep_t ep, int mode, int64_t timeout_in)
 	 * interface to allow asynchronous finalization
 	 */
 
+
+	/* Check if transfer ownership of receive thread is needed before closing ep.
+	 * In case of PSM2_MULTI_EP support receive thread is created and assigned
+	 * to first opened endpoint. Receive thread is killed when closing this
+	 * endpoint.
+	 */
+	if (ep->user_ep_next != NULL) {
+		/* Receive thread will be transfered and assigned to ep->user_ep_next
+		 * only if currently working receive thread (which will be killed) is
+		 * assigned to ep and there isn't any assigned to ep->user_ep_next.
+		 */
+		if ((psmi_ptl_ips_rcvthread.is_enabled(ep->ptl_ips.ptl)) &&
+		    (!psmi_ptl_ips_rcvthread.is_enabled(ep->user_ep_next->ptl_ips.ptl)))
+			psmi_ptl_ips_rcvthread.transfer_ownership(ep->ptl_ips.ptl, ep->user_ep_next->ptl_ips.ptl);
+	}
+
 	/*
 	 * Before freeing the master ep itself,
 	 * remove it from the global linklist.
diff --git a/psm_log.h b/psm_log.h
index c808c5c..785b930 100644
--- a/psm_log.h
+++ b/psm_log.h
@@ -56,19 +56,19 @@
 
 /*
 
-  A note about PSM_LOG and PSM_LOG_FAST_IO:
+  A note about PSM2_LOG and PSM2_LOG_FAST_IO:
 
-  By default, the PSM_LOG facility is safe, slow, and is complete.  That is, if the
+  By default, the PSM2_LOG facility is safe, slow, and is complete.  That is, if the
   test case you are debugging has an abnormal termiation, no problem.  The logs are
   saved up to the point of the abnormal termination.  Abnormal termination can be
   a seg fault, the test case issues a fatal error, or exit()'s or abort()'s.
 
-  However, debugging timing sensitive problems, make the usual SLOW PSM_LOG
+  However, debugging timing sensitive problems, make the usual SLOW PSM2_LOG
   facility inadequate as the timing overhead that it introduces dominates, and the
   symptoms of your problem may change or go away.
 
-  For this case, you can use BOTH: PSM_LOG and PSM_LOG_FAST_IO.  To use
-  PSM_LOG_FAST_IO though, caution: for abnormal program termination, you will get
+  For this case, you can use BOTH: PSM2_LOG and PSM2_LOG_FAST_IO.  To use
+  PSM2_LOG_FAST_IO though, caution: for abnormal program termination, you will get
   no log file.
 
   To workaround this problem, and allow you to get a log file even after an abnormal
@@ -84,23 +84,23 @@
   By default, these macros are not defined when building psm.  When not defined, the
   macros become no-ops in the PSM code.
 
-  When enabled (by defining the PSM_LOG symbol), the macros present information to
+  When enabled (by defining the PSM2_LOG symbol), the macros present information to
   the psmi_log_message() facility for processing.  See below for more information on the
   psmi_log_message() facility.
 
-  To enable the macros, build PSM with the PSM_LOG environment variable exported, ala:
+  To enable the macros, build PSM with the PSM2_LOG environment variable exported, ala:
 
-  PSM_LOG=1 make ...
+  PSM2_LOG=1 make ...
 
   The macros are described in the following:
 
   PSM2_LOG_MSG(FORMAT,...)        Spills a printf-style message to the log.
-  PSM_LOG_DECLARE_BT_BUFFER()    Declares a local back trace buffer for use with the
-  				 PSM_LOG_BT() macro.
-  PSM_LOG_BT(NFRAMES,FORMAT,...) Spills the current backtrace, if it differs from the
+  PSM2_LOG_DECLARE_BT_BUFFER()    Declares a local back trace buffer for use with the
+  				 PSM2_LOG_BT() macro.
+  PSM2_LOG_BT(NFRAMES,FORMAT,...) Spills the current backtrace, if it differs from the
                                  previous backtrace spilled to the log.
 
-  The psmi_log_message() facility is the backend for these messages when PSM_LOG is enabled.
+  The psmi_log_message() facility is the backend for these messages when PSM2_LOG is enabled.
   The psmi_log_message() facility spills messages to unique log files based on the process id
   and the thread id.  So every unique process id, and thread id will spill to unique log files.
   The psmi_log_message prefixes each message in the log files with a high resolution timer
@@ -108,15 +108,15 @@
   It is left as an exercise to the reader to reconcile log messages from different hosts to one
   timeline.
 
-  The backtrace capability in the PSM_LOG functionality needs some explanation: often a bug
-  happens only when the code is tickled from a specific call-chain.  The PSM_LOG_BT() macro
+  The backtrace capability in the PSM2_LOG functionality needs some explanation: often a bug
+  happens only when the code is tickled from a specific call-chain.  The PSM2_LOG_BT() macro
   supports identifying the unique call-chain when a problem occurs.  The model is as follows:
 
   A unique declaration is made for a backtrace to spill the backtrace information to.  This
-  declaration should be made in the same basic block as the use of the PSM_LOG_BT() macro.
-  To make the declaration, use PSM_LOG_DECLARE_BT_BUFFER().
+  declaration should be made in the same basic block as the use of the PSM2_LOG_BT() macro.
+  To make the declaration, use PSM2_LOG_DECLARE_BT_BUFFER().
 
-  When the PSM_LOG is enabled, at the statement for the macro: PSM_LOG_BT(NFRAMES,FORMAT,...),
+  When the PSM2_LOG is enabled, at the statement for the macro: PSM2_LOG_BT(NFRAMES,FORMAT,...),
   the psmi_log_message() facility generates the current backtrace, and compares the first
   NFRAMES of the current backtrace against the previous backtrace stored in the backtrace
   buffer declared with the declaration.  If the two backtraces differ, the psmi_log_message()
@@ -160,11 +160,11 @@
 
  */
 
-#define PSM_LOG_EPM_TX ((int)1)
-#define PSM_LOG_EPM_RX ((int)0)
+#define PSM2_LOG_EPM_TX ((int)1)
+#define PSM2_LOG_EPM_RX ((int)0)
 
 
-#ifdef PSM_LOG
+#ifdef PSM2_LOG
 
 extern void psmi_log_initialize(void);
 
@@ -174,7 +174,7 @@ extern void psmi_log_message(const char *fileName,
 			     int lineNumber,
 			     const char *format, ...);
 
-#ifdef PSM_LOG_FAST_IO
+#ifdef PSM2_LOG_FAST_IO
 extern void psmi_log_fini(void);
 #else
 #define psmi_log_fini() /* nothing */
@@ -182,26 +182,30 @@ extern void psmi_log_fini(void);
 
 #define PSM2_LOG_MSG(FORMAT , ...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,FORMAT, ## __VA_ARGS__)
 
-#define PSM_LOG_BT_BUFFER_SIZE 100
+#define PSM2_LOG_BT_BUFFER_SIZE 100
 
-#define PSM_LOG_DECLARE_BT_BUFFER() static void * psm_log_bt_buffer[PSM_LOG_BT_BUFFER_SIZE]
+#define PSM2_LOG_DECLARE_BT_BUFFER() static void * psm_log_bt_buffer[PSM2_LOG_BT_BUFFER_SIZE]
 
-#define PSM_LOG_BT_MAGIC ((const char *)-1)
+#define PSM2_LOG_BT_MAGIC ((const char *)-1)
 
-#define PSM_LOG_BT(NFRAMES,FORMAT , ...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,PSM_LOG_BT_MAGIC,psm_log_bt_buffer,NFRAMES,FORMAT, ## __VA_ARGS__)
+#define PSM2_LOG_BT(NFRAMES,FORMAT , ...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,PSM2_LOG_BT_MAGIC,psm_log_bt_buffer,NFRAMES,FORMAT, ## __VA_ARGS__)
 
-#define PSM_LOG_EPM_MAGIC ((const char *)-2)
+#define PSM2_LOG_EPM_MAGIC ((const char *)-2)
 
 /* EPM is short for Emit Protocol Message to the log file.
 OPCODE is an int, and corresponds to one of the OPCODES declared in ptl_ips/ips_proto_header.h
-TXRX is an int, and should be one of the above two consts (PSM_LOG_EPM_TX, or PSM_LOG_EPM_RX).
+TXRX is an int, and should be one of the above two consts (PSM2_LOG_EPM_TX, or PSM2_LOG_EPM_RX).
 FROMEPID and TOEPID are uint64_t's and the fromepid should be the epid (end point id) of the sender   of the message
                                    and the toepid   should be the epid (end point id) of the receiver of the message
     */
-#define PSM_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,PSM_LOG_EPM_MAGIC,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT, ## __VA_ARGS__)
+#define PSM2_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,PSM2_LOG_EPM_MAGIC,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT, ## __VA_ARGS__)
 
-/* Just adds a condition to the PSM_LOG_EPM() macro. */
-#define PSM_LOG_EPM_COND(COND,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) if (COND) PSM_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT, ## __VA_ARGS__)
+/* Just adds a condition to the PSM2_LOG_EPM() macro. */
+#define PSM2_LOG_EPM_COND(COND,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) if (COND) PSM2_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT, ## __VA_ARGS__)
+
+#define PSM2_LOG_DUMP_MAGIC ((const char *)-3)
+
+#define PSM2_LOG_MSG_DUMP(ADDR,SIZE,FORMAT , ...) psmi_log_message(__FILE__,__FUNCTION__,__LINE__,PSM2_LOG_DUMP_MAGIC,ADDR,SIZE,FORMAT, ## __VA_ARGS__)
 
 #else
 
@@ -211,14 +215,16 @@ FROMEPID and TOEPID are uint64_t's and the fromepid should be the epid (end poin
 
 #define psmi_log_fini()                                     /* nothing */
 
-#define PSM_LOG_DECLARE_BT_BUFFER()                         /* nothing */
+#define PSM2_LOG_DECLARE_BT_BUFFER()                         /* nothing */
+
+#define PSM2_LOG_BT(NFRAMES,FORMAT , ...)                    /* nothing */
 
-#define PSM_LOG_BT(NFRAMES,FORMAT , ...)                    /* nothing */
+#define PSM2_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) /* nothing */
 
-#define PSM_LOG_EPM(OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) /* nothing */
+#define PSM2_LOG_EPM_COND(COND,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) /* nothing */
 
-#define PSM_LOG_EPM_COND(COND,OPCODE,TXRX,FROMEPID,TOEPID,FORMAT,...) /* nothing */
+#define PSM2_LOG_MSG_DUMP(ADDR,SIZE,FORMAT , ...)                      /* nothing */
 
-#endif /* #ifdef PSM_LOG */
+#endif /* #ifdef PSM2_LOG */
 
 #endif /* #ifndef _PSMI_LOG_H */
diff --git a/psm_mq_recv.c b/psm_mq_recv.c
index 3217714..3ac481c 100644
--- a/psm_mq_recv.c
+++ b/psm_mq_recv.c
@@ -275,7 +275,7 @@ psmi_mq_handle_rts(psm2_mq_t mq, psm2_epaddr_t src, psm2_mq_tag_t *tag,
 		}
 		req->recv_msgoff = req->send_msgoff = paylen;
 		*req_o = req;	/* yes match */
-		PSM_LOG_EPM(OPCODE_LONG_RTS,PSM_LOG_EPM_RX,src->epid,mq->ep->epid,
+		PSM2_LOG_EPM(OPCODE_LONG_RTS,PSM2_LOG_EPM_RX,src->epid,mq->ep->epid,
 			    "req->rts_reqidx_peer: %d",req->rts_reqidx_peer);
 		rc = MQ_RET_MATCH_OK;
 	} else if (msgorder > 1) {
@@ -292,8 +292,8 @@ psmi_mq_handle_rts(psm2_mq_t mq, psm2_epaddr_t src, psm2_mq_tag_t *tag,
 		/* We don't know recv_msglen yet but we set it here for
 		 * mq_iprobe */
 		req->send_msglen = req->recv_msglen = send_msglen;
-		PSM_LOG_EPM_COND(req->send_msglen > mq->hfi_thresh_rv,
-				 OPCODE_LONG_RTS,PSM_LOG_EPM_RX,src->epid,mq->ep->epid,
+		PSM2_LOG_EPM_COND(req->send_msglen > mq->hfi_thresh_rv,
+				 OPCODE_LONG_RTS,PSM2_LOG_EPM_RX,src->epid,mq->ep->epid,
 				    "req->rts_reqidx_peer: %d",req->rts_reqidx_peer);
 		req->state = MQ_STATE_UNEXP_RV;
 		req->peer = src;
diff --git a/psm_utils.c b/psm_utils.c
index 37446a4..df45cdd 100644
--- a/psm_utils.c
+++ b/psm_utils.c
@@ -1682,7 +1682,7 @@ psm2_error_t psmi_am_getopt(const void *am_obj, int optname,
 	return psmi_amopt_ctl(am_obj, optname, optval, optlen, 1);
 }
 
-#ifdef PSM_LOG
+#ifdef PSM2_LOG
 
 #include <execinfo.h>
 #include <stdio.h>
@@ -1692,7 +1692,7 @@ psm2_error_t psmi_am_getopt(const void *am_obj, int optname,
 #include "ptl_ips/ips_proto_header.h"
 
 /* A treeNode is used to store the list of Function Name Lists that
-   are passed to the PSM_LOG facility via environment variables.
+   are passed to the PSM2_LOG facility via environment variables.
    See psm_log.h for more information.
 
    Note that treeNode is a node in a binary tree data structure. */
@@ -2064,8 +2064,8 @@ static const char * const TxRxString(int txrx)
 {
 	switch(txrx)
 	{
-	case PSM_LOG_EPM_TX: return "Sent";
-	case PSM_LOG_EPM_RX: return "Received";
+	case PSM2_LOG_EPM_TX: return "Sent";
+	case PSM2_LOG_EPM_RX: return "Received";
 	default:             return "Unknown";
 	}
 }
@@ -2098,7 +2098,7 @@ void psmi_log_initialize(void)
 			&excludeFunctionNamesTreeRoot);
 }
 
-#ifdef PSM_LOG_FAST_IO
+#ifdef PSM2_LOG_FAST_IO
 
 struct psmi_log_io_thread_info
 {
@@ -2328,7 +2328,7 @@ static int psmi_buff_fputc(int c, int port)
 #endif
 
 
-/* plmf is short for 'psm log message facility. All of the PSM_LOG macros defined in psm_log.h
+/* plmf is short for 'psm log message facility. All of the PSM2_LOG macros defined in psm_log.h
    are serviced from this back end. */
 void psmi_log_message(const char *fileName,
 		      const char *functionName,
@@ -2342,7 +2342,9 @@ void psmi_log_message(const char *fileName,
 	/* Next, determine if this log message is signal or noise. */
 	if (plmf_search_format_string)
 	{
-		if((format != PSM_LOG_BT_MAGIC) && (format != PSM_LOG_EPM_MAGIC))
+		if((format != PSM2_LOG_BT_MAGIC)  &&
+		   (format != PSM2_LOG_EPM_MAGIC) &&
+		   (format != PSM2_LOG_DUMP_MAGIC))
 		{
 			if (fnmatch(plmf_search_format_string, format, 0))
 			{
@@ -2376,8 +2378,8 @@ void psmi_log_message(const char *fileName,
 	}
 
 	/* At this point, we think that this may be a message that we want to emit to the log.
-	   But, there is one more test, to apply to the two cases where (format == PSM_LOG_BT_MAGIC
-	   and format == PSM_LOG_EPM_MAGIC. */
+	   But, there is one more test, to apply to the two cases where (format == PSM2_LOG_BT_MAGIC
+	   and format == PSM2_LOG_EPM_MAGIC and format == PSM2_LOG_DUMP_MAGIC. */
 	{
 		void      **voidarray      = NULL;   /*va_arg(ap,void **);*/
 		int         nframes        = 0;      /*va_arg(ap,int);*/
@@ -2386,8 +2388,10 @@ void psmi_log_message(const char *fileName,
 		int         txrx           = 0;
 		uint64_t    fromepid       = 0;
 		uint64_t    toepid         = 0;
+		void       *dumpAddr       = 0;
+		size_t      dumpSize       = 0;
 
-#ifdef PSM_LOG_FAST_IO
+#ifdef PSM2_LOG_FAST_IO
 #define IO_PORT         0
 #define MY_FPRINTF      psmi_buff_fprintf
 #define MY_VFPRINTF     psmi_buff_vfprintf
@@ -2404,46 +2408,40 @@ void psmi_log_message(const char *fileName,
 #endif
 		struct timespec tp;
 
-		if (format == PSM_LOG_BT_MAGIC)
+		/* Pop arguments for the alternative forms of PSM2_LOG functionality: */
+		if (format == PSM2_LOG_BT_MAGIC)
 		{
 			voidarray = va_arg(ap,void **);
 			nframes   = va_arg(ap,int);
 			newFormat = va_arg(ap,const char *);
-			/* One last test to make sure that this message is signal: */
-			if (plmf_search_format_string)
-			{
-				{
-					if (fnmatch(plmf_search_format_string, newFormat, 0))
-					{
-						va_end(ap);
-						/* tis noise, return. */
-						return;
-					}
-				}
-			}
 		}
-		else if (format == PSM_LOG_EPM_MAGIC)
+		else if (format == PSM2_LOG_EPM_MAGIC)
 		{
 			opcode    = va_arg(ap,int);
 			txrx      = va_arg(ap,int);
 			fromepid  = va_arg(ap,uint64_t);
 			toepid    = va_arg(ap,uint64_t);
 			newFormat = va_arg(ap,const char *);
-			/* One last test to make sure that this message is signal: */
-			if (plmf_search_format_string)
+		}
+		else if (format == PSM2_LOG_DUMP_MAGIC)
+		{
+			dumpAddr  = va_arg(ap,void*);
+			dumpSize  = va_arg(ap,size_t);
+			newFormat = va_arg(ap,const char *);
+		}
+
+		/* One last test to make sure that this message is signal: */
+		if (plmf_search_format_string && newFormat)
+		{
+			if (fnmatch(plmf_search_format_string, newFormat, 0))
 			{
-				{
-					if (fnmatch(plmf_search_format_string, newFormat, 0))
-					{
-						va_end(ap);
-						/* tis noise, return. */
-						return;
-					}
-				}
+				va_end(ap);
+				/* tis noise, return. */
+				return;
 			}
 		}
 
-#ifdef PSM_LOG_FAST_IO
+#ifdef PSM2_LOG_FAST_IO
 		if (psmi_log_register_tls() != 0)
 		{
 			va_end(ap);
@@ -2469,16 +2467,18 @@ void psmi_log_message(const char *fileName,
 
 		M1();
 
-		if ((format != PSM_LOG_BT_MAGIC) && (format != PSM_LOG_EPM_MAGIC))
+		if ((format != PSM2_LOG_BT_MAGIC)  &&
+		    (format != PSM2_LOG_EPM_MAGIC) &&
+		    (format != PSM2_LOG_DUMP_MAGIC))
 		{
 			MY_VFPRINTF(IO_PORT,format,ap);
 			MY_FPUTC('\n',IO_PORT);
 		}
-		else if (format == PSM_LOG_BT_MAGIC)
+		else if (format == PSM2_LOG_BT_MAGIC)
 		{
-			void *newframes[PSM_LOG_BT_BUFFER_SIZE];
+			void *newframes[PSM2_LOG_BT_BUFFER_SIZE];
 			int  newframecnt      = backtrace(newframes,
-							  PSM_LOG_BT_BUFFER_SIZE);
+							  PSM2_LOG_BT_BUFFER_SIZE);
 			int  pframes          = min(newframecnt,nframes);
 
 			MY_VFPRINTF(IO_PORT,newFormat,ap);
@@ -2494,26 +2494,22 @@ void psmi_log_message(const char *fileName,
 				MY_FPRINTF(IO_PORT,
 					   "backtrace() returned %d addresses\n",
 					   newframecnt);
-
 				strings = backtrace_symbols(voidarray, pframes);
 				if (strings == NULL)
 				{
 					perror("backtrace_symbols");
 					exit(EXIT_FAILURE);
 				}
-
 				for (i = 0; i < pframes; i++)
 				{
 					M1();
 					MY_FPRINTF(IO_PORT,"%s\n", strings[i]);
 				}
-
 #undef free
 				free(strings);
 			}
-
 		}
-		else /* (format == PSM_LOG_EPM_MAGIC) */
+		else if (format == PSM2_LOG_EPM_MAGIC)
 		{
 			static epmTreeNode *root = 0;
 			static pthread_mutex_t plmf_epm_mutex =
@@ -2545,9 +2541,33 @@ void psmi_log_message(const char *fileName,
 			MY_VFPRINTF(IO_PORT,newFormat,ap);
 			MY_FPUTC('\n',IO_PORT);
 		}
+		else /* if (format == PSM2_LOG_DUMP_MAGIC) */
+		{
+			MY_VFPRINTF(IO_PORT,newFormat,ap);
+			MY_FPUTC('\n',IO_PORT);
+			M1();
+
+			uint8_t *pu8 = (uint8_t *)dumpAddr;
+			size_t   i,cnt=0;
+			for (i=0;i < dumpSize;i++)
+			{
+				if ((i != 0) && ((i % 8) == 0))
+				{
+					MY_FPRINTF(IO_PORT," (%d)\n",(int)(i-8));
+					M1();
+					cnt = 0;
+				}
+				else if (cnt)
+					MY_FPUTC(',',IO_PORT);
+				MY_FPRINTF(IO_PORT,"0x%02x", pu8[i-1]);
+				cnt++;
+			}
+			if (cnt)
+				MY_FPRINTF(IO_PORT," (%d)\n",(int)(i-8));
+		}
 		MY_FCLOSE(IO_PORT);
 	}
 
 	va_end(ap);
 }
-#endif /* #ifdef PSM_LOG */
+#endif /* #ifdef PSM2_LOG */
diff --git a/ptl.h b/ptl.h
index 88d6fc1..22628df 100644
--- a/ptl.h
+++ b/ptl.h
@@ -104,6 +104,11 @@ struct ptl_ctl_init {
 		       void *optval, uint64_t *optlen);
 };
 
+struct ptl_ctl_rcvthread {
+	uint32_t(*is_enabled) (const ptl_t *ptl);
+	void(*transfer_ownership) (ptl_t *from_ptl, ptl_t *to_ptl);
+};
+
 typedef
 struct ptl_arg {
 	union {
diff --git a/ptl_ips/ips_proto_expected.c b/ptl_ips/ips_proto_expected.c
index c0ca988..d7a37b9 100644
--- a/ptl_ips/ips_proto_expected.c
+++ b/ptl_ips/ips_proto_expected.c
@@ -706,7 +706,7 @@ ips_protoexp_send_tid_grant(struct ips_tid_recv_desc *tidrecvc)
 	ips_scb_buffer(scb) = (void *)&tidrecvc->tid_list;
 	ips_scb_length(scb) = tidrecvc->tsess_tidlist_length;
 
-	PSM_LOG_EPM(OPCODE_LONG_CTS,PSM_LOG_EPM_TX, proto->ep->epid,
+	PSM2_LOG_EPM(OPCODE_LONG_CTS,PSM2_LOG_EPM_TX, proto->ep->epid,
 		    flow->ipsaddr->epaddr.epid ,"tidrecvc->getreq->tidgr_sendtoken; %d",
 		    tidrecvc->getreq->tidgr_sendtoken);
 
@@ -723,7 +723,7 @@ ips_protoexp_send_tid_completion(struct ips_tid_recv_desc *tidrecvc,
 	struct ips_flow *flow = &ipsaddr->flows[proto->msgflowid];
 	ips_scb_t *scb;
 
-	PSM_LOG_EPM(OPCODE_EXPTID_COMPLETION,PSM_LOG_EPM_TX, proto->ep->epid,
+	PSM2_LOG_EPM(OPCODE_EXPTID_COMPLETION,PSM2_LOG_EPM_TX, proto->ep->epid,
 		    flow->ipsaddr->epaddr.epid ,"sdescid._desc_idx: %d",
 		    sdescid._desc_idx);
 	scb = tidrecvc->completescb;
@@ -765,7 +765,7 @@ ips_protoexp_recv_tid_completion(struct ips_recvhdrq_event *rcv_ev)
 	struct ips_tid_send_desc *tidsendc;
 
 	PSM2_LOG_MSG("entering");
-	PSM_LOG_EPM(OPCODE_EXPTID_COMPLETION,PSM_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
+	PSM2_LOG_EPM(OPCODE_EXPTID_COMPLETION,PSM2_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
 		    rcv_ev->proto->ep->mq->ep->epid,"desc_id._desc_idx: %d",desc_id._desc_idx);
 
 	if (!ips_proto_is_expected_or_nak(rcv_ev))
@@ -885,7 +885,7 @@ int ips_protoexp_data(struct ips_recvhdrq_event *rcv_ev)
 	PSM2_LOG_MSG("entering");
 
 	desc_id._desc_idx = ips_proto_flowid(p_hdr);
-	PSM_LOG_EPM(OPCODE_EXPTID,PSM_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
+	PSM2_LOG_EPM(OPCODE_EXPTID,PSM2_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
 		    proto->ep->mq->ep->epid,"desc_id._desc_idx: %d", desc_id._desc_idx);
 
 	desc_id._desc_genc = p_hdr->exp_rdescid_genc;
@@ -1644,7 +1644,7 @@ ips_scb_prepare_tid_sendctrl(struct ips_flow *flow,
 	/*
 	 * Other packet fields.
 	 */
-	PSM_LOG_EPM(OPCODE_EXPTID,PSM_LOG_EPM_TX, protoexp->proto->ep->epid,
+	PSM2_LOG_EPM(OPCODE_EXPTID,PSM2_LOG_EPM_TX, protoexp->proto->ep->epid,
 		    flow->ipsaddr->epaddr.epid,
 		    "psmi_mpool_get_obj_index(tidsendc->mqreq): %d, tidsendc->rdescid._desc_idx: %d, tidsendc->sdescid._desc_idx: %d",
 		    psmi_mpool_get_obj_index(tidsendc->mqreq),tidsendc->rdescid._desc_idx,tidsendc->sdescid._desc_idx);
diff --git a/ptl_ips/ips_proto_mq.c b/ptl_ips/ips_proto_mq.c
index e36492f..6f13473 100644
--- a/ptl_ips/ips_proto_mq.c
+++ b/ptl_ips/ips_proto_mq.c
@@ -508,7 +508,7 @@ ips_ptl_mq_rndv(struct ips_proto *proto, psm2_mq_req_t req,
 	}
 #endif
 
-	PSM_LOG_EPM_COND(len > proto->mq->hfi_thresh_rv && proto->protoexp,OPCODE_LONG_RTS,PSM_LOG_EPM_TX,proto->ep->epid, req->rts_peer->epid,
+	PSM2_LOG_EPM_COND(len > proto->mq->hfi_thresh_rv && proto->protoexp,OPCODE_LONG_RTS,PSM2_LOG_EPM_TX,proto->ep->epid, req->rts_peer->epid,
 			    "ips_scb_hdrdata(scb).u32w0: %d",ips_scb_hdrdata(scb).u32w0);
 
 	if ((err = ips_mq_send_envelope(proto, flow, scb, PSMI_TRUE)))
@@ -993,7 +993,7 @@ ips_proto_mq_push_cts_req(struct ips_proto *proto, psm2_mq_req_t req)
 	args[1].u32w1 = req->recv_msglen;
 	args[1].u32w0 = req->rts_reqidx_peer;
 
-	PSM_LOG_EPM(OPCODE_LONG_CTS,PSM_LOG_EPM_TX, proto->ep->epid,
+	PSM2_LOG_EPM(OPCODE_LONG_CTS,PSM2_LOG_EPM_TX, proto->ep->epid,
 		    flow->ipsaddr->epaddr.epid ,"req->rts_reqidx_peer: %d",
 		    req->rts_reqidx_peer);
 
@@ -1176,7 +1176,7 @@ ips_proto_mq_handle_cts(struct ips_recvhdrq_event *rcv_ev)
 		ips_tid_session_list *payload =
 			ips_recvhdrq_event_payload(rcv_ev);
 		psmi_assert(paylen == 0 || payload);
-		PSM_LOG_EPM(OPCODE_LONG_CTS,PSM_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
+		PSM2_LOG_EPM(OPCODE_LONG_CTS,PSM2_LOG_EPM_RX,rcv_ev->ipsaddr->epaddr.epid,
 			    mq->ep->epid,"p_hdr->data[1].u32w0 %d",
 			    p_hdr->data[1].u32w0);
 		proto->epaddr_stats.tids_grant_recv++;
@@ -1310,7 +1310,7 @@ ips_proto_mq_handle_rts(struct ips_recvhdrq_event *rcv_ev)
 	req->rts_reqidx_peer = p_hdr->data[1].u32w0;
 	if (req->send_msglen > mq->hfi_thresh_rv)
 	{
-		PSM_LOG_EPM(OPCODE_LONG_RTS,PSM_LOG_EPM_RX,req->rts_peer->epid,mq->ep->epid,
+		PSM2_LOG_EPM(OPCODE_LONG_RTS,PSM2_LOG_EPM_RX,req->rts_peer->epid,mq->ep->epid,
 			    "req->rts_reqidx_peer: %d",req->rts_reqidx_peer);
 	}
 	if (p_hdr->flags & IPS_SEND_FLAG_BLOCKING)
diff --git a/ptl_ips/ptl.c b/ptl_ips/ptl.c
index 01a0c3f..8a50660 100644
--- a/ptl_ips/ptl.c
+++ b/ptl_ips/ptl.c
@@ -620,6 +620,14 @@ ips_ptl_getopt(const void *component_obj, int optname,
 	return ips_ptl_optctl(component_obj, optname, optval, optlen, 1);
 }
 
+
+static
+uint32_t
+ips_ptl_rcvthread_is_enabled(const ptl_t *ptl)
+{
+	return (ptl->runtime_flags & PSMI_RUNTIME_RCVTHREAD);
+}
+
 psm2_error_t ips_ptl_poll(ptl_t *ptl, int _ignored)
 {
 	const uint64_t current_count = get_cycles();
@@ -948,3 +956,9 @@ psmi_ptl_ips = {
 	ips_ptl_sizeof, ips_ptl_init, ips_ptl_fini, ips_ptl_setopt,
 	    ips_ptl_getopt
 };
+
+struct ptl_ctl_rcvthread
+psmi_ptl_ips_rcvthread = {
+	ips_ptl_rcvthread_is_enabled,
+	ips_ptl_rcvthread_transfer_ownership,
+};
diff --git a/ptl_ips/ptl_fwd.h b/ptl_ips/ptl_fwd.h
index d2a903a..3702fba 100644
--- a/ptl_ips/ptl_fwd.h
+++ b/ptl_ips/ptl_fwd.h
@@ -62,4 +62,6 @@ typedef struct ips_msgctl ips_msgctl_t;
 
 /* Symbol in ips ptl */
 struct ptl_ctl_init psmi_ptl_ips;
+
+struct ptl_ctl_rcvthread psmi_ptl_ips_rcvthread;
 #endif /* _PTL_FWD_IPS_H */
diff --git a/ptl_ips/ptl_ips.h b/ptl_ips/ptl_ips.h
index 56adaf7..ea09ef3 100644
--- a/ptl_ips/ptl_ips.h
+++ b/ptl_ips/ptl_ips.h
@@ -190,5 +190,6 @@ psm2_error_t ips_ptl_shared_poll(ptl_t *ptl, int _ignored);
  */
 psm2_error_t ips_ptl_rcvthread_init(ptl_t *ptl, struct ips_recvhdrq *recvq);
 psm2_error_t ips_ptl_rcvthread_fini(ptl_t *ptl);
+void ips_ptl_rcvthread_transfer_ownership(ptl_t *from_ptl, ptl_t *to_ptl);
 
 #endif /* _IPS_PTL_H */
diff --git a/ptl_ips/ptl_rcvthread.c b/ptl_ips/ptl_rcvthread.c
index 527e113..89b12f3 100644
--- a/ptl_ips/ptl_rcvthread.c
+++ b/ptl_ips/ptl_rcvthread.c
@@ -213,6 +213,23 @@ fail:
 	return err;
 }
 
+void ips_ptl_rcvthread_transfer_ownership(ptl_t *from_ptl, ptl_t *to_ptl)
+{
+	struct ptl_rcvthread *rcvc;
+
+	from_ptl->runtime_flags &= ~(PSMI_RUNTIME_RCVTHREAD);
+	to_ptl->runtime_flags |= PSMI_RUNTIME_RCVTHREAD;
+
+	to_ptl->rcvthread = from_ptl->rcvthread;
+	from_ptl->rcvthread = NULL;
+
+	rcvc = to_ptl->rcvthread;
+
+	rcvc->recvq = &to_ptl->recvq;
+	rcvc->context = to_ptl->context;
+	rcvc->ptl = to_ptl;
+}
+
 psm2_error_t rcvthread_initsched(struct ptl_rcvthread *rcvc)
 {
 	union psmi_envvar_val env_to;
@@ -322,8 +339,6 @@ void *ips_ptl_pollintr(void *rcvthreadc)
 {
 	struct ptl_rcvthread *rcvc = (struct ptl_rcvthread *)rcvthreadc;
 	struct ips_recvhdrq *recvq = rcvc->recvq;
-	psmi_context_t *context = (psmi_context_t *) rcvc->context;
-	int fd_dev = context->fd;
 	int fd_pipe = rcvc->pipefd[0];
 	psm2_ep_t ep;
 	struct pollfd pfd[2];
@@ -354,7 +369,7 @@ void *ips_ptl_pollintr(void *rcvthreadc)
 	_HFI_PRDBG("Enabled communication thread on URG packets\n");
 
 	while (1) {
-		pfd[0].fd = fd_dev;
+		pfd[0].fd = rcvc->context->fd;
 		pfd[0].events = POLLIN;
 		pfd[0].revents = 0;
 		pfd[1].fd = fd_pipe;
diff --git a/rpm_release_extension b/rpm_release_extension
index 45a4fb7..98d9bcb 100644
--- a/rpm_release_extension
+++ b/rpm_release_extension
@@ -1 +1 @@
-8
+17

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/libpsm2.git



More information about the Pkg-ofed-commits mailing list