Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/uct/ib/mlx5/rc/rc_mlx5.inl
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ uct_rc_mlx5_base_ep_sgl_zcopy_post(uct_rc_mlx5_base_ep_t *ep,
uint16_t op_flags, uct_completion_t *comp)
{
uct_ib_mlx5_txwq_t *txwq = &ep->tx.wq;
const uint16_t first_pi = txwq->sw_pi;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: first_pi and pi are both initialized from the same txwq->sw_pi (pi = txwq->sw_pi; a few lines below), i.e. redundant state that can silently drift. Can we set pi = first_pi there so the two cannot drift apart?

size_t total = 0;
struct mlx5_wqe_ctrl_seg *ctrl = NULL;
uint32_t num_packets = 0;
Expand All @@ -535,7 +536,7 @@ uct_rc_mlx5_base_ep_sgl_zcopy_post(uct_rc_mlx5_base_ep_t *ep,

ucs_assert(count > 0);

pi = txwq->sw_pi;
pi = first_pi;

ucs_assert(!(txwq->flags & UCT_IB_MLX5_TXWQ_FLAG_FAILED));
ucs_assert(ucs_div_round_up(data_wqe_size, MLX5_SEND_WQE_BB) == 1);
Expand Down Expand Up @@ -591,8 +592,13 @@ uct_rc_mlx5_base_ep_sgl_zcopy_post(uct_rc_mlx5_base_ep_t *ep,
uct_ib_mlx5_txwq_ring_doorbell(txwq, ctrl, txwq->sw_pi, 1);
uct_rc_mlx5_txwq_add_psn(txwq, IBV_QPT_RC, num_packets);

/* Keep the send op on the first WQE of the chain, so a failure reported for
* any WQE of the chain completes the operation with the error status, like
* for an operation of a single WQE, but otherwise it is completed by the
* CQE of the last WQE, since only it is signaled, while the others are
* unsignaled. */
uct_rc_txqp_add_send_comp_sgl_always(
&iface->super, &ep->super.txqp, handler, comp, txwq->sig_pi,
&iface->super, &ep->super.txqp, handler, comp, first_pi,
UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY | op_flags, buffers, lengths,
count, total);
return total;
Expand Down
Loading
Loading