From 24aff02f130b40daa5316ffebaeeb490d07381b4 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 27 Feb 2025 10:03:04 +0200 Subject: [PATCH 1/2] Detect when a device is rxe (soft RoCE) The rxe provider does not set its own vendor ID. Use an alternative that relies on the default naming scheme for rxe interfaces. Avoids an ugly warning and thus allowed me to get through loopback tests with a clean standard error. --- src/perftest_parameters.c | 13 +++++++++++++ src/perftest_parameters.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/perftest_parameters.c b/src/perftest_parameters.c index f4fd12e3..454621c7 100755 --- a/src/perftest_parameters.c +++ b/src/perftest_parameters.c @@ -1952,6 +1952,14 @@ const int str_link_layer(const char *str) return LINK_FAILURE; } +bool is_rxe_heuristic(const struct ibv_context *context) +{ + if (context->device == NULL) { + return false; + } + return ! strncmp("rxe", context->device->name, 3); +} + /****************************************************************************** * ******************************************************************************/ @@ -2077,6 +2085,11 @@ enum ctx_device ib_dev_name(struct ibv_context *context) default : dev_fname = UNKNOWN; } } + if (dev_fname == UNKNOWN) { + if (is_rxe_heuristic(context)) { + dev_fname = RXE; + } + } return dev_fname; } diff --git a/src/perftest_parameters.h b/src/perftest_parameters.h index 2ff43d9d..bea8ec33 100755 --- a/src/perftest_parameters.h +++ b/src/perftest_parameters.h @@ -387,6 +387,7 @@ enum ctx_device { CONNECTX8 = 31, INTEL_GEN2 = 32, CONNECTX9 = 33, + RXE = 33, }; /* Units for rate limiter */ From f9520b6ef57949e958aa1f9b5e1847f65a36691a Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 27 Feb 2025 10:04:41 +0200 Subject: [PATCH 2/2] debian: Example autopkgtest configuration --- debian/tests/control | 10 +++++ debian/tests/rxe_loopback | 81 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 debian/tests/control create mode 100755 debian/tests/rxe_loopback diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 00000000..e28ec708 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,10 @@ +Tests: rxe_loopback +Depends: + @, + rdma-core, + iproute2, + psmisc, +Restrictions: + superficial, + needs-root, + isolation-machine, diff --git a/debian/tests/rxe_loopback b/debian/tests/rxe_loopback new file mode 100755 index 00000000..e8e04ed0 --- /dev/null +++ b/debian/tests/rxe_loopback @@ -0,0 +1,81 @@ +#!/bin/sh + +set -e + +link_name="rxe_test" +port_index=1 # Always? +dev_name="$link_name/$port_index" + +get_eth_dev() { + ip -o link | awk '/link\/ether/ {print $2}' | tr -d : | head -n1 +} + +do_init() { + base_link=`get_eth_dev` + if rdma link show "$dev_name" >/dev/null 2>&1; then + echo "$0: Error: rdma link $link_name already exists. Run $0 shutdown" + else + rdma link add "$link_name" type rxe netdev "$base_link" + fi +} + +run_loopback() { + echo "==== Running loopback for $*: ====" + run_loopback_server "$@" & + sleep 1 + run_loopback_client "$@" + echo "==== Done loopback for $*: ====" + +} + +run_loopback_server() { + command_name="$1" + + "$@" || killall "$command_name" || : +} + +run_loopback_client() { + "$@" localhost +} + + +do_check() { + run_loopback ib_write_bw -s 10 + run_loopback ib_read_bw + run_loopback ib_send_bw + run_loopback ib_atomic_bw + run_loopback ib_write_lat + run_loopback ib_atomic_lat + run_loopback ib_write_lat + # Can't test: + # run_loopback raw_ethernet_burst_lat + # run_loopback raw_ethernet_bw + # run_loopback raw_ethernet_fs_rate + # run_loopback raw_ethernet_lat +} + +do_shutdown() { + if rdma link show "$dev_name" >/dev/null 2>&1; then + rdma link delete "$link_name" + fi +} + +do_all() { + do_init + do_check + do_shutdown +} + +do_help() { + echo "$0 " +} + +case "$1" in +init | check | shutdown | help | all) + cmd="$1" + shift + do_$cmd "$@" + ;; +'') do_all;; +*) do_help; exit 1 +esac