Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722740 > unrolled thread

[Patch v3 00/19] CIFS: Implement SMB Direct

Started byLong Li <longli@exchange.microsoft.com>
First post2017-08-29 21:40 +0200
Last post2017-08-30 20:50 +0200
Articles 20 on this page of 34 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [Patch v3 00/19] CIFS: Implement SMB Direct Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 07/19] CIFS: SMBD: Destroy SMBDirect session on shutdown or umount Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB  connection and Makefile Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 01:20 +0200
        RE: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB  connection and Makefile Long Li <longli@microsoft.com> - 2017-08-30 01:20 +0200
    [Patch v3 09/19] CIFS: SMBD: Receive data from SMBDirect Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 01/19] CIFS: Add rdma mount option Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 01/19] CIFS: Add rdma mount option Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 00:40 +0200
        RE: [Patch v3 01/19] CIFS: Add rdma mount option Long Li <longli@microsoft.com> - 2017-08-30 01:00 +0200
    [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 02:50 +0200
        RE: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O  data Long Li <longli@microsoft.com> - 2017-08-30 04:20 +0200
    [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 03:00 +0200
        RE: [Patch v3 12/19] CIFS: SMBD: Fix the definition for  SMB2_CHANNEL_RDMA_V1_INVALIDATE Long Li <longli@microsoft.com> - 2017-08-30 04:20 +0200
    [Patch v3 10/19] CIFS: SMBD: Send data through SMBDirect Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 19/19] CIFS: SMBD: Add SMBDirect debug counters Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 17/19] CIFS: SMBD: Implement SMB read via RDMA write through memory registration Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 14/19] CIFS: SMBD: Deregister memory on finishing SMB write Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 08/19] CIFS: SMBD: Set SMBDirect maximum read or write size for I/O Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 18/19] CIFS: SMBD: Deregister memory when finishing SMB read Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 06/19] CIFS: SMBD: Reconnect to SMBDirect session Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 06/19] CIFS: SMBD: Reconnect to SMBDirect session Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 01:30 +0200
        RE: [Patch v3 06/19] CIFS: SMBD: Reconnect to SMBDirect session Long Li <longli@microsoft.com> - 2017-08-30 01:40 +0200
    [Patch v3 15/19] CIFS: SMBD: Add parameter rdata to smb2_new_read_req Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 13/19] CIFS: SMBD: Implement SMB write via RDMA read through memory registration Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
    [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants Long Li <longli@exchange.microsoft.com> - 2017-08-29 21:40 +0200
      Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 00:50 +0200
        RE: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport  constants Long Li <longli@microsoft.com> - 2017-08-30 01:10 +0200
          Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 20:20 +0200
            RE: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport  constants Long Li <longli@microsoft.com> - 2017-08-30 20:30 +0200
              Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants Pavel Shilovsky <piastryyy@gmail.com> - 2017-08-30 20:40 +0200
                Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants Steve French <smfrench@gmail.com> - 2017-09-01 17:50 +0200
    RE: [Patch v3 00/19] CIFS: Implement SMB Direct Long Li <longli@microsoft.com> - 2017-08-30 20:50 +0200

Page 1 of 2  [1] 2  Next page →


#1722740 — [Patch v3 00/19] CIFS: Implement SMB Direct

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 00/19] CIFS: Implement SMB Direct
Message-ID<ujUwF-6Me-9@gated-at.bofh.it>
From: Long Li <longli@microsoft.com>

Starting with SMB2 dialect 3.0, Microsoft introduced SMBDirect transport
protocol for transferring upper layer (SMB2) payload over RDMA via Infiniband,
RoCE or iWARP. The prococol is published in [MS-SMBD]
(https://msdn.microsoft.com/en-us/library/hh536346.aspx).

Patch v2 added RDMA read/write via memory registration, and addressed
feedbacks on v1.

Patch v3 improved performance by introducing an additional queue for handling
empty packets and reducing lock contention on IRQ path. Also added light
weight profiling by reading TSC and addressed feedbacks on v2.

Long Li (19):
  CIFS: Add rdma mount option
  CIFS: SMBD: Add SMBDirect protocol and transport constants
  CIFS: SMBD: Implement SMBDirect transport
  CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile
  CIFS: SMBD: Connect to SMBDirect session
  CIFS: SMBD: Reconnect to SMBDirect session
  CIFS: SMBD: Destroy SMBDirect session on shutdown or umount
  CIFS: SMBD: Set SMBDirect maximum read or write size for I/O
  CIFS: SMBD: Receive data from SMBDirect
  CIFS: SMBD: Send data through SMBDirect
  CIFS: SMBD: Define memory registration for I/O data
  CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE
  CIFS: SMBD: Implement SMB write via RDMA read through memory
    registration
  CIFS: SMBD: Deregister memory on finishing SMB write
  CIFS: SMBD: Add parameter rdata to smb2_new_read_req
  CIFS: SMBD: Read correct returned data length for RDMA write (SMB
    read) I/O
  CIFS: SMBD: Implement SMB read via RDMA write through memory
    registration
  CIFS: SMBD: Deregister memory when finishing SMB read
  CIFS: SMBD: Add SMBDirect debug counters

 fs/cifs/Makefile     |    2 +-
 fs/cifs/cifs_debug.c |   84 ++
 fs/cifs/cifsfs.c     |    2 +
 fs/cifs/cifsglob.h   |   17 +-
 fs/cifs/cifssmb.c    |   10 +-
 fs/cifs/connect.c    |   46 +-
 fs/cifs/file.c       |   10 +
 fs/cifs/smb1ops.c    |    2 +-
 fs/cifs/smb2ops.c    |   21 +-
 fs/cifs/smb2pdu.c    |  114 ++-
 fs/cifs/smb2pdu.h    |    2 +-
 fs/cifs/smbdirect.c  | 2639 ++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/cifs/smbdirect.h  |  324 +++++++
 fs/cifs/transport.c  |    7 +
 14 files changed, 3260 insertions(+), 20 deletions(-)
 create mode 100644 fs/cifs/smbdirect.c
 create mode 100644 fs/cifs/smbdirect.h

-- 
2.7.4

[toc] | [next] | [standalone]


#1722741 — [Patch v3 07/19] CIFS: SMBD: Destroy SMBDirect session on shutdown or umount

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 07/19] CIFS: SMBD: Destroy SMBDirect session on shutdown or umount
Message-ID<ujUwG-6Me-15@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

When CIFS wants to umount, call shutdown on transport when SMBDirect is used.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/connect.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 341a3fd..4f62337 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -708,6 +708,11 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
 	/* give those requests time to exit */
 	msleep(125);
 
