c8627e0f714575d8c38d26ce28fb91323c82d389
[openwrt/staging/noltari.git] / target / linux / generic / backport-5.15 / 609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch
1 From 7cda76d858a4e71ac4a04066c093679a12e1312c Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
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
9 Allow increasing the MTU over page boundaries on veth devices
10 if the attached xdp program declares to support xdp fragments.
11
12 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
13 Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
14 Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
15 Acked-by: John Fastabend <john.fastabend@gmail.com>
16 Link: https://lore.kernel.org/bpf/d5dc039c3d4123426e7023a488c449181a7bc57f.1646989407.git.lorenzo@kernel.org
17 ---
18 drivers/net/veth.c | 11 ++++++++---
19 1 file changed, 8 insertions(+), 3 deletions(-)
20
21 diff --git a/drivers/net/veth.c b/drivers/net/veth.c
22 index bfae15ec902b..1b5714926d81 100644
23 --- a/drivers/net/veth.c
24 +++ b/drivers/net/veth.c
25 @@ -1470,9 +1470,14 @@ static int veth_xdp_set(struct net_devic
26 goto err;
27 }
28
29 - max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
30 - peer->hard_header_len -
31 - SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
32 + max_mtu = SKB_WITH_OVERHEAD(PAGE_SIZE - VETH_XDP_HEADROOM) -
33 + peer->hard_header_len;
34 + /* Allow increasing the max_mtu if the program supports
35 + * XDP fragments.
36 + */
37 + //if (prog->aux->xdp_has_frags)
38 + max_mtu += PAGE_SIZE * MAX_SKB_FRAGS;
39 +
40 if (peer->mtu > max_mtu) {
41 NL_SET_ERR_MSG_MOD(extack, "Peer MTU is too large to set XDP");
42 err = -ERANGE;