From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0047.outbound.protection.outlook.com [104.47.2.47]) by dpdk.org (Postfix) with ESMTP id 675351B5BF for ; Wed, 10 Oct 2018 15:05:51 +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=g7H6uKFKXKbJ7wRNCE91YMvpbpiTfsVrzzacYPUWxeA=; b=ALq3wCUQLgWp43YGW4VGIjOCr0eqllnZNC/En/yLIbdpIFEcF3Wci5cjRzdWt/WPXQrJGjCYOdQUkQFwXQoZtfnHMIIMh9a+3sL74wi7I7DHGlO2S6YYiQRUsEZWN1BjQ9vHqCtfbiUftSa6IiSUqTtYB66lLVUApfrgWSmffgM= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB2327.eurprd05.prod.outlook.com (10.168.56.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Wed, 10 Oct 2018 13:05:50 +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; Wed, 10 Oct 2018 13:05:50 +0000 From: Jack Min To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 1/3] ethdev: add generic TTL rewrite actions Thread-Index: AQHUYJn3ns98KWIRkUu0qs20hJ3i6Q== Date: Wed, 10 Oct 2018 13:05:49 +0000 Message-ID: <20181010130524.23590-2-jackmin@mellanox.com> References: <20180925143719.23339-1-jackmin@mellanox.com> <20181010130524.23590-1-jackmin@mellanox.com> In-Reply-To: <20181010130524.23590-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR01CA0102.apcprd01.prod.exchangelabs.com (2603:1096:3:15::28) 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; DB6PR0501MB2327; 6:d4fSySt5gB9mfH4g8mgX+m+Xav7PZZsaTiQcavm58Lu/oUxSI5vuWW0MCtVhbWGMuEz7in2tx6aaHkgkOwUhld3vXdRL3c0zxADBZTSYUwCZEs5yTEvba0MHGYxdbrw/IzjgkSJEOadwwdVB3OpEgk/KjrYZY5AM7X5ow7oG9WsBd2CIKCj0bDe3RoRsdDvJ8sqGBFDeitBzZFe9TLuQCle4kXch4MR5RXJMHM2u3hBADUTEYYxLsuJfB1L3NLKghfv5SEshgSdi/j4YjQWpVHTT2N/6tXahGOH+WMaHM4SWVPckA78JLfuCIJqYc4f4X3HE5WET+9hpOze8sZ1psPdAogOtVx0DZ0E5WteHlnHCjWZ6iMr03IOiHrVK1WWf3V7XarEfhq5nu181IPbg6XuNLWLls6zVhxd9ZERHUKr1Om5fN52VP43K4M1elo3lSrl0XnYliivzNpW3krgk7Q==; 5:OPGflVMxRbbDxf1D3Kg02FmUP63ZwJosA/IvT3mO/WRBCo1X791JLCNg/sKeqGV62Vs6IezezqsB/tmawhclIbpGIoiR/5vaICSj4M8yXG3AXrer8qT8t+F48cinsKvao32ejPRzrkn0SdzN2mqcSIQONTmR8kkgy2UxUZHgkVM=; 7:q5410X/LDxrITeurJmKJROiR0AEaBJ+xFjJ6ccU7NUm3fnERSUOWhmtU2E460NNxjm5bpzF8XY34FksrCGol6AwGd1CMu0SL1WFverjqDHhuLOsLK2gXoQw6/9Ezp56sLTJOwv3FIyTAZtYFbo+i5CbMv6zYue80YKieKyar3/nPuihQ00FUa0UHhzpKa0M5qJ7i0nj6Gw9zj6+zfBNxNV6CIpurRxue+aa07KsGsnnCHq6ZbXi0kbeddaX4/4kY x-ms-office365-filtering-correlation-id: 80549d49-ecec-42e2-fd6a-08d62eb119c8 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:DB6PR0501MB2327; x-ms-traffictypediagnostic: DB6PR0501MB2327: 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)(93006095)(93001095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051); SRVR:DB6PR0501MB2327; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2327; x-forefront-prvs: 08213D42D3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(366004)(376002)(346002)(136003)(189003)(199004)(97736004)(6486002)(186003)(7736002)(26005)(305945005)(5250100002)(66066001)(71200400001)(68736007)(71190400001)(53936002)(8936002)(102836004)(25786009)(2900100001)(256004)(6436002)(6512007)(36756003)(76176011)(81166006)(446003)(86362001)(316002)(105586002)(1076002)(2906002)(8676002)(3846002)(110136005)(11346002)(386003)(476003)(2616005)(99286004)(478600001)(106356001)(4326008)(5660300001)(6116002)(486006)(14454004)(81156014)(6506007)(52116002)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2327; 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: GGcuQVDnrbK7G7gHEZTT5kZHKsNIQV6DtZanp+DsTFOkIZ6W1xxFUh1BU2vUcsZhD20aNB4soePhw0RV8+1WLclJhPdpTD3xeUH3sOdFUhF8GTz3Umqd3h0sl0UkvUy1kfz0kym5MlHDiEv4wiO5LFFE6tXtRYRz97ZEzsto6QutJcG+0kQbcr09tOeAgrc4zGlbcDJyo/jelmyGvcQlGzRYLuerXxzwtcBA0OY2cIYMi1izq6oeUFH7FuGBkyeCJr2tg2TLbug02ieLxpLNnbaglBZZ/AlLelAyr7V5q+FUC8lAn9+kI9VqbYAz/uZ6O55fioMwCmkkZQoK/y6zZRPkShUjXKsuJdb2j1MjQ4Y= 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: 80549d49-ecec-42e2-fd6a-08d62eb119c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 13:05:50.0101 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2327 Subject: [dpdk-dev] [PATCH v3 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: Wed, 10 Oct 2018 13:05:51 -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 | 30 +++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.c | 2 ++ lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte= _flow.rst index 93daceca2..e8df1e488 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2166,6 +2166,36 @@ Set a new TCP/UDP destination port number. | ``port`` | new TCP/UDP destination port | +---------------+-------------------------+ =20 +Action: ``DEC_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Decrease TTL value. + +.. _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. + +.. _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 4eeb392b6..458a05994 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -135,6 +135,8 @@ static const struct rte_flow_desc_data rte_flow_desc_ac= tion[] =3D { 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 static int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index fe7e2434f..bb07eba9d 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1548,6 +1548,26 @@ enum rte_flow_action_type { * See struct rte_flow_action_set_tp. */ RTE_FLOW_ACTION_TYPE_SET_TP_DST, + + /** + * Decrease TTL value directly + * + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a + * RTE_FLOW_ERROR_TYPE_ACTION error. + */ + RTE_FLOW_ACTION_TYPE_DEC_TTL, + + /** + * Set TTL value + * + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a + * RTE_FLOW_ERROR_TYPE_ACTION error. + * + * See struct rte_flow_action_set_ttl + */ + RTE_FLOW_ACTION_TYPE_SET_TTL, }; =20 /** @@ -1956,6 +1976,17 @@ struct rte_flow_action_set_tp { uint16_t port; }; =20 +/** + * RTE_FLOW_ACTION_TYPE_SET_TTL + * + * Set the TTL value directly for IPv4 or IPv6 + * The RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6 + * must be present in pattern + */ +struct rte_flow_action_set_ttl { + uint8_t ttl_value; +}; + /* * Definition of a single action. * --=20 2.17.1