Skip to contentSkip to conversation

Support NVGRE on i40e

PATCH Superseded Jijiang Liu 5 participants 15 messages Feb 12, 2015 – Feb 23, 2015 9 messages not in the archive

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover 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

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

V2 changes:
Do some rework based on Olivier's patch set [PATCH v2 00/20] enhance tx checksum offload API; the changes are listed below,
1. remove nvgre_hdr definition from rte_ether.h file. It is not used in csumonly.c file.
2. remove filter type iip that is not supported well in current firmware.
3. remove GRE packet flag from mbuf.

Jijiang Liu (4):
add ETHER_TYPE_TEB definition
add nvgre filter
test nvgre filter
test nvgre tx checksum

 app/test-pmd/cmdline.c            |   14 ++++++++------
 app/test-pmd/csumonly.c           |   32 +++++++++++++++++++-------------
 lib/librte_ether/rte_ether.h      |    1 +
 lib/librte_pmd_i40e/i40e_ethdev.c |    3 +++
 4 files changed, 31 insertions(+), 19 deletions(-)
Signature · 1 line
1.7.7.6

A message that is not in the archive (sent off-list or not yet received): 1423701947-17996-1-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH v2 1/4 librte_ether:add an ETHER_TYPE_TEB macro

Add an Ethernet type definition for Transparent Ethernet Bridging.

---
 lib/librte_ether/rte_ether.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
lib/librte_ether/rte_ether.h +1 -0
index 7e7d22c..a8b3e1d 100644
@@ -329,6 +329,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. */
Signature · 1 line
1.7.7.6
#3 lore raw

PATCH v2 2/4 i40e:support RX tunnel filter for NVGRE packet

In reply to a message not in the archive

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.

---
 lib/librte_pmd_i40e/i40e_ethdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
index 6f385d2..bb6d3e1 100644
@@ -4810,6 +4810,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.");
Signature · 1 line
1.7.7.6
#4 lore raw

PATCH v2 3/4 app/testpmd:test RX tunnel filter for NVGRE packet

In reply to a message not in the archive

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

---
 app/test-pmd/cmdline.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c +8 -6
index 9de3e7e..a380d43 100644
@@ -293,11 +293,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"
@@ -6851,8 +6851,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;
 	}
 
@@ -6896,12 +6898,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#");
 cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result,
 	tenant_id, UINT32);
@@ -6914,7 +6916,7 @@ 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) "
 			"tenant_id queue_num",
Signature · 1 line
1.7.7.6

A message that is not in the archive (sent off-list or not yet received): 1423701947-17996-4-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#6 lore raw

Re: [PATCH v2 3/4] app/testpmd:test RX tunnel filter for NVGRE packet

Hi, jijiang

Quoted 41 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jijiang Liu
Sent: Thursday, February 12, 2015 8:46 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 3/4] app/testpmd:test RX tunnel filter for NVGRE packet

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

---
 app/test-pmd/cmdline.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

9de3e7e..a380d43 100644

app/test-pmd/cmdline.c +0 -0
@@ -293,11 +293,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) "

app/test-pmd/cmdline.c +0 -1
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +1 -0
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +0 -0
 			"   add a tunnel filter of a port.\n\n"
 
 			"tunnel_filter rm (port_id) (outer_mac) (inner_mac)

(ip_addr) "

app/test-pmd/cmdline.c +0 -1
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +1 -0
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +0 -0
 			"   remove a tunnel filter of a port.\n\n"
 
 			"rx_vxlan_port add (udp_port) (port_id)\n"

app/test-pmd/cmdline.c cmd_tunnel_filter_parsed(void *parsed_result, · line 6858

Quoted 9 lines
app/test-pmd/cmdline.c +3 -1
@@ -6851,8 +6851,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");

Maybe "not" is missed in the printed sentence. Or you can just remove the else {}, because res->tunnel_type can only be "vxlan" or "nvgre".

Quoted 6 lines
app/test-pmd/cmdline.c +0 -0
 		return;
 	}
@@ -6896,12 +6898,12 @@ cmdline_parse_token_ipaddr_t

cmd_tunnel_filter_ip_value =

app/test-pmd/cmdline.c +0 -0
 	ip_value);

