smb: client: make use of smbdirect_socket.send_io.pending.{count,{dec,zero}_wait_queue}
This will be used by the server too and will allow to create common helper functions. 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>pull/1354/merge
parent
a51c67db2c
commit
ca48841de9
|
|
@ -497,7 +497,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
|
|||
atomic_read(&server->smbd_conn->receive_credits),
|
||||
server->smbd_conn->receive_credit_target);
|
||||
seq_printf(m, "\nPending send_pending: %u ",
|
||||
atomic_read(&server->smbd_conn->send_pending));
|
||||
atomic_read(&sc->send_io.pending.count));
|
||||
seq_printf(m, "\nReceive buffers count_receive_queue: %u ",
|
||||
server->smbd_conn->count_receive_queue);
|
||||
seq_printf(m, "\nMR responder_resources: %u "
|
||||
|
|
|
|||
|
|
@ -418,10 +418,10 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
return;
|
||||
}
|
||||
|
||||
if (atomic_dec_and_test(&info->send_pending))
|
||||
wake_up(&info->wait_send_pending);
|
||||
if (atomic_dec_and_test(&sc->send_io.pending.count))
|
||||
wake_up(&sc->send_io.pending.zero_wait_queue);
|
||||
|
||||
wake_up(&info->wait_post_send);
|
||||
wake_up(&sc->send_io.pending.dec_wait_queue);
|
||||
|
||||
mempool_free(request, sc->send_io.mem.pool);
|
||||
}
|
||||
|
|
@ -908,14 +908,14 @@ static int smbd_post_send_negotiate_req(struct smbd_connection *info)
|
|||
request->sge[0].addr,
|
||||
request->sge[0].length, request->sge[0].lkey);
|
||||
|
||||
atomic_inc(&info->send_pending);
|
||||
atomic_inc(&sc->send_io.pending.count);
|
||||
rc = ib_post_send(sc->ib.qp, &send_wr, NULL);
|
||||
if (!rc)
|
||||
return 0;
|
||||
|
||||
/* if we reach here, post send failed */
|
||||
log_rdma_send(ERR, "ib_post_send failed rc=%d\n", rc);
|
||||
atomic_dec(&info->send_pending);
|
||||
atomic_dec(&sc->send_io.pending.count);
|
||||
ib_dma_unmap_single(sc->ib.dev, request->sge[0].addr,
|
||||
request->sge[0].length, DMA_TO_DEVICE);
|
||||
|
||||
|
|
@ -1038,8 +1038,8 @@ wait_credit:
|
|||
}
|
||||
|
||||
wait_send_queue:
|
||||
wait_event(info->wait_post_send,
|
||||
atomic_read(&info->send_pending) < sp->send_credit_target ||
|
||||
wait_event(sc->send_io.pending.dec_wait_queue,
|
||||
atomic_read(&sc->send_io.pending.count) < sp->send_credit_target ||
|
||||
sc->status != SMBDIRECT_SOCKET_CONNECTED);
|
||||
|
||||
if (sc->status != SMBDIRECT_SOCKET_CONNECTED) {
|
||||
|
|
@ -1048,9 +1048,9 @@ wait_send_queue:
|
|||
goto err_wait_send_queue;
|
||||
}
|
||||
|
||||
if (unlikely(atomic_inc_return(&info->send_pending) >
|
||||
if (unlikely(atomic_inc_return(&sc->send_io.pending.count) >
|
||||
sp->send_credit_target)) {
|
||||
atomic_dec(&info->send_pending);
|
||||
atomic_dec(&sc->send_io.pending.count);
|
||||
goto wait_send_queue;
|
||||
}
|
||||
|
||||
|
|
@ -1157,8 +1157,8 @@ err_dma:
|
|||
atomic_sub(new_credits, &info->receive_credits);
|
||||
|
||||
err_alloc:
|
||||
if (atomic_dec_and_test(&info->send_pending))
|
||||
wake_up(&info->wait_send_pending);
|
||||
if (atomic_dec_and_test(&sc->send_io.pending.count))
|
||||
wake_up(&sc->send_io.pending.zero_wait_queue);
|
||||
|
||||
err_wait_send_queue:
|
||||
/* roll back send credits and pending */
|
||||
|
|
@ -1848,11 +1848,6 @@ static struct smbd_connection *_smbd_get_connection(
|
|||
queue_delayed_work(info->workqueue, &info->idle_timer_work,
|
||||
msecs_to_jiffies(sp->keepalive_interval_msec));
|
||||
|
||||
init_waitqueue_head(&info->wait_send_pending);
|
||||
atomic_set(&info->send_pending, 0);
|
||||
|
||||
init_waitqueue_head(&info->wait_post_send);
|
||||
|
||||
INIT_WORK(&info->post_send_credits_work, smbd_post_send_credits);
|
||||
info->new_credits_offered = 0;
|
||||
spin_lock_init(&info->lock_new_credits_offered);
|
||||
|
|
@ -2151,8 +2146,8 @@ int smbd_send(struct TCP_Server_Info *server,
|
|||
* that means all the I/Os have been out and we are good to return
|
||||
*/
|
||||
|
||||
wait_event(info->wait_send_pending,
|
||||
atomic_read(&info->send_pending) == 0 ||
|
||||
wait_event(sc->send_io.pending.zero_wait_queue,
|
||||
atomic_read(&sc->send_io.pending.count) == 0 ||
|
||||
sc->status != SMBDIRECT_SOCKET_CONNECTED);
|
||||
|
||||
if (sc->status != SMBDIRECT_SOCKET_CONNECTED && rc == 0)
|
||||
|
|
|
|||
|
|
@ -82,11 +82,6 @@ struct smbd_connection {
|
|||
/* Used by transport to wait until all MRs are returned */
|
||||
wait_queue_head_t wait_for_mr_cleanup;
|
||||
|
||||
/* Activity accounting */
|
||||
atomic_t send_pending;
|
||||
wait_queue_head_t wait_send_pending;
|
||||
wait_queue_head_t wait_post_send;
|
||||
|
||||
/* Receive queue */
|
||||
int count_receive_queue;
|
||||
wait_queue_head_t wait_receive_queues;
|
||||
|
|
|
|||
Loading…
Reference in New Issue