Skip to contentSkip to conversation

Add support for GSO partial to Intel NIC drivers

PATCH New Alexander Duyck 4 participants 12 messages Apr 14, 2016 – May 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Add support for GSO partial to Intel NIC drivers

So these are the patches needed to enable tunnel segmentation offloads on the igb, igbvf, ixgbe, and ixgbevf drivers. In addition this patch extends the i40e and i40evf drivers to include segmentation support for tunnels with outer checksums.

The net performance gain for these patches are pretty significant. In the case of i40e a tunnel with outer checksums showed the following improvement:
Throughput Throughput Local Local Result
Units CPU Service Tag
Util Demand
%

14066.29   10^6bits/s  3.49  0.651   "before"
20618.16   10^6bits/s  3.09  0.393   "after"

For ixgbe similar results were seen:

Throughput Throughput  Local  Local   Result
           Units       CPU    Service Tag
                       Util   Demand
                       %
12879.89   10^6bits/s  10.00  0.763   "before"
14286.77   10^6bits/s  5.74   0.395   "after"

These patches rely on patches that were recently added to net-next so please make certain to pull the latest net-next before attempting to build with these patches.

Testing Hints:
For the i40e(vf) driver it is just a matter of creating a set of tunnels with the checksum unabled. If using the latest net-next kernel and iproute2 build this should be the default for tunnels such as VXLAN. Turning off the feature "tx-gso-partial" should also turn off "tx-gre-csum-segmentation" and "tx-udp_tnl-csum-segmentation".

For the igb(vf) and ixgbe(vf) drivers you will need to set the feature "tx-tcp-mangle-id-segmentation" to "on" in ethtool to enable the segmentation offload for TCPv4 inside of tunnels, otherwise only TCPv6 inside the tunnel will be offloaded. If "tx-gso-partial" is turned off then you should see all of the tunnel segmentation offloads turned off including gre, gre-csum, ipip, sit, udp_tnl, and udp_tnl-csum.

I also have some patches I have submitted to net-next that will enable offloads for GRE tunnels over IPv6. Once those are accepted you should be able to test all of the tunnel types traversing over IPv4 or IPv6 as the underlying L3.

---

Alexander Duyck (3):
i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM ixgbe/ixgbevf: Add support for GSO partial
igb/igbvf: Add support for GSO partial

 drivers/net/ethernet/intel/i40e/i40e_main.c       |   10 +
 drivers/net/ethernet/intel/i40e/i40e_txrx.c       |    7 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c     |    7 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c   |   10 +
 drivers/net/ethernet/intel/igb/igb_main.c         |  137 +++++++++++-----
 drivers/net/ethernet/intel/igbvf/netdev.c         |  182 ++++++++++++---------
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  133 ++++++++++-----
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  129 +++++++++++----
 8 files changed, 411 insertions(+), 204 deletions(-)

--

#1 lore raw

PATCH v2 1/3 i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM

This patch makes it so that i40e and i40evf can use GSO_PARTIAL to support segmentation for frames with checksums enabled in outer headers. As a result we can now send data over these types of tunnels at over 20Gb/s versus the 12Gb/s that was previously possible on my system.

The advantage with the i40e parts is that this offload is mostly transparent as the hardware still deals with the inner and/or outer IPv4 headers so the IP ID is still incrementing for both when this offload is performed.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c     |   10 ++++++++--
 drivers/net/ethernet/intel/i40e/i40e_txrx.c     |    7 ++++++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |    7 ++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |   10 ++++++++--
 4 files changed, 28 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -2
index 19a2d3033f7f..8e6c0f2487d7 100644
@@ -9130,20 +9130,25 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 				   NETIF_F_TSO_ECN		|
 				   NETIF_F_TSO6			|
 				   NETIF_F_GSO_GRE		|
+				   NETIF_F_GSO_GRE_CSUM		|
 				   NETIF_F_GSO_IPIP		|
 				   NETIF_F_GSO_SIT		|
 				   NETIF_F_GSO_UDP_TUNNEL	|
 				   NETIF_F_GSO_UDP_TUNNEL_CSUM	|
+				   NETIF_F_GSO_PARTIAL		|
 				   NETIF_F_SCTP_CRC		|
 				   NETIF_F_RXHASH		|
 				   NETIF_F_RXCSUM		|
 				   0;
 
 	if (!(pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE))
-		netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+		netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+
+	netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
 
 	/* record features VLANs can make use of */
-	netdev->vlan_features |= netdev->hw_enc_features;
+	netdev->vlan_features |= netdev->hw_enc_features |
+				 NETIF_F_TSO_MANGLEID;
 
 	if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
 		netdev->hw_features |= NETIF_F_NTUPLE;
@@ -9153,6 +9158,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 			       NETIF_F_HW_VLAN_CTAG_RX;
 
 	netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
