From patchwork Sat Jan 21 05:21:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 122437 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 35B1E42436; Sat, 21 Jan 2023 06:22:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E013542DCD; Sat, 21 Jan 2023 06:22:36 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by mails.dpdk.org (Postfix) with ESMTP id 73E9541101 for ; Sat, 21 Jan 2023 06:22:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+P/SIenosJ/omykB7DHTrhCcK3smSvL+HLdxWI79Z09oLnTrBJhdvFi9mG5myuQZili2wVUTbAHeSWAA5hQBJ0X595mdKDlfqcjB5DMEu7+D+TSjLUobNE0gMljP5mBpKoVRVnGdz1RL+zfk6fMMbuLzbYrrDEScDP2ehH2OADY34QCk3J0+zojxyZFXWatJiZ6YTddanQ06/zuJu8in9z7WJ+763NKsAQUYVidUnCgwXqJ4Kgk4nXi2qsHIRuzwmZdLRbDaomft8dFaDUEGe3LVXmGAoDnEk0sKC/xjZURzRuFi9MBci8cKyKIq2WMxsbmhge6A0PWPTu+t3kycA== 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=eOgbcHkKdQghWMYTBB+h8FaJrB1aYMdDoIPI6g7oVGg=; b=n51W1eoQs2Ht6XXf/mzBqaT+i5Jb6QvkaUm+XoY3tx70wbIyzfGEBIM41WrPQB+hP15bvve5QSrVxgHSP9fd2kUTkvZVrBJ7TgtKa7pDtYVV9R/0LfbWFyKOpZcTU8LwX20WHosQKpgrjHCBG1HAv2RSPibZHDb5yx8aVFxJXGYWzDsqQsZ74MZAN9ovu/hlOIO0NpmBiFzo/IKP7+aXPKdrDMEr3lswpWdvIjjn84vNmo1GepjIW9PXKVbRkeRSUbzhr4F6FwKF54dta+FbKnQA3FHTOhdi3jlYyUMxPaQ3/30fUNp7lnDcpU6PnwUOowX8XTZrbcWJbodjuxxcXw== 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 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=eOgbcHkKdQghWMYTBB+h8FaJrB1aYMdDoIPI6g7oVGg=; b=RvTFihkjtoSXR9JeMW3PC25FnmChQ/t7uz0yYSmvfJsceBYUmnlrINpsHUunuf6sSCvTARnO5niRueGR4u+QcMZwC6YUVi66IRlLL/Rr46oboEKxriGs11AhVkqCPUkR+u5aGfDilU2xi4da1go3LMjh5fTJL36VUmu6WHG0kxAh9u3o3c/rHsW51NwPBR/Z1W1+yRt7xBmYt97xzqI99Us3okCZfaxfsGQz1EG12TGzBP4Ed3OWCYK0WBjbIEUNsER/qk5ZPeG516F0AwfhNN7OSq7E4aviwokyobIsHsSXaTIKWPDs+WT/zkSrBTVhiNdLZVXGJKHTGBtMiM0jyw== Received: from MW4PR03CA0107.namprd03.prod.outlook.com (2603:10b6:303:b7::22) by BY5PR12MB4243.namprd12.prod.outlook.com (2603:10b6:a03:20f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.28; Sat, 21 Jan 2023 05:22:29 +0000 Received: from CO1NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::86) by MW4PR03CA0107.outlook.office365.com (2603:10b6:303:b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.27 via Frontend Transport; Sat, 21 Jan 2023 05:22:29 +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 CO1NAM11FT033.mail.protection.outlook.com (10.13.174.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6023.16 via Frontend Transport; Sat, 21 Jan 2023 05:22: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.986.36; Fri, 20 Jan 2023 21:22:24 -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; Fri, 20 Jan 2023 21:22:23 -0800 From: Alexander Kozyrev To: CC: , , , Subject: [PATCH 2/4] ethdev: add template table hash calculation function Date: Sat, 21 Jan 2023 07:21:56 +0200 Message-ID: <20230121052158.2928238-3-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20230121052158.2928238-1-akozyrev@nvidia.com> References: <20221214022110.393410-1-akozyrev@nvidia.com> <20230121052158.2928238-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: CO1NAM11FT033:EE_|BY5PR12MB4243:EE_ X-MS-Office365-Filtering-Correlation-Id: d63d2ef4-9d3b-4aa8-fa34-08dafb6f7d54 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: znmBZIBYm0VOylMvAR2aMiK+sX0dTjWq+SW0uv2oHZxdIpwH9b7zgoWMFoOC/RmBQG2e6rEAHPqCBZ8uqrHjz7kxlBsmWewCQjLtLx/2kXNpbi4IYjPlhuYCw/xlBD6QNeEea/lQC8TJ9slat6oYlHx7Z9CqY9EETepuOpj6CyqWDan2Q21avsuYM1w8zNS0qD2DRXe2e32j0uJ3Jw+3wFITPYfd4CgD2A0GnLW5UzCDymw+MwodeHJwSU8QR2lwGI9LiNCZ74sjF698VybQ3CIA5D6PrNvQRcxsRrJnDRNooA+a+iOXxtUexAy0QZMiL1JTjlBJj+bIgQRXL8U8GnuQrwa48ETAOiEvoQE7tOY4ImX5sQEJe60yEWJgnU/ZLSs3ab2UfazZa/iomJxd+zXIRrlf/7SqrEg0rMb2d6MZGZwPMjdHWsvBLtECosGKLnk/9F/2IMDSFHDGmriPmy/N1CNIHKSnJdFdbxKRuBoR+c6//P8fqeXCRyH7cC+4CsmTcAl+l1BVya4CznU0S7qSFpucowZZrmXVgdGHKgYg/NFkAA+zQSgKqdRgf+MAOPMYS/9rYCWd+HZq/gizMxyHcSt5ERUNdqPengm7Vjg5v6DgW3aJpzBqt5mOM1OHSvREliCtZw2KHlbryFRmE3hrAGp05BqaK8Fou2ujkaA= 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:(13230022)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199015)(36840700001)(46966006)(86362001)(2906002)(40480700001)(70206006)(70586007)(16526019)(186003)(26005)(336012)(41300700001)(426003)(4326008)(6916009)(8676002)(1076003)(2616005)(47076005)(478600001)(316002)(54906003)(107886003)(6666004)(82740400003)(7636003)(356005)(8936002)(5660300002)(83380400001)(36860700001)(82310400005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:22:28.8071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d63d2ef4-9d3b-4aa8-fa34-08dafb6f7d54 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: CO1NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4243 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 13dd368f2e..0535205c8b 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -63,6 +63,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 88d0c6a724..0c793bce8a 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; }; /**