Netdev List
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: Omar Ramadan <omar@blockcast.net>
Cc: Antonio Quartulli <antonio@mandelbit.com>,
	Taehee Yoo <ap420073@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
	mbloch@nvidia.com, brett.creeley@amd.com, sgoutham@marvell.com,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	intel-wired-lan@lists.osuosl.org,
	Ido Schimmel <idosch@nvidia.com>,
	Satish Kharat <satishkh@cisco.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [RFC PATCH net-next 1/9] amt: add the relay replication offload provider header
Date: Tue,  1 Dec 2026 01:34:48 +0100	[thread overview]
Message-ID: <20261201003458.3731956-2-antonio@mandelbit.com> (raw)
In-Reply-To: <20261107184437.2783174-2-omar@blockcast.net>

On Sat, Nov 07, 2026 at 06:44:28PM +0000, Omar Ramadan wrote:
> +/*
> + * Reserved: (S,G)-keyed forwarding. v1 forwards per (family, group) exactly
> + * as the software path does, so this bit has NO v1 semantics. A provider
> + * must not set it; amt ignores it.
> + */
> +#define AMT_OFFLOAD_F_SOURCE_FILTER	BIT(0)

Please drop everything amt never reads: this bit, caps.features,
caps.max_endpoints, caps.max_groups and ops->stats.

IMHO it's better to add each one with its first user.

> + * @op_timeout_ms: longest a programming op may take before amt treats the
> + *	provider as wedged, resets it and replays from desired state.

The ops are synchronous, so amt can only measure an op after it returns.
That gets both cases wrong:
- An op that hangs is never caught. It keeps amt's offload mutex, and
  teardown takes that mutex with RTNL held.
- An op that succeeds a little late triggers a full flush and replay.

Details are in 3/9. Please drop the field: a provider that can time out
its command channel returns -ETIMEDOUT and should report through its own
devlink health reporter.

> + * @epoch: monotonic per relay device, bumped on every bind, reset and
> + *	teardown. A completion carrying an older epoch is stale and ignored.

No op completes asynchronously and no op takes an epoch, so a provider
has nothing to compare it against. I think we can actually get rid of
this?

> + *	key returns the existing handle. 0 means accepted and durable, not yet
> + *	forwarding. Process context, never under amt's spinlocks.

It seems the locking rule that matters is missing: the programming ops
run with amt's offload mutex held and without RTNL, while teardown holds RTNL
(and, for a netdevsim port, the devlink instance lock) and then takes
that mutex. A driver whose command path takes RTNL or the devlink lock
deadlocks.
The header has to forbid that, or amt has to call the ops under RTNL.

> + *	the commit until the next one. Until amt publishes @gen, any @xmit for
> + *	@grp carries an earlier generation this provider committed, and a call
> + *	already in flight may carry any of those or @gen itself; the provider
> + *	serves such a generation or declines it. A provider must never emit

This forces every provider to keep earlier committed member sets alive
for packets in flight. Hardware replicates from its programmed state and
has no notion of a per-packet generation.
A potentially simpler rule: amt stops handing the group over and waits
out in-flight xmit (synchronize_net) before group_commit, and resumes
after it returns. The provider then holds one set, and a joining gateway
is served by software while the group is reprogrammed instead of getting
nothing (see 4/9).

> + * @AMT_OFFLOAD_PATH_INGRESS: the provider replicates on ingress and the
> + *	host only sees punted packets. Semantics only until a real provider
> + *	exists; no simulated provider implements it.

I think the ingress path can be dropped from this series, because nothing
implements it?
The punt rule added in 4/9 seems to be dropping legitimate traffic.

> + * relay on @lower in software. Caller holds RTNL. A no-op if @lower has no
> + * provider, which is the case after @lower itself was unregistered.

A netns move of @lower also sends NETDEV_UNREGISTER, so amt silently
forgets the provider. Every provider must then re-register on
NETDEV_REGISTER (netdevsim does), and the contract doesn't say so.

An ops pointer in net_device should avoid the problem entirely (see 0/9).

Patch 3 rewrites this header (+66/-8) and patch 4 does it again
(+35/-3). Please introduce it together with its first user.

Regards,
Antonio

  reply	other threads:[~2026-12-01  0:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 18:44 [RFC PATCH net-next 0/9] amt: relay replication offload provider contract (RFC, not for merge, seeking a provider) Omar Ramadan
2026-11-07 18:44 ` [RFC PATCH net-next 1/9] amt: add the relay replication offload provider header Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli [this message]
2026-11-07 18:44 ` [RFC PATCH net-next 2/9] amt: offload provider registry and lower-device lifecycle Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 3/9] amt: offload group object, desired state and reconciler Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 4/9] amt: offload TX handoff, ingress punt rule and counters Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 5/9] amt: add IFLA_AMT_OFFLOAD_MODE Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 6/9] amt: KUnit cases for the offload contract Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 7/9] netdevsim: add a TX reference provider for AMT relay offload Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 8/9] selftests: net: add amt_offload.sh " Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-11-07 18:44 ` [RFC PATCH net-next 9/9] MAINTAINERS: amt: cover the offload header and netdevsim provider Omar Ramadan
2026-12-01  0:34   ` Antonio Quartulli
2026-12-01  0:34 ` [RFC PATCH net-next 0/9] amt: relay replication offload provider contract (RFC, not for merge, seeking a provider) Antonio Quartulli

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=20261201003458.3731956-2-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ap420073@gmail.com \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavoars@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=omar@blockcast.net \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=saeedm@nvidia.com \
    --cc=satishkh@cisco.com \
    --cc=sgoutham@marvell.com \
    --cc=shuah@kernel.org \
    --cc=tariqt@nvidia.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