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 61C5CA0C45; Wed, 6 Oct 2021 06:49:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DB8E40685; Wed, 6 Oct 2021 06:49:01 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2071.outbound.protection.outlook.com [40.107.244.71]) by mails.dpdk.org (Postfix) with ESMTP id 87E1A40140 for ; Wed, 6 Oct 2021 06:48:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YmNxlFX0mb70YUfGv+CV9f4CtfS5Ufrll76to3NnzdXkgj5XCkuKTjFmN9hNkH0L5tbSmf8WvRuriXH9dqIhyZnzJjnckTR1SPGzoqR7uM5HI9C9LNMzYDn8e46AIcJV6nY7lJ6ENt1GIRM8NejAzBdhBuk6hAbCGuWLq35FpUccPazlj2PuRJaRCQ9uHxL7SJkL8nb5VHfVdKT6aBLwMl3PXP6Nuesnu0oyzURO1xoSNiyDqLdUVeOQKqeiQ/n+5wbAa7svQrZua32Aw9c8vyU2Mcx/fF5xsAFBEeKj1cwHIxB6UVeK77jKaQBMa9f8b3/DBG/8geneG82iLn7Cug== 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=kMFXKh3jQ23AcrqdXxPz2YMiLitUoXXFYK/+YdCvnTw=; b=U2CWKhljA/Dr7SNqti4xaNzLGW0CIZ5bldjvv5spQAQznzdQ0yLxfQXgWRp6n7vNwLnYCJEYxhc0RnXU6/QFDboJsShtl2O5MzSAHuWujVTh8nJHqJABTCEKDlVwMWaYRHKG4Kiq4Y7ToP2Aq5dBoHpfMtali1S7JBqbe2jdFScK1dPxaSvkCQ7V3JlfGMcOx9xzOLC3Eq+5dbLZhpkqaCzhOgmqrD0bRDr9oQrFvm/duGpQMYVRmiC8KhzwPpqae58SCZwqsK3wmaK4w/UCp5O6+PEEnzDIvyLJlYisLera15uaHvsOrDxSdThtHNT+ZqAiYni+A0yk4SQungTBPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=kMFXKh3jQ23AcrqdXxPz2YMiLitUoXXFYK/+YdCvnTw=; b=bEKoZGEs5x/Fp0u8WykOEdVTXwr4zP1+UAKosbjUwSXqa54eY5ubFlt3KYnThX1AKRfubMz5yRMJ1QoBo+PH29sU3Xt5NLiCm2HJwbca9eOrT1s3QxfKPZKNIH3+HtpuriCl+msUQHuPI/+F130Z8FzkmHPYxcDkUxnjDgSxJN41nECNwYgZ+pQy0I5bihLQQEsZiMXQuyzkddOG/fXwlw98hL3AtY+4ko7KBOFvVV4S5MPp/wJaEglWMmoVx0bkghklJkaSz8Lnm6HZ7Hx3qgBlqGPxU1QHDj4zCijb/dD2uRUsSlyXyZv0Cb9v2LE8fkFmT/OGhmumP4ocrifjPQ== Received: from BN6PR2001CA0018.namprd20.prod.outlook.com (2603:10b6:404:b4::28) by MN2PR12MB4390.namprd12.prod.outlook.com (2603:10b6:208:26e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Wed, 6 Oct 2021 04:48:57 +0000 Received: from BN8NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:404:b4:cafe::e8) by BN6PR2001CA0018.outlook.office365.com (2603:10b6:404:b4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Wed, 6 Oct 2021 04:48:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT030.mail.protection.outlook.com (10.13.177.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Wed, 6 Oct 2021 04:48:56 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 6 Oct 2021 04:48:53 +0000 From: Alexander Kozyrev To: CC: , , , , , , , , Date: Wed, 6 Oct 2021 07:48:33 +0300 Message-ID: <20211006044835.3936226-2-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20211006044835.3936226-1-akozyrev@nvidia.com> References: <20211006044835.3936226-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e9f10ea-0898-4a21-6c06-08d988849b17 X-MS-TrafficTypeDiagnostic: MN2PR12MB4390: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hqVB0yC40xaduiDuaPhpd++QLtNMsI4FrgtRWypaJ5WNIX8Yfw7Dk0hmYhZXk9unjeSqXffSiC50Dh/UK2zKaZxw4GrmRJLdJoLLM4Skp1bhc7Art++s7FV809m/zkIinnndgYfF9fEdNxtwPuEjB8h00QfuWAVBD3YLETXRhiMQT286ZUUCw9bTm0QBaKoyIjluvIddoohYeTgiUu0223gl0mq2BsRztB5zJ8wXCgwHwIjygScz/QGlZTFqt9cOAZjKLVe2BduF16J9AZyVrU4jFkvpM2D4PjW2R9R39AH4d0UxMwXH8JjN5UJif5y5bSV3d0AkFqv8P7f6DmY+6a5ld3NdcgEpHCL0sMRyvpdg1i1Xqx1Us+P8Ts0HRuyAHTme8OcK/d6b7kAcODmiz1BUO9atiGHgkDiBwQpHbIRp4SMDiUDjjtiW+05dbrq11+24uU+I66cXjNWkQEbPikDuEFdlqg4QooSDACFF6hSdiPjfbb07r7B01e1+02Alm/KGpQcG52T26PId722EEyL4bGMEhCf7dRR5K1hcpBwQM5ChSOvLJGTbRCnBPnSa1LiMJ+llYJQGxtWnQRZzHUhVWL5Y3Iyir2WbaBn0Ra+Hb3ytWkYcnvU/SGQ19vuaOIdAzIU7RFnzGDeAsvg2N1A0I6gDc88/2DotNG+kwkC9RsOfMS5oM8CDMhVXXGtp9c3nPLfi36PYmdWLcZKB/w== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(508600001)(8676002)(5660300002)(86362001)(1076003)(36860700001)(70206006)(47076005)(6286002)(83380400001)(2906002)(6666004)(36756003)(82310400003)(2616005)(54906003)(26005)(7636003)(6916009)(70586007)(55016002)(7696005)(8936002)(426003)(336012)(316002)(16526019)(4326008)(186003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 04:48:56.7000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e9f10ea-0898-4a21-6c06-08d988849b17 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4390 Subject: [dpdk-dev] [PATCH 1/3] ethdev: introduce flow pre-configuration hints 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 Sender: "dev" The flow rules creation/destruction at a large scale incurs a performance penalty and may negatively impact the packet processing when used as part of the datapath logic. This is mainly because software/hardware resources are allocated and prepared during the flow rule creation. In order to optimize the insertion rate, PMD may use some hints provided by the application at the initialization phase. The rte_flow_configure() function allows to pre-allocate all the needed resources beforehand. These resources can be used at a later stage without costly allocations. Every PMD may use only the subset of hints and ignore unused ones. Signed-off-by: Alexander Kozyrev Suggested-by: Ori Kam --- lib/ethdev/rte_flow.h | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 7b1ed7f110..c69d503b90 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -4288,6 +4288,76 @@ rte_flow_tunnel_item_release(uint16_t port_id, struct rte_flow_item *items, uint32_t num_of_items, struct rte_flow_error *error); + +/** + * Flow engine configuration. + */ +__extension__ +struct rte_flow_port_attr { + /** + * Version of the struct layout, should be 0. + */ + uint32_t version; + /** + * Memory size allocated for the flow rules management. + * If set to 0, memory is allocated dynamically. + */ + uint32_t mem_size; + /** + * Number of counter actions pre-configured. + * If set to 0, PMD will allocate counters dynamically. + * @see RTE_FLOW_ACTION_TYPE_COUNT + */ + uint32_t nb_counters; + /** + * Number of aging actions pre-configured. + * If set to 0, PMD will allocate aging dynamically. + * @see RTE_FLOW_ACTION_TYPE_AGE + */ + uint32_t nb_aging; + /** + * Number of traffic metering actions pre-configured. + * If set to 0, PMD will allocate meters dynamically. + * @see RTE_FLOW_ACTION_TYPE_METER + */ + uint32_t nb_meters; + /** + * Resources reallocation strategy. + * If set to 1, PMD is not allowed to allocate more resources on demand. + * An application can only allocate more resources by calling the + * configure API again with new values (may not be supported by PMD). + */ + uint32_t fixed_resource_size:1; +}; + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Configure flow rules module. + * To pre-allocate resources as per the flow port attributes, + * this configuration function must be called before any flow rule is created. + * No other rte_flow function should be called while this function is invoked. + * This function can be called again to change the configuration. + * Some PMDs may not support re-configuration at all, + * or may only allow increasing the number of resources allocated. + * + * @param port_id + * Port identifier of Ethernet device. + * @param[in] port_attr + * Port configuration attributes. + * @param[out] error + * Perform verbose error reporting if not NULL. + * PMDs initialize this structure in case of error only. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +__rte_experimental +int +rte_flow_configure(uint16_t port_id, + const struct rte_flow_port_attr *port_attr, + struct rte_flow_error *error); #ifdef __cplusplus } #endif -- 2.18.2