Skip to content

Commit 621433b

Browse files
hcleeSteve French
authored andcommitted
ksmbd: smbd: relax the count of sges required
Remove the condition that the count of sges must be greater than or equal to SMB_DIRECT_MAX_SEND_SGES(8). Because ksmbd needs sges only for SMB direct header, SMB2 transform header, SMB2 response, and optional payload. Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Reviewed-by: Tom Talpey <tom@talpey.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 376b913 commit 621433b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

fs/ksmbd/transport_rdma.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,11 +1711,11 @@ static int smb_direct_init_params(struct smb_direct_transport *t,
17111711
int max_send_sges, max_rw_wrs, max_send_wrs;
17121712
unsigned int max_sge_per_wr, wrs_per_credit;
17131713

1714-
/* need 2 more sge. because a SMB_DIRECT header will be mapped,
1715-
* and maybe a send buffer could be not page aligned.
1714+
/* need 3 more sge. because a SMB_DIRECT header, SMB2 header,
1715+
* SMB2 response could be mapped.
17161716
*/
17171717
t->max_send_size = smb_direct_max_send_size;
1718-
max_send_sges = DIV_ROUND_UP(t->max_send_size, PAGE_SIZE) + 2;
1718+
max_send_sges = DIV_ROUND_UP(t->max_send_size, PAGE_SIZE) + 3;
17191719
if (max_send_sges > SMB_DIRECT_MAX_SEND_SGES) {
17201720
pr_err("max_send_size %d is too large\n", t->max_send_size);
17211721
return -EINVAL;
@@ -1736,6 +1736,8 @@ static int smb_direct_init_params(struct smb_direct_transport *t,
17361736

17371737
max_sge_per_wr = min_t(unsigned int, device->attrs.max_send_sge,
17381738
device->attrs.max_sge_rd);
1739+
max_sge_per_wr = max_t(unsigned int, max_sge_per_wr,
1740+
max_send_sges);
17391741
wrs_per_credit = max_t(unsigned int, 4,
17401742
DIV_ROUND_UP(t->pages_per_rw_credit,
17411743
max_sge_per_wr) + 1);
@@ -1760,11 +1762,6 @@ static int smb_direct_init_params(struct smb_direct_transport *t,
17601762
return -EINVAL;
17611763
}
17621764

1763-
if (device->attrs.max_send_sge < SMB_DIRECT_MAX_SEND_SGES) {
1764-
pr_err("warning: device max_send_sge = %d too small\n",
1765-
device->attrs.max_send_sge);
1766-
return -EINVAL;
1767-
}
17681765
if (device->attrs.max_recv_sge < SMB_DIRECT_MAX_RECV_SGES) {
17691766
pr_err("warning: device max_recv_sge = %d too small\n",
17701767
device->attrs.max_recv_sge);

0 commit comments

Comments
 (0)