Re: [RFC net-next 0/6] net: configurable extra TX headroom for local egress
From: Daniel Borkmann
Date: Fri Oct 16 2026 - 15:15:31 EST
On 10/16/26 8:48 PM, Dragos Tatulea wrote:
On 16.10.26 10:02, David Woodhouse wrote:Fwiw, there was some work in this area here in the past ...
On Thu, 2026-10-15 at 23:53 +0000, David Keogh wrote:For TC-BPF I suppose only the BPF program knows how much extra
Measurements (net-next at commit 05b5019b0, veth, 500000 UDP datagrams, a
20-byte ip-in-ip push attached at TC egress, only tx_extra_headroom varied):
tx_extra_headroom pskb_expand_head reallocs / 500k
0 (off) 500003 (~1 per packet)
64 4 (background)
128 2 (background)
I remember frowning at this years ago, in the context of PPPoE.
I have the same question I had back then: why, if *every* packet ends
up having to call pskb_expand_head() because it didn't have enough
headroom, does our kernel need to be *told* by userspace that it needs
to expand the allocations?
We gained dev->needed_headroom and ip_tunnel_adj_headroom() since then,
and the kernel doesn't actually need to be told.
You explained why you don't want to use dev->needed_headroom; I don't
have much of an opinion on that front. But if you do want to introduce
a new tx_extra_headroom, could we try really hard to have it auto-
tuning?
headroom is needed.
Maybe this tx_extra_headroom could be declared as a BTF decl tag
in the program. If this is the only usecase there's no need for a
rtnetlink uAPI.
- b9ed315d3c4c ("netkit: Allow for configuring needed_{head,tail}room")
- b73b8146d7ff ("rtnetlink: add needed_{head,tail}room attributes")
... which we've integrated into Cilium which orchestrates the K8s
Pods + BPF progs, so it can calc needed headroom for the Pod's netdev
based on the config/needs in the hostns (e.g. tunneling).
Cheers,
Daniel