From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3DF41FAF8 for ; Tue, 20 Dec 2016 08:32:32 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP; 19 Dec 2016 23:32:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,377,1477983600"; d="scan'208";a="44823449" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by fmsmga005.fm.intel.com with ESMTP; 19 Dec 2016 23:32:31 -0800 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.252]) by KMSMSX151.gar.corp.intel.com ([169.254.10.6]) with mapi id 14.03.0248.002; Tue, 20 Dec 2016 15:32:30 +0800 From: "Zhao1, Wei" To: Adrien Mazarguil , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 10/25] app/testpmd: add flow flush command Thread-Index: AQHSWiC3g+7zBElq7EyGGNY/CRZ/g6EQbeig Date: Tue, 20 Dec 2016 07:32:29 +0000 Message-ID: References: <8a8d3efbf0258cc3afa5b334b180e049ce2f9ee3.1482168851.git.adrien.mazarguil@6wind.com> In-Reply-To: <8a8d3efbf0258cc3afa5b334b180e049ce2f9ee3.1482168851.git.adrien.mazarguil@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 10/25] app/testpmd: add flow flush command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:32:34 -0000 Hi, Adrien > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil > Sent: Tuesday, December 20, 2016 1:49 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 10/25] app/testpmd: add flow flush > command >=20 > Syntax: >=20 > flow flush {port_id} >=20 > Destroy all flow rules on a port. >=20 > Signed-off-by: Adrien Mazarguil > Acked-by: Olga Shern > --- > app/test-pmd/cmdline.c | 3 +++ > app/test-pmd/cmdline_flow.c | 43 > +++++++++++++++++++++++++++++++++++++++- > 2 files changed, 45 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 0dc6c63..6e2b289 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -811,6 +811,9 @@ static void cmd_help_long_parsed(void > *parsed_result, > " (select|add)\n" > " Set the input set for FDir.\n\n" >=20 > + "flow flush {port_id}\n" > + " Destroy all flow rules.\n\n" > + > "flow list {port_id} [group {group_id}] [...]\n" > " List existing flow rules sorted by priority," > " filtered by group identifiers.\n\n" > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index bd3da38..49578eb 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -63,6 +63,7 @@ enum index { > FLOW, >=20 > /* Sub-level commands. */ > + FLUSH, > LIST, >=20 > /* List arguments. */ > @@ -179,6 +180,9 @@ static const enum index next_list_attr[] =3D { stati= c int > parse_init(struct context *, const struct token *, > const char *, unsigned int, > void *, unsigned int); > +static int parse_flush(struct context *, const struct token *, > + const char *, unsigned int, > + void *, unsigned int); > static int parse_list(struct context *, const struct token *, > const char *, unsigned int, > void *, unsigned int); > @@ -240,10 +244,19 @@ static const struct token token_list[] =3D { > .name =3D "flow", > .type =3D "{command} {port_id} [{arg} [...]]", > .help =3D "manage ingress/egress flow rules", > - .next =3D NEXT(NEXT_ENTRY(LIST)), > + .next =3D NEXT(NEXT_ENTRY > + (FLUSH, > + LIST)), > .call =3D parse_init, > }, > /* Sub-level commands. */ > + [FLUSH] =3D { > + .name =3D "flush", > + .help =3D "destroy all flow rules", > + .next =3D NEXT(NEXT_ENTRY(PORT_ID)), > + .args =3D ARGS(ARGS_ENTRY(struct buffer, port)), > + .call =3D parse_flush, > + }, > [LIST] =3D { > .name =3D "list", > .help =3D "list existing flow rules", > @@ -316,6 +329,31 @@ parse_init(struct context *ctx, const struct token > *token, > return len; > } >=20 > +/** Parse tokens for flush command. */ > +static int > +parse_flush(struct context *ctx, const struct token *token, > + const char *str, unsigned int len, > + void *buf, unsigned int size) > +{ > + struct buffer *out =3D buf; > + > + /* Token name must match. */ > + if (parse_default(ctx, token, str, len, NULL, 0) < 0) > + return -1; > + /* Nothing else to do if there is no buffer. */ > + if (!out) > + return len; > + if (!out->command) { > + if (ctx->curr !=3D FLUSH) > + return -1; > + if (sizeof(*out) > size) > + return -1; > + out->command =3D ctx->curr; > + ctx->object =3D out; > + } > + return len; > +} > + > /** Parse tokens for list command. */ > static int > parse_list(struct context *ctx, const struct token *token, @@ -698,6 +73= 6,9 > @@ static void cmd_flow_parsed(const struct buffer *in) { > switch (in->command) { > + case FLUSH: > + port_flow_flush(in->port); > + break; > case LIST: > port_flow_list(in->port, in->args.list.group_n, > in->args.list.group); > -- > 2.1.4 When user flow flush cmd, PMD will flush all the rule on the specific port= , and the memory of which rte_flow point to must be flushed. This memory is returned when flow create, will rte layer flush this memory = or PMD is responsible for that memory flush? BTW, there is no argument about rte_flow in flush function pass into PMD la= yer.