summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@redhat.com>2019-04-11 12:26:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-27 09:35:35 +0200
commit4a692bc1d5fa706d9170404c34b3efa190ebf039 (patch)
tree9f3db7533169ff1771935d93c7e5fa2b43e9ee8a
parent6d5d30e03309fc22a48fc522b2e3f3c02c130092 (diff)
downloadlinux-stable-4a692bc1d5fa706d9170404c34b3efa190ebf039.tar.gz
linux-stable-4a692bc1d5fa706d9170404c34b3efa190ebf039.tar.bz2
linux-stable-4a692bc1d5fa706d9170404c34b3efa190ebf039.zip
net: thunderx: don't allow jumbo frames with XDP
[ Upstream commit 1f227d16083b2e280b7dde4ca78883d75593f2fd ] The thunderx driver forbids to load an eBPF program if the MTU is too high, but this can be circumvented by loading the eBPF, then raising the MTU. Fix this by limiting the MTU if an eBPF program is already loaded. Fixes: 05c773f52b96e ("net: thunderx: Add basic XDP support") Signed-off-by: Matteo Croce <mcroce@redhat.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/cavium/thunder/nicvf_main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index bbe8add918b7..98734a37b6f6 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1461,6 +1461,15 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu)
struct nicvf *nic = netdev_priv(netdev);
int orig_mtu = netdev->mtu;
+ /* For now just support only the usual MTU sized frames,
+ * plus some headroom for VLAN, QinQ.
+ */
+ if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) {
+ netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
+ netdev->mtu);
+ return -EINVAL;
+ }
+
netdev->mtu = new_mtu;
if (!netif_running(netdev))