+	netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
 
 	if (vsi->type == I40E_VSI_MAIN) {
 		SET_NETDEV_DEV(netdev, &pf->pdev->dev);
drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 -1
index 17ee438d1e03..4e5ecc36313c 100644
@@ -2319,11 +2319,15 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 	}
 
 	if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+					 SKB_GSO_GRE_CSUM |
 					 SKB_GSO_IPIP |
 					 SKB_GSO_SIT |
 					 SKB_GSO_UDP_TUNNEL |
 					 SKB_GSO_UDP_TUNNEL_CSUM)) {
-		if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) {
+		if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
+		    (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) {
+			l4.udp->len = 0;
+
 			/* determine offset of outer transport header */
 			l4_offset = l4.hdr - skb->data;
 
@@ -2500,6 +2504,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 
 		/* indicate if we need to offload outer UDP header */
 		if ((*tx_flags & I40E_TX_FLAGS_TSO) &&
+		    !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
 		    (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
 			tunnel |= I40E_TXD_CTX_QW0_L4T_CS_MASK;
 
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +6 -1
index 4633235ee70b..ede8dfc189bc 100644
@@ -1566,11 +1566,15 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 	}
 
 	if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+					 SKB_GSO_GRE_CSUM |
 					 SKB_GSO_IPIP |
 					 SKB_GSO_SIT |
 					 SKB_GSO_UDP_TUNNEL |
 					 SKB_GSO_UDP_TUNNEL_CSUM)) {
-		if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) {
+		if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
+		    (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) {
+			l4.udp->len = 0;
+
 			/* determine offset of outer transport header */
 			l4_offset = l4.hdr - skb->data;
 
@@ -1705,6 +1709,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 
 		/* indicate if we need to offload outer UDP header */
 		if ((*tx_flags & I40E_TX_FLAGS_TSO) &&
+		    !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
 		    (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
 			tunnel |= I40E_TXD_CTX_QW0_L4T_CS_MASK;
 
drivers/net/ethernet/intel/i40evf/i40evf_main.c +8 -2
index b9b1dd831a16..9f0bd7acc22a 100644
@@ -2240,20 +2240,25 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
 				   NETIF_F_TSO_ECN		|
 				   NETIF_F_TSO6			|
 				   NETIF_F_GSO_GRE		|
+				   NETIF_F_GSO_GRE_CSUM		|
 				   NETIF_F_GSO_IPIP		|
 				   NETIF_F_GSO_SIT		|
 				   NETIF_F_GSO_UDP_TUNNEL	|
 				   NETIF_F_GSO_UDP_TUNNEL_CSUM	|
+				   NETIF_F_GSO_PARTIAL		|
 				   NETIF_F_SCTP_CRC		|
 				   NETIF_F_RXHASH		|
 				   NETIF_F_RXCSUM		|
 				   0;
 
 	if (!(adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE))
-		netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+		netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+
+	netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
 
 	/* record features VLANs can make use of */
-	netdev->vlan_features |= netdev->hw_enc_features;
+	netdev->vlan_features |= netdev->hw_enc_features |
+				 NETIF_F_TSO_MANGLEID;
 
 	/* Write features and hw_features separately to avoid polluting
 	 * with, or dropping, features that are set when we registgered.
@@ -2261,6 +2266,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
 	netdev->hw_features |= netdev->hw_enc_features;
 
 	netdev->features |= netdev->hw_enc_features | I40EVF_VLAN_FEATURES;
+	netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
 
 	/* disable VLAN features if not supported */
 	if (!(vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN))
#2 lore raw

PATCH v2 1/3 i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Thursday, April 14, 2016 2:19 PM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next-queue PATCH v2 1/3] i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM

This patch makes it so that i40e and i40evf can use GSO_PARTIAL to support segmentation for frames with checksums enabled in outer headers. As a result we can now send data over these types of tunnels at over 20Gb/s versus the 12Gb/s that was previously possible on my system.

The advantage with the i40e parts is that this offload is mostly transparent as the hardware still deals with the inner and/or outer IPv4 headers so the IP ID is still incrementing for both when this offload is performed.

Quoted 7 lines
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     |   10 ++++++++--
 drivers/net/ethernet/intel/i40e/i40e_txrx.c     |    7 ++++++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |    7 ++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |   10 ++++++++--
 4 files changed, 28 insertions(+), 6 deletions(-)

GRE tunnel traffic works as expected with speed increase

#3 lore raw

PATCH v2 2/3 ixgbe/ixgbevf: Add support for GSO partial

In reply to Alexander Duyck

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  133 ++++++++++++++-------
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  129 +++++++++++++++-----
 2 files changed, 180 insertions(+), 82 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +88 -45
index d70746f85cab..baee3c139ad0 100644
@@ -7255,9 +7255,18 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
 		     struct ixgbe_tx_buffer *first,
 		     u8 *hdr_len)
 {
+	u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
 	struct sk_buff *skb = first->skb;
-	u32 vlan_macip_lens, type_tucmd;
-	u32 mss_l4len_idx, l4len;
+	union {
+		struct iphdr *v4;
+		struct ipv6hdr *v6;
+		unsigned char *hdr;
+	} ip;
+	union {
+		struct tcphdr *tcp;
+		unsigned char *hdr;
+	} l4;
+	u32 paylen, l4_offset;
 	int err;
 
 	if (skb->ip_summed != CHECKSUM_PARTIAL)
@@ -7270,46 +7279,52 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
 	if (err < 0)
 		return err;
 
+	ip.hdr = skb_network_header(skb);
+	l4.hdr = skb_checksum_start(skb);
+
 	/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
 	type_tucmd = IXGBE_ADVTXD_TUCMD_L4T_TCP;
 
-	if (first->protocol == htons(ETH_P_IP)) {
-		struct iphdr *iph = ip_hdr(skb);
-		iph->tot_len = 0;
-		iph->check = 0;
-		tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
-							 iph->daddr, 0,
-							 IPPROTO_TCP,
-							 0);
+	/* initialize outer IP header fields */
+	if (ip.v4->version == 4) {
+		/* IP header will have to cancel out any data that
+		 * is not a part of the outer IP header
+		 */
+		ip.v4->check = csum_fold(csum_add(lco_csum(skb),
+						  csum_unfold(l4.tcp->check)));
 		type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
+
+		ip.v4->tot_len = 0;
 		first->tx_flags |= IXGBE_TX_FLAGS_TSO |
 				   IXGBE_TX_FLAGS_CSUM |
 				   IXGBE_TX_FLAGS_IPV4;
-	} else if (skb_is_gso_v6(skb)) {
-		ipv6_hdr(skb)->payload_len = 0;
-		tcp_hdr(skb)->check =
-		    ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
-				     &ipv6_hdr(skb)->daddr,
-				     0, IPPROTO_TCP, 0);
+	} else {
+		ip.v6->payload_len = 0;
 		first->tx_flags |= IXGBE_TX_FLAGS_TSO |
 				   IXGBE_TX_FLAGS_CSUM;
 	}
 
-	/* compute header lengths */
-	l4len = tcp_hdrlen(skb);
-	*hdr_len = skb_transport_offset(skb) + l4len;
+	/* determine offset of inner transport header */
+	l4_offset = l4.hdr - skb->data;
+
+	/* compute length of segmentation header */
+	*hdr_len = (l4.tcp->doff * 4) + l4_offset;
+
+	/* remove payload length from inner checksum */
+	paylen = skb->len - l4_offset;
+	csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
 
 	/* update gso size and bytecount with header size */
 	first->gso_segs = skb_shinfo(skb)->gso_segs;
 	first->bytecount += (first->gso_segs - 1) * *hdr_len;
 
 	/* mss_l4len_id: use 0 as index for TSO */
-	mss_l4len_idx = l4len << IXGBE_ADVTXD_L4LEN_SHIFT;
+	mss_l4len_idx = (*hdr_len - l4_offset) << IXGBE_ADVTXD_L4LEN_SHIFT;
 	mss_l4len_idx |= skb_shinfo(skb)->gso_size << IXGBE_ADVTXD_MSS_SHIFT;
 
 	/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
-	vlan_macip_lens = skb_network_header_len(skb);
-	vlan_macip_lens |= skb_network_offset(skb) << IXGBE_ADVTXD_MACLEN_SHIFT;
+	vlan_macip_lens = l4.hdr - ip.hdr;
+	vlan_macip_lens |= (ip.hdr - skb->data) << IXGBE_ADVTXD_MACLEN_SHIFT;
 	vlan_macip_lens |= first->tx_flags & IXGBE_TX_FLAGS_VLAN_MASK;
 
 	ixgbe_tx_ctxtdesc(tx_ring, vlan_macip_lens, 0, type_tucmd,
@@ -8966,17 +8981,36 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv)
 	kfree(fwd_adapter);
 }
 
-#define IXGBE_MAX_TUNNEL_HDR_LEN 80
+#define IXGBE_MAX_MAC_HDR_LEN		127
+#define IXGBE_MAX_NETWORK_HDR_LEN	511
+
 static netdev_features_t
 ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
 		     netdev_features_t features)
 {
-	if (!skb->encapsulation)
-		return features;
-
-	if (unlikely(skb_inner_mac_header(skb) - skb_transport_header(skb) >
-		     IXGBE_MAX_TUNNEL_HDR_LEN))
-		return features & ~NETIF_F_CSUM_MASK;
+	unsigned int network_hdr_len, mac_hdr_len;
+
+	/* Make certain the headers can be described by a context descriptor */
+	mac_hdr_len = skb_network_header(skb) - skb->data;
+	if (unlikely(mac_hdr_len > IXGBE_MAX_MAC_HDR_LEN))
+		return features & ~(NETIF_F_HW_CSUM |
+				    NETIF_F_SCTP_CRC |
+				    NETIF_F_HW_VLAN_CTAG_TX |
+				    NETIF_F_TSO |
+				    NETIF_F_TSO6);
+
+	network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb);
+	if (unlikely(network_hdr_len >  IXGBE_MAX_NETWORK_HDR_LEN))
+		return features & ~(NETIF_F_HW_CSUM |
+				    NETIF_F_SCTP_CRC |
+				    NETIF_F_TSO |
+				    NETIF_F_TSO6);
+
+	/* We can only support IPV4 TSO in tunnels if we can mangle the
+	 * inner IP ID field, so strip TSO if MANGLEID is not supported.
+	 */
+	if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
+		features &= ~NETIF_F_TSO;
 
 	return features;
 }
