Skip to content

Commit

Permalink
prov/cxi: Move msg otx_reqs inc to after ring
Browse files Browse the repository at this point in the history
Making this change is required for messaging to use the TXC emit
functions. The TXC emit functions already handle otx_reqs.

Signed-off-by: Ian Ziemba <[email protected]>
  • Loading branch information
iziemba committed Jan 23, 2024
1 parent 3d342dd commit 99d4f5c
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions prov/cxi/src/cxip_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -4768,7 +4768,7 @@ static ssize_t _cxip_send_rdzv_put(struct cxip_req *req)
}

cxip_txq_ring(cmdq, !!(req->send.flags & FI_MORE),
ofi_atomic_get32(&req->send.txc->otx_reqs) - 1);
ofi_atomic_get32(&req->send.txc->otx_reqs));
ofi_genlock_unlock(&txc->domain->trig_cmdq_lock);
} else {

Expand All @@ -4781,9 +4781,11 @@ static ssize_t _cxip_send_rdzv_put(struct cxip_req *req)
goto err_enqueue;

cxip_txq_ring(cmdq, !!(req->send.flags & FI_MORE),
ofi_atomic_get32(&req->send.txc->otx_reqs) - 1);
ofi_atomic_get32(&req->send.txc->otx_reqs));
}

ofi_atomic_inc32(&req->send.txc->otx_reqs);

return FI_SUCCESS;

err_enqueue:
Expand Down Expand Up @@ -4984,7 +4986,9 @@ static ssize_t _cxip_send_eager_idc(struct cxip_req *req)
}

cxip_txq_ring(cmdq, !!(req->send.flags & FI_MORE),
ofi_atomic_get32(&req->send.txc->otx_reqs) - 1);
ofi_atomic_get32(&req->send.txc->otx_reqs));

ofi_atomic_inc32(&req->send.txc->otx_reqs);

return FI_SUCCESS;

Expand Down Expand Up @@ -5075,7 +5079,7 @@ static ssize_t _cxip_send_eager(struct cxip_req *req)
goto err_enqueue;
}
cxip_txq_ring(cmdq, !!(req->send.flags & FI_MORE),
ofi_atomic_get32(&req->send.txc->otx_reqs) - 1);
ofi_atomic_get32(&req->send.txc->otx_reqs));
ofi_genlock_unlock(&txc->domain->trig_cmdq_lock);

} else {
Expand All @@ -5088,9 +5092,11 @@ static ssize_t _cxip_send_eager(struct cxip_req *req)
goto err_enqueue;

cxip_txq_ring(cmdq, !!(req->send.flags & FI_MORE),
ofi_atomic_get32(&req->send.txc->otx_reqs) - 1);
ofi_atomic_get32(&req->send.txc->otx_reqs));
}

ofi_atomic_inc32(&req->send.txc->otx_reqs);

return FI_SUCCESS;

err_enqueue:
Expand Down Expand Up @@ -5332,6 +5338,13 @@ int cxip_fc_resume(struct cxip_ep_obj *ep_obj, uint32_t nic_addr, uint32_t pid)

dlist_foreach_container_safe(&peer->msg_queue, struct cxip_req,
req, send.txc_entry, tmp) {

/* Since messaging does not have events disabled, need to return
* a TXC credit for replay. _cxip_send_req() will take the
* credit again.
*/
ofi_atomic_dec32(&txc->otx_reqs);

/* -FI_EAGAIN can be return if the command queue is full. Loop
* until this goes through.
*/
Expand Down Expand Up @@ -5583,7 +5596,7 @@ ssize_t cxip_send_common(struct cxip_txc *txc, uint32_t tclass, const void *buf,
}

/* Restrict outstanding success event requests to queue size */
if (ofi_atomic_inc32(&txc->otx_reqs) > txc->attr.size) {
if (ofi_atomic_get32(&txc->otx_reqs) >= txc->attr.size) {
ret = -FI_EAGAIN;
goto err_req_free;
}
Expand Down Expand Up @@ -5664,7 +5677,6 @@ ssize_t cxip_send_common(struct cxip_txc *txc, uint32_t tclass, const void *buf,
err_req_buf_fini:
cxip_send_buf_fini(req);
err_req_free:
ofi_atomic_dec32(&txc->otx_reqs);
cxip_evtq_req_free(req);
unlock:
ofi_genlock_unlock(&txc->ep_obj->lock);
Expand Down

0 comments on commit 99d4f5c

Please sign in to comment.