]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/net-thunderx-don-t-allow-jumbo-frames-with-xdp.patch
f9cdae9af8f64f6e7d9ffb20e45ba9a9dbbe9bbd
[thirdparty/kernel/stable-queue.git] / queue-4.19 / net-thunderx-don-t-allow-jumbo-frames-with-xdp.patch
1 From foo@baz Sat Apr 20 16:43:55 CEST 2019
2 From: Matteo Croce <mcroce@redhat.com>
3 Date: Thu, 11 Apr 2019 12:26:33 +0200
4 Subject: net: thunderx: don't allow jumbo frames with XDP
5
6 From: Matteo Croce <mcroce@redhat.com>
7
8 [ Upstream commit 1f227d16083b2e280b7dde4ca78883d75593f2fd ]
9
10 The thunderx driver forbids to load an eBPF program if the MTU is too high,
11 but this can be circumvented by loading the eBPF, then raising the MTU.
12
13 Fix this by limiting the MTU if an eBPF program is already loaded.
14
15 Fixes: 05c773f52b96e ("net: thunderx: Add basic XDP support")
16 Signed-off-by: Matteo Croce <mcroce@redhat.com>
17 Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/net/ethernet/cavium/thunder/nicvf_main.c | 9 +++++++++
22 1 file changed, 9 insertions(+)
23
24 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
25 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
26 @@ -1554,6 +1554,15 @@ static int nicvf_change_mtu(struct net_d
27 struct nicvf *nic = netdev_priv(netdev);
28 int orig_mtu = netdev->mtu;
29
30 + /* For now just support only the usual MTU sized frames,
31 + * plus some headroom for VLAN, QinQ.
32 + */
33 + if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) {
34 + netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
35 + netdev->mtu);
36 + return -EINVAL;
37 + }
38 +
39 netdev->mtu = new_mtu;
40
41 if (!netif_running(netdev))