From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0063.outbound.protection.outlook.com [104.47.0.63]) by dpdk.org (Postfix) with ESMTP id 900D91B3B3 for ; Sat, 13 Oct 2018 05:24:24 +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=tPxHKCkOD6ZV9KFUgSTfJbuQaKQYCgPOS379LT34sJ4=; b=g6XsOmWr2iylg22S3+nSCyZyrPEDJxB9gxP3pZWMsloRjksetwTvMvKXg6gfwo6pSMnTTgJvBe3I7OFttL8VDGY72osUSQDvGbXKHZUwhUXxwJZEJJN3lw16074sg3hVwqyzg3PYBVWxaZgTvYADNv/x/qVQj+BC2ni3nCrLBm0= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB1990.eurprd05.prod.outlook.com (10.168.9.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 03:24:23 +0000 Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913]) by DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913%3]) with mapi id 15.20.1228.020; Sat, 13 Oct 2018 03:24:23 +0000 From: Jack Min To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: "dev@dpdk.org" Thread-Topic: [PATCH v5 2/3] app/testpmd: add commands of modify TTL Thread-Index: AQHUYqQ8oFy5FZqhdEi04OtpNBt99Q== Date: Sat, 13 Oct 2018 03:24:22 +0000 Message-ID: <20181013032348.26380-3-jackmin@mellanox.com> References: <20181011132641.1000-1-jackmin@mellanox.com> <20181013032348.26380-1-jackmin@mellanox.com> In-Reply-To: <20181013032348.26380-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR03CA0012.apcprd03.prod.outlook.com (2603:1096:203:2e::24) To DB6PR0501MB2023.eurprd05.prod.outlook.com (2603:10a6:4:6::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [118.201.220.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0501MB1990; 6:Mo7y3shEftWw6CROrEE1HPq0BmX2wsjcXdN+rTZV3uxN+8j61jfjHHR/ADEwhJSPzKt2neTg3uG8GK28c0h0s2tiqFEPz6GKLqTD8haJuGipAqRaGAJ3JLJhuGwooX6GAvD5/1OnsmZQlJY/5LV2wsFD9HPF2VoASbe1Wmlt/AMB7Usua9UvDnZhTRtO4KPt/rm/VFYMk4KbK2QkdrF/z0WqkNYEaGU0N8j88I+t3Ny4XrjwzGfEmTz7ANT5ta2RarXz88kGxITDSv+8oitSWBOiRar/IogWeAi5zaaTxxMF+ah/XAcOF8ory1YaT+YvCrSZFf1pFCINhdtoas+GNg02SEiwfLSpJxS1jimuyRdgbpo62k2GKGE5AXHpDsJBFwyRW4y4zHC8mPt9IkiJ9rJUrq9FMarl7OfRk8nYubbQu6dtoZM52HBj9un8GZRMcimL9tTtDBoTeRVEw78+pA==; 5:ajCAhdrszZmeqNrFDmkn9IRHBVrSdEK67M2F+jS0P4LB6VLcnGXWOOaDLA9Qlrogo4Tb0TBJA13G1rKgEk4sgChLv+iXQSU7Q4ccXcvWai00q2J30Cn3ejoKSERe+v9ByEo8IaV+dq+PIh/aQ0VHFWb3oUGD9ZKBZ0MApDMbaAE=; 7:IeDvkdXE0/eqmGcGSQOLSZP3AaiWzli+TFkyEHnOQLckov7aNsydaZhuE4Wo0Nt4Bszo9mb3hBdhDTHhgfvQM3rZORvLtQ6p47zEnN0zwaTqRomlons2DMgpu9ghIPZJw0mHHNc8LvwoU/Jl78ySIotJPylkdm5WZKEDlATmk5cwZFa8NeHLO1qAPwuChx5bka6EBo9+C6tTYMEoBnB4cp+PaFv/0ys8URw1LLfKCGO349hG7pvO9plj0eZD8Xk0 x-ms-office365-filtering-correlation-id: a909eaf4-a639-4351-e652-08d630bb5e94 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:DB6PR0501MB1990; x-ms-traffictypediagnostic: DB6PR0501MB1990: 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)(8121501046)(5005006)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991067); SRVR:DB6PR0501MB1990; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB1990; x-forefront-prvs: 082465FB26 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(366004)(39860400002)(136003)(189003)(199004)(5250100002)(25786009)(4326008)(8936002)(66066001)(256004)(68736007)(14454004)(11346002)(2616005)(36756003)(97736004)(6512007)(110136005)(316002)(6486002)(2906002)(71200400001)(6436002)(71190400001)(8676002)(81156014)(106356001)(6116002)(3846002)(478600001)(486006)(305945005)(7736002)(86362001)(81166006)(102836004)(105586002)(2900100001)(1076002)(26005)(186003)(476003)(99286004)(446003)(6506007)(386003)(5660300001)(76176011)(53936002)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB1990; H:DB6PR0501MB2023.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: C2kfcLPtznsP8rpkz3kS5vSkQt7WJBL2WwaHJHafGB+aIDfN5g62aXvfB3pqeEjXFT4UCR7kbCArqacv3cIc4CO9YII8lnR6fgG6i3/yH4L4SuuMbCSKmJZNhuzku4ptB9xSgHOBFgCOAWjS1zUeU21ufG9XCEcxfxBJqnIHcyGatB50EOGsx3NgllkhhjymYKz2w6i7Dz5yOiGBrRgCmRIOKtQ6P1HZMGcPjUbp6H0//ICRW4LpY0hKQu0IXn6jFPE3VML4AtBqiFd37RSmhvq0hXeEc7hdByzW/voE2h2G2GZUfyZkU4Zwq3ZiUKXH3svXMiWtKXlE6/gKJsa5a7iehE94/10ZUVlTyzQgdLU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a909eaf4-a639-4351-e652-08d630bb5e94 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2018 03:24:22.8963 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB1990 Subject: [dpdk-dev] [PATCH v5 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: Sat, 13 Oct 2018 03:24:24 -0000 add commands which supports following TTL actions: - RTE_FLOW_ACTION_TYPE_DEC_TTL - RTE_FLOW_ACTION_TYPE_SET_TTL Signed-off-by: Xiaoyu Min Acked-by: Yongseok Koh --- app/test-pmd/cmdline_flow.c | 34 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ 2 files changed, 39 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 4a2764270..3efc2d86e 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -256,6 +256,9 @@ enum index { ACTION_SET_TP_DST, ACTION_SET_TP_DST_TP_DST, ACTION_MAC_SWAP, + ACTION_DEC_TTL, + ACTION_SET_TTL, + ACTION_SET_TTL_TTL, }; =20 /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -836,6 +839,8 @@ static const enum index next_action[] =3D { ACTION_SET_TP_SRC, ACTION_SET_TP_DST, ACTION_MAC_SWAP, + ACTION_DEC_TTL, + ACTION_SET_TTL, ZERO, }; =20 @@ -974,6 +979,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, @@ -2636,6 +2647,29 @@ static const struct token token_list[] =3D { .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT)), .call =3D parse_vc, }, + [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/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testp= md_app_ug/testpmd_funcs.rst index 74769cd48..77233987b 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3739,6 +3739,11 @@ This section lists supported actions and their attri= butes, if any. - ``mac_swap``: Swap the source and destination MAC addresses in the outer= most Ethernet header. =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