@@ -9343,31 +9377,44 @@ skip_sriov:
 			   NETIF_F_TSO6 |
 			   NETIF_F_RXHASH |
 			   NETIF_F_RXCSUM |
-			   NETIF_F_HW_CSUM |
-			   NETIF_F_HW_VLAN_CTAG_TX |
-			   NETIF_F_HW_VLAN_CTAG_RX |
-			   NETIF_F_HW_VLAN_CTAG_FILTER;
+			   NETIF_F_HW_CSUM;
+
+#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
+				    NETIF_F_GSO_GRE_CSUM | \
+				    NETIF_F_GSO_IPIP | \
+				    NETIF_F_GSO_SIT | \
+				    NETIF_F_GSO_UDP_TUNNEL | \
+				    NETIF_F_GSO_UDP_TUNNEL_CSUM)
+
+	netdev->gso_partial_features = IXGBE_GSO_PARTIAL_FEATURES;
+	netdev->features |= NETIF_F_GSO_PARTIAL |
+			    IXGBE_GSO_PARTIAL_FEATURES;
 
 	if (hw->mac.type >= ixgbe_mac_82599EB)
 		netdev->features |= NETIF_F_SCTP_CRC;
 
 	/* copy netdev features into list of user selectable features */
-	netdev->hw_features |= netdev->features;
-	netdev->hw_features |= NETIF_F_RXALL |
+	netdev->hw_features |= netdev->features |
+			       NETIF_F_HW_VLAN_CTAG_RX |
+			       NETIF_F_HW_VLAN_CTAG_TX |
+			       NETIF_F_RXALL |
 			       NETIF_F_HW_L2FW_DOFFLOAD;
 
 	if (hw->mac.type >= ixgbe_mac_82599EB)
 		netdev->hw_features |= NETIF_F_NTUPLE |
 				       NETIF_F_HW_TC;
 
