On Sat, Nov 07, 2026 at 06:44:28PM +0000, Omar Ramadan wrote:
> +static int amt_offload_required_refused_set(const char *val, > + const struct kernel_param *kp) > +{ > + pr_warn("offload_required_refused is read-only; ignoring \"%s\"\n", > + val ? val : ""); > + return 0; > +}
netdev doesn't take new module parameters :) And this one is a counter that is global across network namespaces. Please drop it; if the counter is needed, report it through netlink (as discussed in the cover letter).
> +static LIST_HEAD(amt_offload_providers);
The comment above calls this an RCU list for readers outside RTNL, but there are no such readers: the only lookup asserts RTNL. A plain list is enough, no?
> + p->lower = lower; > + p->ops = ops; > + list_add_rcu(&p->node, &amt_offload_providers);
There is no reference on @lower and no reg_state check. A provider that registers too early or too late leaves an entry that can later match a reused pointer. The lookup also matches the relay's stream_dev exactly, so a relay on a VLAN or bond over the capable port can never offload.
> + /* 1. Stop admission and wait for every ops->xmit already admitted. */ > + WRITE_ONCE(b->admitting, false); > + synchronize_net();
[...]
> + RCU_INIT_POINTER(amt->offload, NULL); > + synchronize_rcu(); > + kfree(b);
This costs two grace periods per relay under RTNL, the second one a plain synchronize_rcu(). Unregistering a provider or a lower that carries N relays therefore costs 2N grace periods under RTNL. After the first grace period no reader is inside xmit; later readers only need b to stay allocated, so kfree_rcu() can replace the second one. Clearing admitting on all relays first and waiting once would remove the remaining N-1.
> + err = amt_offload_attach(amt, extack); > + if (err) { > + netdev_upper_dev_unlink(amt->stream_dev, dev); > + unregister_netdevice(dev); > + goto err; > + }
A refused required-mode relay is registered and then unregistered, so userspace sees RTM_NEWLINK and RTM_DELLINK for a link whose creation failed. The provider lookup needs only stream_dev; please do it before register_netdevice().
> +static const struct attribute_group amt_offload_group = { > + .name = "offload", > + .attrs = amt_offload_attrs, > +};
New per-netdev sysfs won't be accepted (as per the cover letter comment). Also, this group is in amt_groups, so it shows up on gateway-mode devices too.
> +static int __maybe_unused amt_offload_track(struct list_head *list, > + void *handle)
Patch 3 deletes this helper, struct amt_offload_ref and the two lists. Please don't add code that the next patch removes :) Regards, Antonio