DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6]  Support NVGRE on i40e
@ 2015-01-26  3:43 Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 1/6] librte_ether:add NVGRE header Jijiang Liu
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

The patch set supports NVGRE on i40e.

It includes:
 - Support RX filters for NVGRE packet. It uses MAC and VLAN to point
   to a queue. The filter types supported are listed below:

   1. Inner MAC and Inner VLAN ID

   2. Inner MAC address, inner VLAN ID and tenant ID.

   3. Inner MAC and tenant ID

   4. Inner MAC address

   5. Outer MAC address, tenant ID and inner MAC

   6. Inner IP

 - Support TX checksum offload for NVGRE packet, which include outer L3(IP), inner L3(IP) and inner L4(UDP, TCP and SCTP)

Jijiang Liu (6):
  add gre header defination
  add nvgre RX filter in i40e
  test nvgre RX filters
  add GRE packet offload flag 
  support GRE packet TX checksum offload
  test nvgre TX checksum offload

 app/test-pmd/cmdline.c            |   37 ++++++++-----
 app/test-pmd/csumonly.c           |  105 +++++++++++++++++++++++++++----------
 app/test-pmd/testpmd.h            |    4 +-
 lib/librte_ether/rte_ether.h      |   12 ++++
 lib/librte_mbuf/rte_mbuf.h        |    6 ++
 lib/librte_pmd_i40e/i40e_ethdev.c |    6 ++
 lib/librte_pmd_i40e/i40e_rxtx.c   |   15 ++++-
 7 files changed, 139 insertions(+), 46 deletions(-)

-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 1/6] librte_ether:add NVGRE header
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 2/6] i40e:support RX tunnel filter for NVGRE packet Jijiang Liu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

Add NVGRE header and Transparent Ethernet Bridging Macro in rte_ether.h file.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_ether/rte_ether.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h
index 7e7d22c..cb36212 100644
--- a/lib/librte_ether/rte_ether.h
+++ b/lib/librte_ether/rte_ether.h
@@ -321,6 +321,17 @@ struct vxlan_hdr {
 	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
 } __attribute__((__packed__));
 
+/**
+ * NVGRE protocol header.
+ * Contains the 16-bit flag, 16-bit protocol type, 24-bit Virtual
+ * Subnet ID, 8-bit FlowId.
+ */
+struct nvgre_hdr {
+	uint16_t flags; /**< Protocol flag. */
+	uint16_t prot_type; /**< Protocol type. */
+	uint32_t key; /**< VSID (24) + FlowID (8). */
+} __attribute__((__packed__));
+
 /* Ethernet frame types */
 #define ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */
 #define ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */
@@ -329,6 +340,7 @@ struct vxlan_hdr {
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
 #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */
+#define ETHER_TYPE_TEB  0x6558 /**< Transparent Ethernet Bridging. */
 
 #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))
 /**< VXLAN tunnel header length. */
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 2/6] i40e:support RX tunnel filter for NVGRE packet
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 1/6] librte_ether:add NVGRE header Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 3/6] app/testpmd:test " Jijiang Liu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

The filter types supported are listed below for NVGRE packet:
   1. Inner MAC and Inner VLAN ID.

   2. Inner MAC address, inner VLAN ID and tenant ID.

   3. Inner MAC and tenant ID.

   4. Inner MAC address.

   5. Outer MAC address, tenant ID and inner MAC address.

   6. Inner IP address.


Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index b47a3d2..fa78d5d 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -4742,6 +4742,9 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag)
 	case ETH_TUNNEL_FILTER_IMAC:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC;
 		break;
+	case ETH_TUNNEL_FILTER_IIP:
+		*flag = I40E_AQC_ADD_CLOUD_FILTER_IIP;
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "invalid tunnel filter type");
 		return -EINVAL;
@@ -4796,6 +4799,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 	case RTE_TUNNEL_TYPE_VXLAN:
 		tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN;
 		break;
+	case RTE_TUNNEL_TYPE_NVGRE:
+		tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC;
+		break;
 	default:
 		/* Other tunnel types is not supported. */
 		PMD_DRV_LOG(ERR, "tunnel type is not supported.");
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 3/6] app/testpmd:test RX tunnel filter for NVGRE packet
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 1/6] librte_ether:add NVGRE header Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 2/6] i40e:support RX tunnel filter for NVGRE packet Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 4/6] mbuf:add a GRE TX tunnel ol_flag Jijiang Liu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

