Skip to content

Commit 4efad19

Browse files
mfijalkoborkmann
authored andcommitted
ice, xsk: Avoid refilling single Rx descriptors
Call alloc Rx routine for ZC driver only when the amount of unallocated descriptors exceeds given threshold. Signed-off-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent a817ead commit 4efad19

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
587587
unsigned int xdp_xmit = 0;
588588
struct bpf_prog *xdp_prog;
589589
bool failure = false;
590+
int entries_to_alloc;
590591

591592
/* ZC patch is enabled only when XDP program is set,
592593
* so here it can not be NULL
@@ -678,7 +679,9 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
678679
ice_receive_skb(rx_ring, skb, vlan_tag);
679680
}
680681

681-
failure |= !ice_alloc_rx_bufs_zc(rx_ring, ICE_DESC_UNUSED(rx_ring));
682+
entries_to_alloc = ICE_DESC_UNUSED(rx_ring);
683+
if (entries_to_alloc > ICE_RING_QUARTER(rx_ring))
684+
failure |= !ice_alloc_rx_bufs_zc(rx_ring, entries_to_alloc);
682685

683686
ice_finalize_xdp_rx(xdp_ring, xdp_xmit);
684687
ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);

0 commit comments

Comments
 (0)