mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Marc Harvey <marcharvey@google.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Kuniyuki Iwashima <kuniyu@google.com>
Subject: Re: [PATCH net-next v7 04/10] selftests: net: Add tests for failover of team-aggregated ports
Date: Mon, 13 Apr 2026 15:05:10 +0200	[thread overview]
Message-ID: <ce718e68-22bb-40bc-a046-8fc9b636590b@redhat.com> (raw)
In-Reply-To: <20260409-teaming-driver-internal-v7-4-f47e7589685d@google.com>



On 4/9/26 4:59 AM, Marc Harvey wrote:
> There are currently no kernel tests that verify the effect of setting
> the enabled team driver option. In a followup patch, there will be
> changes to this option, so it will be important to make sure it still
> behaves as it does now.
> 
> The test verifies that tcp continues to work across two different team
> devices in separate network namespaces, even when member links are
> manually disabled.
> 
> Signed-off-by: Marc Harvey <marcharvey@google.com>
> ---
> Changes in v6:
> - Use a tcp port with no associated service.
> - Make tcpdump helper function not string-replace port numbers with
>   associated service names, even on Fedora, which has a tcpdump patch
>   that changes the required flag.
> - Link to v5: https://lore.kernel.org/netdev/20260406-teaming-driver-internal-v5-4-e8a3f348a1c5@google.com/
> 
> Changes in v5:
> - Use tcpdump for collecting traffic, rather than reading rx counters.
> - Link to v4: https://lore.kernel.org/netdev/20260403-teaming-driver-internal-v4-4-d3032f33ca25@google.com/
> 
> Changes in v2:
> - Fix shellcheck failures.
> - Remove dependency on net forwarding lib and pipe viewer tools.
> - Use iperf3 for tcp instead of netcat.
> - Link to v1: https://lore.kernel.org/all/20260331053353.2504254-5-marcharvey@google.com/
> ---
>  tools/testing/selftests/drivers/net/team/Makefile  |   2 +
>  tools/testing/selftests/drivers/net/team/config    |   4 +
>  .../testing/selftests/drivers/net/team/team_lib.sh | 148 +++++++++++++++++++
>  .../drivers/net/team/transmit_failover.sh          | 158 +++++++++++++++++++++
>  tools/testing/selftests/net/forwarding/lib.sh      |   9 +-
>  5 files changed, 319 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/team/Makefile b/tools/testing/selftests/drivers/net/team/Makefile
> index 02d6f51d5a06..777da2e0429e 100644
> --- a/tools/testing/selftests/drivers/net/team/Makefile
> +++ b/tools/testing/selftests/drivers/net/team/Makefile
> @@ -7,9 +7,11 @@ TEST_PROGS := \
>  	options.sh \
>  	propagation.sh \
>  	refleak.sh \
> +	transmit_failover.sh \
>  # end of TEST_PROGS
>  
>  TEST_INCLUDES := \
> +	team_lib.sh \
>  	../bonding/lag_lib.sh \
>  	../../../net/forwarding/lib.sh \
>  	../../../net/in_netns.sh \
> diff --git a/tools/testing/selftests/drivers/net/team/config b/tools/testing/selftests/drivers/net/team/config
> index 5d36a22ef080..8f04ae419c53 100644
> --- a/tools/testing/selftests/drivers/net/team/config
> +++ b/tools/testing/selftests/drivers/net/team/config
> @@ -6,4 +6,8 @@ CONFIG_NETDEVSIM=m
>  CONFIG_NET_IPGRE=y
>  CONFIG_NET_TEAM=y
>  CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y
> +CONFIG_NET_TEAM_MODE_BROADCAST=y
>  CONFIG_NET_TEAM_MODE_LOADBALANCE=y
> +CONFIG_NET_TEAM_MODE_RANDOM=y
> +CONFIG_NET_TEAM_MODE_ROUNDROBIN=y
> +CONFIG_VETH=y
> diff --git a/tools/testing/selftests/drivers/net/team/team_lib.sh b/tools/testing/selftests/drivers/net/team/team_lib.sh
> new file mode 100644
> index 000000000000..2057f5edee79
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/team/team_lib.sh
> @@ -0,0 +1,148 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +test_dir="$(dirname "$0")"
> +export REQUIRE_MZ=no
> +export NUM_NETIFS=0
> +# shellcheck disable=SC1091
> +source "${test_dir}/../../../net/forwarding/lib.sh"
> +
> +TCP_PORT="43434"
> +
> +# Create a team interface inside of a given network namespace with a given
> +# mode, members, and IP address.
> +# Arguments:
> +#  namespace - Network namespace to put the team interface into.
> +#  team - The name of the team interface to setup.
> +#  mode - The team mode of the interface.
> +#  ip_address - The IP address to assign to the team interface.
> +#  prefix_length - The prefix length for the IP address subnet.
> +#  $@ - members - The member interfaces of the aggregation.
> +setup_team()
> +{
> +	local namespace=$1
> +	local team=$2
> +	local mode=$3
> +	local ip_address=$4
> +	local prefix_length=$5
> +	shift 5
> +	local members=("$@")
> +
> +	# Prerequisite: team must have no members
> +	for member in "${members[@]}"; do
> +		ip -n "${namespace}" link set "${member}" nomaster
> +	done
> +
> +	# Prerequisite: team must have no address in order to set it
> +	# shellcheck disable=SC2086
> +	ip -n "${namespace}" addr del "${ip_address}/${prefix_length}" \
> +			${NODAD} dev "${team}"
> +
> +	echo "Setting team in ${namespace} to mode ${mode}"
> +
> +	if ! ip -n "${namespace}" link set "${team}" down; then
> +		echo "Failed to bring team device down"
> +		return 1
> +	fi
> +	if ! ip netns exec "${namespace}" teamnl "${team}" setoption mode \
> +			"${mode}"; then
> +		echo "Failed to set ${team} mode to '${mode}'"
> +		return 1
> +	fi
> +
> +	# Aggregate the members into teams.
> +	for member in "${members[@]}"; do
> +		ip -n "${namespace}" link set "${member}" master "${team}"
> +	done
> +
> +	# Bring team devices up and give them addresses.
> +	if ! ip -n "${namespace}" link set "${team}" up; then
> +		echo "Failed to set ${team} up"
> +		return 1
> +	fi
> +
> +	# shellcheck disable=SC2086
> +	if ! ip -n "${namespace}" addr add "${ip_address}/${prefix_length}" \
> +			${NODAD} dev "${team}"; then
> +		echo "Failed to give ${team} IP address in ${namespace}"
> +		return 1
> +	fi
> +}
> +
> +# This is global used to keep track of the sender's iperf3 process, so that it
> +# can be terminated.
> +declare sender_pid
> +
> +# Start sending and receiving TCP traffic with iperf3.
> +# Globals:
> +#  sender_pid - The process ID of the iperf3 sender process. Used to kill it
> +#  later.
> +start_listening_and_sending()
> +{
> +	ip netns exec "${NS2}" iperf3 -s -p "${TCP_PORT}" --logfile /dev/null &
> +	# Wait for server to become reachable before starting client.
> +	slowwait 5 ip netns exec "${NS1}" iperf3 -c "${NS2_IP}" -p \
> +			"${TCP_PORT}" -t 1 --logfile /dev/null

Note for a possible follow-up: the iperf3 server is apparently never
stopped. You could used the wait_local_port_listen helper and
the`--one-off` iperf3 command line argument to avoid that (or explicitly
killing the server pid at cleanup time)

/P


  parent reply	other threads:[~2026-04-13 13:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  2:59 [PATCH net-next v7 00/10] Decouple receive and transmit enablement in team driver Marc Harvey
2026-04-09  2:59 ` [PATCH net-next v7 01/10] net: team: Annotate reads and writes for mixed lock accessed values Marc Harvey
2026-04-10  5:55   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 02/10] net: team: Remove unused team_mode_op, port_enabled Marc Harvey
2026-04-10  5:56   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 03/10] net: team: Rename port_disabled team mode op to port_tx_disabled Marc Harvey
2026-04-10  5:56   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 04/10] selftests: net: Add tests for failover of team-aggregated ports Marc Harvey
2026-04-10  6:09   ` Kuniyuki Iwashima
2026-04-13 13:05   ` Paolo Abeni [this message]
2026-04-09  2:59 ` [PATCH net-next v7 05/10] selftests: net: Add test for enablement of ports with teamd Marc Harvey
2026-04-10  6:18   ` Kuniyuki Iwashima
2026-04-13 13:07   ` Paolo Abeni
2026-04-09  2:59 ` [PATCH net-next v7 06/10] net: team: Rename enablement functions and struct members to tx Marc Harvey
2026-04-10  6:22   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 07/10] net: team: Track rx enablement separately from tx enablement Marc Harvey
2026-04-10  6:31   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 08/10] net: team: Add new rx_enabled team port option Marc Harvey
2026-04-10  6:33   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 09/10] net: team: Add new tx_enabled " Marc Harvey
2026-04-10  6:36   ` Kuniyuki Iwashima
2026-04-09  2:59 ` [PATCH net-next v7 10/10] selftests: net: Add tests for team driver decoupled tx and rx control Marc Harvey
2026-04-10  6:40   ` Kuniyuki Iwashima
2026-04-13 13:30 ` [PATCH net-next v7 00/10] Decouple receive and transmit enablement in team driver patchwork-bot+netdevbpf

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=ce718e68-22bb-40bc-a046-8fc9b636590b@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=marcharvey@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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®