+	if (server->smbd_conn) {
+		smbd_destroy(server->smbd_conn);
+		server->smbd_conn = NULL;
+	}
+
 	if (server->ssocket) {
 		sock_release(server->ssocket);
 		server->ssocket = NULL;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722742 — [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile
Message-ID<ujUwG-6Me-19@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

Add SMBDirect as an optional connection to the SMB session structure in CIFS.
When SMB session is connected through SMBDirect, upper layer uses this
connection to carry payloads.

With the transport code hooked up to upper layer, add SMBDirect code to
Makefile.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/Makefile   | 2 +-
 fs/cifs/cifsglob.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
index eed7eb0..6bb9863 100644
--- a/fs/cifs/Makefile
+++ b/fs/cifs/Makefile
@@ -18,4 +18,4 @@ cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
 cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
 
 cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o \
-			    smb2misc.o smb2pdu.o smb2inode.o smb2file.o
+			    smb2misc.o smb2pdu.o smb2inode.o smb2file.o smbdirect.o
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 703c2fb..dc5404d 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -652,6 +652,8 @@ struct TCP_Server_Info {
 	bool	large_buf;		/* is current buffer large? */
 	/* use SMBD connection instead of socket */
 	bool	rdma;
+	/* point to the SMBD connection if RDMA is used instead of socket */
+	struct smbd_connection *smbd_conn;
 	struct delayed_work	echo; /* echo ping workqueue job */
 	char	*smallbuf;	/* pointer to current "small" buffer */
 	char	*bigbuf;	/* pointer to current "big" buffer */
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722905 — Re: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile

FromPavel Shilovsky <piastryyy@gmail.com>
Date2017-08-30 01:20 +0200
SubjectRe: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile
Message-ID<ujXXz-xc-3@gated-at.bofh.it>
In reply to#1722742
2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> From: Long Li <longli@microsoft.com>
>
> Add SMBDirect as an optional connection to the SMB session structure in CIFS.
> When SMB session is connected through SMBDirect, upper layer uses this
> connection to carry payloads.
>
> With the transport code hooked up to upper layer, add SMBDirect code to
> Makefile.
>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  fs/cifs/Makefile   | 2 +-
>  fs/cifs/cifsglob.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
> index eed7eb0..6bb9863 100644
> --- a/fs/cifs/Makefile
> +++ b/fs/cifs/Makefile
> @@ -18,4 +18,4 @@ cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
>  cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
>
>  cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o \
> -                           smb2misc.o smb2pdu.o smb2inode.o smb2file.o
> +                           smb2misc.o smb2pdu.o smb2inode.o smb2file.o smbdirect.o
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 703c2fb..dc5404d 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -652,6 +652,8 @@ struct TCP_Server_Info {
>         bool    large_buf;              /* is current buffer large? */
>         /* use SMBD connection instead of socket */
>         bool    rdma;
> +       /* point to the SMBD connection if RDMA is used instead of socket */
> +       struct smbd_connection *smbd_conn;
>         struct delayed_work     echo; /* echo ping workqueue job */
>         char    *smallbuf;      /* pointer to current "small" buffer */
>         char    *bigbuf;        /* pointer to current "big" buffer */
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

It is better to split the current patch into 2 and merge the Makefile
part to #3 and cifsglob.h part to #5.

--
Best regards,
Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722906 — RE: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile

FromLong Li <longli@microsoft.com>
Date2017-08-30 01:20 +0200
SubjectRE: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile
Message-ID<ujXXz-xc-1@gated-at.bofh.it>
In reply to#1722905
> -----Original Message-----
> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
> Sent: Tuesday, August 29, 2017 4:12 PM
> To: Long Li <longli@microsoft.com>
> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>;
> Long Li <longli@microsoft.com>
> Subject: Re: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB
> connection and Makefile
> 
> 2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> > From: Long Li <longli@microsoft.com>
> >
> > Add SMBDirect as an optional connection to the SMB session structure in
> CIFS.
> > When SMB session is connected through SMBDirect, upper layer uses this
> > connection to carry payloads.
> >
> > With the transport code hooked up to upper layer, add SMBDirect code
> > to Makefile.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  fs/cifs/Makefile   | 2 +-
> >  fs/cifs/cifsglob.h | 2 ++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile index
> > eed7eb0..6bb9863 100644
> > --- a/fs/cifs/Makefile
> > +++ b/fs/cifs/Makefile
> > @@ -18,4 +18,4 @@ cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o
> > cifs_dfs_ref.o
> >  cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
> >
> >  cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o
> smb2transport.o \
> > -                           smb2misc.o smb2pdu.o smb2inode.o smb2file.o
> > +                           smb2misc.o smb2pdu.o smb2inode.o
> > + smb2file.o smbdirect.o
> > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index
> > 703c2fb..dc5404d 100644
> > --- a/fs/cifs/cifsglob.h
> > +++ b/fs/cifs/cifsglob.h
> > @@ -652,6 +652,8 @@ struct TCP_Server_Info {
> >         bool    large_buf;              /* is current buffer large? */
> >         /* use SMBD connection instead of socket */
> >         bool    rdma;
> > +       /* point to the SMBD connection if RDMA is used instead of socket */
> > +       struct smbd_connection *smbd_conn;
> >         struct delayed_work     echo; /* echo ping workqueue job */
> >         char    *smallbuf;      /* pointer to current "small" buffer */
> >         char    *bigbuf;        /* pointer to current "big" buffer */
> > --
> > 2.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-cifs"
> > in the body of a message to majordomo@vger.kernel.org More
> majordomo
> > info at
> >
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.k
> > ernel.org%2Fmajordomo-
> info.html&data=02%7C01%7Clongli%40microsoft.com%
> >
> 7C74a459a67c6440f88d4308d4ef3358c5%7C72f988bf86f141af91ab2d7cd011db
> 47%
> >
> 7C1%7C0%7C636396451192818334&sdata=nIFmV5wvnL1xMm6tCnfdAgLMt%
> 2BFKJU6oh
> > hNhEXO8ZJs%3D&reserved=0
> 
> It is better to split the current patch into 2 and merge the Makefile part to #3
> and cifsglob.h part to #5.

Sure, will make the change.

> 
> --
> Best regards,
> Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722743 — [Patch v3 09/19] CIFS: SMBD: Receive data from SMBDirect

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 09/19] CIFS: SMBD: Receive data from SMBDirect
Message-ID<ujUwG-6Me-17@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

With SMBDirect connected, use it for receiving data via RDMA recv.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/connect.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4f62337..29f384f 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -546,7 +546,10 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg)
 		if (server_unresponsive(server))
 			return -ECONNABORTED;
 
-		length = sock_recvmsg(server->ssocket, smb_msg, 0);
+		if (server->smbd_conn)
+			length = smbd_recv(server->smbd_conn, smb_msg);
+		else
+			length = sock_recvmsg(server->ssocket, smb_msg, 0);
 
 		if (server->tcpStatus == CifsExiting)
 			return -ESHUTDOWN;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722744 — [Patch v3 01/19] CIFS: Add rdma mount option

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 01/19] CIFS: Add rdma mount option
Message-ID<ujUwG-6Me-23@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

Add "rdma" to CIFS mount options to connect to SMB Direct.
Add checks to validate this is used on SMB 3.X dialects.

To connect to SMBDirect, use "mount.cifs -o rdma,vers=3.x".
At the time of this patch, 3.x can be 3.0, 3.02 or 3.1.1.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/cifs_debug.c |  2 ++
 fs/cifs/cifsfs.c     |  2 ++
 fs/cifs/cifsglob.h   |  3 +++
 fs/cifs/connect.c    | 15 ++++++++++++++-
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 9727e1d..ba0870d 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -171,6 +171,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
+			if (server->rdma)
+				seq_printf(m, "RDMA\n\t");
 			seq_printf(m, "TCP status: %d\n\tLocal Users To "
 				   "Server: %d SecMode: 0x%x Req On Wire: %d",
 				   server->tcpStatus, server->srv_count,
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index fe0c8dc..a628800 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -330,6 +330,8 @@ cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server)
 	default:
 		seq_puts(s, "(unknown)");
 	}
+	if (server->rdma)
+		seq_puts(s, ",rdma");
 }
 
 static void
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 8289f95..703c2fb 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -531,6 +531,7 @@ struct smb_vol {
 	bool nopersistent:1;
 	bool resilient:1; /* noresilient not required since not fored for CA */
 	bool domainauto:1;
+	bool rdma:1;
 	unsigned int rsize;
 	unsigned int wsize;
 	bool sockopt_tcp_nodelay:1;
@@ -649,6 +650,8 @@ struct TCP_Server_Info {
 	bool	sec_kerberos;		/* supports plain Kerberos */
 	bool	sec_mskerberos;		/* supports legacy MS Kerberos */
 	bool	large_buf;		/* is current buffer large? */
+	/* use SMBD connection instead of socket */
+	bool	rdma;
 	struct delayed_work	echo; /* echo ping workqueue job */
 	char	*smallbuf;	/* pointer to current "small" buffer */
 	char	*bigbuf;	/* pointer to current "big" buffer */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 2eeaac6..19fdca8 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -94,7 +94,7 @@ enum {
 	Opt_multiuser, Opt_sloppy, Opt_nosharesock,
 	Opt_persistent, Opt_nopersistent,
 	Opt_resilient, Opt_noresilient,
-	Opt_domainauto,
+	Opt_domainauto, Opt_rdma,
 
 	/* Mount options which take numeric value */
 	Opt_backupuid, Opt_backupgid, Opt_uid,
@@ -185,6 +185,7 @@ static const match_table_t cifs_mount_option_tokens = {
 	{ Opt_resilient, "resilienthandles"},
 	{ Opt_noresilient, "noresilienthandles"},
 	{ Opt_domainauto, "domainauto"},
+	{ Opt_rdma, "rdma"},
 
 	{ Opt_backupuid, "backupuid=%s" },
 	{ Opt_backupgid, "backupgid=%s" },
@@ -1541,6 +1542,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
 		case Opt_domainauto:
 			vol->domainauto = true;
 			break;
+		case Opt_rdma:
+			vol->rdma = true;
+			break;
 
 		/* Numeric Values */
 		case Opt_backupuid:
@@ -1931,6 +1935,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
 		goto cifs_parse_mount_err;
 	}
 
+	if (vol->rdma && vol->vals->protocol_id < SMB30_PROT_ID) {
+		cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n");
+		goto cifs_parse_mount_err;
+	}
+
 #ifndef CONFIG_KEYS
 	/* Muliuser mounts require CONFIG_KEYS support */
 	if (vol->multiuser) {
@@ -2134,6 +2143,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)
 	if (server->echo_interval != vol->echo_interval * HZ)
 		return 0;
 
+	if (server->rdma != vol->rdma)
+		return 0;
+
 	return 1;
 }
 
@@ -2234,6 +2246,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
 	tcp_ses->noblocksnd = volume_info->noblocksnd;
 	tcp_ses->noautotune = volume_info->noautotune;
 	tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
+	tcp_ses->rdma = volume_info->rdma;
 	tcp_ses->in_flight = 0;
 	tcp_ses->credits = 1;
 	init_waitqueue_head(&tcp_ses->response_q);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722894 — Re: [Patch v3 01/19] CIFS: Add rdma mount option

FromPavel Shilovsky <piastryyy@gmail.com>
Date2017-08-30 00:40 +0200
SubjectRe: [Patch v3 01/19] CIFS: Add rdma mount option
Message-ID<ujXkR-5k-5@gated-at.bofh.it>
In reply to#1722744
2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> From: Long Li <longli@microsoft.com>
>
> Add "rdma" to CIFS mount options to connect to SMB Direct.
> Add checks to validate this is used on SMB 3.X dialects.
>
> To connect to SMBDirect, use "mount.cifs -o rdma,vers=3.x".
> At the time of this patch, 3.x can be 3.0, 3.02 or 3.1.1.
>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  fs/cifs/cifs_debug.c |  2 ++
>  fs/cifs/cifsfs.c     |  2 ++
>  fs/cifs/cifsglob.h   |  3 +++
>  fs/cifs/connect.c    | 15 ++++++++++++++-
>  4 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index 9727e1d..ba0870d 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -171,6 +171,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                                 ses->ses_count, ses->serverOS, ses->serverNOS,
>                                 ses->capabilities, ses->status);
>                         }
> +                       if (server->rdma)
> +                               seq_printf(m, "RDMA\n\t");
>                         seq_printf(m, "TCP status: %d\n\tLocal Users To "
>                                    "Server: %d SecMode: 0x%x Req On Wire: %d",
>                                    server->tcpStatus, server->srv_count,
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index fe0c8dc..a628800 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -330,6 +330,8 @@ cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server)
>         default:
>                 seq_puts(s, "(unknown)");
>         }
> +       if (server->rdma)
> +               seq_puts(s, ",rdma");
>  }
>
>  static void
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 8289f95..703c2fb 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -531,6 +531,7 @@ struct smb_vol {
>         bool nopersistent:1;
>         bool resilient:1; /* noresilient not required since not fored for CA */
>         bool domainauto:1;
> +       bool rdma:1;
>         unsigned int rsize;
>         unsigned int wsize;
>         bool sockopt_tcp_nodelay:1;
> @@ -649,6 +650,8 @@ struct TCP_Server_Info {
>         bool    sec_kerberos;           /* supports plain Kerberos */
>         bool    sec_mskerberos;         /* supports legacy MS Kerberos */
>         bool    large_buf;              /* is current buffer large? */
> +       /* use SMBD connection instead of socket */
> +       bool    rdma;
>         struct delayed_work     echo; /* echo ping workqueue job */
>         char    *smallbuf;      /* pointer to current "small" buffer */
>         char    *bigbuf;        /* pointer to current "big" buffer */
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 2eeaac6..19fdca8 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -94,7 +94,7 @@ enum {
>         Opt_multiuser, Opt_sloppy, Opt_nosharesock,
>         Opt_persistent, Opt_nopersistent,
>         Opt_resilient, Opt_noresilient,
> -       Opt_domainauto,
> +       Opt_domainauto, Opt_rdma,
>
>         /* Mount options which take numeric value */
>         Opt_backupuid, Opt_backupgid, Opt_uid,
> @@ -185,6 +185,7 @@ static const match_table_t cifs_mount_option_tokens = {
>         { Opt_resilient, "resilienthandles"},
>         { Opt_noresilient, "noresilienthandles"},
>         { Opt_domainauto, "domainauto"},
> +       { Opt_rdma, "rdma"},
>
>         { Opt_backupuid, "backupuid=%s" },
>         { Opt_backupgid, "backupgid=%s" },
> @@ -1541,6 +1542,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
>                 case Opt_domainauto:
>                         vol->domainauto = true;
>                         break;
> +               case Opt_rdma:
> +                       vol->rdma = true;
> +                       break;
>
>                 /* Numeric Values */
>                 case Opt_backupuid:
> @@ -1931,6 +1935,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
>                 goto cifs_parse_mount_err;
>         }
>
> +       if (vol->rdma && vol->vals->protocol_id < SMB30_PROT_ID) {
> +               cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n");
> +               goto cifs_parse_mount_err;
> +       }
> +
>  #ifndef CONFIG_KEYS
>         /* Muliuser mounts require CONFIG_KEYS support */
>         if (vol->multiuser) {
> @@ -2134,6 +2143,9 @@ static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)
>         if (server->echo_interval != vol->echo_interval * HZ)
>                 return 0;
>
> +       if (server->rdma != vol->rdma)
> +               return 0;
> +
>         return 1;
>  }
>
> @@ -2234,6 +2246,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
>         tcp_ses->noblocksnd = volume_info->noblocksnd;
>         tcp_ses->noautotune = volume_info->noautotune;
>         tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
> +       tcp_ses->rdma = volume_info->rdma;
>         tcp_ses->in_flight = 0;
>         tcp_ses->credits = 1;
>         init_waitqueue_head(&tcp_ses->response_q);
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

It is better to introduce a mount option after the functional changes
not before them. In this case we do not result in having the mount
option that does nothing if we break the patchset.

--
Best regards,
Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722898 — RE: [Patch v3 01/19] CIFS: Add rdma mount option

FromLong Li <longli@microsoft.com>
Date2017-08-30 01:00 +0200
SubjectRE: [Patch v3 01/19] CIFS: Add rdma mount option
Message-ID<ujXEd-bG-1@gated-at.bofh.it>
In reply to#1722894

> -----Original Message-----
> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
> Sent: Tuesday, August 29, 2017 3:37 PM
> To: Long Li <longli@microsoft.com>
> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>;
> Long Li <longli@microsoft.com>
> Subject: Re: [Patch v3 01/19] CIFS: Add rdma mount option
> 
> 2017-08-29 12:28 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> > From: Long Li <longli@microsoft.com>
> >
> > Add "rdma" to CIFS mount options to connect to SMB Direct.
> > Add checks to validate this is used on SMB 3.X dialects.
> >
> > To connect to SMBDirect, use "mount.cifs -o rdma,vers=3.x".
> > At the time of this patch, 3.x can be 3.0, 3.02 or 3.1.1.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  fs/cifs/cifs_debug.c |  2 ++
> >  fs/cifs/cifsfs.c     |  2 ++
> >  fs/cifs/cifsglob.h   |  3 +++
> >  fs/cifs/connect.c    | 15 ++++++++++++++-
> >  4 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index
> > 9727e1d..ba0870d 100644
> > --- a/fs/cifs/cifs_debug.c
> > +++ b/fs/cifs/cifs_debug.c
> > @@ -171,6 +171,8 @@ static int cifs_debug_data_proc_show(struct
> seq_file *m, void *v)
> >                                 ses->ses_count, ses->serverOS, ses->serverNOS,
> >                                 ses->capabilities, ses->status);
> >                         }
> > +                       if (server->rdma)
> > +                               seq_printf(m, "RDMA\n\t");
> >                         seq_printf(m, "TCP status: %d\n\tLocal Users To "
> >                                    "Server: %d SecMode: 0x%x Req On Wire: %d",
> >                                    server->tcpStatus,
> > server->srv_count, diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> > index fe0c8dc..a628800 100644
> > --- a/fs/cifs/cifsfs.c
> > +++ b/fs/cifs/cifsfs.c
> > @@ -330,6 +330,8 @@ cifs_show_address(struct seq_file *s, struct
> TCP_Server_Info *server)
> >         default:
> >                 seq_puts(s, "(unknown)");
> >         }
> > +       if (server->rdma)
> > +               seq_puts(s, ",rdma");
> >  }
> >
> >  static void
> > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index
> > 8289f95..703c2fb 100644
> > --- a/fs/cifs/cifsglob.h
> > +++ b/fs/cifs/cifsglob.h
> > @@ -531,6 +531,7 @@ struct smb_vol {
> >         bool nopersistent:1;
> >         bool resilient:1; /* noresilient not required since not fored for CA */
> >         bool domainauto:1;
> > +       bool rdma:1;
> >         unsigned int rsize;
> >         unsigned int wsize;
> >         bool sockopt_tcp_nodelay:1;
> > @@ -649,6 +650,8 @@ struct TCP_Server_Info {
> >         bool    sec_kerberos;           /* supports plain Kerberos */
> >         bool    sec_mskerberos;         /* supports legacy MS Kerberos */
> >         bool    large_buf;              /* is current buffer large? */
> > +       /* use SMBD connection instead of socket */
> > +       bool    rdma;
> >         struct delayed_work     echo; /* echo ping workqueue job */
> >         char    *smallbuf;      /* pointer to current "small" buffer */
> >         char    *bigbuf;        /* pointer to current "big" buffer */
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index
> > 2eeaac6..19fdca8 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -94,7 +94,7 @@ enum {
> >         Opt_multiuser, Opt_sloppy, Opt_nosharesock,
> >         Opt_persistent, Opt_nopersistent,
> >         Opt_resilient, Opt_noresilient,
> > -       Opt_domainauto,
> > +       Opt_domainauto, Opt_rdma,
> >
> >         /* Mount options which take numeric value */
> >         Opt_backupuid, Opt_backupgid, Opt_uid, @@ -185,6 +185,7 @@
> > static const match_table_t cifs_mount_option_tokens = {
> >         { Opt_resilient, "resilienthandles"},
> >         { Opt_noresilient, "noresilienthandles"},
> >         { Opt_domainauto, "domainauto"},
> > +       { Opt_rdma, "rdma"},
> >
> >         { Opt_backupuid, "backupuid=%s" },
> >         { Opt_backupgid, "backupgid=%s" }, @@ -1541,6 +1542,9 @@
> > cifs_parse_mount_options(const char *mountdata, const char *devname,
> >                 case Opt_domainauto:
> >                         vol->domainauto = true;
> >                         break;
> > +               case Opt_rdma:
> > +                       vol->rdma = true;
> > +                       break;
> >
> >                 /* Numeric Values */
> >                 case Opt_backupuid:
> > @@ -1931,6 +1935,11 @@ cifs_parse_mount_options(const char
> *mountdata, const char *devname,
> >                 goto cifs_parse_mount_err;
> >         }
> >
> > +       if (vol->rdma && vol->vals->protocol_id < SMB30_PROT_ID) {
> > +               cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n");
> > +               goto cifs_parse_mount_err;
> > +       }
> > +
> >  #ifndef CONFIG_KEYS
> >         /* Muliuser mounts require CONFIG_KEYS support */
> >         if (vol->multiuser) {
> > @@ -2134,6 +2143,9 @@ static int match_server(struct TCP_Server_Info
> *server, struct smb_vol *vol)
> >         if (server->echo_interval != vol->echo_interval * HZ)
> >                 return 0;
> >
> > +       if (server->rdma != vol->rdma)
> > +               return 0;
> > +
> >         return 1;
> >  }
> >
> > @@ -2234,6 +2246,7 @@ cifs_get_tcp_session(struct smb_vol
> *volume_info)
> >         tcp_ses->noblocksnd = volume_info->noblocksnd;
> >         tcp_ses->noautotune = volume_info->noautotune;
> >         tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
> > +       tcp_ses->rdma = volume_info->rdma;
> >         tcp_ses->in_flight = 0;
> >         tcp_ses->credits = 1;
> >         init_waitqueue_head(&tcp_ses->response_q);
> > --
> > 2.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-cifs"
> > in the body of a message to majordomo@vger.kernel.org More
> majordomo
> > info at
> >
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.k
> > ernel.org%2Fmajordomo-
> info.html&data=02%7C01%7Clongli%40microsoft.com%
> >
> 7C4e70338e15204a407fd908d4ef2e855c%7C72f988bf86f141af91ab2d7cd011d
> b47%
> >
> 7C1%7C0%7C636396430465385563&sdata=FX0HbkzueGC4ene2wItN6iCiIRqZk
> 71OzY7
> > d%2FXX6rPM%3D&reserved=0
> 
> It is better to introduce a mount option after the functional changes not
> before them. In this case we do not result in having the mount option that
> does nothing if we break the patchset.

I can move this patch to later.

However it doesn’t break the build, just does nothing at all.

> 
> --
> Best regards,
> Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722745 — [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data
Message-ID<ujUwG-6Me-21@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

To prepare for RDMA read/write using memory registration, add memory
registartion pointers to upper layer data I/O context.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/cifsglob.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index dc5404d..dcd2b63 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1166,6 +1166,7 @@ struct cifs_readdata {
 				struct cifs_readdata *rdata,
 				struct iov_iter *iter);
 	struct kvec			iov[2];
+	struct smbd_mr			*mr;
 	unsigned int			pagesz;
 	unsigned int			tailsz;
 	unsigned int			credits;
@@ -1188,6 +1189,7 @@ struct cifs_writedata {
 	pid_t				pid;
 	unsigned int			bytes;
 	int				result;
+	struct smbd_mr			*mr;
 	unsigned int			pagesz;
 	unsigned int			tailsz;
 	unsigned int			credits;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722939 — Re: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data

FromPavel Shilovsky <piastryyy@gmail.com>
Date2017-08-30 02:50 +0200
SubjectRe: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data
Message-ID<ujZmF-1iX-11@gated-at.bofh.it>
In reply to#1722745
2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> From: Long Li <longli@microsoft.com>
>
> To prepare for RDMA read/write using memory registration, add memory
> registartion pointers to upper layer data I/O context.
>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  fs/cifs/cifsglob.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index dc5404d..dcd2b63 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -1166,6 +1166,7 @@ struct cifs_readdata {
>                                 struct cifs_readdata *rdata,
>                                 struct iov_iter *iter);
>         struct kvec                     iov[2];
> +       struct smbd_mr                  *mr;
>         unsigned int                    pagesz;
>         unsigned int                    tailsz;
>         unsigned int                    credits;
> @@ -1188,6 +1189,7 @@ struct cifs_writedata {
>         pid_t                           pid;
>         unsigned int                    bytes;
>         int                             result;
> +       struct smbd_mr                  *mr;
>         unsigned int                    pagesz;
>         unsigned int                    tailsz;
>         unsigned int                    credits;
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

The same thing: let's not add structure fields that the code doesn't
do anything with.

--
Best regards,
Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722973 — RE: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data

FromLong Li <longli@microsoft.com>
Date2017-08-30 04:20 +0200
SubjectRE: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data
Message-ID<uk0LM-2mC-7@gated-at.bofh.it>
In reply to#1722939

> -----Original Message-----
> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
> Sent: Tuesday, August 29, 2017 5:49 PM
> To: Long Li <longli@microsoft.com>
> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>;
> Long Li <longli@microsoft.com>
> Subject: Re: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O
> data
> 
> 2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> > From: Long Li <longli@microsoft.com>
> >
> > To prepare for RDMA read/write using memory registration, add memory
> > registartion pointers to upper layer data I/O context.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  fs/cifs/cifsglob.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index
> > dc5404d..dcd2b63 100644
> > --- a/fs/cifs/cifsglob.h
> > +++ b/fs/cifs/cifsglob.h
> > @@ -1166,6 +1166,7 @@ struct cifs_readdata {
> >                                 struct cifs_readdata *rdata,
> >                                 struct iov_iter *iter);
> >         struct kvec                     iov[2];
> > +       struct smbd_mr                  *mr;
> >         unsigned int                    pagesz;
> >         unsigned int                    tailsz;
> >         unsigned int                    credits;
> > @@ -1188,6 +1189,7 @@ struct cifs_writedata {
> >         pid_t                           pid;
> >         unsigned int                    bytes;
> >         int                             result;
> > +       struct smbd_mr                  *mr;
> >         unsigned int                    pagesz;
> >         unsigned int                    tailsz;
> >         unsigned int                    credits;
> > --
> > 2.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-cifs"
> > in the body of a message to majordomo@vger.kernel.org More
> majordomo
> > info at
> >
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.k
> > ernel.org%2Fmajordomo-
> info.html&data=02%7C01%7Clongli%40microsoft.com%
> >
> 7C1a02c615906e4648835c08d4ef40e655%7C72f988bf86f141af91ab2d7cd011d
> b47%
> >
> 7C1%7C0%7C636396509394018449&sdata=yjvt3xPYPMmBp8nRiAC%2FYUOOs
> ganvPd%2
> > Ff6Y1uZtbqGU%3D&reserved=0
> 
> The same thing: let's not add structure fields that the code doesn't do
> anything with.

Okay. I will fold the patch into relevant patches.

> 
> --
> Best regards,
> Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722746 — [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE
Message-ID<ujUwG-6Me-25@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

The channel value for requesting server remote invalidating local memory
registration should be 0x00000002

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/smb2pdu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 18700fd..0417a36 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -832,7 +832,7 @@ struct smb2_flush_rsp {
 /* Channel field for read and write: exactly one of following flags can be set*/
 #define SMB2_CHANNEL_NONE		0x00000000
 #define SMB2_CHANNEL_RDMA_V1		0x00000001 /* SMB3 or later */
-#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */
+#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 /* SMB3.02 or later */
 
 /* SMB2 read request without RFC1001 length at the beginning */
 struct smb2_read_plain_req {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722943 — Re: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE

FromPavel Shilovsky <piastryyy@gmail.com>
Date2017-08-30 03:00 +0200
SubjectRe: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE
Message-ID<ujZwl-1m1-1@gated-at.bofh.it>
In reply to#1722746
2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> From: Long Li <longli@microsoft.com>
>
> The channel value for requesting server remote invalidating local memory
> registration should be 0x00000002
>
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  fs/cifs/smb2pdu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
> index 18700fd..0417a36 100644
> --- a/fs/cifs/smb2pdu.h
> +++ b/fs/cifs/smb2pdu.h
> @@ -832,7 +832,7 @@ struct smb2_flush_rsp {
>  /* Channel field for read and write: exactly one of following flags can be set*/
>  #define SMB2_CHANNEL_NONE              0x00000000
>  #define SMB2_CHANNEL_RDMA_V1           0x00000001 /* SMB3 or later */
> -#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */
> +#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 /* SMB3.02 or later */
>
>  /* SMB2 read request without RFC1001 length at the beginning */
>  struct smb2_read_plain_req {
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

If this is a bug in the existing code, this patch should go at the
very beginning of the series.

--
Best regards,
Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722971 — RE: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE

FromLong Li <longli@microsoft.com>
Date2017-08-30 04:20 +0200
SubjectRE: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE
Message-ID<uk0LL-2mC-1@gated-at.bofh.it>
In reply to#1722943

> -----Original Message-----
> From: Pavel Shilovsky [mailto:piastryyy@gmail.com]
> Sent: Tuesday, August 29, 2017 5:50 PM
> To: Long Li <longli@microsoft.com>
> Cc: Steve French <sfrench@samba.org>; linux-cifs <linux-
> cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>;
> Kernel Mailing List <linux-kernel@vger.kernel.org>; linux-
> rdma@vger.kernel.org; Christoph Hellwig <hch@infradead.org>; Tom Talpey
> <ttalpey@microsoft.com>; Matthew Wilcox <mawilcox@microsoft.com>;
> Long Li <longli@microsoft.com>
> Subject: Re: [Patch v3 12/19] CIFS: SMBD: Fix the definition for
> SMB2_CHANNEL_RDMA_V1_INVALIDATE
> 
> 2017-08-29 12:29 GMT-07:00 Long Li <longli@exchange.microsoft.com>:
> > From: Long Li <longli@microsoft.com>
> >
> > The channel value for requesting server remote invalidating local
> > memory registration should be 0x00000002
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  fs/cifs/smb2pdu.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index
> > 18700fd..0417a36 100644
> > --- a/fs/cifs/smb2pdu.h
> > +++ b/fs/cifs/smb2pdu.h
> > @@ -832,7 +832,7 @@ struct smb2_flush_rsp {
> >  /* Channel field for read and write: exactly one of following flags can be
> set*/
> >  #define SMB2_CHANNEL_NONE              0x00000000
> >  #define SMB2_CHANNEL_RDMA_V1           0x00000001 /* SMB3 or later */
> > -#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02
> or
> > later */
> > +#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 /*
> SMB3.02 or
> > +later */
> >
> >  /* SMB2 read request without RFC1001 length at the beginning */
> > struct smb2_read_plain_req {
> > --
> > 2.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-cifs"
> > in the body of a message to majordomo@vger.kernel.org More
> majordomo
> > info at
> >
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.k
> > ernel.org%2Fmajordomo-
> info.html&data=02%7C01%7Clongli%40microsoft.com%
> >
> 7C9a11066a2c3b402da09f08d4ef411927%7C72f988bf86f141af91ab2d7cd011d
> b47%
> >
> 7C1%7C0%7C636396510253376659&sdata=0fLwHcdbOLSOsbKj5PZ2yrJap%2B
> N0ZB%2B
> > TGbFimPMqcx4%3D&reserved=0
> 
> If this is a bug in the existing code, this patch should go at the very beginning
> of the series.

Okay, I will reorder the patch.

> 
> --
> Best regards,
> Pavel Shilovsky

[toc] | [prev] | [next] | [standalone]


#1722747 — [Patch v3 10/19] CIFS: SMBD: Send data through SMBDirect

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 10/19] CIFS: SMBD: Send data through SMBDirect
Message-ID<ujUwG-6Me-29@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

With SMBDirect connected, use it for sending data via RDMA send.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/transport.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index ba62aaf..bddb699 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -37,6 +37,7 @@
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
+#include "smbdirect.h"
 
 void
 cifs_wake_up_task(struct mid_q_entry *mid)
@@ -230,6 +231,11 @@ __smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
 	struct msghdr smb_msg;
 	int val = 1;
 
+	if (server->smbd_conn) {
+		rc = smbd_send(server->smbd_conn, rqst);
+		goto done;
+	}
+
 	if (ssocket == NULL)
 		return -ENOTSOCK;
 
@@ -299,6 +305,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
 		server->tcpStatus = CifsNeedReconnect;
 	}
 
+done:
 	if (rc < 0 && rc != -EINTR)
 		cifs_dbg(VFS, "Error %d sending data on socket to server\n",
 			 rc);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722749 — [Patch v3 19/19] CIFS: SMBD: Add SMBDirect debug counters

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 19/19] CIFS: SMBD: Add SMBDirect debug counters
Message-ID<ujUwG-6Me-31@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

Export SMBDirect debug counters to /proc/fs/cifs/DebugData.

Those are used for debugging, troubleshooting and profiling.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/cifs_debug.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index ba0870d..dad13d5 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -30,6 +30,7 @@
 #include "cifsproto.h"
 #include "cifs_debug.h"
 #include "cifsfs.h"
+#include "smbdirect.h"
 
 void
 cifs_dump_mem(char *label, void *data, int length)
@@ -152,6 +153,87 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	list_for_each(tmp1, &cifs_tcp_ses_list) {
 		server = list_entry(tmp1, struct TCP_Server_Info,
 				    tcp_ses_list);
+
+		if (!server->rdma)
+			goto skip_rdma;
+
+		seq_printf(m, "\nSMBDirect (in hex) protocol version: %x "
+			"transport status: %x",
+			server->smbd_conn->protocol,
+			server->smbd_conn->transport_status);
+		seq_printf(m, "\nConn receive_credit_max: %x "
+			"send_credit_target: %x max_send_size: %x",
+			server->smbd_conn->receive_credit_max,
+			server->smbd_conn->send_credit_target,
+			server->smbd_conn->max_send_size);
+		seq_printf(m, "\nConn max_fragmented_recv_size: %x "
+			"max_fragmented_send_size: %x max_receive_size:%x",
+			server->smbd_conn->max_fragmented_recv_size,
+			server->smbd_conn->max_fragmented_send_size,
+			server->smbd_conn->max_receive_size);
+		seq_printf(m, "\nConn keep_alive_interval: %x "
+			"max_readwrite_size: %x rdma_readwrite_threshold: %x",
+			server->smbd_conn->keep_alive_interval,
+			server->smbd_conn->max_readwrite_size,
+			server->smbd_conn->rdma_readwrite_threshold);
+		seq_printf(m, "\nDebug count_get_receive_buffer: %x "
+			"count_put_receive_buffer: %x count_send_empty: %x",
+			server->smbd_conn->count_get_receive_buffer,
+			server->smbd_conn->count_put_receive_buffer,
+			server->smbd_conn->count_send_empty);
+		seq_printf(m, "\nRead Queue count_reassembly_queue: %x "
+			"count_enqueue_reassembly_queue: %x "
+			"count_dequeue_reassembly_queue: %x "
+			"fragment_reassembly_remaining: %x "
+			"reassembly_data_length: %x "
+			"reassembly_queue_length: %x",
+			server->smbd_conn->count_reassembly_queue,
+			server->smbd_conn->count_enqueue_reassembly_queue,
+			server->smbd_conn->count_dequeue_reassembly_queue,
+			server->smbd_conn->fragment_reassembly_remaining,
+			server->smbd_conn->reassembly_data_length,
+			server->smbd_conn->reassembly_queue_length);
+		seq_printf(m, "\nCurrent Credits send_credits: %x "
+			"receive_credits: %x receive_credit_target: %x",
+			atomic_read(&server->smbd_conn->send_credits),
+			atomic_read(&server->smbd_conn->receive_credits),
+			server->smbd_conn->receive_credit_target);
+		seq_printf(m, "\nPending send_pending: %x send_payload_pending:"
+			" %x smbd_send_pending: %x smbd_recv_pending: %x",
+			atomic_read(&server->smbd_conn->send_pending),
+			atomic_read(&server->smbd_conn->send_payload_pending),
+			server->smbd_conn->smbd_send_pending,
+			server->smbd_conn->smbd_recv_pending);
+		seq_printf(m, "\nReceive buffers count_receive_queue: %x "
+			"count_empty_packet_queue: %x",
+			server->smbd_conn->count_receive_queue,
+			server->smbd_conn->count_empty_packet_queue);
+		seq_printf(m, "\nMR responder_resources: %x "
+			"max_frmr_depth: %x mr_type: %x",
+			server->smbd_conn->responder_resources,
+			server->smbd_conn->max_frmr_depth,
+			server->smbd_conn->mr_type);
+		seq_printf(m, "\nMR mr_ready_count: %x mr_used_count: %x",
+			atomic_read(&server->smbd_conn->mr_ready_count),
+			atomic_read(&server->smbd_conn->mr_used_count));
+
+		seq_printf(m, "\nTSC cycle histogram in I/O path: "
+			"(the number of most significant bits)");
+		seq_printf(m, "\nsmbd_register_mr cycles [1/10000]: ");
+		profiling_display_histogram(m, server->smbd_conn->smbd_register_mr_cycles);
+
+		seq_printf(m, "\nsmbd_deregister_mr cycles [1/10000]: ");
+		profiling_display_histogram(m, server->smbd_conn->smbd_deregister_mr_cycles);
+
+		seq_printf(m, "\nsmbd_send cycles [1/10000]: ");
+		profiling_display_histogram(m, server->smbd_conn->smbd_write_cycles);
+
+		seq_printf(m, "\nsmbd_recv cycles [1/10000]: ");
+		profiling_display_histogram(m, server->smbd_conn->smbd_recv_cycles);
+
+		seq_printf(m, "\nrecv_done cycles [1/10000]: ");
+		profiling_display_histogram(m, server->smbd_conn->recv_done_cycles);
+skip_rdma:
 		seq_printf(m, "\nNumber of credits: %d", server->credits);
 		i++;
 		list_for_each(tmp2, &server->smb_ses_list) {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722750 — [Patch v3 17/19] CIFS: SMBD: Implement SMB read via RDMA write through memory registration

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 17/19] CIFS: SMBD: Implement SMB read via RDMA write through memory registration
Message-ID<ujUwG-6Me-39@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

If I/O size is larger than rdma_readwrite_threshold, use RDMA write for
SMB read by specifying channel SMB2_CHANNEL_RDMA_V1 or
SMB2_CHANNEL_RDMA_V1_INVALIDATE in the SMB packet, depending on SMB dialect
used. Append a smbd_buffer_descriptor_v1 to the end of the SMB packet and fill
in other values to indicate this SMB read uses RDMA write.

There is no need to read from the transport for incoming payload. At the time
SMB read response comes back, the data is already transfered and placed in the
pages by RDMA hardware.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/file.c    |  5 +++++
 fs/cifs/smb2pdu.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index dec70b3..41460a5 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -42,6 +42,7 @@
 #include "cifs_debug.h"
 #include "cifs_fs_sb.h"
 #include "fscache.h"
+#include "smbdirect.h"
 
 
 static inline int cifs_convert_flags(unsigned int flags)
@@ -3037,6 +3038,8 @@ uncached_fill_pages(struct TCP_Server_Info *server,
 		}
 		if (iter)
 			result = copy_page_from_iter(page, 0, n, iter);
+		else if (rdata->mr)
+			result = n;
 		else
 			result = cifs_read_page_from_socket(server, page, n);
 		if (result < 0)
@@ -3606,6 +3609,8 @@ readpages_fill_pages(struct TCP_Server_Info *server,
 
 		if (iter)
 			result = copy_page_from_iter(page, 0, n, iter);
+		else if (rdata->mr)
+			result = n;
 		else
 			result = cifs_read_page_from_socket(server, page, n);
 		if (result < 0)
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index fbad987..1f08c75 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2392,6 +2392,39 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
 	req->Length = cpu_to_le32(io_parms->length);
 	req->Offset = cpu_to_le64(io_parms->offset);
 
+	/*
+	 * If we want to do a RDMA write, fill in and append
+	 * smbd_buffer_descriptor_v1 to the end of read request
+	 */
+	if (server->rdma && rdata &&
+		rdata->bytes > server->smbd_conn->rdma_readwrite_threshold) {
+
+		struct smbd_buffer_descriptor_v1 *v1;
+		bool need_invalidate =
+			io_parms->tcon->ses->server->dialect == SMB30_PROT_ID;
+
+		rdata->mr = smbd_register_mr(
+				server->smbd_conn, rdata->pages,
+				rdata->nr_pages, rdata->tailsz,
+				true, need_invalidate);
+		if (!rdata->mr)
+			return -ENOBUFS;
+
+		req->Channel = SMB2_CHANNEL_RDMA_V1_INVALIDATE;
+		if (need_invalidate)
+			req->Channel = SMB2_CHANNEL_RDMA_V1;
+		req->ReadChannelInfoOffset =
+			offsetof(struct smb2_read_plain_req, Buffer);
+		req->ReadChannelInfoLength =
+			sizeof(struct smbd_buffer_descriptor_v1);
+		v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0];
+		v1->offset = rdata->mr->mr->iova;
+		v1->token = rdata->mr->mr->rkey;
+		v1->length = rdata->mr->mr->length;
+
+		*total_len += sizeof(*v1) - 1;
+	}
+
 	if (request_type & CHAINED_REQUEST) {
 		if (!(request_type & END_OF_CHAIN)) {
 			/* next 8-byte aligned request */
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722751 — [Patch v3 14/19] CIFS: SMBD: Deregister memory on finishing SMB write

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 14/19] CIFS: SMBD: Deregister memory on finishing SMB write
Message-ID<ujUwG-6Me-37@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

On write I/O finish, deregister the memory region if this was for a RDMA read.
If remote invalidation is not used, the call to smbd_deregister_mr will do
local invalidation and possibly wait. Memory region is normally deregistered
in MID callback as soon as it's used. There are situations where the MID may
not be created on I/O failure, under which memory region is deregistered when
write data context is released.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/cifssmb.c |  6 ++++++
 fs/cifs/smb2pdu.c | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index fbb0d4c..6e1de21 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -43,6 +43,7 @@
 #include "cifs_unicode.h"
 #include "cifs_debug.h"
 #include "fscache.h"
+#include "smbdirect.h"
 
 #ifdef CONFIG_CIFS_POSIX
 static struct {
@@ -1905,6 +1906,11 @@ cifs_writedata_release(struct kref *refcount)
 	struct cifs_writedata *wdata = container_of(refcount,
 					struct cifs_writedata, refcount);
 
+	if (wdata->mr) {
+		smbd_deregister_mr(wdata->mr);
+		wdata->mr = NULL;
+	}
+
 	if (wdata->cfile)
 		cifsFileInfo_put(wdata->cfile);
 
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 5581afd..5551053 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2666,6 +2666,18 @@ smb2_writev_callback(struct mid_q_entry *mid)
 		break;
 	}
 
+	/*
+	 * If this wdata has a memory registered, the MR can be freed
+	 * The number of MRs available is limited, it's important to recover
+	 * used MR as soon as I/O is finished. Hold MR longer in the later
+	 * I/O process can possibly result in I/O deadlock due to lack of MR
+	 * to send request on I/O retry
+	 */
+	if (wdata->mr) {
+		smbd_deregister_mr(wdata->mr);
+		wdata->mr = NULL;
+	}
+
 	if (wdata->result)
 		cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1722752 — [Patch v3 08/19] CIFS: SMBD: Set SMBDirect maximum read or write size for I/O

FromLong Li <longli@exchange.microsoft.com>
Date2017-08-29 21:40 +0200
Subject[Patch v3 08/19] CIFS: SMBD: Set SMBDirect maximum read or write size for I/O
Message-ID<ujUwG-6Me-41@gated-at.bofh.it>
In reply to#1722740
From: Long Li <longli@microsoft.com>

When connecting over SMBDirect, the transport negotiates its maximum I/O sizes
with the server and determines how to choose to do RDMA send/recv vs
read/write. Expose these maximum I/O sizes to upper layer so we will get the
correct sized payloads.

Signed-off-by: Long Li <longli@microsoft.com>
---
 fs/cifs/smb2ops.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 06494e1..e67f5f0 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -32,6 +32,7 @@
 #include "smb2status.h"
 #include "smb2glob.h"
 #include "cifs_ioctl.h"
+#include "smbdirect.h"
 
 static int
 change_conf(struct TCP_Server_Info *server)
@@ -249,7 +250,11 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
 
 	/* start with specified wsize, or default */
 	wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;
-	wsize = min_t(unsigned int, wsize, server->max_write);
+	if (server->rdma)
+		wsize = min_t(unsigned int,
+				wsize, server->smbd_conn->max_readwrite_size);
+	else
+		wsize = min_t(unsigned int, wsize, server->max_write);
 
 	if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
 		wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE);
@@ -265,7 +270,11 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
 
 	/* start with specified rsize, or default */
 	rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;
-	rsize = min_t(unsigned int, rsize, server->max_read);
+	if (server->rdma)
+		rsize = min_t(unsigned int,
+				rsize, server->smbd_conn->max_readwrite_size);
+	else
+		rsize = min_t(unsigned int, rsize, server->max_read);
 
 	if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
 		rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web