From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60065.outbound.protection.outlook.com [40.107.6.65]) by dpdk.org (Postfix) with ESMTP id 9ABC94CA5 for ; Tue, 16 Oct 2018 10:14: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=HJgUZyBg23c8Hxm+WRC6ACCdlXsT3l5LbwgZL8ZEmb4=; b=XHnknEPBKe8NZ/p6s2XBnmT1JSJ/SAEyFRw2nXS5Y/IKD0lq652EZ++lKN9XQ3QZumj5eGTRY88WDCTWtlmr0FvvohWemMJMIqH0trRLdbNQQEX/rpRbsn0vCOohxyhdgixmCnjfHYP/CYxQcDSdvsNc3Ovtl5BMOCZPoLMk3RQ= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB2726.eurprd05.prod.outlook.com (10.172.225.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Tue, 16 Oct 2018 08:14: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.1250.020; Tue, 16 Oct 2018 08:14:23 +0000 From: Jack Min To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH v6 1/3] ethdev: add generic TTL rewrite actions Thread-Index: AQHUZSg/gHVh44VSukaGRwhnAehD1A== Date: Tue, 16 Oct 2018 08:14:23 +0000 Message-ID: <20181016081350.24765-2-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) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [118.201.220.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0501MB2726; 6:Pzs2dWNyqGdzJI9pze3+zwH3BaoB/Wt+5BAUUYJ0Zf8CGdabU1zoEvtGaVt7jdFWYCLO14bdsbaBXHx8NI8mq7VEWW4uY1dtSkz6gIIUYzb+QMZhMsVyNsiZduwuT5An+vfW3X9f0J4NB79SjpO6m8Crhp0Adhj9hcv9eHsojgi+xr3hNAEtqqqOgwQzmFl4opB3kgVfMW6QEMAVQsmAfjNd5wx6qWTULXzmauxjafTXyqYPbK9QunIR3A+C1Fuq8R+VSGUe09H/3ZuU/6OyAQzXxD1t11ylTBDldjWqQHtMf6gMM/uBuLl0McrKsbjI0LhX5fqP3uJn1TL44GmkSU2CBgfVuEKKTPs1o9tJla24sSLfC/es7y+rLJVs5w/iHmr3M+MCEQ3Ix/8hxw63Mnb18qJfEAw0xUtVb+9fzc5DMaogS/ZiG74lXuVyRcfYRj9zlmVQsNqzx8E6TUfejw==; 5:csC1n8IHMoMvfYibgU+1zyGyKrQOuTZFbbT4DTVS5MACb1MzPtlVp5td1k/cgCsALfBW03wkqHuZqqZEG4G/QfVMzGoLz58y3+Xq0gaJURM2A11PqrL3gwkbDHUR6Xev/oMtzvReWYcydtANdPuABsUDPo5+zpfKC5n+o+aOCsI=; 7:8gmvLCgMRctWZjAXDukeFk4AikOq/HJttuHFv4O3vjKmfO9fcbhMUvTC7xYMqc0+cunuKDWYWZkJL5V0OhC+RfFel1LKwqT6Fc4Nzw9f95ZETFSwpgDaNlCKyPya4ef/lbcccr6PTxyq4T7DxU9y+fdRcoIc8D9DMsRAvym76FjXMxt1skLqygpxPYc974N+B+n8W9uYObSvCgWC3pKXw+99jrRV+DkRmP8LoA845ONYzOX6f58E+u5ktbjgV4/F x-ms-office365-filtering-correlation-id: fe7c1d75-7ed8-4507-3f5d-08d6333f615b 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:DB6PR0501MB2726; x-ms-traffictypediagnostic: DB6PR0501MB2726: 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)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:DB6PR0501MB2726; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2726; x-forefront-prvs: 0827D7ACB9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(136003)(396003)(376002)(199004)(189003)(71200400001)(25786009)(86362001)(2616005)(7736002)(5250100002)(478600001)(476003)(486006)(305945005)(102836004)(11346002)(3846002)(6116002)(4326008)(256004)(446003)(1076002)(8936002)(316002)(5660300001)(6486002)(81156014)(6436002)(8676002)(386003)(36756003)(2906002)(81166006)(53936002)(186003)(68736007)(99286004)(52116002)(106356001)(26005)(14454004)(97736004)(66066001)(6346003)(71190400001)(2900100001)(105586002)(6506007)(110136005)(6512007)(76176011)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2726; 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; x-microsoft-antispam-message-info: Fopb3cM/MJKLt6J+x3Or+ckpjFq7X1pl1mwEqmSJe7XqfEVAPZikVuFDRc0hZcYukO41WFH2GG50O5P4vFZJi1CPaoJAR+oQO16E+AbFDBX5OdhhvdhFGRvpzgKYscYNTBdpfFvIBAsA9n2uU401ddD7LU94yAHbkyph7zaelZpiCJsuSMTPAGRyrtZDh62hCn1vFuay5L8Pi6REXuiYWMmIlBWOaHpklwqaOX1WcfBTpgw9t2IpOYy47eEDUjoB1QCykyIy5xHboKtpUDUfFddZy9DP4YKvNEAJW/IGRl7WZ+ZVxoWjMZRkrWChU4maW8/mHDo+G0hMYcq4SyH1YJp+1KBbdhsGNxqBsxtW/qA= 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: fe7c1d75-7ed8-4507-3f5d-08d6333f615b X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2018 08:14:23.2053 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2726 Subject: [dpdk-dev] [PATCH v6 1/3] ethdev: add generic TTL rewrite actions 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:24 -0000 rewrite TTL by decrease or just set it directly it's not necessary to check if the final result is zero or not This is slightly different from the one defined by openflow and more generic Signed-off-by: Xiaoyu Min Acked-by: Yongseok Koh --- doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.c | 2 ++ lib/librte_ethdev/rte_flow.h | 23 +++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte= _flow.rst index a5ec441c9..e76632907 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2203,6 +2203,42 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be = returned. | no properties | +---------------+ =20 +Action: ``DEC_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Decrease TTL value. + +If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6 +in pattern, Some PMDs will reject rule because behaviour will be undefined= . + +.. _table_rte_flow_action_dec_ttl: + +.. table:: DEC_TTL + + +---------------+ + | Field | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + | no properties | + +---------------+ + +Action: ``SET_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Assigns a new TTL value. + +If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6 +in pattern, Some PMDs will reject rule because behaviour will be undefined= . + +.. _table_rte_flow_action_set_ttl: + +.. table:: SET_TTL + + +---------------+--------------------+ + | Field | Value | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + | ``ttl_value`` | new TTL value | + +---------------+--------------------+ + Negative types ~~~~~~~~~~~~~~ =20 diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index bc9e719dc..5040c7667 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -136,6 +136,8 @@ static const struct rte_flow_desc_data rte_flow_desc_ac= tion[] =3D { MK_FLOW_ACTION(SET_TP_DST, sizeof(struct rte_flow_action_set_tp)), MK_FLOW_ACTION(MAC_SWAP, 0), + MK_FLOW_ACTION(DEC_TTL, 0), + MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)), }; =20 static int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 68bbf57d0..79bcb292d 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1579,6 +1579,20 @@ enum rte_flow_action_type { * No associated configuration structure. */ RTE_FLOW_ACTION_TYPE_MAC_SWAP, + + /** + * Decrease TTL value directly + * + * No associated configuration structure. + */ + RTE_FLOW_ACTION_TYPE_DEC_TTL, + + /** + * Set TTL value + * + * See struct rte_flow_action_set_ttl + */ + RTE_FLOW_ACTION_TYPE_SET_TTL, }; =20 /** @@ -1987,6 +2001,15 @@ struct rte_flow_action_set_tp { rte_be16_t port; }; =20 +/** + * RTE_FLOW_ACTION_TYPE_SET_TTL + * + * Set the TTL value directly for IPv4 or IPv6 + */ +struct rte_flow_action_set_ttl { + uint8_t ttl_value; +}; + /* * Definition of a single action. * --=20 2.17.1