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 36C1241C35; Wed, 8 Feb 2023 03:48:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11F3D40E6E; Wed, 8 Feb 2023 03:48:28 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2046.outbound.protection.outlook.com [40.107.212.46]) by mails.dpdk.org (Postfix) with ESMTP id D69D240E6E for ; Wed, 8 Feb 2023 03:48:26 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cS/V7u+cL90AYdehg+UmIi6e9L/1yOw5ExTbpZetnGi2FnNb0wkp8CJwCsOB6Xx+bhpp2dS/SpQO98AMjcHA9yaNanWuKQYib47VQ4SJld0vh9b2e+DlHoELUyiQ21x8e9Amhe7H8zhN3wEfrLvjsiD/QbspRO7DzSAVL+ywW0LHG6UcNK9HK3E6IeaTB2oyQ2bUiy8yrj1mZ05fk8i6EhrtLmpjllks0jvAxZwXwYrGjW/L4M/eRyO8wyjypIh9gZ5fzq/DCYCI41s5vAUsOO12w1Yb3PmwT6UdBM7E/maoA2A8JuE5HzEyxHoWDZhiMBnN7nb7uuaaWM1rtC5Tyg== 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=hfDdMsVNKLqs9BfFZVR/9DwboR6oI/JHvUrxj0fMVqM=; b=DzOWaFr4r+JSpDrmUm1UasjuENulr77fIciWM7YpuGp72g+HXWMipvyaFl+hl3TjNmwycVU8KiweGZ7kEZSSyUX+kmMQnHZoMASVSNvAkJCG6FCTKNCdsTIOOaTvqYIl4XKqx1iPkMlmc6rMHWbqGOVVKPo+RqlA4UzGGz3ZNdZM952RgM+vCANuh3ac8vzBV5LmIb65UkPyWKL6scGex5yc3VaR/yYUNgtZSb73iRyDmGflEqRgv5sDCCWinHCIfCUpbi9cdZ3QiqIgd5rpZYjX3dHP1+OyCP9Tu3E7CkVpu14Mho/WVsOYBY59kr/1I4tv3a/LAe4V6jRi+zkZMQ== 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=hfDdMsVNKLqs9BfFZVR/9DwboR6oI/JHvUrxj0fMVqM=; b=YyBVrKf2+D9lkQUafiMVToT3dRBQNZglQRCt1m30qJRD3Yhf5IWHQZKvtrrKyNWgXh70gAm/5MkE+raObigTfSf/eH1ID1hWp1tLC2gJC5k7xpdQxtJc3+0DqM27+KiR9qzgB/7IKXx7nUNtYTtxrOGV93qGb3E1O6wdp20vVJBhlZLmroXtHEryDLp7HaBXxjIqoNbXvDD7yEK3IQIN0pLeZq2uFlxLiXfLDpWpxO89nWpSLXGJDRUYXEBbHMnscHjLeb955ZpgisLoRkJmxDfHDZRoujvrp8dZGlZ3txqaaPLHPVJstlKDHPttBDauuGLyTKoJax54S1UJ+z/DVQ== Received: from DS7PR03CA0169.namprd03.prod.outlook.com (2603:10b6:5:3b2::24) by PH7PR12MB7235.namprd12.prod.outlook.com (2603:10b6:510:206::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 02:48:24 +0000 Received: from DS1PEPF0000E653.namprd02.prod.outlook.com (2603:10b6:5:3b2:cafe::d4) by DS7PR03CA0169.outlook.office365.com (2603:10b6:5:3b2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 02:48:24 +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 DS1PEPF0000E653.mail.protection.outlook.com (10.167.18.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Wed, 8 Feb 2023 02:48:24 +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; Tue, 7 Feb 2023 18:48:15 -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; Tue, 7 Feb 2023 18:48:13 -0800 From: Alexander Kozyrev To: CC: , , , Subject: [PATCH v3 2/4] ethdev: add template table hash calculation function Date: Wed, 8 Feb 2023 04:47:53 +0200 Message-ID: <20230208024755.72743-3-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20230208024755.72743-1-akozyrev@nvidia.com> References: <20230126232802.3960109-1-akozyrev@nvidia.com> <20230208024755.72743-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain 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: DS1PEPF0000E653:EE_|PH7PR12MB7235:EE_ X-MS-Office365-Filtering-Correlation-Id: b72910fa-df4f-4229-0282-08db097ef2d5 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: wPjZJ2XV/mUCNjA+IWXOrdiz9P3l/9JQ84DYqd9shvAeX/M3pMi7UP22ipsYlAzBZBvZaDt2iJHwZKZpw7kmROSN0iKRJ/YyhX0vSGH8b7R5frtEUv+HMMHmztOOH6xN14qTYi0PozDX3nCGLQHYo33Ef/cCIHVjpDTp86BIuLmN54NmxRHxjUMgKGNQ5w5BeevDCARkzxuo5mT8jSRCiJgQSHsLV1zw8lXtiBKeFbcRbaFmOjHR9KIZhkqvzDTmghLe80LFOqOT5BAqsm9AIh2Gf5nH4Jlg4O+a53HGNsx9j6nI6A2P9CvZ5UTzENABNsdpfRBuywzThCNrc8+kRzEsAP5PVjMt8fkpOvg78sz50pFp6wcNNzyee0lG0/72/HGVYKIVUU4r77vJ3Bbbq9VZ68Sk3zTYp52RIoSuLTtkIqKLIWX5Kbv2DUx5oXEwBF9LZEmy6EBk+9+/Y7O/xqk+5y8zlmlaCugcbcC5vymc/Ff1oJclsUUXjGXHd4DJ47diPvX5FDy/lin8ydiuENeLpNXAicpqQJrcZ2UwkHArtqZvEljEdStuG8zxz6AGVX1Ztq0S2chYykJ39VPVDFouZ7gFstLct/3FwnhiGGe03G805QvlY+fdusov6tac+6A43Nog3WM4KO4qBYySFNeI839ONrOvkfOrL+pYvxKHqkBjmi4RFUBKXZeygEz0dYbJGO+AkQ1LRwj0Ij4Hmg== 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:(13230025)(4636009)(136003)(346002)(376002)(396003)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(336012)(2906002)(2616005)(70586007)(70206006)(36756003)(478600001)(1076003)(4326008)(5660300002)(40460700003)(6666004)(26005)(107886003)(83380400001)(426003)(186003)(8936002)(16526019)(86362001)(41300700001)(40480700001)(47076005)(356005)(6916009)(8676002)(7636003)(82740400003)(316002)(54906003)(36860700001)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 02:48:24.6070 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b72910fa-df4f-4229-0282-08db097ef2d5 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: DS1PEPF0000E653.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7235 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 | 2 ++ lib/ethdev/rte_flow.h | 30 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index d3bddfb0f5..5228e0f405 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -75,6 +75,8 @@ New Features of index-based template tables in addition to pattern-based tables. * Introduced new function ``rte_flow_async_create_by_index()`` to insert rules by index into index-based template tables. + * 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; }; /** -- 2.18.2