Skip to contentSkip to conversation

support L2TPv2 for AVF RSS hash and FDIR

PATCH Superseded Jie Wang 2 participants 9 messages Jan 24, 2022 – Jan 25, 2022 Network drivers

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Jie Wang

author
#0 lore raw

cover support L2TPv2 for AVF RSS hash and FDIR

Support IAVF L2TPv2(include PPP over L2tpv2) RSS hash and flow director. Required to distribute packets based on outer MAC src address and L2TPv2 session ID.

Support IAVF PPPoL2TPv2oUDP flow director. Required to distribute packets based on inner IP src+dest address and TCP/UDP src+dest port.

Jie Wang (6):
ethdev: add L2TPv2 RSS offload type
net: fix L2TPv2 common header
app/testpmd: add 6 types of L2TPv2 message
common/iavf: add session ID fields for L2TPv2
net/iavf: support L2TPv2 for AVF HASH
net/iavf: support L2TPv2 for AVF FDIR

 app/test-pmd/cmdline.c                 |  10 +-
 app/test-pmd/cmdline_flow.c            | 313 +++++++++++++++++++++----
 app/test-pmd/config.c                  |   3 +-
 doc/guides/rel_notes/release_22_03.rst |  14 ++
 drivers/common/iavf/virtchnl.h         |   4 +
 drivers/net/iavf/iavf.h                |   2 +
 drivers/net/iavf/iavf_fdir.c           | 174 +++++++++++---
 drivers/net/iavf/iavf_generic_flow.c   |  34 +++
 drivers/net/iavf/iavf_generic_flow.h   |  10 +
 drivers/net/iavf/iavf_hash.c           |  83 ++++++-
 lib/ethdev/rte_ethdev.h                |   3 +
 lib/net/rte_l2tpv2.h                   |  33 ++-
 12 files changed, 585 insertions(+), 98 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/6 ethdev: add L2TPv2 RSS offload type

This patch defines new RSS offload type for L2TPv2, which are required when users want to distribute packets based on the L2TPv2 field.

---
 app/test-pmd/cmdline.c                 | 10 ++++++----
 app/test-pmd/config.c                  |  3 ++-
 doc/guides/rel_notes/release_22_03.rst |  5 +++++
 lib/ethdev/rte_ethdev.h                |  3 +++
 4 files changed, 16 insertions(+), 5 deletions(-)
app/test-pmd/cmdline.c +6 -4
index 6e10afeedd..3914fb9a75 100644
@@ -2178,7 +2178,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
 			RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
 			RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
-			RTE_ETH_RSS_ECPRI;
+			RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
 	else if (!strcmp(res->value, "eth"))
 		rss_conf.rss_hf = RTE_ETH_RSS_ETH;
 	else if (!strcmp(res->value, "vlan"))
@@ -2256,6 +2256,8 @@ cmd_config_rss_parsed(void *parsed_result,
 		rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
 	} else if (!strcmp(res->value, "default"))
 		use_default = 1;
+	else if (!strcmp(res->value, "l2tpv2"))
+		rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
 	else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
 						atoi(res->value) < 64)
 		rss_conf.rss_hf = 1ULL << atoi(res->value);
@@ -2314,7 +2316,7 @@ cmdline_parse_inst_t cmd_config_rss = {
 	.help_str = "port config all rss "
 		"all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
 		"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-default|"
-		"level-outer|level-inner|ipv4-chksum|<flowtype_id>",
+		"level-outer|level-inner|ipv4-chksum|l2tpv2|<flowtype_id>",
 	.tokens = {
 		(void *)&cmd_config_rss_port,
 		(void *)&cmd_config_rss_keyword,
@@ -2429,7 +2431,7 @@ cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_type =
 				 "ipv6-tcp-ex#ipv6-udp-ex#"
 				 "l3-src-only#l3-dst-only#l4-src-only#l4-dst-only#"
 				 "l2-src-only#l2-dst-only#s-vlan#c-vlan#"
-				 "l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls");
+				 "l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls#l2tpv2");
 cmdline_parse_token_string_t cmd_config_rss_hash_key_value =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, key, NULL);
 
