609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 7cda76d858a4e71ac4a04066c093679a12e1312c Mon Sep 17 00:00:00 2001
  2. From: Lorenzo Bianconi <[email protected]>
  3. Date: Fri, 11 Mar 2022 10:14:20 +0100
  4. Subject: [PATCH] veth: Allow jumbo frames in xdp mode
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Allow increasing the MTU over page boundaries on veth devices
  9. if the attached xdp program declares to support xdp fragments.
  10. Signed-off-by: Lorenzo Bianconi <[email protected]>
  11. Signed-off-by: Daniel Borkmann <[email protected]>
  12. Acked-by: Toke Høiland-Jørgensen <[email protected]>
  13. Acked-by: John Fastabend <[email protected]>
  14. Link: https://lore.kernel.org/bpf/d5dc039c3d4123426e7023a488c449181a7bc57f.1646989407.git.lorenzo@kernel.org
  15. ---
  16. drivers/net/veth.c | 11 ++++++++---
  17. 1 file changed, 8 insertions(+), 3 deletions(-)
  18. --- a/drivers/net/veth.c
  19. +++ b/drivers/net/veth.c
  20. @@ -1455,9 +1455,14 @@ static int veth_xdp_set(struct net_devic
  21. goto err;
  22. }
  23. - max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
  24. - peer->hard_header_len -
  25. - SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
  26. + max_mtu = SKB_WITH_OVERHEAD(PAGE_SIZE - VETH_XDP_HEADROOM) -
  27. + peer->hard_header_len;
  28. + /* Allow increasing the max_mtu if the program supports
  29. + * XDP fragments.
  30. + */
  31. + //if (prog->aux->xdp_has_frags)
  32. + max_mtu += PAGE_SIZE * MAX_SKB_FRAGS;
  33. +
  34. if (peer->mtu > max_mtu) {
  35. NL_SET_ERR_MSG_MOD(extack, "Peer MTU is too large to set XDP");
  36. err = -ERANGE;