Skip to content

Commit

Permalink
fabtests/efa: add rdma check for unsolicited write recv
Browse files Browse the repository at this point in the history
Signed-off-by: Jessie Yang <[email protected]>
  • Loading branch information
jiaxiyan authored and shijin-aws committed Jan 24, 2025
1 parent 2e8ef33 commit b280fc0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
5 changes: 5 additions & 0 deletions fabtests/prov/efa/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ AS_IF([test x"$have_efadv" = x"1"], [
[],
[efa_rdma_checker_happy=0],
[[#include <infiniband/efadv.h>]])
AC_CHECK_DECL(EFADV_DEVICE_ATTR_CAPS_UNSOLICITED_WRITE_RECV,
[],
[efa_rdma_checker_happy=0],
[[#include <infiniband/efadv.h>]])
])
AM_CONDITIONAL([BUILD_EFA_RDMA_CHECKER], [test $efa_rdma_checker_happy -eq 1])
31 changes: 24 additions & 7 deletions fabtests/prov/efa/src/efa_rdma_checker.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
enum rdma_op {
READ,
WRITE,
UNSOLICITED_WRITE_RECV,
};

/*
Expand All @@ -37,16 +38,18 @@ int main(int argc, char *argv[])
op = READ;
} else if (!strcasecmp(optarg, "write")) {
op = WRITE;
} else if (!strcasecmp(optarg, "writedata")) {
op = UNSOLICITED_WRITE_RECV;
} else {
fprintf(stderr, "Unknown operation '%s. Allowed: read | write'\n", optarg);
fprintf(stderr, "Unknown operation '%s. Allowed: read | write | writedata '\n", optarg);
return EXIT_FAILURE;
}
break;
case '?':
case 'h':
default:
fprintf(stderr, "Usage:\n");
FT_PRINT_OPTS_USAGE("fi_efa_rdma_checker -o <op>", "rdma operation type: read|write");
FT_PRINT_OPTS_USAGE("fi_efa_rdma_checker -o <op>", "rdma operation type: read | write | writedata");
return EXIT_FAILURE;
}
}
Expand Down Expand Up @@ -86,11 +89,25 @@ int main(int argc, char *argv[])
if (op == READ)
goto out;

if (efadv_attr.device_caps & EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE) {
fprintf(stdout, "rdma write is enabled \n");
} else {
fprintf(stderr, "rdma write is NOT enabled \n");
err = op == WRITE ? 1 : 0;
if (op == WRITE) {
if (efadv_attr.device_caps & EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE) {
fprintf(stdout, "rdma write is enabled \n");
} else {
fprintf(stderr, "rdma write is NOT enabled \n");
err = 1;
}
goto out;
}

if (op == UNSOLICITED_WRITE_RECV) {
if (efadv_attr.device_caps & EFADV_DEVICE_ATTR_CAPS_UNSOLICITED_WRITE_RECV) {
fprintf(stdout,
"rdma unsolicited write recv is enabled \n");
} else {
fprintf(stderr, "rdma unsolicited write recv is NOT "
"enabled \n");
err = 1;
}
}

out:
Expand Down
2 changes: 1 addition & 1 deletion fabtests/pytest/efa/efa_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def has_rdma(cmdline_args, operation):
operation: rdma operation name, allowed values are read and write
return: a boolean
"""
assert operation in ["read", "write"]
assert operation in ["read", "write", "writedata"]
binpath = cmdline_args.binpath or ""
cmd = "timeout " + str(cmdline_args.timeout) \
+ " " + os.path.join(binpath, f"fi_efa_rdma_checker -o {operation}")
Expand Down

0 comments on commit b280fc0

Please sign in to comment.