# \[PATCH net-next RFC v1 0/4\] veth: reduce reallocations of SKBs when XDP bpf-prog is loaded

- From: Jesper Dangaard Brouer \<hawk@kernel.org\>
- Date: 2023-08-22 17:59:06 
- List: netdev
- Page: https://ratatoskr.run/netdev/2023/08/11270394
- Thread: https://ratatoskr.run/netdev/2023/08/11270394/t.md

```text
Loading an XDP bpf-prog on veth device driver results in a significant
performance degradation (for normal unrelated traffic) due to
veth_convert_skb_to_xdp_buff() in most cases fully reallocates an SKB and copy
data over, even when XDP prog does nothing (e.g. XDP_PASS).

This patchset reduce the cases that cause reallocation.
After patchset UDP and AF_XDP sending avoids reallocations.

Future work will investigate TCP.

---

Jesper Dangaard Brouer (4):
      veth: use same bpf_xdp_adjust_head check as generic-XDP
      veth: use generic-XDP functions when dealing with SKBs
      veth: lift skb_head_is_locked restriction for SKB based XDP
      veth: when XDP is loaded increase needed_headroom


 drivers/net/veth.c | 86 +++++++++++++++++++---------------------------
 net/core/dev.c     |  1 +
 net/core/filter.c  |  1 +
 3 files changed, 38 insertions(+), 50 deletions(-)

--
Jesper

```
