Skip to content

Commit

Permalink
prov/cxi: Define additional cmdq helper functions
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 24, 2024
1 parent 55d2712 commit 198e5f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions prov/cxi/include/cxip.h
Original file line number Diff line number Diff line change
Expand Up @@ -2772,6 +2772,19 @@ void cxip_cmdq_free(struct cxip_cmdq *cmdq);
int cxip_cmdq_emit_c_state(struct cxip_cmdq *cmdq,
const struct c_cstate_cmd *cmd);

static inline bool cxip_cmdq_empty(struct cxip_cmdq *cmdq)
{
return cxi_cq_empty(cmdq->dev_cmdq);
}

static inline bool cxip_cmdq_match(struct cxip_cmdq *cmdq, uint16_t vni,
enum cxi_traffic_class tc,
enum cxi_traffic_class_type tc_type)
{
return (cmdq->cur_cp->vni == vni) && (cmdq->cur_cp->tc == tc) &&
(cmdq->cur_cp->tc_type == tc_type);
}

int cxip_evtq_init(struct cxip_evtq *evtq, struct cxip_cq *cq,
size_t num_events, size_t num_fc_events);
void cxip_evtq_fini(struct cxip_evtq *eq);
Expand Down
3 changes: 1 addition & 2 deletions prov/cxi/src/cxip_cmdq.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ int cxip_cmdq_cp_set(struct cxip_cmdq *cmdq, uint16_t vni,
struct cxi_cp *cp;
int ret;

if (cmdq->cur_cp->vni == vni && cmdq->cur_cp->tc == tc &&
cmdq->cur_cp->tc_type == tc_type)
if (cxip_cmdq_match(cmdq, vni, tc, tc_type))
return FI_SUCCESS;

ret = cxip_cp_get(cmdq->lni, vni, tc, tc_type, &cp);
Expand Down

0 comments on commit 198e5f3

Please sign in to comment.