kernel: pick patches for MediaTek Ethernet from linux-next
[openwrt/staging/nbd.git] / target / linux / generic / backport-5.15 / 609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch
1 commit 7cda76d858a4e71ac4a04066c093679a12e1312c
2 Author: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Fri Mar 11 10:14:20 2022 +0100
4
5 veth: Allow jumbo frames in xdp mode
6
7 Allow increasing the MTU over page boundaries on veth devices
8 if the attached xdp program declares to support xdp fragments.
9
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
12 Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
13 Acked-by: John Fastabend <john.fastabend@gmail.com>
14 Link: https://lore.kernel.org/bpf/d5dc039c3d4123426e7023a488c449181a7bc57f.1646989407.git.lorenzo@kernel.org
15
16 --- a/drivers/net/veth.c
17 +++ b/drivers/net/veth.c
18 @@ -1470,9 +1470,14 @@ static int veth_xdp_set(struct net_devic
19 goto err;
20 }
21
22 - max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
23 - peer->hard_header_len -
24 - SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
25 + max_mtu = SKB_WITH_OVERHEAD(PAGE_SIZE - VETH_XDP_HEADROOM) -
26 + peer->hard_header_len;
27 + /* Allow increasing the max_mtu if the program supports
28 + * XDP fragments.
29 + */
30 + //if (prog->aux->xdp_has_frags)
31 + max_mtu += PAGE_SIZE * MAX_SKB_FRAGS;
32 +
33 if (peer->mtu > max_mtu) {
34 NL_SET_ERR_MSG_MOD(extack, "Peer MTU is too large to set XDP");
35 err = -ERANGE;