Extend the "tunnel_filter" command in testpmd to test the RX tunnel filter API for NVGRE packet. 

Signed-off-by Jijiang Liu <jijiang.liu@intel.com>
---
 app/test-pmd/cmdline.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 882a5a2..ab25e24 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -292,11 +292,11 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" a port\n\n"
 
 			"tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) "
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id)\n"
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n"
 			"   add a tunnel filter of a port.\n\n"
 
 			"tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) "
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id) (queue_id)\n"
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id) (queue_id)\n"
 			"   remove a tunnel filter of a port.\n\n"
 
 			"rx_vxlan_port add (udp_port) (port_id)\n"
@@ -6756,6 +6756,8 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 	else if (!strcmp(res->filter_type, "omac-imac-tenid"))
 		tunnel_filter_conf.filter_type =
 			RTE_TUNNEL_FILTER_OMAC_TENID_IMAC;
+	else if (!strcmp(res->filter_type, "iip"))
+		tunnel_filter_conf.filter_type = ETH_TUNNEL_FILTER_IIP;
 	else {
 		printf("The filter type is not supported");
 		return;
@@ -6763,8 +6765,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 
 	if (!strcmp(res->tunnel_type, "vxlan"))
 		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+	if (!strcmp(res->tunnel_type, "nvgre"))
+		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE;
 	else {
-		printf("Only VXLAN is supported now.\n");
+		printf("The tunnel type is supported now.\n");
 		return;
 	}
 
@@ -6808,12 +6812,12 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value =
 	ip_value);
 cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
-	tunnel_type, "vxlan");
+	tunnel_type, "vxlan#nvgre");
 
 cmdline_parse_token_string_t cmd_tunnel_filter_filter_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
 	filter_type, "imac-ivlan#imac-ivlan-tenid#imac-tenid#"
-		"imac#omac-imac-tenid");
+		"imac#omac-imac-tenid#iip");
 cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result,
 	tenant_id, UINT32);
