Re: [ewg] NFS/RDMA backport for OFED 4.8-1 part 3

2017-09-01 Thread Vladimir Sokolovsky

Applied + build: OFED-4.8-1-20170901-1439

Regards,
Vladimir

On 09/02/2017 12:44 AM, Jeff Becker wrote:

Hi Vlad,

Please apply the attached patches to compat-rdma.git. Together with 
the previous two patches, these have been tested with RHEL7.3 and 
SLES12SP2. Thanks.


-jeff



___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/mailman/listinfo/ewg

Re: [ewg] NFS/RDMA backport for OFED 4.8-1 part 2

2017-09-01 Thread Vladimir Sokolovsky

Applied,

Regards,
Vladimir

On 09/02/2017 12:38 AM, Jeff Becker wrote:

Hi Vlad,

Please apply the attached patch to compat.git. Thanks.

-jeff



___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/mailman/listinfo/ewg

Re: [ewg] NFS/RDMA backport for OFED 4.8-1 part 1

2017-09-01 Thread Vladimir Sokolovsky

Applied,

Regards,
Vladimir

On 09/02/2017 12:34 AM, Jeff Becker wrote:

Hi Vlad,

Please apply the attached patch to linux-4.8.git. Thanks.

-jeff



___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/mailman/listinfo/ewg

[ewg] NFS/RDMA backport for OFED 4.8-1 part 3

2017-09-01 Thread Jeff Becker

Hi Vlad,

Please apply the attached patches to compat-rdma.git. Together with the 
previous two patches, these have been tested with RHEL7.3 and SLES12SP2. 
Thanks.


-jeff

>From dcb076f7acbe1f2d34668d864a22dc780ae8a314 Mon Sep 17 00:00:00 2001
From: Jeff Becker 
Date: Fri, 1 Sep 2017 13:25:35 -0700
Subject: [PATCH 2/2] NFS/RDMA backport patch for SLES12SP2

Signed-off-by: Jeff Becker 
---
 patches/0017-BACKPORT-nfsrdma-sles12sp2.patch | 82 +++
 1 file changed, 82 insertions(+)
 create mode 100644 patches/0017-BACKPORT-nfsrdma-sles12sp2.patch

diff --git a/patches/0017-BACKPORT-nfsrdma-sles12sp2.patch b/patches/0017-BACKPORT-nfsrdma-sles12sp2.patch
new file mode 100644
index 000..ebc453f
--- /dev/null
+++ b/patches/0017-BACKPORT-nfsrdma-sles12sp2.patch
@@ -0,0 +1,82 @@
+diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
+index a71b0f5..4fd3708 100644
+--- a/net/sunrpc/xprtrdma/xprt_rdma.h
 b/net/sunrpc/xprtrdma/xprt_rdma.h
+@@ -52,6 +52,10 @@
+ #include  	/* RPC/RDMA protocol */
+ #include  	/* xprt parameters */
+ 
++#ifndef HAVE_XPRT_PUT_EXPORTED
++#include 
++#endif
++
+ #define RDMA_RESOLVE_TIMEOUT	(5000)	/* 5 seconds */
+ #define RDMA_CONNECT_RETRY_MAX	(2)	/* retries if no listener backlog */
+ 
+@@ -541,4 +541,30 @@ void xprt_rdma_bc_destroy(struct rpc_xprt *, unsigned int);
+ 
+ extern struct xprt_class xprt_rdma_bc;
+ 
++#ifndef HAVE_XPRT_PUT_EXPORTED
++static inline void backport_xprt_put(struct rpc_xprt *xprt)
++{
++	if (atomic_dec_and_test(>count)) {
++		printk("RPC:   destroying transport %p\n", xprt);
++
++		/* Exclude transport connect/disconnect handlers */
++		wait_on_bit_lock(>state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE);
++
++		del_timer_sync(>timer);
++
++		debugfs_remove_recursive(xprt->debugfs);
++		xprt->debugfs = NULL;
++		rpc_destroy_wait_queue(>binding);
++		rpc_destroy_wait_queue(>pending);
++		rpc_destroy_wait_queue(>sending);
++		rpc_destroy_wait_queue(>backlog);
++		cancel_work_sync(>task_cleanup);
++		kfree(xprt->servername);
++		/*
++ 	 	 * Tear down transport state and free the rpc_xprt
++ 	 	 */
++		xprt->ops->destroy(xprt);
++	}
++}
++#endif
+ #endif/* _LINUX_SUNRPC_XPRT_RDMA_H */
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+index a2a7519..1d2703c 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
 b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+@@ -350,7 +350,11 @@ xprt_setup_rdma_bc(struct xprt_create *args)
