From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PbBW4lsqkR23SGOSjMYMgAhLAjp/sV4lhCsBFcpgtVc=; b=MAXgf/TPGyuNG28XkFHyN2UHQM8z+RJRumlywWnjmBs375NAhJYVhh/0W1xYYxCGL45LKyCJ6jd8qEs4r9/+TRedmQtyHlkBN/ITjo2lhp1CrkEycclzc794mUSkQ8Z2dWjgwSGNN7PDgfsE0+rA8rY7pZDUQOJJMPCmXth0QgQ= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3977.eurprd05.prod.outlook.com (52.134.70.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Wed, 3 Oct 2018 19:51:35 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Wed, 3 Oct 2018 19:51:35 +0000 From: Yongseok Koh To: Jack Min CC: "ferruh.yigit@intel.com" , Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 2/3] app/testpmd: add commands of modify TTL Thread-Index: AQHUVN17TTLMOM6pUkK36F/OyQExcaUN+zOA 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> In-Reply-To: <20180925143719.23339-3-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR07CA0036.namprd07.prod.outlook.com (2603:10b6:a02:bc::49) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3977; 6:0oH0SvMuBuAdEX1kRq9Zg0nt1OCypO6wt6wVSU951vCLeuG0xI3l1Hr5GN1Nx3h8TQ7GzZLUBdUBZyusmYObd/KmpBvBd5zq9HB/qWK4K/I9iBw8NArrc2XpWwWci8KwtmHOHd3+OurqnMvkybrvBXtCDBX30HbMLaEieTqi1wDT4oByNOvEhgA8ynuQYrfiBXMQAfbk/xncd+G8hMlQ7YBzV7lIlyWh4vXq9rHX1THj1zgJ4ZY0GSpWzRoIU2KjgJpGW8CkKYdAaRRNl033aKqWLfkU0ktbKs01st+N/9XF0vi9qNyRwuOZOSSDHYUcvu1j20SdDJ2W66ZwH5HhpNjxz/UD08OXJc/gJKFUcLLIJSCUNB4laoHqrB2stQG61mtEgh21jzBcOx9qhciYfwVyO95T80c5BH+024ck47bUXc1/BxNQnSASQw4XoT6be8wjIvq2g73BiGcSYH3DKA==; 5:UC5+1A0rXaMqRS3tYBmgnxGKRkRbMQKthXTwk1SRE2L2CisFNbIb6WFfVzQ8TDrzYpYuM5KunhnkN9HNohWcPKUx9N9KvVVVIQMNb2ipNdehY6kBJrev4vO76QWOSWSSv13qxLd3kLvNSZDmkAKyM5tfe8NO99s8lph5pSxO4R4=; 7:QNzs37KkKEEIjonKHEdnlePpr73gFLwTBSl7WDBFPNjqTvPp5qNurn0rlRbZUFaCB05Zj1SJ82jgLxjAPQJ7FMtLJfooCNmVWmooLqLqzgREVsyJR68rNDtb9pwdFcJOVvCsjWMGmsiQOq+G0VdiVXzIqNuY5cxF+vtUvnX6l01u8DMqFcxVwDivwkcFA72m882IvVqDRV+K9mcSCLW+4d57lNIJwexNrVN1WGuCous7Dh96G0ESC27dChMngYqC x-ms-office365-filtering-correlation-id: eda2f1e1-d700-4cb4-bc90-08d62969a01d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3977; x-ms-traffictypediagnostic: DB3PR0502MB3977: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:DB3PR0502MB3977; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3977; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(376002)(396003)(136003)(366004)(199004)(189003)(86362001)(102836004)(26005)(486006)(2906002)(66066001)(106356001)(97736004)(81156014)(81166006)(386003)(6506007)(33896004)(6636002)(105586002)(76176011)(5250100002)(99286004)(229853002)(52116002)(8676002)(6486002)(6862004)(4326008)(6436002)(14444005)(1076002)(256004)(8936002)(14454004)(316002)(33656002)(2900100001)(54906003)(478600001)(305945005)(25786009)(446003)(68736007)(7736002)(71200400001)(186003)(6116002)(476003)(6246003)(11346002)(53936002)(3846002)(6512007)(9686003)(71190400001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3977; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KXSXBmItUUP33gTgOo4kSgNoMnKkQH0xSl25flcNUP6lzAbfMIL8xBEG5ju8d/YKj6lbBiiwXEpO5MFaRILkRRkqE0wux/gFl98d7q9BArnk3AO3tzht+nqjFHRRVVpVh9s7lm/k++1UY8vrN/1dOsDg/6Y6Yqfy2zMtaf2NLNEYpe7d598P4dab02t1JdJQzvjKYyQcB8oDRUmNnrhYALdE/FSKx0gBOHnAY4k5aNMmbPVROk0/ninpMPI2LyG1F5rqLqV2eEPeP87WzF4pdb1q81ciPloO2HW9vq/chEcFQoxtLJHRmKsibsy1kZI+e95X+HbS6wlKsxJuvgGtfY6JL6MFRAR1JlpRRZeQ6TM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <122D06742CB141469788E39806691ABF@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: eda2f1e1-d700-4cb4-bc90-08d62969a01d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 19:51:35.6583 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3977 Subject: Re: [dpdk-dev] [PATCH v2 2/3] app/testpmd: add commands of modify TTL 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: Wed, 03 Oct 2018 19:51:37 -0000 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