From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40045.outbound.protection.outlook.com [40.107.4.45]) by dpdk.org (Postfix) with ESMTP id 2D0C51B579 for ; Thu, 11 Oct 2018 15:27:18 +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=Glsw8D9IMas74ddfk44mgXQmexaK4zRAEdlaF2Dekqo=; b=MCHvsjPqIiN+emU5CqZAjmrdxflAhgCclTuTYTcE21aPJxAJPeJEEkfcEPfsjMM3MDPKSVCtL2/gTduUhNQVIVub07kUiGXmb7ovPl+Zfv2dWQOTZ4UnIrOUJiiZRgWjUzoNc68FFeST2ryzdlubZxTx0Cscr42bp+WTEI5L3p8= 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:17 +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:17 +0000 From: Jack Min To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH v4 1/3] ethdev: add generic TTL rewrite actions Thread-Index: AQHUYWYgV9vSLmrceUmopPRXA9y/Nw== Date: Thu, 11 Oct 2018 13:27:16 +0000 Message-ID: <20181011132641.1000-2-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:mBvwROmmYx6qFzvj66oPSUH9P9sW8syvl+yLwvMYQo9z4Zd3EK8aAduqyU48/1WI5sB79Zn4927t4KN2M/CiQAt3fcradBkzYbjWR4hSzE6fAe35fUp+gBJUxcSY1fBx3GGvZgP1geCJlReU9t+vldS8U/4Dict0NOblN9S9HbwVzUuL3h0lDaeFSyyK/BTw75/uMYxoq9bFAy+w8LsfWESyGmi4VU0E7aMKB7nO7Dm92UbTSh0u3In4vkYgxAGtZaHyswwKM6HlgRfpkMQ6wAs+Vxa+uEueyIKFGaI5QQqNES1y6fdOtUgFHGz1H1n0IvfQe+4LZQCqj/t8sSWGeyRdoaA4owWzltjBDVIsaxoBpdTwSsZaZLAQbPu5h0CGUgcRieJPsOjQqdnaAIBt0Q4ODuOZuACIYVSKdl4GGy5N8qza7zNHEQMB4uZURqFftEqkfR8EczvTbPcSSsi7fA==; 5:cnZHKEpwb9219wPBmrVtbXIuipb6qjeknMdBvWpck4JxCNXVZrnQogh4/vQnaxEmTxcfhALeHRB7Gtk2gK2DVkZQR9XdYQhw7jVJ81YR9cVY6KMVqdol27ItY3E2PoUAkTV4sqv6qJYPhgtXX3JtqPOKes6oQYDdHEjmWb3p1A4=; 7:S0DzFQP9uj1HNeawRZ/LkaC/0QIUbhcgpEJ20DRYgTnhnRhKchCgUrRITlBXGAG/0RYtETJOJ9YVkV424yaaoQ14L8I2Z82OhBqfebMYp/hAx+Bkm9x6H6JYrLfoVsv8VqjtkKbHnWpMm0V1FgvnLSfagj35NnITRKJiWaRmBWpDFCl+JHjH/cWQe70tuiNBP7qJQEnkdqJ1tIY26B3uo7vKiHTBJngciC29FvCk/0n6V1m8X/738j5hVMBj5sSf x-ms-office365-filtering-correlation-id: e5ccd235-23e1-4140-1d5b-08d62f7d4350 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)(41533002); 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: CXJhdbVD+dquguhHjdgCTG1hntAWlMzFmiEnOhlwX9c0zE8Kv1ANQUHBHb58mvpc3xLhWSkd8C5df3TsWjLxXIePBs3WzVbe2KUD+ebckqaTfUWBcPy/vwvhRCPbyGVHyklU1CZbxWi4yC7QdBYY4ETN1eOY+4Q2tA8P0mE3D353tc2+IFINvzI5Y16HwxiL9F7Fd7gRLXDJoAxL0NJEXWfvP3gdQXZ110TZMmKlKgVJihWFkP2e264uJ260k5AZ/HeFgft1xbMbS/QYQG2jdAPhenuSuudfdItXamFTjSKbmtt48BJ+DAHTvzT7T13su55qxkuKAvGEeAXR2vf0cPlBxxc925KSlbqW+3ZvszY= 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: e5ccd235-23e1-4140-1d5b-08d62f7d4350 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 13:27:17.0151 (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 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: Thu, 11 Oct 2018 13:27:18 -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 | 24 +++++++++++++++++++++++ lib/librte_ethdev/rte_flow.c | 2 ++ lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte= _flow.rst index a5ec441c9..9fc5b88f2 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2197,12 +2197,36 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be= returned. =20 .. table:: MAC_SWAP =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 | +---------------+ =20 +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 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..f102e6939 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1579,6 +1579,26 @@ enum rte_flow_action_type { * No associated configuration structure. */ RTE_FLOW_ACTION_TYPE_MAC_SWAP, + + /** + * 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 /** @@ -1987,6 +2007,17 @@ 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 + * 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