@@ -6826,9 +6830,9 @@ cmdline_parse_inst_t cmd_tunnel_filter = {
 	.data = (void *)0,
 	.help_str = "add/rm tunnel filter of a port: "
 			"tunnel_filter add port_id outer_mac inner_mac ip "
-			"inner_vlan tunnel_type(vxlan) filter_type "
+			"inner_vlan tunnel_type(vxlan|nvgre) filter_type "
 			"(imac-ivlan|imac-ivlan-tenid|imac-tenid|"
-			"imac|omac-imac-tenid) "
+			"imac|omac-imac-tenid|iip) "
 			"tenant_id queue_num",
 	.tokens = {
 		(void *)&cmd_tunnel_filter_cmd,
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 4/6] mbuf:add a GRE TX tunnel ol_flag
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
                   ` (2 preceding siblings ...)
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 3/6] app/testpmd:test " Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 5/6] i40e:support GRE tunnel TX checksum offload Jijiang Liu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

This flag is used to tell the NIC the TX packet is a GRE tunneled packet.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 16059c6..a672bd8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -105,6 +105,12 @@ extern "C" {
 /* add new TX flags here */
 
 /**
+ * TX packet is a GRE tunneled packet. It must be specified when using
+ * outer checksum offload (PKT_TX_OUTER_IP_CKSUM)
+ */
+#define PKT_TX_GRE_TUNNEL_PKT (1ULL << 48)
+
+/**
  * TCP segmentation offload. To enable this offload feature for a
  * packet to be transmitted on hardware supporting TSO:
  *  - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 5/6] i40e:support GRE tunnel TX checksum offload
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
                   ` (3 preceding siblings ...)
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 4/6] mbuf:add a GRE TX tunnel ol_flag Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 6/6] app/testpmd:test NVGRE Tx " Jijiang Liu
  2015-01-27  5:46 ` [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Cao, Min
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

Support NVGRE TX checksum offload, which includes
  - outer L3(IP) checksum offload
  - inner L3(IP) checksum offload
  - inner L4(UDP, TCP and SCTP) checksum offload

In addition, for GRE packet, the L4 tunnel type should be I40E_TXD_CTX_GRE_TUNNELING. 

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_i40e/i40e_rxtx.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 2beae3c..6c1e324 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -476,8 +476,15 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 		return;
 	}
 
-	/* UDP tunneling packet TX checksum offload */
-	if (unlikely(ol_flags & PKT_TX_UDP_TUNNEL_PKT)) {
+	/* UDP/GRE tunneling packet TX checksum offload */
+	if (unlikely(ol_flags & (PKT_TX_UDP_TUNNEL_PKT |
+			PKT_TX_GRE_TUNNEL_PKT))) {
+		uint32_t tunnel_flag;
+
+		if (ol_flags & PKT_TX_UDP_TUNNEL_PKT)
+			tunnel_flag = I40E_TXD_CTX_UDP_TUNNELING;
+		else
+			tunnel_flag = I40E_TXD_CTX_GRE_TUNNELING;
 
 		*td_offset |= (outer_l2_len >> 1)
 				<< I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
@@ -492,7 +499,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 		/* Now set the ctx descriptor fields */
 		*cd_tunneling |= (outer_l3_len >> 2) <<
 				I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT |
-				I40E_TXD_CTX_UDP_TUNNELING |
+				tunnel_flag |
 				(l2_len >> 1) <<
 				I40E_TXD_CTX_QW0_NATLEN_SHIFT;
 
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 6/6] app/testpmd:test NVGRE Tx checksum offload
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
                   ` (4 preceding siblings ...)
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 5/6] i40e:support GRE tunnel TX checksum offload Jijiang Liu
@ 2015-01-26  3:43 ` Jijiang Liu
  2015-01-27  5:46 ` [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Cao, Min
  6 siblings, 0 replies; 9+ messages in thread
From: Jijiang Liu @ 2015-01-26  3:43 UTC (permalink / raw)
  To: dev

Enhance csum fwd engine and command lines based on current TX checksum framework in order to test TX Checksum offload for NVGRE packet.

It includes:
 - IPv4 and IPv6 packet
 - outer L3, inner L3 and L4 checksum offload for Tx side.

Note: The patch will need to be reworked after Olivier's patch set for enhancing checksum offload API is applied.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 app/test-pmd/cmdline.c          |   19 +++++--
 app/test-pmd/csumonly.c         |  105 ++++++++++++++++++++++++++++----------
 app/test-pmd/testpmd.h          |    4 +-
 lib/librte_pmd_i40e/i40e_rxtx.c |    2 +
 4 files changed, 94 insertions(+), 36 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ab25e24..54e0774 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -316,7 +316,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"    Disable hardware insertion of a VLAN header in"
 			" packets sent on a port.\n\n"
 
-			"tx_cksum set (ip|udp|tcp|sctp|vxlan) (hw|sw) (port_id)\n"
+			"tx_cksum set (ip|udp|tcp|sctp|vxlan|nvgre) (hw|sw) (port_id)\n"
 			"    Select hardware or software calculation of the"
 			" checksum with when transmitting a packet using the"
 			" csum forward engine.\n"
@@ -2899,8 +2899,9 @@ cmd_tx_cksum_parsed(void *parsed_result,
 			mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM;
 		} else if (!strcmp(res->proto, "sctp")) {
 			mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM;
-		} else if (!strcmp(res->proto, "vxlan")) {
-			mask = TESTPMD_TX_OFFLOAD_VXLAN_CKSUM;
+		} else if (!strcmp(res->proto, "vxlan") ||
+				!strcmp(res->proto, "nvgre")) {
+			mask = TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM;
 		}
 
 		if (hw)
@@ -2918,8 +2919,14 @@ cmd_tx_cksum_parsed(void *parsed_result,
 		(ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw");
 	printf("SCTP checksum offload is %s\n",
 		(ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
-	printf("VxLAN checksum offload is %s\n",
-		(ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) ? "hw" : "sw");
+
+	if (!strcmp(res->proto, "vxlan")) {
+		printf("VxLAN checksum offload is %s\n",
+		(ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM) ? "hw" : "sw");
+	} else if (!strcmp(res->proto, "nvgre")) {
+		printf("NVGRE checksum offload is %s\n",
+		(ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM) ? "hw" : "sw");
+	}
 
 	/* display warnings if configuration is not supported by the NIC */
 	rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -2953,7 +2960,7 @@ cmdline_parse_token_string_t cmd_tx_cksum_mode =
 				mode, "set");
 cmdline_parse_token_string_t cmd_tx_cksum_proto =
 	TOKEN_STRING_INITIALIZER(struct cmd_tx_cksum_result,
-				proto, "ip#tcp#udp#sctp#vxlan");
+				proto, "ip#tcp#udp#sctp#vxlan#nvgre");
 cmdline_parse_token_string_t cmd_tx_cksum_hwsw =
 	TOKEN_STRING_INITIALIZER(struct cmd_tx_cksum_result,
 				hwsw, "hw#sw");
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 41711fd..8a87fbb 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -86,6 +86,12 @@
 #define _htons(x) (x)
 #endif
 
+/* simplified GRE header */
+struct simple_gre_hdr {
+	uint16_t flags;
+	uint16_t proto;
+};
+
 static uint16_t
 get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags)
 {
@@ -244,42 +250,42 @@ process_inner_cksums(void *l3_hdr, uint16_t ethertype, uint16_t l3_len,
 	return ol_flags;
 }
 
-/* Calculate the checksum of outer header (only vxlan is supported,
- * meaning IP + UDP). The caller already checked that it's a vxlan
+/* Calculate the checksum of outer header (only vxlan/nvgre is supported,
+ * meaning IP + UDP/GRE). The caller already checked that it's a vxlan/NVGRE
  * packet */
 static uint64_t
 process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
-	uint16_t outer_l3_len, uint16_t testpmd_ol_flags)
+	uint16_t outer_l3_len, uint16_t testpmd_ol_flags, uint16_t l4_prot)
 {
 	struct ipv4_hdr *ipv4_hdr = outer_l3_hdr;
 	struct ipv6_hdr *ipv6_hdr = outer_l3_hdr;
 	struct udp_hdr *udp_hdr;
 	uint64_t ol_flags = 0;
 
-	if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
-		ol_flags |= PKT_TX_UDP_TUNNEL_PKT;
-
 	if (outer_ethertype == _htons(ETHER_TYPE_IPv4)) {
 		ipv4_hdr->hdr_checksum = 0;
 
-		if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
+		if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
 			ol_flags |= PKT_TX_OUTER_IP_CKSUM;
 		else
 			ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
-	} else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
+	} else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
 		ol_flags |= PKT_TX_OUTER_IPV6;
 
-	udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + outer_l3_len);
-	/* do not recalculate udp cksum if it was 0 */
-	if (udp_hdr->dgram_cksum != 0) {
-		udp_hdr->dgram_cksum = 0;
-		if (outer_ethertype == _htons(ETHER_TYPE_IPv4))
-			udp_hdr->dgram_cksum =
-				rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr);
-		else
-			udp_hdr->dgram_cksum =
-				rte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr);
-	}
+	if (l4_prot == IPPROTO_UDP) {
+		udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr
+				+ outer_l3_len);
+		/* do not recalculate udp cksum if it was 0 */
+		if (udp_hdr->dgram_cksum != 0) {
+			udp_hdr->dgram_cksum = 0;
+			if (outer_ethertype == _htons(ETHER_TYPE_IPv4))
+				udp_hdr->dgram_cksum =
+					rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr);
+			else
+				udp_hdr->dgram_cksum =
+					rte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr);
+		}
+	} /* else if (l4_proto == IPPROTO_GRE), nothing to do here*/
 
 	return ol_flags;
 }
