DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: Suanming Mou <suanmingm@mellanox.com>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Matan Azrad <matan@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Subject: Re: [dpdk-dev] [RFC v3 1/2] ethdev: add IPv4/IPv6 DSCP rewrite action
Date: Mon, 16 Dec 2019 07:49:51 +0000	[thread overview]
Message-ID: <AM4PR05MB3425316374FB7A791094DBF6DB510@AM4PR05MB3425.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1576467723-68792-1-git-send-email-suanmingm@mellanox.com>



> -----Original Message-----
> From: Suanming Mou <suanmingm@mellanox.com>
> Sent: Monday, December 16, 2019 5:42 AM
> To: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Wenzhuo Lu
> <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Bernard
> Iremonger <bernard.iremonger@intel.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Ferruh Yigit <ferruh.yigit@intel.com>; Andrew Rybchenko
> <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; Shahaf Shuler <shahafs@mellanox.com>; Ori Kam
> <orika@mellanox.com>; Matan Azrad <matan@mellanox.com>; Slava
> Ovsiienko <viacheslavo@mellanox.com>
> Subject: [RFC v3 1/2] ethdev: add IPv4/IPv6 DSCP rewrite action
> 
> For some overlay network, such as VXLAN, the DSCP field in the new outer
> IP header after VXLAN decapsulation may need to be updated accordingly.
> 
> This commit introduce the DSCP modify action for IPv4 and IPv6.
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
> 
> v3:
>  * Add testpmd code.
>  * Add one more commit support action in mlx5 pmd code.
> 
> v2:
>  * Add space to IPv4/6 DSCP.
>  * Fix typo.
> 
> ---



Acked-by: Ori Kam <orika@mellanox.com>
Best,
Ori

