From: Larysa Zaremba <larysa.zaremba@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: bpf@vger.kernel.org, "Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Vladimir Oltean" <vladimir.oltean@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>,
"Jakub Kicinski" <kuba@kernel.org>,
"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>,
"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>,
"Dragos Tatulea" <dtatulea@nvidia.com>
Subject: Re: [PATCH bpf v2 7/9] idpf: use truesize as XDP RxQ info frag_size
Date: Mon, 16 Feb 2026 15:01:45 +0100 [thread overview]
Message-ID: <aZMjSSiZ5cvwi_Ig@soc-5CG4396X81.clients.intel.com> (raw)
In-Reply-To: <de0cc1e0-63d3-486f-a7a3-f1957a4116f0@intel.com>
On Mon, Feb 16, 2026 at 11:48:27AM +0100, Alexander Lobakin wrote:
> From: Alexander Lobakin <aleksander.lobakin@intel.com>
> Date: Mon, 16 Feb 2026 11:46:05 +0100
>
> > From: Zaremba, Larysa <larysa.zaremba@intel.com>
> > Date: Thu, 12 Feb 2026 19:33:22 +0100
> >
> >> The only user of frag_size field in XDP RxQ info is
> >> bpf_xdp_frags_increase_tail(). It clearly expects whole buffer size instead
> >> of DMA write size. Different assumptions in idpf driver configuration lead
> >> to negative tailroom.
> >>
> >> To make it worse, buffer sizes are not actually uniform in idpf when
> >> splitq is enabled, as there are several buffer queues, so rxq->rx_buf_size
> >> is meaningless in this case.
> >>
> >> Use rxq->truesize as a frag_size for singleq and truesize of the first bufq
> >> in AF_XDP ZC, as there is only one. Disable growinf tail for regular
> >> splitq.
> >>
> >> Fixes: ac8a861f632e ("idpf: prepare structures to support XDP")
> >> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> >> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> >> ---
> >> drivers/net/ethernet/intel/idpf/xdp.c | 8 +++++++-
> >> drivers/net/ethernet/intel/idpf/xsk.c | 1 +
> >> 2 files changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/ethernet/intel/idpf/xdp.c b/drivers/net/ethernet/intel/idpf/xdp.c
> >> index 958d16f87424..a152c9a26976 100644
> >> --- a/drivers/net/ethernet/intel/idpf/xdp.c
> >> +++ b/drivers/net/ethernet/intel/idpf/xdp.c
> >> @@ -46,11 +46,17 @@ static int __idpf_xdp_rxq_info_init(struct idpf_rx_queue *rxq, void *arg)
> >> {
> >> const struct idpf_vport *vport = rxq->q_vector->vport;
> >> bool split = idpf_is_queue_model_split(vport->rxq_model);
> >> + u32 frag_size = 0;
> >> int err;
> >>
> >> + if (idpf_queue_has(XSK, rxq) && split)
> >> + frag_size = rxq->bufq_sets[0].bufq.truesize;
> >> + else if (!split)
> >> + frag_size = rxq->truesize;
> >
> > XDP and XSk are supported only in mode splitq mode, so you can remove
> > the second condition and change the first one to just `has(XSK)`.
> >
But the function itself handles singleq case. I do not see why frag_size should
be treated differently.
Not that I am against of removing this logic, it would look more neat without
these conditions.
> >> +
> >> err = __xdp_rxq_info_reg(&rxq->xdp_rxq, vport->netdev, rxq->idx,
> >> rxq->q_vector->napi.napi_id,
> >> - rxq->rx_buf_size);
> >> + frag_size);
> >> if (err)
> >> return err;
> >>
> >> diff --git a/drivers/net/ethernet/intel/idpf/xsk.c b/drivers/net/ethernet/intel/idpf/xsk.c
> >> index fd2cc43ab43c..febe1073b9b4 100644
> >> --- a/drivers/net/ethernet/intel/idpf/xsk.c
> >> +++ b/drivers/net/ethernet/intel/idpf/xsk.c
> >> @@ -401,6 +401,7 @@ int idpf_xskfq_init(struct idpf_buf_queue *bufq)
> >> bufq->pending = fq.pending;
> >> bufq->thresh = fq.thresh;
> >> bufq->rx_buf_size = fq.buf_len;
> >> + bufq->truesize = xsk_pool_get_rx_frag_step(fq.pool);
>
> Better to do that in libeth_xdp rather than here?
>
Smth like that?
diff --git a/drivers/net/ethernet/intel/idpf/xsk.c b/drivers/net/ethernet/intel/idpf/xsk.c
index febe1073b9b4..de87455b92d7 100644
--- a/drivers/net/ethernet/intel/idpf/xsk.c
+++ b/drivers/net/ethernet/intel/idpf/xsk.c
@@ -401,7 +401,7 @@ int idpf_xskfq_init(struct idpf_buf_queue *bufq)
bufq->pending = fq.pending;
bufq->thresh = fq.thresh;
bufq->rx_buf_size = fq.buf_len;
- bufq->truesize = xsk_pool_get_rx_frag_step(fq.pool);
+ bufq->truesize = fq.chunk_align;
if (!idpf_xskfq_refill(bufq))
netdev_err(bufq->pool->netdev,
diff --git a/drivers/net/ethernet/intel/libeth/xsk.c b/drivers/net/ethernet/intel/libeth/xsk.c
index 846e902e31b6..5b298558ecfd 100644
--- a/drivers/net/ethernet/intel/libeth/xsk.c
+++ b/drivers/net/ethernet/intel/libeth/xsk.c
@@ -167,6 +167,7 @@ int libeth_xskfq_create(struct libeth_xskfq *fq)
fq->pending = fq->count;
fq->thresh = libeth_xdp_queue_threshold(fq->count);
fq->buf_len = xsk_pool_get_rx_frame_size(fq->pool);
+ fq->chunk_align = xsk_pool_get_rx_frag_step(fq->pool);
return 0;
}
diff --git a/include/net/libeth/xsk.h b/include/net/libeth/xsk.h
index 481a7b28e6f2..a3ea90d30d17 100644
--- a/include/net/libeth/xsk.h
+++ b/include/net/libeth/xsk.h
@@ -598,6 +598,7 @@ __libeth_xsk_run_pass(struct libeth_xdp_buff *xdp,
* @thresh: threshold below which the queue is refilled
* @buf_len: HW-writeable length per each buffer
* @nid: ID of the closest NUMA node with memory
+ * @chunk_align: step between consecutive buffers, 0 if none exists
*/
struct libeth_xskfq {
struct_group_tagged(libeth_xskfq_fp, fp,
@@ -615,6 +616,8 @@ struct libeth_xskfq {
u32 buf_len;
int nid;
+
+ u32 chunk_align;
};
int libeth_xskfq_create(struct libeth_xskfq *fq);
> >>
> >> if (!idpf_xskfq_refill(bufq))
> >> netdev_err(bufq->pool->netdev,
>
> Thanks,
> Olek
next prev parent reply other threads:[~2026-02-16 14:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 18:33 [PATCH bpf v2 0/9] Address XDP frags having negative tailroom Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 1/9] xdp: use modulo operation to calculate XDP frag tailroom Larysa Zaremba
2026-02-13 20:34 ` Jakub Kicinski
2026-02-12 18:33 ` [PATCH bpf v2 2/9] xsk: introduce helper to determine rxq->frag_size Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 3/9] ice: fix rxq info registering in mbuf packets Larysa Zaremba
2026-02-12 19:31 ` bot+bpf-ci
2026-02-12 18:33 ` [PATCH bpf v2 4/9] ice: change XDP RxQ frag_size from DMA write length to xdp.frame_sz Larysa Zaremba
2026-02-13 3:57 ` Loktionov, Aleksandr
2026-02-13 8:41 ` Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 5/9] i40e: fix registering XDP RxQ info Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 6/9] i40e: use xdp.frame_sz as XDP RxQ info frag_size Larysa Zaremba
2026-02-13 4:04 ` Loktionov, Aleksandr
2026-02-13 8:58 ` Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 7/9] idpf: use truesize " Larysa Zaremba
2026-02-16 10:46 ` Alexander Lobakin
2026-02-16 10:48 ` Alexander Lobakin
2026-02-16 14:01 ` Larysa Zaremba [this message]
2026-02-16 15:17 ` Alexander Lobakin
2026-02-12 18:33 ` [PATCH bpf v2 8/9] net: enetc: " Larysa Zaremba
2026-02-12 18:33 ` [PATCH bpf v2 9/9] xdp: produce a warning when calculated tailroom is negative Larysa Zaremba
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=aZMjSSiZ5cvwi_Ig@soc-5CG4396X81.clients.intel.com \
--to=larysa.zaremba@intel.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=dtatulea@nvidia.com \
--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=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=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=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