[Pkg-ofed-commits] [librdmacm] 03/18: Imported Upstream version 1.0.7

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Wed Jul 2 13:58:23 UTC 2014


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

ana pushed a commit to branch master
in repository librdmacm.

commit fff8ffe53657965781d7667b0ad64a222971a1ed
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Wed Jul 2 15:58:06 2014 +0200

    Imported Upstream version 1.0.7
---
 Makefile.am                 |  1 +
 Makefile.in                 |  1 +
 configure                   | 20 +++++++--------
 configure.in                |  4 +--
 examples/cmatose.c          | 59 ++++++++++++++++++++++++++++++++++++++++-----
 include/rdma/rdma_cma.h     |  7 ++++++
 include/rdma/rdma_cma_abi.h | 13 +++++++++-
 librdmacm.spec              | 19 ++++++++++-----
 librdmacm.spec.in           | 17 +++++++++----
 man/rdma_migrate_id.3       | 27 +++++++++++++++++++++
 man/ucmatose.1              |  4 +++
 src/cma.c                   | 52 +++++++++++++++++++++++++++++----------
 src/librdmacm.map           |  1 +
 13 files changed, 182 insertions(+), 43 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 77782da..290cbc3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,7 @@ man_MANS = \
 	man/rdma_join_multicast.3 \
 	man/rdma_leave_multicast.3 \
 	man/rdma_listen.3 \
+	man/rdma_migrate_id.3 \
 	man/rdma_notify.3 \
 	man/rdma_reject.3 \
 	man/rdma_resolve_addr.3 \
diff --git a/Makefile.in b/Makefile.in
index 521bf69..21cb41d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -266,6 +266,7 @@ man_MANS = \
 	man/rdma_join_multicast.3 \
 	man/rdma_leave_multicast.3 \
 	man/rdma_listen.3 \
+	man/rdma_migrate_id.3 \
 	man/rdma_notify.3 \
 	man/rdma_reject.3 \
 	man/rdma_resolve_addr.3 \
diff --git a/configure b/configure
index 59dcebd..64ffbbf 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for librdmacm 1.0.6.
+# Generated by GNU Autoconf 2.59 for librdmacm 1.0.7.
 #
 # Report bugs to <general at lists.openfabrics.org>.
 #
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='librdmacm'
 PACKAGE_TARNAME='librdmacm'