>  app/test-pmd/cmdline_flow.c                 | 50
> +++++++++++++++++++++++++++++
>  doc/guides/prog_guide/rte_flow.rst          | 40 +++++++++++++++++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  8 +++++
>  lib/librte_ethdev/rte_flow.c                |  2 ++
>  lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++
>  5 files changed, 131 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 99dade7..af94dbe 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -326,6 +326,10 @@ enum index {
>  	ACTION_SET_META,
>  	ACTION_SET_META_DATA,
>  	ACTION_SET_META_MASK,
> +	ACTION_SET_IPV4_DSCP,
> +	ACTION_SET_IPV4_DSCP_VALUE,
> +	ACTION_SET_IPV6_DSCP,
> +	ACTION_SET_IPV6_DSCP_VALUE,
>  };
> 
>  /** Maximum size for pattern in struct rte_flow_item_raw. */
> @@ -1087,6 +1091,8 @@ struct parse_action_priv {
>  	ACTION_RAW_DECAP,
>  	ACTION_SET_TAG,
>  	ACTION_SET_META,
> +	ACTION_SET_IPV4_DSCP,
> +	ACTION_SET_IPV6_DSCP,
>  	ZERO,
>  };
> 
> @@ -1300,6 +1306,18 @@ struct parse_action_priv {
>  	ZERO,
>  };
> 
> +static const enum index action_set_ipv4_dscp[] = {
> +	ACTION_SET_IPV4_DSCP_VALUE,
> +	ACTION_NEXT,
> +	ZERO,
> +};
> +
> +static const enum index action_set_ipv6_dscp[] = {
> +	ACTION_SET_IPV6_DSCP_VALUE,
> +	ACTION_NEXT,
> +	ZERO,
> +};
> +
>  static int parse_set_raw_encap_decap(struct context *, const struct token
> *,
>  				     const char *, unsigned int,
>  				     void *, unsigned int);
> @@ -3493,6 +3511,38 @@ static int comp_set_raw_index(struct context *,
> const struct token *,
>  			     (struct rte_flow_action_set_meta, mask)),
>  		.call = parse_vc_conf,
>  	},
> +	[ACTION_SET_IPV4_DSCP] = {
> +		.name = "set_ipv4_dscp",
> +		.help = "set dscp value",
> +		.priv = PRIV_ACTION(SET_IPV4_DSCP,
> +			sizeof(struct rte_flow_action_set_dscp)),
> +		.next = NEXT(action_set_ipv4_dscp),
> +		.call = parse_vc,
> +	},
> +	[ACTION_SET_IPV4_DSCP_VALUE] = {
> +		.name = "dscp_value",
> +		.help = "new IPv4 DSCP value to set",
> +		.next = NEXT(action_set_ipv4_dscp,
> NEXT_ENTRY(UNSIGNED)),
> +		.args = ARGS(ARGS_ENTRY
> +			     (struct rte_flow_action_set_dscp, dscp)),
> +		.call = parse_vc_conf,
> +	},
> +	[ACTION_SET_IPV6_DSCP] = {
> +		.name = "set_ipv6_dscp",
> +		.help = "set DSCP value",
> +		.priv = PRIV_ACTION(SET_IPV6_DSCP,
> +			sizeof(struct rte_flow_action_set_dscp)),
> +		.next = NEXT(action_set_ipv6_dscp),
> +		.call = parse_vc,
> +	},
> +	[ACTION_SET_IPV6_DSCP_VALUE] = {
> +		.name = "dscp_value",
> +		.help = "new IPv6 DSCP value to set",
> +		.next = NEXT(action_set_ipv6_dscp,
> NEXT_ENTRY(UNSIGNED)),
> +		.args = ARGS(ARGS_ENTRY
> +			     (struct rte_flow_action_set_dscp, dscp)),
> +		.call = parse_vc_conf,
> +	},
>  };
> 
>  /** Remove and return last entry from argument stack. */
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index a254c81..2f21309 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -2558,6 +2558,46 @@ the other path depending on HW capability.
>     | ``mask`` | bit-mask applies to "data" |
>     +----------+----------------------------+
> 
> +Action: ``SET_IPV4_DSCP``
> +^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Set IPv4 DSCP.
> +
> +Modify DSCP in IPv4 header.
> +
> +It must be used with RTE_FLOW_ITEM_TYPE_IPV4 in pattern.
> +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
> +
> +.. _table_rte_flow_action_set_ipv4_dscp:
> +
> +.. table:: SET_IPV4_DSCP
> +
> +   +-----------+---------------------------------+
> +   | Field     | Value                           |
> +   +===========+=================================+
> +   | ``dscp``  | DSCP in low 6 bits, rest ignore |
> +   +-----------+---------------------------------+
> +
> +Action: ``SET_IPV6_DSCP``
> +^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Set IPv6 DSCP.
> +
> +Modify DSCP in IPv6 header.
> +
> +It must be used with RTE_FLOW_ITEM_TYPE_IPV6 in pattern.
> +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
> +
> +.. _table_rte_flow_action_set_ipv6_dscp:
> +
> +.. table:: SET_IPV6_DSCP
> +
> +   +-----------+---------------------------------+
> +   | Field     | Value                           |
> +   +===========+=================================+
> +   | ``dscp``  | DSCP in low 6 bits, rest ignore |
> +   +-----------+---------------------------------+
> +
>  Negative types
>  ~~~~~~~~~~~~~~
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 10aabf5..3baaacb 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -4228,6 +4228,14 @@ This section lists supported actions and their
> attributes, if any.
> 
>    - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
> 
> +- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
> +
> +  - ``dscp_value {unsigned}``: The new DSCP value to be set
> +
> +- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
> +
> +  - ``dscp_value {unsigned}``: The new DSCP value to be set
> +
>  Destroying flow rules
>  ~~~~~~~~~~~~~~~~~~~~~
> 
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 87a3e8c..b86aee3 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -168,6 +168,8 @@ struct rte_flow_desc_data {
>  	MK_FLOW_ACTION(DEC_TCP_ACK, sizeof(rte_be32_t)),
>  	MK_FLOW_ACTION(SET_TAG, sizeof(struct
> rte_flow_action_set_tag)),
>  	MK_FLOW_ACTION(SET_META, sizeof(struct
> rte_flow_action_set_meta)),
> +	MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct
> rte_flow_action_set_dscp)),
> +	MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct
> rte_flow_action_set_dscp)),
>  };
> 
>  int
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 452d359..76bf080 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -2004,6 +2004,26 @@ enum rte_flow_action_type {
>  	 * See struct rte_flow_action_set_meta.
>  	 */
>  	RTE_FLOW_ACTION_TYPE_SET_META,
> +
> +	/**
> +	 * Modify IPv4 DSCP in the outermost IP header.
> +	 *
> +	 * If flow pattern does not define a valid
> RTE_FLOW_ITEM_TYPE_IPV4,
> +	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
> error.
> +	 *
> +	 * See struct rte_flow_action_set_dscp.
> +	 */
> +	RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
> +
> +	/**
> +	 * Modify IPv6 DSCP in the outermost IP header.
> +	 *
> +	 * If flow pattern does not define a valid
> RTE_FLOW_ITEM_TYPE_IPV6,
> +	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
> error.
> +	 *
> +	 * See struct rte_flow_action_set_dscp.
> +	 */
> +	RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
>  };
> 
>  /**
> @@ -2530,6 +2550,17 @@ struct rte_flow_action_set_meta {
>  	uint32_t mask;
>  };
> 
> +/**
> + * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
> + * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
> + *
> + * Set the DSCP value for IPv4/IPv6 header.
> + * DSCP in low 6 bits, rest ignored.
> + */
> +struct rte_flow_action_set_dscp {
> +	uint8_t dscp;
> +};
> +
>  /* Mbuf dynamic field offset for metadata. */
>  extern int rte_flow_dynf_metadata_offs;
> 
> --
> 1.8.3.1


      parent reply	other threads:[~2019-12-16  7:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10  5:23 [dpdk-dev] [RFC] " Suanming Mou
2019-12-10  7:33 ` Andrew Rybchenko
2019-12-10  8:55   ` Suanming Mou
2019-12-10 18:32     ` Stephen Hemminger
2019-12-10 18:31   ` Stephen Hemminger
2019-12-10 19:48     ` Ori Kam
2019-12-11  1:36     ` Suanming Mou
2019-12-10  9:27 ` [dpdk-dev] [RFC v2] " Suanming Mou
2019-12-16  3:42 ` [dpdk-dev] [RFC v3 1/2] " Suanming Mou
2019-12-16  3:42   ` [dpdk-dev] [RFC v3 2/2] net/mlx5: " Suanming Mou
2019-12-16  7:49   ` Ori Kam [this message]

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=AM4PR05MB3425316374FB7A791094DBF6DB510@AM4PR05MB3425.eurprd05.prod.outlook.com \
    --to=orika@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=arybchenko@solarflare.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=matan@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=suanmingm@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@mellanox.com \
    --cc=wenzhuo.lu@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).