@@ -2442,7 +2444,7 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = {
 		"l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
 		"l3-src-only|l3-dst-only|l4-src-only|l4-dst-only|"
 		"l2-src-only|l2-dst-only|s-vlan|c-vlan|"
-		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls "
+		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls|l2tpv2 "
 		"<string of hex digits (variable length, NIC dependent)>",
 	.tokens = {
 		(void *)&cmd_config_rss_hash_key_port,
app/test-pmd/config.c +2 -1
index 1722d6c8f8..ec922bd304 100644
@@ -90,7 +90,7 @@ const struct rss_type_info rss_type_table[] = {
 	{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
 		RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
 		RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |
-		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS},
+		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS | RTE_ETH_RSS_L2TPV2},
 	{ "none", 0 },
 	{ "eth", RTE_ETH_RSS_ETH },
 	{ "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
@@ -143,6 +143,7 @@ const struct rss_type_info rss_type_table[] = {
 	{ "mpls", RTE_ETH_RSS_MPLS },
 	{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
 	{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
+	{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
 	{ NULL, 0 },
 };
 
doc/guides/rel_notes/release_22_03.rst +5 -0
index 6d99d1eaa9..30695f11b7 100644
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added new RSS offload types for L2TPv2 in RSS flow.**
+
+  Added macros RTE_ETH_RSS_L2TPV2, now L2TPv2 field can be used as
+  input set for RSS.
+
 
 Removed Items
 -------------
lib/ethdev/rte_ethdev.h +3 -0
index fa299c8ad7..43f582c90c 100644
@@ -645,6 +645,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_RSS_L4_CHKSUM          RTE_BIT64(35)
 #define ETH_RSS_L4_CHKSUM              RTE_ETH_RSS_L4_CHKSUM
 
+#define RTE_ETH_RSS_L2TPV2             RTE_BIT64(36)
+#define ETH_RSS_L2TPV2                 RTE_ETH_RSS_L2TPV2
+
 /*
  * We use the following macros to combine with above RTE_ETH_RSS_* for
  * more specific input set selection. These bits are defined starting
Signature · 1 line
2.25.1
#2 lore raw

RE: [PATCH 1/6] ethdev: add L2TPv2 RSS offload type

Hi Jie

Quoted 94 lines

-----Original Message-----
From: Jie Wang <[email protected]>
Sent: Monday, January 24, 2022 8:56 AM
Subject: [PATCH 1/6] ethdev: add L2TPv2 RSS offload type

This patch defines new RSS offload type for L2TPv2, which are required when users want to distribute packets based on the L2TPv2 field.

---
 app/test-pmd/cmdline.c                 | 10 ++++++----
 app/test-pmd/config.c                  |  3 ++-
 doc/guides/rel_notes/release_22_03.rst |  5 +++++
 lib/ethdev/rte_ethdev.h                |  3 +++
 4 files changed, 16 insertions(+), 5 deletions(-)
app/test-pmd/cmdline.c +6 -4
index 6e10afeedd..3914fb9a75 100644
@@ -2178,7 +2178,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |
 			RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP |
 			RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU |
-			RTE_ETH_RSS_ECPRI;
+			RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
 	else if (!strcmp(res->value, "eth"))
 		rss_conf.rss_hf = RTE_ETH_RSS_ETH;
 	else if (!strcmp(res->value, "vlan"))
@@ -2256,6 +2256,8 @@ cmd_config_rss_parsed(void *parsed_result,
 		rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
 	} else if (!strcmp(res->value, "default"))
 		use_default = 1;
+	else if (!strcmp(res->value, "l2tpv2"))
+		rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
 	else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
 						atoi(res->value) < 64)
 		rss_conf.rss_hf = 1ULL << atoi(res->value);
@@ -2314,7 +2316,7 @@ cmdline_parse_inst_t cmd_config_rss = {
 	.help_str = "port config all rss "
 		"all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"
 		"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-default|"
-		"level-outer|level-inner|ipv4-chksum|<flowtype_id>",
+		"level-outer|level-inner|ipv4-chksum|l2tpv2|<flowtype_id>",
 	.tokens = {
 		(void *)&cmd_config_rss_port,
 		(void *)&cmd_config_rss_keyword,
@@ -2429,7 +2431,7 @@ cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_type =
 				 "ipv6-tcp-ex#ipv6-udp-ex#"
 				 "l3-src-only#l3-dst-only#l4-src-only#l4-dst-only#"
 				 "l2-src-only#l2-dst-only#s-vlan#c-vlan#"
-				 "l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls");
+				 "l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls#l2tpv2");
 cmdline_parse_token_string_t cmd_config_rss_hash_key_value =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, key, NULL);
 
@@ -2442,7 +2444,7 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = {
 		"l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
 		"l3-src-only|l3-dst-only|l4-src-only|l4-dst-only|"
 		"l2-src-only|l2-dst-only|s-vlan|c-vlan|"
-		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls "
+		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls|l2tpv2 "
 		"<string of hex digits (variable length, NIC dependent)>",
 	.tokens = {
 		(void *)&cmd_config_rss_hash_key_port,
app/test-pmd/config.c +0 -0
index 1722d6c8f8..ec922bd304 100644
@@ -90,7 +90,7 @@ const struct rss_type_info rss_type_table[] = {
 	{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |
 		RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD |
 		RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP

|

app/test-pmd/config.c +1 -1
-		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS},
+		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS |

RTE_ETH_RSS_L2TPV2},

app/test-pmd/config.c +1 -0
 	{ "none", 0 },
 	{ "eth", RTE_ETH_RSS_ETH },
 	{ "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY },
@@ -143,6 +143,7 @@ const struct rss_type_info rss_type_table[] = {
 	{ "mpls", RTE_ETH_RSS_MPLS },
 	{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
 	{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
+	{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
 	{ NULL, 0 },
 };
 
doc/guides/rel_notes/release_22_03.rst +0 -0
index 6d99d1eaa9..30695f11b7 100644

doc/guides/rel_notes/release_22_03.rst New Features · line 62

Quoted 8 lines
doc/guides/rel_notes/release_22_03.rst +5 -0
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added new RSS offload types for L2TPv2 in RSS flow.**
+
+  Added macros RTE_ETH_RSS_L2TPV2, now L2TPv2 field can be used as
+  input set for RSS.
+

Which fields exactly? I assume it is tunnel id but can it be something else?

Quoted 8 lines
doc/guides/rel_notes/release_22_03.rst +0 -0
 Removed Items
 -------------
lib/ethdev/rte_ethdev.h +0 -0
index fa299c8ad7..43f582c90c 100644

lib/ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 650

Quoted 6 lines
lib/ethdev/rte_ethdev.h +3 -0
@@ -645,6 +645,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_RSS_L4_CHKSUM          RTE_BIT64(35)
 #define ETH_RSS_L4_CHKSUM              RTE_ETH_RSS_L4_CHKSUM
 
+#define RTE_ETH_RSS_L2TPV2             RTE_BIT64(36)
+#define ETH_RSS_L2TPV2                 RTE_ETH_RSS_L2TPV2
+

I know it was not done until now, but I think it is important to explain exactly on what fields this hash is being done.

Quoted 5 lines
lib/ethdev/rte_ethdev.h +0 -1
 /*
  * We use the following macros to combine with above RTE_ETH_RSS_* for
  * more specific input set selection. These bits are defined starting
--

2.25.1

Best,
Ori

#3 lore raw

RE: [PATCH 1/6] ethdev: add L2TPv2 RSS offload type

Hi Ori,

Quoted 127 lines

-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Tuesday, January 25, 2022 12:35 AM
To: Wang, Jie1X <[email protected]>; [email protected]
Cc: Yang, SteveX <[email protected]>; Singh, Aman Deep <[email protected]>; Yigit, Ferruh <[email protected]>; NBU- Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: RE: [PATCH 1/6] ethdev: add L2TPv2 RSS offload type

Hi Jie

Quoted 21 lines

-----Original Message-----
From: Jie Wang <[email protected]>
Sent: Monday, January 24, 2022 8:56 AM
Subject: [PATCH 1/6] ethdev: add L2TPv2 RSS offload type

This patch defines new RSS offload type for L2TPv2, which are required when users want to distribute packets based on the L2TPv2 field.

---
 app/test-pmd/cmdline.c                 | 10 ++++++----
 app/test-pmd/config.c                  |  3 ++-
 doc/guides/rel_notes/release_22_03.rst |  5 +++++
 lib/ethdev/rte_ethdev.h                |  3 +++
 4 files changed, 16 insertions(+), 5 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

6e10afeedd..3914fb9a75 100644

app/test-pmd/cmdline.c cmd_config_rss_parsed(void *parsed_result, · line 2178

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
@@ -2178,7 +2178,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP |

RTE_ETH_RSS_SCTP |

app/test-pmd/cmdline.c cmd_config_rss_parsed(void *parsed_result, · line 2179

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 |

RTE_ETH_RSS_ESP |

app/test-pmd/cmdline.c cmd_config_rss_parsed(void *parsed_result, · line 2180

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP |

RTE_ETH_RSS_GTPU |

Quoted 6 lines
app/test-pmd/cmdline.c +1 -1
-			RTE_ETH_RSS_ECPRI;
+			RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_L2TPV2;
 	else if (!strcmp(res->value, "eth"))
 		rss_conf.rss_hf = RTE_ETH_RSS_ETH;
 	else if (!strcmp(res->value, "vlan")) @@ -2256,6 +2256,8 @@

cmd_config_rss_parsed(void *parsed_result,

app/test-pmd/cmdline.c cmd_config_rss_parsed(void *parsed_result,

Quoted 8 lines
app/test-pmd/cmdline.c +2 -0
 		rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST);
 	} else if (!strcmp(res->value, "default"))
 		use_default = 1;
+	else if (!strcmp(res->value, "l2tpv2"))
+		rss_conf.rss_hf = RTE_ETH_RSS_L2TPV2;
 	else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
 						atoi(res->value) < 64)
 		rss_conf.rss_hf = 1ULL << atoi(res->value); @@ -2314,7

+2316,7 @@

Quoted 3 lines

cmdline_parse_inst_t cmd_config_rss = {
.help_str = "port config all rss "

"all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|"

Quoted 1 line

"nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-

default|"

app/test-pmd/cmdline.c cmdline_parse_token_string_t

Quoted 6 lines
app/test-pmd/cmdline.c +1 -1
-		"level-outer|level-inner|ipv4-chksum|<flowtype_id>",
+		"level-outer|level-inner|ipv4-chksum|l2tpv2|<flowtype_id>",
 	.tokens = {
 		(void *)&cmd_config_rss_port,
 		(void *)&cmd_config_rss_keyword,
@@ -2429,7 +2431,7 @@ cmdline_parse_token_string_t

cmd_config_rss_hash_key_rss_type =

app/test-pmd/cmdline.c cmdline_parse_token_string_t · line 2432

Quoted 2 lines
app/test-pmd/cmdline.c +0 -0
 				 "ipv6-tcp-ex#ipv6-udp-ex#"
 				 "l3-src-only#l3-dst-only#l4-src-only#l4-dst-

only#"

app/test-pmd/cmdline.c cmdline_parse_token_string_t · line 2432

Quoted 2 lines
app/test-pmd/cmdline.c +0 -1
 				 "l2-src-only#l2-dst-only#s-vlan#c-vlan#"
-

"l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls");

app/test-pmd/cmdline.c cmdline_parse_token_string_t · line 2434

Quoted 1 line
app/test-pmd/cmdline.c +1 -0
+

"l2tpv3#esp#ah#pfcp#pppoe#gtpu#ecpri#mpls#l2tpv2");

app/test-pmd/cmdline.c cmdline_parse_token_string_t · line 2436

Quoted 2 lines
app/test-pmd/cmdline.c +0 -0
 cmdline_parse_token_string_t cmd_config_rss_hash_key_value =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, key,

NULL);

Quoted 15 lines
app/test-pmd/cmdline.c +1 -1
@@ -2442,7 +2444,7 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = {
 		"l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|"
 		"l3-src-only|l3-dst-only|l4-src-only|l4-dst-only|"
 		"l2-src-only|l2-dst-only|s-vlan|c-vlan|"
-		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls "
+		"l2tpv3|esp|ah|pfcp|pppoe|gtpu|ecpri|mpls|l2tpv2 "
 		"<string of hex digits (variable length, NIC dependent)>",
 	.tokens = {
 		(void *)&cmd_config_rss_hash_key_port, diff --git

a/app/test-pmd/config.c b/app/test-pmd/config.c index 1722d6c8f8..ec922bd304 100644

app/test-pmd/config.c const struct rss_type_info rss_type_table[] = { · line 90

Quoted 1 line
app/test-pmd/config.c +0 -0
@@ -90,7 +90,7 @@ const struct rss_type_info rss_type_table[] = {
 	{ "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP |

RTE_ETH_RSS_TCP |

app/test-pmd/config.c const struct rss_type_info rss_type_table[] = { · line 91

Quoted 1 line
app/test-pmd/config.c +0 -0
 		RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP |

RTE_ETH_RSS_L2_PAYLOAD |

app/test-pmd/config.c const struct rss_type_info rss_type_table[] = { · line 92

Quoted 1 line
app/test-pmd/config.c +0 -0
 		RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH

|

app/test-pmd/config.c

Quoted 3 lines

RTE_ETH_RSS_PFCP
|

app/test-pmd/config.c +0 -1
-		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI |

RTE_ETH_RSS_MPLS},

app/test-pmd/config.c

Quoted 1 line
app/test-pmd/config.c +1 -0
+		RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI |

RTE_ETH_RSS_MPLS |

Quoted 21 lines

RTE_ETH_RSS_L2TPV2},

app/test-pmd/config.c +0 -0
 	{ "none", 0 },
 	{ "eth", RTE_ETH_RSS_ETH },
 	{ "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY }, @@ -143,6 +143,7 @@

const struct rss_type_info rss_type_table[] = {

app/test-pmd/config.c +1 -0
 	{ "mpls", RTE_ETH_RSS_MPLS },
 	{ "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM },
 	{ "l4-chksum", RTE_ETH_RSS_L4_CHKSUM },
+	{ "l2tpv2", RTE_ETH_RSS_L2TPV2 },
 	{ NULL, 0 },
 };
doc/guides/rel_notes/release_22_03.rst +0 -0
index 6d99d1eaa9..30695f11b7 100644
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
Quoted 8 lines

doc/guides/rel_notes/release_22_03.rst New Features · line 62

Quoted 5 lines
doc/guides/rel_notes/release_22_03.rst +5 -0
+* **Added new RSS offload types for L2TPv2 in RSS flow.**
+
+  Added macros RTE_ETH_RSS_L2TPV2, now L2TPv2 field can be used as
+ input set for RSS.
+

Which fields exactly? I assume it is tunnel id but can it be something else?

It's session ID, I'll update it in v2.

Quoted 11 lines
Quoted 11 lines
doc/guides/rel_notes/release_22_03.rst +0 -0
 Removed Items
 -------------
lib/ethdev/rte_ethdev.h index renamed from lib/ethdev/rte_ethdev.h +0 -0

fa299c8ad7..43f582c90c 100644

lib/ethdev/rte_ethdev.h +0 -0
@@ -645,6 +645,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_RSS_L4_CHKSUM          RTE_BIT64(35)
 #define ETH_RSS_L4_CHKSUM              RTE_ETH_RSS_L4_CHKSUM
 
Quoted 7 lines

lib/ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 650

Quoted 3 lines
lib/ethdev/rte_ethdev.h +3 -0
+#define RTE_ETH_RSS_L2TPV2             RTE_BIT64(36)
+#define ETH_RSS_L2TPV2                 RTE_ETH_RSS_L2TPV2
+

I know it was not done until now, but I think it is important to explain exactly on what fields this hash is being done.

Yes, I'll add some comments to explain it in v2.

Quoted 9 lines
Quoted 6 lines
lib/ethdev/rte_ethdev.h +0 -1
 /*
  * We use the following macros to combine with above RTE_ETH_RSS_* for
  * more specific input set selection. These bits are defined starting
--

2.25.1

Best,
Ori

author
#4 lore raw

PATCH 2/6 net: fix L2TPv2 common header

In reply to Jie Wang

The fields of L2TPv2 common header were reversed in big endian and little endian.

This patch fixes this error to ensure L2TPv2 can be parsed correctly.

Fixes 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
---
 lib/net/rte_l2tpv2.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
lib/net/rte_l2tpv2.h +10 -10
index b90e36cf12..398e53bc46 100644
@@ -89,16 +89,6 @@ struct rte_l2tpv2_common_hdr {
 		__extension__
 		struct {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
-			uint16_t t:1;		/**< message Type */
-			uint16_t l:1;		/**< length option bit */
-			uint16_t res1:2;	/**< reserved */
-			uint16_t s:1;		/**< ns/nr option bit */
-			uint16_t res2:1;	/**< reserved */
-			uint16_t o:1;		/**< offset option bit */
-			uint16_t p:1;		/**< priority option bit */
-			uint16_t res3:4;	/**< reserved */
-			uint16_t ver:4;		/**< protocol version */
-#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 			uint16_t ver:4;		/**< protocol version */
 			uint16_t res3:4;	/**< reserved */
 			uint16_t p:1;		/**< priority option bit */
@@ -108,6 +98,16 @@ struct rte_l2tpv2_common_hdr {
 			uint16_t res1:2;	/**< reserved */
 			uint16_t l:1;		/**< length option bit */
 			uint16_t t:1;		/**< message Type */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+			uint16_t t:1;		/**< message Type */
+			uint16_t l:1;		/**< length option bit */
+			uint16_t res1:2;	/**< reserved */
+			uint16_t s:1;		/**< ns/nr option bit */
+			uint16_t res2:1;	/**< reserved */
+			uint16_t o:1;		/**< offset option bit */
+			uint16_t p:1;		/**< priority option bit */
+			uint16_t res3:4;	/**< reserved */
+			uint16_t ver:4;		/**< protocol version */
 #endif
 		};
 	};
Signature · 1 line
2.25.1
author
#5 lore raw

PATCH 3/6 app/testpmd: add 6 types of L2TPv2 message

In reply to Jie Wang

This patch adds L2TPv2 control message and 5 types of data message support for testpmd.

The added L2TPv2 message types are listed below:
1. L2TPv2 control
2. L2TPv2
3. L2TPv2 + length option
4. L2TPv2 + sequence option
5. L2TPv2 + offset option
6. L2TPv2 + length option + sequence option

---
 app/test-pmd/cmdline_flow.c | 313 ++++++++++++++++++++++++++++++------
 lib/net/rte_l2tpv2.h        |  13 ++
 2 files changed, 275 insertions(+), 51 deletions(-)
app/test-pmd/cmdline_flow.c +262 -51
index bbe3dc0115..d9226b1579 100644
@@ -322,13 +322,30 @@ enum index {
 	ITEM_FLEX_ITEM_HANDLE,
 	ITEM_FLEX_PATTERN_HANDLE,
 	ITEM_L2TPV2,
-	ITEM_L2TPV2_COMMON,
-	ITEM_L2TPV2_COMMON_TYPE,
-	ITEM_L2TPV2_COMMON_TYPE_DATA_L,
-	ITEM_L2TPV2_COMMON_TYPE_CTRL,
+	ITEM_L2TPV2_TYPE,
+	ITEM_L2TPV2_TYPE_DATA,
+	ITEM_L2TPV2_TYPE_DATA_L,
+	ITEM_L2TPV2_TYPE_DATA_S,
+	ITEM_L2TPV2_TYPE_DATA_O,
+	ITEM_L2TPV2_TYPE_DATA_L_S,
+	ITEM_L2TPV2_TYPE_CTRL,
+	ITEM_L2TPV2_MSG_DATA_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_SESSION_ID,
 	ITEM_L2TPV2_MSG_DATA_L_LENGTH,
 	ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
 	ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_NS,
+	ITEM_L2TPV2_MSG_DATA_S_NR,
+	ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_O_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_O_OFFSET,
+	ITEM_L2TPV2_MSG_DATA_L_S_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_NS,
+	ITEM_L2TPV2_MSG_DATA_L_S_NR,
 	ITEM_L2TPV2_MSG_CTRL_LENGTH,
 	ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
 	ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
@@ -1449,19 +1466,70 @@ static const enum index item_flex[] = {
 };
 
 static const enum index item_l2tpv2[] = {
-	ITEM_L2TPV2_COMMON,
+	ITEM_L2TPV2_TYPE,
 	ITEM_NEXT,
 	ZERO,
 };
 
-static const enum index item_l2tpv2_common[] = {
-	ITEM_L2TPV2_COMMON_TYPE,
+static const enum index item_l2tpv2_type[] = {
+	ITEM_L2TPV2_TYPE_DATA,
+	ITEM_L2TPV2_TYPE_DATA_L,
+	ITEM_L2TPV2_TYPE_DATA_S,
+	ITEM_L2TPV2_TYPE_DATA_O,
+	ITEM_L2TPV2_TYPE_DATA_L_S,
+	ITEM_L2TPV2_TYPE_CTRL,
 	ZERO,
 };
 
-static const enum index item_l2tpv2_common_type[] = {
-	ITEM_L2TPV2_COMMON_TYPE_DATA_L,
-	ITEM_L2TPV2_COMMON_TYPE_CTRL,
+static const enum index item_l2tpv2_type_data[] = {
+	ITEM_L2TPV2_MSG_DATA_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_SESSION_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_l[] = {
+	ITEM_L2TPV2_MSG_DATA_L_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_s[] = {
+	ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_NS,
+	ITEM_L2TPV2_MSG_DATA_S_NR,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_o[] = {
+	ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_O_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_O_OFFSET,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_l_s[] = {
+	ITEM_L2TPV2_MSG_DATA_L_S_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_NS,
+	ITEM_L2TPV2_MSG_DATA_L_S_NR,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_ctrl[] = {
+	ITEM_L2TPV2_MSG_CTRL_LENGTH,
+	ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
+	ITEM_L2TPV2_MSG_CTRL_NS,
+	ITEM_L2TPV2_MSG_CTRL_NR,
+	ITEM_NEXT,
 	ZERO,
 };
 
@@ -3843,31 +3911,46 @@ static const struct token token_list[] = {
 		.next = NEXT(item_l2tpv2),
 		.call = parse_vc,
 	},
-	[ITEM_L2TPV2_COMMON] = {
-		.name = "common",
-		.help = "L2TPv2 common header",
-		.next = NEXT(item_l2tpv2_common),
-	},
-	[ITEM_L2TPV2_COMMON_TYPE] = {
+	[ITEM_L2TPV2_TYPE] = {
 		.name = "type",
-		.help = "type of common header",
-		.next = NEXT(item_l2tpv2_common_type),
+		.help = "type of l2tpv2",
+		.next = NEXT(item_l2tpv2_type),
 		.args = ARGS(ARG_ENTRY_HTON(struct rte_flow_item_l2tpv2)),
 	},
-	[ITEM_L2TPV2_COMMON_TYPE_DATA_L] = {
+	[ITEM_L2TPV2_TYPE_DATA] = {
+		.name = "data",
+		.help = "Type #7: data message without any options",
+		.next = NEXT(item_l2tpv2_type_data),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type7.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type7.session_id)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_L] = {
 		.name = "data_l",
 		.help = "Type #6: data message with length option",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH,
-					ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
-					ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
-					ITEM_NEXT)),
+		.next = NEXT(item_l2tpv2_type_data_l),
 		.call = parse_vc_item_l2tpv2_type,
 	},
 	[ITEM_L2TPV2_MSG_DATA_L_LENGTH] = {
 		.name = "length",
 		.help = "message length",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3876,8 +3959,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID] = {
 		.name = "tunnel_id",
 		.help = "tunnel identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3886,29 +3968,150 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_DATA_L_SESSION_ID] = {
 		.name = "session_id",
 		.help = "session identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
 					     hdr.type6.session_id)),
 	},
-	[ITEM_L2TPV2_COMMON_TYPE_CTRL] = {
+	[ITEM_L2TPV2_TYPE_DATA_S] = {
+		.name = "data_s",
+		.help = "Type #5: data message with ns, nr option",
+		.next = NEXT(item_l2tpv2_type_data_s),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_NS] = {
+		.name = "ns",
+		.help = "sequence number for message",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.ns)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_NR] = {
+		.name = "nr",
+		.help = "sequence number for next receive message",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.nr)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_O] = {
+		.name = "data_o",
+		.help = "Type #4: data message with offset option",
+		.next = NEXT(item_l2tpv2_type_data_o),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type4.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_OFFSET] = {
+		.name = "offset_size",
+		.help = "the size of offset padding",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type4.offset_size)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_L_S] = {
+		.name = "data_l_s",
+		.help = "Type #3: data message contains length, ns, nr "
+			"options",
+		.next = NEXT(item_l2tpv2_type_data_l_s),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_LENGTH] = {
+		.name = "length",
+		.help = "message length",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.length)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_NS] = {
+		.name = "ns",
+		.help = "sequence number for message",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.ns)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_NR] = {
+		.name = "nr",
+		.help = "sequence number for next receive message",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.nr)),
+	},
+	[ITEM_L2TPV2_TYPE_CTRL] = {
 		.name = "control",
-		.help = "Type #3: conrtol message contains length, ns, nr options",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH,
-					ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
-					ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
-					ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_MSG_CTRL_NR,
-					ITEM_NEXT)),
+		.help = "Type #3: conrtol message contains length, ns, nr "
+			"options",
+		.next = NEXT(item_l2tpv2_type_ctrl),
 		.call = parse_vc_item_l2tpv2_type,
 	},
 	[ITEM_L2TPV2_MSG_CTRL_LENGTH] = {
 		.name = "length",
 		.help = "message length",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3917,8 +4120,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID] = {
 		.name = "tunnel_id",
 		.help = "tunnel identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3927,8 +4129,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_SESSION_ID] = {
 		.name = "session_id",
 		.help = "session identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3937,8 +4138,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_NS] = {
 		.name = "ns",
 		.help = "sequence number for message",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3947,8 +4147,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_NR] = {
 		.name = "nr",
 		.help = "sequence number for next receive message",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -5889,11 +6088,23 @@ parse_vc_item_l2tpv2_type(struct context *ctx, const struct token *token,
 	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
 		return -1;
 	switch (ctx->curr) {
-	case ITEM_L2TPV2_COMMON_TYPE_DATA_L:
-		msg_type |= 0x4000;
+	case ITEM_L2TPV2_TYPE_DATA:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_L:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_S:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_S;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_O:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_O;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_L_S:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L_S;
 		break;
-	case ITEM_L2TPV2_COMMON_TYPE_CTRL:
-		msg_type |= 0xC800;
+	case ITEM_L2TPV2_TYPE_CTRL:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_CONTROL;
 		break;
 	default:
 		return -1;
lib/net/rte_l2tpv2.h +13 -0
index 398e53bc46..2edbfb49f0 100644
@@ -78,6 +78,19 @@
 extern "C" {
 #endif
 
+/*
+ * L2TPv2 Message Type
+ */
+#define RTE_L2TPV2_MSG_TYPE_CONTROL	0xC802
+#define RTE_L2TPV2_MSG_TYPE_DATA	0x0002
+#define RTE_L2TPV2_MSG_TYPE_DATA_L	0x4002
+#define RTE_L2TPV2_MSG_TYPE_DATA_S	0x0802
+#define RTE_L2TPV2_MSG_TYPE_DATA_O	0x0202
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_S	0x4802
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_O	0x4202
+#define RTE_L2TPV2_MSG_TYPE_DATA_S_O	0x0A02
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_S_O	0x4A02
+
 /**
  * L2TPv2 Common Header
  */
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH 4/6 common/iavf: add session ID fields for L2TPv2

In reply to Jie Wang

Add virtchnl fields session ID of L2TPv2 for AVF HASH.

---
 drivers/common/iavf/virtchnl.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/common/iavf/virtchnl.h +4 -0
index 269578f7c0..7c86127dac 100644
@@ -1653,6 +1653,10 @@ enum virtchnl_proto_hdr_field {
 		PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN),
 	VIRTCHNL_PROTO_HDR_GTPU_UP_QFI =
 		PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP),
+	/* L2TPv2 */
+	VIRTCHNL_PROTO_HDR_L2TPV2_SESS_ID =
+		PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_L2TPV2),
+	VIRTCHNL_PROTO_HDR_L2TPV2_LEN_SESS_ID,
 };
 
 struct virtchnl_proto_hdr {
Signature · 1 line
2.25.1
author
#7 lore raw

PATCH 5/6 net/iavf: support L2TPv2 for AVF HASH

In reply to Jie Wang

Add support for PPP over L2TPv2 over UDP protocol and L2TPv2 protocol RSS hash based on outer MAC src address and L2TPv2 session ID.

Patterns are listed below:
eth/ipv4/udp/l2tpv2
eth/ipv4/udp/l2tpv2/ppp
eth/ipv6/udp/l2tpv2
eth/ipv6/udp/l2tpv2/ppp

---
 doc/guides/rel_notes/release_22_03.rst |  5 ++
 drivers/net/iavf/iavf.h                |  2 +
 drivers/net/iavf/iavf_generic_flow.c   | 34 +++++++++++
 drivers/net/iavf/iavf_generic_flow.h   |  6 ++
 drivers/net/iavf/iavf_hash.c           | 83 ++++++++++++++++++++++++--
 5 files changed, 126 insertions(+), 4 deletions(-)
doc/guides/rel_notes/release_22_03.rst +5 -0
index 30695f11b7..472005e74c 100644
@@ -60,6 +60,11 @@ New Features
   Added macros RTE_ETH_RSS_L2TPV2, now L2TPv2 field can be used as
   input set for RSS.
 
+* **Updated Intel iavf driver.**
+
+  Added L2TPv2(include PPP over L2tpv2) RSS hash distribute packets
+  based on outer MAC src address and L2TPv2 session ID.
+
 
 Removed Items
 -------------
drivers/net/iavf/iavf.h +2 -0
index 0bb5698583..a01d18e61b 100644
@@ -93,6 +93,8 @@
 
 #define IAVF_VLAN_TAG_PCP_OFFSET 13
 
+#define IAVF_L2TPV2_FLAGS_LEN	0x4000
+
 struct iavf_adapter;
 struct iavf_rx_queue;
 struct iavf_tx_queue;
drivers/net/iavf/iavf_generic_flow.c +34 -0
index 2befa125ac..7f411a764c 100644
@@ -1611,6 +1611,40 @@ enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_udp[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_L2TPV2,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2_ppp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_L2TPV2,
+	RTE_FLOW_ITEM_TYPE_PPP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_L2TPV2,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2_ppp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_L2TPV2,
+	RTE_FLOW_ITEM_TYPE_PPP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 /* PPPoL2TPv2oUDP */
 enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
drivers/net/iavf/iavf_generic_flow.h +6 -0
index 3681a96b31..107bbc1a23 100644
@@ -410,6 +410,12 @@ extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_tcp[];
 extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4_udp[];
 extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_udp[];
 
+/* L2TPv2 */
+extern enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2[];
+extern enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2_ppp[];
+extern enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2[];
+extern enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2_ppp[];
+
 /* PPPoL2TPv2oUDP */
 extern enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4[];
 extern enum rte_flow_item_type iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6[];
drivers/net/iavf/iavf_hash.c +79 -4

152 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#8 lore raw

PATCH 6/6 net/iavf: support L2TPv2 for AVF FDIR

In reply to Jie Wang

Add support for L2TPv2(include PPP over L2TPv2) protocols FDIR based on outer MAC src address and L2TPv2 session ID.

Add support for PPPoL2TPv2oUDP protocols FDIR based on inner IP src/dst address and UDP/TCP src/dst port.

Patterns are listed below:
eth/ipv4(6)/udp/l2tpv2
eth/ipv4(6)/udp/l2tpv2/ppp

eth/ipv4(6)/udp/l2tpv2/ppp/ipv4(6)
eth/ipv4(6)/udp/l2tpv2/ppp/ipv4(6)/udp
eth/ipv4(6)/udp/l2tpv2/ppp/ipv4(6)/tcp

---
 doc/guides/rel_notes/release_22_03.rst |   6 +-
 drivers/net/iavf/iavf_fdir.c           | 174 +++++++++++++++++++++----
 drivers/net/iavf/iavf_generic_flow.h   |   4 +
 3 files changed, 155 insertions(+), 29 deletions(-)
doc/guides/rel_notes/release_22_03.rst +5 -1
index 472005e74c..a01334c303 100644
@@ -62,8 +62,12 @@ New Features
 
 * **Updated Intel iavf driver.**
 
-  Added L2TPv2(include PPP over L2tpv2) RSS hash distribute packets
+  * Added L2TPv2(include PPP over L2tpv2) RSS hash distribute packets
   based on outer MAC src address and L2TPv2 session ID.
+  * Added L2TPv2(include PPP over L2tpv2) FDIR distribute packets
+  based on outer MAC src address and L2TPv2 session ID.
+  * Added PPPoL2TPv2oUDP FDIR distribute packets based on inner IP
+  src/dst address and UDP/TCP src/dst port.
 
 
 Removed Items
drivers/net/iavf/iavf_fdir.c +146 -28

214 lines not on this page · raw message

drivers/net/iavf/iavf_generic_flow.h +4 -0
index 107bbc1a23..f6af176073 100644
@@ -35,6 +35,7 @@
 #define IAVF_PROT_L2TPV3OIP	    (1ULL << 24)
 #define IAVF_PROT_PFCP		    (1ULL << 25)
 #define IAVF_PROT_ECPRI		    (1ULL << 26)
+#define IAVF_PROT_L2TPV2	    (1ULL << 27)
 
 
 /* field */
@@ -62,6 +63,7 @@
 #define IAVF_PFCP_SEID		    (1ULL << 43)
 #define IAVF_ECPRI_PC_RTC_ID	    (1ULL << 42)
 #define IAVF_IP_PKID		    (1ULL << 41)
+#define IAVF_L2TPV2_SESSION_ID	    (1ULL << 40)
 
 /* input set */
 
@@ -175,6 +177,8 @@
 	(IAVF_PROT_PFCP | IAVF_PFCP_S_FIELD | IAVF_PFCP_SEID)
 #define IAVF_INSET_ECPRI \
 	(IAVF_PROT_ECPRI | IAVF_ECPRI_PC_RTC_ID)
+#define IAVF_INSET_L2TPV2 \
+	(IAVF_PROT_L2TPV2 | IAVF_L2TPV2_SESSION_ID)
 
 /* empty pattern */
 extern enum rte_flow_item_type iavf_pattern_empty[];
Signature · 1 line
2.25.1