Skip to content

Commit 2f89464

Browse files
longlimsftsmfrench
authored andcommitted
CIFS: SMBD: Upper layer connects to SMBDirect session
When "rdma" is specified in the mount option, make CIFS connect to SMB Direct. Signed-off-by: Long Li <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]>
1 parent 0933d6f commit 2f89464

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

fs/cifs/connect.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include <net/ipv6.h>
4545
#include <linux/parser.h>
4646
#include <linux/bvec.h>
47-
4847
#include "cifspdu.h"
4948
#include "cifsglob.h"
5049
#include "cifsproto.h"
@@ -56,6 +55,7 @@
5655
#include "rfc1002pdu.h"
5756
#include "fscache.h"
5857
#include "smb2proto.h"
58+
#include "smbdirect.h"
5959

6060
#define CIFS_PORT 445
6161
#define RFC1001_PORT 139
@@ -2310,13 +2310,29 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
23102310
tcp_ses->echo_interval = volume_info->echo_interval * HZ;
23112311
else
23122312
tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT * HZ;
2313-
2313+
if (tcp_ses->rdma) {
2314+
#ifndef CONFIG_CIFS_SMB_DIRECT
2315+
cifs_dbg(VFS, "CONFIG_CIFS_SMB_DIRECT is not enabled\n");
2316+
rc = -ENOENT;
2317+
goto out_err_crypto_release;
2318+
#endif
2319+
tcp_ses->smbd_conn = smbd_get_connection(
2320+
tcp_ses, (struct sockaddr *)&volume_info->dstaddr);
2321+
if (tcp_ses->smbd_conn) {
2322+
cifs_dbg(VFS, "RDMA transport established\n");
2323+
rc = 0;
2324+
goto smbd_connected;
2325+
} else {
2326+
rc = -ENOENT;
2327+
goto out_err_crypto_release;
2328+
}
2329+
}
23142330
rc = ip_connect(tcp_ses);
23152331
if (rc < 0) {
23162332
cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n");
23172333
goto out_err_crypto_release;
23182334
}
2319-
2335+
smbd_connected:
23202336
/*
23212337
* since we're in a cifs function already, we know that
23222338
* this will succeed. No need for try_module_get().

0 commit comments

Comments
 (0)