From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: Re: [PATCH v2 2/3] app/testpmd: add commands of modify TTL Date: Wed, 3 Oct 2018 19:51:35 +0000 Message-ID: <20181003195124.GB26206@mtidpdk.mti.labs.mlnx> References: <20180925134718.18945-1-jackmin@mellanox.com> <20180925143719.23339-1-jackmin@mellanox.com> <20180925143719.23339-3-jackmin@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "ferruh.yigit@intel.com" , Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , "dev@dpdk.org" To: Jack Min Return-path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70055.outbound.protection.outlook.com [40.107.7.55]) by dpdk.org (Postfix) with ESMTP id 1C7EC1B203 for ; Wed, 3 Oct 2018 21:51:37 +0200 (CEST) In-Reply-To: <20180925143719.23339-3-jackmin@mellanox.com> Content-Language: en-US Content-ID: <122D06742CB141469788E39806691ABF@eurprd05.prod.outlook.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Sep 25, 2018 at 10:37:18PM +0800, Xiaoyu Min wrote: > add commands which supports following TTL actions: > - RTE_FLOW_ACTION_TYPE_DEC_TTL > - RTE_FLOW_ACTION_TYPE_SET_TTL >=20 > Signed-off-by: Xiaoyu Min Acked-by: Yongseok Koh Thanks > --- > app/test-pmd/cmdline_flow.c | 34 +++++++++++++++++++++ > app/test-pmd/config.c | 3 ++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ > 3 files changed, 42 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 3935539cb..fae825462 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -255,6 +255,9 @@ enum index { > ACTION_SET_TP_SRC_TP_SRC, > ACTION_SET_TP_DST, > ACTION_SET_TP_DST_TP_DST, > + ACTION_DEC_TTL, > + ACTION_SET_TTL, > + ACTION_SET_TTL_TTL, > }; > =20 > /** Maximum size for pattern in struct rte_flow_item_raw. */ > @@ -834,6 +837,8 @@ static const enum index next_action[] =3D { > ACTION_SET_IPV6_DST, > ACTION_SET_TP_SRC, > ACTION_SET_TP_DST, > + ACTION_DEC_TTL, > + ACTION_SET_TTL, > ZERO, > }; > =20 > @@ -972,6 +977,12 @@ static const enum index action_set_tp_dst[] =3D { > ZERO, > }; > =20 > +static const enum index action_set_ttl[] =3D { > + ACTION_SET_TTL_TTL, > + ACTION_NEXT, > + ZERO, > +}; > + > static const enum index action_jump[] =3D { > ACTION_JUMP_GROUP, > ACTION_NEXT, > @@ -2620,6 +2631,29 @@ static const struct token token_list[] =3D { > (struct rte_flow_action_set_tp, port)), > .call =3D parse_vc_conf, > }, > + [ACTION_DEC_TTL] =3D { > + .name =3D "dec_ttl", > + .help =3D "decrease network TTL if available", > + .priv =3D PRIV_ACTION(DEC_TTL, 0), > + .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), > + .call =3D parse_vc, > + }, > + [ACTION_SET_TTL] =3D { > + .name =3D "set_ttl", > + .help =3D "set ttl value", > + .priv =3D PRIV_ACTION(SET_TTL, > + sizeof(struct rte_flow_action_set_ttl)), > + .next =3D NEXT(action_set_ttl), > + .call =3D parse_vc, > + }, > + [ACTION_SET_TTL_TTL] =3D { > + .name =3D "ttl_value", > + .help =3D "new ttl value to set", > + .next =3D NEXT(action_set_ttl, NEXT_ENTRY(UNSIGNED)), > + .args =3D ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_ttl, ttl_value)), > + .call =3D parse_vc_conf, > + }, > }; > =20 > /** Remove and return last entry from argument stack. */ > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index d1028d03e..d28b6ed14 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1174,6 +1174,9 @@ static const struct { > sizeof(struct rte_flow_action_set_tp)), > MK_FLOW_ACTION(SET_TP_DST, > sizeof(struct rte_flow_action_set_tp)), > + MK_FLOW_ACTION(DEC_TTL, 0), > + MK_FLOW_ACTION(SET_TTL, > + sizeof(struct rte_flow_action_set_ttl)), > }; > =20 > /** Compute storage space needed by action configuration and copy it. */ > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/tes= tpmd_app_ug/testpmd_funcs.rst > index f60be0862..db68c4346 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3721,6 +3721,11 @@ This section lists supported actions and their att= ributes, if any. > =20 > - ``port``: New TCP/UDP destination port number. > =20 > +- ``dec_ttl``: Performs a decrease TTL value action > + > +- ``set_ttl``: Set TTL value with specificed value > + - ``ttl_value {unsigned}``: The new TTL value to be set > + > Destroying flow rules > ~~~~~~~~~~~~~~~~~~~~~ > =20 > --=20 > 2.17.1 >=20