Skip to content

Detect when a device is rxe (soft RoCE) #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Tests: rxe_loopback
Depends:
@,
rdma-core,
iproute2,
psmisc,
Restrictions:
superficial,
needs-root,
isolation-machine,
81 changes: 81 additions & 0 deletions debian/tests/rxe_loopback
Original file line number Diff line number Diff line change
@@ -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 <all | init | check | shutdown>"
}

case "$1" in
init | check | shutdown | help | all)
cmd="$1"
shift
do_$cmd "$@"
;;
'') do_all;;
*) do_help; exit 1
esac
13 changes: 13 additions & 0 deletions src/perftest_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any soft roce device will have 'rxe' as prefix?

}

/******************************************************************************
*
******************************************************************************/
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/perftest_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ enum ctx_device {
CONNECTX8 = 31,
INTEL_GEN2 = 32,
CONNECTX9 = 33,
RXE = 33,
};

/* Units for rate limiter */
Expand Down