Skip to content

Commit e142dc4

Browse files
walking-machinekuba-moo
authored andcommitted
ice: change XDP RxQ frag_size from DMA write length to xdp.frame_sz
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 <[email protected]> Signed-off-by: Larysa Zaremba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 02852b4 commit e142dc4

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)