From patchwork Thu Jan 26 23:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 122591 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D00F42498; Fri, 27 Jan 2023 00:28:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DF2542D44; Fri, 27 Jan 2023 00:28:42 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) by mails.dpdk.org (Postfix) with ESMTP id 1B71A41133 for ; Fri, 27 Jan 2023 00:28:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bRTV5qlrAH33fp5sQdOaKK238ZA8RULUS3VXHmRnaFobvS0ln0cY/vQrkwks/mt/nwB+wiUwH7mvvNumHFMuVVdKWwrQiNAhHrIvc9o4OVarZnowxOWxdDTc5U5+25ATfUzDxCxPdh+P8h9Dv7nWKo0O3+w2HfMFmohfUmargXDA6uy5cLhXuRsGHBmGBRvCPS5obppvWDvPXdRUytwsvaX7tqhxazPp5BWeOt3wF4oad+PhpjACK/RldUoAKu2XONt7pIdOohD9+oHjnLH4ZBVFLsgsrm3E7leBwjxhaEwopPrNWYwd9IdQT7y+T3N7Nv/Eq34hi+BQkTUYULaOlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eGXTrIV6PIrDv0GkI5Z7ZLsYpokQi3yWvQ3tlM4OVoI=; b=D5Bz+U58rFMZKhyQUaE3Qn8lFwQYfp+wxtpmdIA0H8eu7KYt29cxn9ZQeW7gv+ha0vcColh7MXxXGNmK5WxnutMN5U0hQGEjGfYrBLYVan5cCiucHrTgDBcdRaZkzR2dzAPo34gCdnEiRAQC/Qf9ktdAPxg184ubhe1b4i1BVD9A2GzbLmsp4L578RRnKhhuagtlZ552dx2DTFsrfNRvJeg1X+5ImgW/EjNdesC0FJSExyQjud1v0n2ZmpbuRzxjkK/Az5+iQBesR9Z1LX83188cNxCRCGzOtyztumiimQ0kDF3BLJyTGiBkHVqL/KC8ZGhUL+YZs56iL10aEV0n0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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 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=eGXTrIV6PIrDv0GkI5Z7ZLsYpokQi3yWvQ3tlM4OVoI=; b=a3mUEYOL9BdMsh5kCeX6nYcd7SaI2AFvmH4WFXMyV9s70bGlT1TQqrWE33bkAdTiR6pu1fV9pjNSuK2HyD4ChoIY+1/CPLlyAKnlED3A440+y4H6oQOJOxOQh28YskC8uVwVChnHxEVJehUlBTO26+boem/2oaXo93XiOVVMON5HDyP/fO2PzKQ9a3tm+xMDL0AJlEWnTv3lzkvYmFif29pg7xaYz3nV3k4K6CJdACs3r5m5wESOr548zl8b5AJAbZI4MEAeV7hh7G8DAGDE2b2jhrOqZmcxDnh+XdOlXp8VyjmWAd+P6b0Qoj2GI5iht3uub05LVh8hkjz+uFrCfQ== Received: from DS7PR03CA0172.namprd03.prod.outlook.com (2603:10b6:5:3b2::27) by IA1PR12MB6092.namprd12.prod.outlook.com (2603:10b6:208:3ec::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Thu, 26 Jan 2023 23:28:39 +0000 Received: from DM6NAM11FT115.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b2:cafe::1a) by DS7PR03CA0172.outlook.office365.com (2603:10b6:5:3b2::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Thu, 26 Jan 2023 23:28:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT115.mail.protection.outlook.com (10.13.173.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21 via Frontend Transport; Thu, 26 Jan 2023 23:28:38 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 26 Jan 2023 15:28:28 -0800 Received: from pegasus01.mtr.labs.mlnx (10.126.230.37) 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.986.36; Thu, 26 Jan 2023 15:28:26 -0800 From: Alexander Kozyrev To: CC: , , , Subject: [PATCH v2 2/4] ethdev: add template table hash calculation function Date: Fri, 27 Jan 2023 01:28:00 +0200 Message-ID: <20230126232802.3960109-3-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20230126232802.3960109-1-akozyrev@nvidia.com> References: <20230121052158.2928238-1-akozyrev@nvidia.com> <20230126232802.3960109-1-akozyrev@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] 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: DM6NAM11FT115:EE_|IA1PR12MB6092:EE_ X-MS-Office365-Filtering-Correlation-Id: 115fa946-74f1-40b0-00b9-08dafff50dc7 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; X-Microsoft-Antispam-Message-Info: N/5/Kfxv79VC72aj5phvDXhnB5FmOOdMQU7cq+cE0KwP+enhXCf/yprRBk3y6JG2eNRGb56UNnbC0VKLeCvDGFGkQEfsh5YDf35nMnnc4Hl3dJHWmOqQpe2H2G4J1EIlZ+ZWxuvXXCQRORuEIELCZ7ZUWpdjqvEFkrT5gtWSsk04v1sb+G3tCas6GwHhcxhgoUgAdfeotdOgCdDznJ9ExqI3yLcVPpBGabTsPnHtycrvVGBC1638BGiSfIWTZ7YOdzQ50xNMi02wR77zGrSyXNsE0tlR4xLbsUoZB69hPlPthISDFN9LLEWQYRj4u0SCLYzGqpS90qz0o7rEre5uvCq9tPlHWsvtmceRok50MmTY1ZnFu/FZb5CSJl8qER16VT3UZf2UQ0ZncG72shLRJEBDl6IV2Im6YCHUc/UJJ2cvvux0Vs1bENEQjMBFmhuCtxrz/tv0bi+n3zyeSFyhfDquPr/NpICr1iCvq//YmfjRILwPOatlWszjH99Rkvmvslto+SMVuy+p+i9V+wq7GSK3Ba8uFYPE4mysvYJm2R8OOabEwPiLkz4dJQlPi8Rh1Qa9lYWLhh7pverfXTqjbGCHyfZG/Sea1GbMqOaSMJ+IhXMCHk2xiAzshY6kKfNz2vQr6aZ9tvZoBkp396MEz9+S7Oibz6mtoplAk9n2EqZt+eb7fTlvU+m4HwhgBW+p1MFv/j6MOmemCY2XDVc0Ug== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199018)(40470700004)(46966006)(36840700001)(40460700003)(7636003)(2906002)(356005)(36860700001)(1076003)(2616005)(107886003)(186003)(26005)(16526019)(6666004)(426003)(86362001)(83380400001)(40480700001)(336012)(4326008)(6916009)(70586007)(47076005)(5660300002)(8676002)(36756003)(70206006)(41300700001)(316002)(54906003)(82740400003)(8936002)(478600001)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 23:28:38.8000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 115fa946-74f1-40b0-00b9-08dafff50dc7 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT115.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6092 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 Allow user to specify hash calculation function used in template tables. The hash calculation type is responsible for the calculation of the flow rule index a packet would hit upon arrival at the table. Control over this is useful for applications with custom RSS algorithms, for example. An application can select various packet fields to serve as a hash calculation source and jump to the appropriate flow rule location. The RSS hash result will be used as the index in the table. For the linear hash function, the mapping is one-to-one and the hash result is the index. For other hash functions, the index is the hash result module table size. The RSS hash result can be retrieved via modify_field API: HASH_RESULT. Signed-off-by: Alexander Kozyrev --- doc/guides/rel_notes/release_23_03.rst | 4 ++++ lib/ethdev/rte_flow.h | 30 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index fa9391de2b..6f7c38ec66 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -76,6 +76,10 @@ New Features Introduced new function ``rte_flow_async_create_by_index()`` to insert rules by index into index-based template tables. +* **Added index-based rules insertion in flow API.** + Added hash calculation function used in template tables + to allow control over the calculation of the rule index for a packet. + Removed Items ------------- diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2ba616eeb1..6ce61e3f53 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3528,6 +3528,7 @@ enum rte_flow_field_id { RTE_FLOW_FIELD_IPV6_ECN, /**< IPv6 ECN. */ RTE_FLOW_FIELD_GTP_PSC_QFI, /**< GTP QFI. */ RTE_FLOW_FIELD_METER_COLOR, /**< Meter color marker. */ + RTE_FLOW_FIELD_HASH_RESULT, /**< Hash result. */ }; /** @@ -5204,6 +5205,31 @@ enum rte_flow_table_insertion_type { RTE_FLOW_TABLE_INSERTION_TYPE_INDEX, }; +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Template table hash index calculation function. + */ +enum rte_flow_table_hash_func { + /** + * Default hash calculation. + */ + RTE_FLOW_TABLE_HASH_FUNC_DEFAULT, + /** + * Linear hash calculation. + */ + RTE_FLOW_TABLE_HASH_FUNC_LINEAR, + /** + * 32-bit checksum hash calculation. + */ + RTE_FLOW_TABLE_HASH_FUNC_CRC32, + /** + * 16-bit checksum hash calculation. + */ + RTE_FLOW_TABLE_HASH_FUNC_CRC16, +}; + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. @@ -5223,6 +5249,10 @@ struct rte_flow_template_table_attr { * Insertion type for flow rules. */ enum rte_flow_table_insertion_type insertion_type; + /** + * Hash calculation function for the packet matching. + */ + enum rte_flow_table_hash_func hash_func; }; /**