ucs_status_t uct_ib_mlx5dv_init_obj(uct_ib_mlx5dv_t *obj, uint64_t obj_type) { ucs_status_t ret = UCS_OK; if (obj_type & MLX5DV_OBJ_QP) { ret = uct_ib_mlx5_get_qp_info(obj->dv.qp.in, ucs_container_of(obj->dv.qp.out, uct_ib_mlx5dv_qp_t, dv)); } if (!ret && (obj_type & MLX5DV_OBJ_CQ)) { ret = uct_ib_mlx5_get_cq(obj->dv.cq.in, ucs_container_of(obj->dv.cq.out, uct_ib_mlx5dv_cq_t, dv)); } if (!ret && (obj_type & MLX5DV_OBJ_SRQ)) { ret = uct_ib_mlx5_get_srq_info(obj->dv.srq.in, ucs_container_of(obj->dv.srq.out, uct_ib_mlx5dv_srq_t, dv)); } return ret; }
static UCS_CLASS_INIT_FUNC(uct_rc_mlx5_ep_t, uct_iface_h tl_iface) { uct_rc_mlx5_iface_t *iface = ucs_derived_of(tl_iface, uct_rc_mlx5_iface_t); uct_ib_mlx5_qp_info_t qp_info; ucs_status_t status; UCS_CLASS_CALL_SUPER_INIT(uct_rc_ep_t, &iface->super); status = uct_ib_mlx5_get_qp_info(self->super.qp, &qp_info); if (status != UCS_OK) { ucs_error("Failed to get mlx5 QP information"); return status; } if ((qp_info.bf.size == 0) || !ucs_is_pow2(qp_info.bf.size) || (qp_info.sq.stride != MLX5_SEND_WQE_BB) || !ucs_is_pow2(qp_info.sq.wqe_cnt)) { ucs_error("mlx5 device parameters not suitable for transport"); return UCS_ERR_IO_ERROR; } self->qp_num = self->super.qp->qp_num; self->tx.qstart = qp_info.sq.buf; self->tx.qend = qp_info.sq.buf + (MLX5_SEND_WQE_BB * qp_info.sq.wqe_cnt); self->tx.seg = self->tx.qstart; self->tx.sw_pi = 0; self->tx.prev_sw_pi = -1; self->tx.max_pi = uct_rc_mlx5_calc_max_pi(iface, self->tx.prev_sw_pi); self->tx.bf_reg = qp_info.bf.reg; self->tx.bf_size = qp_info.bf.size; self->tx.dbrec = &qp_info.dbrec[MLX5_SND_DBR]; memset(self->tx.qstart, 0, self->tx.qend - self->tx.qstart); return UCS_OK; }