Skip to content

Commit

Permalink
prov/cxi: Define cmdq idc msg wrapper func
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Ziemba <ian.ziemba@hpe.com>
  • Loading branch information
iziemba committed Jan 23, 2024
1 parent 68f8bca commit 1d3c7ac
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prov/cxi/include/cxip.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,10 @@ int cxip_cmdq_emic_idc_amo(struct cxip_cmdq *cmdq,
bool fetching, bool flush);
int cxip_cmdq_emit_dma_amo(struct cxip_cmdq *cmdq, struct c_dma_amo_cmd *amo,
uint64_t flags, bool fetching, bool flush);
int cxip_cmdq_emit_idc_msg(struct cxip_cmdq *cmdq,
const struct c_cstate_cmd *c_state,
const struct c_idc_msg_hdr *msg, const void *buf,
size_t len, uint64_t flags);

/* OFI Provider Structures */

Expand Down
33 changes: 33 additions & 0 deletions prov/cxi/src/cxip_cmdq.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,36 @@ int cxip_cmdq_emit_dma_amo(struct cxip_cmdq *cmdq, struct c_dma_amo_cmd *amo,

return FI_SUCCESS;
}

int cxip_cmdq_emit_idc_msg(struct cxip_cmdq *cmdq,
const struct c_cstate_cmd *c_state,
const struct c_idc_msg_hdr *msg, const void *buf,
size_t len, uint64_t flags)
{
int ret;

if (flags & (FI_FENCE | FI_CXI_WEAK_FENCE)) {
ret = cxi_cq_emit_cq_cmd(cmdq->dev_cmdq, C_CMD_CQ_FENCE);
if (ret) {
CXIP_WARN("Failed to issue fence command: %d:%s\n", ret,
fi_strerror(-ret));
return -FI_EAGAIN;
}
}

ret = cxip_cmdq_emit_c_state(cmdq, c_state);
if (ret) {
CXIP_WARN("Failed to emit c_state command: %d:%s\n", ret,
fi_strerror(-ret));
return ret;
}

ret = cxi_cq_emit_idc_msg(cmdq->dev_cmdq, msg, buf, len);
if (ret) {
CXIP_WARN("Failed to emit idc_msg command: %d:%s\n", ret,
fi_strerror(-ret));
return -FI_EAGAIN;
}

return FI_SUCCESS;
}

0 comments on commit 1d3c7ac

Please sign in to comment.