Skip to content

Commit 11659a8

Browse files
hcleesmfrench
authored andcommitted
ksmbd: smbd: simplify tracking pending packets
Because we don't have to tracking pending packets by dividing these into packets with payload and packets without payload, merge the tracking code. Signed-off-by: Hyunchul Lee <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent ddbdc86 commit 11659a8

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

fs/ksmbd/transport_rdma.c

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ struct smb_direct_transport {
157157
mempool_t *recvmsg_mempool;
158158
struct kmem_cache *recvmsg_cache;
159159

160-
wait_queue_head_t wait_send_payload_pending;
161-
atomic_t send_payload_pending;
162160
wait_queue_head_t wait_send_pending;
163161
atomic_t send_pending;
164162

@@ -386,8 +384,6 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id)
386384
spin_lock_init(&t->empty_recvmsg_queue_lock);
387385
INIT_LIST_HEAD(&t->empty_recvmsg_queue);
388386

389-
init_waitqueue_head(&t->wait_send_payload_pending);
390-
atomic_set(&t->send_payload_pending, 0);
391387
init_waitqueue_head(&t->wait_send_pending);
392388
atomic_set(&t->send_pending, 0);
393389

@@ -417,8 +413,6 @@ static void free_transport(struct smb_direct_transport *t)
417413
wake_up_interruptible(&t->wait_send_credits);
418414

419415
ksmbd_debug(RDMA, "wait for all send posted to IB to finish\n");
420-
wait_event(t->wait_send_payload_pending,
421-
atomic_read(&t->send_payload_pending) == 0);
422416
wait_event(t->wait_send_pending,
423417
atomic_read(&t->send_pending) == 0);
424418

@@ -873,13 +867,8 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
873867
smb_direct_disconnect_rdma_connection(t);
874868
}
875869

876-
if (sendmsg->num_sge > 1) {
877-
if (atomic_dec_and_test(&t->send_payload_pending))
878-
wake_up(&t->wait_send_payload_pending);
879-
} else {
880-
if (atomic_dec_and_test(&t->send_pending))
881-
wake_up(&t->wait_send_pending);
882-
}
870+
if (atomic_dec_and_test(&t->send_pending))
871+
wake_up(&t->wait_send_pending);
883872

884873
/* iterate and free the list of messages in reverse. the list's head
885874
* is invalid.
@@ -911,21 +900,12 @@ static int smb_direct_post_send(struct smb_direct_transport *t,
911900
{
912901
int ret;
913902

914-
if (wr->num_sge > 1)
915-
atomic_inc(&t->send_payload_pending);
916-
else
917-
atomic_inc(&t->send_pending);
918-
903+
atomic_inc(&t->send_pending);
919904
ret = ib_post_send(t->qp, wr, NULL);
920905
if (ret) {
921906
pr_err("failed to post send: %d\n", ret);
922-
if (wr->num_sge > 1) {
923-
if (atomic_dec_and_test(&t->send_payload_pending))
924-
wake_up(&t->wait_send_payload_pending);
925-
} else {
926-
if (atomic_dec_and_test(&t->send_pending))
927-
wake_up(&t->wait_send_pending);
928-
}
907+
if (atomic_dec_and_test(&t->send_pending))
908+
wake_up(&t->wait_send_pending);
929909
smb_direct_disconnect_rdma_connection(t);
930910
}
931911
return ret;
@@ -1326,8 +1306,8 @@ static int smb_direct_writev(struct ksmbd_transport *t,
13261306
* that means all the I/Os have been out and we are good to return
13271307
*/
13281308

1329-
wait_event(st->wait_send_payload_pending,
1330-
atomic_read(&st->send_payload_pending) == 0);
1309+
wait_event(st->wait_send_pending,
1310+
atomic_read(&st->send_pending) == 0);
13311311
return ret;
13321312
}
13331313

0 commit comments

Comments
 (0)