CIFS: SMBD: Implement function to create a SMB Direct connection
authorLong Li <longli@microsoft.com>
Sat, 18 Nov 2017 01:26:52 +0000 (17:26 -0800)
committerSteve French <smfrench@gmail.com>
Thu, 25 Jan 2018 01:49:05 +0000 (19:49 -0600)
The upper layer calls this function to connect to peer through SMB Direct.
Each SMB Direct connection is based on a RDMA RC Queue Pair.

Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
fs/cifs/smbdirect.c
fs/cifs/smbdirect.h

index 2ecd5c19d313bce812c4bc6766574441607febc4..862cdf9424cbcf66ffd0441cecca6e150a586d7d 100644 (file)
@@ -1646,3 +1646,20 @@ create_id_failed:
        kfree(info);
        return NULL;
 }
+
+struct smbd_connection *smbd_get_connection(
+       struct TCP_Server_Info *server, struct sockaddr *dstaddr)
+{
+       struct smbd_connection *ret;
+       int port = SMBD_PORT;
+
+try_again:
+       ret = _smbd_get_connection(server, dstaddr, port);
+
+       /* Try SMB_PORT if SMBD_PORT doesn't work */
+       if (!ret && port == SMBD_PORT) {
+               port = SMB_PORT;
+               goto try_again;
+       }
+       return ret;
+}
index e4e65d3c6de89ef83499eb85ebbc340b26c369a0..25b3782cc6928f08a019b79334eeebb056a0e2b9 100644 (file)
@@ -243,9 +243,15 @@ struct smbd_response {
        u8 packet[];
 };
 
+/* Create a SMBDirect session */
+struct smbd_connection *smbd_get_connection(
+       struct TCP_Server_Info *server, struct sockaddr *dstaddr);
+
 #else
 #define cifs_rdma_enabled(server)      0
 struct smbd_connection {};
+static inline void *smbd_get_connection(
+       struct TCP_Server_Info *server, struct sockaddr *dstaddr) {return NULL;}
 #endif
 
 #endif