Skip to content

Commit 02548c4

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: queue post_recv_credits_work also if the peer raises the credit target
This is already handled in the server, but currently it done in a very complex way there. So we do it much simpler. Note that put_receive_buffer() will take care of it in case data_length is 0. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b0aa92a commit 02548c4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/smb/client/smbdirect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
590590
struct smbdirect_socket_parameters *sp = &sc->parameters;
591591
struct smbd_connection *info =
592592
container_of(sc, struct smbd_connection, socket);
593+
int old_recv_credit_target;
593594
u32 data_offset = 0;
594595
u32 data_length = 0;
595596
u32 remaining_data_length = 0;
@@ -661,6 +662,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
661662
}
662663

663664
atomic_dec(&info->receive_credits);
665+
old_recv_credit_target = info->receive_credit_target;
664666
info->receive_credit_target =
665667
le16_to_cpu(data_transfer->credits_requested);
666668
if (le16_to_cpu(data_transfer->credits_granted)) {
@@ -691,6 +693,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
691693
* reassembly queue and wake up the reading thread
692694
*/
693695
if (data_length) {
696+
if (info->receive_credit_target > old_recv_credit_target)
697+
queue_work(info->workqueue, &info->post_send_credits_work);
698+
694699
enqueue_reassembly(info, response, data_length);
695700
wake_up(&sc->recv_io.reassembly.wait_queue);
696701
} else

0 commit comments

Comments
 (0)