+ out_fail:
+ 	xprt_rdma_free_addresses(xprt);
+ 	args->bc_xprt->xpt_bc_xprt = NULL;
++#ifdef HAVE_XPRT_PUT_EXPORTED
+ 	xprt_put(xprt);
++#else
++	backport_xprt_put(xprt);
++#endif
+ 	xprt_free(xprt);
+ 	return ERR_PTR(-EINVAL);
+ }
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+index dd94401..a9f812f 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
 b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+@@ -1223,7 +1223,11 @@ static void __svc_rdma_free(struct work_struct *work)
+ 
+ 	/* Final put of backchannel client transport */
+ 	if (xprt->xpt_bc_xprt) {
++#ifdef HAVE_XPRT_PUT_EXPORTED
+ 		xprt_put(xprt->xpt_bc_xprt);
++#else
++		backport_xprt_put(xprt->xpt_bc_xprt);
++#endif
+ 		xprt->xpt_bc_xprt = NULL;
+ 	}
+ 
+diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
+index a71b0f5..607c94c 100644
+--- a/net/sunrpc/xprtrdma/xprt_rdma.h
 b/net/sunrpc/xprtrdma/xprt_rdma.h
-- 
1.8.3.1

>From f33a8f4bfc55b57b45518ff00165f8d49fe58fc5 Mon Sep 17 00:00:00 2001
From: Jeff Becker 
Date: Thu, 24 Aug 2017 10:06:10 -0700
Subject: [PATCH 1/2] NFS/RDMA backport patch to revert source files to 4.6
 kernel in order to facilitate dependency on distro SUNRPC. Include fix to use
 correct ib_map_mr_sg signature from OFED4.8.

Signed-off-by: Jeff Becker 
---
 ofed_scripts/checkout_files|1 +
 patches/0016-BACKPORT-nfsrdma-to-4.6.patch | 3682 
 2 files changed, 3683 insertions(+)
 create mode 100644 patches/0016-BACKPORT-nfsrdma-to-4.6.patch

diff --git a/ofed_scripts/checkout_files b/ofed_scripts/checkout_files
index 21bc220..f1b6a76 100644
--- a/ofed_scripts/checkout_files
+++ b/ofed_scripts/checkout_files
@@ -25,3 +25,4 @@ drivers/nvme/
 include/linux/nvme.h
 include/linux/nvme-rdma.h
 include/uapi/linux/nvme_ioctl.h
+include/linux/sunrpc/
diff --git a/patches/0016-BACKPORT-nfsrdma-to-4.6.patch b/patches/0016-BACKPORT-nfsrdma-to-4.6.patch
new file mode 100644
index 000..e0846b2
--- /dev/null
+++ b/patches/0016-BACKPORT-nfsrdma-to-4.6.patch
@@ -0,0 +1,3682 @@
+diff --git a/net/sunrpc/xprtrdma/Makefile b/net/sunrpc/xprtrdma/Makefile
+index ef19fa4..dc9f3b5 100644
+--- a/net/sunrpc/xprtrdma/Makefile
 b/net/sunrpc/xprtrdma/Makefile
+@@ -1,7 +1,7 @@
+ obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o
+ 
+ rpcrdma-y := 

[ewg] NFS/RDMA backport for OFED 4.8-1 part 2

2017-09-01 Thread Jeff Becker

Hi Vlad,

Please apply the attached patch to compat.git. Thanks.

-jeff

>From 96cfe9b9d341df91618e96549c0db2aa06c8f1f7 Mon Sep 17 00:00:00 2001
From: Jeff Becker 
Date: Fri, 1 Sep 2017 13:35:23 -0700
Subject: [PATCH] NFS/RDMA backport: check if kernel exports xprt_put symbol.

Signed-off-by: Jeff Becker 
---
 config/rdma.m4 | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/config/rdma.m4 b/config/rdma.m4
index 0f13391..aaddbef 100644
--- a/config/rdma.m4
+++ b/config/rdma.m4
@@ -3499,6 +3499,12 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
 			[pat_enabled is exported by the kernel])],
 	[])
 
