Commit 11659a8d authored by Hyunchul Lee's avatar Hyunchul Lee Committed by Steve French

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: default avatarHyunchul Lee <hyc.lee@gmail.com>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent ddbdc861
......@@ -157,8 +157,6 @@ struct smb_direct_transport {
mempool_t *recvmsg_mempool;
struct kmem_cache *recvmsg_cache;
wait_queue_head_t wait_send_payload_pending;
atomic_t send_payload_pending;
wait_queue_head_t wait_send_pending;
atomic_t send_pending;
......@@ -386,8 +384,6 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id)
spin_lock_init(&t->empty_recvmsg_queue_lock);
INIT_LIST_HEAD(&t->empty_recvmsg_queue);
init_waitqueue_head(&t->wait_send_payload_pending);
atomic_set(&t->send_payload_pending, 0);
init_waitqueue_head(&t->wait_send_pending);
atomic_set(&t->send_pending, 0);
......@@ -417,8 +413,6 @@ static void free_transport(struct smb_direct_transport *t)
wake_up_interruptible(&t->wait_send_credits);
ksmbd_debug(RDMA, "wait for all send posted to IB to finish\n");
wait_event(t->wait_send_payload_pending,
atomic_read(&t->send_payload_pending) == 0);
wait_event(t->wait_send_pending,
atomic_read(&t->send_pending) == 0);
......@@ -873,13 +867,8 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
smb_direct_disconnect_rdma_connection(t);
}
if (sendmsg->num_sge > 1) {
if (atomic_dec_and_test(&t->send_payload_pending))
wake_up(&t->wait_send_payload_pending);
} else {
if (atomic_dec_and_test(&t->send_pending))
wake_up(&t->wait_send_pending);
}
if (atomic_dec_and_test(&t->send_pending))
wake_up(&t->wait_send_pending);
/* iterate and free the list of messages in reverse. the list's head
* is invalid.
......@@ -911,21 +900,12 @@ static int smb_direct_post_send(struct smb_direct_transport *t,
{
int ret;
if (wr->num_sge > 1)
atomic_inc(&t->send_payload_pending);
else
atomic_inc(&t->send_pending);
atomic_inc(&t->send_pending);
ret = ib_post_send(t->qp, wr, NULL);
if (ret) {
pr_err("failed to post send: %d\n", ret);
if (wr->num_sge > 1) {
if (atomic_dec_and_test(&t->send_payload_pending))
wake_up(&t->wait_send_payload_pending);
} else {
if (atomic_dec_and_test(&t->send_pending))
wake_up(&t->wait_send_pending);
}
if (atomic_dec_and_test(&t->send_pending))
wake_up(&t->wait_send_pending);
smb_direct_disconnect_rdma_connection(t);
}
return ret;
......@@ -1326,8 +1306,8 @@ static int smb_direct_writev(struct ksmbd_transport *t,
* that means all the I/Os have been out and we are good to return
*/
wait_event(st->wait_send_payload_pending,
atomic_read(&st->send_payload_pending) == 0);
wait_event(st->wait_send_pending,
atomic_read(&st->send_pending) == 0);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment