Article View: linux.kernel.netdev
Article #24870Re: [RFC PATCH net-next 2/9] amt: offload provider registry and lower-device lifecycle
From: Antonio Quartulli
Date: Tue, 01 Dec 2026 00:34
Date: Tue, 01 Dec 2026 00:34
76 lines
12598 bytes
12598 bytes
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
Technical Details
Message-ID:
<20261201003458.3731956-3-antonio@mandelbit.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374555-linux-kernel-netdev=dewy.ruReferences:
<20261107184437.2783174-1-omar@blockcast.net> <20261107184437.2783174-3-omar@blockcast.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374555-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: Re: [RFC PATCH net-next 2/9] amt: offload provider registry and lower-device lifecycle Date: Tue, 1 Dec 2026 01:34:49 +0100 Organization: Usenet Network Message-ID: <20261201003458.3731956-3-antonio@mandelbit.com> References: <20261107184437.2783174-1-omar@blockcast.net> <20261107184437.2783174-3-omar@blockcast.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1576307"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BQgCm5dOHPjFKe30z0uqRxczsqg= sha256:VYVSb71Evnp0yzJKdDanurhZ0ygUGWZScxMCKNZkpi4= sha1:9QeELpsdLXef77xrbhKpc63XwXE= sha256:9Kf1n9EO6Ihpt/Al/AVEzln+krCZlXI4MVLhqWei3pw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E80CA126019; Tue, 1 Dec 2026 03:36:01 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.95 X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=mandelbit.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q5Cbzw_sTDvU; Tue, 1 Dec 2026 03:35:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374555-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id E6288126017; Tue, 1 Dec 2026 03:35:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id E23A72E99F; Tue, 1 Dec 2026 00:35:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796085325; b=0cUoJ6LbQNpr6EjJqzW0ijeUYpxz9V5Q1r5PFuC/WemnUz1Kgckxbo1/uWqzNS1iwOzg 1Wf0p5GtIljfIlFxnDzas3zIW8Fiedtk/reD5PkLSQkbCwFoKtWWWoJhdSLDGbCTNduzD rhv1dk0x9XVmrYonFpHjdrh1ZOdLsLkNKY//n7tP0Q9hXErzAcxIZYm9WEABhvJrKWJOb Uu4/3YGV/NQ2G0+gWfpCs1pDjV6HyV2G1J9FVACqTXSf+UkCQodw1Sooid6Yt9vWrxyPo SZgRKFtpnXqXHl2A2TiBfj3Qo6/ytzJ1e7sI/NaReCra6Q0EGQ8RbUBuiXp/S6Gvxng== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796085325; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=pe3bK2POPmaAntDlcklDyapugT4/ZMq4N97C37Ve+sY=; b=EUEiB6QEn6S6OkizKlahjLMpdy/CK+qP6NzuJRp3rMThy0JB/ktDAGgnOz5CWEXzSpWu i3FXiHhPP+rbvr8S1UjlrKOvH+5CFTpcW6H/JfAVpWXWfpUDElZYGUvYddEN7NxkNqygc jVo6lyQZ9GrBFAThPFGmdpnCN8pcG1Y1KC/Qo4B/enMH1IzhQo0Pn4tyyqo8Y0FT+36Fk w5IjECfHmymQxtzzdn9WzA7iBoIV+1mPTd68hv2FAvfJtGq8SjQw76K7t4ebQ62GISkPM M5old6QsmKfv2mITdmUZC1yH8TXMD9EC6KNuWNxizuHYvqfJ7awIt5XV2/16M6Um6uQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qqpfaPmW; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2ED0606A685; Tue, 1 Dec 2026 00:35:25 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qqpfaPmW X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.55 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796085315; b=An9JXSx1C+Vs6aen230yjpdb+sGeZalK9pLCXK8NHN1sLWLT7bEApx3ToDG5Nrtkft0H 9HUakl+eIIgJdTXLMioAllRWr98M/NibxcfG3jvuwdUX0rVK/8TdvSNXWP36pJcIw+ZMZ CA1FD3pnfQ0oRM++VNGfkeDsoOj5/Z7gNw45mAnYQKMqgE4pGiVndAzKdCn79felFQxEz HGKypBIQTpo6SBYj8UbcGu9t+L58l6PboXEiymC1ObnDSvFyFe/j4FyMQi07IxWEJNdr0 e1ImM1tP7C/Qa7wn5gA+TXgzyB98AwQZD3wI0Bvt1ilneNKTyoZfbSj7S22c5/KiSMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796085315; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=pe3bK2POPmaAntDlcklDyapugT4/ZMq4N97C37Ve+sY=; b=jPw55uFHJRiWNr+xhtXqeTwYsfNkWad6eWg45jEfSAcVN6GpvDMhTg097fP/wanLYXJM /ePami3Dx/ukbzRaSa8TsNWdhdc6aPBUcREIZwyXcrbGWb5jD2kXh4jFu7Wly0q8pVGAw wNaYkhCy0l5A2crQXP3z1Bn8htZ1FAU4NkQNxAHteTBI2UpgPESwBayLrZDR+vN6aHNuU oHPUlm8eHsudXgTq+aPlQYlzC4QnON0ziguQJJ2tKZhzLU4UX5H0nM6Wz8Oo7NVeO/cN2 ifVeyiPP3P/kYTHvrFrRcaoPQcdqW2NBUnrcrSujsu1U08VYdZJSiNJWVApjtlZjYaw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qqpfaPmW; arc=none smtp.remote-ip=195.10.208.55 X-Received: from mout-b-110.mailbox.org (mout-b-110.mailbox.org [195.10.208.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12F3E606A337; Tue, 1 Dec 2026 00:35:13 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12F3E606A337 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-110.mailbox.org (Postfix) with ESMTPS id 4jdhk63YP2zNl43; Tue, 01 Dec 2026 01:35:10 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796085310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pe3bK2POPmaAntDlcklDyapugT4/ZMq4N97C37Ve+sY=; b=qqpfaPmWJBoQVYL69P7utBfFzVBvtTwADxJ9MIywRK4v9Ei4tj9B6bnoum+NhdahRgIrft ddKd4HHLn1LT089QSMTRuvP5LoY0ZaW+4XKL2dMvh9R5Plu9zXuYM9B5BSxy6fvdWTcRD9 enyv6U7CbBfFKOXuf/e+tSITgRzk4WQD2S2hWyL4jd1HaS6cuuoqARivoXW1akPNbh7VJk fPrv1o/y6lXl++l+r0sKEXhqyihBqn7dgg4rEZN0mHDSVagpfLQh3T4RYbhVsIM8RSN52m OoGGlBDNNlxm13j+u0jj4qBqxSM2ehc5ecxm5wTjyRk1N8lv2KuXojQDbfIZOg== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com X-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 X-Mailer: git-send-email 2.56.1 X-In-Reply-To: <20261107184437.2783174-3-omar@blockcast.net> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Rspamd-Queue-Id: 4jdhk63YP2zNl43