From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20041.outbound.protection.outlook.com [40.107.2.41]) by dpdk.org (Postfix) with ESMTP id DACF21B562 for ; Thu, 11 Oct 2018 15:27:22 +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=le785APOZFSN7Dneh3rne+dHfoGHbPAdr6uMitEo68ZEmfCa0vawFM9tvoOY2rSOrCYw5aHM/thsGYWhRQbSjhmgVpig4fCjhzUmvpC0vKds0Z7brV5zIW7B0MibbuOMm1jnXdrgVudMrUKW/0UsfGGpHyK0ltq/mZ2R7mjCln8= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB2568.eurprd05.prod.outlook.com (10.168.74.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Thu, 11 Oct 2018 13:27:21 +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; Thu, 11 Oct 2018 13:27:21 +0000 From: Jack Min To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: "dev@dpdk.org" Thread-Topic: [PATCH v4 2/3] app/testpmd: add commands of modify TTL Thread-Index: AQHUYWYjoxFpeI0KIkGe/QMhY9cgjg== Date: Thu, 11 Oct 2018 13:27:21 +0000 Message-ID: <20181011132641.1000-3-jackmin@mellanox.com> References: <20181010130524.23590-1-jackmin@mellanox.com> <20181011132641.1000-1-jackmin@mellanox.com> In-Reply-To: <20181011132641.1000-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR04CA0077.apcprd04.prod.outlook.com (2603:1096:202:15::21) 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; DB6PR0501MB2568; 6:xMY/SA+09BTff/OO58dorN1UDbZJjg/+AlMYNH3m6dUmrhr2DIBYGwwTuvQYUeqQiADx5tiatFlCSLGagXPO9ZOphxgVcd/HFrdb6kaiFt2WTUmPM9CfOSq5pvQeNyuB29rLQAdRnuR8SKLc3lwfViazK4saoByT2aMlDLeb4xoPDESgPd3pUef5q44tesqPBk2w4fQn4tF740fI5pgL3c3NKvn7FK8Brv2e0pPNuxPcwQv+ATTIRgW3RwpAYJ4PCj7hN316INK1Uhrn+b59QIyKuIIEdTRZqCTXYDenyWhp7BGJ2kBSQusOMCX7cDo6mnTzSDGdqmR4J9hnMySPJ90NIbT/G890JJ/MEK3tKMkmAWWUnaezKMTToxYjqfw87Yyz6iBTE7xSIGectCjIQSCEDmYXL9kEiMZpOaqlFUBFkq+aNu8GKZcCiTWPUGZJ60/p202v64tj0BEc8GeBnQ==; 5:dXp00twinzcsw/JBz3ZED0kSJhoL3AJaSN22i5qfY/uV8GOo6UFUtAIGcurIQG0mnxFzHw5tHPEtk3Ns/vq4VHjB/mOJ0cisWS0SGegr6KPjlkX2cRVFdIQlSN1/ThHajFTmXVdpv3XCn072EV5qkYf6n68+HRa22XFJwsZKZ/k=; 7:W4KsX7nWKGeiB4Jwe2uaeBnWkwy8SH+pVeBWpBK6/ljPkTHRf3aO9zxRUkI8veLf3ZhHQuJzr6sIPTRIDxLUm8uhq0TTbjjYpqkymxs2Rivy92IVhFvGqQ0JH8Zmmk71iuiyQnnJf1WHwc1yhNa4jP0vDG9zlvBtfBnCVF2lfpOqUkFUz91Z0zP7KcA/yTZlQbbStvn8+BW+SgWCVFnDcLcs39eVtOj/IPcYJePCKSJPvQ0FfI0AkNwPitDLPVDY x-ms-office365-filtering-correlation-id: 6ba95918-fd45-4baa-f46d-08d62f7d45e6 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:DB6PR0501MB2568; x-ms-traffictypediagnostic: DB6PR0501MB2568: 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)(3002001)(3231355)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:DB6PR0501MB2568; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2568; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(396003)(376002)(346002)(136003)(199004)(189003)(71190400001)(316002)(6116002)(66066001)(81156014)(6436002)(8936002)(8676002)(110136005)(81166006)(2900100001)(3846002)(2906002)(5250100002)(7736002)(305945005)(1076002)(6486002)(71200400001)(5660300001)(97736004)(186003)(11346002)(446003)(53936002)(478600001)(102836004)(26005)(256004)(6506007)(86362001)(68736007)(25786009)(476003)(386003)(486006)(105586002)(4326008)(6512007)(36756003)(106356001)(52116002)(14454004)(99286004)(2616005)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2568; H:DB6PR0501MB2023.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: FTVv2Yu5H9He6+0nDOZW214iY1DHcMoenI5r/L9SlECzNjJd6lYF5KPhG9hCiK16ltL38MKz8lk2+6iW3RNDBt49oaIKIF+sB7Z2Ie0nxiTLVzpBlPXeOBxPdY9/asEIOQt43sNCv4XlNLsBSSfhtURPmn6Pm7f/G5qtAcCJzDGPJZZtGUWFhPvstNvHBih1hFTLz2qFlsKKZq73n9T+xcVydyOX/O3aTh9veiEiG0UuUUrzQDur30iJLidXu2OpLR2ygyobZD0dUSEeei92Z3kTjtiLseU/8xmY8cwlRfug0jEwLCfj+YwRWrQnoEopK5gWbeQ6F/u2hLBkj1GXHj4Ak8NSHj2egpYBbqjjWDg= 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: 6ba95918-fd45-4baa-f46d-08d62f7d45e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 13:27:21.6247 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2568 Subject: [dpdk-dev] [PATCH v4 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: Thu, 11 Oct 2018 13:27:23 -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