Skip to content

Commit b0f0510

Browse files
walking-machineSasha Levin
authored andcommitted
ice: change XDP RxQ frag_size from DMA write length to xdp.frame_sz
[ Upstream commit e142dc4 ] 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: 2fba7dc ("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> Link: https://patch.msgid.link/20260305111253.2317394-5-larysa.zaremba@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a5b3a86 commit b0f0510

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
661661
{
662662
struct device *dev = ice_pf_to_dev(ring->vsi->back);
663663
u32 num_bufs = ICE_DESC_UNUSED(ring);
664-
u32 rx_buf_len;
665664
int err;
666665

667666
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)
672671
return err;
673672

674673
if (ring->xsk_pool) {
675-
rx_buf_len =
676-
xsk_pool_get_rx_frame_size(ring->xsk_pool);
674+
u32 frag_size =
675+
xsk_pool_get_rx_frag_step(ring->xsk_pool);
677676
err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
678677
ring->q_index,
679678
ring->q_vector->napi.napi_id,
680-
rx_buf_len);
679+
frag_size);
681680
if (err)
682681
return err;
683682
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)
697696
err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
698697
ring->q_index,
699698
ring->q_vector->napi.napi_id,
700-
ring->rx_buf_len);
699+
ring->truesize);
701700
if (err)
702701
goto err_destroy_fq;
703702

0 commit comments

Comments
 (0)