πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Mon, 23 Nov 2026 03:59
Re: [PATCH net-next v2 11/11] selftests: net: tx_extra_headroom: test the veth attribute
#20701
Author: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 03:59
93 lines
12552 bytes
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] In tools/testing/selftests/net/tx_extra_headroom.py,
  test_veth_info() never checks the value that…

--

selftests: net: tx_extra_headroom: test the veth attribute

This adds a test that uses YNL to create a veth pair with
VETH_INFO_TX_EXTRA_HEADROOM set to 64, and moves the peer to another
netns. It checks that both ends report 64 over netlink, and that the
sending end's tx_extra_headroom is 64, or 64 + 256 with XDP on the peer.
A second test checks that a value above 512 is rejected with ERANGE.

> diff --git a/tools/testing/selftests/net/tx_extra_headroom.py b/tools/testing/selftests/net/tx_extra_headroom.py
> index 122a1a1b5ca94..a4e4195179fab 100755
> --- a/tools/testing/selftests/net/tx_extra_headroom.py
> +++ b/tools/testing/selftests/net/tx_extra_headroom.py

[ ... ]

> @@ -353,6 +380,30 @@ def test_tag_max() -> None:
>      ksft_eq(bss["tx_extra_headroom"], TX_EXTRA_HEADROOM_MAX)
>
>
> +def test_veth_info() -> None:
> +    """Check that VETH_INFO_TX_EXTRA_HEADROOM adds to tx_extra_headroom."""
> +    with NetNS() as send_ns, NetNS() as peer_ns, NetNSEnter(str(send_ns)):
> +        _setup_veth(peer_ns, tx_extra_headroom=64)
> +        ksft_eq(_veth_tx_extra_headroom("veth0"), 64)
> +        with NetNSEnter(str(peer_ns)):
> +            ksft_eq(_veth_tx_extra_headroom("veth1"), 64)
> +        map_id = _load_progs()
> +        _attach_tcx("veth0", "egress", "record")
> +        _send_udp4()
> +        ksft_eq(_read_bss(map_id)["tx_extra_headroom"], 64)

[Severity: Low]
Does this check cover the value that veth_newlink() sets on the device
when it is created?

The record program at tcx egress of veth0 reads
kskb->dev->tx_extra_headroom. Attaching it goes through
tcx_prog_attach(), and for egress that recomputes the value for veth0
and its peer:

kernel/bpf/tcx.c:tcx_prog_attach() {
    ...
		bpf_mprog_commit(entry);
		if (!ingress)
			netdev_update_tx_extra_headroom(dev);
    ...
}

The value is not recalculated anywhere between creation and this attach.
Moving veth1 to another netns, adding addresses, bringing the links up
and _load_progs() all leave it alone. So this ksft_eq() would still pass
if the creation-time call in veth_newlink() were removed or broken:

drivers/net/veth.c:veth_newlink() {
    ...
	netdev_update_tx_extra_headroom(dev);
    ...
}

The two _veth_tx_extra_headroom() checks only read
priv->tx_extra_headroom through veth_fill_info(), not
dev->tx_extra_headroom. The peer's dev->tx_extra_headroom is never
checked.

The use case in "veth: add VETH_INFO_TX_EXTRA_HEADROOM" is a CNI plugin
that sets the headroom at creation, with no tcx egress program on the
veth. That use case relies only on the creation-time path.

Only egress attach recalculates the value. Could a record program at
tcx ingress of veth1 be used to read the creation-time value? If not,
could the commit message mention this limitation?

> +        _attach_xdp(peer_ns)
> +        _send_udp4()
> +        ksft_eq(_read_bss(map_id)["tx_extra_headroom"],
> +                64 + XDP_PACKET_HEADROOM)

[ ... ]

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

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads