Article View: linux.kernel.netdev
Article #14057Re: [PATCH net-next 1/8] net: add tx_extra_headroom and LL_ALLOC_SPACE()
From: Willem de Bruijn
Date: Tue, 10 Nov 2026 16:23
Date: Tue, 10 Nov 2026 16:23
64 lines
15756 bytes
15756 bytes
Tianyi Gao wrote: > Hi Stephen, > > Thanks for the invaluable and detailed review. > > On Sun, 8 Nov 2026 19:08:31 -0800, Stephen Hemminger wrote: > > Since the motivating case is XDP, the mechanism should let the XDP program > > ask for the padding it needs, rather than making the operator translate > > the program's requirement into a device setting by hand. > > The series started from David Keogh's TC egress case, as described in > the RFC [1] and in the first paragraph of the v1 cover letter. The veth > XDP case came later, when I found that the same field also avoids the > copy for generic XDP on veth. > > > Your own reply already works this out: > > > > > - XDP on a veth peer: veth_xdp_set() and generic_xdp_install() can > > > increase the headroom of the peer to XDP_PACKET_HEADROOM on attach > > > and reset it on detach. > > > > That is the mechanism, and it needs no uapi, no operator arithmetic, and > > no stale state. I would rather see it implemented for the cases it covers > > than add a permanent uapi that removes the incentive to do so. > > Agreed. For this case, I plan to move to this in v2. When an XDP program > is attached to a veth device, tx_extra_headroom of the peer is set to > XDP_PACKET_HEADROOM. > > > On the argument that program-side declaration is itself new uapi, and that > > the labeled device is often not the device the skb was allocated on: > > granted for the general TC egress case. > > For TC egress, the kernel does not know at attach time how many bytes > the program pushes. Only the program, or the software that loads it, > knows. Attach-time propagation works for XDP because XDP_PACKET_HEADROOM > is a fixed value. > > Since we both agree that auto-tuning has real problems, a narrow UAPI, > such as a BPF-side declaration, seems unavoidable for TC egress. The > program declares the headroom that it needs through this UAPI. The > initial plan is a BTF decl_tag, as Dragos Tatulea suggested on the RFC > [2]. On attach, the kernel increases tx_extra_headroom of the device > that the program is attached to. > > > Which leaves the genuinely hard case, the one you describe at Cloudflare: a > > service in a netns sends through a veth pair, the host forwards to the > > uplink, and a TC egress program there encapsulates, after ip_rcv_core() > > has orphaned the skb so the allocating device cannot be identified. If > > that is the real residue, make it the problem being solved and argue for > > the narrowest mechanism that solves it. > > This case only came up after I started to look at in-kernel approaches, > because the general IFLA_TX_EXTRA_HEADROOM UAPI already solves it. It is > not a new case, and it is not uncommon. Cilium, Flannel and Calico use a > tunnel by default [3][4][5], so the device that encapsulates is not the > device that allocated the skb. I have some hope that if there is sufficient reason, this backlinking to the originating netdev (or socket?) can eventually be addressed as well. Rather than work around it. The skb_orphan and iif issues are well know. But not set in stone.
Technical Details
Message-ID:
<willemdebruijn.kernel.935b9bf7f1a1@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360425-linux-kernel-netdev=dewy.ruReferences:
<cover.1794020868.git.tianyi@cloudflare.com> <e90e748e0aefa7cbe1c2b31b8c7902ccf135c3f2.1794020868.git.tianyi@cloudflare.com> <willemdebruijn.kernel.1d64e7848503b@gmail.com> <20261107182526.69543-1-tianyi@cloudflare.com> <willemdebruijn.kernel.2c6a653eb65fa@gmail.com> <20261108190831.3f991a13@phoenix.local> <20261109154909.32748-1-tianyi@cloudflare.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360425-linux-kernel-netdev=dewy.ru
From: willemdebruijn.kernel@gmail.com (Willem de Bruijn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/8] net: add tx_extra_headroom and
LL_ALLOC_SPACE()
Date: Tue, 10 Nov 2026 11:23:09 -0500
Organization: Usenet Network
Message-ID: <willemdebruijn.kernel.935b9bf7f1a1@gmail.com>
References: <cover.1794020868.git.tianyi@cloudflare.com>
<e90e748e0aefa7cbe1c2b31b8c7902ccf135c3f2.1794020868.git.tianyi@cloudflare.com>
<willemdebruijn.kernel.1d64e7848503b@gmail.com>
<20261107182526.69543-1-tianyi@cloudflare.com>
<willemdebruijn.kernel.2c6a653eb65fa@gmail.com>
<20261108190831.3f991a13@phoenix.local>
<20261109154909.32748-1-tianyi@cloudflare.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="657233"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ksH70MK5xw036NFVic7gVpemBuE= sha256:bYHyK4C9o1Klfl0CInVuBx4tEK0RW6Pj4Y8+xB7XorE=
sha1:u3tWTtgTpKfSpVcYZR2CNrckfOw= sha256:Y+e05u56GTerXiLQEJVbKzkL9R0gYzvT+zhszgDb2Jo=
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 706DB113C75; Tue, 10 Nov 2026 20:12:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.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 mLB-LnPnpYOT;
Tue, 10 Nov 2026 20:12:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360425-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 5F2F3113C71; Tue, 10 Nov 2026 20:12:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 34F57126FAD; Tue, 10 Nov 2026 16:23:18 +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=1794327792;
b=iZv5Wv7VrL13Tgq2oUz9WAgwjhw9+OxMZ4WTSdcn5EkAaX237n/vy8BNlhDkDpVlQdkp
036pAJcCjQuHL+zj7U42XwpRHtwHzaix0+jawNq+NffOFYZHutpONsrPJE8WvtOXXzun6
5mkTsaQZKhEccOmMd1UDYDUawNJ4h0aNxiMLcGdT8vwnSi/btLyZUtJdflrzjttxVfZ84
MffQM7DWqORkTbSBdj/D3+rn8A6WOmSMJvbvazvEpThjDEC4D0cCDhBpB0HVNILA/EUw7
OktO5mGQ42hfdupwazRd6YMd9LC0Ze7xfZg2KN0c3LOGUfH2DclpXZxFJe/aS3KlGsw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794327792;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Message-ID:In-Reply-To:
References:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Transfer-Encoding;
bh=42cpwdtrc4HrP4DqyvReN7gjWda0yb9ngByLx/bSiMU=;
b=eMKZw2+Yv9LGzmSRWu6AmnsbuOnBoNrd5tASUH2nLs9RCzZptOTIX6ewbzdYnv+sLFQY
Cm2OjA3Tf48Jefem/v40mPVWuF7rQcMVL58cys0LRC8u8P0RtJdHGjbZwaw8V8/ffMlzd
HFJ2B7hd/6gn5iB67AqCyqKo89gXAYONaj7YgQrUK6psmoEv7IZ/Ve9aS8amRDZaYFfWD
xhQQQMyB0LtK+DBwifSGZcYwoc2S2+Lt+5cxPhCvNF9t1+hl24NM1ErF64GCMmvEYuT5M
GqbIaGuoFznqCKFk6Jg1rl2thL1ZRgK3NcH26uYGMNFmcQaRkl1QDenLsgEqDoWIOUA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=k9jynX5W;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.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 D3F5A606A323;
Tue, 10 Nov 2026 16:23:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=k9jynX5W
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794327792;
b=Slb29tOZbJsQeH6WIoyy+nvsGGjd0T1yEnF7gowziwr+m3762XjWYH/0l0wWToZ8w0tN
uN+UHIO0jMfJU6BmW7rbAtfSyTj+giJy+7g7gTVgLtHiXQ3WhndsqOvsNhoidr8CMYt1j
vHbaOkLgquc/5IL/FTZ1Zt5fvK/90bGZd1S1kj1bUPKInbq96ahcfRD3otk/cc09hD2u4
AvA9OYyxiNoMfcOM1HhLTu9g9k4RTRYTMoOwIjWHl2wEFCI//dUnbqtjKfEbrbxcV8tU8
ClZkla+qoJO8U/t5d1ZggFW4ktxaBpCThbZ8d/Q2aUsJqjt1vmkBqljCTKT8AGPi/3g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794327792;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:
MIME-Version:Content-Type:Content-Transfer-Encoding;
bh=42cpwdtrc4HrP4DqyvReN7gjWda0yb9ngByLx/bSiMU=;
b=dkuoTv2r64XjxhMMye2d84xbuEf3vBPu/HFINgMJeQmVVNRIg55iIYxsBgt84ykJX2sg
PCQVN254V+c9gV0giQfP4LOV0zsRDIPxJVQXUMfyd5TVJUqU1l/MoWGYc5BTYWVN84SMh
b1jpdtnW7h1Gb6W58mNsKBZ4DUVYKGkXz6PJKG6K0McPGUdZJUS8yMEcDOSIHKO94y1hL
GWu6A8tyiY/eDKkqE9V4dEyKllaTac1As4Jl/1iH4rX8H20ViQtTB1ppfpwnKj3qA6IEI
Am9RGxirdMqI8RATpMSQpGkY0YAcVoySzL5A3OksOMHbb3jGvtUfUKf9da2J9+0rXdA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=k9jynX5W;
arc=none smtp.remote-ip=209.85.221.178
X-Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4DD2606A325
for <netdev@vger.kernel.org>; Tue, 10 Nov 2026 16:23:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A4DD2606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-5e9528732b4so912190e0c.0
for <netdev@vger.kernel.org>; Tue, 10 Nov 2026 08:23:11 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794327790; x=1794932590; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:mime-version:subject
:references:in-reply-to:message-id:cc:to:from:date:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=42cpwdtrc4HrP4DqyvReN7gjWda0yb9ngByLx/bSiMU=;
b=k9jynX5WUmAeD9j2NE6/ggs5zDZLdvScu7YwYXbqBbHL22S8jy8N7eEfyWdUvgcBpF
8TAHUcgd9VnzhBUjoptLnC2COcPn9xKFLvBh2LvJTPkk9frz8XfKNrLC4YMk3T7aRsTc
y5BqzughtJdwuo03qMeGDlzdpIWW9LTkAJVgO/wunOYTcgDRD8NE6D+4pTVaCLr7nUiA
uo2X6xEjzPkrR8zphv7oYSD9b8iVKcnZpqlk+Xe11f1uXZIuVS3fF1qUgiJethGSaUS6
wlcxLJaReAQCdUgdwFNR3hHlOpTVBIM7HJhltfl/pnlWIeN8VeVhcBWXaAwF/v0hnspp
gNzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794327790; x=1794932590;
h=content-transfer-encoding:content-type:mime-version:subject
:references:in-reply-to:message-id:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date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oIFwC1yUj1kkCaTzg9Ud4tNlulUMeJOHAOkoxzGuj0
7H0FEdXf9EMUe/2diwVjONH6Bnj30nB9VovFFhfjbeZ7Kjc5ssm7EAVHRPSA0Oq9JyEr+UblHqw
RrN4GK6ox3vUOCoIwVzpHjANMgZBApQ9ocX46awVyPyV6xJRd18iYF16sLe2szhoL632KOQ7A9E
W885rybMHyOHE6A/acr8CPrVowcPwqzjwYtmIWOy5AYqfSxSYKn0XTctTZ92YLHHL6wgzcTakWJ
NMpaIqoDetYWdU0fBG/trqu8Nl5cYR0SkJdJt7C22zX4kVAWlVbb/aRD5qqWarwmuSUXEgAY=
X-Received: by 2002:a05:6122:62e9:b0:5c9:c60e:3a4a with SMTP id 71dfb90a1353d-5ee0d19e59amr1124633e0c.22.1794327790334;
Tue, 10 Nov 2026 08:23:10 -0800 (PST)
X-Received: from gmail.com (223.230.150.34.bc.googleusercontent.com. [34.150.230.223])
by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-99c200838f0sm2123832241.9.2026.11.10.08.23.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 10 Nov 2026 08:23:09 -0800 (PST)
X-Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
netdev@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>,
David Keogh <dkeogh@amazon.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
David Woodhouse <dwmw2@infradead.org>,
Dragos Tatulea <dtatulea@nvidia.com>,
Nimrod Oren <noren@nvidia.com>,
Alasdair McWilliam <alasdair@mcwilliam.dev>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Magnus Karlsson <magnus.karlsson@intel.com>,
David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
Alexei Starovoitov <ast@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Donald Hunter <donald.hunter@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Shuah Khan <shuah@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>,
Breno Leitao <leitao@debian.org>,
Asbjørn Sloth Tønnesen <ast@fiberby.net>,
Danielle Ratson <danieller@nvidia.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
bpf@vger.kernel.org,
linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org,
kernel-team@cloudflare.com,
nh-open-source@amazon.com
X-In-Reply-To: <20261109154909.32748-1-tianyi@cloudflare.com>
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