From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59DDD45831; Thu, 22 Aug 2024 22:28:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DFB142F6B; Thu, 22 Aug 2024 22:28:36 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2046.outbound.protection.outlook.com [40.107.236.46]) by mails.dpdk.org (Postfix) with ESMTP id 7408942F57 for ; Thu, 22 Aug 2024 22:28:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xN5K3KH/RqBbq9QHaSjN0QI2ndVtZ8dp+aRausattNsIWfVHj1tkXZm3mOAP3Vi4SkRYgRy1Xy2LTs2oHwbaqixdCumpB7uiG5XxgBjhbIKIuqWBPcCfzZqkIQ7riFvs4hPF8CuduueP6S88skYsPioddPl7c9gg1ER8j5F/rZg8bzaoaIyvNEUtuOTCjVml3h52qyeJisehIkb0Z63rNX2xGc/s6IIvc5rSsIEllFZjhFXxhpZfnJrLNH4fQOgnq/eYKAcU9lEaNGzLH6y2zu/WSpPNq6H+RW9VHS1+05upVnF5ceSa2k7VrJ5UGmrwXzeMOp0tDcfJx0Rz47R3Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MA4/AFqXsddcOjTigQr2hwN6e7ozlrj6PIK3AajDNcQ=; b=T+k0WMC03pE3Dyu+0lyelDJ9CikCfwcmqehWquZUR2Xujj4J+UkOqmiFPXGN6ROqT47Tdk2NsN0+HyVG5ESuS98wMRknAqMHHPg9wM88v23HdmUS3o79dqiTzHH6ls/L6ZtdTz4N033R5W/JwjQ79OXyPH8HD2zzLKUJu+xR0ft4wTP237O6aRLVoSw0Ned2FmIzuyJf9PTkyFbz3cnyr5qFy0bErcO+7hwfzxaR5cusgefnKZtTnWzJiV5/aDcxUrwfwG3yv4whmHrahZgxvWO4aVZRteJMr1zOf1gMBsMcb6WKYNUSkcrSBowjHbuLLEm/1heseaersqABkNG8eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MA4/AFqXsddcOjTigQr2hwN6e7ozlrj6PIK3AajDNcQ=; b=MNKz0nPVzurLfMF5a/tmkHgZxgsYHiqyBK0T3+RbYLVDMA9TnaciCqOlhEhatndbxZi/lu+6GsmhKuCPl1OQnZ58tTJ1ArLby2xJvcOI9bI9jIkwBvIP810kDzI6y/nDpDUE3SthB7r17AcGzncayyiuLhl1K6FtC/JEKRWYQi2+bVXgTrUcFrE8pnhYw9tFu8K/1AYtC0qcr06IsnY5DKgegqprMHy8fF5xxDa/ww/7AH3C3FDVLQrvKNGU0JhI2gUDGxCmqZPnHAqHKv6fr/EBtYCer9cabh2Kgq3wdVXblU7nF4CdsTEw+qrfH2uYPVzKgEn/v5cPmCEAnckVEQ== Received: from MN2PR05CA0024.namprd05.prod.outlook.com (2603:10b6:208:c0::37) by CH3PR12MB7739.namprd12.prod.outlook.com (2603:10b6:610:151::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Thu, 22 Aug 2024 20:28:28 +0000 Received: from BL02EPF0001A101.namprd05.prod.outlook.com (2603:10b6:208:c0:cafe::9e) by MN2PR05CA0024.outlook.office365.com (2603:10b6:208:c0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19 via Frontend Transport; Thu, 22 Aug 2024 20:28:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF0001A101.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 20:28:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 22 Aug 2024 13:28:12 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 22 Aug 2024 13:28:10 -0700 From: Alexander Kozyrev To: CC: , , , , Subject: [RFC] ethdev: jump to table support Date: Thu, 22 Aug 2024 23:27:53 +0300 Message-ID: <20240822202753.3856703-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A101:EE_|CH3PR12MB7739:EE_ X-MS-Office365-Filtering-Correlation-Id: 3449fa5a-96a3-4d35-1b19-08dcc2e8fb75 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9a9iNRAQNpWLrS4A3QGGM41fOPV/Q0FF1TKvXC5sJOvfYLNVjuHOHCRuJQB8?= =?us-ascii?Q?998Ku2xx8qB5K8V/3/2q+E34Ak2ir54iDK5PrOHTbhWDpJRSFuqQh6DctJou?= =?us-ascii?Q?yLS5v1Gs5txeTGl9dEKNEkUltRfneqffPTAx28LC2snXcavSmEOWLIlYDIvt?= =?us-ascii?Q?lXcpU2bL/6bfonUeRw1mbYNC4L1YcPepC+rdgKzFo+821MhMHDmqGPotjiKZ?= =?us-ascii?Q?+A3odwKTVBPx0d2RdRUMheZeI5YQcKJy9WGCueF55+BvgkXEPvnLsu3h/Chy?= =?us-ascii?Q?Y7HYqdg+ztzwC02VVzrNf6CcUY8R4kL8LpTanqU1Y34aiqJcY4rfq5KUHIG7?= =?us-ascii?Q?T9Czz1XAut7wmB+UhKbh3wja5ksXqgftaQy8LcmO9+Q/Df7FnowhNdKgxiaM?= =?us-ascii?Q?bPWhpVTh3lmS0cTT1sJyT44u5ZxtzyGuwR9YELRNqarhZRn+qEFNQtanBEkm?= =?us-ascii?Q?ebk/jNHrXMXtw0/Ci31zTYiuhAvHO+aukCeqPqyq06DY5jPotK6U7WqKI8Q0?= =?us-ascii?Q?a/2gdCF43EDCvynmGW2X0tmilr45s0FcbMEOJSiUAaLpMGgP9wEmw0b9SfKt?= =?us-ascii?Q?jqSAWiNYags7N2ALpyCtFOEQ2gHsOzNHri0x9cvegpyRWRO7hglCyhsrXOsH?= =?us-ascii?Q?ToS1+sAtxDNUFulEtdLpub+uLYczVl50c1F0Bb2DVSSE7Qml9UplHN9GLdG0?= =?us-ascii?Q?dVu3Mrthu3BACo6ujmdtgS6UZ0WNVmqkFBls6551SX6/Ipfv6MDb1sYM4X4C?= =?us-ascii?Q?aMjLQYkOBBHDsQdngAq/oYv2h+3bgeiwITu/DJYZhoDKK5HVadhrj8gstSqV?= =?us-ascii?Q?Z3Hnf5/9+354IVqgyqtHz0aAI8Eh2fiabDRG+Q/1jHRwy8eI6/bAMJKqNCNB?= =?us-ascii?Q?jPCyie9ztxnnIZS+GQDmIsqtqaDoGM8dAjune4ntjwhHs17MEP6vEDCaVz64?= =?us-ascii?Q?GCA4EGn1UDw2YLhSbxyPOUNVz9RlfYD5pSHDS81NI40i+Yj9IUk7RtplomIA?= =?us-ascii?Q?VaM2iUcndmEtdz1WdibPlQwgXmNnpuiQ8+G19Jq/Dva2ybCIXxmKUYX2u8hm?= =?us-ascii?Q?6S2kmVC4leKttodRFITN5bDDECjmHgnUcwuEUPumlSKLIACh/oE9b72xtJFm?= =?us-ascii?Q?ID0/xKlGAvO0TLdXHkWuI/zQYlfMRrCXwoZZ82HX4vrC3J55USoc1Whsq1LB?= =?us-ascii?Q?OrtX9wzQurw+NT85UNFriQCU0j3VXGg7Hq0AIxaZkhmfh3GZCqI4t9eJbW2P?= =?us-ascii?Q?6UOwYvXy2zMVL0J0vAIeyCayQDUNhEnBE27ULBby71dfPcXzt7dp9qT8RgoK?= =?us-ascii?Q?O7AwheM52jKPoIBjjyOEnlOMdvGS5B4x/CaC73F8eWrE/wAses1J3zPCk4vO?= =?us-ascii?Q?9Z459FhKswBDKngGPLJjZtxCbvrnrnoaN6kPaNOnnCrMvchls05SO+QFioRZ?= =?us-ascii?Q?wkT9zjB+aKPGJmKU69wXWNpwML+Mjd22?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 20:28:28.4693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3449fa5a-96a3-4d35-1b19-08dcc2e8fb75 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A101.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7739 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Introduce new JUMP_TO_TABLE and JUMP_TO_TABLE_INDEX actions. They allow bypassing a hierarchy of groups and going directly to a specified flow table. That gives a user the flexibility to jump between different priorities in a group and eliminates the need to do a table lookup in the group hierarchy. The JUMP_TO_TABLE action redirects a packet to a regular flow group with the pattern-based flow rules insertion type. The JUMP_TO_TABLE_INDEX action forwards a packet to the specified rule index inside the index-based flow table. The current index-based flow table doesn't do any matching on the packet and executes the actions immediately. Add a new index-based flow table with pattern matching. The JUMP_TO_TABLE_INDEX can redirect a packet to another matching criteria at the specified index in this case. Signed-off-by: Alexander Kozyrev --- lib/ethdev/rte_flow.c | 58 ++++++++++++++++++++++ lib/ethdev/rte_flow.h | 95 ++++++++++++++++++++++++++++++++++++ lib/ethdev/rte_flow_driver.h | 14 ++++++ lib/ethdev/version.map | 4 ++ 4 files changed, 171 insertions(+) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 4076ae4ee1..91f1293bc8 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -275,6 +275,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(PROG, sizeof(struct rte_flow_action_prog)), MK_FLOW_ACTION(NAT64, sizeof(struct rte_flow_action_nat64)), + MK_FLOW_ACTION(JUMP_TO_TABLE, sizeof(struct rte_flow_action_jump_to_table)), + MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)), }; int @@ -2109,6 +2111,43 @@ rte_flow_async_create_by_index(uint16_t port_id, user_data, error); } +struct rte_flow * +rte_flow_async_create_by_index_with_pattern(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_template_table *template_table, + uint32_t rule_index, + const struct rte_flow_item pattern[], + uint8_t pattern_template_index, + const struct rte_flow_action actions[], + uint8_t actions_template_index, + void *user_data, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + +#ifdef RTE_FLOW_DEBUG + if (!rte_eth_dev_is_valid_port(port_id)) { + rte_flow_error_set(error, ENODEV, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + rte_strerror(ENODEV)); + return NULL; + } + if (dev->flow_fp_ops == NULL || + dev->flow_fp_ops->async_create_by_index_with_pattern == NULL) { + rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + rte_strerror(ENOSYS)); + return NULL; + } +#endif + + return dev->flow_fp_ops->async_create_by_index_with_pattern(dev, queue_id, + op_attr, template_table, + rule_index, + pattern, pattern_template_index, + actions, actions_template_index, + user_data, error); +} + int rte_flow_async_destroy(uint16_t port_id, uint32_t queue_id, @@ -2733,6 +2772,24 @@ rte_flow_dummy_async_create_by_index(struct rte_eth_dev *dev __rte_unused, return NULL; } +static struct rte_flow * +rte_flow_dummy_async_create_by_index_with_pattern(struct rte_eth_dev *dev __rte_unused, + uint32_t queue __rte_unused, + const struct rte_flow_op_attr *attr __rte_unused, + struct rte_flow_template_table *table __rte_unused, + uint32_t rule_index __rte_unused, + const struct rte_flow_item items[] __rte_unused, + uint8_t pattern_template_index __rte_unused, + const struct rte_flow_action actions[] __rte_unused, + uint8_t action_template_index __rte_unused, + void *user_data __rte_unused, + struct rte_flow_error *error) +{ + rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + rte_strerror(ENOSYS)); + return NULL; +} + static int rte_flow_dummy_async_actions_update(struct rte_eth_dev *dev __rte_unused, uint32_t queue_id __rte_unused, @@ -2898,6 +2955,7 @@ rte_flow_dummy_async_action_list_handle_query_update( struct rte_flow_fp_ops rte_flow_fp_default_ops = { .async_create = rte_flow_dummy_async_create, .async_create_by_index = rte_flow_dummy_async_create_by_index, + .async_create_by_index_with_pattern = rte_flow_dummy_async_create_by_index_with_pattern, .async_actions_update = rte_flow_dummy_async_actions_update, .async_destroy = rte_flow_dummy_async_destroy, .push = rte_flow_dummy_push, diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index f864578f80..6e3ffbf558 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3262,6 +3262,24 @@ enum rte_flow_action_type { * @see struct rte_flow_action_nat64 */ RTE_FLOW_ACTION_TYPE_NAT64, + + /** + * RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE, + * + * Redirects packets to a particular flow table. + * + * @see struct rte_flow_action_jump_to_table. + */ + RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE, + + /** + * RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX, + * + * Redirects packets to a particular index in a flow table. + * + * @see struct rte_flow_action_jump_to_table_index. + */ + RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX, }; /** @@ -4266,6 +4284,26 @@ rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v) *RTE_FLOW_DYNF_METADATA(m) = v; } +/** + * RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE + * + * Redirects packets to a particular flow table. + */ +struct rte_flow_action_jump_to_table { + struct rte_flow_template_table *table; +}; + +/** + * RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX + * + * Redirects packets to a particular flow table. + */ +struct rte_flow_action_jump_to_table_index { + struct rte_flow_template_table *table; + uint32_t index; +}; + + /** * Definition of a single action. * @@ -5898,6 +5936,10 @@ enum rte_flow_table_insertion_type { * Index-based insertion. */ RTE_FLOW_TABLE_INSERTION_TYPE_INDEX, + /** + * Index-based insertion with pattern. + */ + RTE_FLOW_TABLE_INSERTION_TYPE_INDEX_WITH_PATTERN, }; /** @@ -6183,6 +6225,59 @@ rte_flow_async_create_by_index(uint16_t port_id, void *user_data, struct rte_flow_error *error); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Enqueue rule creation operation. + * + * @param port_id + * Port identifier of Ethernet device. + * @param queue_id + * Flow queue used to insert the rule. + * @param[in] op_attr + * Rule creation operation attributes. + * @param[in] template_table + * Template table to select templates from. + * @param[in] rule_index + * Rule index in the table. + * Inserting a rule to already occupied index results in undefined behavior. + * @param[in] pattern + * List of pattern items to be used. + * The list order should match the order in the pattern template. + * The spec is the only relevant member of the item that is being used. + * @param[in] pattern_template_index + * Pattern template index in the table. + * @param[in] actions + * List of actions to be used. + * The list order should match the order in the actions template. + * @param[in] actions_template_index + * Actions template index in the table. + * @param[in] user_data + * The user data that will be returned on the completion events. + * @param[out] error + * Perform verbose error reporting if not NULL. + * PMDs initialize this structure in case of error only. + * + * @return + * Handle on success, NULL otherwise and rte_errno is set. + * The rule handle doesn't mean that the rule has been populated. + * Only completion result indicates that if there was success or failure. + */ +__rte_experimental +struct rte_flow * +rte_flow_async_create_by_index_with_pattern(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_template_table *template_table, + uint32_t rule_index, + const struct rte_flow_item pattern[], + uint8_t pattern_template_index, + const struct rte_flow_action actions[], + uint8_t actions_template_index, + void *user_data, + struct rte_flow_error *error); + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. diff --git a/lib/ethdev/rte_flow_driver.h b/lib/ethdev/rte_flow_driver.h index 506d1262ab..e1fb4c6088 100644 --- a/lib/ethdev/rte_flow_driver.h +++ b/lib/ethdev/rte_flow_driver.h @@ -319,6 +319,19 @@ typedef struct rte_flow *(*rte_flow_async_create_by_index_t)(struct rte_eth_dev void *user_data, struct rte_flow_error *error); +/** @internal Enqueue rule creation by index with pattern operation. */ +typedef struct rte_flow *(*rte_flow_async_create_by_index_with_pattern_t)(struct rte_eth_dev *dev, + uint32_t queue, + const struct rte_flow_op_attr *attr, + struct rte_flow_template_table *table, + uint32_t rule_index, + const struct rte_flow_item *items, + uint8_t pattern_template_index, + const struct rte_flow_action *actions, + uint8_t action_template_index, + void *user_data, + struct rte_flow_error *error); + /** @internal Enqueue rule update operation. */ typedef int (*rte_flow_async_actions_update_t)(struct rte_eth_dev *dev, uint32_t queue_id, @@ -435,6 +448,7 @@ typedef int (*rte_flow_async_action_list_handle_query_update_t)( struct __rte_cache_aligned rte_flow_fp_ops { rte_flow_async_create_t async_create; rte_flow_async_create_by_index_t async_create_by_index; + rte_flow_async_create_by_index_with_pattern_t async_create_by_index_with_pattern; rte_flow_async_actions_update_t async_actions_update; rte_flow_async_destroy_t async_destroy; rte_flow_push_t push; diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 79f6f5293b..1f18ccd08a 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -325,6 +325,10 @@ EXPERIMENTAL { rte_flow_template_table_resizable; rte_flow_template_table_resize; rte_flow_template_table_resize_complete; + + # added in 24.11 + rte_flow_async_create_by_index_with_pattern; + }; INTERNAL { -- 2.18.2