Skip to content

Commit d8c3061

Browse files
kevin-laatz-intelborkmann
authored andcommitted
ixgbe: modify driver for handling offsets
With the addition of the unaligned chunks option, we need to make sure we handle the offsets accordingly based on the mode we are currently running in. This patch modifies the driver to appropriately mask the address for each case. Signed-off-by: Kevin Laatz <[email protected]> Acked-by: Jonathan Lemon <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 2f86c80 commit d8c3061

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,20 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter,
143143
struct ixgbe_ring *rx_ring,
144144
struct xdp_buff *xdp)
145145
{
146+
struct xdp_umem *umem = rx_ring->xsk_umem;
146147
int err, result = IXGBE_XDP_PASS;
148+
u64 offset = umem->headroom;
147149
struct bpf_prog *xdp_prog;
148150
struct xdp_frame *xdpf;
149151
u32 act;
150152

151153
rcu_read_lock();
152154
xdp_prog = READ_ONCE(rx_ring->xdp_prog);
153155
act = bpf_prog_run_xdp(xdp_prog, xdp);
154-
xdp->handle += xdp->data - xdp->data_hard_start;
156+
offset += xdp->data - xdp->data_hard_start;
157+
158+
xdp->handle = xsk_umem_adjust_offset(umem, xdp->handle, offset);
159+
155160
switch (act) {
156161
case XDP_PASS:
157162
break;
@@ -243,7 +248,7 @@ void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle)
243248
bi->addr = xdp_umem_get_data(rx_ring->xsk_umem, handle);
244249
bi->addr += hr;
245250

246-
bi->handle = (u64)handle + rx_ring->xsk_umem->headroom;
251+
bi->handle = (u64)handle;
247252
}
248253

249254
static bool ixgbe_alloc_buffer_zc(struct ixgbe_ring *rx_ring,
@@ -269,7 +274,7 @@ static bool ixgbe_alloc_buffer_zc(struct ixgbe_ring *rx_ring,
269274
bi->addr = xdp_umem_get_data(umem, handle);
270275
bi->addr += hr;
271276

272-
bi->handle = handle + umem->headroom;
277+
bi->handle = handle;
273278

274279
xsk_umem_discard_addr(umem);
275280
return true;
@@ -296,7 +301,7 @@ static bool ixgbe_alloc_buffer_slow_zc(struct ixgbe_ring *rx_ring,
296301
bi->addr = xdp_umem_get_data(umem, handle);
297302
bi->addr += hr;
298303

299-
bi->handle = handle + umem->headroom;
304+
bi->handle = handle;
300305

301306
xsk_umem_discard_addr_rq(umem);
302307
return true;

0 commit comments

Comments
 (0)