From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84038A2EDB for ; Mon, 30 Sep 2019 15:15:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F4CB322C; Mon, 30 Sep 2019 15:15:24 +0200 (CEST) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 7DF9D271 for ; Mon, 30 Sep 2019 15:15:22 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 7F6B91C04; Mon, 30 Sep 2019 09:15:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 30 Sep 2019 09:15:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=e3ZFvn6ZrdybiOd6WlJZAEPHYe2vLo725kCYBYJhL4A=; b=h7JaAH798ORR 1DMmRskbNw52KSIzZEWSNqfSa0EYyvUHgB1GLtN0wvUAwLvOQBcbxzavtMPZx3Ml n7cTJIXDyDovx1aNe7nEOKQFmwPI3gBIL3EhwpUaImv9xP84H4begG3DuX0Ukw3Q M58QJfi2XZ5tidRljNeXLml1KGnS/Xo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=e3ZFvn6ZrdybiOd6WlJZAEPHYe2vLo725kCYBYJhL 4A=; b=C/MrjaX6c47D+j7Gu/G/FaI+cP90f5jt0CQjm8kCNjSrFXFQtYxgJaZic N4OKOc+kB0z7upzKw3uMTq0BxRhNLpKUQFSmFvYkrlad+TanF3sxxvWLj8WO0v6P lfc8o7ndd0Mvxpf4w9IqsSxuZVBy/+0kesb/hAYou9FzDlBbHAUY3uNzehZu/Qob CkoMYUbfo4eLk1pC2u+S/pZBznWSxIK2FZQlKWaa4ERMqWXJdUqa42RY/Xc/s63W t10btx64LAdm2mpaHbfImSxtgMfBTn+ymOg2kVSWFobeQpAC37kYS1GHplUivKQu 8Dmm8ey+SQ+dOcF3+jHl9l2HGH9+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgedvgdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthhqredttddtjeenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E8D4680060; Mon, 30 Sep 2019 09:15:17 -0400 (EDT) From: Thomas Monjalon To: Bernard Iremonger , Adrien Mazarguil Cc: dev@dpdk.org, Jack Min , Wenzhuo Lu , Jingjing Wu , John McNamara , Marko Kovacevic , Ori Kam , Asaf Penso , ferruh.yigit@intel.com Date: Mon, 30 Sep 2019 15:15:15 +0200 Message-ID: <3631481.Gshkirke4k@xps> In-Reply-To: <20190923120357.id6bbuo5aefktbv7@mellanox.com> References: <20190923120357.id6bbuo5aefktbv7@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] app/testpmd: support multiple raw encap/decap 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adrien, Bernard, no comment? Does it mean this patch is ready for dpdk-next-net? 23/09/2019 14:04, Jack Min: > Hey, >=20 > Anyone has any comments on this patch? >=20 > -Jack >=20 > On Mon, 19-09-16, 17:21, Xiaoyu Min wrote: > > In some scenarios, the raw_encap/raw_decap actions could be multiple in > > one single flow (e,g. hirepin flow): > >=20 > > ... actions raw_decap / raw_encap / raw_decap / raw_encap / ... > >=20 > > This requires the testpmd supports multiple raw_encap/raw_decap data > > settings as well. > >=20 > > With the multiple raw_encap/raw_decap settings, the testpmd commands = =E2=80=93 > > set raw_encap / set raw_decap will become: > >=20 > > set raw_encap > > set raw_decap > >=20 > > And the actions =E2=80=93 raw_encap/raw_decap also could optionally cho= ose which > > global raw_encap/raw_decap confs to be used by index: > >=20 > > ... actions raw_decap index 1 / raw_encap index 2 / ... > >=20 > > If there is no `index` specified, the default index is 0: > >=20 > > set raw_encap > > ... actions raw_decap / raw_encap / ... > >=20 > > which will use raw_encap index 0. > >=20 > > In addition to the set raw_encap/raw_decap commands, > >=20 > > show > > show all > >=20 > > are also introduced into in order to check which index is set and to > > what. > >=20 > > Signed-off-by: Xiaoyu Min > > --- > > app/test-pmd/cmdline.c | 2 + > > app/test-pmd/cmdline_flow.c | 310 ++++++++++++++++++-- > > app/test-pmd/testpmd.h | 2 + > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 57 +++- > > 4 files changed, 331 insertions(+), 40 deletions(-) > >=20 > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > > index b6bc34b4d2..9a7aae8b0e 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c > > @@ -19017,6 +19017,8 @@ cmdline_parse_ctx_t main_ctx[] =3D { > > (cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific, > > (cmdline_parse_inst_t *)&cmd_show_tx_metadata, > > (cmdline_parse_inst_t *)&cmd_set_raw, > > + (cmdline_parse_inst_t *)&cmd_show_set_raw, > > + (cmdline_parse_inst_t *)&cmd_show_set_raw_all, > > NULL, > > }; > > =20 > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index 495871394e..f5a1178d9d 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -19,7 +19,10 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > +#include > > =20 > > #include "testpmd.h" > > =20 > > @@ -51,6 +54,7 @@ enum index { > > /* Sub-leve commands. */ > > SET_RAW_ENCAP, > > SET_RAW_DECAP, > > + SET_RAW_INDEX, > > =20 > > /* Top-level command. */ > > FLOW, > > @@ -297,6 +301,10 @@ enum index { > > ACTION_DEC_TCP_ACK_VALUE, > > ACTION_RAW_ENCAP, > > ACTION_RAW_DECAP, > > + ACTION_RAW_ENCAP_INDEX, > > + ACTION_RAW_ENCAP_INDEX_VALUE, > > + ACTION_RAW_DECAP_INDEX, > > + ACTION_RAW_DECAP_INDEX_VALUE, > > }; > > =20 > > /** Maximum size for pattern in struct rte_flow_item_raw. */ > > @@ -320,6 +328,7 @@ struct action_rss_data { > > #define ACTION_VXLAN_ENCAP_ITEMS_NUM 6 > > =20 > > #define ACTION_RAW_ENCAP_MAX_DATA 128 > > +#define RAW_ENCAP_CONFS_MAX_NUM 8 > > =20 > > /** Storage for struct rte_flow_action_raw_encap. */ > > struct raw_encap_conf { > > @@ -328,7 +337,7 @@ struct raw_encap_conf { > > size_t size; > > }; > > =20 > > -struct raw_encap_conf raw_encap_conf =3D {.size =3D 0}; > > +struct raw_encap_conf raw_encap_confs[RAW_ENCAP_CONFS_MAX_NUM]; > > =20 > > /** Storage for struct rte_flow_action_raw_decap. */ > > struct raw_decap_conf { > > @@ -336,7 +345,7 @@ struct raw_decap_conf { > > size_t size; > > }; > > =20 > > -struct raw_decap_conf raw_decap_conf =3D {.size =3D 0}; > > +struct raw_decap_conf raw_decap_confs[RAW_ENCAP_CONFS_MAX_NUM]; > > =20 > > /** Storage for struct rte_flow_action_vxlan_encap including external = data. */ > > struct action_vxlan_encap_data { > > @@ -376,12 +385,14 @@ struct action_raw_encap_data { > > struct rte_flow_action_raw_encap conf; > > uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; > > uint8_t preserve[ACTION_RAW_ENCAP_MAX_DATA]; > > + uint16_t idx; > > }; > > =20 > > /** Storage for struct rte_flow_action_raw_decap including external da= ta. */ > > struct action_raw_decap_data { > > struct rte_flow_action_raw_decap conf; > > uint8_t data[ACTION_RAW_ENCAP_MAX_DATA]; > > + uint16_t idx; > > }; > > =20 > > /** Maximum number of subsequent tokens and arguments on the stack. */ > > @@ -902,6 +913,12 @@ static const enum index item_meta[] =3D { > > ZERO, > > }; > > =20 > > +static const enum index next_set_raw[] =3D { > > + SET_RAW_INDEX, > > + ITEM_ETH, > > + ZERO, > > +}; > > + > > static const enum index next_action[] =3D { > > ACTION_END, > > ACTION_VOID, > > @@ -1143,6 +1160,18 @@ static const enum index action_dec_tcp_ack[] =3D= { > > ZERO, > > }; > > =20 > > +static const enum index action_raw_encap[] =3D { > > + ACTION_RAW_ENCAP_INDEX, > > + ACTION_NEXT, > > + ZERO, > > +}; > > + > > +static const enum index action_raw_decap[] =3D { > > + ACTION_RAW_DECAP_INDEX, > > + ACTION_NEXT, > > + ZERO, > > +}; > > + > > static int parse_set_raw_encap_decap(struct context *, const struct to= ken *, > > const char *, unsigned int, > > void *, unsigned int); > > @@ -1201,6 +1230,12 @@ static int parse_vc_action_raw_encap(struct cont= ext *, > > static int parse_vc_action_raw_decap(struct context *, > > const struct token *, const char *, > > unsigned int, void *, unsigned int); > > +static int parse_vc_action_raw_encap_index(struct context *, > > + const struct token *, const char *, > > + unsigned int, void *, unsigned int); > > +static int parse_vc_action_raw_decap_index(struct context *, > > + const struct token *, const char *, > > + unsigned int, void *, unsigned int); > > static int parse_destroy(struct context *, const struct token *, > > const char *, unsigned int, > > void *, unsigned int); > > @@ -1260,6 +1295,8 @@ static int comp_vc_action_rss_type(struct context= *, const struct token *, > > unsigned int, char *, unsigned int); > > static int comp_vc_action_rss_queue(struct context *, const struct tok= en *, > > unsigned int, char *, unsigned int); > > +static int comp_set_raw_index(struct context *, const struct token *, > > + unsigned int, char *, unsigned int); > > =20 > > /** Token definitions. */ > > static const struct token token_list[] =3D { > > @@ -3095,23 +3132,49 @@ static const struct token token_list[] =3D { > > .name =3D "raw_encap", > > .help =3D "encapsulation data, defined by set raw_encap", > > .priv =3D PRIV_ACTION(RAW_ENCAP, > > - sizeof(struct rte_flow_action_raw_encap)), > > - .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > > + sizeof(struct action_raw_encap_data)), > > + .next =3D NEXT(action_raw_encap), > > .call =3D parse_vc_action_raw_encap, > > }, > > + [ACTION_RAW_ENCAP_INDEX] =3D { > > + .name =3D "index", > > + .help =3D "the index of raw_encap_confs", > > + .next =3D NEXT(NEXT_ENTRY(ACTION_RAW_ENCAP_INDEX_VALUE)), > > + }, > > + [ACTION_RAW_ENCAP_INDEX_VALUE] =3D { > > + .name =3D "{index}", > > + .type =3D "UNSIGNED", > > + .help =3D "unsigned integer value", > > + .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > > + .call =3D parse_vc_action_raw_encap_index, > > + .comp =3D comp_set_raw_index, > > + }, > > [ACTION_RAW_DECAP] =3D { > > .name =3D "raw_decap", > > .help =3D "decapsulation data, defined by set raw_encap", > > .priv =3D PRIV_ACTION(RAW_DECAP, > > - sizeof(struct rte_flow_action_raw_decap)), > > - .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > > + sizeof(struct action_raw_decap_data)), > > + .next =3D NEXT(action_raw_decap), > > .call =3D parse_vc_action_raw_decap, > > }, > > + [ACTION_RAW_DECAP_INDEX] =3D { > > + .name =3D "index", > > + .help =3D "the index of raw_encap_confs", > > + .next =3D NEXT(NEXT_ENTRY(ACTION_RAW_DECAP_INDEX_VALUE)), > > + }, > > + [ACTION_RAW_DECAP_INDEX_VALUE] =3D { > > + .name =3D "{index}", > > + .type =3D "UNSIGNED", > > + .help =3D "unsigned integer value", > > + .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > > + .call =3D parse_vc_action_raw_decap_index, > > + .comp =3D comp_set_raw_index, > > + }, > > /* Top level command. */ > > [SET] =3D { > > .name =3D "set", > > .help =3D "set raw encap/decap data", > > - .type =3D "set raw_encap|raw_decap ", > > + .type =3D "set raw_encap|raw_decap ", > > .next =3D NEXT(NEXT_ENTRY > > (SET_RAW_ENCAP, > > SET_RAW_DECAP)), > > @@ -3121,14 +3184,29 @@ static const struct token token_list[] =3D { > > [SET_RAW_ENCAP] =3D { > > .name =3D "raw_encap", > > .help =3D "set raw encap data", > > - .next =3D NEXT(next_item), > > + .next =3D NEXT(next_set_raw), > > + .args =3D ARGS(ARGS_ENTRY_ARB_BOUNDED > > + (offsetof(struct buffer, port), > > + sizeof(((struct buffer *)0)->port), > > + 0, RAW_ENCAP_CONFS_MAX_NUM - 1)), > > .call =3D parse_set_raw_encap_decap, > > }, > > [SET_RAW_DECAP] =3D { > > .name =3D "raw_decap", > > .help =3D "set raw decap data", > > - .next =3D NEXT(next_item), > > + .next =3D NEXT(next_set_raw), > > + .args =3D ARGS(ARGS_ENTRY_ARB_BOUNDED > > + (offsetof(struct buffer, port), > > + sizeof(((struct buffer *)0)->port), > > + 0, RAW_ENCAP_CONFS_MAX_NUM - 1)), > > .call =3D parse_set_raw_encap_decap, > > + }, > > + [SET_RAW_INDEX] =3D { > > + .name =3D "{index}", > > + .type =3D "UNSIGNED", > > + .help =3D "index of raw_encap/raw_decap data", > > + .next =3D NEXT(next_item), > > + .call =3D parse_port, > > } > > }; > > =20 > > @@ -4423,6 +4501,84 @@ parse_vc_action_mplsoudp_decap(struct context *c= tx, const struct token *token, > > return ret; > > } > > =20 > > +static int > > +parse_vc_action_raw_decap_index(struct context *ctx, const struct toke= n *token, > > + const char *str, unsigned int len, void *buf, > > + unsigned int size) > > +{ > > + struct action_raw_decap_data *action_raw_decap_data; > > + struct rte_flow_action *action; > > + const struct arg *arg; > > + struct buffer *out =3D buf; > > + int ret; > > + uint16_t idx; > > + > > + RTE_SET_USED(token); > > + RTE_SET_USED(buf); > > + RTE_SET_USED(size); > > + arg =3D ARGS_ENTRY_ARB_BOUNDED > > + (offsetof(struct action_raw_decap_data, idx), > > + sizeof(((struct action_raw_decap_data *)0)->idx), > > + 0, RAW_ENCAP_CONFS_MAX_NUM - 1); > > + if (push_args(ctx, arg)) > > + return -1; > > + ret =3D parse_int(ctx, token, str, len, NULL, 0); > > + if (ret < 0) { > > + pop_args(ctx); > > + return -1; > > + } > > + if (!ctx->object) > > + return len; > > + action =3D &out->args.vc.actions[out->args.vc.actions_n - 1]; > > + action_raw_decap_data =3D ctx->object; > > + idx =3D action_raw_decap_data->idx; > > + action_raw_decap_data->conf.data =3D raw_decap_confs[idx].data; > > + action_raw_decap_data->conf.size =3D raw_decap_confs[idx].size; > > + action->conf =3D &action_raw_decap_data->conf; > > + return len; > > +} > > + > > + > > +static int > > +parse_vc_action_raw_encap_index(struct context *ctx, const struct toke= n *token, > > + const char *str, unsigned int len, void *buf, > > + unsigned int size) > > +{ > > + struct action_raw_encap_data *action_raw_encap_data; > > + struct rte_flow_action *action; > > + const struct arg *arg; > > + struct buffer *out =3D buf; > > + int ret; > > + uint16_t idx; > > + > > + RTE_SET_USED(token); > > + RTE_SET_USED(buf); > > + RTE_SET_USED(size); > > + if (ctx->curr !=3D ACTION_RAW_ENCAP_INDEX_VALUE) > > + return -1; > > + arg =3D ARGS_ENTRY_ARB_BOUNDED > > + (offsetof(struct action_raw_encap_data, idx), > > + sizeof(((struct action_raw_encap_data *)0)->idx), > > + 0, RAW_ENCAP_CONFS_MAX_NUM - 1); > > + if (push_args(ctx, arg)) > > + return -1; > > + ret =3D parse_int(ctx, token, str, len, NULL, 0); > > + if (ret < 0) { > > + pop_args(ctx); > > + return -1; > > + } > > + if (!ctx->object) > > + return len; > > + action =3D &out->args.vc.actions[out->args.vc.actions_n - 1]; > > + action_raw_encap_data =3D ctx->object; > > + idx =3D action_raw_encap_data->idx; > > + action_raw_encap_data->conf.data =3D raw_encap_confs[idx].data; > > + action_raw_encap_data->conf.size =3D raw_encap_confs[idx].size; > > + action_raw_encap_data->conf.preserve =3D NULL; > > + action->conf =3D &action_raw_encap_data->conf; > > + return len; > > +} > > + > > static int > > parse_vc_action_raw_encap(struct context *ctx, const struct token *tok= en, > > const char *str, unsigned int len, void *buf, > > @@ -4430,8 +4586,7 @@ parse_vc_action_raw_encap(struct context *ctx, co= nst struct token *token, > > { > > struct buffer *out =3D buf; > > struct rte_flow_action *action; > > - struct rte_flow_action_raw_encap *action_raw_encap_conf =3D NULL; > > - uint8_t *data =3D NULL; > > + struct action_raw_encap_data *action_raw_encap_data =3D NULL; > > int ret; > > =20 > > ret =3D parse_vc(ctx, token, str, len, buf, size); > > @@ -4447,14 +4602,11 @@ parse_vc_action_raw_encap(struct context *ctx, = const struct token *token, > > ctx->object =3D out->args.vc.data; > > ctx->objmask =3D NULL; > > /* Copy the headers to the buffer. */ > > - action_raw_encap_conf =3D ctx->object; > > - /* data stored from tail of data buffer */ > > - data =3D (uint8_t *)&(raw_encap_conf.data) + > > - ACTION_RAW_ENCAP_MAX_DATA - raw_encap_conf.size; > > - action_raw_encap_conf->data =3D data; > > - action_raw_encap_conf->preserve =3D NULL; > > - action_raw_encap_conf->size =3D raw_encap_conf.size; > > - action->conf =3D action_raw_encap_conf; > > + action_raw_encap_data =3D ctx->object; > > + action_raw_encap_data->conf.data =3D raw_encap_confs[0].data; > > + action_raw_encap_data->conf.preserve =3D NULL; > > + action_raw_encap_data->conf.size =3D raw_encap_confs[0].size; > > + action->conf =3D &action_raw_encap_data->conf; > > return ret; > > } > > =20 > > @@ -4465,8 +4617,7 @@ parse_vc_action_raw_decap(struct context *ctx, co= nst struct token *token, > > { > > struct buffer *out =3D buf; > > struct rte_flow_action *action; > > - struct rte_flow_action_raw_decap *action_raw_decap_conf =3D NULL; > > - uint8_t *data =3D NULL; > > + struct action_raw_decap_data *action_raw_decap_data =3D NULL; > > int ret; > > =20 > > ret =3D parse_vc(ctx, token, str, len, buf, size); > > @@ -4482,13 +4633,10 @@ parse_vc_action_raw_decap(struct context *ctx, = const struct token *token, > > ctx->object =3D out->args.vc.data; > > ctx->objmask =3D NULL; > > /* Copy the headers to the buffer. */ > > - action_raw_decap_conf =3D ctx->object; > > - /* data stored from tail of data buffer */ > > - data =3D (uint8_t *)&(raw_decap_conf.data) + > > - ACTION_RAW_ENCAP_MAX_DATA - raw_decap_conf.size; > > - action_raw_decap_conf->data =3D data; > > - action_raw_decap_conf->size =3D raw_decap_conf.size; > > - action->conf =3D action_raw_decap_conf; > > + action_raw_decap_data =3D ctx->object; > > + action_raw_decap_data->conf.data =3D raw_decap_confs[0].data; > > + action_raw_decap_data->conf.size =3D raw_decap_confs[0].size; > > + action->conf =3D &action_raw_decap_data->conf; > > return ret; > > } > > =20 > > @@ -5167,6 +5315,7 @@ parse_set_raw_encap_decap(struct context *ctx, co= nst struct token *token, > > return -1; > > ctx->objdata =3D 0; > > ctx->objmask =3D NULL; > > + ctx->object =3D out; > > if (!out->command) > > return -1; > > out->command =3D ctx->curr; > > @@ -5343,6 +5492,24 @@ comp_vc_action_rss_queue(struct context *ctx, co= nst struct token *token, > > return -1; > > } > > =20 > > +/** Complete index number for set raw_encap/raw_decap commands. */ > > +static int > > +comp_set_raw_index(struct context *ctx, const struct token *token, > > + unsigned int ent, char *buf, unsigned int size) > > +{ > > + uint16_t idx =3D 0; > > + uint16_t nb =3D 0; > > + > > + RTE_SET_USED(ctx); > > + RTE_SET_USED(token); > > + for (idx =3D 0; idx < RAW_ENCAP_CONFS_MAX_NUM; ++idx) { > > + if (buf && idx =3D=3D ent) > > + return snprintf(buf, size, "%u", idx); > > + ++nb; > > + } > > + return nb; > > +} > > + > > /** Internal context. */ > > static struct context cmd_flow_context; > > =20 > > @@ -5777,15 +5944,16 @@ cmd_set_raw_parsed(const struct buffer *in) > > size_t *total_size =3D NULL; > > uint16_t upper_layer =3D 0; > > uint16_t proto =3D 0; > > + uint16_t idx =3D in->port; /* We borrow port field as index */ > > =20 > > RTE_ASSERT(in->command =3D=3D SET_RAW_ENCAP || > > in->command =3D=3D SET_RAW_DECAP); > > if (in->command =3D=3D SET_RAW_ENCAP) { > > - total_size =3D &raw_encap_conf.size; > > - data =3D (uint8_t *)&raw_encap_conf.data; > > + total_size =3D &raw_encap_confs[idx].size; > > + data =3D (uint8_t *)&raw_encap_confs[idx].data; > > } else { > > - total_size =3D &raw_decap_conf.size; > > - data =3D (uint8_t *)&raw_decap_conf.data; > > + total_size =3D &raw_decap_confs[idx].size; > > + data =3D (uint8_t *)&raw_decap_confs[idx].data; > > } > > *total_size =3D 0; > > memset(data, 0x00, ACTION_RAW_ENCAP_MAX_DATA); > > @@ -5855,6 +6023,7 @@ cmd_set_raw_parsed(const struct buffer *in) > > if (verbose_level & 0x1) > > printf("total data size is %zu\n", (*total_size)); > > RTE_ASSERT((*total_size) <=3D ACTION_RAW_ENCAP_MAX_DATA); > > + memmove(data, (data_tail - (*total_size)), *total_size); > > } > > =20 > > /** Populate help strings for current token (cmdline API). */ > > @@ -5939,3 +6108,80 @@ cmdline_parse_inst_t cmd_set_raw =3D { > > NULL, > > }, /**< Tokens are returned by cmd_flow_tok(). */ > > }; > > + > > +/* *** display raw_encap/raw_decap buf */ > > +struct cmd_show_set_raw_result { > > + cmdline_fixed_string_t cmd_show; > > + cmdline_fixed_string_t cmd_what; > > + cmdline_fixed_string_t cmd_all; > > + uint16_t cmd_index; > > +}; > > + > > +static void > > +cmd_show_set_raw_parsed(void *parsed_result, struct cmdline *cl, void = *data) > > +{ > > + struct cmd_show_set_raw_result *res =3D parsed_result; > > + uint16_t index =3D res->cmd_index; > > + uint8_t all =3D 0; > > + uint8_t *raw_data =3D NULL; > > + size_t raw_size =3D 0; > > + char title[16] =3D {0}; > > + > > + RTE_SET_USED(cl); > > + RTE_SET_USED(data); > > + if (!strcmp(res->cmd_all, "all")) { > > + all =3D 1; > > + index =3D 0; > > + } else if (index >=3D RAW_ENCAP_CONFS_MAX_NUM) { > > + printf("index should be 0-%u\n", RAW_ENCAP_CONFS_MAX_NUM - 1); > > + return; > > + } > > + do { > > + if (!strcmp(res->cmd_what, "raw_encap")) { > > + raw_data =3D (uint8_t *)&raw_encap_confs[index].data; > > + raw_size =3D raw_encap_confs[index].size; > > + snprintf(title, 16, "\nindex: %u", index); > > + rte_hexdump(stdout, title, raw_data, raw_size); > > + } else { > > + raw_data =3D (uint8_t *)&raw_decap_confs[index].data; > > + raw_size =3D raw_decap_confs[index].size; > > + snprintf(title, 16, "\nindex: %u", index); > > + rte_hexdump(stdout, title, raw_data, raw_size); > > + } > > + } while (all && ++index < RAW_ENCAP_CONFS_MAX_NUM); > > +} > > + > > +cmdline_parse_token_string_t cmd_show_set_raw_cmd_show =3D > > + TOKEN_STRING_INITIALIZER(struct cmd_show_set_raw_result, > > + cmd_show, "show"); > > +cmdline_parse_token_string_t cmd_show_set_raw_cmd_what =3D > > + TOKEN_STRING_INITIALIZER(struct cmd_show_set_raw_result, > > + cmd_what, "raw_encap#raw_decap"); > > +cmdline_parse_token_num_t cmd_show_set_raw_cmd_index =3D > > + TOKEN_NUM_INITIALIZER(struct cmd_show_set_raw_result, > > + cmd_index, UINT16); > > +cmdline_parse_token_string_t cmd_show_set_raw_cmd_all =3D > > + TOKEN_STRING_INITIALIZER(struct cmd_show_set_raw_result, > > + cmd_all, "all"); > > +cmdline_parse_inst_t cmd_show_set_raw =3D { > > + .f =3D cmd_show_set_raw_parsed, > > + .data =3D NULL, > > + .help_str =3D "show ", > > + .tokens =3D { > > + (void *)&cmd_show_set_raw_cmd_show, > > + (void *)&cmd_show_set_raw_cmd_what, > > + (void *)&cmd_show_set_raw_cmd_index, > > + NULL, > > + }, > > +}; > > +cmdline_parse_inst_t cmd_show_set_raw_all =3D { > > + .f =3D cmd_show_set_raw_parsed, > > + .data =3D NULL, > > + .help_str =3D "show all", > > + .tokens =3D { > > + (void *)&cmd_show_set_raw_cmd_show, > > + (void *)&cmd_show_set_raw_cmd_what, > > + (void *)&cmd_show_set_raw_cmd_all, > > + NULL, > > + }, > > +}; > > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > > index ce13eb8e6a..a65635d6ff 100644 > > --- a/app/test-pmd/testpmd.h > > +++ b/app/test-pmd/testpmd.h > > @@ -265,6 +265,8 @@ extern struct fwd_engine ieee1588_fwd_engine; > > =20 > > extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. = */ > > extern cmdline_parse_inst_t cmd_set_raw; > > +extern cmdline_parse_inst_t cmd_show_set_raw; > > +extern cmdline_parse_inst_t cmd_show_set_raw_all; > > =20 > > extern uint16_t mempool_flags; > > =20 > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/t= estpmd_app_ug/testpmd_funcs.rst > > index 67f4339ca9..1cf9a2bdff 100644 > > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > @@ -540,6 +540,25 @@ Dumps the log level for all the dpdk modules:: > > =20 > > testpmd> dump_log_types > > =20 > > +show (raw_encap|raw_decap) > > +~~~~~~~~~~~~~~~~~~~~~~~~~~ > > + > > +Display content of raw_encap/raw_decap buffers in hex:: > > + > > + testpmd> show > > + testpmd> show all > > + > > +For example:: > > + > > + testpmd> show raw_encap 6 > > + > > + index: 6 at [0x1c565b0], len=3D50 > > + 00000000: 00 00 00 00 00 00 16 26 36 46 56 66 08 00 45 00 | .......&= 6FVf..E. > > + 00000010: 00 00 00 00 00 00 00 11 00 00 C0 A8 01 06 C0 A8 | ........= =2E....... > > + 00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ........= =2E....... > > + 00000030: 06 00 | .. > > + > > + > > Configuration Functions > > ----------------------- > > =20 > > @@ -1844,12 +1863,22 @@ Config Raw Encapsulation > > Configure the raw data to be used when encapsulating a packet by > > rte_flow_action_raw_encap:: > > =20 > > + set raw_encap {index} {item} [/ {item} [...]] / end_set > > + > > +There are multiple global buffers for ``raw_encap``, this command will= set one > > +internal buffer index by ``{index}``. > > +If there is no ``{index}`` specified:: > > + > > set raw_encap {item} [/ {item} [...]] / end_set > > =20 > > -This command will set an internal buffer inside testpmd, any following= flow rule > > -using the action raw_encap will use the last configuration set. > > -To have a different encapsulation header, this command must be called = before the > > -flow rule creation. > > +the default index ``0`` is used. > > +In order to use different encapsulating header, ``index`` must be spec= ified > > +during the flow rule creation:: > > + > > + testpmd> flow create 0 egress pattern eth / ipv4 / end actions > > + raw_encap index 2 / end > > + > > +Otherwise the default index ``0`` is used. > > =20 > > Config Raw Decapsulation > > ~~~~~~~~~~~~~~~~~~~~~~~~ > > @@ -1857,10 +1886,22 @@ Config Raw Decapsulation > > Configure the raw data to be used when decapsulating a packet by > > rte_flow_action_raw_decap:: > > =20 > > + set raw_decap {index} {item} [/ {item} [...]] / end_set > > + > > +There are multiple global buffers for ``raw_decap``, this command will= set > > +one internal buffer index by ``{index}``. > > +If there is no ``{index}`` specified:: > > + > > set raw_decap {item} [/ {item} [...]] / end_set > > =20 > > -This command will set an internal buffer inside testpmd, any following= flow rule > > -using the action raw_decap will use the last configuration set. > > +the default index ``0`` is used. > > +In order to use different decapsulating header, ``index`` must be spec= ified > > +during the flow rule creation:: > > + > > + testpmd> flow create 0 egress pattern eth / ipv4 / end actions > > + raw_encap index 3 / end > > + > > +Otherwise the default index ``0`` is used. > > =20 > > Port Functions > > -------------- > > @@ -4658,11 +4699,11 @@ Raw encapsulation configuration can be set by t= he following commands > > =20 > > Eecapsulating VxLAN:: > > =20 > > - testpmd> set raw_encap eth src is 10:11:22:33:44:55 / vlan tci is 1 > > + testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1 > > inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni > > is 2 / end_set > > testpmd> flow create 0 egress pattern eth / ipv4 / end actions > > - raw_encap / end > > + raw_encap index 4 / end > > =20 > > Sample Raw decapsulation rule > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > --=20 > > 2.23.0 > >=20 >=20