Skip to content

Commit

Permalink
prov/cxi: cxi EQ do not support wait objects
Browse files Browse the repository at this point in the history
Make sure wait objects are not allowed for cxi EQs.

NETCASSINI-6964

Signed-off-by: Steve Welch <welch@hpe.com>
  • Loading branch information
swelch committed Jan 8, 2025
1 parent c8c36e4 commit c7ba8da
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
12 changes: 11 additions & 1 deletion prov/cxi/src/cxip_eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include "cxip.h"

#define CXIP_WARN(...) _CXIP_WARN(FI_LOG_EQ, __VA_ARGS__)

static int cxip_eq_close(struct fid *fid)
{
struct cxip_eq *cxi_eq;
Expand Down Expand Up @@ -104,7 +106,7 @@ static struct fi_ops cxi_eq_fi_ops = {
static struct fi_eq_attr cxip_eq_def_attr = {
.size = CXIP_EQ_DEF_SZ,
.flags = 0,
.wait_obj = FI_WAIT_FD,
.wait_obj = FI_WAIT_NONE,
.signaling_vector = 0,
.wait_set = NULL
};
Expand All @@ -124,6 +126,14 @@ int cxip_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
else
cxi_eq->attr = *attr;

if (cxi_eq->attr.wait_obj != FI_WAIT_NONE) {
CXIP_WARN("Unsupported EQ attribute wait obj %d\n",
cxi_eq->attr.wait_obj);
ret = -FI_ENOSYS;

goto err0;
}

ret = ofi_eq_init(fabric, &cxi_eq->attr, &cxi_eq->util_eq.eq_fid,
context);
if (ret != FI_SUCCESS)
Expand Down
27 changes: 26 additions & 1 deletion prov/cxi/test/eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,36 @@
TestSuite(eq, .init = cxit_setup_eq, .fini = cxit_teardown_eq,
.timeout = CXIT_DEFAULT_TIMEOUT);

/* Test basic CQ creation */
/* Test basic EQ creation */
Test(eq, simple)
{
cxit_create_eq();
cr_assert(cxit_eq != NULL);
cxit_destroy_eq();
}

void eq_bad_wait_obj(enum fi_wait_obj wait_obj)

{
struct fi_eq_attr attr = {
.size = 32,
.flags = FI_WRITE,
.wait_obj = wait_obj,
};
int ret;

ret = fi_eq_open(cxit_fabric, &attr, &cxit_eq, NULL);
cr_assert(ret == -FI_ENOSYS, "fi_eq_open unexpected success");
cr_assert(cxit_eq == NULL, "cxit_eq not NULL on bad wait_obj");
}

Test(eq, bad_wait_obj_unspec)
{
eq_bad_wait_obj(FI_WAIT_UNSPEC);
}

Test(eq, bad_wait_obj_wait_fd)
{
eq_bad_wait_obj(FI_WAIT_UNSPEC);
}

0 comments on commit c7ba8da

Please sign in to comment.