]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: mptcp: join: allow changing ifaces nr per test
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 8 May 2026 15:40:50 +0000 (17:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 12 May 2026 01:01:37 +0000 (18:01 -0700)
By default, 4 network interfaces are created per subtest in a dedicated
net namespace. Each netns has a dedicated pair of v4 and v6 addresses.
Future tests will need more.

Simply always creating more network interfaces per test will increase
the execution time for all other tests, for no other benefits. So now it
is possible to change this number only when needed, by setting ifaces_nr
when calling 'reset' and 'init_shapers', e.g.

  ifaces_nr=8 reset "Subtest title"
  ifaces_nr=8 init_shapers

Note that it might also be interesting to decrease the default value to
2 to reduce the setup time, especially when a debug kernel config is
being used.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260508-net-next-mptcp-pm-inc-limits-v1-5-c84e3fdf9b6a@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_join.sh

index beec41f6662a279af0fc46a2b540f2db85b9224b..28da9df797ae8f0bb62a3b62b83d83d87251b96f 100755 (executable)
@@ -63,6 +63,7 @@ unset fastclose
 unset fullmesh
 unset speed
 unset bind_addr
+unset ifaces_nr
 unset join_syn_rej
 unset join_csum_ns1
 unset join_csum_ns2
@@ -146,7 +147,7 @@ init_partial()
        # ns1eth4    ns2eth4
 
        local i
-       for i in $(seq 1 4); do
+       for i in $(seq 1 "${ifaces_nr:-4}"); do
                ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2"
                ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i
                ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad
@@ -165,7 +166,7 @@ init_partial()
 init_shapers()
 {
        local i
-       for i in $(seq 1 4); do
+       for i in $(seq 1 "${ifaces_nr:-4}"); do
                tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1ms
                tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1ms
        done