From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0083.outbound.protection.outlook.com [104.47.2.83]) by dpdk.org (Postfix) with ESMTP id 65C8A1B3A7 for ; Tue, 25 Sep 2018 16:38:30 +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=jZ+x0o+4JE15hOSNZ4qC7kuVtGxbL/dgh3M1mGO1Xzk=; b=qj6ZMa9CAldmo6FqFg8d63ozJjH0joJ4vpobTjtCA3pCJA4mPYrJ80ALK0AJ++1LyIzMHScMdEQ+gIXcQcRv5BWxZCd95YfK8bF5ci6FOHewNwYQ6lLt13M1MAFf7weX7h3WyoR4jS0VmMRZF4nMQMIPgl9aGlXhmqIjBvLHS4A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; Received: from dev-r630-08.mtbc.labs.mlnx (118.201.220.138) by AM5PR0501MB2020.eurprd05.prod.outlook.com (2603:10a6:203:1a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Tue, 25 Sep 2018 14:38:25 +0000 From: Xiaoyu Min To: ferruh.yigit@intel.com, Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Andrew Rybchenko Cc: dev@dpdk.org Date: Tue, 25 Sep 2018 22:37:17 +0800 Message-Id: <20180925143719.23339-2-jackmin@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180925143719.23339-1-jackmin@mellanox.com> References: <20180925134718.18945-1-jackmin@mellanox.com> <20180925143719.23339-1-jackmin@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [118.201.220.138] X-ClientProxiedBy: HK2PR04CA0045.apcprd04.prod.outlook.com (2603:1096:202:14::13) To AM5PR0501MB2020.eurprd05.prod.outlook.com (2603:10a6:203:1a::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36cd5711-bceb-4b47-5a51-08d622f48f47 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0501MB2020; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2020; 3:jYx5Gg7WG2/Rn3rYxXdcJpNrGkUwiswtpQQ5keGgL4BSoODGCyU/QSTIrPRlaDzfzUZS/HpWce45bOgUqrlr+oWJQO5xshR3VUyhUFuySQCSjrGygbl5w03/sZ13syxpEUytySbKxEKf9cz5E1X9pxdr3SHgcbShuB31fNc2OF2cd9kx2GqCS05zDBiqLdFbhMknPwoVUN8cZxnsKtKYg/VvRk84ikww6ZEWrUIXTIJG/QWUIJtiVp1Gs972tAoT; 25:IJZT3aHktucGtJ8NepHhJ6sgI/0qXy19ZioIyaM+jnD7p0WA1cdEgAtfqIoq+X3B0Q0VBxEuRcclbz6MyVo2cd04hEuJ9g3eEkHQvZyU9DxtS27Cw39PV/rPxiOoWk9su/43yPZgucYF6ZyFOwBqsz3JOX/UsM+/gdWlDYvn7J+8/et9hrvpW5Oj/Td9+JT/Lonbul3TEjuT68QAZl4N5iLkrwCtM4Jbse69fhzTM5AKjp97i0saFJWT1JU2DAeFkRZgtgMi76AmHcjb0eKrhxNjPp8xwaoE/AlHNYTsT6j/aJ8WD+S2FndZWihFxMNjeEiYgHgbd7vouwITxIs5pQ==; 31:ieKBfQtutZNxxYcjZ76RZ2buPI7jwATtalQjMu8bSWY9D3NBjGPUuRwZAa8pHwt0Xp7UGLSg9rVwj/2YQHoFGovwnZACmzYj11DckYkQnM8riQaXP/MHAu/hP7Upxzu7TeNqxNCVyfpRbqQJCORuquRrzTdVoff/2i9apGzZtc71AusXGCZIkCOsUyghMfiChPCxiNyUs8Utt/one4BaVFcn/3VWRnF9CganjNl1g7w= X-MS-TrafficTypeDiagnostic: AM5PR0501MB2020: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2020; 20:X2Pg3nlDOaaWXsVX7gPl7bGfr4ijDqrmKmk0TJ7R0shsyBpaXTeKDNj1aMNflMrC3JFzvob/RKfXLXQqaM6x/qZCvdmyYxveFuWnjTs/bzehXPO+ocg6iOV6z/xqXczW8ACjZ1iVBLOZXVucgy1JB/WoRqtQIKiqdnU6s8nDzbYthse+g4Z+AxRLV0fS91Y9xuisY4042G1j5QV5dj3ZDzQhLEgXDz+0OlZ+E88sd8plRpm7ZQAxBCQ6a60X45oaAcE7nfXd9wK7org/wrfQmjCesJXqEjb3MYWyIZymcjILT4IWqAkG0/3IY8CdXEfq89iIklWtpT1K9nAdlVu/6CqVpkrzFzvxtp6L6bhpCt7zhMM0jSWOQqqgXCd6nHzXbWSNIcKv9ovVnTM9oJSdWAyba/moD3pv/qIjPVka73fOqXn3PIQpw/7+ubI6EKMR10kCO4zScxXfi3aHWJErqhtyeei5mseKQ9eDG2iQE9ZSxHfTovypYfRlgs5GmMq+; 4:64j2EPZy/Pxn/+yMBlzUmS0FEdcqFNS0CrGJMn5CAilJrXjM0nKSiRjTbGLojPEtbHUfgrIidZfScrAZx+LXIRoXqCORWUOKAR1ucXTahsyDdyFxWRt9DkhxoopRYg359lLxzW1oICLX866VM0O9bch8etBVWzQCuL1L6WVJhvXSEu1KwOJhKi6i/CMH0OAsdofqbGS4fRBfb1idobJPqWwKe34T5Hyks/b4XHP9Dn5w0cEI4RS4tJwpaDWMDET7AERHYT4XBx3/GrfNQHumkA== 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)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699051); SRVR:AM5PR0501MB2020; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2020; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(396003)(136003)(366004)(189003)(199004)(6512007)(478600001)(48376002)(6486002)(476003)(50226002)(6116002)(486006)(2616005)(3846002)(956004)(53936002)(68736007)(8936002)(16586007)(97736004)(110136005)(386003)(305945005)(81156014)(4326008)(1076002)(25786009)(6506007)(16526019)(186003)(36756003)(2906002)(26005)(316002)(7736002)(81166006)(47776003)(76176011)(11346002)(51416003)(86362001)(52116002)(446003)(66066001)(6666003)(50466002)(105586002)(8676002)(5660300001)(106356001)(34290500001)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2020; H:dev-r630-08.mtbc.labs.mlnx; 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-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0501MB2020; 23:E95dSWjIBB78ruXX5irbo32th2YOK3+dY85D6IC?= =?us-ascii?Q?S6OOSu7d3mKUNjPIibIV7e6pIGZ/CapTXiAodp+qMQAImgTxwqxmdmZVOYgj?= =?us-ascii?Q?1Ti+OidLAAfEQEIxWHv3we5AHVekOo6FpnGoGHA4d8NGXZaRaSe78Bn4A941?= =?us-ascii?Q?IAgYQbpOJFYXSF76sqgFW2v7mKuZvFi1JV8aoLbzcj9PVYnZFLdtsg4h1vwn?= =?us-ascii?Q?+d9tOTaCIs1RNb+i0ojBm4jFIb2NakaPKXcF9IPaU2x13ukX/xvbgMvE4uek?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xG/lYg4DpYqYZZvZbWh2grAOKsnBODLBte7ySu2srTHLmrq7a6v48x1LHZ012QhoPv9dtK3uJnkmgBd1BJlrjXyUT3udzqhO+aFw0/h+MY/aGAE0hmi4=; 7:w1hZo6DTTWdFxSXNNPnPHuNcf/heSPoePYLb+86EGNfqWN7p3TCqeYvW8e4FvwMQg+1k8P4BjPIpCRfIEyUEE/LHFMYwLbgijj552uiybLzXUBROiY+YGfg09bKHuT2ZvaphBy2bDd0lfb6k+BXQEkJFzz3bs6s4MsvrZTX3w9QQrec9XSEl5VhfqHEY2yf1GsuO7oMKy6UTDxhx+4jFZ+KzaXetzHcZf+eDtstcY4x8ZBukI67HkR2rCInaqVz2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 14:38:25.9450 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36cd5711-bceb-4b47-5a51-08d622f48f47 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2020 Subject: [dpdk-dev] [PATCH v2 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, 25 Sep 2018 14:38:30 -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 --- 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 4faf8cb40..3aec0834b 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 | +---------------+-------------------------+ +Action: ``DEC_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Decrease TTL value. + +.. _table_rte_flow_action_dec_ttl: + +.. table:: DEC_TTL + + +---------------+ + | Field | + +===============+ + | no properties | + +---------------+ + +Action: ``SET_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Assigns a new TTL value. + +.. _table_rte_flow_action_set_ttl: + +.. table:: SET_TTL + + +---------------+--------------------+ + | Field | Value | + +===============+====================+ + | ``ttl_value`` | new TTL value | + +---------------+--------------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 409c79741..631f80efd 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -121,6 +121,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { 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)), }; static int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index c80771b25..b41e37a31 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1547,6 +1547,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, }; /** @@ -1955,6 +1975,17 @@ struct rte_flow_action_set_tp { uint16_t port; }; +/** + * 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. * -- 2.17.1