i40evf: Fix turning TSO, GSO and GRO on after
authorPaweł Jabłoński <pawel.jablonski@intel.com>
Fri, 20 Apr 2018 08:41:36 +0000 (01:41 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Mon, 30 Apr 2018 16:19:55 +0000 (09:19 -0700)
This patch fixes the problem where each MTU change turns TSO,
GSO and GRO on from off state.

Now when TSO, GSO or GRO is turned off, MTU change does not
turn them on.

Signed-off-by: Paweł Jabłoński <pawel.jablonski@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40evf_main.c

index 28a8cc4..3f04a18 100644 (file)
@@ -3357,6 +3357,24 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
        if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)
                netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
+       /* Do not turn on offloads when they are requested to be turned off.
+        * TSO needs minimum 576 bytes to work correctly.
+        */
+       if (netdev->wanted_features) {
+               if (!(netdev->wanted_features & NETIF_F_TSO) ||
+                   netdev->mtu < 576)
+                       netdev->features &= ~NETIF_F_TSO;
+               if (!(netdev->wanted_features & NETIF_F_TSO6) ||
+                   netdev->mtu < 576)
+                       netdev->features &= ~NETIF_F_TSO6;
+               if (!(netdev->wanted_features & NETIF_F_TSO_ECN))
+                       netdev->features &= ~NETIF_F_TSO_ECN;
+               if (!(netdev->wanted_features & NETIF_F_GRO))
+                       netdev->features &= ~NETIF_F_GRO;
+               if (!(netdev->wanted_features & NETIF_F_GSO))
+                       netdev->features &= ~NETIF_F_GSO;
+       }
+
        adapter->vsi.id = adapter->vsi_res->vsi_id;
 
        adapter->vsi.back = adapter;