@@ -299,12 +305,15 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
  *   Ether / (vlan) / IP|IP6 / UDP|TCP|SCTP .
  *   Ether / (vlan) / outer IP|IP6 / outer UDP / VxLAN / Ether / IP|IP6 /
  *           UDP|TCP|SCTP
+ *   Ether / (vlan) / outer IP|IP6 / GRE / Ether / IP|IP6 /
+ *	     UDP|TCP|SCTP
  *
  * The testpmd command line for this forward engine sets the flags
  * TESTPMD_TX_OFFLOAD_* in ports[tx_port].tx_ol_flags. They control
  * wether a checksum must be calculated in software or in hardware. The
  * IP, UDP, TCP and SCTP flags always concern the inner layer.  The
- * VxLAN flag concerns the outer IP (if packet is recognized as a vxlan packet).
+ * TUNNEL flag concerns the outer IP (if packet is recognized as a vxlan/nvgre
+ * packet).
  */
 static void
 pkt_burst_checksum_forward(struct fwd_stream *fs)
@@ -315,6 +324,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	struct ether_hdr *eth_hdr;
 	void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */
 	struct udp_hdr *udp_hdr;
+	struct simple_gre_hdr *gre_hdr;
 	uint16_t nb_rx;
 	uint16_t nb_tx;
 	uint16_t i;
@@ -386,17 +396,20 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 				tunnel = 1;
 
 			/* currently, this flag is set by i40e only if the
-			 * packet is vxlan */
+			 * packet is tunneled packet */
 			} else if (m->ol_flags & (PKT_RX_TUNNEL_IPV4_HDR |
 					PKT_RX_TUNNEL_IPV6_HDR))
 				tunnel = 1;
 
 			if (tunnel == 1) {
+				if (testpmd_ol_flags &
+					TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
+					ol_flags |= PKT_TX_UDP_TUNNEL_PKT;
+
 				outer_ethertype = ethertype;
 				outer_l2_len = l2_len;
 				outer_l3_len = l3_len;
 				outer_l3_hdr = l3_hdr;
-
 				eth_hdr = (struct ether_hdr *)((char *)udp_hdr +
 					sizeof(struct udp_hdr) +
 					sizeof(struct vxlan_hdr));
@@ -407,6 +420,35 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 			}
 		}
 
+		if ((l4_proto == IPPROTO_GRE)
+			&& ((m->ol_flags & (PKT_RX_TUNNEL_IPV4_HDR |
+				PKT_RX_TUNNEL_IPV6_HDR)))) {
+			gre_hdr = (struct simple_gre_hdr *)((char *)l3_hdr + l3_len);
+			if (gre_hdr->proto == _htons(ETHER_TYPE_TEB)) {
+				l4_tun_len = sizeof(struct nvgre_hdr);
+				tunnel = 1;
+			}
+
+			if (tunnel == 1) {
+				if (testpmd_ol_flags &
+					TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
+					ol_flags |= PKT_TX_GRE_TUNNEL_PKT;
+
+				outer_ethertype = ethertype;
+				outer_l2_len = l2_len;
+				outer_l3_len = l3_len;
+				outer_l3_hdr = l3_hdr;
+
+				/* currently, only NVGRE packet is supported */
+				eth_hdr = (struct ether_hdr *)((char *)gre_hdr +
+					sizeof(struct nvgre_hdr));
+				parse_ethernet(eth_hdr, &ethertype, &l2_len,
+						&l3_len, &l4_proto, &l4_len);
+				l3_hdr = (char *)eth_hdr + l2_len;
+			}
+
+		}
+
 		/* step 2: change all source IPs (v4 or v6) so we need
 		 * to recompute the chksums even if they were correct */
 
@@ -428,13 +470,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		 * processed in hardware. */
 		if (tunnel == 1) {
 			ol_flags |= process_outer_cksums(outer_l3_hdr,
-				outer_ethertype, outer_l3_len, testpmd_ol_flags);
+				outer_ethertype, outer_l3_len, testpmd_ol_flags,
+				l4_proto);
 		}
 
 		/* step 4: fill the mbuf meta data (flags and header lengths) */
 
 		if (tunnel == 1) {
-			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) {
+			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM) {
 				m->outer_l2_len = outer_l2_len;
 				m->outer_l3_len = outer_l3_len;
 				m->l2_len = l4_tun_len + l2_len;
@@ -446,9 +489,15 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 				   we changed the ip, but it shows that
 				   we can process the inner header cksum
 				   in the nic */
-				m->l2_len = outer_l2_len + outer_l3_len +
-					sizeof(struct udp_hdr) +
-					sizeof(struct vxlan_hdr) + l2_len;
+				if (l4_proto == IPPROTO_UDP)
+					m->l2_len = outer_l2_len + outer_l3_len +
+						sizeof(struct udp_hdr) +
+						sizeof(struct vxlan_hdr) + l2_len;
+
+				/* currently, only NVGRE is supported */
+				else if (l4_proto == IPPROTO_GRE)
+					m->l2_len = outer_l2_len + outer_l3_len +
+						sizeof(struct nvgre_hdr) + l2_len;
 				m->l3_len = l3_len;
 				m->l4_len = l4_len;
 			}
@@ -505,7 +554,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 					"m->l4_len=%d\n",
 					m->l2_len, m->l3_len, m->l4_len);
 			if ((tunnel == 1) &&
-				(testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM))
+				(testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM))
 				printf("tx: m->outer_l2_len=%d m->outer_l3_len=%d\n",
 					m->outer_l2_len, m->outer_l3_len);
 			if (tso_segsz != 0)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f8b0740..528457b 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -125,8 +125,8 @@ struct fwd_stream {
 #define TESTPMD_TX_OFFLOAD_TCP_CKSUM         0x0004
 /** Offload SCTP checksum in csum forward engine */
 #define TESTPMD_TX_OFFLOAD_SCTP_CKSUM        0x0008
-/** Offload VxLAN checksum in csum forward engine */
-#define TESTPMD_TX_OFFLOAD_VXLAN_CKSUM       0x0010
+/** Offload tunneled packet checksum in csum forward engine */
+#define TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM       0x0010
 /** Insert VLAN header in forward engine */
 #define TESTPMD_TX_OFFLOAD_INSERT_VLAN       0x0020
 
diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 6c1e324..bf6c17c 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -1169,6 +1169,8 @@ i40e_calc_context_desc(uint64_t flags)
 
 	if (flags | PKT_TX_UDP_TUNNEL_PKT)
 		mask |= PKT_TX_UDP_TUNNEL_PKT;
+	if (flags | PKT_TX_GRE_TUNNEL_PKT)
+		mask |= PKT_TX_GRE_TUNNEL_PKT;
 
 #ifdef RTE_LIBRTE_IEEE1588
 	mask |= PKT_TX_IEEE1588_TMST;
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6]  Support NVGRE on i40e
  2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
                   ` (5 preceding siblings ...)
  2015-01-26  3:43 ` [dpdk-dev] [PATCH 6/6] app/testpmd:test NVGRE Tx " Jijiang Liu
@ 2015-01-27  5:46 ` Cao, Min
  2015-01-28 11:08   ` Olivier MATZ
  6 siblings, 1 reply; 9+ messages in thread
From: Cao, Min @ 2015-01-27  5:46 UTC (permalink / raw)
  To: Liu, Jijiang, dev

Test by: min.cao <min.cao@intel.com>
Patch name: 		[dpdk-dev] [PATCH 0/6]  Support NVGRE on i40e
Test Flag: 			Tested-by
Tester name: 		min.cao@intel.com
Result summary:		total 2 cases, 2 passed, 0 failed

Test Case 1:		
Name:				nvgre filter
Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
				gcc (GCC) 4.8.2
				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
				NIC: Fortville eagle 
Test result:		PASSED
Detail:                 check normal packet + ip filter 
                        check vxlan packet + inner ip filter
                        check vxlan packet + outer ip filter
                        check vxlan packet + outer ip + inner ip filter
                        check vxlan packet + inner udp filter
                        check vxlan packet + inner tcp filter
                        check vlan vxlan packet + outer ip filter
                        check vlan vxlan packet + inner ip filter
                        check vlan vxlan packet + outer&inner ip filter
                        check vlan vxlan packet + inner vlan + outer ip filter
                        check vlan vxlan packet + inner vlan + inner ip filter
                        check vlan vxlan packet + inner vlan + outer&inner ip filter
                        check vlan vxlan packet + inner vlan + inner udp filter
                        check vlan vxlan packet + inner vlan + inner tcp filter

Test Case 2:		
Name:				nvgre checksum
Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
				gcc (GCC) 4.8.2
				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
				NIC: Fortville eagle 
Test result:		PASSED
Detail:                 check normal packet + ip checksum invalid
                        check vxlan packet + inner ip checksum invalid
                        check vxlan packet + outer ip checksum invalid
                        check vxlan packet + outer ip + inner ip checksum invalid
                        check vxlan packet + inner udp checksum invalid
                        check vxlan packet + inner tcp checksum invalid
                        check vlan vxlan packet + outer ip checksum invalid
                        check vlan vxlan packet + inner ip checksum invalid
                        check vlan vxlan packet + outer&inner ip checksum invalid
                        check vlan vxlan packet + inner vlan + outer ip checksum invalid
                        check vlan vxlan packet + inner vlan + inner ip checksum invalid
                        check vlan vxlan packet + inner vlan + outer&inner ip checksum invalid
                        check vlan vxlan packet + inner vlan + inner udp checksum invalid
                        check vlan vxlan packet + inner vlan + inner tcp checksum invalid

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jijiang Liu
Sent: Monday, January 26, 2015 11:43 AM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e

The patch set supports NVGRE on i40e.

It includes:
 - Support RX filters for NVGRE packet. It uses MAC and VLAN to point
   to a queue. The filter types supported are listed below:

   1. Inner MAC and Inner VLAN ID

   2. Inner MAC address, inner VLAN ID and tenant ID.

   3. Inner MAC and tenant ID

   4. Inner MAC address

   5. Outer MAC address, tenant ID and inner MAC

   6. Inner IP

 - Support TX checksum offload for NVGRE packet, which include outer L3(IP), inner L3(IP) and inner L4(UDP, TCP and SCTP)

Jijiang Liu (6):
  add gre header defination
  add nvgre RX filter in i40e
  test nvgre RX filters
  add GRE packet offload flag 
  support GRE packet TX checksum offload
  test nvgre TX checksum offload

 app/test-pmd/cmdline.c            |   37 ++++++++-----
 app/test-pmd/csumonly.c           |  105 +++++++++++++++++++++++++++----------
 app/test-pmd/testpmd.h            |    4 +-
 lib/librte_ether/rte_ether.h      |   12 ++++
 lib/librte_mbuf/rte_mbuf.h        |    6 ++
 lib/librte_pmd_i40e/i40e_ethdev.c |    6 ++
 lib/librte_pmd_i40e/i40e_rxtx.c   |   15 ++++-
 7 files changed, 139 insertions(+), 46 deletions(-)

-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6]  Support NVGRE on i40e
  2015-01-27  5:46 ` [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Cao, Min
@ 2015-01-28 11:08   ` Olivier MATZ
  0 siblings, 0 replies; 9+ messages in thread
From: Olivier MATZ @ 2015-01-28 11:08 UTC (permalink / raw)
  To: Cao, Min, Liu, Jijiang, dev

Hi Min,

On 01/27/2015 06:46 AM, Cao, Min wrote:
> Test by: min.cao <min.cao@intel.com>
> Patch name: 		[dpdk-dev] [PATCH 0/6]  Support NVGRE on i40e
> Test Flag: 			Tested-by
> Tester name: 		min.cao@intel.com
> Result summary:		total 2 cases, 2 passed, 0 failed
>
> Test Case 1:		
> Name:				nvgre filter
> Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
> 				gcc (GCC) 4.8.2
> 				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
> 				NIC: Fortville eagle
> [...]

Just one remarq about your test report: it's quite useful to have
such reports, showing that a feature is tested. However, I think
it would be much better if you provide all the means to reproduce
the test (testpmd configuration, scripts to generate packets, ...).

For instance, this could help people wanting to implement the same
on another PMD to validate with the same test plan than yours.

Regards,
Olivier

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-01-28 11:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26  3:43 [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 1/6] librte_ether:add NVGRE header Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 2/6] i40e:support RX tunnel filter for NVGRE packet Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 3/6] app/testpmd:test " Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 4/6] mbuf:add a GRE TX tunnel ol_flag Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 5/6] i40e:support GRE tunnel TX checksum offload Jijiang Liu
2015-01-26  3:43 ` [dpdk-dev] [PATCH 6/6] app/testpmd:test NVGRE Tx " Jijiang Liu
2015-01-27  5:46 ` [dpdk-dev] [PATCH 0/6] Support NVGRE on i40e Cao, Min
2015-01-28 11:08   ` Olivier MATZ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).