-	netdev->vlan_features |= NETIF_F_SG |
-				 NETIF_F_TSO |
-				 NETIF_F_TSO6 |
-				 NETIF_F_HW_CSUM |
-				 NETIF_F_SCTP_CRC;
+	if (pci_using_dac)
+		netdev->features |= NETIF_F_HIGHDMA;
+
+	/* set this bit last since it cannot be part of vlan_features */
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
+	netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
+	netdev->hw_enc_features |= netdev->vlan_features;
 	netdev->mpls_features |= NETIF_F_HW_CSUM;
-	netdev->hw_enc_features |= NETIF_F_HW_CSUM;
 
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 	netdev->priv_flags |= IFF_SUPP_NOFCS;
@@ -9398,10 +9445,6 @@ skip_sriov:
 					 NETIF_F_FCOE_MTU;
 	}
 #endif /* IXGBE_FCOE */
-	if (pci_using_dac) {
-		netdev->features |= NETIF_F_HIGHDMA;
-		netdev->vlan_features |= NETIF_F_HIGHDMA;
-	}
 
 	if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)
 		netdev->hw_features |= NETIF_F_LRO;
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +92 -37

186 lines not on this page · raw message

#4 lore raw

[Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf: Add support for GSO partial

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Alexander,

[auto build test ERROR on jkirsher-next-queue/dev-queue]
[cannot apply to v4.6-rc3 next-20160414]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Duyck/Add-support-for-GSO-partial-to-Intel-NIC-drivers/20160415-052212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: xtensa-allyesconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All errors (new ones prefixed by >>):

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c: In function 'ixgbe_features_check':

>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9012:41: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9012:41: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/ixgbe/ixgbe_main.c: In function 'ixgbe_probe':
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9389:8: error: 'struct net_device' has no member named 'gso_partial_features'
     netdev->gso_partial_features = IXGBE_GSO_PARTIAL_FEATURES;
           ^
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9390:22: error: 'NETIF_F_GSO_PARTIAL' undeclared (first use in this function)
     netdev->features |= NETIF_F_GSO_PARTIAL |
                         ^
   drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9415:46: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
                                                 ^
--
   drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function 'ixgbevf_features_check':
>> drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:3914:41: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:3914:41: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function 'ixgbevf_probe':
>> drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4056:8: error: 'struct net_device' has no member named 'gso_partial_features'
     netdev->gso_partial_features = IXGBEVF_GSO_PARTIAL_FEATURES;
           ^
>> drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4057:25: error: 'NETIF_F_GSO_PARTIAL' undeclared (first use in this function)
     netdev->hw_features |= NETIF_F_GSO_PARTIAL |
                            ^
   drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4065:46: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
                                                 ^

vim +/NETIF_F_TSO_MANGLEID +9012 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

9006 NETIF_F_TSO |
9007 NETIF_F_TSO6);
9008
9009 /* We can only support IPV4 TSO in tunnels if we can mangle the
9010 * inner IP ID field, so strip TSO if MANGLEID is not supported.
9011 */

> 9012		if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))

9013 features &= ~NETIF_F_TSO;
9014
9015 return features;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 44869 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160415/b5ea968a/attachment-0001.obj>

#5 lore raw

PATCH v2 2/3 ixgbe/ixgbevf: Add support for GSO partial

In reply to Alexander Duyck
Quoted 17 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Thursday, April 14, 2016 2:20 PM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf: Add support for GSO partial

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

Quoted 7 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  133 ++++++++++++++--
-----
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  129
+++++++++++++++-----
 2 files changed, 180 insertions(+), 82 deletions(-)

GRE tunnel traffic works as expected with speed increase with GSO on

#6 lore raw

