[v6,17/22] CIFS: SMBD: Upper layer sends data via RDMA send

Message ID 20171105054404.23886-18-longli@exchange.microsoft.com
State New
Headers show
Series
  • CIFS: Implement SMB Direct protocol
Related show

Commit Message

Long Li Nov. 5, 2017, 5:43 a.m.
From: Long Li <longli@microsoft.com>

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

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

Patch

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 7efbab0..1b51d08 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -37,6 +37,9 @@ 
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
+#ifdef CONFIG_CIFS_SMB_DIRECT
+#include "smbdirect.h"
+#endif
 
 void
 cifs_wake_up_task(struct mid_q_entry *mid)
@@ -229,7 +232,12 @@  __smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
 	struct socket *ssocket = server->ssocket;
 	struct msghdr smb_msg;
 	int val = 1;
-
+#ifdef CONFIG_CIFS_SMB_DIRECT
+	if (server->smbd_conn) {
+		rc = smbd_send(server->smbd_conn, rqst);
+		goto smbd_done;
+	}
+#endif
 	if (ssocket == NULL)
 		return -ENOTSOCK;
 
@@ -298,7 +306,9 @@  __smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
 		 */
 		server->tcpStatus = CifsNeedReconnect;
 	}
-
+#ifdef CONFIG_CIFS_SMB_DIRECT
+smbd_done:
+#endif
 	if (rc < 0 && rc != -EINTR)
 		cifs_dbg(VFS, "Error %d sending data on socket to server\n",
 			 rc);