Message ID | 20190411102633.3685-3-mcroce@redhat.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Commit | 1f227d16083b2e280b7dde4ca78883d75593f2fd |
Headers | show |
Series | Fix thunderx MTU with XDP | expand |
On Thu, 11 Apr 2019 12:26:33 +0200 Matteo Croce <mcroce@redhat.com> wrote: > 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> LGTM Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index debc8c861c6b..c032bef1b776 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1589,6 +1589,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))
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> --- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 9 +++++++++ 1 file changed, 9 insertions(+)