PATCH v2 2/3 ixgbe/ixgbevf: Add support for GSO partial

Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bowers, AndrewX
Sent: Wednesday, April 20, 2016 2:21 PM
To: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf: Add support for GSO partial

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan
[mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Thursday, April 14, 2016 2:20 PM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf:
Add support for GSO partial

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

Quoted 7 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  133 ++++++++++++++--
-----
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  129
+++++++++++++++-----
 2 files changed, 180 insertions(+), 82 deletions(-)
Quoted 6 lines

works as expected with speed increase with GSO on
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Alex,
Turns out this patch is causing an error when attempting to create a VLAN. Would you be interested in submitting a follow on patch to address this? Here's repro steps:
1. Install Fedora 23 and compile the next-queue kernel (v4.6-rc6) with dev-queue branch
2. Reboot with kernel-4.6.0-rc6_20160506.next_queue_dev_queue.
3. Created vlan 3260 interface with Spring Fountain

[root at lin-nd3-114 ~]# ip l a enp130s0f0.3260 l enp130s0f0 type vlan id 3260 RTNETLINK answers: Invalid argument

Expected result: vlan 3260 interface should be created.

Actual result: Can't get vlan interface.

Characterization/Isolation input:
[root at lin-nd3-114 test_script]# dmesg | tail -50

[  366.829260] ixgbe 0000:82:00.0 enp130s0f0: VLAN features are set incorrectly.  Q-in-Q configurations may not work correctly.
[  366.829639] ------------[ cut here ]------------
[  366.830002] WARNING: CPU: 34 PID: 4643 at net/core/dev.c:7016 register_netdevice+0x309/0x4f0
[  366.830378] netdevice: enp130s0f0.3260 (uninitialized)
               Buggy VLAN acceleration in driver!
[  366.831225] Modules linked in: rpcsec_gss_krb5 bnx2fc nfsv4 cnic uio dns_resolver nfs fcoe libfcoe fscache ip6table_filter ip6_tables libfc scsi_transport_fc 8021q garp mrp stp llc cfg80211 rfkill intel_rapl x86_pkg_temp_thermal coretemp kvm_intel kvm irqbypass joydev iTCO_wdt iTCO_vendor_support dcdbas crct10dif_pclmul sb_edac crc32_pclmul ghash_clmulni_intel ipmi_devintf ipmi_ssif mei_me ipmi_si pcspkr edac_core mei ipmi_msghandler shpchp lpc_ich tpm_tis tpm acpi_power_meter wmi nfsd auth_rpcgss nfs_acl lockd grace sunrpc xfs libcrc32c mgag200 i2c_algo_bit drm_kms_helper ttm drm ixgbe i40e crc32c_intel mdio tg3 dca megaraid_sas fjes ptp pps_core [last unloaded: netconsole]
[  366.834201] CPU: 34 PID: 4643 Comm: ip Tainted: G        W       4.6.0-rc6_20160506.next_queue_dev_queue #1
[  366.834692] Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.2.10 03/09/2015
[  366.835184]  0000000000000286 000000005f89205a ffff880436a37788 ffffffff813caa5e
[  366.835681]  ffff880436a377d8 0000000000000000 ffff880436a377c8 ffffffff810a48cb
[  366.836183]  00001b6800008de0 ffff880446165000 00000000ffffffea ffffffff81a5cdeb
[  366.836719] Call Trace:
[  366.837221]  [<ffffffff813caa5e>] dump_stack+0x63/0x85
[  366.837727]  [<ffffffff810a48cb>] __warn+0xcb/0xf0
[  366.838237]  [<ffffffff810a494f>] warn_slowpath_fmt+0x5f/0x80
[  366.838754]  [<ffffffff813dfb85>] ? find_next_bit+0x15/0x20
[  366.839275]  [<ffffffff816abf69>] register_netdevice+0x309/0x4f0
[  366.839831]  [<ffffffffa0451ad9>] register_vlan_dev+0xd9/0x230 [8021q]
[  366.840358]  [<ffffffffa045366b>] vlan_newlink+0xbb/0xf0 [8021q]
[  366.840905]  [<ffffffff816bb18e>] rtnl_newlink+0x6ee/0x8a0
[  366.841422]  [<ffffffff816bac16>] ? rtnl_newlink+0x176/0x8a0
[  366.841945]  [<ffffffff816b9686>] rtnetlink_rcv_msg+0xe6/0x220
[  366.842464]  [<ffffffff8121c173>] ? __kmalloc_node_track_caller+0x223/0x300
[  366.843005]  [<ffffffff81692c07>] ? __alloc_skb+0x87/0x1f0
[  366.843515]  [<ffffffff816b95a0>] ? rtnetlink_rcv+0x30/0x30
[  366.844018]  [<ffffffff816dff74>] netlink_rcv_skb+0xa4/0xc0
[  366.844510]  [<ffffffff816b9598>] rtnetlink_rcv+0x28/0x30
[  366.844999]  [<ffffffff816df953>] netlink_unicast+0x183/0x230
[  366.845480]  [<ffffffff816dfcfb>] netlink_sendmsg+0x2fb/0x3a0
[  366.845979]  [<ffffffff8168a408>] sock_sendmsg+0x38/0x50
[  366.846456]  [<ffffffff8168aebe>] ___sys_sendmsg+0x28e/0x2a0
[  366.846939]  [<ffffffff811c35fa>] ? lru_cache_add+0x3a/0x80
[  366.847418]  [<ffffffff811c37bc>] ? lru_cache_add_active_or_unevictable+0x4c/0xf0
[  366.847898]  [<ffffffff811e81b6>] ? handle_mm_fault+0xf26/0x1d50
[  366.848375]  [<ffffffff8168b814>] __sys_sendmsg+0x54/0x90
[  366.848882]  [<ffffffff8168b862>] SyS_sendmsg+0x12/0x20
[  366.849369]  [<ffffffff817c45b2>] entry_SYSCALL_64_fastpath+0x1a/0xa4
[  366.849869] ---[ end trace 7f8e70c0cbf69fdc ]---
#7 lore raw

PATCH v2 2/3 ixgbe/ixgbevf: Add support for GSO partial

Quoted 51 lines · Phillip J
Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bowers, AndrewX
Sent: Wednesday, April 20, 2016 2:21 PM
To: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf: Add support for GSO partial

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan
[mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Thursday, April 14, 2016 2:20 PM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next-queue PATCH v2 2/3] ixgbe/ixgbevf:
Add support for GSO partial

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

Quoted 7 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  133 ++++++++++++++--
-----
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  129
+++++++++++++++-----
 2 files changed, 180 insertions(+), 82 deletions(-)
Quoted 6 lines

works as expected with speed increase with GSO on
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Alex,
Turns out this patch is causing an error when attempting to create a VLAN. Would you be interested in submitting a follow on patch to address this? Here's repro steps:
1. Install Fedora 23 and compile the next-queue kernel (v4.6-rc6) with dev-queue branch
2. Reboot with kernel-4.6.0-rc6_20160506.next_queue_dev_queue.
3. Created vlan 3260 interface with Spring Fountain

Quoted 6 lines

[root at lin-nd3-114 ~]# ip l a enp130s0f0.3260 l enp130s0f0 type vlan id 3260 RTNETLINK answers: Invalid argument

Expected result: vlan 3260 interface should be created.

Actual result: Can't get vlan interface.

I think I found the issue. It looks like a few lines got swapped when I was working on the patch.

I have submitted a patch to fix it that should be available in the next few minutes.

Thanks.

- Alex

#8 lore raw

PATCH v2 3/3 igb/igbvf: Add support for GSO partial

In reply to Alexander Duyck

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

---
 drivers/net/ethernet/intel/igb/igb_main.c |  137 +++++++++++++++-------
 drivers/net/ethernet/intel/igbvf/netdev.c |  182 +++++++++++++++++------------
 2 files changed, 203 insertions(+), 116 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +96 -41
index 3d58b3268182..f1c18f141d3e 100644
@@ -2087,6 +2087,40 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 	return ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, flags);
 }
 
