Skip to content

Commit 09902f8

Browse files
longlimsftsmfrench
authored andcommitted
CIFS: SMBD: Set SMB Direct maximum read or write size for I/O
When connecting over SMB Direct, 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 <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]>
1 parent bce9ce7 commit 09902f8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fs/cifs/smb2ops.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "smb2status.h"
3333
#include "smb2glob.h"
3434
#include "cifs_ioctl.h"
35+
#include "smbdirect.h"
3536

3637
static int
3738
change_conf(struct TCP_Server_Info *server)
@@ -250,7 +251,11 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
250251
/* start with specified wsize, or default */
251252
wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;
252253
wsize = min_t(unsigned int, wsize, server->max_write);
253-
254+
#ifdef CONFIG_CIFS_SMB_DIRECT
255+
if (server->rdma)
256+
wsize = min_t(unsigned int,
257+
wsize, server->smbd_conn->max_readwrite_size);
258+
#endif
254259
if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
255260
wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE);
256261

@@ -266,6 +271,11 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
266271
/* start with specified rsize, or default */
267272
rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;
268273
rsize = min_t(unsigned int, rsize, server->max_read);
274+
#ifdef CONFIG_CIFS_SMB_DIRECT
275+
if (server->rdma)
276+
rsize = min_t(unsigned int,
277+
rsize, server->smbd_conn->max_readwrite_size);
278+
#endif
269279

270280
if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
271281
rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);

0 commit comments

Comments
 (0)