[v4,1/6] ethdev: add L2TPv2 RSS offload type
Checks
Commit Message
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 | 6 ++++++
4 files changed, 19 insertions(+), 5 deletions(-)
Comments
On 2/8/2022 8:38 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>
> ---
> 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 | 6 ++++++
> 4 files changed, 19 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..b7e78618c8 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -651,6 +651,12 @@ 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.
> + */
Why this comment is duplicated here? (There is exact same above, and it is wrong to
have it here.)
If this is the only comment, I can remove it while merging.
> +#define RTE_ETH_RSS_L2TPV2 RTE_BIT64(36)
> +
> /*
> * We use the following macros to combine with above RTE_ETH_RSS_* for
> * more specific input set selection. These bits are defined starting
On 2/8/2022 1:13 PM, Ferruh Yigit wrote:
> On 2/8/2022 8:38 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>
>> ---
>> 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 | 6 ++++++
>> 4 files changed, 19 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;
I think better to keep 'default' as last check, can you please add new one
above the 'default' check?
>> 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>",
Can you please update
- cmd_help_long_parsed() in same file
- documentation, doc/guides/testpmd_app_ug/testpmd_funcs.rst
>> .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 "
Same for this command
>> "<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..b7e78618c8 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -651,6 +651,12 @@ 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.
>> + */
>
> Why this comment is duplicated here? (There is exact same above, and it is wrong to
> have it here.)
>
Please remove above comment too
> If this is the only comment, I can remove it while merging.
>
>> +#define RTE_ETH_RSS_L2TPV2 RTE_BIT64(36)
>> +
>> /*
>> * We use the following macros to combine with above RTE_ETH_RSS_* for
>> * more specific input set selection. These bits are defined starting
>
@@ -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,
@@ -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 },
};
@@ -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.
@@ -651,6 +651,12 @@ 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)
+
/*
* We use the following macros to combine with above RTE_ETH_RSS_* for
* more specific input set selection. These bits are defined starting