+#define IGB_MAX_MAC_HDR_LEN	127
+#define IGB_MAX_NETWORK_HDR_LEN	511
+
+static netdev_features_t
+igb_features_check(struct sk_buff *skb, struct net_device *dev,
+		   netdev_features_t features)
+{
+	unsigned int network_hdr_len, mac_hdr_len;
+
+	/* Make certain the headers can be described by a context descriptor */
+	mac_hdr_len = skb_network_header(skb) - skb->data;
+	if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN))
+		return features & ~(NETIF_F_HW_CSUM |
+				    NETIF_F_SCTP_CRC |
+				    NETIF_F_HW_VLAN_CTAG_TX |
+				    NETIF_F_TSO |
+				    NETIF_F_TSO6);
+
+	network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb);
+	if (unlikely(network_hdr_len >  IGB_MAX_NETWORK_HDR_LEN))
+		return features & ~(NETIF_F_HW_CSUM |
+				    NETIF_F_SCTP_CRC |
+				    NETIF_F_TSO |
+				    NETIF_F_TSO6);
+
+	/* We can only support IPV4 TSO in tunnels if we can mangle the
+	 * inner IP ID field, so strip TSO if MANGLEID is not supported.
+	 */
+	if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
+		features &= ~NETIF_F_TSO;
+
+	return features;
+}
+
 static const struct net_device_ops igb_netdev_ops = {
 	.ndo_open		= igb_open,
 	.ndo_stop		= igb_close,
@@ -2111,7 +2145,7 @@ static const struct net_device_ops igb_netdev_ops = {
 	.ndo_fix_features	= igb_fix_features,
 	.ndo_set_features	= igb_set_features,
 	.ndo_fdb_add		= igb_ndo_fdb_add,
-	.ndo_features_check	= passthru_features_check,
+	.ndo_features_check	= igb_features_check,
 };
 
 /**
@@ -2377,38 +2411,43 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 			    NETIF_F_TSO6 |
 			    NETIF_F_RXHASH |
 			    NETIF_F_RXCSUM |
-			    NETIF_F_HW_CSUM |
-			    NETIF_F_HW_VLAN_CTAG_RX |
-			    NETIF_F_HW_VLAN_CTAG_TX;
+			    NETIF_F_HW_CSUM;
 
 	if (hw->mac.type >= e1000_82576)
 		netdev->features |= NETIF_F_SCTP_CRC;
 
+#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
+				  NETIF_F_GSO_GRE_CSUM | \
+				  NETIF_F_GSO_IPIP | \
+				  NETIF_F_GSO_SIT | \
+				  NETIF_F_GSO_UDP_TUNNEL | \
+				  NETIF_F_GSO_UDP_TUNNEL_CSUM)
+
+	netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES;
+	netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES;
+
 	/* copy netdev features into list of user selectable features */
-	netdev->hw_features |= netdev->features;
-	netdev->hw_features |= NETIF_F_RXALL;
+	netdev->hw_features |= netdev->features |
+			       NETIF_F_HW_VLAN_CTAG_RX |
+			       NETIF_F_HW_VLAN_CTAG_TX |
+			       NETIF_F_RXALL;
 
 	if (hw->mac.type >= e1000_i350)
 		netdev->hw_features |= NETIF_F_NTUPLE;
 
-	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
-
-	netdev->vlan_features |= NETIF_F_SG |
-				 NETIF_F_TSO |
-				 NETIF_F_TSO6 |
-				 NETIF_F_HW_CSUM |
-				 NETIF_F_SCTP_CRC;
+	if (pci_using_dac)
+		netdev->features |= NETIF_F_HIGHDMA;
 
+	netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
 	netdev->mpls_features |= NETIF_F_HW_CSUM;
-	netdev->hw_enc_features |= NETIF_F_HW_CSUM;
+	netdev->hw_enc_features |= netdev->vlan_features;
 
-	netdev->priv_flags |= IFF_SUPP_NOFCS;
+	/* set this bit last since it cannot be part of vlan_features */
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
-	if (pci_using_dac) {
-		netdev->features |= NETIF_F_HIGHDMA;
-		netdev->vlan_features |= NETIF_F_HIGHDMA;
-	}
+	netdev->priv_flags |= IFF_SUPP_NOFCS;
 
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 
@@ -4842,9 +4881,18 @@ static int igb_tso(struct igb_ring *tx_ring,
 		   struct igb_tx_buffer *first,
 		   u8 *hdr_len)
 {
+	u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
 	struct sk_buff *skb = first->skb;
-	u32 vlan_macip_lens, type_tucmd;
-	u32 mss_l4len_idx, l4len;
+	union {
+		struct iphdr *v4;
+		struct ipv6hdr *v6;
+		unsigned char *hdr;
+	} ip;
+	union {
+		struct tcphdr *tcp;
+		unsigned char *hdr;
+	} l4;
+	u32 paylen, l4_offset;
 	int err;
 
 	if (skb->ip_summed != CHECKSUM_PARTIAL)
@@ -4857,45 +4905,52 @@ static int igb_tso(struct igb_ring *tx_ring,
 	if (err < 0)
 		return err;
 
+	ip.hdr = skb_network_header(skb);
+	l4.hdr = skb_checksum_start(skb);
+
 	/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
 	type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
 
-	if (first->protocol == htons(ETH_P_IP)) {
-		struct iphdr *iph = ip_hdr(skb);
-		iph->tot_len = 0;
-		iph->check = 0;
-		tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
-							 iph->daddr, 0,
-							 IPPROTO_TCP,
-							 0);
+	/* initialize outer IP header fields */
+	if (ip.v4->version == 4) {
+		/* IP header will have to cancel out any data that
+		 * is not a part of the outer IP header
+		 */
+		ip.v4->check = csum_fold(csum_add(lco_csum(skb),
+						  csum_unfold(l4.tcp->check)));
 		type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;
+
+		ip.v4->tot_len = 0;
 		first->tx_flags |= IGB_TX_FLAGS_TSO |
 				   IGB_TX_FLAGS_CSUM |
 				   IGB_TX_FLAGS_IPV4;
-	} else if (skb_is_gso_v6(skb)) {
-		ipv6_hdr(skb)->payload_len = 0;
-		tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
-						       &ipv6_hdr(skb)->daddr,
-						       0, IPPROTO_TCP, 0);
+	} else {
+		ip.v6->payload_len = 0;
 		first->tx_flags |= IGB_TX_FLAGS_TSO |
 				   IGB_TX_FLAGS_CSUM;
 	}
 
-	/* compute header lengths */
-	l4len = tcp_hdrlen(skb);
-	*hdr_len = skb_transport_offset(skb) + l4len;
+	/* determine offset of inner transport header */
+	l4_offset = l4.hdr - skb->data;
+
+	/* compute length of segmentation header */
+	*hdr_len = (l4.tcp->doff * 4) + l4_offset;
+
+	/* remove payload length from inner checksum */
+	paylen = skb->len - l4_offset;
+	csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
 
 	/* update gso size and bytecount with header size */
 	first->gso_segs = skb_shinfo(skb)->gso_segs;
 	first->bytecount += (first->gso_segs - 1) * *hdr_len;
 
 	/* MSS L4LEN IDX */
-	mss_l4len_idx = l4len << E1000_ADVTXD_L4LEN_SHIFT;
+	mss_l4len_idx = (*hdr_len - l4_offset) << E1000_ADVTXD_L4LEN_SHIFT;
 	mss_l4len_idx |= skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT;
 
 	/* VLAN MACLEN IPLEN */
-	vlan_macip_lens = skb_network_header_len(skb);
-	vlan_macip_lens |= skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT;
+	vlan_macip_lens = l4.hdr - ip.hdr;
+	vlan_macip_lens |= (ip.hdr - skb->data) << E1000_ADVTXD_MACLEN_SHIFT;
 	vlan_macip_lens |= first->tx_flags & IGB_TX_FLAGS_VLAN_MASK;
 
 	igb_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, mss_l4len_idx);
drivers/net/ethernet/intel/igbvf/netdev.c +107 -75

233 lines not on this page · raw message

#9 lore raw

[Intel-wired-lan] [next-queue PATCH v2 3/3] igb/igbvf: Add support for GSO partial

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Alexander,

[auto build test ERROR on jkirsher-next-queue/dev-queue]
[cannot apply to v4.6-rc3 next-20160414]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Duyck/Add-support-for-GSO-partial-to-Intel-NIC-drivers/20160415-052212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: xtensa-allyesconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All errors (new ones prefixed by >>):

drivers/net/ethernet/intel/igb/igb_main.c: In function 'igb_features_check':

>> drivers/net/ethernet/intel/igb/igb_main.c:2118:41: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   drivers/net/ethernet/intel/igb/igb_main.c:2118:41: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/igb/igb_main.c: In function 'igb_probe':
>> drivers/net/ethernet/intel/igb/igb_main.c:2426:8: error: 'struct net_device' has no member named 'gso_partial_features'
     netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES;
           ^
>> drivers/net/ethernet/intel/igb/igb_main.c:2427:22: error: 'NETIF_F_GSO_PARTIAL' undeclared (first use in this function)
     netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES;
                         ^
   drivers/net/ethernet/intel/igb/igb_main.c:2441:46: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
                                                 ^
--
   drivers/net/ethernet/intel/igbvf/netdev.c: In function 'igbvf_features_check':
>> drivers/net/ethernet/intel/igbvf/netdev.c:2634:41: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   drivers/net/ethernet/intel/igbvf/netdev.c:2634:41: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/igbvf/netdev.c: In function 'igbvf_probe':
>> drivers/net/ethernet/intel/igbvf/netdev.c:2771:8: error: 'struct net_device' has no member named 'gso_partial_features'
     netdev->gso_partial_features = IGBVF_GSO_PARTIAL_FEATURES;
           ^
>> drivers/net/ethernet/intel/igbvf/netdev.c:2772:25: error: 'NETIF_F_GSO_PARTIAL' undeclared (first use in this function)
     netdev->hw_features |= NETIF_F_GSO_PARTIAL |
                            ^
   drivers/net/ethernet/intel/igbvf/netdev.c:2780:46: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
                                                 ^

vim +/NETIF_F_TSO_MANGLEID +2118 drivers/net/ethernet/intel/igb/igb_main.c

2112 NETIF_F_TSO |
2113 NETIF_F_TSO6);
2114
2115 /* We can only support IPV4 TSO in tunnels if we can mangle the
2116 * inner IP ID field, so strip TSO if MANGLEID is not supported.
2117 */

