From: Ori Kam <orika@nvidia.com>
To: "Sean Zhang (Networking SW)" <xiazhang@nvidia.com>,
"NBU-Contact-Thomas Monjalon (EXTERNAL)" <thomas@monjalon.net>,
"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
Xiaoyun Li <xiaoyun.li@intel.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [v2 3/4] app/testpmd: add gre_option item command
Date: Fri, 11 Feb 2022 10:10:03 +0000 [thread overview]
Message-ID: <MW2PR12MB4666CB51ABAA8B3A73F4683DD6309@MW2PR12MB4666.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220211014530.77711-4-xiazhang@nvidia.com>
Hi Sean,
> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Subject: [v2 3/4] app/testpmd: add gre_option item command
>
> Add gre_option command for matching optional fields(checksum/key/sequence)
> in GRE header. The item must follow gre item, and the item does not
> change the flags in gre item, the application should set the flags in
> gre item correspondingly.
> Application can still use gre_key item 'gre_key value is xx' for key
> matching, the effect is the same with using 'gre_option key is xx'.
>
> The examples for gre_option are as follows:
>
> To match on checksum field with value 0x11:
> testpmd> ... pattern / eth / gre c_bit is 1 / gre_option checksum is
> 0x11 / end ..
>
> To match on checksum field with value 0x11 and any value of key:
> testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 1 / gre_option
> checksum is 0x11 / end ..
>
> To match on checksum field with value 0x11 and no key field in packet:
> testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 0 / gre_option
> checksum is 0x11 / end ..
>
> The invalid patterns for gre_option are as follows:
>
> testpmd> ... pattern / eth / gre / gre_option checksum is 0x11 / end ..
> (c_bit in gre item not present)
> testpmd> ... pattern / eth / gre c_bit is 0 / gre_option checksum is 0x11 /
> end .. (c_bit is unset for gre item, but checksum is
> specified by gre_option item)
>
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
> app/test-pmd/cmdline_flow.c | 72 +++++++++++++++++++++++++++++
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++
> 2 files changed, 78 insertions(+)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 7b56b1b..b977480 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -272,6 +272,10 @@ enum index {
> ITEM_META_DATA,
> ITEM_GRE_KEY,
> ITEM_GRE_KEY_VALUE,
> + ITEM_GRE_OPTION,
> + ITEM_GRE_OPTION_CHECKSUM,
> + ITEM_GRE_OPTION_KEY,
> + ITEM_GRE_OPTION_SEQUENCE,
> ITEM_GTP_PSC,
> ITEM_GTP_PSC_QFI,
> ITEM_GTP_PSC_PDU_T,
> @@ -1043,6 +1047,7 @@ struct parse_action_priv {
> ITEM_ICMP6_ND_OPT_TLA_ETH,
> ITEM_META,
> ITEM_GRE_KEY,
> + ITEM_GRE_OPTION,
> ITEM_GTP_PSC,
> ITEM_PPPOES,
> ITEM_PPPOED,
> @@ -1234,6 +1239,14 @@ struct parse_action_priv {
> ZERO,
> };
>
> +static const enum index item_gre_option[] = {
> + ITEM_GRE_OPTION_CHECKSUM,
> + ITEM_GRE_OPTION_KEY,
> + ITEM_GRE_OPTION_SEQUENCE,
> + ITEM_NEXT,
> + ZERO,
> +};
> +
> static const enum index item_gtp[] = {
> ITEM_GTP_FLAGS,
> ITEM_GTP_MSG_TYPE,
> @@ -3494,6 +3507,38 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
> item_param),
> .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)),
> },
> + [ITEM_GRE_OPTION] = {
> + .name = "gre_option",
> + .help = "match GRE optional fields",
> + .priv = PRIV_ITEM(GRE_OPTION,
> + sizeof(struct rte_flow_item_gre_opt)),
> + .next = NEXT(item_gre_option),
> + .call = parse_vc,
> + },
> + [ITEM_GRE_OPTION_CHECKSUM] = {
> + .name = "checksum",
> + .help = "match GRE checksum",
> + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED),
> + item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt,
> + checksum_rsvd.checksum)),
> + },
> + [ITEM_GRE_OPTION_KEY] = {
> + .name = "key",
> + .help = "match GRE key",
> + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED),
> + item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt,
> + key.key)),
> + },
> + [ITEM_GRE_OPTION_SEQUENCE] = {
> + .name = "sequence",
> + .help = "match GRE sequence",
> + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED),
> + item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt,
> + sequence.sequence)),
> + },
> [ITEM_GTP_PSC] = {
> .name = "gtp_psc",
> .help = "match GTP extension header with type 0x85",
> @@ -9252,6 +9297,33 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
> ((const struct rte_flow_item_flex *)
> item->spec)->length : 0;
> break;
> + case RTE_FLOW_ITEM_TYPE_GRE_OPTION:
> + size = 0;
> + if (item->spec) {
> + const struct rte_flow_item_gre_opt
> + *opt = item->spec;
> + if (opt->checksum_rsvd.checksum) {
> + *total_size +=
> + sizeof(opt->checksum_rsvd);
> + rte_memcpy(data_tail - (*total_size),
> + &opt->checksum_rsvd,
> + sizeof(opt->checksum_rsvd));
> + }
> + if (opt->key.key) {
> + *total_size += sizeof(opt->key.key);
> + rte_memcpy(data_tail - (*total_size),
> + &opt->key.key,
> + sizeof(opt->key.key));
> + }
> + if (opt->sequence.sequence) {
> + *total_size += sizeof(opt->sequence.sequence);
> + rte_memcpy(data_tail - (*total_size),
> + &opt->sequence.sequence,
> + sizeof(opt->sequence.sequence));
> + }
> + }
> + proto = 0x2F;
> + break;
> default:
> fprintf(stderr, "Error - Not supported item\n");
> goto error;
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 0551121..09cd1f4 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3715,6 +3715,12 @@ This section lists supported pattern items and their attributes, if any.
>
> - ``value {unsigned}``: key value.
>
> +- ``gre_option``: match GRE optional fields(checksum/key/sequence).
> +
> + - ``checksum {unsigned}``: checksum value.
> + - ``key {unsigned}``: key value.
> + - ``sequence {unsigned}``: sequence number value.
> +
> - ``fuzzy``: fuzzy pattern match, expect faster than default.
>
> - ``thresh {unsigned}``: accuracy threshold.
> --
> 1.8.3.1
Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
next prev parent reply other threads:[~2022-02-11 10:10 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-30 3:08 [RFC 0/3] Add support for GRE optional fields matching Sean Zhang
2021-12-30 3:08 ` [RFC 1/3] ethdev: support GRE optional fields Sean Zhang
2022-01-09 12:30 ` Ori Kam
2022-01-11 3:44 ` Sean Zhang (Networking SW)
2022-01-11 7:24 ` Ori Kam
2022-01-11 8:31 ` Sean Zhang (Networking SW)
2022-01-19 9:53 ` Ferruh Yigit
2022-01-19 10:01 ` Thomas Monjalon
2022-01-19 10:56 ` Ori Kam
2022-01-25 9:49 ` Sean Zhang (Networking SW)
2022-01-25 11:37 ` Ferruh Yigit
2022-01-25 13:06 ` Ori Kam
2022-01-25 14:29 ` Ferruh Yigit
2022-01-25 16:03 ` Ori Kam
2022-01-26 8:44 ` [v1 0/4] Add support for GRE optional fields matching Sean Zhang
2022-01-26 8:44 ` [v1 1/4] lib: add optional fields in GRE header Sean Zhang
2022-02-01 12:47 ` Ori Kam
2022-01-26 8:44 ` [v1 2/4] ethdev: support GRE optional fields Sean Zhang
2022-02-01 12:57 ` Ori Kam
2022-02-04 15:15 ` Ferruh Yigit
2022-01-26 8:44 ` [v1 3/4] app/testpmd: add gre_option item command Sean Zhang
2022-02-01 12:57 ` Ori Kam
2022-01-26 8:44 ` [v1 4/4] net/mlx5: support matching optional fields of GRE Sean Zhang
2022-02-01 10:50 ` Ferruh Yigit
2022-02-01 11:13 ` [v1 0/4] Add support for GRE optional fields matching Ferruh Yigit
2022-02-11 1:45 ` [v2 " Sean Zhang
2022-02-11 1:45 ` [v2 1/4] lib: add optional fields in GRE header Sean Zhang
2022-02-11 9:38 ` Ferruh Yigit
2022-02-11 10:23 ` Sean Zhang (Networking SW)
2022-02-11 10:37 ` Ferruh Yigit
2022-02-11 10:12 ` Ori Kam
2022-02-11 1:45 ` [v2 2/4] ethdev: support GRE optional fields Sean Zhang
2022-02-11 10:10 ` Ori Kam
2022-02-11 1:45 ` [v2 3/4] app/testpmd: add gre_option item command Sean Zhang
2022-02-11 10:10 ` Ori Kam [this message]
2022-02-11 1:45 ` [v2 4/4] net/mlx5: support matching optional fields of GRE Sean Zhang
2022-02-17 6:27 ` [PATCH] " Sean Zhang
2022-02-17 8:33 ` Thomas Monjalon
2022-02-21 3:00 ` Sean Zhang (Networking SW)
2022-02-25 15:31 ` Thomas Monjalon
2022-02-26 0:57 ` Sean Zhang (Networking SW)
2022-02-24 13:18 ` Raslan Darawsheh
2022-02-25 1:18 ` Sean Zhang (Networking SW)
2022-02-25 1:14 ` [v4] " Sean Zhang
2022-02-25 15:32 ` Thomas Monjalon
2022-02-25 17:55 ` Ferruh Yigit
2022-02-25 18:32 ` Thomas Monjalon
2022-02-11 9:36 ` [v2 0/4] Add support for GRE optional fields matching Ferruh Yigit
2022-02-11 10:33 ` Sean Zhang (Networking SW)
2022-02-11 10:38 ` Ferruh Yigit
2022-02-11 16:14 ` Ferruh Yigit
2021-12-30 3:08 ` [RFC 2/3] app/testpmd: add gre_option item command Sean Zhang
2021-12-30 3:08 ` [RFC 3/3] net/mlx5: support matching on optional fields of GRE Sean Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW2PR12MB4666CB51ABAA8B3A73F4683DD6309@MW2PR12MB4666.namprd12.prod.outlook.com \
--to=orika@nvidia.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=thomas@monjalon.net \
--cc=xiaoyun.li@intel.com \
--cc=xiazhang@nvidia.com \
--cc=yuying.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).