Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tianyi@cloudflare.com
Cc: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, davem@davemloft.net, horms@kernel.org,
	dkeogh@amazon.com, hawk@kernel.org, daniel@iogearbox.net,
	dwmw2@infradead.org, dtatulea@nvidia.com, noren@nvidia.com,
	alasdair@mcwilliam.dev, willemdebruijn.kernel@gmail.com,
	maciej.fijalkowski@intel.com, sdf@fomichev.me,
	magnus.karlsson@intel.com, dsahern@kernel.org, idosch@nvidia.com,
	ast@kernel.org, john.fastabend@gmail.com,
	donald.hunter@gmail.com, andrew+netdev@lunn.ch, corbet@lwn.net,
	skhan@linuxfoundation.org, shuah@kernel.org,
	rdunlap@infradead.org, leitao@debian.org, ast@fiberby.net,
	danieller@nvidia.com, 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,
	stephen@networkplumber.org, gustavoars@kernel.org,
	one-d-wide@protonmail.com, ameryhung@gmail.com,
	andrii@kernel.org, aroulin@nvidia.com,
	anilkaushikwireless@gmail.com, demosthenes.ra@gmail.com,
	eddyz87@gmail.com, emil@etsalapatis.com, hangbin.liu@linux.dev,
	ihor.solodrai@linux.dev, jiayuan.chen@linux.dev,
	jolsa@kernel.org, joe@dama.to, memxor@gmail.com,
	lirongqing@baidu.com, louis.scalbert@6wind.com,
	mkl@pengutronix.de, martin.lau@linux.dev, mkarsten@uwaterloo.ca,
	mattbobrowski@google.com, michael.bommarito@gmail.com,
	razor@blackwall.org, runyu.xiao@seu.edu.cn, song@kernel.org,
	linux@leemhuis.info, wang.zhan@smartx.com,
	yonghong.song@linux.dev, n0ps1edzz@gmail.com,
	tianyi.gao@linux.dev
Subject: Re: [PATCH net-next v2 01/11] net: add tx_extra_headroom and netdev_get_alloc_headroom()
Date: Mon, 23 Nov 2026 03:59:00 +0000	[thread overview]
Message-ID: <179540634013.3135.970023281433843364@kernel.org> (raw)
In-Reply-To: <20261119013830.36935-2-tianyi@cloudflare.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] At this commit, Documentation/networking/netdevices.rst says
  tx_extra_headroom is "at most 512 bytes" and include/linux/netdevice.h…
- [Low] At this commit, the new documentation describes behaviour that is
  not implemented yet.

--

net: add tx_extra_headroom and netdev_get_alloc_headroom()

This adds a tx_extra_headroom field to struct net_device. It also adds the
netdev_get_alloc_headroom(), netdev_get_alloc_headroom_hlen() and
netdev_get_alloc_needed_headroom() helpers for sites that allocate locally
generated packets. Nothing sets the field yet (later patches in the series
set it from XDP, TC egress and a veth attribute), and the unused
LL_RESERVED_SPACE_EXTRA() macro is removed.

> diff --git a/Documentation/networking/net_cachelines/net_device.rst b/Documentation/networking/net_cachelines/net_device.rst
> index 7620d3fcb8dce..4341e9e443bab 100644
> --- a/Documentation/networking/net_cachelines/net_device.rst
> +++ b/Documentation/networking/net_cachelines/net_device.rst
> @@ -35,6 +35,7 @@ unsigned_short                      gflags

[ ... ]

>  unsigned_short                      needed_headroom             read_mostly                             LL_RESERVED_SPACE/ip_finish_output2
> +unsigned_short                      tx_extra_headroom           read_mostly                             netdev_get_alloc_headroom/__ip_append_data

[ ... ]

> diff --git a/Documentation/networking/netdevices.rst b/Documentation/networking/netdevices.rst
> index 6a87f09e70158..f593b242da9cc 100644
> --- a/Documentation/networking/netdevices.rst
> +++ b/Documentation/networking/netdevices.rst
> @@ -441,6 +441,19 @@ from a notifier.
>  
>  Drivers **must not** generate nested notifications of the ops-locked types.
>  
> +TX headroom reservation
> +=======================
> +
> +``tx_extra_headroom`` is extra headroom for locally generated packets. The
> +stack adds it when it allocates such a packet for the device, so that
> +headers pushed later, for example at TC egress, fit without a
> +reallocation. It is at most 512 bytes.

[Severity: Low]
Is this text accurate at this point in the series? This commit does not
convert any allocation site. __ip_append_data() still sizes its headroom
with LL_RESERVED_SPACE(), and nothing calls the new
netdev_get_alloc_headroom*() helpers yet.

