* [PATCH net-next 1/7] net: team: Annotate reads and writes for mixed lock accessed values
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 2/7] net: team: Remove unused team_mode_op, port_enabled Marc Harvey
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
The team_port's "index" and the team's "en_port_count" are read in
the hot transmit path, but are only written to when holding the rtnl
lock.
Use READ_ONCE() for all lockless reads of these values, and use
WRITE_ONCE() for all writes.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
drivers/net/team/team_core.c | 11 ++++++-----
drivers/net/team/team_mode_random.c | 2 +-
include/linux/if_team.h | 4 ++--
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index 566a5d102c23..becd066279a6 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -938,7 +938,8 @@ static void team_port_enable(struct team *team,
{
if (team_port_enabled(port))
return;
- port->index = team->en_port_count++;
+ WRITE_ONCE(port->index, team->en_port_count);
+ WRITE_ONCE(team->en_port_count, team->en_port_count + 1);
hlist_add_head_rcu(&port->hlist,
team_port_index_hash(team, port->index));
team_adjust_ops(team);
@@ -958,7 +959,7 @@ static void __reconstruct_port_hlist(struct team *team, int rm_index)
for (i = rm_index + 1; i < team->en_port_count; i++) {
port = team_get_port_by_index(team, i);
hlist_del_rcu(&port->hlist);
- port->index--;
+ WRITE_ONCE(port->index, port->index - 1);
hlist_add_head_rcu(&port->hlist,
team_port_index_hash(team, port->index));
}
@@ -973,8 +974,8 @@ static void team_port_disable(struct team *team,
team->ops.port_disabled(team, port);
hlist_del_rcu(&port->hlist);
__reconstruct_port_hlist(team, port->index);
- port->index = -1;
- team->en_port_count--;
+ WRITE_ONCE(port->index, -1);
+ WRITE_ONCE(team->en_port_count, team->en_port_count - 1);
team_queue_override_port_del(team, port);
team_adjust_ops(team);
team_lower_state_changed(port);
@@ -1245,7 +1246,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
netif_addr_unlock_bh(dev);
}
- port->index = -1;
+ WRITE_ONCE(port->index, -1);
list_add_tail_rcu(&port->list, &team->port_list);
team_port_enable(team, port);
netdev_compute_master_upper_features(dev, true);
diff --git a/drivers/net/team/team_mode_random.c b/drivers/net/team/team_mode_random.c
index 53d0ce34b8ce..169a7bc865b2 100644
--- a/drivers/net/team/team_mode_random.c
+++ b/drivers/net/team/team_mode_random.c
@@ -16,7 +16,7 @@ static bool rnd_transmit(struct team *team, struct sk_buff *skb)
struct team_port *port;
int port_index;
- port_index = get_random_u32_below(team->en_port_count);
+ port_index = get_random_u32_below(READ_ONCE(team->en_port_count));
port = team_get_port_by_index_rcu(team, port_index);
if (unlikely(!port))
goto drop;
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index ccb5327de26d..06f4d7400c1e 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -77,7 +77,7 @@ static inline struct team_port *team_port_get_rcu(const struct net_device *dev)
static inline bool team_port_enabled(struct team_port *port)
{
- return port->index != -1;
+ return READ_ONCE(port->index) != -1;
}
static inline bool team_port_txable(struct team_port *port)
@@ -272,7 +272,7 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
struct hlist_head *head = team_port_index_hash(team, port_index);
hlist_for_each_entry_rcu(port, head, hlist)
- if (port->index == port_index)
+ if (READ_ONCE(port->index) == port_index)
return port;
return NULL;
}
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 2/7] net: team: Remove unused team_mode_op, port_enabled
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 1/7] net: team: Annotate reads and writes for mixed lock accessed values Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 3/7] net: team: Rename port_disabled team mode op to port_tx_disabled Marc Harvey
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
This team_mode_op wasn't used by any of the team modes, so remove it.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
drivers/net/team/team_core.c | 2 --
include/linux/if_team.h | 1 -
2 files changed, 3 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index becd066279a6..e54bd21bd068 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -944,8 +944,6 @@ static void team_port_enable(struct team *team,
team_port_index_hash(team, port->index));
team_adjust_ops(team);
team_queue_override_port_add(team, port);
- if (team->ops.port_enabled)
- team->ops.port_enabled(team, port);
team_notify_peers(team);
team_mcast_rejoin(team);
team_lower_state_changed(port);
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 06f4d7400c1e..a761f5282bcf 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -121,7 +121,6 @@ struct team_mode_ops {
int (*port_enter)(struct team *team, struct team_port *port);
void (*port_leave)(struct team *team, struct team_port *port);
void (*port_change_dev_addr)(struct team *team, struct team_port *port);
- void (*port_enabled)(struct team *team, struct team_port *port);
void (*port_disabled)(struct team *team, struct team_port *port);
};
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 3/7] net: team: Rename port_disabled team mode op to port_tx_disabled
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 1/7] net: team: Annotate reads and writes for mixed lock accessed values Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 2/7] net: team: Remove unused team_mode_op, port_enabled Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 4/7] selftests: net: Add tests for failover of team-aggregated ports Marc Harvey
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
This team mode op is only used by the load balance mode, and it only
uses it in the tx path.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
drivers/net/team/team_core.c | 4 ++--
drivers/net/team/team_mode_loadbalance.c | 4 ++--
include/linux/if_team.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index e54bd21bd068..2ce31999c99f 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -968,8 +968,8 @@ static void team_port_disable(struct team *team,
{
if (!team_port_enabled(port))
return;
- if (team->ops.port_disabled)
- team->ops.port_disabled(team, port);
+ if (team->ops.port_tx_disabled)
+ team->ops.port_tx_disabled(team, port);
hlist_del_rcu(&port->hlist);
__reconstruct_port_hlist(team, port->index);
WRITE_ONCE(port->index, -1);
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 684954c2a8de..840f409d250b 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -655,7 +655,7 @@ static void lb_port_leave(struct team *team, struct team_port *port)
free_percpu(lb_port_priv->pcpu_stats);
}
-static void lb_port_disabled(struct team *team, struct team_port *port)
+static void lb_port_tx_disabled(struct team *team, struct team_port *port)
{
lb_tx_hash_to_port_mapping_null_port(team, port);
}
@@ -665,7 +665,7 @@ static const struct team_mode_ops lb_mode_ops = {
.exit = lb_exit,
.port_enter = lb_port_enter,
.port_leave = lb_port_leave,
- .port_disabled = lb_port_disabled,
+ .port_tx_disabled = lb_port_tx_disabled,
.receive = lb_receive,
.transmit = lb_transmit,
};
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index a761f5282bcf..740cb3100dfc 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -121,7 +121,7 @@ struct team_mode_ops {
int (*port_enter)(struct team *team, struct team_port *port);
void (*port_leave)(struct team *team, struct team_port *port);
void (*port_change_dev_addr)(struct team *team, struct team_port *port);
- void (*port_disabled)(struct team *team, struct team_port *port);
+ void (*port_tx_disabled)(struct team *team, struct team_port *port);
};
extern int team_modeop_port_enter(struct team *team, struct team_port *port);
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 4/7] selftests: net: Add tests for failover of team-aggregated ports
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
` (2 preceding siblings ...)
2026-03-31 5:33 ` [PATCH net-next 3/7] net: team: Rename port_disabled team mode op to port_tx_disabled Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 5/7] selftests: net: Add test for enablement of ports with teamd Marc Harvey
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
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>
---
.../selftests/drivers/net/team/Makefile | 1 +
.../testing/selftests/drivers/net/team/config | 4 +
.../selftests/drivers/net/team/team_lib.sh | 129 +++++++++++++++
.../drivers/net/team/transmit_failover.sh | 155 ++++++++++++++++++
tools/testing/selftests/net/forwarding/lib.sh | 13 +-
5 files changed, 300 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/drivers/net/team/team_lib.sh
create mode 100755 tools/testing/selftests/drivers/net/team/transmit_failover.sh
diff --git a/tools/testing/selftests/drivers/net/team/Makefile b/tools/testing/selftests/drivers/net/team/Makefile
index 02d6f51d5a06..ed11edf07655 100644
--- a/tools/testing/selftests/drivers/net/team/Makefile
+++ b/tools/testing/selftests/drivers/net/team/Makefile
@@ -7,6 +7,7 @@ TEST_PROGS := \
options.sh \
propagation.sh \
refleak.sh \
+ transmit_failover.sh \
# end of TEST_PROGS
TEST_INCLUDES := \
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..94fdb07edc30
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/team/team_lib.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+REQUIRE_MZ=no
+NUM_NETIFS=0
+source "${test_dir}/../../../net/forwarding/lib.sh"
+
+# 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
+ 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
+
+ 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 netcat process, so that it
+# can be terminated.
+declare sender_pid
+
+# Start sending and receiving TCP traffic with netcat.
+# Globals:
+# sender_pid - The process ID of the netcat sender process. Used to kill it
+# later.
+start_listening_and_sending()
+{
+ ip netns exec "${NS2}" nc -l "${NS2_IP}" 1234 > /dev/null &
+ ip netns exec "${NS1}" /bin/bash -c "cat /dev/urandom | pv -q -L 1m | \
+ nc ${NS2_IP} 1234 &"
+ sender_pid=$!
+}
+
+# Stop sending TCP traffic with netcat.
+# Globals:
+# sender_pid - The process IF of the netcat sender process.
+stop_sending_and_listening()
+{
+ kill "${sender_pid}" && wait "${sender_pid}"
+}
+
+# Monitor for TCP traffic with Tcpdump, save results to temp files.
+# Arguments:
+# namespace - The network namespace to run tcpdump inside of.
+# $@ - interfaces - The interfaces to listen to.
+save_tcpdump_outputs()
+{
+ local namespace=$1
+ shift 1
+ local interfaces=("$@")
+
+ for interface in "${interfaces[@]}"; do
+ tcpdump_start_nosleep "${interface}" "${namespace}"
+ done
+
+ sleep 1
+
+ for interface in "${interfaces[@]}"; do
+ tcpdump_stop_nosleep "${interface}"
+ done
+}
+
+# Read Tcpdump output, determine packet counts.
+# Arguments:
+# interface - The name of the interface to count packets for.
+# ip_address - The destination IP address.
+did_interface_receive()
+{
+ local interface="$1"
+ local ip_address="$2"
+
+ local packet_count=$(tcpdump_show "$interface" | grep \
+ "> ${ip_address}.1234" | wc -l)
+ echo "Packet count for ${interface} was ${packet_count}"
+
+ if [[ "${packet_count}" -gt 0 ]]; then
+ true
+ else
+ false
+ fi
+}
diff --git a/tools/testing/selftests/drivers/net/team/transmit_failover.sh b/tools/testing/selftests/drivers/net/team/transmit_failover.sh
new file mode 100755
index 000000000000..c53743e26c24
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/team/transmit_failover.sh
@@ -0,0 +1,155 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# These tests verify the basic failover capability of the team driver via the
+# `enabled` team driver option across different team driver modes. This does not
+# rely on teamd, and instead just uses teamnl to set the `enabled` option
+# directly.
+#
+# Topology:
+#
+# +-------------------------+ NS1
+# | test_team1 |
+# | + |
+# | eth0 | eth1 |
+# | +---+---+ |
+# | | | |
+# +-------------------------+
+# | |
+# +-------------------------+ NS2
+# | | | |
+# | +-------+ |
+# | eth0 | eth1 |
+# | + |
+# | test_team2 |
+# +-------------------------+
+
+ALL_TESTS="team_test_failover"
+
+test_dir="$(dirname "$0")"
+source "${test_dir}/../../../net/lib.sh"
+
+NS1=""
+NS2=""
+NODAD="nodad"
+PREFIX_LENGTH="64"
+NS1_IP="fd00::1"
+NS2_IP="fd00::2"
+NS1_IP4="192.168.0.1"
+NS2_IP4="192.168.0.2"
+MEMBERS=("eth0" "eth1")
+
+while getopts "4" opt; do
+ case $opt in
+ 4)
+ echo "IPv4 mode selected."
+ NODAD=
+ PREFIX_LENGTH="24"
+ NS1_IP="${NS1_IP4}"
+ NS2_IP="${NS2_IP4}"
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ esac
+done
+
+# This has to be sourced after opts are gathered... (because of the forwarding
+# lib)
+source "${test_dir}/team_lib.sh"
+
+# Create the network namespaces, veth pair, and team devices in the specified
+# mode.
+# Globals:
+# RET - Used by test infra, set by `check_err` functions.
+# Arguments:
+# mode - The team driver mode to use for the team devices.
+environment_create()
+{
+ trap cleanup_all_ns EXIT
+ setup_ns ns1 ns2
+ NS1="${NS_LIST[0]}"
+ NS2="${NS_LIST[1]}"
+
+ # Create the interfaces.
+ ip -n "${NS1}" link add eth0 type veth peer name eth0 netns "${NS2}"
+ ip -n "${NS1}" link add eth1 type veth peer name eth1 netns "${NS2}"
+ ip -n "${NS1}" link add test_team1 type team
+ ip -n "${NS2}" link add test_team2 type team
+
+ # Set up the receiving network namespace's team interface.
+ setup_team "${NS2}" test_team2 roundrobin "${NS2_IP}" \
+ "${PREFIX_LENGTH}" "${MEMBERS[@]}"
+}
+
+
+# Check that failover works for a specific team driver mode.
+# Globals:
+# RET - Used by test infra, set by `check_err` functions.
+# Arguments:
+# mode - The mode to set the team interfaces to.
+team_test_mode_failover()
+{
+ local mode="$1"
+ RET=0
+
+ # Set up the sender team with the correct mode.
+ echo "Members: ${MEMBERS[@]}"
+ setup_team "${NS1}" test_team1 "${mode}" "${NS1_IP}" \
+ "${PREFIX_LENGTH}" "${MEMBERS[@]}"
+ check_err $? "Failed to set up sender team"
+
+ start_listening_and_sending
+
+ ### Scenario 1: All interfaces initially enabled.
+ save_tcpdump_outputs "${NS2}" "${MEMBERS[@]}"
+ did_interface_receive eth0 "${NS2_IP}"
+ check_err $? "eth0 not transmitting when both links enabled"
+ did_interface_receive eth1 "${NS2_IP}"
+ check_err $? "eth1 not transmitting when both links enabled"
+
+ ### Scenario 2: One tx-side interface disabled.
+ ip netns exec "${NS1}" teamnl test_team1 setoption enabled false \
+ --port=eth0
+ slowwait 2 bash -c "ip netns exec ${NS1} teamnl test_team1 getoption \
+ enabled --port=eth0 | grep -q false"
+ save_tcpdump_outputs "${NS2}" "${MEMBERS[@]}"
+
+ did_interface_receive eth0 "${NS2_IP}"
+ check_fail $? "eth0 IS transmitting when disabled"
+ did_interface_receive eth1 "${NS2_IP}"
+ check_err $? "eth1 not transmitting when enabled"
+
+ ### Scenario 3: The interface is re-enabled.
+ ip netns exec "${NS1}" teamnl test_team1 setoption enabled true \
+ --port=eth0
+ slowwait 2 bash -c "ip netns exec ${NS1} teamnl test_team1 getoption \
+ enabled --port=eth0 | grep -q true"
+ save_tcpdump_outputs "${NS2}" "${MEMBERS[@]}"
+
+ did_interface_receive eth0 "${NS2_IP}"
+ check_err $? "eth0 not transmitting when both links enabled"
+ did_interface_receive eth1 "${NS2_IP}"
+ check_err $? "eth1 not transmitting when both links enabled"
+
+ log_test "Failover of '${mode}' test"
+
+ # Clean up
+ stop_sending_and_listening
+}
+
+team_test_failover()
+{
+ team_test_mode_failover broadcast
+ team_test_mode_failover roundrobin
+ team_test_mode_failover random
+ # Don't test `activebackup` or `loadbalance` modes, since they are too
+ # complicated for just setting `enabled` to work. They use more than
+ # the `enabled` option for transmit.
+}
+
+require_command teamnl nc pv
+environment_create
+tests_run
+exit "${EXIT_STATUS}"
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index a9034f0bb58b..5733f9437521 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1582,7 +1582,7 @@ declare -A cappid
declare -A capfile
declare -A capout
-tcpdump_start()
+tcpdump_start_nosleep()
{
local if_name=$1; shift
local ns=$1; shift
@@ -1606,16 +1606,25 @@ tcpdump_start()
-s 65535 -B 32768 $capuser -w ${capfile[$if_name]} \
> "${capout[$if_name]}" 2>&1 &
cappid[$if_name]=$!
+}
+tcpdump_start()
+{
+ tcpdump_start_nosleep $1 $2
sleep 1
}
-tcpdump_stop()
+tcpdump_stop_nosleep()
{
local if_name=$1
local pid=${cappid[$if_name]}
$ns_cmd kill "$pid" && wait "$pid"
+}
+
+tcpdump_stop()
+{
+ tcpdump_stop_nosleep $1
sleep 1
}
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 5/7] selftests: net: Add test for enablement of ports with teamd
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
` (3 preceding siblings ...)
2026-03-31 5:33 ` [PATCH net-next 4/7] selftests: net: Add tests for failover of team-aggregated ports Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 6/7] net: team: Decouple rx and tx enablement in the team driver Marc Harvey
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
There are no tests that verify enablement and disablement of team driver
ports with teamd. This should work even with changes to the enablement
option, so it is important to test.
This test sets up an active-backup network configuration across two
network namespaces, and tries to send traffic while changing which
link is the active one.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
.../selftests/drivers/net/team/Makefile | 1 +
.../drivers/net/team/teamd_activebackup.sh | 208 ++++++++++++++++++
tools/testing/selftests/net/lib.sh | 13 ++
3 files changed, 222 insertions(+)
create mode 100755 tools/testing/selftests/drivers/net/team/teamd_activebackup.sh
diff --git a/tools/testing/selftests/drivers/net/team/Makefile b/tools/testing/selftests/drivers/net/team/Makefile
index ed11edf07655..621c8eba2c32 100644
--- a/tools/testing/selftests/drivers/net/team/Makefile
+++ b/tools/testing/selftests/drivers/net/team/Makefile
@@ -7,6 +7,7 @@ TEST_PROGS := \
options.sh \
propagation.sh \
refleak.sh \
+ teamd_activebackup.sh \
transmit_failover.sh \
# end of TEST_PROGS
diff --git a/tools/testing/selftests/drivers/net/team/teamd_activebackup.sh b/tools/testing/selftests/drivers/net/team/teamd_activebackup.sh
new file mode 100755
index 000000000000..fe8a30a8d5e6
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/team/teamd_activebackup.sh
@@ -0,0 +1,208 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# These tests verify that teamd is able to enable and disable ports via the
+# active backup runner.
+#
+# Topology:
+#
+# +-------------------------+ NS1
+# | test_team1 |
+# | + |
+# | eth0 | eth1 |
+# | +---+---+ |
+# | | | |
+# +-------------------------+
+# | |
+# +-------------------------+ NS2
+# | | | |
+# | +-------+ |
+# | eth0 | eth1 |
+# | + |
+# | test_team2 |
+# +-------------------------+
+
+ALL_TESTS="teamd_test_active_backup"
+
+test_dir="$(dirname "$0")"
+source "${test_dir}/../../../net/lib.sh"
+
+NS1=""
+NS2=""
+NODAD="nodad"
+PREFIX_LENGTH="64"
+NS1_IP="fd00::1"
+NS2_IP="fd00::2"
+NS1_IP4="192.168.0.1"
+NS2_IP4="192.168.0.2"
+MEMBERS=("eth0" "eth1")
+NS1_TEAMD_CONF=""
+NS2_TEAMD_CONF=""
+
+while getopts "4" opt; do
+ case $opt in
+ 4)
+ echo "IPv4 mode selected."
+ NODAD=
+ PREFIX_LENGTH="24"
+ NS1_IP="${NS1_IP4}"
+ NS2_IP="${NS2_IP4}"
+ ;;
+ \?)
+ echo "Invalid option: -${OPTARG}" >&2
+ exit 1
+ ;;
+ esac
+done
+
+# This has to be sourced after opts are gathered... (because of the forwarding
+# lib)
+source "${test_dir}/team_lib.sh"
+
+teamd_config_create()
+{
+ local runner=$1
+ local dev=$2
+ local conf
+
+ conf=$(mktemp)
+
+ cat > $conf <<-EOF
+ {
+ "device": "${dev}",
+ "runner": {"name": "${runner}"},
+ "ports": {
+ "eth0": {},
+ "eth1": {}
+ }
+ }
+ EOF
+ echo $conf
+}
+
+# Create the network namespaces, veth pair, and team devices in the specified
+# runner.
+# Globals:
+# RET - Used by test infra, set by `check_err` functions.
+# Arguments:
+# runner - The Teamd runner to use for the Team devices.
+environment_create()
+{
+ local runner=$1
+
+ echo "Setting up two-link aggregation for runner ${runner}"
+ trap environment_destroy EXIT
+
+ setup_ns ns1 ns2
+ NS1="${NS_LIST[0]}"
+ NS2="${NS_LIST[1]}"
+
+ for link in $(seq 0 1); do
+ ip -n "${NS1}" link add "eth${link}" type veth peer name \
+ "eth${link}" netns "${NS2}"
+ check_err $? "Failed to create veth pair"
+ done
+
+ NS1_TEAMD_CONF=$(teamd_config_create "${runner}" "test_team1")
+ NS2_TEAMD_CONF=$(teamd_config_create "${runner}" "test_team2")
+ echo "Conf files are ${NS1_TEAMD_CONF} and ${NS2_TEAMD_CONF}"
+
+ ip netns exec "${NS1}" teamd -d -f "${NS1_TEAMD_CONF}"
+ check_err $? "Failed to create team device in ${NS1}"
+ ip netns exec "${NS2}" teamd -d -f "${NS2_TEAMD_CONF}"
+ check_err $? "Failed to create team device in ${NS2}"
+ echo "Created team devices"
+
+ rm "${NS1_TEAMD_CONF}"
+ rm "${NS2_TEAMD_CONF}"
+ NS1_TEAMD_CONF=""
+ NS2_TEAMD_CONF=""
+
+ for link in $(seq 0 1); do
+ in_all_ns "ip link set eth${link} up"
+ check_err $? "Failed to set eth${link} up"
+ done
+
+ ip -n "${NS1}" link set test_team1 up
+ check_err $? "Failed to set test_team1 up in ${NS1}"
+ ip -n "${NS2}" link set test_team2 up
+ check_err $? "Failed to set test_team2 up in ${NS2}"
+
+ ip -n "${NS1}" addr add "${NS1_IP}/${PREFIX_LENGTH}" dev test_team1
+ check_err $? "Failed to add address to team device in ${NS1}"
+ ip -n "${NS2}" addr add "${NS2_IP}/${PREFIX_LENGTH}" dev test_team2
+ check_err $? "Failed to add address to team device in ${NS2}"
+
+ slowwait 2 timeout 0.5 ip netns exec "${NS1}" ping -W 1 -c 1 "${NS2_IP}"
+}
+
+# Tear down the environment: kill teamd and delete network namespaces.
+environment_destroy()
+{
+ echo "Tearing down two-link aggregation"
+ ip netns exec "${NS1}" teamd -k -t test_team1
+ ip netns exec "${NS2}" teamd -k -t test_team2
+ cleanup_all_ns
+}
+
+# Change the active port for an active-backup mode team.
+# Arguments:
+# namespace - The network namespace that the team is in.
+# team - The name of the team.
+# active_port - The port to make active.
+set_active_port()
+{
+ local namespace=$1
+ local team=$2
+ local active_port=$3
+
+ ip netns exec "${namespace}" teamdctl "${team}" state item set \
+ runner.active_port "${active_port}"
+ slowwait 2 bash -c "ip netns exec ${namespace} teamdctl ${team} state \
+ item get runner.active_port | grep -q ${active_port}"
+}
+
+# Test that active backup runner can change active ports.
+# Globals:
+# RET - Used by test infra, set by `check_err` functions.
+teamd_test_active_backup()
+{
+ RET=0
+
+ start_listening_and_sending
+
+ ### Scenario 1: Don't manually set active port, just make sure team
+ # works.
+ save_tcpdump_outputs "${NS2}" test_team2
+ did_interface_receive test_team2 "${NS2_IP}"
+ check_err $? "Traffic did not reach team interface in NS2."
+
+ ### Scenario 2: Choose active port.
+ set_active_port "${NS1}" test_team1 eth1
+ set_active_port "${NS2}" test_team2 eth1
+ save_tcpdump_outputs "${NS2}" "${MEMBERS[@]}"
+
+ did_interface_receive eth0 "${NS2_IP}"
+ check_fail $? "eth0 IS transmitting when disabled"
+ did_interface_receive eth1 "${NS2_IP}"
+ check_err $? "eth1 not transmitting when enabled"
+
+ ### Scenario 3: Change active port.
+ set_active_port "${NS1}" test_team1 eth0
+ set_active_port "${NS2}" test_team2 eth0
+ save_tcpdump_outputs "${NS2}" "${MEMBERS[@]}"
+
+ did_interface_receive eth0 "${NS2_IP}"
+ check_err $? "eth0 not transmitting when enabled"
+ did_interface_receive eth1 "${NS2_IP}"
+ check_fail $? "eth1 IS transmitting when disabled"
+
+ log_test "teamd active backup runner test"
+
+ stop_sending_and_listening
+}
+
+require_command teamd teamdctl nc pv
+environment_create activebackup
+tests_run
+exit "${EXIT_STATUS}"
diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
index b40694573f4c..992342b1dd7c 100644
--- a/tools/testing/selftests/net/lib.sh
+++ b/tools/testing/selftests/net/lib.sh
@@ -224,6 +224,19 @@ setup_ns()
NS_LIST+=("${ns_list[@]}")
}
+in_all_ns()
+{
+ local ret=0
+ local ns_list=("${NS_LIST[@]}")
+
+ for ns in "${ns_list[@]}"; do
+ ip netns exec "${ns}" bash -c "$@"
+ (( ret = ret || $? ))
+ done
+
+ return "${ret}"
+}
+
# Create netdevsim with given id and net namespace.
create_netdevsim() {
local id="$1"
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 6/7] net: team: Decouple rx and tx enablement in the team driver
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
` (4 preceding siblings ...)
2026-03-31 5:33 ` [PATCH net-next 5/7] selftests: net: Add test for enablement of ports with teamd Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 5:33 ` [PATCH net-next 7/7] selftests: net: Add tests for team driver decoupled tx and rx control Marc Harvey
2026-03-31 17:33 ` [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Jakub Kicinski
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
There are use cases where an aggregated port should send traffic, but
not receive traffic, and vice versa. For example, in the IEEE
802.3ad-2000 specification, there is an optional "Independent Control"
version of the mux machine. Currently there is no way create
implementations like this for the team driver.
Separate the existing "enabled" per-port option into tx and rx
specific enablement options, but do so without breaking the existing
"enabled" option. The existing "enabled" option is now defined as
(rx_enabled AND tx_enabled), so if one is independently disabled, then
the old "enabled" option will also not be enabled. However, setting
the old "enabled" option affects both the rx_enabled and tx_enabled
options. This is the first case where setting an option can affect
another option.
Note that teamd and any other software that exclusively uses "coupled"
enablement will continue to work without any changes.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
drivers/net/team/team_core.c | 238 +++++++++++++++++++----
drivers/net/team/team_mode_loadbalance.c | 4 +-
drivers/net/team/team_mode_random.c | 4 +-
drivers/net/team/team_mode_roundrobin.c | 2 +-
include/linux/if_team.h | 60 +++---
5 files changed, 245 insertions(+), 63 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index 2ce31999c99f..308ff7cd4b15 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -87,7 +87,7 @@ static void team_lower_state_changed(struct team_port *port)
struct netdev_lag_lower_state_info info;
info.link_up = port->linkup;
- info.tx_enabled = team_port_enabled(port);
+ info.tx_enabled = team_port_tx_enabled(port);
netdev_lower_state_changed(port->dev, &info);
}
@@ -532,13 +532,13 @@ static void team_adjust_ops(struct team *team)
* correct ops are always set.
*/
- if (!team->en_port_count || !team_is_mode_set(team) ||
+ if (!team->tx_en_port_count || !team_is_mode_set(team) ||
!team->mode->ops->transmit)
team->ops.transmit = team_dummy_transmit;
else
team->ops.transmit = team->mode->ops->transmit;
- if (!team->en_port_count || !team_is_mode_set(team) ||
+ if (!team->rx_en_port_count || !team_is_mode_set(team) ||
!team->mode->ops->receive)
team->ops.receive = team_dummy_receive;
else
@@ -734,7 +734,7 @@ static rx_handler_result_t team_handle_frame(struct sk_buff **pskb)
port = team_port_get_rcu(skb->dev);
team = port->team;
- if (!team_port_enabled(port)) {
+ if (!team_port_rx_enabled(port)) {
if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
/* link-local packets are mostly useful when stack receives them
* with the link they arrive on.
@@ -831,7 +831,7 @@ static bool team_queue_override_port_has_gt_prio_than(struct team_port *port,
return true;
if (port->priority > cur->priority)
return false;
- if (port->index < cur->index)
+ if (port->tx_index < cur->tx_index)
return true;
return false;
}
@@ -876,7 +876,7 @@ static void __team_queue_override_enabled_check(struct team *team)
static void team_queue_override_port_prio_changed(struct team *team,
struct team_port *port)
{
- if (!port->queue_id || !team_port_enabled(port))
+ if (!port->queue_id || !team_port_tx_enabled(port))
return;
__team_queue_override_port_del(team, port);
__team_queue_override_port_add(team, port);
@@ -887,7 +887,7 @@ static void team_queue_override_port_change_queue_id(struct team *team,
struct team_port *port,
u16 new_queue_id)
{
- if (team_port_enabled(port)) {
+ if (team_port_tx_enabled(port)) {
__team_queue_override_port_del(team, port);
port->queue_id = new_queue_id;
__team_queue_override_port_add(team, port);
@@ -927,58 +927,172 @@ static bool team_port_find(const struct team *team,
return false;
}
+static void __team_port_enable_rx(struct team *team,
+ struct team_port *port)
+{
+ team->rx_en_port_count++;
+ WRITE_ONCE(port->rx_enabled, true);
+}
+
+static void __team_port_disable_rx(struct team *team,
+ struct team_port *port)
+{
+ team->rx_en_port_count--;
+ WRITE_ONCE(port->rx_enabled, false);
+}
+
+static void team_port_enable_rx(struct team *team,
+ struct team_port *port)
+{
+ if (team_port_rx_enabled(port))
+ return;
+
+ __team_port_enable_rx(team, port);
+
+ team_adjust_ops(team);
+
+ team_notify_peers(team);
+ team_mcast_rejoin(team);
+}
+
+static void team_port_disable_rx(struct team *team,
+ struct team_port *port)
+{
+ if (!team_port_rx_enabled(port))
+ return;
+
+ __team_port_disable_rx(team, port);
+ team_adjust_ops(team);
+}
+
+/*
+ * Enable just TX on the port by adding to tx-enabled port hashlist and
+ * setting port->tx_index (Might be racy so reader could see incorrect
+ * ifindex when processing a flying packet, but that is not a problem).
+ * Write guarded by RTNL.
+ */
+static void __team_port_enable_tx(struct team *team,
+ struct team_port *port)
+{
+ WRITE_ONCE(port->tx_index, team->tx_en_port_count);
+ WRITE_ONCE(team->tx_en_port_count, team->tx_en_port_count + 1);
+ hlist_add_head_rcu(&port->tx_hlist,
+ team_tx_port_index_hash(team, port->tx_index));
+}
+
+static void team_port_enable_tx(struct team *team,
+ struct team_port *port)
+{
+ if (team_port_tx_enabled(port))
+ return;
+
+ __team_port_enable_tx(team, port);
+ team_adjust_ops(team);
+ team_queue_override_port_add(team, port);
+
+ /* Don't rejoin multicast, since this port might not be receiving. */
+ team_notify_peers(team);
+ team_lower_state_changed(port);
+}
+
/*
- * Enable/disable port by adding to enabled port hashlist and setting
- * port->index (Might be racy so reader could see incorrect ifindex when
- * processing a flying packet, but that is not a problem). Write guarded
- * by RTNL.
+ * Enable TX AND RX on the port.
*/
static void team_port_enable(struct team *team,
struct team_port *port)
{
+ bool rx_was_enabled;
+ bool tx_was_enabled;
+
if (team_port_enabled(port))
return;
- WRITE_ONCE(port->index, team->en_port_count);
- WRITE_ONCE(team->en_port_count, team->en_port_count + 1);
- hlist_add_head_rcu(&port->hlist,
- team_port_index_hash(team, port->index));
+
+ rx_was_enabled = team_port_rx_enabled(port);
+ tx_was_enabled = team_port_tx_enabled(port);
+
+ if (!rx_was_enabled)
+ __team_port_enable_rx(team, port);
+ if (!tx_was_enabled) {
+ __team_port_enable_tx(team, port);
+ team_queue_override_port_add(team, port);
+ }
+
team_adjust_ops(team);
- team_queue_override_port_add(team, port);
team_notify_peers(team);
- team_mcast_rejoin(team);
- team_lower_state_changed(port);
+
+ if (!rx_was_enabled)
+ team_mcast_rejoin(team);
+ if (!tx_was_enabled)
+ team_lower_state_changed(port);
}
static void __reconstruct_port_hlist(struct team *team, int rm_index)
{
- int i;
+ struct hlist_head *tx_port_index_hash;
struct team_port *port;
+ int i;
- for (i = rm_index + 1; i < team->en_port_count; i++) {
- port = team_get_port_by_index(team, i);
- hlist_del_rcu(&port->hlist);
- WRITE_ONCE(port->index, port->index - 1);
- hlist_add_head_rcu(&port->hlist,
- team_port_index_hash(team, port->index));
+ for (i = rm_index + 1; i < team->tx_en_port_count; i++) {
+ port = team_get_port_by_tx_index(team, i);
+ hlist_del_rcu(&port->tx_hlist);
+ WRITE_ONCE(port->tx_index, port->tx_index - 1);
+ tx_port_index_hash = team_tx_port_index_hash(team,
+ port->tx_index);
+ hlist_add_head_rcu(&port->tx_hlist, tx_port_index_hash);
}
}
-static void team_port_disable(struct team *team,
- struct team_port *port)
+static void __team_port_disable_tx(struct team *team,
+ struct team_port *port)
{
- if (!team_port_enabled(port))
- return;
if (team->ops.port_tx_disabled)
team->ops.port_tx_disabled(team, port);
- hlist_del_rcu(&port->hlist);
- __reconstruct_port_hlist(team, port->index);
- WRITE_ONCE(port->index, -1);
- WRITE_ONCE(team->en_port_count, team->en_port_count - 1);
+
+ hlist_del_rcu(&port->tx_hlist);
+ __reconstruct_port_hlist(team, port->tx_index);
+
+ WRITE_ONCE(port->tx_index, -1);
+ WRITE_ONCE(team->tx_en_port_count, team->tx_en_port_count - 1);
+}
+
+static void team_port_disable_tx(struct team *team,
+ struct team_port *port)
+{
+ if (!team_port_tx_enabled(port))
+ return;
+
+ __team_port_disable_tx(team, port);
+
team_queue_override_port_del(team, port);
team_adjust_ops(team);
team_lower_state_changed(port);
}
+static void team_port_disable(struct team *team,
+ struct team_port *port)
+{
+ bool rx_was_enabled;
+ bool tx_was_enabled;
+
+ if (!team_port_tx_enabled(port) && !team_port_rx_enabled(port))
+ return;
+
+ rx_was_enabled = team_port_rx_enabled(port);
+ tx_was_enabled = team_port_tx_enabled(port);
+
+ if (tx_was_enabled) {
+ __team_port_disable_tx(team, port);
+ team_queue_override_port_del(team, port);
+ }
+ if (rx_was_enabled)
+ __team_port_disable_rx(team, port);
+
+ team_adjust_ops(team);
+
+ if (tx_was_enabled)
+ team_lower_state_changed(port);
+}
+
static int team_port_enter(struct team *team, struct team_port *port)
{
int err = 0;
@@ -1244,7 +1358,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
netif_addr_unlock_bh(dev);
}
- WRITE_ONCE(port->index, -1);
+ WRITE_ONCE(port->tx_index, -1);
list_add_tail_rcu(&port->list, &team->port_list);
team_port_enable(team, port);
netdev_compute_master_upper_features(dev, true);
@@ -1429,6 +1543,46 @@ static int team_port_en_option_set(struct team *team,
return 0;
}
+static void team_port_tx_en_option_get(struct team *team,
+ struct team_gsetter_ctx *ctx)
+{
+ struct team_port *port = ctx->info->port;
+
+ ctx->data.bool_val = team_port_tx_enabled(port);
+}
+
+static int team_port_tx_en_option_set(struct team *team,
+ struct team_gsetter_ctx *ctx)
+{
+ struct team_port *port = ctx->info->port;
+
+ if (ctx->data.bool_val)
+ team_port_enable_tx(team, port);
+ else
+ team_port_disable_tx(team, port);
+ return 0;
+}
+
+static void team_port_rx_en_option_get(struct team *team,
+ struct team_gsetter_ctx *ctx)
+{
+ struct team_port *port = ctx->info->port;
+
+ ctx->data.bool_val = team_port_rx_enabled(port);
+}
+
+static int team_port_rx_en_option_set(struct team *team,
+ struct team_gsetter_ctx *ctx)
+{
+ struct team_port *port = ctx->info->port;
+
+ if (ctx->data.bool_val)
+ team_port_enable_rx(team, port);
+ else
+ team_port_disable_rx(team, port);
+ return 0;
+}
+
static void team_user_linkup_option_get(struct team *team,
struct team_gsetter_ctx *ctx)
{
@@ -1550,6 +1704,20 @@ static const struct team_option team_options[] = {
.getter = team_port_en_option_get,
.setter = team_port_en_option_set,
},
+ {
+ .name = "tx_enabled",
+ .type = TEAM_OPTION_TYPE_BOOL,
+ .per_port = true,
+ .getter = team_port_tx_en_option_get,
+ .setter = team_port_tx_en_option_set,
+ },
+ {
+ .name = "rx_enabled",
+ .type = TEAM_OPTION_TYPE_BOOL,
+ .per_port = true,
+ .getter = team_port_rx_en_option_get,
+ .setter = team_port_rx_en_option_set,
+ },
{
.name = "user_linkup",
.type = TEAM_OPTION_TYPE_BOOL,
@@ -1595,7 +1763,7 @@ static int team_init(struct net_device *dev)
return -ENOMEM;
for (i = 0; i < TEAM_PORT_HASHENTRIES; i++)
- INIT_HLIST_HEAD(&team->en_port_hlist[i]);
+ INIT_HLIST_HEAD(&team->tx_en_port_hlist[i]);
INIT_LIST_HEAD(&team->port_list);
err = team_queue_override_init(team);
if (err)
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 840f409d250b..38a459649569 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -120,7 +120,7 @@ static struct team_port *lb_hash_select_tx_port(struct team *team,
{
int port_index = team_num_to_port_index(team, hash);
- return team_get_port_by_index_rcu(team, port_index);
+ return team_get_port_by_tx_index_rcu(team, port_index);
}
/* Hash to port mapping select tx port */
@@ -380,7 +380,7 @@ static int lb_tx_hash_to_port_mapping_set(struct team *team,
list_for_each_entry(port, &team->port_list, list) {
if (ctx->data.u32_val == port->dev->ifindex &&
- team_port_enabled(port)) {
+ team_port_tx_enabled(port)) {
rcu_assign_pointer(LB_HTPM_PORT_BY_HASH(lb_priv, hash),
port);
return 0;
diff --git a/drivers/net/team/team_mode_random.c b/drivers/net/team/team_mode_random.c
index 169a7bc865b2..370e974f3dca 100644
--- a/drivers/net/team/team_mode_random.c
+++ b/drivers/net/team/team_mode_random.c
@@ -16,8 +16,8 @@ static bool rnd_transmit(struct team *team, struct sk_buff *skb)
struct team_port *port;
int port_index;
- port_index = get_random_u32_below(READ_ONCE(team->en_port_count));
- port = team_get_port_by_index_rcu(team, port_index);
+ port_index = get_random_u32_below(READ_ONCE(team->tx_en_port_count));
+ port = team_get_port_by_tx_index_rcu(team, port_index);
if (unlikely(!port))
goto drop;
port = team_get_first_port_txable_rcu(team, port);
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c
index dd405d82c6ac..ecbeef28c221 100644
--- a/drivers/net/team/team_mode_roundrobin.c
+++ b/drivers/net/team/team_mode_roundrobin.c
@@ -27,7 +27,7 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb)
port_index = team_num_to_port_index(team,
rr_priv(team)->sent_packets++);
- port = team_get_port_by_index_rcu(team, port_index);
+ port = team_get_port_by_tx_index_rcu(team, port_index);
if (unlikely(!port))
goto drop;
port = team_get_first_port_txable_rcu(team, port);
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 740cb3100dfc..3d21e06fda67 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -27,10 +27,11 @@ struct team;
struct team_port {
struct net_device *dev;
- struct hlist_node hlist; /* node in enabled ports hash list */
+ struct hlist_node tx_hlist; /* node in tx-enabled ports hash list */
struct list_head list; /* node in ordinary list */
struct team *team;
- int index; /* index of enabled port. If disabled, it's set to -1 */
+ int tx_index; /* index of tx enabled port. If disabled, -1 */
+ bool rx_enabled;
bool linkup; /* either state.linkup or user.linkup */
@@ -75,14 +76,24 @@ static inline struct team_port *team_port_get_rcu(const struct net_device *dev)
return rcu_dereference(dev->rx_handler_data);
}
+static inline bool team_port_rx_enabled(struct team_port *port)
+{
+ return READ_ONCE(port->rx_enabled);
+}
+
+static inline bool team_port_tx_enabled(struct team_port *port)
+{
+ return READ_ONCE(port->tx_index) != -1;
+}
+
static inline bool team_port_enabled(struct team_port *port)
{
- return READ_ONCE(port->index) != -1;
+ return team_port_rx_enabled(port) && team_port_tx_enabled(port);
}
static inline bool team_port_txable(struct team_port *port)
{
- return port->linkup && team_port_enabled(port);
+ return port->linkup && team_port_tx_enabled(port);
}
static inline bool team_port_dev_txable(const struct net_device *port_dev)
@@ -190,10 +201,11 @@ struct team {
const struct header_ops *header_ops_cache;
/*
- * List of enabled ports and their count
+ * List of tx-enabled ports and counts of rx and tx-enabled ports.
*/
- int en_port_count;
- struct hlist_head en_port_hlist[TEAM_PORT_HASHENTRIES];
+ int tx_en_port_count;
+ int rx_en_port_count;
+ struct hlist_head tx_en_port_hlist[TEAM_PORT_HASHENTRIES];
struct list_head port_list; /* list of all ports */
@@ -237,41 +249,43 @@ static inline int team_dev_queue_xmit(struct team *team, struct team_port *port,
return dev_queue_xmit(skb);
}
-static inline struct hlist_head *team_port_index_hash(struct team *team,
- int port_index)
+static inline struct hlist_head *team_tx_port_index_hash(struct team *team,
+ int tx_port_index)
{
- return &team->en_port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
+ unsigned int list_entry = tx_port_index & (TEAM_PORT_HASHENTRIES - 1);
+
+ return &team->tx_en_port_hlist[list_entry];
}
-static inline struct team_port *team_get_port_by_index(struct team *team,
- int port_index)
+static inline struct team_port *team_get_port_by_tx_index(struct team *team,
+ int tx_port_index)
{
+ struct hlist_head *head = team_tx_port_index_hash(team, tx_port_index);
struct team_port *port;
- struct hlist_head *head = team_port_index_hash(team, port_index);
- hlist_for_each_entry(port, head, hlist)
- if (port->index == port_index)
+ hlist_for_each_entry(port, head, tx_hlist)
+ if (port->tx_index == tx_port_index)
return port;
return NULL;
}
static inline int team_num_to_port_index(struct team *team, unsigned int num)
{
- int en_port_count = READ_ONCE(team->en_port_count);
+ int tx_en_port_count = READ_ONCE(team->tx_en_port_count);
- if (unlikely(!en_port_count))
+ if (unlikely(!tx_en_port_count))
return 0;
- return num % en_port_count;
+ return num % tx_en_port_count;
}
-static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
- int port_index)
+static inline struct team_port *team_get_port_by_tx_index_rcu(struct team *team,
+ int tx_port_index)
{
+ struct hlist_head *head = team_tx_port_index_hash(team, tx_port_index);
struct team_port *port;
- struct hlist_head *head = team_port_index_hash(team, port_index);
- hlist_for_each_entry_rcu(port, head, hlist)
- if (READ_ONCE(port->index) == port_index)
+ hlist_for_each_entry_rcu(port, head, tx_hlist)
+ if (READ_ONCE(port->tx_index) == tx_port_index)
return port;
return NULL;
}
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 7/7] selftests: net: Add tests for team driver decoupled tx and rx control
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
` (5 preceding siblings ...)
2026-03-31 5:33 ` [PATCH net-next 6/7] net: team: Decouple rx and tx enablement in the team driver Marc Harvey
@ 2026-03-31 5:33 ` Marc Harvey
2026-03-31 17:33 ` [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Jakub Kicinski
7 siblings, 0 replies; 11+ messages in thread
From: Marc Harvey @ 2026-03-31 5:33 UTC (permalink / raw)
To: jiri, andrew+netdev
Cc: willemb, maheshb, netdev, linux-kselftest, Marc Harvey
Use ping and tcpdump to verify that independent rx and tx enablement
of team driver member interfaces works as intended.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
.../selftests/drivers/net/team/Makefile | 1 +
.../drivers/net/team/decoupled_enablement.sh | 200 ++++++++++++++++++
.../selftests/drivers/net/team/options.sh | 96 +++++++++
.../selftests/drivers/net/team/team_lib.sh | 16 ++
4 files changed, 313 insertions(+)
create mode 100755 tools/testing/selftests/drivers/net/team/decoupled_enablement.sh
diff --git a/tools/testing/selftests/drivers/net/team/Makefile b/tools/testing/selftests/drivers/net/team/Makefile
index 621c8eba2c32..e46460820e13 100644
--- a/tools/testing/selftests/drivers/net/team/Makefile
+++ b/tools/testing/selftests/drivers/net/team/Makefile
@@ -2,6 +2,7 @@
# Makefile for net selftests
TEST_PROGS := \
+ decoupled_enablement.sh \
dev_addr_lists.sh \
non_ether_header_ops.sh \
options.sh \
diff --git a/tools/testing/selftests/drivers/net/team/decoupled_enablement.sh b/tools/testing/selftests/drivers/net/team/decoupled_enablement.sh
new file mode 100755
index 000000000000..23ea2cf666b1
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/team/decoupled_enablement.sh
@@ -0,0 +1,200 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# These tests verify the decoupled RX and TX enablement of team driver member
+# interfaces.
+#
+# Topology
+#
+# +---------------------+ NS1
+# | test_team1 |
+# | | |
+# | eth0 |
+# | | |
+# | | |
+# +---------------------+
+# |
+# +---------------------+ NS2
+# | | |
+# | | |
+# | eth0 |
+# | | |
+# | test_team2 |
+# +---------------------+
+
+ALL_TESTS="
+ team_test_tx_enablement
+ team_test_rx_enablement
+"
+
+test_dir="$(dirname "$0")"
+source "${test_dir}/../../../net/lib.sh"
+
+NS1=""
+NS2=""
+NODAD="nodad"
+PREFIX_LENGTH="64"
+NS1_IP="fd00::1"
+NS2_IP="fd00::2"
+NS1_IP4="192.168.0.1"
+NS2_IP4="192.168.0.2"
+MEMBERS=("eth0")
+PING_COUNT=5
+PING_TIMEOUT_S=1
+PING_INTERVAL=0.1
+
+while getopts "4" opt; do
+ case $opt in
+ 4)
+ echo "IPv4 mode selected."
+ NODAD=
+ PREFIX_LENGTH="24"
+ NS1_IP="${NS1_IP4}"
+ NS2_IP="${NS2_IP4}"
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ esac
+done
+
+# This has to be sourced after opts are gathered... (because of the forwarding
+# lib)
+source "${test_dir}/team_lib.sh"
+
+# Create the network namespaces, veth pair, and team devices in the specified
+# mode.
+# Globals:
+# RET - Used by test infra, set by `check_err` functions.
+# Arguments:
+# mode - The team driver mode to use for the team devices.
+environment_create()
+{
+ trap cleanup_all_ns EXIT
+ setup_ns ns1 ns2
+ NS1="${NS_LIST[0]}"
+ NS2="${NS_LIST[1]}"
+
+ # Create the interfaces.
+ ip -n "${NS1}" link add eth0 type veth peer name eth0 netns "${NS2}"
+ ip -n "${NS1}" link add test_team1 type team
+ ip -n "${NS2}" link add test_team2 type team
+
+ # Set up the receiving network namespace's team interface.
+ setup_team "${NS2}" test_team2 roundrobin "${NS2_IP}" \
+ "${PREFIX_LENGTH}" "${MEMBERS[@]}"
+}
+
+set_option_value()
+{
+ local namespace="$1"
+ local option_name="$2"
+ local option_value="$3"
+ local team_name="$4"
+ local member_name="$5"
+ local port_flag="--port=${member_name}"
+
+ ip netns exec "${namespace}" teamnl "${team_name}" setoption \
+ "${option_name}" "${option_value}" "${port_flag}"
+ return $?
+}
+
+try_ping()
+{
+ ip netns exec "${NS1}" ping -i "${PING_INTERVAL}" -c "${PING_COUNT}" \
+ "${NS2_IP}" -W "${PING_TIMEOUT_S}"
+}
+
+team_test_mode_tx_enablement()
+{
+ local mode="$1"
+ RET=0
+
+ # Set up the sender team with the correct mode.
+ setup_team "${NS1}" test_team1 "${mode}" "${NS1_IP}" \
+ "${PREFIX_LENGTH}" "${MEMBERS[@]}"
+ check_err $? "Failed to set up sender team"
+
+ ### Scenario 1: Member interface initially enabled.
+ # Expect ping to pass
+ try_ping
+ check_err $? "Ping failed when TX enabled"
+
+ ### Scenario 2: Once tx-side interface disabled.
+ # Expect ping to fail.
+ set_option_value "${NS1}" tx_enabled false test_team1 eth0
+ check_err $? "Failed to disable TX"
+ tcpdump_start eth0 "${NS2}"
+ try_ping
+ check_fail $? "Ping succeeded when TX disabled"
+ tcpdump_stop eth0
+ # Expect no packets to be transmitted, since TX is disabled.
+ did_interface_receive_icmp eth0 "${NS2_IP}"
+ check_fail $? "eth0 IS transmitting when TX disabled"
+
+ ### Scenario 3: The interface has tx re-enabled.
+ # Expect ping to pass.
+ set_option_value "${NS1}" tx_enabled true test_team1 eth0
+ check_err $? "Failed to reenable TX"
+ try_ping
+ check_err $? "Ping failed when TX reenabled"
+
+ log_test "TX failover of '${mode}' test"
+}
+
+team_test_mode_rx_enablement()
+{
+ local mode="$1"
+ RET=0
+
+ # Set up the sender team with the correct mode.
+ setup_team "${NS1}" test_team1 "${mode}" "${NS1_IP}" \
+ "${PREFIX_LENGTH}" "${MEMBERS[@]}"
+ check_err $? "Failed to set up sender team"
+
+ ### Scenario 1: Member interface initially enabled.
+ # Expect ping to pass
+ try_ping
+ check_err $? "Ping failed when RX enabled"
+
+ ### Scenario 2: Once rx-side interface disabled.
+ # Expect ping to fail.
+ set_option_value "${NS1}" rx_enabled false test_team1 eth0
+ check_err $? "Failed to disable RX"
+ tcpdump_start eth0 "${NS2}"
+ try_ping
+ check_fail $? "Ping succeeded when RX disabled"
+ tcpdump_stop eth0
+ # Expect packets to be transmitted, since only RX is disabled.
+ did_interface_receive_icmp eth0 "${NS2_IP}"
+ check_err $? "eth0 not transmitting when RX disabled"
+
+ ### Scenario 3: The interface has tx re-enabled.
+ # Expect ping to pass.
+ set_option_value "${NS1}" rx_enabled true test_team1 eth0
+ check_err $? "Failed to reenable RX"
+ try_ping
+ check_err $? "Ping failed when RX reenabled"
+
+ log_test "RX failover of '${mode}' test"
+}
+
+team_test_tx_enablement()
+{
+ team_test_mode_tx_enablement broadcast
+ team_test_mode_tx_enablement roundrobin
+ team_test_mode_tx_enablement random
+}
+
+team_test_rx_enablement()
+{
+ team_test_mode_rx_enablement broadcast
+ team_test_mode_rx_enablement roundrobin
+ team_test_mode_rx_enablement random
+}
+
+require_command teamnl ping pv
+environment_create
+tests_run
+exit "${EXIT_STATUS}"
diff --git a/tools/testing/selftests/drivers/net/team/options.sh b/tools/testing/selftests/drivers/net/team/options.sh
index 44888f32b513..75ebfe9f8d95 100755
--- a/tools/testing/selftests/drivers/net/team/options.sh
+++ b/tools/testing/selftests/drivers/net/team/options.sh
@@ -13,6 +13,9 @@ fi
ALL_TESTS="
team_test_options
+ team_test_enabled_implicit_changes
+ team_test_rx_enabled_implicit_changes
+ team_test_tx_enabled_implicit_changes
"
source "${test_dir}/../../../net/lib.sh"
@@ -176,12 +179,105 @@ team_test_options()
team_test_option mcast_rejoin_count 0 5
team_test_option mcast_rejoin_interval 0 5
team_test_option enabled true false "${MEMBER_PORT}"
+ team_test_option rx_enabled true false "${MEMBER_PORT}"
+ team_test_option tx_enabled true false "${MEMBER_PORT}"
team_test_option user_linkup true false "${MEMBER_PORT}"
team_test_option user_linkup_enabled true false "${MEMBER_PORT}"
team_test_option priority 10 20 "${MEMBER_PORT}"
team_test_option queue_id 0 1 "${MEMBER_PORT}"
}
+team_test_enabled_implicit_changes()
+{
+ RET=0
+
+ attach_port_if_specified "${MEMBER_PORT}"
+ check_err $? "Couldn't attach ${MEMBER_PORT} to master"
+
+ # Set enabled to true.
+ set_and_check_get enabled true "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'enabled' to true"
+
+ # Show that both rx enabled and tx enabled are true.
+ get_and_check_value rx_enabled true "--port=${MEMBER_PORT}"
+ check_err $? "'Rx_enabled' wasn't implicitly set to true"
+ get_and_check_value tx_enabled true "--port=${MEMBER_PORT}"
+ check_err $? "'Tx_enabled' wasn't implicitly set to true"
+
+ # Set enabled to false.
+ set_and_check_get enabled false "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'enabled' to true"
+
+ # Show that both rx enabled and tx enabled are false.
+ get_and_check_value rx_enabled false "--port=${MEMBER_PORT}"
+ check_err $? "'Rx_enabled' wasn't implicitly set to true"
+ get_and_check_value tx_enabled false "--port=${MEMBER_PORT}"
+ check_err $? "'Tx_enabled' wasn't implicitly set to true"
+
+ log_test "'Enabled' implicit changes"
+}
+
+team_test_rx_enabled_implicit_changes()
+{
+ RET=0
+
+ attach_port_if_specified "${MEMBER_PORT}"
+ check_err $? "Couldn't attach ${MEMBER_PORT} to master"
+
+ # Set enabled to true.
+ set_and_check_get enabled true "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'enabled' to true"
+
+ # Set rx_enabled to false.
+ set_and_check_get rx_enabled false "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'rx_enabled' to false"
+
+ # Show that enabled is false.
+ get_and_check_value enabled false "--port=${MEMBER_PORT}"
+ check_err $? "'enabled' wasn't implicitly set to false"
+
+ # Set rx_enabled to true.
+ set_and_check_get rx_enabled true "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'rx_enabled' to true"
+
+ # Show that enabled is true.
+ get_and_check_value enabled true "--port=${MEMBER_PORT}"
+ check_err $? "'enabled' wasn't implicitly set to true"
+
+ log_test "'Rx_enabled' implicit changes"
+}
+
+team_test_tx_enabled_implicit_changes()
+{
+ RET=0
+
+ attach_port_if_specified "${MEMBER_PORT}"
+ check_err $? "Couldn't attach ${MEMBER_PORT} to master"
+
+ # Set enabled to true.
+ set_and_check_get enabled true "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'enabled' to true"
+
+ # Set tx_enabled to false.
+ set_and_check_get tx_enabled false "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'tx_enabled' to false"
+
+ # Show that enabled is false.
+ get_and_check_value enabled false "--port=${MEMBER_PORT}"
+ check_err $? "'enabled' wasn't implicitly set to false"
+
+ # Set tx_enabled to true.
+ set_and_check_get tx_enabled true "--port=${MEMBER_PORT}"
+ check_err $? "Failed to set 'tx_enabled' to true"
+
+ # Show that enabled is true.
+ get_and_check_value enabled true "--port=${MEMBER_PORT}"
+ check_err $? "'enabled' wasn't implicitly set to true"
+
+ log_test "'Tx_enabled' implicit changes"
+}
+
+
require_command teamnl
setup
tests_run
diff --git a/tools/testing/selftests/drivers/net/team/team_lib.sh b/tools/testing/selftests/drivers/net/team/team_lib.sh
index 94fdb07edc30..f0f41a19ec47 100644
--- a/tools/testing/selftests/drivers/net/team/team_lib.sh
+++ b/tools/testing/selftests/drivers/net/team/team_lib.sh
@@ -127,3 +127,19 @@ did_interface_receive()
false
fi
}
+
+did_interface_receive_icmp()
+{
+ local interface="$1"
+ local ip_address="$2"
+
+ local packet_count=$(tcpdump_show "$interface" | grep \
+ "> ${ip_address}: ICMP" | wc -l)
+ echo "Packet count for ${interface} was ${packet_count}"
+
+ if [[ "$packet_count" -gt 0 ]]; then
+ true
+ else
+ false
+ fi
+}
--
2.53.0.1018.g2bb0e51243-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver
2026-03-31 5:33 [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Marc Harvey
` (6 preceding siblings ...)
2026-03-31 5:33 ` [PATCH net-next 7/7] selftests: net: Add tests for team driver decoupled tx and rx control Marc Harvey
@ 2026-03-31 17:33 ` Jakub Kicinski
2026-04-01 1:42 ` Marc Harvey
7 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2026-03-31 17:33 UTC (permalink / raw)
To: Marc Harvey
Cc: jiri, andrew+netdev, willemb, maheshb, netdev, linux-kselftest
On Tue, 31 Mar 2026 05:33:46 +0000 Marc Harvey wrote:
> Allow independent control over receive and transmit enablement states
> for aggregated ports in the team driver.
>
> The motivation is that IEE 802.3ad LACP "independent control" can't
> be implemented for the team driver currently. This was added to the
> bonding driver in commit 240fd405528b ("bonding: Add independent
> control state machine").
>
> This series also has a few patches that add tests to show that the old
> coupled enablement still works and that the new decoupled enalbment
> works as intended (4, 5, and 7).
>
> There are three patches with small fixes as well, with the goal of
> making the final decouplement patch clearer (1, 2, and 3).
The tests don't pass for us, any dependencies we should be aware of?
# selftests: drivers/net/team: teamd_activebackup.sh
# Setting up two-link aggregation for runner activebackup
# Conf files are /tmp/tmp.zYDeygAAcf and /tmp/tmp.y5dfmFapAj
# This program is not intended to be run as root.
# This program is not intended to be run as root.
# Created team devices
# PING fd00::2 (fd00::2) 56 data bytes
# 64 bytes from fd00::2: icmp_seq=1 ttl=64 time=233 ms
#
# --- fd00::2 ping statistics ---
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms
# rtt min/avg/max/mdev = 233.163/233.163/233.163/0.000 ms/bin/bash: line 1: pv: command not found
# Packet count for test_team2 was 0
# Packet count for eth0 was 0
# Packet count for eth1 was 0
# Packet count for eth0 was 0
# Packet count for eth1 was 0
# TEST: teamd active backup runner test [FAIL]
# Traffic did not reach team interface in NS2.
# ./team_lib.sh: line 87: kill: (597) - No such process
# Tearing down two-link aggregation
# Failed to kill daemon: Timer expired
--
pw-bot: defer
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver
2026-03-31 17:33 ` [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver Jakub Kicinski
@ 2026-04-01 1:42 ` Marc Harvey
2026-04-01 1:53 ` Jakub Kicinski
0 siblings, 1 reply; 11+ messages in thread
From: Marc Harvey @ 2026-04-01 1:42 UTC (permalink / raw)
To: Jakub Kicinski
Cc: jiri, andrew+netdev, willemb, maheshb, netdev, linux-kselftest
On Tue, Mar 31, 2026 at 10:33 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 31 Mar 2026 05:33:46 +0000 Marc Harvey wrote:
> > Allow independent control over receive and transmit enablement states
> > for aggregated ports in the team driver.
> >
> > The motivation is that IEE 802.3ad LACP "independent control" can't
> > be implemented for the team driver currently. This was added to the
> > bonding driver in commit 240fd405528b ("bonding: Add independent
> > control state machine").
> >
> > This series also has a few patches that add tests to show that the old
> > coupled enablement still works and that the new decoupled enalbment
> > works as intended (4, 5, and 7).
> >
> > There are three patches with small fixes as well, with the goal of
> > making the final decouplement patch clearer (1, 2, and 3).
>
> The tests don't pass for us, any dependencies we should be aware of?
Ah, I added a check for this using the `require_command` function, but
it seems I used it incorrectly. I will fix this in v2, and probably
remove the pv dependency altogether.
>
> # selftests: drivers/net/team: teamd_activebackup.sh
> # Setting up two-link aggregation for runner activebackup
> # Conf files are /tmp/tmp.zYDeygAAcf and /tmp/tmp.y5dfmFapAj
> # This program is not intended to be run as root.
> # This program is not intended to be run as root.
> # Created team devices
> # PING fd00::2 (fd00::2) 56 data bytes
> # 64 bytes from fd00::2: icmp_seq=1 ttl=64 time=233 ms
> #
> # --- fd00::2 ping statistics ---
> # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> # rtt min/avg/max/mdev = 233.163/233.163/233.163/0.000 ms/bin/bash: line 1: pv: command not found
> # Packet count for test_team2 was 0
> # Packet count for eth0 was 0
> # Packet count for eth1 was 0
> # Packet count for eth0 was 0
> # Packet count for eth1 was 0
> # TEST: teamd active backup runner test [FAIL]
> # Traffic did not reach team interface in NS2.
> # ./team_lib.sh: line 87: kill: (597) - No such process
> # Tearing down two-link aggregation
> # Failed to kill daemon: Timer expired
> --
> pw-bot: defer
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net-next 0/7] Decouple receive and transmit enablement in team driver
2026-04-01 1:42 ` Marc Harvey
@ 2026-04-01 1:53 ` Jakub Kicinski
0 siblings, 0 replies; 11+ messages in thread
From: Jakub Kicinski @ 2026-04-01 1:53 UTC (permalink / raw)
To: Marc Harvey
Cc: jiri, andrew+netdev, willemb, maheshb, netdev, linux-kselftest
On Tue, 31 Mar 2026 18:42:26 -0700 Marc Harvey wrote:
> On Tue, Mar 31, 2026 at 10:33 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Tue, 31 Mar 2026 05:33:46 +0000 Marc Harvey wrote:
> > > Allow independent control over receive and transmit enablement states
> > > for aggregated ports in the team driver.
> > >
> > > The motivation is that IEE 802.3ad LACP "independent control" can't
> > > be implemented for the team driver currently. This was added to the
> > > bonding driver in commit 240fd405528b ("bonding: Add independent
> > > control state machine").
> > >
> > > This series also has a few patches that add tests to show that the old
> > > coupled enablement still works and that the new decoupled enalbment
> > > works as intended (4, 5, and 7).
> > >
> > > There are three patches with small fixes as well, with the goal of
> > > making the final decouplement patch clearer (1, 2, and 3).
> >
> > The tests don't pass for us, any dependencies we should be aware of?
>
> Ah, I added a check for this using the `require_command` function, but
> it seems I used it incorrectly. I will fix this in v2, and probably
> remove the pv dependency altogether.
Instead of adding require_command - please use socat if you can?
pv is frankly highly unusual, most system images won't have it
installed. nc has multiple incompatible implementations so it's
a portability nightmare.
^ permalink raw reply [flat|nested] 11+ messages in thread