app/test-pmd/cmdline.c cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = · line 6906

Quoted 10 lines
app/test-pmd/cmdline.c +2 -2
 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#");

Do you need the additional "#"?

Quoted 14 lines

cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id =

app/test-pmd/cmdline.c +1 -2
 	TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result,
 	tenant_id, UINT32);
@@ -6914,7 +6916,7 @@ 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) "
 			"tenant_id queue_num",
--

1.7.7.6

A message that is not in the archive (sent off-list or not yet received): 9BB6961774997848B5B42BEC655768F8BA72B3-0J0gbvR4kTg/[email protected]

#8 lore raw

Re: [PATCH v2 3/4] app/testpmd:test RX tunnel filter for NVGRE packet

Quoted 53 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Friday, February 13, 2015 9:23 AM
To: Liu, Jijiang; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2 3/4] app/testpmd:test RX tunnel filter for NVGRE packet

Hi, jijiang

Quoted 42 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Jijiang Liu
Sent: Thursday, February 12, 2015 8:46 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 3/4] app/testpmd:test RX tunnel filter for NVGRE packet

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

---
 app/test-pmd/cmdline.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

9de3e7e..a380d43 100644

app/test-pmd/cmdline.c +0 -0
@@ -293,11 +293,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) "

app/test-pmd/cmdline.c +0 -1
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +1 -0
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +0 -0
 			"   add a tunnel filter of a port.\n\n"
 
 			"tunnel_filter rm (port_id) (outer_mac) (inner_mac)

(ip_addr) "

app/test-pmd/cmdline.c +0 -1
-			"(inner_vlan) (tunnel_type) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +1 -0
+			"(inner_vlan) (vxlan|nvgre) (filter_type) (tenant_id)

(queue_id)\n"

app/test-pmd/cmdline.c +0 -0
 			"   remove a tunnel filter of a port.\n\n"
 
 			"rx_vxlan_port add (udp_port) (port_id)\n"
@@ -6851,8 +6851,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 
Quoted 11 lines

app/test-pmd/cmdline.c cmd_tunnel_filter_parsed(void *parsed_result, · line 6857

Quoted 8 lines
app/test-pmd/cmdline.c +3 -1
 	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");

Maybe "not" is missed in the printed sentence. Or you can just remove the else {}, because res->tunnel_type can only be "vxlan" or "nvgre".

I'll update it in next version.

Quoted 11 lines
Quoted 11 lines
app/test-pmd/cmdline.c +0 -0
 		return;
 	}
@@ -6896,12 +6898,12 @@ cmdline_parse_token_ipaddr_t

cmd_tunnel_filter_ip_value =

app/test-pmd/cmdline.c +1 -1
 	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");
Quoted 8 lines

app/test-pmd/cmdline.c cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value = · line 6906

Quoted 5 lines

cmdline_parse_token_string_t cmd_tunnel_filter_filter_type =

app/test-pmd/cmdline.c +1 -1
 	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#");

Do you need the additional "#"?

Don't need it, I'll update it in next version.

Quoted 14 lines
Quoted 14 lines

cmdline_parse_token_num_t cmd_tunnel_filter_tenant_id =

app/test-pmd/cmdline.c +1 -2
 	TOKEN_NUM_INITIALIZER(struct cmd_tunnel_filter_result,
 	tenant_id, UINT32);
@@ -6914,7 +6916,7 @@ 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) "
 			"tenant_id queue_num",
--

1.7.7.6

#9 lore raw

PATCH v2 4/4 app/testpmd:test NVGRE Tx checksum offload

In reply to a message not in the archive

Enhance csum fwd engine 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.

---
 app/test-pmd/csumonly.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)
app/test-pmd/csumonly.c +19 -13
index 5ddbaf5..58b82e7 100644
@@ -79,6 +79,10 @@
 #define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
 #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
+#define GRE_KEY_PRESENT 0x2000
+#define GRE_KEY_LEN     4
+#define GRE_SUPPORTED_FIELDS GRE_KEY_PRESENT
+
 /* We cannot use rte_cpu_to_be_16() on a constant in a switch/case */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #define _htons(x) ((uint16_t)((((x) & 0x00ffU) << 8) | (((x) & 0xff00U) >> 8)))