> 2118		if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))

2119 features &= ~NETIF_F_TSO;
2120
2121 return features;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 44869 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160415/f7f7ceea/attachment-0001.obj>

#10 lore raw

[Intel-wired-lan] [next-queue PATCH v2 3/3] igb/igbvf: Add support for GSO partial

In reply to Alexander Duyck
reproduce:

Hi Alexander,

[auto build test WARNING on jkirsher-next-queue/dev-queue]
[cannot apply to v4.6-rc3 next-20160414]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Alexander-Duyck/Add-support-for-GSO-partial-to-Intel-NIC-drivers/20160415-052212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: i386-randconfig-x019-201615 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/net/ethernet/intel/igb/igb_main.c:26:
drivers/net/ethernet/intel/igb/igb_main.c: In function 'igb_features_check':
drivers/net/ethernet/intel/igb/igb_main.c:2118:41: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)

     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/net/ethernet/intel/igb/igb_main.c:2118:2: note: in expansion of macro 'if'
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
     ^
   drivers/net/ethernet/intel/igb/igb_main.c:2118:41: note: each undeclared identifier is reported only once for each function it appears in
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
                                            ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/net/ethernet/intel/igb/igb_main.c:2118:2: note: in expansion of macro 'if'
     if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
     ^
   drivers/net/ethernet/intel/igb/igb_main.c: In function 'igb_probe':
   drivers/net/ethernet/intel/igb/igb_main.c:2426:8: error: 'struct net_device' has no member named 'gso_partial_features'
     netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES;
           ^
   drivers/net/ethernet/intel/igb/igb_main.c:2427:22: error: 'NETIF_F_GSO_PARTIAL' undeclared (first use in this function)
     netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES;
                         ^
   drivers/net/ethernet/intel/igb/igb_main.c:2441:46: error: 'NETIF_F_TSO_MANGLEID' undeclared (first use in this function)
     netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
                                                 ^

