Skip to content
/ linux Public

Commit e131aac

Browse files
metze-sambaSasha Levin
authored andcommitted
smb: client: correct value for smbd_max_fragmented_recv_size
[ Upstream commit 4a93d1e ] When we download a file without rdma offload or get a large directly enumeration from the server, the server might want to send up to smbd_max_fragmented_recv_size bytes, but if it is too large all our recv buffers might already be moved to the recv_io.reassembly.list and we're no longer able to grant recv credits. The maximum fragmented upper-layer payload receive size supported Assume max_payload_per_credit is smbd_max_receive_size - 24 = 1340 The maximum number would be smbd_receive_credit_max * max_payload_per_credit 1340 * 255 = 341700 (0x536C4) The minimum value from the spec is 131072 (0x20000) For now we use the logic we used in ksmbd before: (1364 * 255) / 2 = 173910 (0x2A756) Fixes: 03bee01 ("CIFS: SMBD: Add SMB Direct protocol initial values and constants") Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0e64bd4 commit e131aac

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

fs/smb/client/smbdirect.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,23 @@ int smbd_send_credit_target = 255;
9191
/* The maximum single message size can be sent to remote peer */
9292
int smbd_max_send_size = 1364;
9393

94-
/* The maximum fragmented upper-layer payload receive size supported */
95-
int smbd_max_fragmented_recv_size = 1024 * 1024;
94+
/*
95+
* The maximum fragmented upper-layer payload receive size supported
96+
*
97+
* Assume max_payload_per_credit is
98+
* smbd_max_receive_size - 24 = 1340
99+
*
100+
* The maximum number would be
101+
* smbd_receive_credit_max * max_payload_per_credit
102+
*
103+
* 1340 * 255 = 341700 (0x536C4)
104+
*
105+
* The minimum value from the spec is 131072 (0x20000)
106+
*
107+
* For now we use the logic we used in ksmbd before:
108+
* (1364 * 255) / 2 = 173910 (0x2A756)
109+
*/
110+
int smbd_max_fragmented_recv_size = (1364 * 255) / 2;
96111

97112
/* The maximum single-message size which can be received */
98113
int smbd_max_receive_size = 1364;

0 commit comments

Comments
 (0)