qlcnic: set mtu lower limit
authorSritej Velaga <sritej.velaga@qlogic.com>
Mon, 4 Oct 2010 04:20:16 +0000 (04:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Oct 2010 05:46:52 +0000 (22:46 -0700)
Setting mtu < 68 is not supported.

Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_hw.c

index 9d80171a1fbfa732970b84f96487990daaf31a70..42a288348aca22d0d458c325125e67289f5777f2 100644 (file)
@@ -95,6 +95,7 @@
 #define FIRST_PAGE_GROUP_END   0x100000
 
 #define P3_MAX_MTU                     (9600)
+#define P3_MIN_MTU                     (68)
 #define QLCNIC_MAX_ETHERHDR                32 /* This contains some padding */
 
 #define QLCNIC_P3_RX_BUF_MAX_LEN         (QLCNIC_MAX_ETHERHDR + ETH_DATA_LEN)
index 712cfabc2825ae00bb548e8083dffcf3251c7f7d..9d3e16dbd0430b2d31560779823da8987ca3dd97 100644 (file)
@@ -758,9 +758,9 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
        struct qlcnic_adapter *adapter = netdev_priv(netdev);
        int rc = 0;
 
-       if (mtu > P3_MAX_MTU) {
-               dev_err(&adapter->netdev->dev, "mtu > %d bytes unsupported\n",
-                                               P3_MAX_MTU);
+       if (mtu < P3_MIN_MTU || mtu > P3_MAX_MTU) {
+               dev_err(&adapter->netdev->dev, "%d bytes < mtu < %d bytes"
+                       " not supported\n", P3_MAX_MTU, P3_MIN_MTU);
                return -EINVAL;
        }