void uct_rc_verbs_iface_common_query(uct_rc_verbs_iface_common_t *verbs_iface, uct_rc_iface_t *iface, uct_iface_attr_t *iface_attr) { /* PUT */ iface_attr->cap.put.max_short = verbs_iface->config.max_inline; iface_attr->cap.put.max_bcopy = iface->super.config.seg_size; iface_attr->cap.put.min_zcopy = 0; iface_attr->cap.put.max_zcopy = uct_ib_iface_port_attr(&iface->super)->max_msg_sz; iface_attr->cap.put.max_iov = uct_ib_iface_get_max_iov(&iface->super); /* GET */ iface_attr->cap.get.max_bcopy = iface->super.config.seg_size; iface_attr->cap.get.min_zcopy = iface->super.config.max_inl_resp + 1; iface_attr->cap.get.max_zcopy = uct_ib_iface_port_attr(&iface->super)->max_msg_sz; iface_attr->cap.get.max_iov = uct_ib_iface_get_max_iov(&iface->super); /* AM */ iface_attr->cap.am.max_short = verbs_iface->config.max_inline - sizeof(uct_rc_hdr_t); iface_attr->cap.am.max_bcopy = iface->super.config.seg_size - sizeof(uct_rc_hdr_t); iface_attr->cap.am.min_zcopy = 0; iface_attr->cap.am.max_zcopy = iface->super.config.seg_size - sizeof(uct_rc_hdr_t); /* The first IOV is reserved for the header */ iface_attr->cap.am.max_iov = uct_ib_iface_get_max_iov(&iface->super) - 1; /* TODO: may need to change for dc/rc */ iface_attr->cap.am.max_hdr = verbs_iface->config.short_desc_size - sizeof(uct_rc_hdr_t); iface_attr->cap.flags |= UCT_IFACE_FLAG_ERRHANDLE_PEER_FAILURE; /* Software overhead */ iface_attr->overhead = 75e-9; }
ucs_status_t uct_rc_verbs_ep_am_zcopy(uct_ep_h tl_ep, uint8_t id, const void *header, unsigned header_length, const uct_iov_t *iov, size_t iovcnt, uct_completion_t *comp) { uct_rc_verbs_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_rc_verbs_iface_t); uct_rc_verbs_ep_t *ep = ucs_derived_of(tl_ep, uct_rc_verbs_ep_t); uct_rc_iface_send_desc_t *desc = NULL; struct ibv_sge sge[UCT_IB_MAX_IOV]; /* First sge is reserved for the header */ struct ibv_send_wr wr; int send_flags; size_t sge_cnt; UCT_CHECK_IOV_SIZE(iovcnt, uct_ib_iface_get_max_iov(&iface->super.super) - 1, "uct_rc_verbs_ep_am_zcopy"); UCT_RC_CHECK_AM_ZCOPY(id, header_length, uct_iov_total_length(iov, iovcnt), iface->verbs_common.config.short_desc_size, iface->super.super.config.seg_size); UCT_RC_CHECK_RES(&iface->super, &ep->super); UCT_RC_CHECK_FC_WND(&iface->super, &ep->super, id); UCT_RC_IFACE_GET_TX_AM_ZCOPY_DESC(&iface->super, &iface->verbs_common.short_desc_mp, desc, id, header, header_length, comp, &send_flags); sge[0].length = sizeof(uct_rc_hdr_t) + header_length; sge_cnt = uct_ib_verbs_sge_fill_iov(sge + 1, iov, iovcnt); UCT_RC_VERBS_FILL_AM_ZCOPY_WR_IOV(wr, sge, (sge_cnt + 1), wr.opcode); UCT_TL_EP_STAT_OP(&ep->super.super, AM, ZCOPY, (header_length + uct_iov_total_length(iov, iovcnt))); uct_rc_verbs_ep_post_send_desc(ep, &wr, desc, send_flags); UCT_RC_UPDATE_FC_WND(&iface->super, &ep->super, id); return UCS_INPROGRESS; }
ucs_status_t uct_rc_verbs_ep_put_zcopy(uct_ep_h tl_ep, const uct_iov_t *iov, size_t iovcnt, uint64_t remote_addr, uct_rkey_t rkey, uct_completion_t *comp) { uct_ib_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_ib_iface_t); uct_rc_verbs_ep_t *ep = ucs_derived_of(tl_ep, uct_rc_verbs_ep_t); ucs_status_t status; UCT_CHECK_IOV_SIZE(iovcnt, uct_ib_iface_get_max_iov(iface), "uct_rc_verbs_ep_put_zcopy"); status = uct_rc_verbs_ep_rdma_zcopy(ep, iov, iovcnt, remote_addr, rkey, comp, IBV_WR_RDMA_WRITE); UCT_TL_EP_STAT_OP_IF_SUCCESS(status, &ep->super.super, PUT, ZCOPY, uct_iov_total_length(iov, iovcnt)); return status; }
ucs_status_t uct_dc_mlx5_ep_get_zcopy(uct_ep_h tl_ep, const uct_iov_t *iov, size_t iovcnt, uint64_t remote_addr, uct_rkey_t rkey, uct_completion_t *comp) { uct_dc_mlx5_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_dc_mlx5_iface_t); uct_dc_mlx5_ep_t *ep = ucs_derived_of(tl_ep, uct_dc_mlx5_ep_t); UCT_CHECK_IOV_SIZE(iovcnt, uct_ib_iface_get_max_iov(&iface->super.super.super), "uct_dc_mlx5_ep_get_zcopy"); UCT_CHECK_LENGTH(uct_iov_total_length(iov, iovcnt), UCT_IB_MAX_MESSAGE_SIZE, "get_zcopy"); UCT_DC_CHECK_RES(&iface->super, &ep->super); uct_dc_mlx5_iface_zcopy_post(iface, ep, MLX5_OPCODE_RDMA_READ, iov, iovcnt, 0, NULL, 0, remote_addr, rkey, comp); UCT_TL_EP_STAT_OP(&ep->super.super, GET, ZCOPY, uct_iov_total_length(iov, iovcnt)); return UCS_INPROGRESS; }
ucs_status_t uct_rc_mlx5_ep_get_zcopy(uct_ep_h tl_ep, const uct_iov_t *iov, size_t iovcnt, uint64_t remote_addr, uct_rkey_t rkey, uct_completion_t *comp) { uct_ib_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_ib_iface_t); uct_rc_mlx5_ep_t *ep = ucs_derived_of(tl_ep, uct_rc_mlx5_ep_t); ucs_status_t status; UCT_CHECK_IOV_SIZE(iovcnt, uct_ib_iface_get_max_iov(iface), "uct_rc_mlx5_ep_get_zcopy"); UCT_CHECK_LENGTH(uct_iov_total_length(iov, iovcnt), UCT_IB_MAX_MESSAGE_SIZE, "get_zcopy"); status = uct_rc_mlx5_ep_zcopy_post(ep, MLX5_OPCODE_RDMA_READ, iov, iovcnt, 0, NULL, 0, remote_addr, rkey, MLX5_WQE_CTRL_CQ_UPDATE, comp); UCT_TL_EP_STAT_OP_IF_SUCCESS(status, &ep->super.super, GET, ZCOPY, uct_iov_total_length(iov, iovcnt)); return status; }