Skip to contentSkip to conversation

Clean-up features and add support for IPIP and SIT tunnel offloads

PATCH New Alexander Duyck 2 participants 5 messages Apr 2, 2016 – Apr 5, 2016

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

cover Clean-up features and add support for IPIP and SIT tunnel offloads

This patch set is meant to help pave the way for the GSO partial changes that will likely be coming in a couple weeks. The first patch resolves some feature issues and makes it so that we can more easily see what features are supported for each driver and which are not. The second patch adds support for IPIP and SIT tunnels where were already supported by the hardware but were not enabled in the drivers.

---

Alexander Duyck (2):
i40e/i40evf: Clean up feature flags i40e/i40evf: Add support for IPIP and SIT offloads

 drivers/net/ethernet/intel/i40e/i40e_main.c     |   63 +++++++++------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c     |   24 +++++---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |   24 +++++---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |   68 ++++++++++++-----------
 4 files changed, 94 insertions(+), 85 deletions(-)

--

#1 lore raw

PATCH 1/2 i40e/i40evf: Clean up feature flags

The feature flags list for i40e and i40evf is beginning to become pretty massive. I plan to add another 4 or so features to these drivers and duplicating the flags for each and every flags list is becoming a bit repetitive.

The primary change here is that we now build our features list around hw_encap_features. After that we assign that to vlan_features, hw_features, and finally map that onto features. In addition we end up throwing features onto hw_encap_features that end up having no effect such as the Rx offloads and SCTP_CRC. However that should have no impact and makes things a bit easier for us as hw_encap_features is one of the less updated features maps available.

For i40evf I went through and sanity checked a few features as well. Specifically RXCSUM was being set as a read-only feature which didn't make much sense. I have updated things so we can clear the NETIF_F_RXCSUM flag since that is really a software feature and not a hardware one anyway so disabling it is just a matter of ignoring the result from the hardware.

---

Testing-hints:
The only real testing required for this patch is to verify the features make sense after the patch has been applied. Most of the change is to deal with things like the fact that we were allowing VLAN filtering to be toggled but didn't actually do anything to disable it when it was.

 drivers/net/ethernet/intel/i40e/i40e_main.c     |   61 +++++++++------------
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |   66 +++++++++++------------
 2 files changed, 58 insertions(+), 69 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +26 -35
index d6147f899062..9100d34913a7 100644
@@ -9110,40 +9110,36 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 	np = netdev_priv(netdev);
 	np->vsi = vsi;
 
-	netdev->hw_enc_features |= NETIF_F_IP_CSUM	       |
-				   NETIF_F_IPV6_CSUM	       |
-				   NETIF_F_TSO		       |
-				   NETIF_F_TSO6		       |
-				   NETIF_F_TSO_ECN	       |
-				   NETIF_F_GSO_GRE	       |
-				   NETIF_F_GSO_UDP_TUNNEL      |
-				   NETIF_F_GSO_UDP_TUNNEL_CSUM |
+	netdev->hw_enc_features |= NETIF_F_SG			|
+				   NETIF_F_IP_CSUM		|
+				   NETIF_F_IPV6_CSUM		|
+				   NETIF_F_HIGHDMA		|
+				   NETIF_F_SOFT_FEATURES	|
+				   NETIF_F_TSO			|
+				   NETIF_F_TSO_ECN		|
+				   NETIF_F_TSO6			|
+				   NETIF_F_GSO_GRE		|
+				   NETIF_F_GSO_UDP_TUNNEL	|
+				   NETIF_F_GSO_UDP_TUNNEL_CSUM	|
+				   NETIF_F_SCTP_CRC		|
+				   NETIF_F_RXHASH		|
+				   NETIF_F_RXCSUM		|
 				   0;
 
-	netdev->features = NETIF_F_SG		       |
-			   NETIF_F_IP_CSUM	       |
-			   NETIF_F_SCTP_CRC	       |
-			   NETIF_F_HIGHDMA	       |
-			   NETIF_F_GSO_UDP_TUNNEL      |
-			   NETIF_F_GSO_GRE	       |
-			   NETIF_F_HW_VLAN_CTAG_TX     |
-			   NETIF_F_HW_VLAN_CTAG_RX     |
-			   NETIF_F_HW_VLAN_CTAG_FILTER |
-			   NETIF_F_IPV6_CSUM	       |
-			   NETIF_F_TSO		       |
-			   NETIF_F_TSO_ECN	       |
-			   NETIF_F_TSO6		       |
-			   NETIF_F_RXCSUM	       |
-			   NETIF_F_RXHASH	       |
-			   0;
+	if (!(pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE))
+		netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+
+	/* record features VLANs can make use of */
+	netdev->vlan_features |= netdev->hw_enc_features;
 
 	if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
-		netdev->features |= NETIF_F_NTUPLE;
-	if (pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)
-		netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+		netdev->hw_features |= NETIF_F_NTUPLE;
+
+	netdev->hw_features |= netdev->hw_enc_features	|
+			       NETIF_F_HW_VLAN_CTAG_TX	|
+			       NETIF_F_HW_VLAN_CTAG_RX;
 
-	/* copy netdev features into list of user selectable features */
-	netdev->hw_features |= netdev->features;
+	netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
 
 	if (vsi->type == I40E_VSI_MAIN) {
 		SET_NETDEV_DEV(netdev, &pf->pdev->dev);
@@ -9182,12 +9178,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 
 	ether_addr_copy(netdev->dev_addr, mac_addr);
 	ether_addr_copy(netdev->perm_addr, mac_addr);
-	/* vlan gets same features (except vlan offload)
-	 * after any tweaks for specific VSI types
-	 */
-	netdev->vlan_features = netdev->features & ~(NETIF_F_HW_VLAN_CTAG_TX |
-						     NETIF_F_HW_VLAN_CTAG_RX |
-						   NETIF_F_HW_VLAN_CTAG_FILTER);
+
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 	netdev->priv_flags |= IFF_SUPP_NOFCS;
 	/* Setup netdev TC information */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +32 -34

72 lines not on this page · raw message

#2 lore raw

PATCH 1/2 i40e/i40evf: Clean up feature flags

Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Saturday, April 02, 2016 12:05 AM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next PATCH 1/2] i40e/i40evf: Clean up feature flags

The feature flags list for i40e and i40evf is beginning to become pretty massive. I plan to add another 4 or so features to these drivers and duplicating the flags for each and every flags list is becoming a bit repetitive.

The primary change here is that we now build our features list around hw_encap_features. After that we assign that to vlan_features, hw_features, and finally map that onto features. In addition we end up throwing features onto hw_encap_features that end up having no effect such as the Rx offloads and SCTP_CRC. However that should have no impact and makes things a bit easier for us as hw_encap_features is one of the less updated features maps available.

For i40evf I went through and sanity checked a few features as well. Specifically RXCSUM was being set as a read-only feature which didn't make much sense. I have updated things so we can clear the NETIF_F_RXCSUM flag since that is really a software feature and not a hardware one anyway so disabling it is just a matter of ignoring the result from the hardware.

---

Testing-hints:
The only real testing required for this patch is to verify the features make sense after the patch has been applied. Most of the change is to deal with things like the fact that we were allowing VLAN filtering to be toggled but didn't actually do anything to disable it when it was.

Quoted 4 lines
 drivers/net/ethernet/intel/i40e/i40e_main.c     |   61 +++++++++------------
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |   66 +++++++++++---------
---
 2 files changed, 58 insertions(+), 69 deletions(-)

Feature flags still make sense with patch applied

#3 lore raw

PATCH 2/2 i40e/i40evf: Add support for IPIP and SIT offloads

In reply to Alexander Duyck

Looking over the documentation it turns out enabling IPIP and SIT offloads for i40e is pretty straighforward. As such I decided to enable them with this patch. In my testing I am seeing an improvement of 8 to 10 Gb/s for IPIP and SIT tunnels with this offload enabled.

---

Testing-hints:
All that should be needed is to setup a pair of systems with a tunnel and pass traffic over it. Documentation on how to setup IPIP and SIT tunnels can be found at:

http://www.linuxfoundation.org/collaborate/workgroups/networking/tunneling

 drivers/net/ethernet/intel/i40e/i40e_main.c     |    2 ++
 drivers/net/ethernet/intel/i40e/i40e_txrx.c     |   24 +++++++++++++++--------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |   24 +++++++++++++++--------
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |    2 ++
 4 files changed, 36 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -0
index 9100d34913a7..d5f2417c0851 100644
@@ -9119,6 +9119,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 				   NETIF_F_TSO_ECN		|
 				   NETIF_F_TSO6			|
 				   NETIF_F_GSO_GRE		|
+				   NETIF_F_GSO_IPIP		|
+				   NETIF_F_GSO_SIT		|
 				   NETIF_F_GSO_UDP_TUNNEL	|
 				   NETIF_F_GSO_UDP_TUNNEL_CSUM	|
 				   NETIF_F_SCTP_CRC		|
drivers/net/ethernet/intel/i40e/i40e_txrx.c +16 -8
index 6bf705add321..0d2a34cec6a9 100644
@@ -2297,7 +2297,10 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
 		ip.v6->payload_len = 0;
 	}
 
-	if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL | SKB_GSO_GRE |
+	if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+					 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) {
 			/* determine offset of outer transport header */
@@ -2439,13 +2442,6 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 						 &l4_proto, &frag_off);
 		}
 
-		/* compute outer L3 header size */
-		tunnel |= ((l4.hdr - ip.hdr) / 4) <<
-			  I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT;
-
-		/* switch IP header pointer from outer to inner header */
-		ip.hdr = skb_inner_network_header(skb);
-
 		/* define outer transport */
 		switch (l4_proto) {
 		case IPPROTO_UDP:
@@ -2456,6 +2452,11 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 			tunnel |= I40E_TXD_CTX_GRE_TUNNELING;
 			*tx_flags |= I40E_TX_FLAGS_UDP_TUNNEL;
 			break;
+		case IPPROTO_IPIP:
+		case IPPROTO_IPV6:
+			*tx_flags |= I40E_TX_FLAGS_UDP_TUNNEL;
+			l4.hdr = skb_inner_network_header(skb);
+			break;
 		default:
 			if (*tx_flags & I40E_TX_FLAGS_TSO)
 				return -1;
@@ -2464,6 +2465,13 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 			return 0;
 		}
 
+		/* compute outer L3 header size */
+		tunnel |= ((l4.hdr - ip.hdr) / 4) <<
+			  I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT;
+
+		/* switch IP header pointer from outer to inner header */
+		ip.hdr = skb_inner_network_header(skb);
+
 		/* compute tunnel header size */
 		tunnel |= ((ip.hdr - l4.hdr) / 2) <<
 			  I40E_TXD_CTX_QW0_NATLEN_SHIFT;
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +16 -8
index 519256bb63e8..07ce8e4e35e0 100644
@@ -1564,7 +1564,10 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
 		ip.v6->payload_len = 0;
 	}
 
-	if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL | SKB_GSO_GRE |
+	if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+					 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) {
 			/* determine offset of outer transport header */
@@ -1664,13 +1667,6 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 						 &l4_proto, &frag_off);
 		}
 
-		/* compute outer L3 header size */
-		tunnel |= ((l4.hdr - ip.hdr) / 4) <<
-			  I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT;
-
-		/* switch IP header pointer from outer to inner header */
-		ip.hdr = skb_inner_network_header(skb);
-
 		/* define outer transport */
 		switch (l4_proto) {
 		case IPPROTO_UDP:
@@ -1681,6 +1677,11 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 			tunnel |= I40E_TXD_CTX_GRE_TUNNELING;
 			*tx_flags |= I40E_TX_FLAGS_VXLAN_TUNNEL;
 			break;
+		case IPPROTO_IPIP:
+		case IPPROTO_IPV6:
+			*tx_flags |= I40E_TX_FLAGS_VXLAN_TUNNEL;
+			l4.hdr = skb_inner_network_header(skb);
+			break;
 		default:
 			if (*tx_flags & I40E_TX_FLAGS_TSO)
 				return -1;
@@ -1689,6 +1690,13 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 			return 0;
 		}
 
+		/* compute outer L3 header size */
+		tunnel |= ((l4.hdr - ip.hdr) / 4) <<
+			  I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT;
+
+		/* switch IP header pointer from outer to inner header */
+		ip.hdr = skb_inner_network_header(skb);
+
 		/* compute tunnel header size */
 		tunnel |= ((ip.hdr - l4.hdr) / 2) <<
 			  I40E_TXD_CTX_QW0_NATLEN_SHIFT;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -0
index a24966e4873a..1bb9d61ec171 100644
@@ -2327,6 +2327,8 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
 				   NETIF_F_TSO_ECN		|
 				   NETIF_F_TSO6			|
 				   NETIF_F_GSO_GRE		|
+				   NETIF_F_GSO_IPIP		|
+				   NETIF_F_GSO_SIT		|
 				   NETIF_F_GSO_UDP_TUNNEL	|
 				   NETIF_F_GSO_UDP_TUNNEL_CSUM	|
 				   NETIF_F_SCTP_CRC		|
#4 lore raw

PATCH 2/2 i40e/i40evf: Add support for IPIP and SIT offloads

Quoted 26 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Saturday, April 02, 2016 12:07 AM
To: intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>; alexander.duyck at gmail.com
Subject: [Intel-wired-lan] [next PATCH 2/2] i40e/i40evf: Add support for IPIP and SIT offloads

Looking over the documentation it turns out enabling IPIP and SIT offloads for i40e is pretty straighforward. As such I decided to enable them with this patch. In my testing I am seeing an improvement of 8 to 10 Gb/s for IPIP and SIT tunnels with this offload enabled.

---

Testing-hints:
All that should be needed is to setup a pair of systems with a tunnel and pass traffic over it. Documentation on how to setup IPIP and SIT tunnels can be found at:

http://www.linuxfoundation.org/collaborate/workgroups/networking/tunn
eling

Quoted 7 lines
 drivers/net/ethernet/intel/i40e/i40e_main.c     |    2 ++
 drivers/net/ethernet/intel/i40e/i40e_txrx.c     |   24 +++++++++++++++------
--
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |   24 +++++++++++++++-----
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |    2 ++
 4 files changed, 36 insertions(+), 16 deletions(-)

SIT and IPIP tunnels can be created and will pass traffic.