+	LB_CHECK_SYMBOL_EXPORT([xprt_put],
+		[net/sunrpc/xprt.c],
+		[AC_DEFINE(HAVE_XPRT_PUT_EXPORTED, 1,
+			[xprt_put is exported by the kernel])],
+	[])
+
 	AC_MSG_CHECKING([if configfs.h default_groups is list_head])
 	LB_LINUX_TRY_COMPILE([
 		#include 
-- 
1.8.3.1

___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/mailman/listinfo/ewg

[ewg] NFS/RDMA backport for OFED 4.8-1 part 1

2017-09-01 Thread Jeff Becker

Hi Vlad,

Please apply the attached patch to linux-4.8.git. Thanks.

-jeff

>From 5568001640115eecfdc5925541bc86aa0c69810f Mon Sep 17 00:00:00 2001
From: Jeff Becker 
Date: Thu, 24 Aug 2017 10:17:06 -0700
Subject: [PATCH] Add missing NFS/RDMA header files

Signed-off-by: Jeff Becker 
---
 include/linux/sunrpc/rpc_rdma.h | 132 
 include/linux/sunrpc/svc_rdma.h | 267 
 2 files changed, 399 insertions(+)
 create mode 100644 include/linux/sunrpc/rpc_rdma.h
 create mode 100644 include/linux/sunrpc/svc_rdma.h

diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
new file mode 100644
index 000..3b1ff38
--- /dev/null
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the BSD-type
+ * 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.
+ *
+ *  Neither the name of the Network Appliance, Inc. nor the names of
+ *  its contributors may be used to endorse or promote products
+ *  derived from this software without specific prior written
+ *  permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_SUNRPC_RPC_RDMA_H
+#define _LINUX_SUNRPC_RPC_RDMA_H
+
+#include 
+
+#define RPCRDMA_VERSION		1
+#define rpcrdma_version		cpu_to_be32(RPCRDMA_VERSION)
+
+struct rpcrdma_segment {
+	__be32 rs_handle;	/* Registered memory handle */
+	__be32 rs_length;	/* Length of the chunk in bytes */
+	__be64 rs_offset;	/* Chunk virtual address or offset */
+};
+
+/*
+ * read chunk(s), encoded as a linked list.
+ */
+struct rpcrdma_read_chunk {
+	__be32 rc_discrim;	/* 1 indicates presence */
+	__be32 rc_position;	/* Position in XDR stream */
+	struct rpcrdma_segment rc_target;
+};
+
+/*
+ * write chunk, and reply chunk.
+ */
+struct rpcrdma_write_chunk {
+	struct rpcrdma_segment wc_target;
+};
+
+/*
+ * write chunk(s), encoded as a counted array.
+ */
+struct rpcrdma_write_array {
+	__be32 wc_discrim;	/* 1 indicates presence */
+	__be32 wc_nchunks;	/* Array count */
+	struct rpcrdma_write_chunk wc_array[0];
+};
+
+struct rpcrdma_msg {
+	__be32 rm_xid;	/* Mirrors the RPC header xid */
+	__be32 rm_vers;	/* Version of this protocol */
+	__be32 rm_credit;	/* Buffers requested/granted */
+	__be32 rm_type;	/* Type of message (enum rpcrdma_proc) */
+	union {
+
+		struct {			/* no chunks */
+			__be32 rm_empty[3];	/* 3 empty chunk lists */
+		} rm_nochunks;
+
+		struct {			/* no chunks and padded */
+			__be32 rm_align;	/* Padding alignment */
+			__be32 rm_thresh;	/* Padding threshold */
+			__be32 rm_pempty[3];	/* 3 empty chunk lists */
+		} rm_padded;
+
+		struct {
+			__be32 rm_err;
+			__be32 rm_vers_low;
+			__be32 rm_vers_high;
+		} rm_error;
+
+		__be32 rm_chunks[0];	/* read, write and reply chunks */
+
+	} rm_body;
+};
+
+/*
+ * Smallest RPC/RDMA header: rm_xid through rm_type, then rm_nochunks
+ */
+#define RPCRDMA_HDRLEN_MIN	(sizeof(__be32) * 7)
+#define RPCRDMA_HDRLEN_ERR	(sizeof(__be32) * 5)
+
+enum rpcrdma_errcode {
+	ERR_VERS = 1,
+	ERR_CHUNK = 2
+};
+
+enum rpcrdma_proc {
+	RDMA_MSG = 0,		/* An RPC call or reply msg */
+	RDMA_NOMSG = 1,		/* An RPC call or reply msg - separate body */
+	RDMA_MSGP = 2,		/* An RPC call or reply msg with padding */
+	RDMA_DONE = 3,		/* Client signals reply completion */
+	RDMA_ERROR = 4		/* An RPC RDMA encoding error */
+};
+
+#define