Commit b35a2d3e authored by Kevin Laatz's avatar Kevin Laatz Committed by Daniel Borkmann

ixgbe: simplify Rx buffer recycle

Currently, the dma, addr and handle are modified when we reuse Rx buffers
in zero-copy mode. However, this is not required as the inputs to the
function are copies, not the original values themselves. As we use the
copies within the function, we can use the original 'obi' values
directly without having to mask and add the headroom.
Signed-off-by: default avatarKevin Laatz <kevin.laatz@intel.com>
Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 10912fc9
...@@ -201,8 +201,6 @@ ixgbe_rx_buffer *ixgbe_get_rx_buffer_zc(struct ixgbe_ring *rx_ring, ...@@ -201,8 +201,6 @@ ixgbe_rx_buffer *ixgbe_get_rx_buffer_zc(struct ixgbe_ring *rx_ring,
static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring, static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring,
struct ixgbe_rx_buffer *obi) struct ixgbe_rx_buffer *obi)
{ {
unsigned long mask = (unsigned long)rx_ring->xsk_umem->chunk_mask;
u64 hr = rx_ring->xsk_umem->headroom + XDP_PACKET_HEADROOM;
u16 nta = rx_ring->next_to_alloc; u16 nta = rx_ring->next_to_alloc;
struct ixgbe_rx_buffer *nbi; struct ixgbe_rx_buffer *nbi;
...@@ -212,14 +210,9 @@ static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring, ...@@ -212,14 +210,9 @@ static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring,
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
/* transfer page from old buffer to new buffer */ /* transfer page from old buffer to new buffer */
nbi->dma = obi->dma & mask; nbi->dma = obi->dma;
nbi->dma += hr; nbi->addr = obi->addr;
nbi->handle = obi->handle;
nbi->addr = (void *)((unsigned long)obi->addr & mask);
nbi->addr += hr;
nbi->handle = obi->handle & mask;
nbi->handle += rx_ring->xsk_umem->headroom;
obi->addr = NULL; obi->addr = NULL;
obi->skb = NULL; obi->skb = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment