From: Marc Harvey <marcharvey@google.com>
To: 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>,
Paolo Abeni <pabeni@redhat.com>, 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,
Marc Harvey <marcharvey@google.com>
Subject: [PATCH net-next v5 09/10] net: team: Add new tx_enabled team port option
Date: Mon, 06 Apr 2026 03:03:45 +0000 [thread overview]
Message-ID: <20260406-teaming-driver-internal-v5-9-e8a3f348a1c5@google.com> (raw)
In-Reply-To: <20260406-teaming-driver-internal-v5-0-e8a3f348a1c5@google.com>
This option allows independent control over tx enablement without
affecting rx enablement. Like the rx_enabled option, this also
implicitly affects the enabled option.
If this option is not used, then the enabled option will continue to
behave as it did before.
Tested in a follow-up patch with a new selftest.
Signed-off-by: Marc Harvey <marcharvey@google.com>
---
Changes in v5:
- None
Changes in v4:
- New patch: split from the original monolithic v3 patch "net: team:
Decouple rx and tx enablement in the team driver".
- Link to v3: https://lore.kernel.org/netdev/20260402-teaming-driver-internal-v3-6-e8cfdec3b5c2@google.com/
---
drivers/net/team/team_core.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index 67f77de4cf10..0c87f9972457 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -978,6 +978,21 @@ static void __team_port_enable_tx(struct team *team,
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);
+}
+
static void __reconstruct_port_hlist(struct team *team, int rm_index)
{
struct hlist_head *tx_port_index_hash;
@@ -1007,6 +1022,19 @@ static void __team_port_disable_tx(struct team *team,
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);
+}
+
/*
* Enable TX AND RX on the port.
*/
@@ -1529,6 +1557,26 @@ static int team_port_rx_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_user_linkup_option_get(struct team *team,
struct team_gsetter_ctx *ctx)
{
@@ -1657,6 +1705,13 @@ static const struct team_option team_options[] = {
.getter = team_port_rx_en_option_get,
.setter = team_port_rx_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 = "user_linkup",
.type = TEAM_OPTION_TYPE_BOOL,
--
2.53.0.1185.g05d4b7b318-goog
next prev parent reply other threads:[~2026-04-06 3:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 3:03 [PATCH net-next v5 00/10] Decouple receive and transmit enablement in team driver Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 01/10] net: team: Annotate reads and writes for mixed lock accessed values Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 02/10] net: team: Remove unused team_mode_op, port_enabled Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 03/10] net: team: Rename port_disabled team mode op to port_tx_disabled Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 04/10] selftests: net: Add tests for failover of team-aggregated ports Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 05/10] selftests: net: Add test for enablement of ports with teamd Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 06/10] net: team: Rename enablement functions and struct members to tx Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 07/10] net: team: Track rx enablement separately from tx enablement Marc Harvey
2026-04-06 3:03 ` [PATCH net-next v5 08/10] net: team: Add new rx_enabled team port option Marc Harvey
2026-04-06 3:03 ` Marc Harvey [this message]
2026-04-06 3:03 ` [PATCH net-next v5 10/10] selftests: net: Add tests for team driver decoupled tx and rx control Marc Harvey
2026-04-06 14:44 ` [PATCH net-next v5 00/10] Decouple receive and transmit enablement in team driver Jakub Kicinski
2026-04-07 5:04 ` Marc Harvey
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=20260406-teaming-driver-internal-v5-9-e8a3f348a1c5@google.com \
--to=marcharvey@google.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=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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