Skip to content

Commit 4fa8fcd

Browse files
netoptimizeranguy11
authored andcommitted
igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS
Driver already implicitly supports XDP metadata access in AF_XDP zero-copy mode, as xsk_buff_pool's xp_alloc() naturally set xdp_buff data_meta equal data. This works fine for XDP and AF_XDP, but if a BPF-prog adjust via bpf_xdp_adjust_meta() and choose to call XDP_PASS, then igc function igc_construct_skb_zc() will construct an invalid SKB packet. The function correctly include the xdp->data_meta area in the memcpy, but forgot to pull header to take metasize into account. Fixes: fc9df2a ("igc: Enable RX via AF_XDP zero-copy") Signed-off-by: Jesper Dangaard Brouer <[email protected]> Tested-by: Nechama Kraus <[email protected]> Acked-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 196073f commit 4fa8fcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2448,8 +2448,10 @@ static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring,
24482448

24492449
skb_reserve(skb, xdp->data_meta - xdp->data_hard_start);
24502450
memcpy(__skb_put(skb, totalsize), xdp->data_meta, totalsize);
2451-
if (metasize)
2451+
if (metasize) {
24522452
skb_metadata_set(skb, metasize);
2453+
__skb_pull(skb, metasize);
2454+
}
24532455

24542456
return skb;
24552457
}

0 commit comments

Comments
 (0)