]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ipoib: added an error message when trying to change mtu to 2K-4K
authorNoa Osherovich <noaos@mellanox.com>
Thu, 5 Dec 2013 08:24:55 +0000 (10:24 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:16 +0000 (14:45 -0700)
Max mtu defined by IB is 4K, but mcast_mtu is limited to 2K,
so any request to change mtu to a value between 2K-4K didn't
change the mtu, but also didn't show an error message.
An error value (-EINVAL) is now returned and an ipoib_warn
is issued in such cases.

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index f2dc1c4553337fb5e5aa258dc26c1dd999acc59f..9f9864b42c0b0fc981fca1b2ab5e409b0e9e54f7 100644 (file)
@@ -218,6 +218,11 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
        priv->admin_mtu = new_mtu;
 
        dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
+       if (dev->mtu < new_mtu) {
+               ipoib_warn(priv, "mtu must be smaller than mcast_mtu (%d)\n",
+                          priv->mcast_mtu);
+               return -EINVAL;
+       }
 
        return 0;
 }