qlcnic: turn off lro when rxcsum is disabled.
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Tue, 17 Aug 2010 00:34:25 +0000 (00:34 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Aug 2010 10:59:49 +0000 (03:59 -0700)
o Also dont allow lro to be turn on, if rx csum is disabled

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@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_ethtool.c
drivers/net/qlcnic/qlcnic_main.c

index 7f4e11bd4cd4842a416c532f8b80df5d864e1f66..f6b887d409d59659597810b217cb758349f6ee37 100644 (file)
@@ -894,6 +894,7 @@ struct qlcnic_mac_req {
 #define QLCNIC_MSI_ENABLED             0x02
 #define QLCNIC_MSIX_ENABLED            0x04
 #define QLCNIC_LRO_ENABLED             0x08
+#define QLCNIC_LRO_DISABLED            0x00
 #define QLCNIC_BRIDGE_ENABLED          0X10
 #define QLCNIC_DIAG_ENABLED            0x20
 #define QLCNIC_ESWITCH_ENABLED         0x40
index 3d4655dce4b516d90070ebbb26cb66287f448295..e38fc3d96d43ce96d192e9ff7e368059c8e1aca4 100644 (file)
@@ -818,7 +818,21 @@ static u32 qlcnic_get_rx_csum(struct net_device *dev)
 static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)
 {
        struct qlcnic_adapter *adapter = netdev_priv(dev);
+
+       if (!!data) {
+               adapter->rx_csum = !!data;
+               return 0;
+       }
+
+       if (adapter->flags & QLCNIC_LRO_ENABLED) {
+               if (qlcnic_config_hw_lro(adapter, QLCNIC_LRO_DISABLED))
+                       return -EIO;
+
+               dev->features &= ~NETIF_F_LRO;
+               qlcnic_send_lro_cleanup(adapter);
+       }
        adapter->rx_csum = !!data;
+       dev_info(&adapter->pdev->dev, "disabling LRO as rx_csum is off\n");
        return 0;
 }
 
@@ -1001,6 +1015,15 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)
        if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
                return -EINVAL;
 
+       if (!adapter->rx_csum) {
+               dev_info(&adapter->pdev->dev, "rx csum is off, "
+                       "cannot toggle lro\n");
+               return -EINVAL;
+       }
+
+       if ((data & ETH_FLAG_LRO) && (adapter->flags & QLCNIC_LRO_ENABLED))
+               return 0;
+
        if (data & ETH_FLAG_LRO) {
                hw_lro = QLCNIC_LRO_ENABLED;
                netdev->features |= NETIF_F_LRO;
index bf4077a1e8248259fcc2a798cbcc6fea0989c1b1..abd7cd6db6fdd18aa64c3d7283bdcd6435fc2ede 100644 (file)
@@ -995,7 +995,7 @@ __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
 
        qlcnic_config_intr_coalesce(adapter);
 
-       if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
+       if (netdev->features & NETIF_F_LRO)
                qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED);
 
        qlcnic_napi_enable(adapter);