From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com,
dsahern@kernel.org, linux-rdma@vger.kernel.org,
linux-kselftest@vger.kernel.org,
"yanjun.zhu@linux.dev" <yanjun.zhu@linux.dev>
Subject: Re: [PATCH v3 4/4] RDMA/rxe: Add testcase for net namespace rxe
Date: Sat, 7 Mar 2026 23:49:24 -0800 [thread overview]
Message-ID: <730903b7-c898-4fba-b375-603a8ccd9067@linux.dev> (raw)
In-Reply-To: <20260308074711.24114-5-yanjun.zhu@linux.dev>
在 2026/3/7 23:47, Zhu Yanjun 写道:
> Add 4 testcases for rxe with net namespace.
The selftest result is as below:
"
# make -C tools/testing/selftests/ TARGETS=rdma run_tests
make: Entering directory '/root/Development/linux/tools/testing/selftests'
make[1]: Nothing to be done for 'all'.
TAP version 13
1..4
# timeout set to 45
# selftests: rdma: rxe_rping_between_netns.sh
# server DISCONNECT EVENT...
# wait for RDMA_READ_ADV state 10
ok 1 selftests: rdma: rxe_rping_between_netns.sh
# timeout set to 45
# selftests: rdma: rxe_ipv6.sh
ok 2 selftests: rdma: rxe_ipv6.sh
# timeout set to 45
# selftests: rdma: rxe_socket_with_netns.sh
ok 3 selftests: rdma: rxe_socket_with_netns.sh
# timeout set to 45
# selftests: rdma: rxe_test_NETDEV_UNREGISTER.sh
ok 4 selftests: rdma: rxe_test_NETDEV_UNREGISTER.sh
make: Leaving directory '/root/Development/linux/tools/testing/selftests'
"
Zhu Yanjun
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> MAINTAINERS | 1 +
> tools/testing/selftests/Makefile | 1 +
> tools/testing/selftests/rdma/Makefile | 7 ++
> tools/testing/selftests/rdma/config | 3 +
> tools/testing/selftests/rdma/rxe_ipv6.sh | 47 ++++++++++++++
> .../selftests/rdma/rxe_rping_between_netns.sh | 57 +++++++++++++++++
> .../selftests/rdma/rxe_socket_with_netns.sh | 64 +++++++++++++++++++
> .../rdma/rxe_test_NETDEV_UNREGISTER.sh | 38 +++++++++++
> 8 files changed, 218 insertions(+)
> create mode 100644 tools/testing/selftests/rdma/Makefile
> create mode 100644 tools/testing/selftests/rdma/config
> create mode 100755 tools/testing/selftests/rdma/rxe_ipv6.sh
> create mode 100755 tools/testing/selftests/rdma/rxe_rping_between_netns.sh
> create mode 100755 tools/testing/selftests/rdma/rxe_socket_with_netns.sh
> create mode 100755 tools/testing/selftests/rdma/rxe_test_NETDEV_UNREGISTER.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 89007f9ed35e..3835857d0192 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -24493,6 +24493,7 @@ L: linux-rdma@vger.kernel.org
> S: Supported
> F: drivers/infiniband/sw/rxe/
> F: include/uapi/rdma/rdma_user_rxe.h
> +F: tools/testing/selftests/rdma/
>
> SOFTLOGIC 6x10 MPEG CODEC
> M: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 450f13ba4cca..110e07c0d99d 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -94,6 +94,7 @@ TARGETS += proc
> TARGETS += pstore
> TARGETS += ptrace
> TARGETS += openat2
> +TARGETS += rdma
> TARGETS += resctrl
> TARGETS += riscv
> TARGETS += rlimits
> diff --git a/tools/testing/selftests/rdma/Makefile b/tools/testing/selftests/rdma/Makefile
> new file mode 100644
> index 000000000000..7dd7cba7a73c
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/Makefile
> @@ -0,0 +1,7 @@
> +# SPDX-License-Identifier: GPL-2.0
> +TEST_PROGS := rxe_rping_between_netns.sh \
> + rxe_ipv6.sh \
> + rxe_socket_with_netns.sh \
> + rxe_test_NETDEV_UNREGISTER.sh
> +
> +include ../lib.mk
> diff --git a/tools/testing/selftests/rdma/config b/tools/testing/selftests/rdma/config
> new file mode 100644
> index 000000000000..4ffb814e253b
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/config
> @@ -0,0 +1,3 @@
> +CONFIG_TUN
> +CONFIG_VETH
> +CONFIG_RDMA_RXE
> diff --git a/tools/testing/selftests/rdma/rxe_ipv6.sh b/tools/testing/selftests/rdma/rxe_ipv6.sh
> new file mode 100755
> index 000000000000..9337ac4fd13f
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/rxe_ipv6.sh
> @@ -0,0 +1,47 @@
> +#!/bin/sh
> +
> +# Notes:
> +#
> +# 1. Before running this script, please disable the firewall, as it may
> +# block UDP port 4791.
> +
> +# 2. This test script depends on the veth and tun drivers. Before running
> +# the script, please verify that both drivers are available by executing:
> +#
> +# modinfo tun
> +# modinfo veth
> +#
> +# Make sure these commands return valid module information.
> +
> +# 3. ipv6 test.
> +# While RXE is conventionally deployed over IPv4, it maintains
> +# native support for IPv6. However, IPv6 implementations typically
> +# receive less validation and performance tuning in standard use cases.
> +exec > /dev/null
> +# 1) create ipv6 net namespace
> +ip netns add net6
> +ip link add veth0 type veth peer name veth1
> +ip link set veth1 netns net6
> +ip netns exec net6 ip addr add 2001:db8::1/64 dev veth1
> +ip netns exec net6 ip link set veth1 up
> +
> +# 2) Add rdma link
> +ip netns exec net6 rdma link add rxe6 type rxe netdev veth1
> +
> +# 3) check IPv6 UDP 4791 listening port
> +if ! ip netns exec net6 ss -ul6n | grep :4791; then
> + echo "Error: udp port 4791 exists"
> + exit 1
> +fi
> +
> +# 4) Delete rxe link
> +ip netns exec net6 rdma link del rxe6
> +if ip netns exec net6 ss -ul6n | grep :4791; then # result should be null
> + echo "Error: udp port 4791 exists"
> + exit 1
> +fi
> +
> +# 5) delete net6
> +ip netns del net6
> +
> +modprobe -v -r rdma_rxe
> diff --git a/tools/testing/selftests/rdma/rxe_rping_between_netns.sh b/tools/testing/selftests/rdma/rxe_rping_between_netns.sh
> new file mode 100755
> index 000000000000..80b4249dba55
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/rxe_rping_between_netns.sh
> @@ -0,0 +1,57 @@
> +#!/bin/sh
> +
> +# Notes:
> +#
> +# 1. Before running this script, please disable the firewall, as it may
> +# block UDP port 4791.
> +
> +# 2. This test script depends on the veth and tun drivers. Before running
> +# the script, please verify that both drivers are available by executing:
> +#
> +# modinfo veth
> +#
> +# Make sure these commands return valid module information.
> +
> +#1. Check if rping can work or not
> +exec > /dev/null
> +ip netns add test1
> +ip netns ls
> +ip link add veth-a type veth peer name veth-b
> +ip l
> +ip link set veth-a netns test1
> +ip l
> +ip netns exec test1 ip l set veth-a up
> +ip netns exec test1 ip addr add 1.1.1.1/24 dev veth-a
> +ip netns exec test1 ip l
> +ip netns exec test1 ip -4 a
> +ip netns exec test1 rdma link add rxe0 type rxe netdev veth-a
> +
> +#check if socket exist or not
> +ip netns exec test1 ss -lun | grep :4791
> +
> +ip netns exec test1 rdma link
> +ip link set veth-b up
> +ip addr add 1.1.1.2/24 dev veth-b
> +ping -c 3 1.1.1.1 || exit 1
> +ip netns exec test1 rping -s -a 1.1.1.1&
> +rdma link add rxe1 type rxe netdev veth-b
> +rdma link
> +
> +#check if socket exist or not
> +ss -lun | grep :4791
> +
> +rping -c -a 1.1.1.1 -d -v -C 3 || exit 1
> +ip netns ls
> +rdma link del rxe1
> +
> +#check if socket exist or not
> +ss -lun | grep :4791
> +
> +ip netns exec test1 ss -lun | grep :4791
> +ip netns exec test1 rdma link del rxe0
> +ip netns exec test1 ss -lun | grep :4791
> +ip netns del test1
> +ip netns ls
> +
> +modprobe -v -r veth
> +modprobe -v -r rdma_rxe
> diff --git a/tools/testing/selftests/rdma/rxe_socket_with_netns.sh b/tools/testing/selftests/rdma/rxe_socket_with_netns.sh
> new file mode 100755
> index 000000000000..676aec63babd
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/rxe_socket_with_netns.sh
> @@ -0,0 +1,64 @@
> +#!/bin/sh
> +
> +# Notes:
> +#
> +# 1. Before running this script, please disable the firewall, as it may
> +# block UDP port 4791.
> +
> +# 2. This test script depends on the veth and tun drivers. Before running
> +# the script, please verify that both drivers are available by executing:
> +#
> +# modinfo tun
> +#
> +# Make sure these commands return valid module information.
> +
> +# Check if socket exist or not
> +exec > /dev/null
> +ip tuntap add mode tun tun0
> +ip -4 a
> +ip addr add 1.1.1.1/24 dev tun0
> +ip link set tun0 up
> +ip -4 a
> +rdma link add rxe0 type rxe netdev tun0
> +rdma link
> +ret=`ss -lun | grep :4791`
> +if [ X"$ret" == X"" ]; then
> + echo "Error: udp port 4791 does not exist"
> + exit 1
> +fi
> +
> +ip tuntap add mode tun tun1
> +ip -4 a
> +ip addr add 2.2.2.2/24 dev tun1
> +ip link set tun1 up
> +rdma link add rxe1 type rxe netdev tun1
> +rdma link
> +ret=`ss -lun | grep :4791`
> +if [ X"$ret" == X"" ]; then
> + echo "Error: udp port 4791 does not exist"
> + exit 1
> +fi
> +
> +rdma link del rxe1
> +rdma link
> +ret=`ss -lun | grep :4791`
> +if [ X"$ret" == X"" ]; then
> + echo "Error: udp port 4791 doese not exist"
> + exit 1
> +fi
> +
> +rdma link del rxe0
> +rdma link
> +if ss -lun | grep :4791; then
> + echo "Error: udp port 4791 exists"
> + exit 1
> +fi
> +
> +ip addr del 2.2.2.2/24 dev tun1
> +ip tuntap del mode tun tun1
> +
> +ip addr del 1.1.1.1/24 dev tun0
> +ip tuntap del mode tun tun0
> +
> +modprobe -v -r tun
> +modprobe -v -r rdma_rxe
> diff --git a/tools/testing/selftests/rdma/rxe_test_NETDEV_UNREGISTER.sh b/tools/testing/selftests/rdma/rxe_test_NETDEV_UNREGISTER.sh
> new file mode 100755
> index 000000000000..c30ff905b121
> --- /dev/null
> +++ b/tools/testing/selftests/rdma/rxe_test_NETDEV_UNREGISTER.sh
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +
> +# Notes:
> +#
> +# 1. Before running this script, please disable the firewall, as it may
> +# block UDP port 4791.
> +
> +# 2. This test script depends on the veth and tun drivers. Before running
> +# the script, please verify that both drivers are available by executing:
> +#
> +# modinfo tun
> +# modinfo veth
> +#
> +# Make sure these commands return valid module information.
> +
> +# Trigger NETDEV_UNREGISTER
> +exec > /dev/null
> +ip tuntap add mode tun tun0
> +ip -4 a
> +ip addr add 1.1.1.1/24 dev tun0
> +ip link set tun0 up
> +ip -4 a
> +rdma link add rxe0 type rxe netdev tun0
> +rdma link
> +ss -lun | grep :4791
> +
> +ip l
> +ip addr del 1.1.1.1/24 dev tun0
> +ip tuntap del mode tun tun0
> +
> +rdma link
> +if ss -lun | grep :4791; then
> + echo "error"
> + exit 1
> +fi
> +
> +modprobe -v -r tun
> +modprobe -v -r rdma_rxe
--
Best Regards,
Yanjun.Zhu
prev parent reply other threads:[~2026-03-08 7:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-08 7:47 [PATCH v3 0/4]RDMA/rxe: Add the support that rxe can work in net namespace Zhu Yanjun
2026-03-08 7:47 ` [PATCH v3 1/4] RDMA/nldev: Add dellink function pointer Zhu Yanjun
2026-03-08 7:47 ` [PATCH v3 2/4] RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets Zhu Yanjun
2026-03-08 17:44 ` David Ahern
2026-03-08 22:52 ` Zhu Yanjun
2026-03-08 7:47 ` [PATCH v3 3/4] RDMA/rxe: Support RDMA link creation and destruction per net namespace Zhu Yanjun
2026-03-08 7:47 ` [PATCH v3 4/4] RDMA/rxe: Add testcase for net namespace rxe Zhu Yanjun
2026-03-08 7:49 ` Zhu Yanjun [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=730903b7-c898-4fba-b375-603a8ccd9067@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=dsahern@kernel.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=zyjzyj2000@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox