ixgbe/ixgbevf: Enables TSO for MPLS encapsulated packets
authorScott Peterson <scott.d.peterson@intel.com>
Fri, 18 Nov 2016 19:25:42 +0000 (11:25 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 31 May 2017 11:16:28 +0000 (04:16 -0700)
This patch advertises TSO & GSO features in netdev->mpls_features.
In ixgbe(vf)_tso() where we set up segmentation offload, the IP
header will be the inner network header when eth_p_mpls() indicates
the Ethernet protocol is MPLS (UC or MC).

Suggested-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Scott Peterson <scott.d.peterson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c

index d39cba214320bd2565d6ad072610b48178897733..c263e22936616a77d63270a624ece2375e1d8be3 100644 (file)
@@ -58,6 +58,7 @@
 #include <net/tc_act/tc_gact.h>
 #include <net/tc_act/tc_mirred.h>
 #include <net/vxlan.h>
+#include <net/mpls.h>
 
 #include "ixgbe.h"
 #include "ixgbe_common.h"
@@ -7667,7 +7668,10 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
        if (err < 0)
                return err;
 
-       ip.hdr = skb_network_header(skb);
+       if (eth_p_mpls(first->protocol))
+               ip.hdr = skb_inner_network_header(skb);
+       else
+               ip.hdr = skb_network_header(skb);
        l4.hdr = skb_checksum_start(skb);
 
        /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
@@ -10191,7 +10195,11 @@ skip_sriov:
 
        netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
        netdev->hw_enc_features |= netdev->vlan_features;
-       netdev->mpls_features |= NETIF_F_HW_CSUM;
+       netdev->mpls_features |= NETIF_F_SG |
+                                NETIF_F_TSO |
+                                NETIF_F_TSO6 |
+                                NETIF_F_HW_CSUM;
+       netdev->mpls_features |= IXGBE_GSO_PARTIAL_FEATURES;
 
        /* set this bit last since it cannot be part of vlan_features */
        netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
index eee29bddddc117569788c73e4a93f0d2b6b14bfc..706d868a778dbaac45e2ac1402a69711f4c6e15e 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/if.h>
 #include <linux/if_vlan.h>
 #include <linux/prefetch.h>
+#include <net/mpls.h>
 
 #include "ixgbevf.h"
 
@@ -3321,7 +3322,10 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,
        if (err < 0)
                return err;
 
-       ip.hdr = skb_network_header(skb);
+       if (eth_p_mpls(first->protocol))
+               ip.hdr = skb_inner_network_header(skb);
+       else
+               ip.hdr = skb_network_header(skb);
        l4.hdr = skb_checksum_start(skb);
 
        /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
@@ -4075,7 +4079,11 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                netdev->features |= NETIF_F_HIGHDMA;
 
        netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
-       netdev->mpls_features |= NETIF_F_HW_CSUM;
+       netdev->mpls_features |= NETIF_F_SG |
+                                NETIF_F_TSO |
+                                NETIF_F_TSO6 |
+                                NETIF_F_HW_CSUM;
+       netdev->mpls_features |= IXGBEVF_GSO_PARTIAL_FEATURES;
        netdev->hw_enc_features |= netdev->vlan_features;
 
        /* set this bit last since it cannot be part of vlan_features */