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 9832741C37; Wed, 8 Feb 2023 04:07:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E005342C4D; Wed, 8 Feb 2023 04:07:14 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2082.outbound.protection.outlook.com [40.107.96.82]) by mails.dpdk.org (Postfix) with ESMTP id 9B0CC42D0E for ; Wed, 8 Feb 2023 04:07:13 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJua+FXVEC5OrtawlBzHwl8N2h5y2295suDDWk9N3PeiNFdK7NTdeuZK0NRe1cZqztLYgU4aPD8OVxwMeiVDHcBXPxLf98Bob+QDdAYEbGUG/jDPTqZNFMHQTsvitqOfDIOB0NHsKY4mI8yiU7wxvA9eqnMJzwOUUmseJYOfkvlYwk1dSSidq6Gdq17U3cGYEgbnBeqC55FcfoZiD5edW+SYQu7ef6n1L6BuzSzYCD6YHD5qS1VHL6uSZMxgWXwV1odO74AAODwHho7DoGcxd80u5OuRqzSD5+zcs563rkuQg1IrnypIt3aawG21gVZlG4OzCmcQReOU02FMgTHaAA== 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=ZMJweS3B0AMdkJ7eyFCppn7Kk+wbdqLVkt32cz0qYysgrte/Lb4xmhWaReHqc2wUl11UtH/bOUOc6hLkxwRV18TdX/vf9kkT5IVX/DFY2pnPrTen8lM9kZFf8AupPIqAxcuCntCVKc9DAy1HMLwzY412dCIsGDdjae3BwlK8N+ERIatJfWRY0Kf02cE5YG1HC+5vjh+J3Ed4j8UMpvN7PWSuVB8TS56Xy1tifhfMDgwWWo9ngE/eXVDpn4pKd2dVG59+JurDAeFXwUS60m810RMbQVA2nNNHuVOKIUjLAY/hhsvs+UnNpL3eDBF6PrBJBTdTuiEQmdInn6vAmOQo0Q== 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=kTVWU72ktJl/usR3woNJ7jfhtY25rf+HgKdJJYBooQPleQLvsV7d1bAOYSdEECoTk3M9h1drCZFXjWE9cFoayYnLvo8CIT2myQiSacytTyIGng+InMjxd/8CU2xtn4vViuLVrwyExLm+ZZw5iW2evG+DXQpC6rz6DSYUwM4g19OSqm/qMEEi5sDdvRylqkJ79IeIfg12LVrVN/gOllxASGBPIDwmSQTZAZ00g9kT6tBzfJWC2FXXHfWn+L3IRzBUJbXa8DkmiwrwNsC+r0rhBp8CW9Cd+MpHKD/6+s3XJ8JgwwNcZbb4iFuacDrKL+pBzsyZfV33BYVUir+sRm5FEw== Received: from MW4PR02CA0012.namprd02.prod.outlook.com (2603:10b6:303:16d::35) by DS0PR12MB7512.namprd12.prod.outlook.com (2603:10b6:8:13a::5) 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 03:07:00 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::93) by MW4PR02CA0012.outlook.office365.com (2603:10b6:303:16d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 03:07:00 +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 CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 03:07:00 +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 19:06:50 -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 19:06:48 -0800 From: Alexander Kozyrev To: CC: , , , Subject: [PATCH v4 2/4] ethdev: add template table hash calculation function Date: Wed, 8 Feb 2023 05:06:22 +0200 Message-ID: <20230208030624.78465-3-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20230208030624.78465-1-akozyrev@nvidia.com> References: <20230208024755.72743-1-akozyrev@nvidia.com> <20230208030624.78465-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: CO1NAM11FT012:EE_|DS0PR12MB7512:EE_ X-MS-Office365-Filtering-Correlation-Id: 742e4581-12a9-444e-fb2e-08db09818bbb 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: YOjRC7tHEgQnqz/D6bK42rHWwaoc1YgfHICwd1v3NWedfnaxgBuRYTYVLAtyAtOuwa61KXNw8i0OwycvdlFx4kdKqPDqx4slVZeUm709lIOtYQgpwv2P6Ygpy8H7096yntbYcSwAMjgFWA4FIcI81+5kiD1B/FyjNcyGW2eBvyO/M/fHUcFgNXC0GU7/L6C9Sf9evoLRpB0Ryl6naMBwuzcuxAr7mknSD1jm3qtylClFC14qA7/blJ/X50IGT/X/Nd5XTrNZCBJgwOP0mlxa3Ap58UIft7Dv+sLtNXQooFldiM8oNNvMgTjETRx0uiJwH1dR/J2PgIszhGgGFIEPdU8gwwOwtfdJE1isGk/Kr1NC8stboDhSgMsH4McUWkkGxaFKlRSOZRi8dhwcH+g3gKQ+BavS+KvT5uO5fKhFtdZbznsWOkQll25SFp/GyrZgAovaHwcDZKNY1Vm+P9y8lmQOQ2bkVIlnM8o223Dpf8VHVnKeGcyiJQZpF72UJXT1thdt6LGmRUcNTwIZP6QfV0sLbrUu5oIvPaV5Hyhm3hbMLnzEJfscNSqDlCh1DYCzlqcQ4p/B1vyJTFZcuiUZCalARHqWQmK8iGRWwVnmfrnQtUTaqwzj/8IVfJSQCtNvGLkhXENUItJjBQlxVdZuYKCGxFOzPkFI3LWXn4L+0mDrN9xGjboG2FOj7wwjsK24YrIF+afdqmHaVKHfAlQghw== 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)(396003)(39860400002)(136003)(376002)(346002)(451199018)(36840700001)(46966006)(40470700004)(47076005)(70206006)(70586007)(6916009)(41300700001)(356005)(316002)(478600001)(36860700001)(54906003)(83380400001)(426003)(336012)(186003)(82740400003)(8676002)(7636003)(2906002)(2616005)(86362001)(40480700001)(26005)(16526019)(6666004)(8936002)(82310400005)(5660300002)(40460700003)(107886003)(36756003)(1076003)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 03:07:00.1747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 742e4581-12a9-444e-fb2e-08db09818bbb 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: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7512 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