From: Paolo Abeni <pabeni@redhat.com>
To: Dmitry Skorodumov <dskr99@gmail.com>,
netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH net 2/2] selftests: net: simple selftest for ipvtap
Date: Sun, 28 Dec 2025 13:14:09 +0100 [thread overview]
Message-ID: <16fa929d-db04-48f5-a350-a31d23f8327c@redhat.com> (raw)
In-Reply-To: <20251225185543.1459044-3-skorodumov.dmitry@huawei.com>
On 12/25/25 7:55 PM, Dmitry Skorodumov wrote:
> diff --git a/tools/testing/selftests/net/ipvtap_test.sh b/tools/testing/selftests/net/ipvtap_test.sh
> new file mode 100755
> index 000000000000..751793f26fed
> --- /dev/null
> +++ b/tools/testing/selftests/net/ipvtap_test.sh
> @@ -0,0 +1,168 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Simple tests for ipvtap
> +
> +
> +#
> +# The testing environment looks this way:
> +#
> +# |------HOST------| |------PHY-------|
> +# | veth<----------------->veth |
> +# |------|--|------| |----------------|
> +# | |
> +# | | |-----TST0-------|
> +# | |------------|----ipvlan |
> +# | |----------------|
> +# |
> +# | |-----TST1-------|
> +# |---------------|----ipvlan |
> +# |----------------|
> +#
> +
> +ALL_TESTS="
> + test_ip_set
> +"
> +
> +source lib.sh
> +
> +DEBUG=0
> +
> +VETH_HOST=vethtst.h
> +VETH_PHY=vethtst.p
> +
> +NS_COUNT=32
> +IP_ITERATIONS=1024
> +
> +ns_run() {
> + ns=$1
> + shift
> + if [[ "$ns" == "global" ]]; then
> + "$@" >/dev/null
> + else
> + ip netns exec "$ns" "$@" >/dev/null
> + fi
> +}
> +
> +test_ip_setup_env() {
> + modprobe -q tap
> + modprobe -q ipvlan
> + modprobe -q ipvtap
> +
> + setup_ns NS_PHY
> +
> + # setup simulated other-host (phy) and host itself
> + ip link add $VETH_HOST type veth peer name $VETH_PHY \
> + netns "$NS_PHY" >/dev/null
It would be better to avoid creating devices in the main netns.
> + ip link set $VETH_HOST up
> + ns_run "$NS_PHY" ip link set $VETH_PHY up
> +
> + for ((i=0; i<NS_COUNT; i++)); do
> + setup_ns ipvlan_ns_$i
> + ns="ipvlan_ns_$i"
> + if [ "$DEBUG" = "1" ]; then
> + echo "created NS ${!ns}"
> + fi
> + if ! ip link add netns ${!ns} ipvlan0 link $VETH_HOST \
> + type ipvtap mode l2 bridge; then
> + exit_error "FAIL: Failed to configure ipvlan link."
> + fi
> + done
> +}
> +
> +test_ip_cleanup_env() {
> + ip link del $VETH_HOST
> + cleanup_all_ns
> +}
> +
> +exit_error() {
> + echo "$1"
> + exit $ksft_fail
> +}
> +
> +rnd() {
> + echo $(( RANDOM % 32 + 16 ))
> +}
> +
> +test_ip_set_thread() {
> + ip link set ipvlan0 up
> + for ((i=0; i<IP_ITERATIONS; i++)); do
> + v=$(rnd)
> + ip a a "172.25.0.$v/24" dev ipvlan0 2>/dev/null
> + ip a a "fc00::$v/64" dev ipvlan0 2>/dev/null
> + v=$(rnd)
> + ip a d "172.25.0.$v/24" dev ipvlan0 2>/dev/null
> + ip a d "fc00::$v/64" dev ipvlan0 2>/dev/null
It's unclear to me why the above tries to remove random addresses
different from the ones just added (possibly not existing)
> + done
> +}
> +
> +test_ip_set() {
> + RET=0
> +
> + modprobe -q tap
> + modprobe -q ipvlan
> + modprobe -q ipvtap
> +
> + trap test_ip_cleanup_env EXIT
> +
> + test_ip_setup_env
> +
> + declare -A ns_pids
> + for ((i=0; i<NS_COUNT; i++)); do
> + ns="ipvlan_ns_$i"
> + ns_run ${!ns} bash -c "$0 test_ip_set_thread"&
> + ns_pids[$i]=$!
> + done
> +
> + for ((i=0; i<NS_COUNT; i++)); do
> + wait "${ns_pids[$i]}"
> + done
This tests fails quite often in debug build due to timeout, see:
https://netdev.bots.linux.dev/flakes.html?tn-needle=ipvtap
and i.e.
https://netdev-ctrl.bots.linux.dev/logs/vmksft/net-dbg/results/447821/5-ipvtap-test-sh/
You should likely decrease the thread and/or iterations count, at least
for debug builds
/P
next prev parent reply other threads:[~2025-12-28 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251225185543.1459044-1-skorodumov.dmitry@huawei.com>
2025-12-25 18:55 ` [PATCH net 1/2] ipvlan: Make the addrs_lock be per port Dmitry Skorodumov
2025-12-28 9:46 ` Paolo Abeni
2025-12-25 18:55 ` [PATCH net 2/2] selftests: net: simple selftest for ipvtap Dmitry Skorodumov
2025-12-26 17:52 ` Stephen Hemminger
2025-12-28 12:14 ` Paolo Abeni [this message]
2025-12-30 10:06 ` Dmitry Skorodumov
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=16fa929d-db04-48f5-a350-a31d23f8327c@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=dskr99@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skorodumov.dmitry@huawei.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
all inboxes | Powered by JetHome®