From: Dragos Tatulea <dtatulea@nvidia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: "Larysa Zaremba" <larysa.zaremba@intel.com>,
bpf@vger.kernel.org, "Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Wei Fang" <wei.fang@nxp.com>,
"Clark Wang" <xiaoning.wang@nxp.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Tony Nguyen" <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"KP Singh" <kpsingh@kernel.org>, "Hao Luo" <haoluo@google.com>,
"Jiri Olsa" <jolsa@kernel.org>, "Simon Horman" <horms@kernel.org>,
"Shuah Khan" <shuah@kernel.org>,
"Alexander Lobakin" <aleksander.lobakin@intel.com>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
"Bastien Curutchet (eBPF Foundation)"
<bastien.curutchet@bootlin.com>,
"Tushar Vyavahare" <tushar.vyavahare@intel.com>,
"Jason Xing" <kernelxing@tencent.com>,
"Ricardo B. Marlière" <rbm@suse.com>,
"Eelco Chaudron" <echaudro@redhat.com>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Toke Hoiland-Jorgensen" <toke@redhat.com>,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-kselftest@vger.kernel.org,
"Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Nimrod Oren" <noren@nvidia.com>
Subject: Re: [PATCH bpf 6/6] net: enetc: use truesize as XDP RxQ info frag_size
Date: Tue, 10 Feb 2026 18:27:48 +0100 [thread overview]
Message-ID: <e229a820-e2e0-4dc7-a6c2-03ad6f2bdac3@nvidia.com> (raw)
In-Reply-To: <20260208125934.f4n5mri2pit6s6gn@skbuf>
On 08.02.26 13:59, Vladimir Oltean wrote:
> On Thu, Feb 05, 2026 at 05:54:08PM -0800, Jakub Kicinski wrote:
>> FWIW my feeling is that instead of nickel and diming leftover space
>> in the frags if someone actually cared about growing mbufs we should
>> have the helper allocate a new page from the PP and append it to the
>> shinfo. Much simpler, "infinite space", and works regardless of the
>> driver. I don't mean that to suggest you implement it, purely to point
>> out that I think nobody really uses positive offsets.. So we can as
>> well switch more complicated drivers back to xdp_rxq_info_reg().
>
> FWIW, I do have a use case at least in the theoretical sense for
> bpf_xdp_adjust_tail() with positive offsets, although it's still under
> development.
>
> I'm working on a DSA data path library for XDP, and one of the features
> it supports is redirecting from one user port to another, with in-place
> tag modification.
>
> If the path to the egress port goes through a tail-tagging switch but
> the path from the ingress port didn't, bpf_xdp_adjust_tail() with a
> positive offset will be called to make space for the tail tags.
>
Jumping a bit late in the conversation...
We were recently discussing this limitation when trying to add growable
tail support for multi-buf XDP buffers in the mlx5 driver (Striding RQ
mode) after lifting the page_size stride limitation for XDP [1].
It turns out that it is quite complicated to do in this mode with the
with existing frag_size configuration...
The issue is that the HW can write a packet in multiple smaller strides
(256B for example) and setting rxq->frag_size to it would not work for
the following reasons:
1) The tailroom formula would yield a negative value, as pointed out by
this series.
2) Even if this formula would not be the issue, frag_size currently
means that the underlying storage of each fragment has a size of
frag_size. So the number of fragments would explode in the driver.
That's a no go.
3) And even if we would change the semantics of frag_size to mean
something else so that the XDP code would use frag_size as the available
growth size in the fragment
(tailroom = skb_frag_off() + frag_size - skb_frag_size())
we'd still be very much in the "nickel and diming" space with less than
256B to spare.
4) The only sane way to do it would be to use a large stride but this
would kill small packet optimization
So +1 for the direction of having a helper allocating an extra page from
the page_pool instead.
> I'm not sure about the "regardless of the driver" part of your comment.
> Is it possible to mix and match allocation models and still keep track
> of how each individual page needs to be freed? AFAICS in xdp_return_frame(),
> the mem_type is assumed to be the same for the entire xdp_frame.
>
Wouldn't the allocations happen from the page_pool of the rx queue
so the mem_type would be homogenous. I was initially worried about the
cpumap case but seems to not allow tail growth (frag_size is initialized
to 0 in cpu_map_bpf_prog_run_xdp()).
[1] - Disclaimer: XDP multi-buf fragment growth is still supported for the
non Striding RQ mode.
Thanks,
Dragos
next prev parent reply other threads:[~2026-02-10 17:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 10:53 [PATCH bpf 0/6] Address XDP frags having negative tailroom Larysa Zaremba
2026-02-03 10:53 ` [PATCH bpf 1/6] xdp: produce a warning when calculated tailroom is negative Larysa Zaremba
2026-02-03 12:26 ` Toke Høiland-Jørgensen
2026-02-03 12:31 ` Larysa Zaremba
2026-02-03 12:38 ` Toke Høiland-Jørgensen
2026-02-03 12:54 ` Larysa Zaremba
2026-02-03 13:37 ` Toke Høiland-Jørgensen
2026-02-04 22:52 ` Martin KaFai Lau
2026-02-03 10:53 ` [PATCH bpf 2/6] ice: fix rxq info registering in mbuf packets Larysa Zaremba
2026-02-03 10:53 ` [PATCH bpf 3/6] ice: change XDP RxQ frag_size from DMA write length to truesize Larysa Zaremba
2026-02-03 10:53 ` [PATCH bpf 4/6] i40e: use truesize as XDP RxQ info frag_size Larysa Zaremba
2026-02-03 10:53 ` [PATCH bpf 5/6] idpf: " Larysa Zaremba
2026-02-03 10:53 ` [PATCH bpf 6/6] net: enetc: " Larysa Zaremba
2026-02-05 0:59 ` Vladimir Oltean
2026-02-05 1:34 ` Jakub Kicinski
2026-02-05 12:29 ` Vladimir Oltean
2026-02-05 12:41 ` Larysa Zaremba
2026-02-05 12:46 ` Vladimir Oltean
2026-02-05 13:23 ` Larysa Zaremba
2026-02-05 13:40 ` Vladimir Oltean
2026-02-06 1:54 ` Jakub Kicinski
2026-02-06 8:36 ` Larysa Zaremba
2026-02-07 2:57 ` Jakub Kicinski
2026-02-09 9:46 ` Larysa Zaremba
2026-02-08 12:59 ` Vladimir Oltean
2026-02-10 17:27 ` Dragos Tatulea [this message]
2026-02-04 22:57 ` [PATCH bpf 0/6] Address XDP frags having negative tailroom Martin KaFai Lau
2026-02-05 1:23 ` Jakub Kicinski
2026-02-05 1:26 ` Jakub Kicinski
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=e229a820-e2e0-4dc7-a6c2-03ad6f2bdac3@nvidia.com \
--to=dtatulea@nvidia.com \
--cc=aleksander.lobakin@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=claudiu.manoil@nxp.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=echaudro@redhat.com \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernelxing@tencent.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rbm@suse.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tariqt@nvidia.com \
--cc=toke@redhat.com \
--cc=tushar.vyavahare@intel.com \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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