mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
i40e: use xdp.frame_sz as XDP RxQ info frag_size
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 i40e driver configuration lead
to negative tailroom.
Set frag_size to the same value as frame_sz in shared pages mode, use new
helper to set frag_size when AF_XDP ZC is active.
Fixes: a045d2f2d0 ("i40e: set xdp_rxq_info::frag_size")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Link: https://patch.msgid.link/20260305111253.2317394-7-larysa.zaremba@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8f497dc8a6
commit
c69d22c6c4
1 changed files with 6 additions and 3 deletions
|
|
@ -3569,6 +3569,7 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
|
|||
u16 pf_q = vsi->base_queue + ring->queue_index;
|
||||
struct i40e_hw *hw = &vsi->back->hw;
|
||||
struct i40e_hmc_obj_rxq rx_ctx;
|
||||
u32 xdp_frame_sz;
|
||||
int err = 0;
|
||||
bool ok;
|
||||
|
||||
|
|
@ -3578,6 +3579,7 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
|
|||
memset(&rx_ctx, 0, sizeof(rx_ctx));
|
||||
|
||||
ring->rx_buf_len = vsi->rx_buf_len;
|
||||
xdp_frame_sz = i40e_rx_pg_size(ring) / 2;
|
||||
|
||||
/* XDP RX-queue info only needed for RX rings exposed to XDP */
|
||||
if (ring->vsi->type != I40E_VSI_MAIN)
|
||||
|
|
@ -3585,11 +3587,12 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
|
|||
|
||||
ring->xsk_pool = i40e_xsk_pool(ring);
|
||||
if (ring->xsk_pool) {
|
||||
xdp_frame_sz = xsk_pool_get_rx_frag_step(ring->xsk_pool);
|
||||
ring->rx_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool);
|
||||
err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
|
||||
ring->queue_index,
|
||||
ring->q_vector->napi.napi_id,
|
||||
ring->rx_buf_len);
|
||||
xdp_frame_sz);
|
||||
if (err)
|
||||
return err;
|
||||
err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
|
||||
|
|
@ -3605,7 +3608,7 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
|
|||
err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
|
||||
ring->queue_index,
|
||||
ring->q_vector->napi.napi_id,
|
||||
ring->rx_buf_len);
|
||||
xdp_frame_sz);
|
||||
if (err)
|
||||
return err;
|
||||
err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
|
||||
|
|
@ -3616,7 +3619,7 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
|
|||
}
|
||||
|
||||
skip:
|
||||
xdp_init_buff(&ring->xdp, i40e_rx_pg_size(ring) / 2, &ring->xdp_rxq);
|
||||
xdp_init_buff(&ring->xdp, xdp_frame_sz, &ring->xdp_rxq);
|
||||
|
||||
rx_ctx.dbuff = DIV_ROUND_UP(ring->rx_buf_len,
|
||||
BIT_ULL(I40E_RXQ_CTX_DBUFF_SHIFT));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue