ionic: set MTU floor at ETH_MIN_MTU
authorShannon Nelson <snelson@pensando.io>
Thu, 27 Aug 2020 23:00:19 +0000 (16:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Aug 2020 15:01:29 +0000 (08:01 -0700)
The NIC might tell us its minimum MTU, but let's be sure not
to use something smaller than ETH_MIN_MTU.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_lif.c

index 26988ad7ec97919c58128ab1dd727e4589eaf206..235215c28f29969684bfbe29ff3fa708effe70f0 100644 (file)
@@ -2079,7 +2079,8 @@ static struct ionic_lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index
        lif->identity = lid;
        lif->lif_type = IONIC_LIF_TYPE_CLASSIC;
        ionic_lif_identify(ionic, lif->lif_type, lif->identity);
-       lif->netdev->min_mtu = le32_to_cpu(lif->identity->eth.min_frame_size);
+       lif->netdev->min_mtu = max_t(unsigned int, ETH_MIN_MTU,
+                                    le32_to_cpu(lif->identity->eth.min_frame_size));
        lif->netdev->max_mtu =
                le32_to_cpu(lif->identity->eth.max_frame_size) - ETH_HLEN - VLAN_HLEN;