@@ -100,7 +104,7 @@ struct testpmd_offload_info {
 	uint16_t tso_segsz;
 };
 
-/* simplified GRE header (flags must be 0) */
+/* simplified GRE header */
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
@@ -231,20 +235,25 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	struct ipv6_hdr *ipv6_hdr;
+	uint8_t gre_len = 0;
 
-	/* if flags != 0; it's not supported */
-	if (gre_hdr->flags != 0)
+	/* check which fields are supported */
+	if (gre_hdr->flags != 0 &&
+		(gre_hdr->flags & _htons(GRE_SUPPORTED_FIELDS)) == 0)
 		return;
 
+	gre_len += sizeof(struct simple_gre_hdr);
+
+	if (gre_hdr->flags & _htons(GRE_KEY_PRESENT))
+		gre_len += GRE_KEY_LEN;
+
 	if (gre_hdr->proto == _htons(ETHER_TYPE_IPv4)) {
 		info->is_tunnel = 1;
 		info->outer_ethertype = info->ethertype;
 		info->outer_l2_len = info->l2_len;
 		info->outer_l3_len = info->l3_len;
 
-		ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
-
+		ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len);
 		parse_ipv4(ipv4_hdr, info);
 		info->ethertype = _htons(ETHER_TYPE_IPv4);
 		info->l2_len = 0;
@@ -255,30 +264,27 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 		info->outer_l2_len = info->l2_len;
 		info->outer_l3_len = info->l3_len;
 
-		ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
+		ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len);
 
 		info->ethertype = _htons(ETHER_TYPE_IPv6);
 		parse_ipv6(ipv6_hdr, info);
 		info->l2_len = 0;
 
-	} else if (gre_hdr->proto == _htons(0x6558)) { /* ETH_P_TEB in linux */
+	} else if (gre_hdr->proto == _htons(ETHER_TYPE_TEB)) {
 		info->is_tunnel = 1;
 		info->outer_ethertype = info->ethertype;
 		info->outer_l2_len = info->l2_len;
 		info->outer_l3_len = info->l3_len;
 
-		eth_hdr = (struct ether_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
+		eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len);
 
 		parse_ethernet(eth_hdr, info);
 	} else
 		return;
 
-	info->l2_len += sizeof(struct simple_gre_hdr);
+	info->l2_len += gre_len;
 }
 
-
 /* Parse an encapsulated ip or ipv6 header */
 static void
 parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)
Signature · 1 line
1.7.7.6

A message that is not in the archive (sent off-list or not yet received): 1423701947-17996-5-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#11 lore raw

Re: [PATCH v2 4/4] app/testpmd:test NVGRE Tx checksum offload

Hi Jijiang,

Quoted 15 lines · Jijiang Liu

Enhance csum fwd engine 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.

[...]

app/test-pmd/csumonly.c +1 -2
@@ -231,20 +235,25 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	struct ipv6_hdr *ipv6_hdr;
+	uint8_t gre_len = 0;
 
-	/* if flags != 0; it's not supported */
-	if (gre_hdr->flags != 0)

app/test-pmd/csumonly.c parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) · line 249

Quoted 10 lines
app/test-pmd/csumonly.c +8 -0
+	/* check which fields are supported */
+	if (gre_hdr->flags != 0 &&
+		(gre_hdr->flags & _htons(GRE_SUPPORTED_FIELDS)) == 0)
 		return;
 
+	gre_len += sizeof(struct simple_gre_hdr);
+
+	if (gre_hdr->flags & _htons(GRE_KEY_PRESENT))
+		gre_len += GRE_KEY_LEN;
+

I think this test won't work if the flags contains both supported and unsupported flags.

What about this instead:

if ((gre_hdr->flags & _htons(~GRE_SUPPORTED_FIELDS)) != 0)

	return;

Regards,
Olivier

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: [PATCH v2 4/4] app/testpmd:test NVGRE Tx checksum offload

Quoted 44 lines

-----Original Message-----
From: Olivier MATZ [mailto:[email protected]]
Sent: Friday, February 13, 2015 5:53 PM
To: Liu, Jijiang; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 4/4] app/testpmd:test NVGRE Tx checksum offload

