aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.15/609-v5.18-veth-Allow-jumbo-frames-in-xdp-mode.patch
blob: 8080d621da9fbb0465f3451626916c2cfe2995fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
commit 7cda76d858a4e71ac4a04066c093679a12e1312c
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Fri Mar 11 10:14:20 2022 +0100

    veth: Allow jumbo frames in xdp mode
    
    Allow increasing the MTU over page boundaries on veth devices
    if the attached xdp program declares to support xdp fragments.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Link: https://lore.kernel.org/bpf/d5dc039c3d4123426e7023a488c449181a7bc57f.1646989407.git.lorenzo@kernel.org

--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1470,9 +1470,14 @@ static int veth_xdp_set(struct net_devic
 			goto err;
 		}
 
-		max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
-			  peer->hard_header_len -
-			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+		max_mtu = SKB_WITH_OVERHEAD(PAGE_SIZE - VETH_XDP_HEADROOM) -
+			  peer->hard_header_len;
+		/* Allow increasing the max_mtu if the program supports
+		 * XDP fragments.
+		 */
+		//if (prog->aux->xdp_has_frags)
+		max_mtu += PAGE_SIZE * MAX_SKB_FRAGS;
+
 		if (peer->mtu > max_mtu) {
 			NL_SET_ERR_MSG_MOD(extack, "Peer MTU is too large to set XDP");
 			err = -ERANGE;