public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Larysa Zaremba <larysa.zaremba@intel.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Cc: "Larysa Zaremba" <larysa.zaremba@intel.com>,
	"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>,
	"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, 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>,
	"Magnus Karlsson" <magnus.karlsson@intel.com>
Subject: [PATCH net v5 4/9] ice: change XDP RxQ frag_size from DMA write length to xdp.frame_sz
Date: Thu,  5 Mar 2026 12:12:45 +0100	[thread overview]
Message-ID: <20260305111253.2317394-5-larysa.zaremba@intel.com> (raw)
In-Reply-To: <20260305111253.2317394-1-larysa.zaremba@intel.com>

The only user of frag_size field in XDP RxQ info is
bpf_xdp_frags_increase_tail(). It clearly expects whole buff size instead
of DMA write size. Different assumptions in ice driver configuration lead
to negative tailroom.

This allows to trigger kernel panic, when using
XDP_ADJUST_TAIL_GROW_MULTI_BUFF xskxceiver test and changing packet size to
6912 and the requested offset to a huge value, e.g.
XSK_UMEM__MAX_FRAME_SIZE * 100.

Due to other quirks of the ZC configuration in ice, panic is not observed
in ZC mode, but tailroom growing still fails when it should not.

Use fill queue buffer truesize instead of DMA write size in XDP RxQ info.
Fix ZC mode too by using the new helper.

Fixes: 2fba7dc5157b ("ice: Add support for XDP multi-buffer on Rx side")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_base.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index 165ef8afa8b0..1667f686ff75 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -661,7 +661,6 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
 {
 	struct device *dev = ice_pf_to_dev(ring->vsi->back);
 	u32 num_bufs = ICE_DESC_UNUSED(ring);
-	u32 rx_buf_len;
 	int err;
 
 	if (ring->vsi->type == ICE_VSI_PF || ring->vsi->type == ICE_VSI_SF ||
@@ -672,12 +671,12 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
 			return err;
 
 		if (ring->xsk_pool) {
-			rx_buf_len =
-				xsk_pool_get_rx_frame_size(ring->xsk_pool);
+			u32 frag_size =
+				xsk_pool_get_rx_frag_step(ring->xsk_pool);
 			err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
 						 ring->q_index,
 						 ring->q_vector->napi.napi_id,
-						 rx_buf_len);
+						 frag_size);
 			if (err)
 				return err;
 			err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
@@ -697,7 +696,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
 			err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
 						 ring->q_index,
 						 ring->q_vector->napi.napi_id,
-						 ring->rx_buf_len);
+						 ring->truesize);
 			if (err)
 				goto err_destroy_fq;
 
-- 
2.52.0


  parent reply	other threads:[~2026-03-05 11:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 11:12 [PATCH net v5 0/9] Address XDP frags having negative tailroom Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 1/9] xdp: use modulo operation to calculate XDP frag tailroom Larysa Zaremba
2026-03-05 16:10   ` patchwork-bot+netdevbpf
2026-03-05 11:12 ` [PATCH net v5 2/9] xsk: introduce helper to determine rxq->frag_size Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 3/9] ice: fix rxq info registering in mbuf packets Larysa Zaremba
2026-03-05 11:12 ` Larysa Zaremba [this message]
2026-03-05 15:08   ` [PATCH net v5 4/9] ice: change XDP RxQ frag_size from DMA write length to xdp.frame_sz Frank Li
2026-03-05 15:18     ` Vladimir Oltean
2026-03-05 15:25       ` Frank Li
2026-03-05 11:12 ` [PATCH net v5 5/9] i40e: fix registering XDP RxQ info Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 6/9] i40e: use xdp.frame_sz as XDP RxQ info frag_size Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 7/9] libeth, idpf: use truesize " Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 8/9] net: enetc: " Larysa Zaremba
2026-03-05 11:12 ` [PATCH net v5 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=20260305111253.2317394-5-larysa.zaremba@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=magnus.karlsson@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