Hi Jijiang,

Quoted 1 line · Jijiang Liu

Enhance csum fwd engine based on current TX checksum framework in order

to test TX Checksum offload for NVGRE packet.

Review parse_gre(struct simple_gre_hdr *gre_hdr, struct

Quoted 7 lines

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

[...]

(quoted diff) +0 -0
@@ -231,20 +235,25 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct

testpmd_offload_info *info)

Quoted 7 lines
app/test-pmd/csumonly.c +1 -2
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	struct ipv6_hdr *ipv6_hdr;
+	uint8_t gre_len = 0;
 
-	/* if flags != 0; it's not supported */
-	if (gre_hdr->flags != 0)

app/test-pmd/csumonly.c parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) · line 249

Quoted 10 lines
app/test-pmd/csumonly.c +8 -0
+	/* check which fields are supported */
+	if (gre_hdr->flags != 0 &&
+		(gre_hdr->flags & _htons(GRE_SUPPORTED_FIELDS)) == 0)
 		return;
 
+	gre_len += sizeof(struct simple_gre_hdr);
+
+	if (gre_hdr->flags & _htons(GRE_KEY_PRESENT))
+		gre_len += GRE_KEY_LEN;
+

I think this test won't work if the flags contains both supported and unsupported flags.

Quoted 5 lines

What about this instead:

if ((gre_hdr->flags & _htons(~GRE_SUPPORTED_FIELDS)) != 0)

	return;

That's correct, I will update it in next version.

Quoted 3 lines

Regards,
Olivier

#14 lore raw

v3 cover Support NVGRE on i40e

In reply to a message not in the archive

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

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

V2 changes:
Do some rework based on Olivier's patch set [PATCH v2 00/20] enhance tx checksum offload API; the changes are listed below,
1. remove nvgre_hdr definition from rte_ether.h file. It is not used in csumonly.c file.
2. remove filter type iip that is not supported well in current firmware.
3. remove GRE packet flag from mbuf.

V3 changes:
- Addresses Olivier's comment's for V2 of patchset
- Re-based against HEAD

Jijiang Liu (4):
librte_ether:add an ETHER_TYPE_TEB macro i40e:support RX tunnel filter for NVGRE packet app/testpmd:test RX tunnel filter for NVGRE packet app/testpmd:test NVGRE Tx checksum offload

 app/test-pmd/cmdline.c            | 12 +++++++-----
 app/test-pmd/csumonly.c           | 29 ++++++++++++++++++-----------
 lib/librte_ether/rte_ether.h      |  1 +
 lib/librte_pmd_i40e/i40e_ethdev.c |  3 +++
 4 files changed, 29 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1424451707-12342-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#16 lore raw

PATCH v3 1/4 librte_ether:add an ETHER_TYPE_TEB macro

From: Jijiang Liu <[email protected]>

Add an Ethernet type definition for Transparent Ethernet Bridging.

---
 lib/librte_ether/rte_ether.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_ether/rte_ether.h +1 -0
index 7e7d22c..a8b3e1d 100644
@@ -329,6 +329,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. */
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1424451707-12342-2-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#18 lore raw

PATCH v3 2/4 i40e:support RX tunnel filter for NVGRE packet

From: Jijiang Liu <[email protected]>

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.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +3 -0
index 6f385d2..bb6d3e1 100644
@@ -4810,6 +4810,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.");
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1424451707-12342-3-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#20 lore raw

PATCH v3 3/4 app/testpmd:test RX tunnel filter for NVGRE packet

From: Jijiang Liu <[email protected]>

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

---
 app/test-pmd/cmdline.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
app/test-pmd/cmdline.c +7 -5
index 4753bb4..b4bb91e 100644
@@ -293,11 +293,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"
@@ -6860,8 +6860,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 
 	if (!strcmp(res->tunnel_type, "vxlan"))
 		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+	else 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 %s not supported.\n", res->tunnel_type);
 		return;
 	}
 
@@ -6905,7 +6907,7 @@ 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,
@@ -6923,7 +6925,7 @@ 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) "
 			"tenant_id queue_num",
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1424451707-12342-4-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#22 lore raw

