Skip to content

Commit 399f953

Browse files
longlimsftsmfrench
authored andcommitted
CIFS: SMBD: Implement function to create a SMB Direct connection
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 <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent f198186 commit 399f953

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

fs/cifs/smbdirect.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,3 +1646,20 @@ struct smbd_connection *_smbd_get_connection(
16461646
kfree(info);
16471647
return NULL;
16481648
}
1649+
1650+
struct smbd_connection *smbd_get_connection(
1651+
struct TCP_Server_Info *server, struct sockaddr *dstaddr)
1652+
{
1653+
struct smbd_connection *ret;
1654+
int port = SMBD_PORT;
1655+
1656+
try_again:
1657+
ret = _smbd_get_connection(server, dstaddr, port);
1658+
1659+
/* Try SMB_PORT if SMBD_PORT doesn't work */
1660+
if (!ret && port == SMBD_PORT) {
1661+
port = SMB_PORT;
1662+
goto try_again;
1663+
}
1664+
return ret;
1665+
}

fs/cifs/smbdirect.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,15 @@ struct smbd_response {
243243
u8 packet[];
244244
};
245245

246+
/* Create a SMBDirect session */
247+
struct smbd_connection *smbd_get_connection(
248+
struct TCP_Server_Info *server, struct sockaddr *dstaddr);
249+
246250
#else
247251
#define cifs_rdma_enabled(server) 0
248252
struct smbd_connection {};
253+
static inline void *smbd_get_connection(
254+
struct TCP_Server_Info *server, struct sockaddr *dstaddr) {return NULL;}
249255
#endif
250256

251257
#endif

0 commit comments

Comments
 (0)