-PACKAGE_VERSION='1.0.6'
-PACKAGE_STRING='librdmacm 1.0.6'
+PACKAGE_VERSION='1.0.7'
+PACKAGE_STRING='librdmacm 1.0.7'
 PACKAGE_BUGREPORT='general at lists.openfabrics.org'
 
 ac_unique_file="src/cma.c"
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures librdmacm 1.0.6 to adapt to many kinds of systems.
+\`configure' configures librdmacm 1.0.7 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1020,7 +1020,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of librdmacm 1.0.6:";;
+     short | recursive ) echo "Configuration of librdmacm 1.0.7:";;
    esac
   cat <<\_ACEOF
 
@@ -1161,7 +1161,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-librdmacm configure 1.0.6
+librdmacm configure 1.0.7
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1175,7 +1175,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by librdmacm $as_me 1.0.6, which was
+It was created by librdmacm $as_me 1.0.7, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1821,7 +1821,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=librdmacm
- VERSION=1.0.6
+ VERSION=1.0.7
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20908,7 +20908,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by librdmacm $as_me 1.0.6, which was
+This file was extended by librdmacm $as_me 1.0.7, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20971,7 +20971,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-librdmacm config.status 1.0.6
+librdmacm config.status 1.0.7
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.in b/configure.in
index cfc86da..54a9c96 100644
--- a/configure.in
+++ b/configure.in
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.57)
-AC_INIT(librdmacm, 1.0.6, general at lists.openfabrics.org)
+AC_INIT(librdmacm, 1.0.7, general at lists.openfabrics.org)
 AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(librdmacm, 1.0.6)
+AM_INIT_AUTOMAKE(librdmacm, 1.0.7)
 
 AM_PROG_LIBTOOL
 
diff --git a/examples/cmatose.c b/examples/cmatose.c
index dcb6074..2f6e5f6 100644
--- a/examples/cmatose.c
+++ b/examples/cmatose.c
@@ -82,6 +82,7 @@ static int message_size = 100;
 static int message_count = 10;
 static uint8_t set_tos = 0;
 static uint8_t tos;
+static uint8_t migrate = 0;
 static char *dst_addr;
 static char *src_addr;
 
@@ -465,6 +466,35 @@ static int disconnect_events(void)
 	return ret;
 }
 
+static int migrate_channel(struct rdma_cm_id *listen_id)
+{
+	struct rdma_event_channel *channel;
+	int i, ret;
+
+	printf("migrating to new event channel\n");
+
+	channel = rdma_create_event_channel();
+	if (!channel) {
+		printf("cmatose: failed to create event channel\n");
+		return -1;
+	}
+
+	ret = 0;
+	if (listen_id)
+		ret = rdma_migrate_id(listen_id, channel);
+
+	for (i = 0; i < connections && !ret; i++)
+		ret = rdma_migrate_id(test.nodes[i].cma_id, channel);
+
+	if (!ret) {
+		rdma_destroy_event_channel(test.channel);
+		test.channel = channel;
+	} else
+		printf("cmatose: failure migrating to channel: %d\n", ret);
+
+	return ret;
+}
+
 static int get_addr(char *dst, struct sockaddr_in *addr)
 {
 	struct addrinfo *res;
@@ -543,6 +573,13 @@ static int run_server(void)
 		printf("data transfers complete\n");
 
 	}
+
+	if (migrate) {
+		ret = migrate_channel(listen_id);
+		if (ret)
+			goto out;
+	}
+
 	printf("cmatose: disconnecting\n");
 	for (i = 0; i < connections; i++) {
 		if (!test.nodes[i].connected)
@@ -592,30 +629,36 @@ static int run_client(void)
 
 	ret = connect_events();
 	if (ret)
-		goto out;
+		goto disc;
 
 	if (message_count) {
 		printf("receiving data transfers\n");
 		ret = poll_cqs();
 		if (ret)
-			goto out;
+			goto disc;
 
 		printf("sending replies\n");
 		for (i = 0; i < connections; i++) {
 			ret = post_sends(&test.nodes[i]);
 			if (ret)
-				goto out;
+				goto disc;
 		}
 
 		printf("data transfers complete\n");
 	}
 
 	ret = 0;
-out:
+
+	if (migrate) {
+		ret = migrate_channel(NULL);
+		if (ret)
+			goto out;
+	}
+disc:
 	ret2 = disconnect_events();
 	if (ret2)
 		ret = ret2;
-
+out:
 	return ret;
 }
 
@@ -623,7 +666,7 @@ int main(int argc, char **argv)
 {
 	int op, ret;
 
-	while ((op = getopt(argc, argv, "s:b:c:C:S:t:")) != -1) {
+	while ((op = getopt(argc, argv, "s:b:c:C:S:t:m")) != -1) {
 		switch (op) {
 		case 's':
 			dst_addr = optarg;
@@ -644,6 +687,9 @@ int main(int argc, char **argv)
 			set_tos = 1;
 			tos = (uint8_t) atoi(optarg);
 			break;
+		case 'm':
+			migrate = 1;
+			break;
 		default:
 			printf("usage: %s\n", argv[0]);
 			printf("\t[-s server_address]\n");
@@ -652,6 +698,7 @@ int main(int argc, char **argv)
 			printf("\t[-C message_count]\n");
 			printf("\t[-S message_size]\n");
 			printf("\t[-t type_of_service]\n");
+			printf("\t[-m(igrate)]\n");
 			exit(1);
 		}
 	}
diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h
index 64b3008..76df90f 100644
--- a/include/rdma/rdma_cma.h
+++ b/include/rdma/rdma_cma.h
@@ -560,6 +560,13 @@ enum {
 int rdma_set_option(struct rdma_cm_id *id, int level, int optname,
 		    void *optval, size_t optlen);
 
+/**
+ * rdma_migrate_id - Move an rdma_cm_id to a new event channel.
+ * @id: Communication identifier to migrate.
+ * @channel: New event channel for rdma_cm_id events.
+ */
+int rdma_migrate_id(struct rdma_cm_id *id, struct rdma_event_channel *channel);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/rdma/rdma_cma_abi.h b/include/rdma/rdma_cma_abi.h
index ba0e7b9..1a3a9c2 100644
--- a/include/rdma/rdma_cma_abi.h
+++ b/include/rdma/rdma_cma_abi.h
@@ -63,7 +63,8 @@ enum {
 	UCMA_CMD_SET_OPTION,
 	UCMA_CMD_NOTIFY,
  	UCMA_CMD_JOIN_MCAST,
- 	UCMA_CMD_LEAVE_MCAST
+ 	UCMA_CMD_LEAVE_MCAST,
+	UCMA_CMD_MIGRATE_ID
 };
 
 struct ucma_abi_cmd_hdr {
@@ -221,4 +222,14 @@ struct ucma_abi_set_option {
 	__u32 optlen;
 };
 
+struct ucma_abi_migrate_id {
+	__u64 response;
+	__u32 id;
+	__u32 fd;
+};
+
+struct ucma_abi_migrate_resp {
+	__u32 events_reported;
+};
+
 #endif /* RDMA_CMA_ABI_H */
diff --git a/librdmacm.spec b/librdmacm.spec
index ec6f00e..ddb14dd 100644
--- a/librdmacm.spec
+++ b/librdmacm.spec
@@ -1,16 +1,18 @@
-%define ver 1.0.6
+%define ver 1.0.7
 
 Name: librdmacm
-Version: 1.0.6
+Version: 1.0.7
 Release: 1%{?dist}
-Summary: Userspace RDMA Connection Manager.
+Summary: Userspace RDMA Connection Manager
 
 Group: System Environment/Libraries
 License: GPLv2 or BSD
 Url: http://www.openfabrics.org/
-Source: http://www.openfabrics.org/downloads/%{name}-%{version}.tar.gz
+Source: http://www.openfabrics.org/downloads/rdmacm/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+BuildRequires: libibverbs-devel >= 1.1-1
+
 %description
 librdmacm provides a userspace RDMA Communication Managment API.
 
@@ -52,17 +54,22 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 %{_libdir}/librdmacm*.so.*
-%doc AUTHORS COPYING ChangeLog README
+%doc AUTHORS COPYING README
 
 %files devel
 %defattr(-,root,root)
 %{_libdir}/lib*.so
 %{_libdir}/*.a
 %{_includedir}/*
-%{_mandir}/man1/*
 %{_mandir}/man3/*
 %{_mandir}/man7/*
 
 %files utils
 %defattr(-,root,root,-)
 %{_bindir}/*
+%{_mandir}/man1/*
+
+%changelog
+
+* Fri Feb 15 2008 Roland Dreier <rdreier at cisco.com> - 1.0.6-1
+- Initial Fedora spec file
diff --git a/librdmacm.spec.in b/librdmacm.spec.in
index 046d9cf..998dfc3 100644
--- a/librdmacm.spec.in
+++ b/librdmacm.spec.in
@@ -1,16 +1,18 @@
 %define ver @VERSION@
 
 Name: librdmacm
-Version: 1.0.6
+Version: 1.0.7
 Release: 1%{?dist}
-Summary: Userspace RDMA Connection Manager.
+Summary: Userspace RDMA Connection Manager
 
 Group: System Environment/Libraries
 License: GPLv2 or BSD
 Url: http://www.openfabrics.org/
-Source: http://www.openfabrics.org/downloads/%{name}-%{version}.tar.gz
+Source: http://www.openfabrics.org/downloads/rdmacm/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+BuildRequires: libibverbs-devel >= 1.1-1
+
 %description
 librdmacm provides a userspace RDMA Communication Managment API.
 
@@ -52,17 +54,22 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 %{_libdir}/librdmacm*.so.*
-%doc AUTHORS COPYING ChangeLog README
+%doc AUTHORS COPYING README
 
 %files devel
 %defattr(-,root,root)
 %{_libdir}/lib*.so
 %{_libdir}/*.a
 %{_includedir}/*
-%{_mandir}/man1/*
 %{_mandir}/man3/*
 %{_mandir}/man7/*
 
 %files utils
 %defattr(-,root,root,-)
 %{_bindir}/*
+%{_mandir}/man1/*
+
+%changelog
+
+* Fri Feb 15 2008 Roland Dreier <rdreier at cisco.com> - 1.0.6-1
+- Initial Fedora spec file
diff --git a/man/rdma_migrate_id.3 b/man/rdma_migrate_id.3
new file mode 100644
index 0000000..ffbad45
--- /dev/null
+++ b/man/rdma_migrate_id.3
@@ -0,0 +1,27 @@
+.TH "RDMA_MIGRATE_ID" 3 "2007-11-13" "librdmacm" "Librdmacm Programmer's Manual" librdmacm
+.SH NAME
+rdma_migrate_id \- Move a communication identifer to a different event channel.
+.SH SYNOPSIS
+.B "#include <rdma/rdma_cma.h>"
+.P
+.B "int" rdma_migrate_id
+.BI "(struct rdma_cm_id *" id ","
+.BI "struct rdma_event_channel *" channel ");"
+.SH ARGUMENTS
+.IP "id" 12
+An existing communication identifier to migrate.
+.IP "channel" 12
+The communication channel that events associated with the
+allocated rdma_cm_id will be reported on.
+.SH "DESCRIPTION"
+Migrates a communication identifier to a different event channel.
+.SH "NOTES"
+This routine migrates a communication identifier to the specified event
+channel and moves any pending events associated with the rdma_cm_id
+to the new channel.  Users should not poll for events on the
+rdma_cm_id's current event channel or invoke other routines on the
+rdma_cm_id while migrating between channels.  This call will block while
+there are any unacknowledged events on the current event channel.
+.SH "SEE ALSO"
+rdma_cm(7), rdma_create_event_channel(3), rdma_create_id(3),
+rdma_get_cm_event(3)
diff --git a/man/ucmatose.1 b/man/ucmatose.1
index 121ea63..73477ea 100644
--- a/man/ucmatose.1
+++ b/man/ucmatose.1
@@ -35,6 +35,10 @@ The size of each message transferred, in bytes.  (default 100)
 \-t tos
 Indicates the type of service used for the communication.  Type of service
 is implementation dependent based on subnet configuration.
+.TP
+\-m
+Tests event channel migration.  Migrates all communication identifiers to
+a different event channel for disconnect events.
 .SH "NOTES"
 Basic usage is to start ucmatose on a server system, then run
 ucmatose -s server_name on a client system.
diff --git a/src/cma.c b/src/cma.c
index 751ca9d..fc98c8f 100644
--- a/src/cma.c
+++ b/src/cma.c
@@ -1312,17 +1312,17 @@ retry:
 	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
 
 	evt->event.event = resp->event;
+	evt->id_priv = (void *) (uintptr_t) resp->uid;
+	evt->event.id = &evt->id_priv->id;
+	evt->event.status = resp->status;
+
 	switch (resp->event) {
 	case RDMA_CM_EVENT_ADDR_RESOLVED:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
-		evt->event.id = &evt->id_priv->id;
 		evt->event.status = ucma_query_route(&evt->id_priv->id);
 		if (evt->event.status)
 			evt->event.event = RDMA_CM_EVENT_ADDR_ERROR;
 		break;
 	case RDMA_CM_EVENT_ROUTE_RESOLVED:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
-		evt->event.id = &evt->id_priv->id;
 		evt->event.status = ucma_query_route(&evt->id_priv->id);
 		if (evt->event.status)
 			evt->event.event = RDMA_CM_EVENT_ROUTE_ERROR;
@@ -1339,8 +1339,6 @@ retry:
 			goto retry;
 		break;
 	case RDMA_CM_EVENT_CONNECT_RESPONSE:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
-		evt->event.id = &evt->id_priv->id;
 		ucma_copy_conn_event(evt, &resp->param.conn);
 		evt->event.status = ucma_process_conn_resp(evt->id_priv);
 		if (!evt->event.status)
@@ -1351,8 +1349,6 @@ retry:
 		}
 		break;
 	case RDMA_CM_EVENT_ESTABLISHED:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
-		evt->event.id = &evt->id_priv->id;
 		if (ucma_is_ud_ps(evt->id_priv->id.ps)) {
 			ucma_copy_ud_event(evt, &resp->param.ud);
 			break;
@@ -1366,22 +1362,18 @@ retry:
 		}
 		break;
 	case RDMA_CM_EVENT_REJECTED:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
 		if (evt->id_priv->connect_error) {
 			ucma_complete_event(evt->id_priv);
 			goto retry;
 		}
-		evt->event.id = &evt->id_priv->id;
 		ucma_copy_conn_event(evt, &resp->param.conn);
 		ucma_modify_qp_err(evt->event.id);
 		break;
 	case RDMA_CM_EVENT_DISCONNECTED:
-		evt->id_priv = (void *) (uintptr_t) resp->uid;
 		if (evt->id_priv->connect_error) {
 			ucma_complete_event(evt->id_priv);
 			goto retry;
 		}
-		evt->event.id = &evt->id_priv->id;
 		ucma_copy_conn_event(evt, &resp->param.conn);
 		break;
 	case RDMA_CM_EVENT_MULTICAST_JOIN:
@@ -1398,7 +1390,6 @@ retry:
 		evt->mc = (void *) (uintptr_t) resp->uid;
 		evt->id_priv = evt->mc->id_priv;
 		evt->event.id = &evt->id_priv->id;
-		evt->event.status = resp->status;
 		evt->event.param.ud.private_data = evt->mc->context;
 		break;
 	default:
@@ -1474,3 +1465,38 @@ int rdma_set_option(struct rdma_cm_id *id, int level, int optname,
 
 	return 0;
 }
+
+int rdma_migrate_id(struct rdma_cm_id *id, struct rdma_event_channel *channel)
+{
+	struct ucma_abi_migrate_resp *resp;
+	struct ucma_abi_migrate_id *cmd;
+	struct cma_id_private *id_priv;
+	void *msg;
+	int ret, size;
+
+	id_priv = container_of(id, struct cma_id_private, id);
+	CMA_CREATE_MSG_CMD_RESP(msg, cmd, resp, UCMA_CMD_MIGRATE_ID, size);
+	cmd->id = id_priv->handle;
+	cmd->fd = id->channel->fd;
+
+	ret = write(channel->fd, msg, size);
+	if (ret != size)
+		return (ret > 0) ? -ENODATA : ret;
+
+	VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
+	/*
+	 * Eventually if we want to support migrating channels while events are
+	 * being processed on the current channel, we need to block here while
+	 * there are any outstanding events on the current channel for this id
+	 * to prevent the user from processing events for this id on the old
+	 * channel after this call returns.
+	 */
+	pthread_mutex_lock(&id_priv->mut);
+	id->channel = channel;
+	while (id_priv->events_completed < resp->events_reported)
+		pthread_cond_wait(&id_priv->cond, &id_priv->mut);
+	pthread_mutex_unlock(&id_priv->mut);
+
+	return 0;
+}
diff --git a/src/librdmacm.map b/src/librdmacm.map
index 84cec7f..cb94efe 100644
--- a/src/librdmacm.map
+++ b/src/librdmacm.map
@@ -27,5 +27,6 @@ RDMACM_1.0 {
 		rdma_set_option;
 		rdma_get_local_addr;
 		rdma_get_peer_addr;
+		rdma_migrate_id;
 	local: *;
 };

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



More information about the Pkg-ofed-commits mailing list