From 96a369bfa872801e645c9d623085383f7b48d2ae Mon Sep 17 00:00:00 2001 From: Zihao Zhao Date: Thu, 3 Sep 2026 20:48:37 +0800 Subject: [PATCH 1/2] UCT/IB/MLX5/RC: Fix put_sgl_zcopy completion Associate the completion with the last WQE in an SGL PUT so partial recovery cannot complete the operation prematurely. Remove the unrelated RDMA read resource check from the PUT path. --- src/uct/ib/mlx5/rc/rc_mlx5_ep.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/uct/ib/mlx5/rc/rc_mlx5_ep.c b/src/uct/ib/mlx5/rc/rc_mlx5_ep.c index 5953a56d7f6..4927e907867 100644 --- a/src/uct/ib/mlx5/rc/rc_mlx5_ep.c +++ b/src/uct/ib/mlx5/rc/rc_mlx5_ep.c @@ -248,7 +248,7 @@ uct_rc_mlx5_base_ep_put_sgl_zcopy(uct_ep_h tl_ep, void * const *buffers, struct mlx5_wqe_data_seg *dptr; size_t wqe_size, i; uint8_t fm_ce_se, fence_flag; - uint16_t sn, pi, res_count; + uint16_t pi, res_count; uint64_t addr; uct_rkey_t rkey; void *curr; @@ -278,17 +278,15 @@ uct_rc_mlx5_base_ep_put_sgl_zcopy(uct_ep_h tl_ep, void * const *buffers, UCT_RC_CHECK_CQE_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, count - 1); - UCT_RC_CHECK_NUM_RDMA_READ_RET(&iface->super, UCS_ERR_NO_RESOURCE); UCT_RC_CHECK_TXQP_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, count - 1); wqe_size = sizeof(*ctrl) + sizeof(*raddr) + sizeof(*dptr); - sn = txwq->sw_pi; + pi = txwq->sw_pi; ucs_assert(!(txwq->flags & UCT_IB_MLX5_TXWQ_FLAG_FAILED)); ucs_assert(ucs_div_round_up(wqe_size, MLX5_SEND_WQE_BB) == 1); - pi = sn; curr = txwq->curr; fence = uct_rc_ep_fm(&iface->super, &txwq->fi, 1); @@ -335,8 +333,9 @@ uct_rc_mlx5_base_ep_put_sgl_zcopy(uct_ep_h tl_ep, void * const *buffers, uct_rc_mlx5_txwq_add_psn(txwq, IBV_QPT_RC, num_packets); uct_rc_txqp_add_send_comp(&iface->super, &ep->super.txqp, - uct_rc_ep_send_op_completion_handler, comp, sn, - UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY, NULL, 0, total); + uct_rc_ep_send_op_completion_handler, comp, + txwq->sig_pi, UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY, + NULL, 0, total); UCT_TL_EP_STAT_OP(&ep->super.super, PUT, ZCOPY, total); uct_rc_ep_enable_flush_remote(&ep->super); From cec4aa2378fa9eabffcc78bbc72bd4f8cace9a8b Mon Sep 17 00:00:00 2001 From: Zihao Zhao Date: Fri, 4 Sep 2026 06:17:33 +0300 Subject: [PATCH 2/2] UCT/IB/MLX5: address comments --- src/uct/ib/mlx5/rc/rc_mlx5_ep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uct/ib/mlx5/rc/rc_mlx5_ep.c b/src/uct/ib/mlx5/rc/rc_mlx5_ep.c index 4927e907867..0a75091829e 100644 --- a/src/uct/ib/mlx5/rc/rc_mlx5_ep.c +++ b/src/uct/ib/mlx5/rc/rc_mlx5_ep.c @@ -278,6 +278,7 @@ uct_rc_mlx5_base_ep_put_sgl_zcopy(uct_ep_h tl_ep, void * const *buffers, UCT_RC_CHECK_CQE_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, count - 1); + UCT_RC_CHECK_NUM_RDMA_READ_RET(&iface->super, UCS_ERR_NO_RESOURCE); UCT_RC_CHECK_TXQP_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, count - 1);