vim +/if +2118 drivers/net/ethernet/intel/igb/igb_main.c

2102 return features & ~(NETIF_F_HW_CSUM |

  2103					    NETIF_F_SCTP_CRC |
  2104					    NETIF_F_HW_VLAN_CTAG_TX |
  2105					    NETIF_F_TSO |
  2106					    NETIF_F_TSO6);
  2107	
  2108		network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb);
  2109		if (unlikely(network_hdr_len >  IGB_MAX_NETWORK_HDR_LEN))
  2110			return features & ~(NETIF_F_HW_CSUM |
  2111					    NETIF_F_SCTP_CRC |
  2112					    NETIF_F_TSO |
  2113					    NETIF_F_TSO6);
  2114	
  2115		/* We can only support IPV4 TSO in tunnels if we can mangle the
  2116		 * inner IP ID field, so strip TSO if MANGLEID is not supported.
  2117		 */
> 2118		if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))

2119 features &= ~NETIF_F_TSO;
2120
2121 return features;
2122 }
2123
2124 static const struct net_device_ops igb_netdev_ops = {
2125 .ndo_open = igb_open,
2126 .ndo_stop = igb_close,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 25883 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160415/368fa997/attachment-0001.obj>

#11 lore raw

PATCH v2 3/3 igb/igbvf: Add support for GSO partial

In reply to Alexander Duyck
Quoted 16 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Thursday, April 14, 2016 2:20 PM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next-queue PATCH v2 3/3] igb/igbvf: Add support for GSO partial

This patch adds support for partial GSO segmentation in the case of tunnels. Specifically with this change the driver an perform segmenation as long as the frame either has IPv6 inner headers, or we are allowed to mangle the IP IDs on the inner header. This is needed because we will not be modifying any fields from the start of the start of the outer transport header to the start of the inner transport header as we are treating them like they are just a block of IP options.

Quoted 7 lines
---
 drivers/net/ethernet/intel/igb/igb_main.c |  137 +++++++++++++++-------
 drivers/net/ethernet/intel/igbvf/netdev.c |  182 +++++++++++++++++----------
--
 2 files changed, 203 insertions(+), 116 deletions(-)