@@ -1649,6 +1649,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (!old_prog) {
peer->hw_features &= ~NETIF_F_GSO_SOFTWARE;
peer->max_mtu = max_mtu;
+ veth_set_rx_headroom(dev, XDP_PACKET_HEADROOM);
}
xdp_features_set_redirect_target(peer, true);
@@ -1666,6 +1667,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
peer->hw_features |= NETIF_F_GSO_SOFTWARE;
peer->max_mtu = ETH_MAX_MTU;
}
+ veth_set_rx_headroom(dev, -1);
}
bpf_prog_put(old_prog);
}
When sending (sendmsg) SKBs out an veth device, the SKB headroom is too small to satisfy XDP on the receiving veth peer device. For AF_XDP (normal non-zero-copy) it is worth noticing that xsk_build_skb() adjust headroom according to dev->needed_headroom. Other parts of the kernel also take this into account (see macro LL_RESERVED_SPACE). This solves the XDP_PACKET_HEADROOM check in veth_convert_skb_to_xdp_buff(). Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org> --- drivers/net/veth.c | 2 ++ 1 file changed, 2 insertions(+)