DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@nvidia.com>
To: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	Haifei Luo <haifeil@nvidia.com>, Matan Azrad <matan@nvidia.com>,
	Slava Ovsiienko <viacheslavo@nvidia.com>,
	"Singh, Jasvinder" <jasvinder.singh@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>,
	Raslan Darawsheh <rasland@nvidia.com>,
	"Iremonger, Bernard" <bernard.iremonger@intel.com>,
	"Xing, Beilei" <beilei.xing@intel.com>,
	"Lu, Wenzhuo" <wenzhuo.lu@intel.com>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: support meter color action in policy
Date: Wed, 5 May 2021 15:42:36 +0000	[thread overview]
Message-ID: <DM6PR12MB49877A98E93D67C0CDB595D7D6599@DM6PR12MB4987.namprd12.prod.outlook.com> (raw)
In-Reply-To: <DM6PR11MB27963B6A3E7947C60AD91953EB5B9@DM6PR11MB2796.namprd11.prod.outlook.com>

HI Haifei,

> -----Original Message-----
> From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Sent: Monday, May 3, 2021 3:11 PM
> Subject: RE: [PATCH] app/testpmd: support meter color action in policy
> 
> 
> 
> > -----Original Message-----
> > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > Sent: Friday, April 30, 2021 1:51 PM
> > To: Haifei Luo <haifeil@nvidia.com>; matan@nvidia.com;
> > orika@nvidia.com; viacheslavo@nvidia.com; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>
> > Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> Iremonger,
> > Bernard <bernard.iremonger@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: Re: [PATCH] app/testpmd: support meter color action in policy
> >
> > On 4/28/2021 3:10 PM, Haifei Luo wrote:
> > > Currently action RTE_FLOW_ACTION_TYPE_METER_COLOR is defined.
> > > Add the CLI for this action in meter policy: color type (types)
> > > There are three types: green, yellow and red.
> > >
> > > Example for the new policy meter CLIs:
> > >    add port meter policy 0 1 g_actions color type green / end y_actions
> > >      color type yellow / end r_actions color type red / end
> > >
> > > In the above command, the action type is
> > RTE_FLOW_ACTION_TYPE_METER_COLOR,
> > > the meter policy action list: green -> green, yellow -> yellow, red -> red.
> > >
> >
> > Ori can you please review this patch too?
> >
> > +Cristian for meter.
> >
> 
> Cc Jasvinder
> 
> > > Signed-off-by: Haifei Luo <haifeil@nvidia.com>
> > > ---
> > >  app/test-pmd/cmdline_flow.c | 85
> > +++++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 85 insertions(+)
> > >
> > > diff --git a/app/test-pmd/cmdline_flow.c
> > > b/app/test-pmd/cmdline_flow.c index 5947341..1c587bb 100644
> > > --- a/app/test-pmd/cmdline_flow.c
> > > +++ b/app/test-pmd/cmdline_flow.c
> > > @@ -348,6 +348,11 @@ enum index {
> > >  	ACTION_PORT_ID_ORIGINAL,
> > >  	ACTION_PORT_ID_ID,
> > >  	ACTION_METER,
> > > +	ACTION_METER_COLOR,
> > > +	ACTION_METER_COLOR_TYPE,
> > > +	ACTION_METER_COLOR_GREEN,
> > > +	ACTION_METER_COLOR_YELLOW,
> > > +	ACTION_METER_COLOR_RED,
> > >  	ACTION_METER_ID,
> > >  	ACTION_OF_SET_MPLS_TTL,
> > >  	ACTION_OF_SET_MPLS_TTL_MPLS_TTL,
> > > @@ -1377,6 +1382,7 @@ struct parse_action_priv {
> > >  	ACTION_PHY_PORT,
> > >  	ACTION_PORT_ID,
> > >  	ACTION_METER,
> > > +	ACTION_METER_COLOR,
> > >  	ACTION_OF_SET_MPLS_TTL,
> > >  	ACTION_OF_DEC_MPLS_TTL,
> > >  	ACTION_OF_SET_NW_TTL,
> > > @@ -1486,6 +1492,12 @@ struct parse_action_priv {
> > >  	ZERO,
> > >  };
> > >
> > > +static const enum index action_meter_color[] = {
> > > +	ACTION_METER_COLOR_TYPE,
> > > +	ACTION_NEXT,
> > > +	ZERO,
> > > +};
> > > +
> > >  static const enum index action_of_set_mpls_ttl[] = {
> > >  	ACTION_OF_SET_MPLS_TTL_MPLS_TTL,
> > >  	ACTION_NEXT,
> > > @@ -1723,6 +1735,10 @@ static int parse_vc_conf(struct context *,
> > > const
> > struct token *,
> > >  static int parse_vc_item_ecpri_type(struct context *, const struct token
> *,
> > >  				    const char *, unsigned int,
> > >  				    void *, unsigned int);
> > > +static int parse_vc_action_meter_color_type(struct context *,
> > > +					const struct token *,
> > > +					const char *, unsigned int, void *,
> > > +					unsigned int);
> > >  static int parse_vc_action_rss(struct context *, const struct token *,
> > >  			       const char *, unsigned int, void *,
> > >  			       unsigned int);
> > > @@ -3801,6 +3817,37 @@ static int comp_set_modify_field_id(struct
> > context *, const struct token *,
> > >  		.next = NEXT(action_meter),
> > >  		.call = parse_vc,
> > >  	},
> > > +	[ACTION_METER_COLOR] = {
> > > +		.name = "color",
> > > +		.help = "meter color for the packets",
> > > +		.priv = PRIV_ACTION(METER_COLOR,
> > > +				sizeof(struct rte_flow_action_meter_color)),
> > > +		.next = NEXT(action_meter_color),
> > > +		.call = parse_vc,
> > > +	},
> > > +	[ACTION_METER_COLOR_TYPE] = {
> > > +		.name = "type",
> > > +		.help = "specific meter color",
> > > +		.next = NEXT(NEXT_ENTRY(ACTION_NEXT),
> > > +
> > 	NEXT_ENTRY(ACTION_METER_COLOR_GREEN,
> > > +					ACTION_METER_COLOR_YELLOW,
> > > +					ACTION_METER_COLOR_RED)),
> > > +	},
> > > +	[ACTION_METER_COLOR_GREEN] = {
> > > +		.name = "green",
> > > +		.help = "meter color green",
> > > +		.call = parse_vc_action_meter_color_type,
> > > +	},
> > > +	[ACTION_METER_COLOR_YELLOW] = {
> > > +		.name = "yellow",
> > > +		.help = "meter color yellow",
> > > +		.call = parse_vc_action_meter_color_type,
> > > +	},
> > > +	[ACTION_METER_COLOR_RED] = {
> > > +		.name = "red",
> > > +		.help = "meter color red",
> > > +		.call = parse_vc_action_meter_color_type,
> > > +	},
> > >  	[ACTION_METER_ID] = {
> > >  		.name = "mtr_id",
> > >  		.help = "meter id to use",
> > > @@ -5318,6 +5365,44 @@ static int comp_set_modify_field_id(struct
> > context *, const struct token *,
> > >  	return len;
> > >  }
> > >
> > > +/** Parse meter color action type. */ static int
> > > +parse_vc_action_meter_color_type(struct context *ctx, const struct
> > token *token,
> > > +				const char *str, unsigned int len,
> > > +				void *buf, unsigned int size)
> > > +{
> > > +	struct rte_flow_action *action_data;
> > > +	struct rte_flow_action_meter_color *conf;
> > > +	enum rte_color color;
> > > +
> > > +	(void)buf;
> > > +	(void)size;
> > > +	/* Token name must match. */
> > > +	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
> > > +		return -1;
> > > +	switch (ctx->curr) {
> > > +	case ACTION_METER_COLOR_GREEN:
> > > +		color = RTE_COLOR_GREEN;
> > > +	break;
> > > +	case ACTION_METER_COLOR_YELLOW:
> > > +		color = RTE_COLOR_YELLOW;
> > > +	break;
> > > +	case ACTION_METER_COLOR_RED:
> > > +		color = RTE_COLOR_RED;
> > > +	break;
> > > +	default:
> > > +		return -1;
> > > +	}
> > > +
> > > +	if (!ctx->object)
> > > +		return len;
> > > +	action_data = ctx->object;
> > > +	conf = (struct rte_flow_action_meter_color *)
> > > +					(uintptr_t)(action_data->conf);
> > > +	conf->color = color;
> > > +	return len;
> > > +}
> > > +
> > >  /** Parse RSS action. */
> > >  static int
> > >  parse_vc_action_rss(struct context *ctx, const struct token *token,
> > >

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


  reply	other threads:[~2021-05-05 15:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 14:10 Haifei Luo
2021-04-30 12:50 ` Ferruh Yigit
2021-05-03 12:11   ` Dumitrescu, Cristian
2021-05-05 15:42     ` Ori Kam [this message]
2021-05-11  9:28 ` [dpdk-dev] [PATCH v2] app/testpmd: add CLI for action meter color Haifei Luo
2021-05-11 11:35   ` Ferruh Yigit
2021-05-11 12:34     ` Dumitrescu, Cristian
2021-05-11 13:20       ` Ferruh Yigit
2021-05-12 19:54         ` Dumitrescu, Cristian
2021-05-11 19:22   ` Ferruh Yigit
2021-05-12  1:41     ` Haifei Luo
2021-05-12  7:03       ` Haifei Luo
2021-05-12  7:02 ` [dpdk-dev] [PATCH v3] " Haifei Luo
2021-05-12  8:33   ` Ferruh Yigit
2021-05-12 10:49 ` [dpdk-dev] [PATCH v4] " Haifei Luo
2021-05-12 11:40   ` Ferruh Yigit
2021-05-12 12:08   ` Ferruh Yigit
2021-05-12 12:19 ` [dpdk-dev] [PATCH v5] " Haifei Luo

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=DM6PR12MB49877A98E93D67C0CDB595D7D6599@DM6PR12MB4987.namprd12.prod.outlook.com \
    --to=orika@nvidia.com \
    --cc=beilei.xing@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=haifeil@nvidia.com \
    --cc=jasvinder.singh@intel.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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).