Skip to content

Commit 8106978

Browse files
metze-sambasmfrench
authored andcommitted
smb: server: let recv_done() queue a refill when the peer is low on credits
In captures I saw that Windows was granting 191 credits in a batch when its peer posted a lot of messages. We are asking for a credit target of 255 and 191 is 252*3/4. So we also use that logic in order to fill the recv buffers available to the peer. Fixes: a7eef61 ("smb: server: queue post_recv_credits_work in put_recvmsg() and avoid count_avail_recvmsg") Cc: <stable@vger.kernel.org> # 6.18.x Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher <metze@samba.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 26ad87a commit 8106978

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

fs/smb/server/transport_rdma.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
644644
struct smbdirect_data_transfer *data_transfer =
645645
(struct smbdirect_data_transfer *)recvmsg->packet;
646646
u32 remaining_data_length, data_offset, data_length;
647+
int current_recv_credits;
647648
u16 old_recv_credit_target;
648649

649650
if (wc->byte_len <
@@ -682,7 +683,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
682683
}
683684

684685
atomic_dec(&sc->recv_io.posted.count);
685-
atomic_dec(&sc->recv_io.credits.count);
686+
current_recv_credits = atomic_dec_return(&sc->recv_io.credits.count);
686687

687688
old_recv_credit_target = sc->recv_io.credits.target;
688689
sc->recv_io.credits.target =
@@ -702,7 +703,8 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
702703
wake_up(&sc->send_io.credits.wait_queue);
703704

704705
if (data_length) {
705-
if (sc->recv_io.credits.target > old_recv_credit_target)
706+
if (current_recv_credits <= (sc->recv_io.credits.target / 4) ||
707+
sc->recv_io.credits.target > old_recv_credit_target)
706708
queue_work(sc->workqueue, &sc->recv_io.posted.refill_work);
707709

708710
enqueue_reassembly(sc, recvmsg, (int)data_length);

0 commit comments

Comments
 (0)