PATCH v3 4/4 app/testpmd:test NVGRE Tx checksum offload

From: Jijiang Liu <[email protected]>

Enhance csum fwd engine 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.

---
 app/test-pmd/csumonly.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
app/test-pmd/csumonly.c +18 -11
index 0a7af79..52cbd8a 100644
@@ -79,6 +79,10 @@
 #define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
 #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
+#define GRE_KEY_PRESENT 0x2000
+#define GRE_KEY_LEN     4
+#define GRE_SUPPORTED_FIELDS GRE_KEY_PRESENT
+
 /* We cannot use rte_cpu_to_be_16() on a constant in a switch/case */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #define _htons(x) ((uint16_t)((((x) & 0x00ffU) << 8) | (((x) & 0xff00U) >> 8)))
@@ -101,7 +105,7 @@ struct testpmd_offload_info {
 	uint16_t tso_segsz;
 };
 
-/* simplified GRE header (flags must be 0) */
+/* simplified GRE header */
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
@@ -233,11 +237,17 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 	struct ether_hdr *eth_hdr;
 	struct ipv4_hdr *ipv4_hdr;
 	struct ipv6_hdr *ipv6_hdr;
+	uint8_t gre_len = 0;
 
-	/* if flags != 0; it's not supported */
-	if (gre_hdr->flags != 0)
+	/* check which fields are supported */
+	if ((gre_hdr->flags & _htons(~GRE_SUPPORTED_FIELDS)) != 0)
 		return;
 
+	gre_len += sizeof(struct simple_gre_hdr);
+
+	if (gre_hdr->flags & _htons(GRE_KEY_PRESENT))
+		gre_len += GRE_KEY_LEN;
+
 	if (gre_hdr->proto == _htons(ETHER_TYPE_IPv4)) {
 		info->is_tunnel = 1;
 		info->outer_ethertype = info->ethertype;
@@ -245,8 +255,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 		info->outer_l3_len = info->l3_len;
 		info->outer_l4_proto = info->l4_proto;
 
-		ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
+		ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len);
 
 		parse_ipv4(ipv4_hdr, info);
 		info->ethertype = _htons(ETHER_TYPE_IPv4);
@@ -259,28 +268,26 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
 		info->outer_l3_len = info->l3_len;
 		info->outer_l4_proto = info->l4_proto;
 
-		ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
+		ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len);
 
 		info->ethertype = _htons(ETHER_TYPE_IPv6);
 		parse_ipv6(ipv6_hdr, info);
 		info->l2_len = 0;
 
-	} else if (gre_hdr->proto == _htons(0x6558)) { /* ETH_P_TEB in linux */
+	} else if (gre_hdr->proto == _htons(ETHER_TYPE_TEB)) {
 		info->is_tunnel = 1;
 		info->outer_ethertype = info->ethertype;
 		info->outer_l2_len = info->l2_len;
 		info->outer_l3_len = info->l3_len;
 		info->outer_l4_proto = info->l4_proto;
 
-		eth_hdr = (struct ether_hdr *)((char *)gre_hdr +
-			sizeof(struct simple_gre_hdr));
+		eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len);
 
 		parse_ethernet(eth_hdr, info);
 	} else
 		return;
 
-	info->l2_len += sizeof(struct simple_gre_hdr);
+	info->l2_len += gre_len;
 }
 
 
Signature · 1 line
1.9.3
#23 lore raw
In reply to a message not in the archive

2015-02-20 17:01, Declan Doherty:

Quoted 28 lines

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

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

V2 changes:
Do some rework based on Olivier's patch set [PATCH v2 00/20] enhance tx checksum offload API; the changes are listed below,
1. remove nvgre_hdr definition from rte_ether.h file. It is not used in csumonly.c file.
2. remove filter type iip that is not supported well in current firmware.
3. remove GRE packet flag from mbuf.

V3 changes:
- Addresses Olivier's comment's for V2 of patchset
- Re-based against HEAD

Quoted 5 lines

Jijiang Liu (4):
librte_ether:add an ETHER_TYPE_TEB macro i40e:support RX tunnel filter for NVGRE packet app/testpmd:test RX tunnel filter for NVGRE packet app/testpmd:test NVGRE Tx checksum offload

Applied, thanks