The net_cachelines/net_device.rst row above names __ip_append_data as a
reader of tx_extra_headroom. That is also only true after the next patch.

This changes nothing at runtime, because the field is always 0 here. The
next commit, "net: reserve extra TX headroom for local egress", converts
__ip_append_data(), __ip6_append_data(), raw_send_hdrinc(),
rawv6_send_hdrinc(), the AF_PACKET paths and AF_XDP copy mode. After that
commit the docs match the code.

Could these documentation updates move into that patch, so the docs match
the code at every bisect point?

[ ... ]

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 0325c6f2a7d14..392e6fc81e347 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h

[ ... ]

> @@ -2196,6 +2195,8 @@ struct net_device {
>  	 */
>  	unsigned int		mtu;
>  	unsigned short		needed_headroom;
> +#define NETDEV_TX_EXTRA_HEADROOM_MAX	512
> +	unsigned short		tx_extra_headroom;

[Severity: Low]
Nothing in this commit uses NETDEV_TX_EXTRA_HEADROOM_MAX. Even so,
netdevices.rst above already says the field "is at most 512 bytes".
Nothing writes tx_extra_headroom yet, so there is nothing to clamp.

Later in the series, every write goes through
__netdev_update_tx_extra_headroom(), which does:

	WRITE_ONCE(dev->tx_extra_headroom,
		   min(tx_extra_headroom, NETDEV_TX_EXTRA_HEADROOM_MAX));

The inputs are bounded as well. bpf_find_tx_extra_headroom() in the
verifier rejects larger values, and veth applies
NLA_POLICY_MAX(NLA_UINT, NETDEV_TX_EXTRA_HEADROOM_MAX) to
VETH_INFO_TX_EXTRA_HEADROOM. So the documented limit holds by the end of
the series.

Would it be cleaner to add the define and the "at most 512 bytes" sentence
in the same patch as the first code that uses them?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119013830.36935-1-tianyi%40cloudflare.com

  reply	other threads:[~2026-11-23  3:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  1:38 [PATCH net-next v2 00/11] net: extra TX headroom for local egress Tianyi Gao
2026-11-19  1:38 ` [PATCH net-next v2 01/11] net: add tx_extra_headroom and netdev_get_alloc_headroom() Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko [this message]
2026-11-19  1:38 ` [PATCH net-next v2 02/11] net: reserve extra TX headroom for local egress Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 03/11] net: set tx_extra_headroom of the peer on XDP attach Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 04/11] selftests: net: add flag to send a frame in xdp_helper Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 05/11] selftests: net: add tx_extra_headroom test Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 06/11] bpf, tcx: Set tx_extra_headroom from a decl tag on egress programs Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 07/11] selftests: net: tx_extra_headroom: test a push at TC egress Tianyi Gao
2026-11-19  1:38 ` [PATCH net-next v2 08/11] selftests/bpf: Test the tx_extra_headroom decl tag Tianyi Gao
2026-11-19  1:38 ` [PATCH net-next v2 09/11] veth: add VETH_INFO_TX_EXTRA_HEADROOM Tianyi Gao
2026-11-19  1:38 ` [PATCH net-next v2 10/11] netlink: specs: rt-link: add veth attributes Tianyi Gao
2026-11-23  3:59   ` netdev-bot+sashiko
2026-11-19  1:38 ` [PATCH net-next v2 11/11] selftests: net: tx_extra_headroom: test the veth attribute Tianyi Gao
2026-11-19  8:31   ` Paolo Abeni
2026-11-23  3:59   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179540634013.3135.970023281433843364@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alasdair@mcwilliam.dev \
    --cc=ameryhung@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=anilkaushikwireless@gmail.com \
    --cc=aroulin@nvidia.com \
    --cc=ast@fiberby.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=demosthenes.ra@gmail.com \
    --cc=dkeogh@amazon.com \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=dtatulea@nvidia.com \
    --cc=dwmw2@infradead.org \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=gustavoars@kernel.org \
    --cc=hangbin.liu@linux.dev \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jiayuan.chen@linux.dev \
    --cc=joe@dama.to \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=leitao@debian.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=lirongqing@baidu.com \
    --cc=louis.scalbert@6wind.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=mattbobrowski@google.com \
    --cc=memxor@gmail.com \
    --cc=michael.bommarito@gmail.com \
    --cc=mkarsten@uwaterloo.ca \
    --cc=mkl@pengutronix.de \
    --cc=n0ps1edzz@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nh-open-source@amazon.com \
    --cc=noren@nvidia.com \
    --cc=one-d-wide@protonmail.com \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=rdunlap@infradead.org \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=song@kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=tianyi.gao@linux.dev \
    --cc=tianyi@cloudflare.com \
    --cc=wang.zhan@smartx.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox