Skip to content

Commit

Permalink
[v1.21.x] prov/verbs: Flush CQ for SQ on no SQ credit
Browse files Browse the repository at this point in the history
This fixes issue 10150.

On post send, when we are out of SQ credit, attempt to
gain SQ credit by polling CQ for SQ.

Also corrected check on peer_rq_credits.  If post send
operation would consume RX buffer on the peer, make
sure there is enough credit.  Reserve the last one for
the credit message.

Signed-off-by: Chien Tin Tung <[email protected]>
(cherry picked from commit 42866c4)
  • Loading branch information
Chien Tin Tung authored and j-xiong committed Jul 16, 2024
1 parent 9a9dc7d commit ce2690e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions prov/verbs/src/verbs_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,21 @@ ssize_t vrb_post_send(struct vrb_ep *ep, struct ibv_send_wr *wr, uint64_t flags)
goto unlock;
}

if (!ep->sq_credits || !ep->peer_rq_credits) {
cq = container_of(ep->util_ep.rx_cq, struct vrb_cq, util_cq);
if (!ep->sq_credits) {
cq = container_of(ep->util_ep.tx_cq, struct vrb_cq, util_cq);
vrb_flush_cq(cq);

if (!ep->sq_credits || !ep->peer_rq_credits)
if (!ep->sq_credits)
goto freectx;
}

if (vrb_wr_consumes_recv(wr) && !--ep->peer_rq_credits &&
!(flags & OFI_PRIORITY)) {
if (vrb_wr_consumes_recv(wr)) {
if (!ep->peer_rq_credits ||
(ep->peer_rq_credits == 1 && !(flags & OFI_PRIORITY)))
/* Last credit is reserved for credit update */
ep->peer_rq_credits++;
goto freectx;
goto freectx;

ep->peer_rq_credits--;
}

ep->sq_credits--;
Expand Down

0 comments on commit ce2690e

Please sign in to comment.