🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Antonio Quartulli Tue, 01 Dec 2026 00:34
Re: [RFC PATCH net-next 1/9] amt: add the relay replication offload provider header
#24866
Author: Antonio Quartulli
Date: Tue, 01 Dec 2026 00:34
91 lines
13616 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads