summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
072a14e)
Sometimes the remote peer may return more send credits than the send queue
depth. If all the send credits are used to post senasd, we may overflow the
send queue.
Fix this by checking the send queue size before posting a send.
Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
if (atomic_dec_and_test(&request->info->send_pending))
wake_up(&request->info->wait_send_pending);
if (atomic_dec_and_test(&request->info->send_pending))
wake_up(&request->info->wait_send_pending);
+ wake_up(&request->info->wait_post_send);
mempool_free(request, request->info->request_mempool);
}
mempool_free(request, request->info->request_mempool);
}
send_wr.opcode = IB_WR_SEND;
send_wr.send_flags = IB_SEND_SIGNALED;
send_wr.opcode = IB_WR_SEND;
send_wr.send_flags = IB_SEND_SIGNALED;
- atomic_inc(&info->send_pending);
+wait_sq:
+ wait_event(info->wait_post_send,
+ atomic_read(&info->send_pending) < info->send_credit_target);
+ if (unlikely(atomic_inc_return(&info->send_pending) >
+ info->send_credit_target)) {
+ atomic_dec(&info->send_pending);
+ goto wait_sq;
+ }
rc = ib_post_send(info->id->qp, &send_wr, NULL);
if (rc) {
rc = ib_post_send(info->id->qp, &send_wr, NULL);
if (rc) {
init_waitqueue_head(&info->wait_send_pending);
atomic_set(&info->send_pending, 0);
init_waitqueue_head(&info->wait_send_pending);
atomic_set(&info->send_pending, 0);
+ init_waitqueue_head(&info->wait_post_send);
INIT_WORK(&info->disconnect_work, smbd_disconnect_rdma_work);
INIT_WORK(&info->post_send_credits_work, smbd_post_send_credits);
INIT_WORK(&info->disconnect_work, smbd_disconnect_rdma_work);
INIT_WORK(&info->post_send_credits_work, smbd_post_send_credits);
/* Activity accoutning */
atomic_t send_pending;
wait_queue_head_t wait_send_pending;
/* Activity accoutning */
atomic_t send_pending;
wait_queue_head_t wait_send_pending;
+ wait_queue_head_t wait_post_send;
/* Receive queue */
struct list_head receive_queue;
/* Receive queue */
struct list_head receive_queue;