ksmbd: smbd: relax the count of sges required
Subsystems (2)
PATCH 1/1 ksmbd: smbd: relax the count of sges required
Remove the condition that the count of sges
must be greater than or equal toSMB_DIRECT_MAX_SEND_SGES(8).
Because ksmbd needs sges only for SMB direct
header, SMB2 transform header, SMB2 response,
and optional payload.
--- fs/ksmbd/transport_rdma.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
fs/ksmbd/transport_rdma.c +5 -8
@@ -1709,11 +1709,11 @@ static int smb_direct_init_params(struct smb_direct_transport *t,int max_send_sges, max_rw_wrs, max_send_wrs;unsigned int max_sge_per_wr, wrs_per_credit; -/* need 2 more sge. because a SMB_DIRECT header will be mapped, -* and maybe a send buffer could be not page aligned. +/* need 3 more sge. because a SMB_DIRECT header, SMB2 header, +* SMB2 response could be mapped. */ t->max_send_size = smb_direct_max_send_size; - max_send_sges =DIV_ROUND_UP (t->max_send_size,PAGE_SIZE ) +2 ; + max_send_sges =DIV_ROUND_UP (t->max_send_size,PAGE_SIZE ) +3 ;if (max_send_sges >SMB_DIRECT_MAX_SEND_SGES ) {pr_err ("max_send_size %d is too large\n" , t->max_send_size);return -EINVAL ;
@@ -1734,6 +1734,8 @@ static int smb_direct_init_params(struct smb_direct_transport *t, max_sge_per_wr = min_t(unsigned int, device->attrs.max_send_sge, device->attrs.max_sge_rd); + max_sge_per_wr = max_t(unsigned int, max_sge_per_wr, + max_send_sges); wrs_per_credit = max_t(unsigned int, 4,DIV_ROUND_UP (t->pages_per_rw_credit, max_sge_per_wr) +1 );
@@ -1758,11 +1760,6 @@ static int smb_direct_init_params(struct smb_direct_transport *t,return -EINVAL ; } -if (device->attrs.max_send_sge <SMB_DIRECT_MAX_SEND_SGES ) { -pr_err ("warning: device max_send_sge = %d too small\n" , - device->attrs.max_send_sge); -return -EINVAL ; - }if (device->attrs.max_recv_sge <SMB_DIRECT_MAX_RECV_SGES ) {pr_err ("warning: device max_recv_sge = %d too small\n" , device->attrs.max_recv_sge);
Signature · 1 line
2.17.1
2022-05-27 8:50 GMT+09:00, Hyunchul Lee <[email protected]>:
Quoted 8 lines
Remove the condition that the count of sges
must be greater than or equal toSMB_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 <[email protected]>
Thanks!
Solid. Maybe add some slack space to pull up the header buffers and get the count down to 3 later :)
May 27, 2022 6:47:49 PM Namjae Jeon <[email protected]>:
Quoted 12 lines
2022-05-27 8:50 GMT+09:00, Hyunchul Lee <[email protected]>:
Quoted 8 lines
Remove the condition that the count of sges
must be greater than or equal toSMB_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 <[email protected]>Acked-by Namjae Jeon <[email protected]>Thanks!