* [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR
@ 2022-01-26 6:30 Jie Wang
2022-01-26 6:30 ` [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
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.
---
v2:
* upadte release notes.
* add comment for RTE_ETH_RSS_L2TPV2.
* update ipv6 l2tpv2 flow item.
* rebase the main branch code.
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 | 15 ++
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 | 7 +
lib/net/rte_l2tpv2.h | 33 ++-
12 files changed, 590 insertions(+), 98 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
2022-01-28 16:11 ` Ferruh Yigit
2022-01-26 6:30 ` [PATCH v2 2/6] net: fix L2TPv2 common header Jie Wang
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
This patch defines new RSS offload type for L2TPv2, which
is required when users want to distribute packets based on
the L2TPv2 session ID field.
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
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 | 7 +++++++
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e626b1c7d9..d535311f21 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1722d6c8f8..ec922bd304 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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 },
};
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 33be3241b9..9a507ab9ea 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -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 macro RTE_ETH_RSS_L2TPV2, now L2TPv2 session ID field can be used as
+ input set for RSS.
+
* **Updated Cisco enic driver.**
* Added rte_flow support for matching GENEVE packets.
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 147cc1ced3..1e493a1e33 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -651,6 +651,13 @@ struct rte_eth_rss_conf {
#define RTE_ETH_RSS_L4_CHKSUM RTE_BIT64(35)
#define ETH_RSS_L4_CHKSUM RTE_DEPRECATED(ETH_RSS_L4_CHKSUM) RTE_ETH_RSS_L4_CHKSUM
+/*
+ * Below macro is defined for RSS offload type, it can be used to
+ * fill rte_eth_rss_conf.rss_hf or rte_flow_action_rss.types.
+ */
+#define RTE_ETH_RSS_L2TPV2 RTE_BIT64(36)
+#define ETH_RSS_L2TPV2 RTE_DEPRECATED(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
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/6] net: fix L2TPv2 common header
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
2022-01-26 6:30 ` [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
2022-01-28 16:11 ` Ferruh Yigit
2022-01-26 6:30 ` [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, 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")
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
lib/net/rte_l2tpv2.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 938a993b48..1f3ad3f03c 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -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
};
};
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
2022-01-26 6:30 ` [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
2022-01-26 6:30 ` [PATCH v2 2/6] net: fix L2TPv2 common header Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
2022-01-28 16:12 ` Ferruh Yigit
2022-01-26 6:30 ` [PATCH v2 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, 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
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
app/test-pmd/cmdline_flow.c | 313 ++++++++++++++++++++++++++++++------
lib/net/rte_l2tpv2.h | 13 ++
2 files changed, 275 insertions(+), 51 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index bbaf18d76e..4e2ed3d6a3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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;
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 1f3ad3f03c..d41123a504 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -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
*/
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 4/6] common/iavf: add session ID fields for L2TPv2
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
` (2 preceding siblings ...)
2022-01-26 6:30 ` [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
2022-01-26 6:30 ` [PATCH v2 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
2022-01-26 6:30 ` [PATCH v2 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
5 siblings, 0 replies; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
Add virtchnl fields session ID of L2TPv2 for AVF HASH.
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
drivers/common/iavf/virtchnl.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h
index 80e754a1b2..3e44eca7d8 100644
--- a/drivers/common/iavf/virtchnl.h
+++ b/drivers/common/iavf/virtchnl.h
@@ -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 {
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 5/6] net/iavf: support L2TPv2 for AVF HASH
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
` (3 preceding siblings ...)
2022-01-26 6:30 ` [PATCH v2 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
2022-01-26 6:30 ` [PATCH v2 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
5 siblings, 0 replies; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, 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
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
doc/guides/rel_notes/release_22_03.rst | 6 ++
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, 127 insertions(+), 4 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 9a507ab9ea..0d1e4a0b61 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -64,6 +64,12 @@ New Features
* Added rte_flow support for matching GENEVE packets.
+* **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
-------------
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 0bb5698583..a01d18e61b 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -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;
diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c
index 2befa125ac..1de4187e67 100644
--- a/drivers/net/iavf/iavf_generic_flow.c
+++ b/drivers/net/iavf/iavf_generic_flow.c
@@ -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_IPV6,
+ 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_IPV6,
+ 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,
diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h
index 3681a96b31..107bbc1a23 100644
--- a/drivers/net/iavf/iavf_generic_flow.h
+++ b/drivers/net/iavf/iavf_generic_flow.h
@@ -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[];
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 5e0888ea68..f568239b71 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -36,6 +36,7 @@
#define IAVF_PHINT_MID_IPV6 BIT_ULL(8)
/* L2TPv2 */
#define IAVF_PHINT_L2TPV2 BIT_ULL(9)
+#define IAVF_PHINT_L2TPV2_LEN BIT_ULL(10)
#define IAVF_PHINT_GTPU_MSK (IAVF_PHINT_GTPU | \
IAVF_PHINT_GTPU_EH | \
@@ -167,7 +168,9 @@ iavf_hash_parse_pattern_action(struct iavf_adapter *ad,
FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ECPRI_PC_RTC_ID), {BUFF_NOUSED} }
#define proto_hdr_l2tpv2 { \
- VIRTCHNL_PROTO_HDR_L2TPV2, 0, {BUFF_NOUSED} }
+ VIRTCHNL_PROTO_HDR_L2TPV2, \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_L2TPV2_SESS_ID) | \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_L2TPV2_LEN_SESS_ID), {BUFF_NOUSED} }
#define proto_hdr_ppp { \
VIRTCHNL_PROTO_HDR_PPP, 0, {BUFF_NOUSED} }
@@ -392,6 +395,40 @@ struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv6_tcp_tmplt = {
proto_hdr_tcp}
};
+struct virtchnl_proto_hdrs ipv4_l2tpv2_tmplt = {
+ TUNNEL_LEVEL_OUTER, 4,
+ {proto_hdr_eth,
+ proto_hdr_ipv4,
+ proto_hdr_udp,
+ proto_hdr_l2tpv2}
+};
+
+struct virtchnl_proto_hdrs ipv6_l2tpv2_tmplt = {
+ TUNNEL_LEVEL_OUTER, 4,
+ {proto_hdr_eth,
+ proto_hdr_ipv6,
+ proto_hdr_udp,
+ proto_hdr_l2tpv2}
+};
+
+struct virtchnl_proto_hdrs ipv4_l2tpv2_ppp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 5,
+ {proto_hdr_eth,
+ proto_hdr_ipv4,
+ proto_hdr_udp,
+ proto_hdr_l2tpv2,
+ proto_hdr_ppp}
+};
+
+struct virtchnl_proto_hdrs ipv6_l2tpv2_ppp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 5,
+ {proto_hdr_eth,
+ proto_hdr_ipv6,
+ proto_hdr_udp,
+ proto_hdr_l2tpv2,
+ proto_hdr_ppp}
+};
+
/* rss type super set */
/* IPv4 outer */
@@ -480,6 +517,11 @@ struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv6_tcp_tmplt = {
#define IAVF_RSS_TYPE_IPV4_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV4)
#define IAVF_RSS_TYPE_IPV6_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV6)
+/* L2TPv2 */
+#define IAVF_RSS_TYPE_ETH_L2TPV2 (RTE_ETH_RSS_L2TPV2 | \
+ RTE_ETH_RSS_ETH | \
+ RTE_ETH_RSS_L2_SRC_ONLY)
+
/**
* Supported pattern for hash.
* The first member is pattern item type,
@@ -547,6 +589,8 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
{iavf_pattern_eth_ipv6_gre_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &inner_ipv4_tcp_tmplt},
{iavf_pattern_eth_ipv4_gre_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &inner_ipv4_udp_tmplt},
{iavf_pattern_eth_ipv6_gre_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv4_l2tpv2_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv4_l2tpv2_ppp_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4, IAVF_RSS_TYPE_INNER_IPV4, &udp_l2tpv2_ppp_ipv4_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &udp_l2tpv2_ppp_ipv4_udp_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &udp_l2tpv2_ppp_ipv4_tcp_tmplt},
@@ -614,6 +658,8 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
{iavf_pattern_eth_ipv6_gre_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &inner_ipv6_tcp_tmplt},
{iavf_pattern_eth_ipv4_gre_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &inner_ipv6_udp_tmplt},
{iavf_pattern_eth_ipv6_gre_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv6_l2tpv2_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv6_l2tpv2_ppp_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6, IAVF_RSS_TYPE_INNER_IPV6, &udp_l2tpv2_ppp_ipv6_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &udp_l2tpv2_ppp_ipv6_udp_tmplt},
{iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &udp_l2tpv2_ppp_ipv6_tcp_tmplt},
@@ -744,6 +790,8 @@ iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
const struct rte_flow_item_gtp_psc *psc;
const struct rte_flow_item_ecpri *ecpri;
struct rte_ecpri_common_hdr ecpri_common;
+ const struct rte_flow_item_l2tpv2 *l2tpv2;
+ uint16_t flags_version;
for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
if (item->last) {
@@ -802,7 +850,18 @@ iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
*phint |= IAVF_PHINT_GRE;
break;
case RTE_FLOW_ITEM_TYPE_L2TPV2:
- *phint |= IAVF_PHINT_L2TPV2;
+ l2tpv2 = item->spec;
+
+ if (l2tpv2) {
+ flags_version = rte_be_to_cpu_16(
+ l2tpv2->hdr.common.flags_version);
+ if (flags_version & IAVF_L2TPV2_FLAGS_LEN)
+ *phint |= IAVF_PHINT_L2TPV2_LEN;
+ else
+ *phint |= IAVF_PHINT_L2TPV2;
+ } else {
+ *phint |= IAVF_PHINT_L2TPV2;
+ }
break;
default:
break;
@@ -1024,6 +1083,10 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
if (!(rss_type & RTE_ETH_RSS_ECPRI))
hdr->field_selector = 0;
break;
+ case VIRTCHNL_PROTO_HDR_L2TPV2:
+ if (!(rss_type & RTE_ETH_RSS_L2TPV2))
+ hdr->field_selector = 0;
+ break;
default:
break;
}
@@ -1130,10 +1193,10 @@ static void
iavf_refine_proto_hdrs_l2tpv2(struct virtchnl_proto_hdrs *proto_hdrs,
uint64_t phint)
{
- struct virtchnl_proto_hdr *hdr1;
+ struct virtchnl_proto_hdr *hdr, *hdr1;
int i;
- if (!(phint & IAVF_PHINT_L2TPV2))
+ if (!(phint & IAVF_PHINT_L2TPV2) && !(phint & IAVF_PHINT_L2TPV2_LEN))
return;
if (proto_hdrs->tunnel_level == TUNNEL_LEVEL_INNER) {
@@ -1150,7 +1213,19 @@ iavf_refine_proto_hdrs_l2tpv2(struct virtchnl_proto_hdrs *proto_hdrs,
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV4);
else if (phint & IAVF_PHINT_OUTER_IPV6)
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV6);
+ } else {
+ for (i = 0; i < proto_hdrs->count; i++) {
+ hdr = &proto_hdrs->proto_hdr[i];
+ if (hdr->type == VIRTCHNL_PROTO_HDR_L2TPV2) {
+ if (phint & IAVF_PHINT_L2TPV2) {
+ REFINE_PROTO_FLD(DEL, L2TPV2_LEN_SESS_ID);
+ } else if (phint & IAVF_PHINT_L2TPV2_LEN) {
+ REFINE_PROTO_FLD(DEL, L2TPV2_SESS_ID);
+ }
+ }
+ }
}
+
}
static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 6/6] net/iavf: support L2TPv2 for AVF FDIR
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
` (4 preceding siblings ...)
2022-01-26 6:30 ` [PATCH v2 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
@ 2022-01-26 6:30 ` Jie Wang
5 siblings, 0 replies; 12+ messages in thread
From: Jie Wang @ 2022-01-26 6:30 UTC (permalink / raw)
To: dev
Cc: stevex.yang, orika, aman.deep.singh, ferruh.yigit, thomas,
andrew.rybchenko, jingjing.wu, beilei.xing, qi.z.zhang, 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
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
doc/guides/rel_notes/release_22_03.rst | 8 +-
drivers/net/iavf/iavf_fdir.c | 174 +++++++++++++++++++++----
drivers/net/iavf/iavf_generic_flow.h | 4 +
3 files changed, 156 insertions(+), 30 deletions(-)
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 0d1e4a0b61..5a73ccc14e 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -66,8 +66,12 @@ New Features
* **Updated Intel iavf driver.**
- 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) 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
diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index b63aaca91d..2583b899aa 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -168,6 +168,31 @@
IAVF_FDIR_INSET_GRE_IPV6 | IAVF_INSET_TUN_UDP_SRC_PORT | \
IAVF_INSET_TUN_UDP_DST_PORT)
+#define IAVF_FDIR_INSET_L2TPV2 (\
+ IAVF_INSET_SMAC | IAVF_INSET_L2TPV2)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV4 (\
+ IAVF_INSET_TUN_IPV4_SRC | IAVF_INSET_TUN_IPV4_DST)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_UDP (\
+ IAVF_FDIR_INSET_L2TPV2_PPP_IPV4 | IAVF_INSET_TUN_UDP_SRC_PORT | \
+ IAVF_INSET_TUN_UDP_DST_PORT)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_TCP (\
+ IAVF_FDIR_INSET_L2TPV2_PPP_IPV4 | IAVF_INSET_TUN_TCP_SRC_PORT | \
+ IAVF_INSET_TUN_TCP_DST_PORT)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV6 (\
+ IAVF_INSET_TUN_IPV6_SRC | IAVF_INSET_TUN_IPV6_DST)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_UDP (\
+ IAVF_FDIR_INSET_L2TPV2_PPP_IPV6 | IAVF_INSET_TUN_UDP_SRC_PORT | \
+ IAVF_INSET_TUN_UDP_DST_PORT)
+
+#define IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_TCP (\
+ IAVF_FDIR_INSET_L2TPV2_PPP_IPV6 | IAVF_INSET_TUN_TCP_SRC_PORT | \
+ IAVF_INSET_TUN_TCP_DST_PORT)
+
static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
{iavf_pattern_ethertype, IAVF_FDIR_INSET_ETH, IAVF_INSET_NONE},
{iavf_pattern_eth_ipv4, IAVF_FDIR_INSET_ETH_IPV4, IAVF_INSET_NONE},
@@ -275,6 +300,28 @@ static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
{iavf_pattern_eth_ipv6_gre_ipv6, IAVF_FDIR_INSET_GRE_IPV6, IAVF_INSET_NONE},
{iavf_pattern_eth_ipv6_gre_ipv6_tcp, IAVF_FDIR_INSET_GRE_IPV6_TCP, IAVF_INSET_NONE},
{iavf_pattern_eth_ipv6_gre_ipv6_udp, IAVF_FDIR_INSET_GRE_IPV6_UDP, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv4_udp_l2tpv2, IAVF_FDIR_INSET_L2TPV2, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp, IAVF_FDIR_INSET_L2TPV2, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv6_udp_l2tpv2, IAVF_FDIR_INSET_L2TPV2, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp, IAVF_FDIR_INSET_L2TPV2, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_udp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_UDP, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_tcp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_TCP, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_udp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_UDP, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_tcp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV4_TCP, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_udp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_UDP, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_tcp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_TCP, IAVF_INSET_NONE},
+
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_udp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_UDP, IAVF_INSET_NONE},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp, IAVF_FDIR_INSET_L2TPV2_PPP_IPV6_TCP, IAVF_INSET_NONE},
};
static struct iavf_flow_parser iavf_fdir_parser;
@@ -694,6 +741,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
const struct rte_flow_item_ecpri *ecpri_spec, *ecpri_mask;
const struct rte_flow_item_gre *gre_spec, *gre_mask;
+ const struct rte_flow_item_l2tpv2 *l2tpv2_spec, *l2tpv2_mask;
+ const struct rte_flow_item_ppp *ppp_spec, *ppp_mask;
const struct rte_flow_item *item = pattern;
struct virtchnl_proto_hdr *hdr, *hdr1 = NULL;
struct rte_ecpri_common_hdr ecpri_common;
@@ -701,7 +750,7 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
enum rte_flow_item_type item_type;
enum rte_flow_item_type next_type;
uint8_t tun_inner = 0;
- uint16_t ether_type;
+ uint16_t ether_type, flags_version;
int layer = 0;
uint8_t ipv6_addr_mask[16] = {
@@ -739,37 +788,41 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
}
if (eth_spec && eth_mask) {
- if (!rte_is_zero_ether_addr(ð_mask->src) ||
- !rte_is_zero_ether_addr(ð_mask->dst)) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM, item,
- "Invalid MAC_addr mask.");
- return -rte_errno;
- }
- }
-
- if (eth_spec && eth_mask && eth_mask->type) {
- if (eth_mask->type != RTE_BE16(0xffff)) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM,
- item, "Invalid type mask.");
- return -rte_errno;
+ if (!rte_is_zero_ether_addr(ð_mask->dst)) {
+ input_set |= IAVF_INSET_DMAC;
+ VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr1,
+ ETH,
+ DST);
+ } else if (!rte_is_zero_ether_addr(ð_mask->src)) {
+ input_set |= IAVF_INSET_SMAC;
+ VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr1,
+ ETH,
+ SRC);
}
- ether_type = rte_be_to_cpu_16(eth_spec->type);
- if (ether_type == RTE_ETHER_TYPE_IPV4 ||
- ether_type == RTE_ETHER_TYPE_IPV6) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM,
- item,
- "Unsupported ether_type.");
- return -rte_errno;
+ if (eth_mask->type) {
+ if (eth_mask->type != RTE_BE16(0xffff)) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item, "Invalid type mask.");
+ return -rte_errno;
+ }
+
+ ether_type = rte_be_to_cpu_16(eth_spec->type);
+ if (ether_type == RTE_ETHER_TYPE_IPV4 ||
+ ether_type == RTE_ETHER_TYPE_IPV6) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Unsupported ether_type.");
+ return -rte_errno;
+ }
+
+ input_set |= IAVF_INSET_ETHERTYPE;
+ VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr1, ETH,
+ ETHERTYPE);
}
- input_set |= IAVF_INSET_ETHERTYPE;
- VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr1, ETH,
- ETHERTYPE);
-
rte_memcpy(hdr1->buffer, eth_spec,
sizeof(struct rte_ether_hdr));
}
@@ -1319,6 +1372,71 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
hdrs->count = ++layer;
break;
+ case RTE_FLOW_ITEM_TYPE_L2TPV2:
+ l2tpv2_spec = item->spec;
+ l2tpv2_mask = item->mask;
+
+ hdr = &hdrs->proto_hdr[layer];
+
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, L2TPV2);
+
+ if (l2tpv2_spec && l2tpv2_mask) {
+ flags_version =
+ rte_be_to_cpu_16(l2tpv2_spec->hdr.common.flags_version);
+ if ((flags_version == RTE_L2TPV2_MSG_TYPE_CONTROL &&
+ l2tpv2_mask->hdr.type3.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA &&
+ l2tpv2_mask->hdr.type7.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L &&
+ l2tpv2_mask->hdr.type6.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_S &&
+ l2tpv2_mask->hdr.type5.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_O &&
+ l2tpv2_mask->hdr.type4.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_S &&
+ l2tpv2_mask->hdr.type3.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_O &&
+ l2tpv2_mask->hdr.type2.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_S_O &&
+ l2tpv2_mask->hdr.type1.session_id == UINT16_MAX) ||
+ (flags_version == RTE_L2TPV2_MSG_TYPE_DATA_L_S_O &&
+ l2tpv2_mask->hdr.type0.session_id == UINT16_MAX)) {
+ input_set |= IAVF_L2TPV2_SESSION_ID;
+ if (flags_version & IAVF_L2TPV2_FLAGS_LEN)
+ VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr,
+ L2TPV2,
+ LEN_SESS_ID);
+ else
+ VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr,
+ L2TPV2,
+ SESS_ID);
+ }
+
+ rte_memcpy(hdr->buffer, l2tpv2_spec,
+ sizeof(*l2tpv2_spec));
+ }
+
+ tun_inner = 1;
+
+ hdrs->count = ++layer;
+ break;
+
+ case RTE_FLOW_ITEM_TYPE_PPP:
+ ppp_spec = item->spec;
+ ppp_mask = item->mask;
+
+ hdr = &hdrs->proto_hdr[layer];
+
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, PPP);
+
+ if (ppp_spec && ppp_mask) {
+ rte_memcpy(hdr->buffer, ppp_spec,
+ sizeof(*ppp_spec));
+ }
+
+ hdrs->count = ++layer;
+ break;
+
case RTE_FLOW_ITEM_TYPE_VOID:
break;
diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h
index 107bbc1a23..f6af176073 100644
--- a/drivers/net/iavf/iavf_generic_flow.h
+++ b/drivers/net/iavf/iavf_generic_flow.h
@@ -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[];
--
2.25.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type
2022-01-26 6:30 ` [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
@ 2022-01-28 16:11 ` Ferruh Yigit
2022-01-29 6:04 ` Wang, Jie1X
0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2022-01-28 16:11 UTC (permalink / raw)
To: 20220124065613.2197436-1-jie1x.wang, dev
Cc: stevex.yang, orika, aman.deep.singh, thomas, andrew.rybchenko,
jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
On 1/26/2022 6:30 AM, Jie Wang wrote:
> This patch defines new RSS offload type for L2TPv2, which
> is required when users want to distribute packets based on
> the L2TPv2 session ID field.
>
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>
<...>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 147cc1ced3..1e493a1e33 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -651,6 +651,13 @@ struct rte_eth_rss_conf {
> #define RTE_ETH_RSS_L4_CHKSUM RTE_BIT64(35)
> #define ETH_RSS_L4_CHKSUM RTE_DEPRECATED(ETH_RSS_L4_CHKSUM) RTE_ETH_RSS_L4_CHKSUM
>
> +/*
> + * Below macro is defined for RSS offload type, it can be used to
> + * fill rte_eth_rss_conf.rss_hf or rte_flow_action_rss.types.
> + */
> +#define RTE_ETH_RSS_L2TPV2 RTE_BIT64(36)
> +#define ETH_RSS_L2TPV2 RTE_DEPRECATED(ETH_RSS_L2TPV2) RTE_ETH_RSS_L2TPV2
The RTE_DEPRECATED is for old and deprecated macros, please don't use it for new
macros.
> +
> /*
> * We use the following macros to combine with above RTE_ETH_RSS_* for
> * more specific input set selection. These bits are defined starting
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/6] net: fix L2TPv2 common header
2022-01-26 6:30 ` [PATCH v2 2/6] net: fix L2TPv2 common header Jie Wang
@ 2022-01-28 16:11 ` Ferruh Yigit
2022-01-29 6:09 ` Wang, Jie1X
0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2022-01-28 16:11 UTC (permalink / raw)
To: 20220124065613.2197436-1-jie1x.wang, dev, Olivier Matz
Cc: stevex.yang, orika, aman.deep.singh, thomas, andrew.rybchenko,
jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
On 1/26/2022 6:30 AM, Jie Wang wrote:
> 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.
>
Just for reference, checked from RFC:
https://datatracker.ietf.org/doc/html/rfc2661#section-3.1
Change looks good to me. Cc'ed Olivier.
> Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
>
Is it candidate for Cc: stable@dpdk.org backport?
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>
<...>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message
2022-01-26 6:30 ` [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
@ 2022-01-28 16:12 ` Ferruh Yigit
0 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2022-01-28 16:12 UTC (permalink / raw)
To: 20220124065613.2197436-1-jie1x.wang, dev, orika
Cc: stevex.yang, aman.deep.singh, thomas, andrew.rybchenko,
jingjing.wu, beilei.xing, qi.z.zhang, Jie Wang
On 1/26/2022 6:30 AM, Jie Wang wrote:
> 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
>
> Signed-off-by: Jie Wang<jie1x.wang@intel.com>
Ori, can you please check this patch?
Thanks,
ferruh
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type
2022-01-28 16:11 ` Ferruh Yigit
@ 2022-01-29 6:04 ` Wang, Jie1X
0 siblings, 0 replies; 12+ messages in thread
From: Wang, Jie1X @ 2022-01-29 6:04 UTC (permalink / raw)
To: Yigit, Ferruh, 20220124065613.2197436-1-jie1x.wang, dev
Cc: Yang, SteveX, orika, Singh, Aman Deep, thomas, andrew.rybchenko,
Wu, Jingjing, Xing, Beilei, Zhang, Qi Z
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Saturday, January 29, 2022 12:12 AM
> To: 20220124065613.2197436-1-jie1x.wang@intel.com; dev@dpdk.org
> Cc: Yang, SteveX <stevex.yang@intel.com>; orika@nvidia.com; Singh, Aman
> Deep <aman.deep.singh@intel.com>; thomas@monjalon.net;
> andrew.rybchenko@oktetlabs.ru; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang,
> Jie1X <jie1x.wang@intel.com>
> Subject: Re: [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type
>
> On 1/26/2022 6:30 AM, Jie Wang wrote:
> > This patch defines new RSS offload type for L2TPv2, which is required
> > when users want to distribute packets based on the L2TPv2 session ID
> > field.
> >
> > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
>
> <...>
>
> > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index
> > 147cc1ced3..1e493a1e33 100644
> > --- a/lib/ethdev/rte_ethdev.h
> > +++ b/lib/ethdev/rte_ethdev.h
> > @@ -651,6 +651,13 @@ struct rte_eth_rss_conf {
> > #define RTE_ETH_RSS_L4_CHKSUM RTE_BIT64(35)
> > #define ETH_RSS_L4_CHKSUM RTE_DEPRECATED(ETH_RSS_L4_CHKSUM)
> > RTE_ETH_RSS_L4_CHKSUM
> >
> > +/*
> > + * Below macro is defined for RSS offload type, it can be used to
> > + * fill rte_eth_rss_conf.rss_hf or rte_flow_action_rss.types.
> > + */
> > +#define RTE_ETH_RSS_L2TPV2 RTE_BIT64(36)
> > +#define ETH_RSS_L2TPV2 RTE_DEPRECATED(ETH_RSS_L2TPV2)
> > +RTE_ETH_RSS_L2TPV2
>
> The RTE_DEPRECATED is for old and deprecated macros, please don't use it for
> new macros.
>
OK, I'll update it in v3.
> > +
> > /*
> > * We use the following macros to combine with above RTE_ETH_RSS_* for
> > * more specific input set selection. These bits are defined
> > starting
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 2/6] net: fix L2TPv2 common header
2022-01-28 16:11 ` Ferruh Yigit
@ 2022-01-29 6:09 ` Wang, Jie1X
0 siblings, 0 replies; 12+ messages in thread
From: Wang, Jie1X @ 2022-01-29 6:09 UTC (permalink / raw)
To: Yigit, Ferruh, dev, Olivier Matz
Cc: Yang, SteveX, orika, Singh, Aman Deep, thomas, andrew.rybchenko,
Wu, Jingjing, Xing, Beilei, Zhang, Qi Z
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Saturday, January 29, 2022 12:12 AM
> To: 20220124065613.2197436-1-jie1x.wang@intel.com; dev@dpdk.org; Olivier
> Matz <olivier.matz@6wind.com>
> Cc: Yang, SteveX <stevex.yang@intel.com>; orika@nvidia.com; Singh, Aman
> Deep <aman.deep.singh@intel.com>; thomas@monjalon.net;
> andrew.rybchenko@oktetlabs.ru; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang,
> Jie1X <jie1x.wang@intel.com>
> Subject: Re: [PATCH v2 2/6] net: fix L2TPv2 common header
>
> On 1/26/2022 6:30 AM, Jie Wang wrote:
> > 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.
> >
>
> Just for reference, checked from RFC:
> https://datatracker.ietf.org/doc/html/rfc2661#section-3.1
>
> Change looks good to me. Cc'ed Olivier.
>
Thanks, I'll cc Olivier in v3.
> > Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
> >
>
> Is it candidate for Cc: stable@dpdk.org backport?
>
Yes, thanks for your reminder.
> > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
>
> <...>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-01-29 6:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 6:30 [PATCH v2 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
2022-01-26 6:30 ` [PATCH v2 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
2022-01-28 16:11 ` Ferruh Yigit
2022-01-29 6:04 ` Wang, Jie1X
2022-01-26 6:30 ` [PATCH v2 2/6] net: fix L2TPv2 common header Jie Wang
2022-01-28 16:11 ` Ferruh Yigit
2022-01-29 6:09 ` Wang, Jie1X
2022-01-26 6:30 ` [PATCH v2 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
2022-01-28 16:12 ` Ferruh Yigit
2022-01-26 6:30 ` [PATCH v2 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
2022-01-26 6:30 ` [PATCH v2 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
2022-01-26 6:30 ` [PATCH v2 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
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).