DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Jack Min <jackmin@mellanox.com>
Cc: "ferruh.yigit@intel.com" <ferruh.yigit@intel.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>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/3] app/testpmd: add commands of modify MAC address
Date: Wed, 3 Oct 2018 20:09:13 +0000	[thread overview]
Message-ID: <20181003200903.GE26206@mtidpdk.mti.labs.mlnx> (raw)
In-Reply-To: <20180925150340.25378-3-jackmin@mellanox.com>

On Tue, Sep 25, 2018 at 11:03:39PM +0800, Xiaoyu Min wrote:
> add commands to support following actions:
> 
> - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC
> - RTE_FLOW_ACTION_TYPE_SET_MAC_DST
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>

Thanks

>  app/test-pmd/cmdline_flow.c                 | 50 +++++++++++++++++++++
>  app/test-pmd/config.c                       |  4 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  8 ++++
>  3 files changed, 62 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index fae825462..d06e75799 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -258,6 +258,10 @@ enum index {
>  	ACTION_DEC_TTL,
>  	ACTION_SET_TTL,
>  	ACTION_SET_TTL_TTL,
> +	ACTION_SET_MAC_SRC,
> +	ACTION_SET_MAC_SRC_MAC_SRC,
> +	ACTION_SET_MAC_DST,
> +	ACTION_SET_MAC_DST_MAC_DST,
>  };
>  
>  /** Maximum size for pattern in struct rte_flow_item_raw. */
> @@ -839,6 +843,8 @@ static const enum index next_action[] = {
>  	ACTION_SET_TP_DST,
>  	ACTION_DEC_TTL,
>  	ACTION_SET_TTL,
> +	ACTION_SET_MAC_SRC,
> +	ACTION_SET_MAC_DST,
>  	ZERO,
>  };
>  
> @@ -947,6 +953,12 @@ static const enum index action_set_ipv4_src[] = {
>  	ZERO,
>  };
>  
> +static const enum index action_set_mac_src[] = {
> +	ACTION_SET_MAC_SRC_MAC_SRC,
> +	ACTION_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index action_set_ipv4_dst[] = {
>  	ACTION_SET_IPV4_DST_IPV4_DST,
>  	ACTION_NEXT,
> @@ -989,6 +1001,12 @@ static const enum index action_jump[] = {
>  	ZERO,
>  };
>  
> +static const enum index action_set_mac_dst[] = {
> +	ACTION_SET_MAC_DST_MAC_DST,
> +	ACTION_NEXT,
> +	ZERO,
> +};
> +
>  static int parse_init(struct context *, const struct token *,
>  		      const char *, unsigned int,
>  		      void *, unsigned int);
> @@ -2654,6 +2672,38 @@ static const struct token token_list[] = {
>  			     (struct rte_flow_action_set_ttl, ttl_value)),
>  		.call = parse_vc_conf,
>  	},
> +	[ACTION_SET_MAC_SRC] = {
> +		.name = "set_mac_src",
> +		.help = "set source mac address",
> +		.priv = PRIV_ACTION(SET_MAC_SRC,
> +			sizeof(struct rte_flow_action_set_mac)),
> +		.next = NEXT(action_set_mac_src),
> +		.call = parse_vc,
> +	},
> +	[ACTION_SET_MAC_SRC_MAC_SRC] = {
> +		.name = "mac_addr",
> +		.help = "new source mac address",
> +		.next = NEXT(action_set_mac_src, NEXT_ENTRY(MAC_ADDR)),
> +		.args = ARGS(ARGS_ENTRY_HTON
> +			     (struct rte_flow_action_set_mac, mac_addr)),
> +		.call = parse_vc_conf,
> +	},
> +	[ACTION_SET_MAC_DST] = {
> +		.name = "set_mac_dst",
> +		.help = "set destination mac address",
> +		.priv = PRIV_ACTION(SET_MAC_DST,
> +			sizeof(struct rte_flow_action_set_mac)),
> +		.next = NEXT(action_set_mac_dst),
> +		.call = parse_vc,
> +	},
> +	[ACTION_SET_MAC_DST_MAC_DST] = {
> +		.name = "mac_addr",
> +		.help = "new destination mac address to set",
> +		.next = NEXT(action_set_mac_dst, NEXT_ENTRY(MAC_ADDR)),
> +		.args = ARGS(ARGS_ENTRY_HTON
> +			     (struct rte_flow_action_set_mac, mac_addr)),
> +		.call = parse_vc_conf,
> +	},
>  };
>  
>  /** Remove and return last entry from argument stack. */
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index d28b6ed14..c2cbf5ce8 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1177,6 +1177,10 @@ static const struct {
>  	MK_FLOW_ACTION(DEC_TTL, 0),
>  	MK_FLOW_ACTION(SET_TTL,
>  		       sizeof(struct rte_flow_action_set_ttl)),
> +	MK_FLOW_ACTION(SET_MAC_SRC,
> +		       sizeof(struct rte_flow_action_set_mac)),
> +	MK_FLOW_ACTION(SET_MAC_DST,
> +		       sizeof(struct rte_flow_action_set_mac)),
>  };
>  
>  /** Compute storage space needed by action configuration and copy it. */
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index db68c4346..0a8cc73a3 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3726,6 +3726,14 @@ This section lists supported actions and their attributes, if any.
>  - ``set_ttl``: Set TTL value with specificed value
>    - ``ttl_value {unsigned}``: The new TTL value to be set
>  
> +- ``set_mac_src``: set source MAC address
> +
> +  - ``mac_addr {MAC-48}``: new source MAC address
> +
> +- ``set_mac_dst``: set destination MAC address
> +
> +  - ``mac_addr {MAC-48}``: new destination MAC address
> +
>  Destroying flow rules
>  ~~~~~~~~~~~~~~~~~~~~~
>  
> -- 
> 2.17.1
> 

  reply	other threads:[~2018-10-03 20:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 15:03 [dpdk-dev] [PATCH 0/3] ethdev: add generic MAC address rewrite actions Xiaoyu Min
2018-09-25 15:03 ` [dpdk-dev] [PATCH 1/3] " Xiaoyu Min
2018-10-03 20:08   ` Yongseok Koh
2018-10-08  9:31   ` Andrew Rybchenko
2018-09-25 15:03 ` [dpdk-dev] [PATCH 2/3] app/testpmd: add commands of modify MAC address Xiaoyu Min
2018-10-03 20:09   ` Yongseok Koh [this message]
2018-09-25 15:03 ` [dpdk-dev] [PATCH 3/3] net/mlx5: eswitch-modify MAC address actions Xiaoyu Min
2018-10-03 20:10   ` Yongseok Koh
2018-10-05 12:54 ` [dpdk-dev] [PATCH 0/3] ethdev: add generic MAC address rewrite actions Ferruh Yigit
2018-10-08  2:32   ` Xiaoyu Min
2018-10-10 13:11 ` [dpdk-dev] [PATCH v2 " Jack Min
2018-10-10 13:11   ` [dpdk-dev] [PATCH v2 1/3] " Jack Min
2018-10-10 13:11   ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: add commands of modify MAC address Jack Min
2018-10-10 13:11   ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: rewrite MAC address by E-Switch Jack Min
2018-10-11  5:51     ` Yongseok Koh
2018-10-11 13:31   ` [dpdk-dev] [PATCH v3 0/3] ethdev: add generic MAC address rewrite actions Jack Min
2018-10-11 13:31     ` [dpdk-dev] [PATCH v3 1/3] " Jack Min
2018-10-11 13:31     ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: add commands of modify MAC address Jack Min
2018-10-11 13:31     ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: rewrite MAC address by E-Switch Jack Min
2018-10-16  9:11     ` [dpdk-dev] [PATCH v3 0/3] ethdev: add generic MAC address rewrite actions Ferruh Yigit

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=20181003200903.GE26206@mtidpdk.mti.labs.mlnx \
    --to=yskoh@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jackmin@mellanox.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.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).