From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0080.outbound.protection.outlook.com [104.47.2.80]) by dpdk.org (Postfix) with ESMTP id 111BE4CC7 for ; Tue, 16 Oct 2018 10:14:29 +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=yqjT5SrrGAC3m450VE965mNhAVrUH2bsrlpVGTl947M=; b=gzmPraxHoB5NA9Bl8IFnisYf/fdxB1l0PAdcJgPmqvOeb8B81grK5Tug2zjJk9MQ9UbVYZd/aifGW0V4AQUHXLIKqxvA2517Ya1vp/NELuyQWPU7faKKwZftUwrBSMahwqjKznAMfuCCUCaFFej3vQyggaHuY9vXAGseQ6Yb5Hk= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB2423.eurprd05.prod.outlook.com (10.168.73.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Tue, 16 Oct 2018 08:14:28 +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.1250.020; Tue, 16 Oct 2018 08:14:28 +0000 From: Jack Min To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: "dev@dpdk.org" Thread-Topic: [PATCH v6 2/3] app/testpmd: add commands of modify TTL Thread-Index: AQHUZShBUgHFeAgaAkWGGtIiW8r8rw== Date: Tue, 16 Oct 2018 08:14:27 +0000 Message-ID: <20181016081350.24765-3-jackmin@mellanox.com> References: <20181013032348.26380-1-jackmin@mellanox.com> <20181016081350.24765-1-jackmin@mellanox.com> In-Reply-To: <20181016081350.24765-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR01CA0012.apcprd01.prod.exchangelabs.com (2603:1096:203:92::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; DB6PR0501MB2423; 6:vDQ6ENkva2eXNURkBwjQfKiuOaj5zd2FtZpyyDQI1xnJu8QDlegEFtAFrGbvDq+FA7gY5qUURy/ZKygkL8a8N/Qs0tLFtcgAuu4MXtBy9L1s24c4FJ23k2r7X2q1vkMfWa83CHwJ7G1EzM73kBK/gZP9f5NZNshfwwdDKSIwQ+krnzcSmVmSZo2R0Zmbte7Ses4yIf6gnrrTxwxlnA5pWAarM8wfIrNeDLsn75S3+X+QaIyR1tuo5ju8QF+oLazWgZ7KsUklMOn1iW9Iy9lh8X8GstyiMh2PebU2pElVPVDX5EBtMRUhIMCkd6PIraDKbhtZi88+jVGfea4n4AVsvwuj/tQx8Aqm3Ee7fDz41Ze0AePJMhwP+XJk+QMsI30lnEjJ3vCxk7ZwR/mlvYIC9yMWKrHz6SQYsvb9SsAGljNkJkvt87q8EQkpfsjwJwaMBjmDArzJEOAZsmr0hHU/zg==; 5:Gy4ihzMhUUa1NRmT/DQZbSYJ69rs5lQz2FTXOnecPmor6wU+V7vlZrX7teWVIIYT9/Y/fjD91eMSQh1IBVkburVmjL6IUZOykMejx25FsmZOCSUmgX43YpAV5O+oKfLoIogdmaD8+D6pOBptVQA11KFYgrt3G4P6l2OkEZfUkfk=; 7:Ef7gw1DD+NbcvZjx2G1Tfp0U7T+xTgZSSSlUEdZMqAjjbzUnW6AUK/0ZaYuuEI/2MnwF7jJDM5rk7i7AVVl5mzxNGudbTpG1w8gasWsbqplBUp2VOR7O0DILNb8n5GASB4f4VPmMQzMRkmqt205b5YpnjbBCxJB6NyoVlQoJ7jNiYKjhP3Os63gRKdKxXZ9AflLk/83GqzmPHpe7HC88Fgia08Bcde8vTSzuoj1loKWzLjc7Pv+vhgG+2GxQJBi4 x-ms-office365-filtering-correlation-id: ff2d3221-3222-4d42-22fa-08d6333f640b 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:DB6PR0501MB2423; x-ms-traffictypediagnostic: DB6PR0501MB2423: 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)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:DB6PR0501MB2423; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2423; x-forefront-prvs: 0827D7ACB9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(366004)(376002)(39860400002)(136003)(189003)(199004)(106356001)(25786009)(8676002)(105586002)(5660300001)(7736002)(68736007)(305945005)(2900100001)(6486002)(486006)(476003)(110136005)(8936002)(2616005)(5250100002)(6512007)(99286004)(53936002)(11346002)(446003)(81156014)(81166006)(14454004)(6436002)(86362001)(6506007)(386003)(4326008)(66066001)(52116002)(76176011)(316002)(478600001)(71190400001)(71200400001)(2906002)(256004)(36756003)(3846002)(6116002)(1076002)(97736004)(102836004)(186003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2423; 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: y4LXJQJah2CdUVuIwUnnOlm3JrED6eSluP8h5v+/ZwkZJQdc71rCN/ibmaiKKHOp4HqOnbgbG34cGeJlP4l0cdGHWRlFKxlfSXiDFvsVUH9WJ5dwrnINzsuvSTZX4zWOOIzJc+kLs6ZIWekhKNyaLXq8SGH0fAdDkEVYKRRuMDhuMShur97i8Wbm4p2BPJdqzXIRIthcLhqkiWOM5b2SG8IrmcTo68Yq15UoLAXIKFzn/w2N5AS/yVZwClwT21lYL91Ndao7JT5NZuMvIYfq+xwFV7IQuowKDihj+ngLsRMTtRHWRtI1PwZyUPkQ2W4esGV16Y/u/7VL/mQEFggE20OWphNrAWWGbn3TeZNxCNk= 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: ff2d3221-3222-4d42-22fa-08d6333f640b X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2018 08:14:27.9446 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2423 Subject: [dpdk-dev] [PATCH v6 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: Tue, 16 Oct 2018 08:14:29 -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 ca060e108..02612cc60 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3802,6 +3802,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