Skip to content

Commit b35a2d3

Browse files
kevin-laatz-intelborkmann
authored andcommitted
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: Kevin Laatz <[email protected]> Acked-by: Jonathan Lemon <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 10912fc commit b35a2d3

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ ixgbe_rx_buffer *ixgbe_get_rx_buffer_zc(struct ixgbe_ring *rx_ring,
201201
static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring,
202202
struct ixgbe_rx_buffer *obi)
203203
{
204-
unsigned long mask = (unsigned long)rx_ring->xsk_umem->chunk_mask;
205-
u64 hr = rx_ring->xsk_umem->headroom + XDP_PACKET_HEADROOM;
206204
u16 nta = rx_ring->next_to_alloc;
207205
struct ixgbe_rx_buffer *nbi;
208206

@@ -212,14 +210,9 @@ static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring,
212210
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
213211

214212
/* transfer page from old buffer to new buffer */
215-
nbi->dma = obi->dma & mask;
216-
nbi->dma += hr;
217-
218-
nbi->addr = (void *)((unsigned long)obi->addr & mask);
219-
nbi->addr += hr;
220-
221-
nbi->handle = obi->handle & mask;
222-
nbi->handle += rx_ring->xsk_umem->headroom;
213+
nbi->dma = obi->dma;
214+
nbi->addr = obi->addr;
215+
nbi->handle = obi->handle;
223216

224217
obi->addr = NULL;
225218
obi->skb = NULL;

0 commit comments

Comments
 (0)