From patchwork Thu Oct 21 06:34:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102528 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 70C7AA0C4B; Thu, 21 Oct 2021 08:35:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CF3141194; Thu, 21 Oct 2021 08:35:41 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id B82454119F for ; Thu, 21 Oct 2021 08:35:37 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.176) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:35:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kqkr7AFcmK6HgRYey2J0WcBSedj2tL1fz7sq+NHV+W/KLgmWU8faJr9970DGYfGy2Y1ErDFR/Z6Yhklmgs7cm3NIQZAvhSVRT7W1kKUXOqTq0FkfR5jX5zMcJtCR4N4Hrk8peee6sjYA9vdl6v88m4g0uahDGz8AgoX+d7vmYNIFyA6qZZcehwpjFH4h+nOdPcgxNmhvFVQLXkLM3WjK5toJt78aFWYtHgeqcmwLUWOJPe3d0O6ufaokxsdptWv/FbLf1WKCxjeDAbSUW5/NZg9XqSO/i6KXiyd9oZsjQzo9qUB6o6gwNs7j7A/Q/kufkJ8rMDxSExpQ21dfTa6P7A== 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=oQPOTOr7llLhM2rv+oaMKHXOBy9Goxao4BNntA9UYtc=; b=jbZQTq5vJYUxiZTc1ghFob3ybiEzdoJrsYm8UUtu0VDVaJB04WBN7uZB2SbwWi6YECzGsVIf71fG1uSrxSnoLW/O4Tju5NOyjWS6CpqAv/T+VEPkd5OOwkeXBF/e59UpeFqYkurzvIsTOx8KK9sjZWSUWpaAxR41vEyDDzeK3R8nQvp4/ugOlj++bVQpIaVCX5NCju/kIo5X43IwK2yL37mGmFYP3HZ+980hLBf3o5qXt6TtUkyQoyPuNWDiigDbM1d8KUWhwChm96XnFxkHcZpfqR/VVVA2kMq0TLWxYkqtPKAFgc0p92QxbjFr4YosqrSmPB/8zK6UtFZREMjd6Q== 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=quarantine 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=oQPOTOr7llLhM2rv+oaMKHXOBy9Goxao4BNntA9UYtc=; b=qvDy4Z4fvF73MXQlvvmtCeqQDYnNz/mBGIEPUd/4cXTqxJb24WyAYdDmRFSXyM1vRP9UPWO7CywWL8+JyddbzFUBveFLLGYViazkaLN0Kub5wyOGAc2ohdUZzL8mBuIa/wjIVrRTw9i24F2jlYht6p+A48VTK0q2y15FgGvVfEdx6E14bEZa6H6OBsBS+vWv2JlEI8kvkSIkPWir9y+Ep9uz6VLbwII3AV8dHjTmj3X3CTJlN6VWNKaNUlPEJbgzniQaaIsHOHKpsjKTzPRLcI7YC2SAWBhwVQHndjEJ1iBs5s9dxK2FHqT6srGopNT5R9Rd6lJdjd4KEUXtUaJvqQ== Received: from BN9PR03CA0298.namprd03.prod.outlook.com (2603:10b6:408:f5::33) by BYAPR12MB3381.namprd12.prod.outlook.com (2603:10b6:a03:df::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Thu, 21 Oct 2021 06:35:34 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::b4) by BN9PR03CA0298.outlook.office365.com (2603:10b6:408:f5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:34 +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 BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:33 +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; Thu, 21 Oct 2021 06:35:22 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko Date: Thu, 21 Oct 2021 09:34:58 +0300 Message-ID: <20211021063503.3632732-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3cf0cdd2-5690-4158-cf9c-08d9945cfc07 X-MS-TrafficTypeDiagnostic: BYAPR12MB3381: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True 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: 41przWB7vgTirpPrtf9hxQMFpbkN/NR9lNKZQgrX5nvSWehT0aaKEKANcH6CTUxbIk3bs2ZUKvT78/1ONr554Qy9j0ykXZSUCzeGEGUjlR7a2afsspy9YjrQ9QI8AitNd5UByOxv3nNq5vKw+1NXs6oFCAWkZYrrOdOKQo5NYkl83amCwFDWM49jGKJGcm0RhXvqf2V2qvQYVQq1FvF8Nxphb26JVTym+5TpCEiZ3wQ9WlIe8bWZQoUut/OGUE4fqDBfV8ZT8QVoZyt+xbDaiOXpBtKnrZnVFqWCxl8WrgYxUvDV6VEDxd2gQbfbjalSVP7uomqWf2OIbV3PorpmBVC40sH6vIxWDUPQq+gPnqKeDNyiPVKgs3QmIVRLI9hV1+EbenalVs/sJJLi6jJbwJN+wKW2QHNTgFw4tb41DnPO5eRYTNyxG5qGHRzJG5ebi4g4WYEj+kA3e7JehW/4gvEPxefnJhylpFlMJgqlNO1mm+9c6YPSZRwr5W2h6fyehSRN8MM86ysotWLZL0CKsXzvPrgi3TFHV4PpRhS/JbAtMPdMLHTDbe7Rho/2XfY683E2TlbKRyT+8JyipRevvJDyWa3PnahRLMcpVT40AF067NxE0Dt7sKEIDBvQQqnwHaJl+2WBUcWmf0EeAUrRM0DFhmQWUgHJkL8PBcgb/OdiEioZA3/Ul+Tx55//U7wI1gNEq9ITbZbuO1u/YFphEA== 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)(4326008)(107886003)(47076005)(6916009)(55016002)(7636003)(426003)(2906002)(508600001)(86362001)(36860700001)(8676002)(316002)(36756003)(7696005)(356005)(5660300002)(6286002)(26005)(2616005)(16526019)(8936002)(83380400001)(6666004)(82310400003)(36906005)(336012)(70206006)(1076003)(186003)(70586007)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:35:33.4249 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cf0cdd2-5690-4158-cf9c-08d9945cfc07 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: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3381 Subject: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart 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" Previously, it was not specified what happens to the flow rules when the device is stopped, possibly reconfigured, then started. If flow rules were kept, it could be convenient for application developers, because they wouldn't need to save and restore them. However, due to the number of flows and possible creation rate it is impractical to save all flow rules in DPDK layer. This means that flow rules persistence really depends on whether PMD and HW can implement it efficiently. It can also be limited by the rule item and action types, and its attributes transfer bit (a combination of an item/action type and a value of the transfer bit is called a ruel feature). Add a device capability bit for PMDs that can keep at least some of the flow rules across restart. Without this capability behavior is still unspecified and it is declared that the application must flush the rules before stopping the device. Allow the application to test for persistence of rules using a particular feature by attempting to create a flow rule using that feature when the device is stopped and checking for the specific error. This is logical because if the PMD can to create the flow rule when the device is not started and use it after the start happens, it is natural that it can move its internal flow rule object to the same state when the device is stopped and restore the state when the device is started. Rule persistence across a reconfigurations is not required, because tracking all the rules and configuration-dependent resources they use may be infeasible. In case a PMD cannot keep the rules across reconfiguration, it is allowed just to report an error. Application must then flush the rules before attempting it. Signed-off-by: Dmitry Kozlyuk Acked-by: Ori Kam Acked-by: Ajit Khaparde Acked-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 39 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index aeba374182..9beaae3df3 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -87,6 +87,37 @@ To avoid resource leaks on the PMD side, handles must be explicitly destroyed by the application before releasing associated resources such as queues and ports. +When the device is stopped, its rules do not process the traffic. +In particular, transfer rules created using some device +stop affecting the traffic even if they refer to different ports. + +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, +rules cannot be created until the device is started for the first time +and cannot be kept when the device is stopped. +However, PMD also does not flush them automatically on stop, +so the application must call ``rte_flow_flush()`` or ``rte_flow_destroy()`` +before stopping the device to ensure no rules remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is advertised, this means +the PMD can keep at least some rules across the device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any rules remain, +so the application must flush them before attempting a reconfiguration. +Keeping may be unsupported for some types of rule items and actions, +as well as depending on the value of flow attributes transfer bit. +A combination of a single an item or action type +and a value of the transfer bit is called a rule feature. +For example: a COUNT action with the transfer bit set. +To test if rules with a particular feature are kept, the application must try +to create a valid rule using this feature when the device is not started +(either before the first start or after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +all rules using this feature must be flushed by the application +before stopping the device. +If it succeeds, such rules will be kept when the device is stopped, +provided they do not use other features that are not supported. +Rules that are created when the device is stopped, including the rules +created for the test, will be kept after the device is started. + The following sections cover: - **Attributes** (represented by ``struct rte_flow_attr``): properties of a diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 014270d316..9cf23fecce 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -90,6 +90,11 @@ * - flow director filtering mode (but not filtering rules) * - NIC queue statistics mappings * + * The following configuration may be retained or not + * depending on the device capabilities: + * + * - flow rules + * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start(). * @@ -1445,6 +1450,8 @@ struct rte_eth_conf { #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001 /** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/** Device supports keeping flow rules across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004 /**@}*/ /* diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2b6efeef8c..16ef33819b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3676,6 +3676,7 @@ enum rte_flow_error_type { RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */ RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */ RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */ + RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */ }; /** From patchwork Thu Oct 21 06:34:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102529 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 6603EA0C4B; Thu, 21 Oct 2021 08:35:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94044411A8; Thu, 21 Oct 2021 08:35:42 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 07B4A411A1 for ; Thu, 21 Oct 2021 08:35:38 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by mxs.oss.nvidia.com (10.13.234.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:35:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oH3d99VtpGkl3wZPxSZfcyCK7y6ExvxlJQcZ7iFVXupzhHpy2kG/0FiKiWsjcZrQK0awpqtYMYuf8/NpWp4ajvtnHHggHtuHmaR12jlwjHPDTpDMFULdsVXAOGHWP7pOcwrfzEwYAaJ+6QGtD++brvnr9Bd9bErJwXjP3fGyzwUDYxEPrz92mM4YbIVEjK1zE5N2Np5QZG93V9kPdg+LFgr5ix8e+HNMm1FqSZefYvEqv4LkR8qbTWwXMp1pDW5JKy/aRG9XSGMRc6hitYbDM+9LeVRM1SvVNDKqROCOSCnsGebR0gxi86gb7AGt68rRLIY7XEub8ZlJlNVRHJuKPQ== 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=YPhLDkxfCJ+bKP+rhWODRy0yghnQ+YzcggwYn2FZ6+Q=; b=N9fBRBqhfBwCWZAzxBID7YqVO0KDF/WWBAXzrToCnBsqze8Gdo41YadgytlMJ1hXJCQuSRbADXM1w+KExSOrEAAKiCjMB7hjcpU/rhj3MZ17lHkLjic1PYhNE4G76EpzVdRCXvEHPKAKYAOtrhT58veBm4NasqJ8q5G+1nGLpJDqQDORhplRm918SGGhi1A33pNxSFEU+NkCZ6z2QUdS3SopbKsDXrlYL1vLUo1vZScSsgAB4Ufh8JAgKmO2emtl8LFxD7zBPt3guJ3qt2WMJ6wblld9EJLFn4VibnhYfqOrkmd6wJn09WNQys5pHwh3sU9jr0r3CEDUOi//XG/1vw== 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=quarantine 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=YPhLDkxfCJ+bKP+rhWODRy0yghnQ+YzcggwYn2FZ6+Q=; b=eAmYXOb9CyLcevdn9o2xtrnN1e/RTPJg4r4pPHYP8QQoJFxxFJ7PJ8PM7dOraMGpEbbVMRJB5ELlZQF102GLOywomrgCyPrNdFMsklhXsg8flw5P8OZGMPcYq3inbqkmkZyFwCVvJn9qosvZ4S+83Vg+mmejnphfaDVk2LHNxzrRqzhWp3JA7B+8cQCQc06eshrcK78mtfh3Ko7CXzexOf6Qimc583ytQhs3G10OamS9MH0FTwJgYn6T1V0eDh5DM/i8c4rvJF5AKGRQ8tuRK5Ixbon74ZE7QJ5E0xgnszDhFYM3Dw/oZlXhgzlBhioS1hLV+CoRgnzkFaI8d2FZ/w== Received: from BN9P223CA0001.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::6) by BL1PR12MB5048.namprd12.prod.outlook.com (2603:10b6:208:30a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Thu, 21 Oct 2021 06:35:35 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::97) by BN9P223CA0001.outlook.office365.com (2603:10b6:408:10b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17 via Frontend Transport; Thu, 21 Oct 2021 06:35:35 +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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:34 +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; Thu, 21 Oct 2021 06:35:26 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko Date: Thu, 21 Oct 2021 09:34:59 +0300 Message-ID: <20211021063503.3632732-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6b399c0-b66e-4a0f-d4dd-08d9945cfd58 X-MS-TrafficTypeDiagnostic: BL1PR12MB5048: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zt/4aasUopo7eUCnQVjLHYPNgzl4eUcjR1Jidx2ar+hpt4m5IBJHiyX2bGA3D9w8XNOhGfpoCsmOyi07vQh1c8M5h0UiA1uiNynKnKNVnHUpMBK0lIRRwfgRn0NAL1ZNcoGULUZCN3SNjDjRqYzMVifez63qP4uZaP0/4zfRVxnkwP5bzdHR3U3wiuJyHUjRMBtUfWPafyCPfxM3ptJ4O2v1tPBygnJuA+A6qz134IGzadcI040ASbCPYjFCL8cw6NFxki8nYMfv3r6YrDvI2/1Q3pMtJO6UHlGpgzEkLdVd3zIDpztaMgxUyv313EJLuezaspVu1muDVmS7J6qIvyLbZf5wAA3gVDZVKnqKCKnSuPPYuHXNjxo64QC0c51DunbTEdnJRSC4nFr6uBVRuioXUvhEtxRwng03ZXxIQGJRcrpSZaYpURdKFmghHSlFBiWvCD87MDQRom130DBX3ANQ1sU9MmiMSns4+qeXmrRO3JPFKtYhfBz3WDrRuUatFD/urAcsq98SRkf9NG3MH3LUulbRIbwvc/H71PW0gAcVn4Py2AI/EkaKVKiItooePBrNm1WakxTC10OpJVmQ86JrsJlmw01qHtk12YHJvWLD/Rik3HmzyiFya9I2kgVHwXfN/wNzcCEJ7EigHzgxK/RTsvxl/9ItS4zsbLxVZYSKHdZCO/CcmewX0gRpc4KsSuZ5uZKiO3UordF0t3rtyg== 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)(46966006)(36840700001)(1076003)(336012)(6286002)(6916009)(54906003)(426003)(316002)(107886003)(47076005)(36906005)(70586007)(26005)(4326008)(7696005)(70206006)(2616005)(6666004)(82310400003)(55016002)(8936002)(186003)(36860700001)(86362001)(356005)(508600001)(8676002)(16526019)(7636003)(2906002)(83380400001)(36756003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:35:34.5282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6b399c0-b66e-4a0f-d4dd-08d9945cfd58 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5048 Subject: [dpdk-dev] [PATCH v4 2/6] ethdev: add capability to keep shared objects on restart 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" rte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped and started again. It is natural for some indirect actions, like counter, to be persistent. Keeping others at least saves application time and complexity. However, not all PMDs can support it, or the support may be limited by particular action kinds, that is, combinations of action type and the value of the transfer bit in its configuration. Add a device capability to indicate if at least some indirect actions are kept across the above sequence. Without this capability the behavior is still unspecified, and application is required to destroy the indirect actions before stopping the device. In the future, indirect actions may not be the only type of objects shared between flow rules. The capability bit intends to cover all possible types of such objects, hence its name. Declare that the application can test for the persistence of a particular indirect action kind by attempting to create an indirect action of that kind when the device is stopped and checking for the specific error type. This is logical because if the PMD can to create an indirect action when the device is not started and use it after the start happens, it is natural that it can move its internal flow shared object to the same state when the device is stopped and restore the state when the device is started. Indirect action persistence across a reconfigurations is not required. In case a PMD cannot keep the indirect actions across reconfiguration, it is allowed just to report an error. Application must then flush the indirect actions before attempting it. Signed-off-by: Dmitry Kozlyuk Acked-by: Ori Kam Acked-by: Ajit Khaparde Acked-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 26 ++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 9beaae3df3..bef143862b 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2965,6 +2965,32 @@ updated depend on the type of the ``action`` and different for every type. The indirect action specified data (e.g. counter) can be queried by ``rte_flow_action_handle_query()``. +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised, +indirect actions cannot be created until the device is started for the first time +and cannot be kept when the device is stopped. +However, PMD also does not flush them automatically on stop, +so the application must call ``rte_flow_action_handle_destroy()`` +before stopping the device to ensure no indirect actions remain. + +If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised, +this means that the PMD can keep at least some indirect actions +across device stop and start. +However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain, +so the application must destroy them before attempting a reconfiguration. +Keeping may be only supported for certain kinds of indirect actions. +A kind is a combination of an action type and a value of its transfer bit. +For example: an indirect counter with the transfer bit reset. +To test if a particular kind of indirect actions is kept, +the application must try to create a valid indirect action of that kind +when the device is not started (either before the first start of after a stop). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +application must destroy all indirect actions of this kind +before stopping the device. +If it succeeds, all indirect actions of the same kind are kept +when the device is stopped. +Indirect actions of a kept kind that are created when the device is stopped, +including the ones created for the test, will be kept after the device start. + .. _table_rte_flow_action_handle: .. table:: INDIRECT diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 9cf23fecce..5375844484 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -94,6 +94,7 @@ * depending on the device capabilities: * * - flow rules + * - flow-related shared objects, e.g. indirect actions * * Any other configuration will not be stored and will need to be re-entered * before a call to rte_eth_dev_start(). @@ -1452,6 +1453,8 @@ struct rte_eth_conf { #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 /** Device supports keeping flow rules across restart. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004 +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP 0x00000008 /**@}*/ /* From patchwork Thu Oct 21 06:35:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102530 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 C146EA0C4B; Thu, 21 Oct 2021 08:36:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AC2D41196; Thu, 21 Oct 2021 08:35:57 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 05A484118E for ; Thu, 21 Oct 2021 08:35:55 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.105) by mxs.oss.nvidia.com (10.13.234.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:35:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O3qVhXOvHhwv7D1RnqnE2I3SfOqlFzPBa3dnTNDhFwm9TNTuWCiRi8qCgUawwE0P+pJLIXtvJAV59Xz7crfo+TuYN0UXupfjLKyvsDDrJVzSftaa5p6ZSYGJ/v6yCByppqLqqO935IID4qvrIFX8lotK0amPfTW0MT4IJEweD4NHPWZ3p9MFbbsEMtMkZ9hXkvO4bvoy1QFzchHhKHTwvTLTMXA44Drq4GsfLCkBj33gEg5IcsEZAPOHhp05018o8/H0Djl8KtXeAhYFN2OWCqw0wEA5ZNY4db8r5WaQZcQnb7kf9dr1Ggx4pCfEJ9GpYRXEims3cpAy0GJdY23UTg== 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=jrmLVuwq20sp0qjd4PRigGZwpTg8bzpzxTdIUQI1Hxs=; b=WxH3q5XfLsUABEnwryXt784ldL3TMi1fnE7wMow4OXN3H+xRlXgGJvytD7NfvY+AZ+UXmO0pFj2Pu6w1vs+Z0lQY+d53tfPmD/m5MaIdVKHaXcg7vj05q1ccYUnAqeh5W/9uY2MnU60hq7quibkJnhDa6EiJX/V4jCQ6U2JOwokgWCxqsP8PDK6EAB7HdUWFSR0i0YWwED6/910yrW5sN/q4cPCehRLPxIBASN13SOfZB6Ma+TtyFldZjv5gWdpFoPsr9g8qFas26nGPamDVCrE8H+x2gUrnF7VP3OXI3qkbZ+A8H0FAtWkZ/7+DPziIQ/kSsAc05rk/+Xc4x9oPFg== 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=quarantine 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=jrmLVuwq20sp0qjd4PRigGZwpTg8bzpzxTdIUQI1Hxs=; b=p4Z1zlvxAAk27Fg7jVuV5zLwjYHvO3HplePF3rhkSfZ3xaaTs8zKh9ey9HlhSzwefr/elnDk9RucmkK80gInJCo7LOE2P93gFg4J3GE4MUZj9a0m1tYslYbo8I4nLp/HCuohdB4bGw2LWNbUnoB0wQGITJFq9UhdTI+a7b76qtp27aVGMABTkct6/gjn9Wy7jgzF+0NsuRFHg+f7ovuEr7XCJY+ORNmXQ4ta5cgsc97yklUN0rXj3lKMRE0vJEP+KT7ZlaEtopEFzH/Nqxpky1Ue3M0kD4cqf7I8vzr7koIDiDr7vwMyNYI4Yp5T/sc+wtiyOiJvYCVvnLJ+uYSDFw== Received: from BN9P223CA0025.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::30) by DM6PR12MB4028.namprd12.prod.outlook.com (2603:10b6:5:1ce::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Thu, 21 Oct 2021 06:35:52 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::54) by BN9P223CA0025.outlook.office365.com (2603:10b6:408:10b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:52 +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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:51 +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; Thu, 21 Oct 2021 06:35:29 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Ferruh Yigit , "Ajit Khaparde" , Somnath Kotur , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Haiyue Wang , John Daley , Hyong Youb Kim , Gaetan Rivet , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou , Beilei Xing , Jingjing Wu , Qiming Yang , Qi Zhang , Rosen Xu , Liron Himi , Jerin Jacob , Rasesh Mody , Devendra Singh Rawat , "Andrew Rybchenko" , Jasvinder Singh , Cristian Dumitrescu , Keith Wiles , "Jiawen Wu" , Jian Wang Date: Thu, 21 Oct 2021 09:35:00 +0300 Message-ID: <20211021063503.3632732-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 530a31cf-d320-4999-e5d6-08d9945d0764 X-MS-TrafficTypeDiagnostic: DM6PR12MB4028: X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sxLk5tvAtF25dozoGBYivIB6jRFH2qlhS7+yoQv3Wzs14M2GMmi7joK5GxvwcgATTz5sVEJ1sEOyVZa1AGLUv0x6YSifMBM4zeunFdlvX4zBV8VM11lp0xnC4RpPd8PUETHchXakkXr8il2xghVjDjTLvVV9uypaEshBsNQ5HWW9y8OkR8LYmTKVVqs7O9tCXuypUEfHUJHGaQnrUdjM3l9szbvLkzBQXFQb8C9lO1Xw+STJzSUOMvuDXA0suB9e+RyiPB2XWxML2XAu0BCv4UTZdnpnvuT8bfx336ua7c3s0b3FhqpYR89TeLTuc5ZNa5EbBIkAv1GCsXl/5CFf2u8AFLiapz7Lo8VeoRn/pjxnvGfZ8aYs7/lQKBIUkPyusbEIPhn3d8c92T0PXsyUbX2D6YI7px/RiY6vaFHAQQmDSDJaTfK3Q25QFi1LZe0ryXckACZlNVeTq2MjSYgMJ4AO2KhVEITIYBp/hAmJQw3yM0z7vAH0sCN4RogSwietvB3Ex2aCsCDCyMguW8Pc237uYH7hJ/QhcArXow1RsPinZZW3tk9n0lnXeSOE5clkXiV6KJMH4sXzYt088WSe13LHlTEe374aQdIzE3RKnp2GLmYNKynno9qs44WswRALESFYmk7zWI4VMDf0BcKdZDnM7M2exBsnmUzyfNjQrdHrlfI0NNAWWG7BYpJv24anGPEfxVYqgbPkzLdlHlYjCyBJ2v/gbZiAAupqJl3p3Ck= 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)(4326008)(6916009)(70206006)(70586007)(2906002)(36756003)(30864003)(186003)(2616005)(6286002)(426003)(16526019)(8676002)(5660300002)(508600001)(1076003)(7636003)(316002)(6666004)(47076005)(336012)(26005)(356005)(36860700001)(36906005)(7696005)(55016002)(86362001)(107886003)(8936002)(82310400003)(83380400001)(54906003)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:35:51.5884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 530a31cf-d320-4999-e5d6-08d9945d0764 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4028 Subject: [dpdk-dev] [PATCH v4 3/6] net: advertise no support for keeping flow rules 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" When RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP capability bit is zero, the specified behavior is the same as it had been before this bit was introduced. Explicitly reset it in all PMDs supporting rte_flow API in order to attract the attention of maintainers, who should eventually choose to advertise the new capability or not. It is already known that mlx4 and mlx5 will not support this capability. For RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP similar action is not performed, because no PMD except mlx5 supports indirect actions. Any PMD that starts doing so will anyway have to consider all relevant API, including this capability. Suggested-by: Ferruh Yigit Signed-off-by: Dmitry Kozlyuk Acked-by: Ajit Khaparde Acked-by: Somnath Kotur Acked-by: Hyong Youb Kim --- drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/bnxt/bnxt_reps.c | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/failsafe/failsafe_ops.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 2 ++ drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev_vf.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_vf_representor.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_ethdev.c | 1 + drivers/net/igc/igc_ethdev.c | 1 + drivers/net/ipn3ke/ipn3ke_representor.c | 1 + drivers/net/mvpp2/mrvl_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 1 + drivers/net/qede/qede_ethdev.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/softnic/rte_eth_softnic.c | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/txgbe/txgbe_ethdev.c | 1 + drivers/net/txgbe/txgbe_ethdev_vf.c | 1 + 26 files changed, 31 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index f385723a9f..dbdcdb1ec4 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1008,6 +1008,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->speed_capa = bnxt_get_speed_capabilities(bp); dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index b7e88e013a..34b5df6018 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -526,6 +526,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->max_tx_queues = max_rx_rings; dev_info->reta_size = bnxt_rss_hash_tbl_size(parent_bp); dev_info->hash_key_size = 40; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; /* MTU specifics */ dev_info->min_mtu = RTE_ETHER_MIN_MTU; diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index d0924df761..b598512322 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -68,6 +68,7 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->speed_capa = dev->speed_capa; devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; return 0; } diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index f77b297600..e654ccc854 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -131,6 +131,8 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->max_vfs = adapter->params.arch.vfcount; device_info->max_vmdq_pools = 0; /* XXX: For now no support for VMDQ */ + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; + device_info->rx_queue_offload_capa = 0UL; device_info->rx_offload_capa = CXGBE_RX_OFFLOADS; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index a0270e7852..19f35262e5 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -254,6 +254,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G | ETH_LINK_SPEED_10G; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->max_hash_mac_addrs = 0; dev_info->max_vfs = 0; diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 73152dec6e..3d546c5517 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1106,6 +1106,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; + /* Preferred queue parameters */ dev_info->default_rxportconf.nb_queues = 1; dev_info->default_txportconf.nb_queues = 1; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index dbe811a1ad..d1e61ea345 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2174,6 +2174,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_queue_offload_capa = igb_get_tx_queue_offloads_capa(dev); dev_info->tx_offload_capa = igb_get_tx_port_offloads_capa(dev) | dev_info->tx_queue_offload_capa; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; switch (hw->mac.type) { case e1000_82575: diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 8df7332bc5..4e8ccfd832 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -469,6 +469,7 @@ static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_offload_capa = enic->rx_offload_capa; device_info->tx_offload_capa = enic->tx_offload_capa; device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa; + device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; device_info->default_rxconf = (struct rte_eth_rxconf) { .rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH }; diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 29de39910c..9e9c688961 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1220,6 +1220,7 @@ fs_dev_infos_get(struct rte_eth_dev *dev, infos->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + infos->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { struct rte_eth_dev_info sub_info; diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index c2374ebb67..ff287321c5 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -751,6 +751,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_MULTI_SEGS; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; + info->hash_key_size = HINIC_RSS_KEY_SIZE; info->reta_size = HINIC_RSS_INDIR_SIZE; info->flow_type_rss_offloads = HINIC_RSS_OFFLOAD_ALL; diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 693048f587..4177c0db41 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2707,6 +2707,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) if (hns3_dev_get_support(hw, INDEP_TXRX)) info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; if (hns3_dev_get_support(hw, PTP)) info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 54dbd4b798..b53e9be091 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -965,6 +965,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) if (hns3_dev_get_support(hw, INDEP_TXRX)) info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; info->rx_desc_lim = (struct rte_eth_desc_lim) { .nb_max = HNS3_MAX_RING_DESC, diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 0a4db0891d..e472cee167 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -3751,6 +3751,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t); diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 12d5a2e48a..4d5a4af292 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -35,6 +35,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, /* get dev info for the vdev */ dev_info->device = ethdev->device; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; + dev_info->max_rx_queues = ethdev->data->nb_rx_queues; dev_info->max_tx_queues = ethdev->data->nb_tx_queues; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 611f1f7722..9bb5bdf465 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -960,6 +960,7 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->reta_size = vf->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads = IAVF_RSS_OFFLOAD_ALL; dev_info->max_mac_addrs = IAVF_NUM_MACADDR_MAX; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_QINQ_STRIP | diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index b8a537cb85..05a7ccf71e 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -673,6 +673,7 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, dev_info->hash_key_size = hw->vf_res->rss_key_size; dev_info->reta_size = hw->vf_res->rss_lut_size; dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index 2a1ed90b64..7d4cc408ba 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -1480,6 +1480,7 @@ eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen = MAX_RX_JUMBO_FRAME_SIZE; dev_info->max_mac_addrs = hw->mac.rar_entry_count; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->rx_offload_capa = IGC_RX_OFFLOAD_ALL; dev_info->tx_offload_capa = IGC_TX_OFFLOAD_ALL; dev_info->rx_queue_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index 063a9c6a6f..d40947162d 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -96,6 +96,7 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index a6458d2ce9..a6d67ea093 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1709,6 +1709,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev, { struct mrvl_priv *priv = dev->data->dev_private; + info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; + info->speed_capa = ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G | diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c index 22a8af5cba..cad5416ba2 100644 --- a/drivers/net/octeontx2/otx2_ethdev_ops.c +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c @@ -583,6 +583,7 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + devinfo->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; return 0; } diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 27f6932dc7..5bcc97d314 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1367,6 +1367,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; if (IS_PF(edev)) dev_info->max_rx_queues = (uint16_t)RTE_MIN( diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index f5986b610f..8951495841 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -186,6 +186,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; if (mae->status == SFC_MAE_STATUS_SUPPORTED || mae->status == SFC_MAE_STATUS_ADMIN) { diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index b3b55b9035..3622049afa 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -93,6 +93,7 @@ pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_pktlen = UINT32_MAX; dev_info->max_rx_queues = UINT16_MAX; dev_info->max_tx_queues = UINT16_MAX; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; return 0; } diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e4f1ad4521..5e19bd8d4b 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1006,6 +1006,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) * functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; return 0; } diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 7b46ffb686..6d64c657d9 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -2603,6 +2603,7 @@ txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->vmdq_queue_num = dev_info->max_rx_queues; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->rx_queue_offload_capa = txgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index 43dc0ed39b..0d464c5a4c 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -487,6 +487,7 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_hash_mac_addrs = TXGBE_VMDQ_NUM_UC_MAC; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_vmdq_pools = ETH_64_POOLS; + dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP; dev_info->rx_queue_offload_capa = txgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); From patchwork Thu Oct 21 06:35:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102531 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 991E6A0C4B; Thu, 21 Oct 2021 08:36:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10F4141193; Thu, 21 Oct 2021 08:36:02 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 1DFEF411A2; Thu, 21 Oct 2021 08:35:59 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.42) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:35:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B1/hvrzTjGtrEyUNT5iR7ZmyeogmPnvmVHJQz6erNR1su+GUDOko+HrRs4C00VsaxJiK0o8GR2TQCH3fXb8CwOb3EcXeTmvA2SpFndzrslqea8T/dOUU4slhSUZyVdlR/AaGS7md3vUS7qtwsPBqM2gisrR0rOexIbQisUwYC87ctSPQN66qPvVe3pH7pHnutaN5+kEwWFpt9fJVdFlPnf0xuwr9QZOPz54Persf3cHvGEPQn7EU+Tsry1VXykcZ5xxlPnarXH4JozcBWrR9IVqYPndwy7tGbDh7Oz88LaFeLETUPxFoOcqwFTnDYSM29UQ09WmoXP9rDIEmi0gVSQ== 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=LF+g91/8J8XjOwLL/YZg1qS8gdcCbeFvq6m+71y22iM=; b=XfU7u7IGwUUY8JYbTzCXdvzpT+zX/SbXyHAj/wV2wYNh2BXEq9LaFXBig2s6nw7/hI00H92ORKZNTQazKiW+lK6+UmdO3lDgtX539j/YFsUfU958sxknXl8DZmzgMovrg2i7geqjXwurksKfInSIwKOrxvoSxLGCHb7xaQqzXnoDYXdMR/WNk3hexfKNRk63XN8iSrd2529vEXY/jLE/UJKwtAanOw7urANNCPq4pxXWHdKjrfjhGIA/rrMPlEg5qdKt2sU6ScfBd4DvAeZ2jSfaMqNx0shynBhCVCavaIcVONJTAWrld229AA4/g8xE0wq5Lhhr0Ga6RBw4ESJTKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=LF+g91/8J8XjOwLL/YZg1qS8gdcCbeFvq6m+71y22iM=; b=iaY3kO0T9gx8aV2TK2VIE0JMQqvC8WDXctH9t+N5K3D95j9drUbtNJ2djZV8nPO9e6+Yl+pNFcOQa/AaGYrZI+7sPCej8WR5b7aNPsUuAbg+JsagbPfzqbl8IthQ/YYRSEItjBOSa5l4n9hC8o8lxOvKpRXt3sOVW0mjl02dafg8xftUsNNGa7mS3N+3wx86/svt8yf8/0lMUuYQt6UmT3JtGnjW1uKOPEf2VJqhLMirmwHGgZIOVvl8/k2XxHdkdAn9DVF5GG3w0j60n7cqMMrjc7remfwj3YvXl7wm6i9eIOnvD7HT4pDWuj0s5Ici3igiwPMmqNwKXDTXtOCx6A== Received: from BN9P223CA0016.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::21) by DM6PR12MB3929.namprd12.prod.outlook.com (2603:10b6:5:148::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Thu, 21 Oct 2021 06:35:56 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::48) by BN9P223CA0016.outlook.office365.com (2603:10b6:408:10b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:35:55 +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; Thu, 21 Oct 2021 06:35:48 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , , Matan Azrad , Viacheslav Ovsiienko Date: Thu, 21 Oct 2021 09:35:01 +0300 Message-ID: <20211021063503.3632732-5-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 446b0573-e63e-43d0-6213-08d9945d09de X-MS-TrafficTypeDiagnostic: DM6PR12MB3929: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +XVgX3uCB3PLhTk3vesXnSv3YtFCQwijConIrVr2BYLWn7knCKJ4TIJk6JnqJ6aM7rlPLBPCQOnTW+7B/GJ1b4ISIfEE/dCXbhbZcEDzBz+2FGTb7hZ2kTZPl6l1migSTjmTrW0h+gNpFQouBZsf7PLlU4FVoUZQP2jeAkBNMX57bTgINjOGcnMPEs84fngLGjtxLQCX+N06h8r4EO3AlfnMnynF0rYO19dM3PsIzqpNZZxSjvhIZPgd5Xk0Z7lhpAjYuk78QQs6I3UxQiz2J2S/WDu8qViytwwNdOSzYMIPa9Xp9um1Cj/N1AYBMe6MuFQxxG65E1iA04h7tgGrIt4pR//l59VBnInMCs3+2YqVqwoqn375rZx+pkBUkTfgqUY2J0MbOhoj64UQbCIzivPRNyQa1ejTXVNkiptz7msNUmSJFv8MaNmVwdMX+K8ufao45CEavERgkZHJcg12kBPr36xN5vR7AQBAoXDls2SBkCEfNPE2Rq12NlZwSTjZRLtpRrefDvH1HoLjk3GDJpMz33rtN567Xih0BTlcdUxR4jPpmmLWVJpr889kylej92V4m8qHAf53x6QlfiVU0SiQ017lf72hjZ0HNmhp+vab/MnNKJt7k45GkPNf2sWr54ws/h4rAXfloF1K0VVGTAtZeQMuWirO9uo8RWxSsn74IGKezCjaB6oqq84wJTkJ6z+z5IK3Qq0CWYP0GvXQ/Q== 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)(82310400003)(54906003)(30864003)(26005)(86362001)(186003)(16526019)(47076005)(107886003)(70586007)(356005)(83380400001)(36906005)(1076003)(6666004)(2906002)(2616005)(336012)(450100002)(5660300002)(36756003)(6916009)(6286002)(316002)(7636003)(55016002)(36860700001)(4326008)(70206006)(7696005)(426003)(8936002)(508600001)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:35:55.2643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 446b0573-e63e-43d0-6213-08d9945d09de 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3929 Subject: [dpdk-dev] [PATCH v4 4/6] net/mlx5: discover max flow priority using DevX 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" Maximum available flow priority was discovered using Verbs API regardless of the selected flow engine. This required some Verbs objects to be initialized in order to use DevX engine. Make priority discovery an engine method and implement it for DevX using its API. Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5_flow.c | 98 +++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 4 ++ drivers/net/mlx5/mlx5_flow_dv.c | 103 +++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow_verbs.c | 77 +++------------------ 5 files changed, 215 insertions(+), 68 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 26a8d75b99..60d2c398db 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1849,7 +1849,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq = mlx5_drop_action_create(eth_dev); if (!priv->drop_queue.hrxq) goto error; - /* Supported Verbs flow priority number detection. */ err = mlx5_flow_discover_priorities(eth_dev); if (err < 0) { err = -err; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index b4d0b7b5ef..2768244c2e 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -9480,3 +9480,101 @@ mlx5_flow_expand_rss_adjust_node(const struct rte_flow_item *pattern, return node; } } + +/* Map of Verbs to Flow priority with 8 Verbs priorities. */ +static const uint32_t priority_map_3[][MLX5_PRIORITY_MAP_MAX] = { + { 0, 1, 2 }, { 2, 3, 4 }, { 5, 6, 7 }, +}; + +/* Map of Verbs to Flow priority with 16 Verbs priorities. */ +static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX] = { + { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }, + { 9, 10, 11 }, { 12, 13, 14 }, +}; + +/** + * Discover the number of available flow priorities. + * + * @param dev + * Ethernet device. + * + * @return + * On success, number of available flow priorities. + * On failure, a negative errno-style code and rte_errno is set. + */ +int +mlx5_flow_discover_priorities(struct rte_eth_dev *dev) +{ + static const uint16_t vprio[] = {8, 16}; + const struct mlx5_priv *priv = dev->data->dev_private; + const struct mlx5_flow_driver_ops *fops; + enum mlx5_flow_drv_type type; + int ret; + + type = mlx5_flow_os_get_type(); + if (type == MLX5_FLOW_TYPE_MAX) { + type = MLX5_FLOW_TYPE_VERBS; + if (priv->config.devx && priv->config.dv_flow_en) + type = MLX5_FLOW_TYPE_DV; + } + fops = flow_get_drv_ops(type); + if (fops->discover_priorities == NULL) { + DRV_LOG(ERR, "Priority discovery not supported"); + rte_errno = ENOTSUP; + return -rte_errno; + } + ret = fops->discover_priorities(dev, vprio, RTE_DIM(vprio)); + if (ret < 0) + return ret; + switch (ret) { + case 8: + ret = RTE_DIM(priority_map_3); + break; + case 16: + ret = RTE_DIM(priority_map_5); + break; + default: + rte_errno = ENOTSUP; + DRV_LOG(ERR, + "port %u maximum priority: %d expected 8/16", + dev->data->port_id, ret); + return -rte_errno; + } + DRV_LOG(INFO, "port %u supported flow priorities:" + " 0-%d for ingress or egress root table," + " 0-%d for non-root table or transfer root table.", + dev->data->port_id, ret - 2, + MLX5_NON_ROOT_FLOW_MAX_PRIO - 1); + return ret; +} + +/** + * Adjust flow priority based on the highest layer and the request priority. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] priority + * The rule base priority. + * @param[in] subpriority + * The priority based on the items. + * + * @return + * The new priority. + */ +uint32_t +mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, + uint32_t subpriority) +{ + uint32_t res = 0; + struct mlx5_priv *priv = dev->data->dev_private; + + switch (priv->config.flow_prio) { + case RTE_DIM(priority_map_3): + res = priority_map_3[priority][subpriority]; + break; + case RTE_DIM(priority_map_5): + res = priority_map_5[priority][subpriority]; + break; + } + return res; +} diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 5c68d4f7d7..8f94125f26 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1226,6 +1226,9 @@ typedef int (*mlx5_flow_create_def_policy_t) (struct rte_eth_dev *dev); typedef void (*mlx5_flow_destroy_def_policy_t) (struct rte_eth_dev *dev); +typedef int (*mlx5_flow_discover_priorities_t) + (struct rte_eth_dev *dev, + const uint16_t *vprio, int vprio_n); struct mlx5_flow_driver_ops { mlx5_flow_validate_t validate; @@ -1260,6 +1263,7 @@ struct mlx5_flow_driver_ops { mlx5_flow_action_update_t action_update; mlx5_flow_action_query_t action_query; mlx5_flow_sync_domain_t sync_domain; + mlx5_flow_discover_priorities_t discover_priorities; }; /* mlx5_flow.c */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index e31d4d8468..5163f518d7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -17883,6 +17883,108 @@ flow_dv_sync_domain(struct rte_eth_dev *dev, uint32_t domains, uint32_t flags) return 0; } +/** + * Discover the number of available flow priorities + * by trying to create a flow with the highest priority value + * for each possible number. + * + * @param[in] dev + * Ethernet device. + * @param[in] vprio + * List of possible number of available priorities. + * @param[in] vprio_n + * Size of @p vprio array. + * @return + * On success, number of available flow priorities. + * On failure, a negative errno-style code and rte_errno is set. + */ +static int +flow_dv_discover_priorities(struct rte_eth_dev *dev, + const uint16_t *vprio, int vprio_n) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_indexed_pool *pool = priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW]; + struct rte_flow_item_eth eth; + struct rte_flow_item item = { + .type = RTE_FLOW_ITEM_TYPE_ETH, + .spec = ð, + .mask = ð, + }; + struct mlx5_flow_dv_matcher matcher = { + .mask = { + .size = sizeof(matcher.mask.buf), + }, + }; + union mlx5_flow_tbl_key tbl_key; + struct mlx5_flow flow; + void *action; + struct rte_flow_error error; + uint8_t misc_mask; + int i, err, ret = -ENOTSUP; + + /* + * Prepare a flow with a catch-all pattern and a drop action. + * Use drop queue, because shared drop action may be unavailable. + */ + action = priv->drop_queue.hrxq->action; + if (action == NULL) { + DRV_LOG(ERR, "Priority discovery requires a drop action"); + rte_errno = ENOTSUP; + return -rte_errno; + } + memset(&flow, 0, sizeof(flow)); + flow.handle = mlx5_ipool_zmalloc(pool, &flow.handle_idx); + if (flow.handle == NULL) { + DRV_LOG(ERR, "Cannot create flow handle"); + rte_errno = ENOMEM; + return -rte_errno; + } + flow.ingress = true; + flow.dv.value.size = MLX5_ST_SZ_BYTES(fte_match_param); + flow.dv.actions[0] = action; + flow.dv.actions_n = 1; + memset(ð, 0, sizeof(eth)); + flow_dv_translate_item_eth(matcher.mask.buf, flow.dv.value.buf, + &item, /* inner */ false, /* group */ 0); + matcher.crc = rte_raw_cksum(matcher.mask.buf, matcher.mask.size); + for (i = 0; i < vprio_n; i++) { + /* Configure the next proposed maximum priority. */ + matcher.priority = vprio[i] - 1; + memset(&tbl_key, 0, sizeof(tbl_key)); + err = flow_dv_matcher_register(dev, &matcher, &tbl_key, &flow, + /* tunnel */ NULL, + /* group */ 0, + &error); + if (err != 0) { + /* This action is pure SW and must always succeed. */ + DRV_LOG(ERR, "Cannot register matcher"); + ret = -rte_errno; + break; + } + /* Try to apply the flow to HW. */ + misc_mask = flow_dv_matcher_enable(flow.dv.value.buf); + __flow_dv_adjust_buf_size(&flow.dv.value.size, misc_mask); + err = mlx5_flow_os_create_flow + (flow.handle->dvh.matcher->matcher_object, + (void *)&flow.dv.value, flow.dv.actions_n, + flow.dv.actions, &flow.handle->drv_flow); + if (err == 0) { + claim_zero(mlx5_flow_os_destroy_flow + (flow.handle->drv_flow)); + flow.handle->drv_flow = NULL; + } + claim_zero(flow_dv_matcher_release(dev, flow.handle)); + if (err != 0) + break; + ret = vprio[i]; + } + mlx5_ipool_free(pool, flow.handle_idx); + /* Set rte_errno if no expected priority value matched. */ + if (ret < 0) + rte_errno = -ret; + return ret; +} + const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops = { .validate = flow_dv_validate, .prepare = flow_dv_prepare, @@ -17916,6 +18018,7 @@ const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops = { .action_update = flow_dv_action_update, .action_query = flow_dv_action_query, .sync_domain = flow_dv_sync_domain, + .discover_priorities = flow_dv_discover_priorities, }; #endif /* HAVE_IBV_FLOW_DV_SUPPORT */ diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 1627c3905f..c8cf7ef29c 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -28,17 +28,6 @@ #define VERBS_SPEC_INNER(item_flags) \ (!!((item_flags) & MLX5_FLOW_LAYER_TUNNEL) ? IBV_FLOW_SPEC_INNER : 0) -/* Map of Verbs to Flow priority with 8 Verbs priorities. */ -static const uint32_t priority_map_3[][MLX5_PRIORITY_MAP_MAX] = { - { 0, 1, 2 }, { 2, 3, 4 }, { 5, 6, 7 }, -}; - -/* Map of Verbs to Flow priority with 16 Verbs priorities. */ -static const uint32_t priority_map_5[][MLX5_PRIORITY_MAP_MAX] = { - { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }, - { 9, 10, 11 }, { 12, 13, 14 }, -}; - /* Verbs specification header. */ struct ibv_spec_header { enum ibv_flow_spec_type type; @@ -50,13 +39,17 @@ struct ibv_spec_header { * * @param[in] dev * Pointer to the Ethernet device structure. - * + * @param[in] vprio + * Expected result variants. + * @param[in] vprio_n + * Number of entries in @p vprio array. * @return - * number of supported flow priority on success, a negative errno + * Number of supported flow priority on success, a negative errno * value otherwise and rte_errno is set. */ -int -mlx5_flow_discover_priorities(struct rte_eth_dev *dev) +static int +flow_verbs_discover_priorities(struct rte_eth_dev *dev, + const uint16_t *vprio, int vprio_n) { struct mlx5_priv *priv = dev->data->dev_private; struct { @@ -79,7 +72,6 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev) }; struct ibv_flow *flow; struct mlx5_hrxq *drop = priv->drop_queue.hrxq; - uint16_t vprio[] = { 8, 16 }; int i; int priority = 0; @@ -87,7 +79,7 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev) rte_errno = ENOTSUP; return -rte_errno; } - for (i = 0; i != RTE_DIM(vprio); i++) { + for (i = 0; i != vprio_n; i++) { flow_attr.attr.priority = vprio[i] - 1; flow = mlx5_glue->create_flow(drop->qp, &flow_attr.attr); if (!flow) @@ -95,59 +87,9 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev) claim_zero(mlx5_glue->destroy_flow(flow)); priority = vprio[i]; } - switch (priority) { - case 8: - priority = RTE_DIM(priority_map_3); - break; - case 16: - priority = RTE_DIM(priority_map_5); - break; - default: - rte_errno = ENOTSUP; - DRV_LOG(ERR, - "port %u verbs maximum priority: %d expected 8/16", - dev->data->port_id, priority); - return -rte_errno; - } - DRV_LOG(INFO, "port %u supported flow priorities:" - " 0-%d for ingress or egress root table," - " 0-%d for non-root table or transfer root table.", - dev->data->port_id, priority - 2, - MLX5_NON_ROOT_FLOW_MAX_PRIO - 1); return priority; } -/** - * Adjust flow priority based on the highest layer and the request priority. - * - * @param[in] dev - * Pointer to the Ethernet device structure. - * @param[in] priority - * The rule base priority. - * @param[in] subpriority - * The priority based on the items. - * - * @return - * The new priority. - */ -uint32_t -mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, - uint32_t subpriority) -{ - uint32_t res = 0; - struct mlx5_priv *priv = dev->data->dev_private; - - switch (priv->config.flow_prio) { - case RTE_DIM(priority_map_3): - res = priority_map_3[priority][subpriority]; - break; - case RTE_DIM(priority_map_5): - res = priority_map_5[priority][subpriority]; - break; - } - return res; -} - /** * Get Verbs flow counter by index. * @@ -2087,4 +2029,5 @@ const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops = { .destroy = flow_verbs_destroy, .query = flow_verbs_query, .sync_domain = flow_verbs_sync_domain, + .discover_priorities = flow_verbs_discover_priorities, }; From patchwork Thu Oct 21 06:35:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102532 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 C393CA0C4B; Thu, 21 Oct 2021 08:36:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8516441185; Thu, 21 Oct 2021 08:36:08 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 6ABD941185; Thu, 21 Oct 2021 08:36:05 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.105) by mxs.oss.nvidia.com (10.13.234.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:36:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJYQRcWPihC0VhWsys4ZGE9EL510yus1YH6n41XwHLv3uh6izy2PxQkLD3byFv2iep2VtgwDqXs4fyzRaCOrKQwIWlX7j5uIH+95XDkyRIUkCJDvahOdgjtg+qNgraY8BRAgSJKZGpMRppoadbPA3uQMPx9/lUXHVbnxqXa3QZUkJIG+BTiN2rK9b/ZBGXnCV+s/jZsPpt9SUKO2+xuqk+fVxI4zR8GYCw4ltwIAn4o5szpAtKBS2tdltf7xXF+SfvNBnAO2Gwelioh/ci+KbAygxjGrVLlwqpVpPT2P2REZMTVFQgDANnxArbkMSUZLLb6eZM7J7eNRKU2nVhElYA== 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=wF3VhGJqAFPkr94VVzFeQUxOiVOhHMeityENzBWS4d0=; b=mWcOd9tS0jlQM+BeyNQMZmE4o4W2CmOsEQbsHGo0YJHeTJfN+X314VQQ4kXLliN/KKKeNUJVUewdYuhFdJxi4u7SkXY9JJBgw7F8ycgAbEC8nKw0pOS6TohhB1DijB9XP7DU44b1AeU1uogS+FThb7PuLHWyHrFsMOKZnS9BhX/5IGvMKc98FdUh9Jc6BsBLaM9zD295kNXzn5wsJwsKvgLo/RwD4rrLNOw9Z547snzmYrQIXE5uxRSj1IXRKLOFrzse2ZTZVRe9wAbwOsjQLD4M9Djzt3iF7K50uHrKtSTdMt25Sm0sgzZTK0bWRr0pxsalmgU8oK10rnGUngrVpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=wF3VhGJqAFPkr94VVzFeQUxOiVOhHMeityENzBWS4d0=; b=KZPe0hQGpU+AQ4BYT8unNKEe+eoYC+w8nWNUGqrpx/oJPLoj9o91ttV3OP2msGjFjrUzrQWnA0/1IoI7R+a5Ump6rS2siaFBgYr9TIJe/WFfEUeceqUnOC0VC0tEFwukjiVCT7VOPar5JSraJ44Z0LeEQMZbR3R6q7VsYtWnEi+6wUfdIrla0cYPrm8Dl72l/+0MuHLkMnzY+DMo+RfhnK2uBaWUpS42UG7RfhoGBzIHfpZxlcLjPqX/Pjey8eCQjE1Ur/+gaZSDkiboG7CX4+zPmINsHi7YiPL3RkxIWG4EqCogk/KzwjmGFS+jQIoQBtzxO+HkQ1xHz8n3a2rNhg== Received: from BN9P223CA0024.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::29) by DM6PR12MB4436.namprd12.prod.outlook.com (2603:10b6:5:2a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Thu, 21 Oct 2021 06:36:03 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::4d) by BN9P223CA0024.outlook.office365.com (2603:10b6:408:10b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17 via Frontend Transport; Thu, 21 Oct 2021 06:36:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:36:01 +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; Thu, 21 Oct 2021 06:35:52 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , , Matan Azrad , Viacheslav Ovsiienko Date: Thu, 21 Oct 2021 09:35:02 +0300 Message-ID: <20211021063503.3632732-6-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f8be024-9d23-41ca-5a7e-08d9945d0da0 X-MS-TrafficTypeDiagnostic: DM6PR12MB4436: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ihDC4Tv6Yz3oAfjY7VsPCZ4nDKlr8lDJcuMaYRE9wTtLncpjFMRQ8R4NtakApse6DLb0Bw8uugCn7f9dUK8TH0RCRqfsuHStyq4bOTcTGi+jj7xAkluUqRu7Akeul4DQSUiFLjJgqHGDGd3WTyctk0lPB+4xZ5D9YyHe1SnCx4MtpMuuzvT6IS7d7FmwR6g5N2BkxwiSKGCpuGfMiuzSWUfopqObmkN8eoke4Fj9al8BPmTLfn6P2R4V4+05NeXzb1KB0HZkxYP3cD04HRfj5yi4cl3sAjsin5jkxAc3vJ94XGIcSTFXhvzkcRefDYuDPYIO+QiGHZvhRrKXF6SmENPpVGOMIxapDozBVjQM+zqOhMxeHAixfq7qrXgkVOxL0vrV/MP7e/sRCtBUzYfjsWk0OgsVw6BHlsOe7Oz551Bq596pQQwPMgy96DnVKq1Cb2ajok3TCasK7lfLws+Z50csGnSIi0+EsJLLl1osNE0bgrHZCP4ihsSsrF3TJ8IbSM6qL1QR4f2sbABSSEnqMKEtLUtMIhGby2Hzs+VCWAnzARGYgd07yfb5jYSOz4Fk1W1rK8Kl8fjSWHWNz+VpY7ul77Q+1cy/CXrQpK87wuBSqQRNehqHuKcLUQy8xE27CR/R0mw48CgcwEmmvdypihH0COUJjZaaEmZpBsOFnlIdPBDPzVRUkxszCX6m82UbonbJ9GR2N9C+PVLNz9J61g== 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)(46966006)(36840700001)(5660300002)(30864003)(8936002)(70586007)(4326008)(6666004)(36756003)(8676002)(47076005)(450100002)(508600001)(86362001)(70206006)(26005)(2616005)(16526019)(6286002)(82310400003)(6916009)(55016002)(356005)(1076003)(107886003)(36860700001)(316002)(36906005)(83380400001)(2906002)(186003)(7696005)(336012)(7636003)(54906003)(426003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:36:01.1679 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8be024-9d23-41ca-5a7e-08d9945d0da0 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4436 Subject: [dpdk-dev] [PATCH v4 5/6] net/mlx5: create drop queue using DevX 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" Drop queue creation and destruction were not implemented for DevX flow engine and Verbs engine methods were used as a workaround. Implement these methods for DevX so that there is a valid queue ID that can be used regardless of queue configuration via API. Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 4 - drivers/net/mlx5/mlx5_devx.c | 211 ++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 35 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 60d2c398db..a8d4b9ae88 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1809,10 +1809,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } if (config->devx && config->dv_flow_en && config->dest_tir) { priv->obj_ops = devx_obj_ops; - priv->obj_ops.drop_action_create = - ibv_obj_ops.drop_action_create; - priv->obj_ops.drop_action_destroy = - ibv_obj_ops.drop_action_destroy; #ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify; #else diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index a1db53577a..1e62108c94 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -226,17 +226,17 @@ mlx5_rx_devx_get_event(struct mlx5_rxq_obj *rxq_obj) * * @param dev * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array. + * @param rxq_data + * RX queue data. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_rxq_create_devx_rq_resources(struct rte_eth_dev *dev, uint16_t idx) +mlx5_rxq_create_devx_rq_resources(struct rte_eth_dev *dev, + struct mlx5_rxq_data *rxq_data) { struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; struct mlx5_rxq_ctrl *rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); struct mlx5_devx_create_rq_attr rq_attr = { 0 }; @@ -289,20 +289,20 @@ mlx5_rxq_create_devx_rq_resources(struct rte_eth_dev *dev, uint16_t idx) * * @param dev * Pointer to Ethernet device. - * @param idx - * Queue index in DPDK Rx queue array. + * @param rxq_data + * RX queue data. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_rxq_create_devx_cq_resources(struct rte_eth_dev *dev, uint16_t idx) +mlx5_rxq_create_devx_cq_resources(struct rte_eth_dev *dev, + struct mlx5_rxq_data *rxq_data) { struct mlx5_devx_cq *cq_obj = 0; struct mlx5_devx_cq_attr cq_attr = { 0 }; struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_ctx_shared *sh = priv->sh; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; struct mlx5_rxq_ctrl *rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); unsigned int cqe_n = mlx5_rxq_cqe_num(rxq_data); @@ -497,13 +497,13 @@ mlx5_rxq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx) tmpl->fd = mlx5_os_get_devx_channel_fd(tmpl->devx_channel); } /* Create CQ using DevX API. */ - ret = mlx5_rxq_create_devx_cq_resources(dev, idx); + ret = mlx5_rxq_create_devx_cq_resources(dev, rxq_data); if (ret) { DRV_LOG(ERR, "Failed to create CQ."); goto error; } /* Create RQ using DevX API. */ - ret = mlx5_rxq_create_devx_rq_resources(dev, idx); + ret = mlx5_rxq_create_devx_rq_resources(dev, rxq_data); if (ret) { DRV_LOG(ERR, "Port %u Rx queue %u RQ creation failure.", dev->data->port_id, idx); @@ -536,6 +536,11 @@ mlx5_rxq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx) * Pointer to Ethernet device. * @param log_n * Log of number of queues in the array. + * @param queues + * List of RX queue indices or NULL, in which case + * the attribute will be filled by drop queue ID. + * @param queues_n + * Size of @p queues array or 0 if it is NULL. * @param ind_tbl * DevX indirection table object. * @@ -563,6 +568,11 @@ mlx5_devx_ind_table_create_rqt_attr(struct rte_eth_dev *dev, } rqt_attr->rqt_max_size = priv->config.ind_table_max_size; rqt_attr->rqt_actual_size = rqt_n; + if (queues == NULL) { + for (i = 0; i < rqt_n; i++) + rqt_attr->rq_list[i] = priv->drop_queue.rxq->rq->id; + return rqt_attr; + } for (i = 0; i != queues_n; ++i) { struct mlx5_rxq_data *rxq = (*priv->rxqs)[queues[i]]; struct mlx5_rxq_ctrl *rxq_ctrl = @@ -595,11 +605,12 @@ mlx5_devx_ind_table_new(struct rte_eth_dev *dev, const unsigned int log_n, { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_devx_rqt_attr *rqt_attr = NULL; + const uint16_t *queues = dev->data->dev_started ? ind_tbl->queues : + NULL; MLX5_ASSERT(ind_tbl); - rqt_attr = mlx5_devx_ind_table_create_rqt_attr(dev, log_n, - ind_tbl->queues, - ind_tbl->queues_n); + rqt_attr = mlx5_devx_ind_table_create_rqt_attr(dev, log_n, queues, + ind_tbl->queues_n); if (!rqt_attr) return -rte_errno; ind_tbl->rqt = mlx5_devx_cmd_create_rqt(priv->sh->ctx, rqt_attr); @@ -670,7 +681,8 @@ mlx5_devx_ind_table_destroy(struct mlx5_ind_table_obj *ind_tbl) * @param[in] hash_fields * Verbs protocol hash field to make the RSS on. * @param[in] ind_tbl - * Indirection table for TIR. + * Indirection table for TIR. If table queues array is NULL, + * a TIR for drop queue is assumed. * @param[in] tunnel * Tunnel type. * @param[out] tir_attr @@ -686,19 +698,27 @@ mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key, int tunnel, struct mlx5_devx_tir_attr *tir_attr) { struct mlx5_priv *priv = dev->data->dev_private; - struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[ind_tbl->queues[0]]; - struct mlx5_rxq_ctrl *rxq_ctrl = - container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); - enum mlx5_rxq_type rxq_obj_type = rxq_ctrl->type; + enum mlx5_rxq_type rxq_obj_type; bool lro = true; uint32_t i; - /* Enable TIR LRO only if all the queues were configured for. */ - for (i = 0; i < ind_tbl->queues_n; ++i) { - if (!(*priv->rxqs)[ind_tbl->queues[i]]->lro) { - lro = false; - break; + /* NULL queues designate drop queue. */ + if (ind_tbl->queues != NULL) { + struct mlx5_rxq_data *rxq_data = + (*priv->rxqs)[ind_tbl->queues[0]]; + struct mlx5_rxq_ctrl *rxq_ctrl = + container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); + rxq_obj_type = rxq_ctrl->type; + + /* Enable TIR LRO only if all the queues were configured for. */ + for (i = 0; i < ind_tbl->queues_n; ++i) { + if (!(*priv->rxqs)[ind_tbl->queues[i]]->lro) { + lro = false; + break; + } } + } else { + rxq_obj_type = priv->drop_queue.rxq->rxq_ctrl->type; } memset(tir_attr, 0, sizeof(*tir_attr)); tir_attr->disp_type = MLX5_TIRC_DISP_TYPE_INDIRECT; @@ -857,7 +877,7 @@ mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, } /** - * Create a DevX drop action for Rx Hash queue. + * Create a DevX drop Rx queue. * * @param dev * Pointer to Ethernet device. @@ -866,14 +886,99 @@ mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq, * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_devx_drop_action_create(struct rte_eth_dev *dev) +mlx5_rxq_devx_obj_drop_create(struct rte_eth_dev *dev) { - (void)dev; - DRV_LOG(ERR, "DevX drop action is not supported yet."); - rte_errno = ENOTSUP; + struct mlx5_priv *priv = dev->data->dev_private; + int socket_id = dev->device->numa_node; + struct mlx5_rxq_ctrl *rxq_ctrl; + struct mlx5_rxq_data *rxq_data; + struct mlx5_rxq_obj *rxq = NULL; + int ret; + + /* + * Initialize dummy control structures. + * They are required to hold pointers for cleanup + * and are only accessible via drop queue DevX objects. + */ + rxq_ctrl = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq_ctrl), + 0, socket_id); + if (rxq_ctrl == NULL) { + DRV_LOG(ERR, "Port %u could not allocate drop queue control", + dev->data->port_id); + rte_errno = ENOMEM; + goto error; + } + rxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, socket_id); + if (rxq == NULL) { + DRV_LOG(ERR, "Port %u could not allocate drop queue object", + dev->data->port_id); + rte_errno = ENOMEM; + goto error; + } + rxq->rxq_ctrl = rxq_ctrl; + rxq_ctrl->type = MLX5_RXQ_TYPE_STANDARD; + rxq_ctrl->priv = priv; + rxq_ctrl->obj = rxq; + rxq_data = &rxq_ctrl->rxq; + /* Create CQ using DevX API. */ + ret = mlx5_rxq_create_devx_cq_resources(dev, rxq_data); + if (ret != 0) { + DRV_LOG(ERR, "Port %u drop queue CQ creation failed.", + dev->data->port_id); + goto error; + } + /* Create RQ using DevX API. */ + ret = mlx5_rxq_create_devx_rq_resources(dev, rxq_data); + if (ret != 0) { + DRV_LOG(ERR, "Port %u drop queue RQ creation failed.", + dev->data->port_id); + rte_errno = ENOMEM; + goto error; + } + /* Change queue state to ready. */ + ret = mlx5_devx_modify_rq(rxq, MLX5_RXQ_MOD_RST2RDY); + if (ret != 0) + goto error; + /* Initialize drop queue. */ + priv->drop_queue.rxq = rxq; + return 0; +error: + ret = rte_errno; /* Save rte_errno before cleanup. */ + if (rxq != NULL) { + if (rxq->rq_obj.rq != NULL) + mlx5_devx_rq_destroy(&rxq->rq_obj); + if (rxq->cq_obj.cq != NULL) + mlx5_devx_cq_destroy(&rxq->cq_obj); + if (rxq->devx_channel) + mlx5_os_devx_destroy_event_channel + (rxq->devx_channel); + mlx5_free(rxq); + } + if (rxq_ctrl != NULL) + mlx5_free(rxq_ctrl); + rte_errno = ret; /* Restore rte_errno. */ return -rte_errno; } +/** + * Release drop Rx queue resources. + * + * @param dev + * Pointer to Ethernet device. + */ +static void +mlx5_rxq_devx_obj_drop_release(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_rxq_obj *rxq = priv->drop_queue.rxq; + struct mlx5_rxq_ctrl *rxq_ctrl = rxq->rxq_ctrl; + + mlx5_rxq_devx_obj_release(rxq); + mlx5_free(rxq); + mlx5_free(rxq_ctrl); + priv->drop_queue.rxq = NULL; +} + /** * Release a drop hash Rx queue. * @@ -883,9 +988,53 @@ mlx5_devx_drop_action_create(struct rte_eth_dev *dev) static void mlx5_devx_drop_action_destroy(struct rte_eth_dev *dev) { - (void)dev; - DRV_LOG(ERR, "DevX drop action is not supported yet."); - rte_errno = ENOTSUP; + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_hrxq *hrxq = priv->drop_queue.hrxq; + + if (hrxq->tir != NULL) + mlx5_devx_tir_destroy(hrxq); + if (hrxq->ind_table->ind_table != NULL) + mlx5_devx_ind_table_destroy(hrxq->ind_table); + if (priv->drop_queue.rxq->rq != NULL) + mlx5_rxq_devx_obj_drop_release(dev); +} + +/** + * Create a DevX drop action for Rx Hash queue. + * + * @param dev + * Pointer to Ethernet device. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +mlx5_devx_drop_action_create(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_hrxq *hrxq = priv->drop_queue.hrxq; + int ret; + + ret = mlx5_rxq_devx_obj_drop_create(dev); + if (ret != 0) { + DRV_LOG(ERR, "Cannot create drop RX queue"); + return ret; + } + /* hrxq->ind_table queues are NULL, drop RX queue ID will be used */ + ret = mlx5_devx_ind_table_new(dev, 0, hrxq->ind_table); + if (ret != 0) { + DRV_LOG(ERR, "Cannot create drop hash RX queue indirection table"); + goto error; + } + ret = mlx5_devx_hrxq_new(dev, hrxq, /* tunnel */ false); + if (ret != 0) { + DRV_LOG(ERR, "Cannot create drop hash RX queue"); + goto error; + } + return 0; +error: + mlx5_devx_drop_action_destroy(dev); + return ret; } /** From patchwork Thu Oct 21 06:35:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 102533 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 3993AA0C4B; Thu, 21 Oct 2021 08:36:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0F6641197; Thu, 21 Oct 2021 08:36:17 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 4528A41197; Thu, 21 Oct 2021 08:36:16 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Wed, 20 Oct 2021 23:36:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTD3pytNRoKsVRJTzZf2FKFBxkmYp+koJAtoivLQyvTA3Tj+aY0Pxu2jPo6NpOzRJc/DyZtVgl6ztHSS2jg0oinZvVWnC7eLfvBCEEWj87LGZaWmAQBksRdCxTIIeDr1opV3hfdt6Az7vf6YeTftd4BzsWD87TQPULV+W36V6KhWofGu2eyzj5WnoaU2mIRutu2QCcyHENZOLQmeE3cz6rF/Ek9soM9cIhAJr12b0SkiZ9s+ndtTjc3lX+6bqHeQ6i3x8Q5dJMC9gbkqeT9wZSgbVjHHj4I8BiWe3jhOK/B5UzmJfbJjPiuyuyAYZiD7CxNWqF12dy44PZfkAWymyg== 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=XfmIdjHSE//WLIwuKCo+Un3Xi04/GRJGGBHUlyGMRMM=; b=mq4SRRc3mg7zi4MV/5FQCIOw5o3gutQpV8wJgC9f5aI+cwvTtb73qtWuKZWGRMZ2OKtC7ftsLw7n0sXuecgBEz4i1tbmmUqBcVCoozOMkDGu6BYP8DrihdhgcY1Q9nYgN9WB/8Ep7eX1s8kb2pLf3ZhKfqKTvzSUg3taCDqjinhvxGhmee2LAjxTs+CLMRJ0uOXKLxPNLdCpOzbkcF1GRvSvOMRD+jt6TTwqwnCtTp117q5u85nE05UNbO1XP/7JCypre6ExEAlA6PUvx5uTdpq5xtmKzMa/LhYHq9CCKoy0/vmHhek3v7VsrWg2xapXLObyHABmhwPw6RKitG9vRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=XfmIdjHSE//WLIwuKCo+Un3Xi04/GRJGGBHUlyGMRMM=; b=lWwN0YjOlG6MfWY8bi3jLPjrUegbduYfPIKTmQ74cEdYqOUCZiMBG6ynw/hhEEc8ntabOEna46JoJ+ZB6q27qrcHdzOFREFAsthihdwIG9genyf5kWwSaxyLqeGZ0U1AiLH9doSKcVMOuJVjPXAyJlWysoeonOElMLlhimZ5f1W0CzF5VHxUOZSrYmYNbgO/kZoUBRuBtjgxIjymOJp1b9e84EmSxUsZU3wfp4DZ5o6mB7TDddaxtV+b05K+gprIPBH51vZG7NJUmP7kOhW+/KY+UoughRDiHXKtWnwk9lghiXaFToEC+jzvp5PhjVfDJ0/W7r18oQxJojfxUEwFRQ== Received: from BN9PR03CA0144.namprd03.prod.outlook.com (2603:10b6:408:fe::29) by CH2PR12MB3863.namprd12.prod.outlook.com (2603:10b6:610:2b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Thu, 21 Oct 2021 06:36:14 +0000 Received: from BN8NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fe:cafe::e4) by BN9PR03CA0144.outlook.office365.com (2603:10b6:408:fe::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:36:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN8NAM11FT005.mail.protection.outlook.com (10.13.176.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 06:36:12 +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; Thu, 21 Oct 2021 06:35:56 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , , , "Matan Azrad" , Viacheslav Ovsiienko Date: Thu, 21 Oct 2021 09:35:03 +0300 Message-ID: <20211021063503.3632732-7-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021063503.3632732-1-dkozlyuk@nvidia.com> References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5910709-9262-4203-fc27-08d9945d1405 X-MS-TrafficTypeDiagnostic: CH2PR12MB3863: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:291; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +1mvF8yDZJTuiD3BiAN/1FjIi4xmeA7UJ4nPi2Sn1/mlU9omR2Vi/06bbV66zvnf7AgdmeEMdmg+jHXV6wxzMRdCgP+/gqkFwCvTisHPpjRIC/Xy4m2uNdadRXJ11dlF/Cg6tLP++iKGCGMZF8UJL5zp93Jd5hq4u/hzyFT0g5JP1Z02hw8TziCkQa8iYao93fUvHuV1xZDBzqThi4wqurGym9IqCw1NWdhvhawW+u651VTZOYcgPc7xz5ZRh4rHNvwyZO/628n0nOh3vYEDJavJtuyZYoYdl2f3KVCiJQTty0tdN/7JBXkVdIOqer67VQzthCO6Y3lRb/pgqrLZOJIDLs2PPKmoAcPs1Tv7bCL3QLUvY+h1cnSHXrI975+777cDXYY7kAMax/Fvtl5n/kpi3hpUK9ix830JP/v1powFuVLwW+ajtyFlydzSCc7ezHk5cU28wCeLTrm54tQUyXYQjcuC5kBByVo/6INPfDpCqMq0hHmJkRKHjO12L94BN+aleOd5cNSfGHN+lrhcpjK1wENzoUeV19Sr6DkhaoxAPPC9aqnlDXYyCOGF8t1Bo/XLQN0vrPLvX6bsWngajCC0KTMMTFXz0sWvFebeyPFhVQBnv/rqrcnTvc5IGqp8bXZJwIV35TQqEKPK6ic4IoTz97jj3pgbrJtFZ5YDQTqeZNbbtre+91TpB3Plga69/xsrKCoX760TLNqRyzTktA== 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)(46966006)(36840700001)(6286002)(86362001)(5660300002)(2616005)(55016002)(7696005)(356005)(30864003)(6666004)(508600001)(4326008)(36756003)(16526019)(336012)(316002)(83380400001)(2906002)(47076005)(70586007)(8936002)(186003)(26005)(8676002)(107886003)(7636003)(54906003)(6916009)(426003)(82310400003)(450100002)(1076003)(70206006)(36860700001); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 06:36:12.8017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c5910709-9262-4203-fc27-08d9945d1405 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: BN8NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3863 Subject: [dpdk-dev] [PATCH v4 6/6] net/mlx5: preserve indirect actions on restart 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" MLX5 PMD uses reference counting to manage RX queue resources. After port stop shared RSS actions kept references to RX queues, preventing resource release. As a result, internal PMD mempool for such queues had been exhausted after a number of port restarts. Diagnostic message from rte_eth_dev_start(): Rx queue allocation failed: Cannot allocate memory Dereference RX queues used by indirect actions on port stop (detach) and restore references on port start (attach) in order to allow RX queue resource release, but keep indirect RSS across the port restart. Replace queue IDs in HW by drop queue ID on detach and restore actual queue IDs on attach. When the port is stopped, create indirect RSS in the detached state. As a result, MLX5 PMD is able to keep all its indirect actions across port restart. Advertise this capability. Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action") Cc: bingz@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.c | 194 ++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_flow.h | 2 + drivers/net/mlx5/mlx5_rx.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 99 ++++++++++++++-- drivers/net/mlx5/mlx5_trigger.c | 10 ++ 6 files changed, 276 insertions(+), 34 deletions(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 82e2284d98..419fec3e4e 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -321,6 +321,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->rx_offload_capa = (mlx5_get_rx_port_offloads() | info->rx_queue_offload_capa); info->tx_offload_capa = mlx5_get_tx_port_offloads(dev); + info->dev_capa = RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP; info->if_index = mlx5_ifindex(dev); info->reta_size = priv->reta_idx_n ? priv->reta_idx_n : config->ind_table_max_size; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 2768244c2e..df1e927534 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1583,6 +1583,58 @@ mlx5_flow_validate_action_queue(const struct rte_flow_action *action, return 0; } +/** + * Validate queue numbers for device RSS. + * + * @param[in] dev + * Configured device. + * @param[in] queues + * Array of queue numbers. + * @param[in] queues_n + * Size of the @p queues array. + * @param[out] error + * On error, filled with a textual error description. + * @param[out] queue + * On error, filled with an offending queue index in @p queues array. + * + * @return + * 0 on success, a negative errno code on error. + */ +static int +mlx5_validate_rss_queues(const struct rte_eth_dev *dev, + const uint16_t *queues, uint32_t queues_n, + const char **error, uint32_t *queue_idx) +{ + const struct mlx5_priv *priv = dev->data->dev_private; + enum mlx5_rxq_type rxq_type = MLX5_RXQ_TYPE_UNDEFINED; + uint32_t i; + + for (i = 0; i != queues_n; ++i) { + struct mlx5_rxq_ctrl *rxq_ctrl; + + if (queues[i] >= priv->rxqs_n) { + *error = "queue index out of range"; + *queue_idx = i; + return -EINVAL; + } + if (!(*priv->rxqs)[queues[i]]) { + *error = "queue is not configured"; + *queue_idx = i; + return -EINVAL; + } + rxq_ctrl = container_of((*priv->rxqs)[queues[i]], + struct mlx5_rxq_ctrl, rxq); + if (i == 0) + rxq_type = rxq_ctrl->type; + if (rxq_type != rxq_ctrl->type) { + *error = "combining hairpin and regular RSS queues is not supported"; + *queue_idx = i; + return -ENOTSUP; + } + } + return 0; +} + /* * Validate the rss action. * @@ -1603,8 +1655,9 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev, { struct mlx5_priv *priv = dev->data->dev_private; const struct rte_flow_action_rss *rss = action->conf; - enum mlx5_rxq_type rxq_type = MLX5_RXQ_TYPE_UNDEFINED; - unsigned int i; + int ret; + const char *message; + uint32_t queue_idx; if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT && rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) @@ -1668,27 +1721,12 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev, return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, "No queues configured"); - for (i = 0; i != rss->queue_num; ++i) { - struct mlx5_rxq_ctrl *rxq_ctrl; - - if (rss->queue[i] >= priv->rxqs_n) - return rte_flow_error_set - (error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, - &rss->queue[i], "queue index out of range"); - if (!(*priv->rxqs)[rss->queue[i]]) - return rte_flow_error_set - (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, - &rss->queue[i], "queue is not configured"); - rxq_ctrl = container_of((*priv->rxqs)[rss->queue[i]], - struct mlx5_rxq_ctrl, rxq); - if (i == 0) - rxq_type = rxq_ctrl->type; - if (rxq_type != rxq_ctrl->type) - return rte_flow_error_set - (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, - &rss->queue[i], - "combining hairpin and regular RSS queues is not supported"); + ret = mlx5_validate_rss_queues(dev, rss->queue, rss->queue_num, + &message, &queue_idx); + if (ret != 0) { + return rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + &rss->queue[queue_idx], message); } return 0; } @@ -8570,6 +8608,116 @@ mlx5_action_handle_flush(struct rte_eth_dev *dev) return ret; } +/** + * Validate existing indirect actions against current device configuration + * and attach them to device resources. + * + * @param dev + * Pointer to Ethernet device. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_action_handle_attach(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_indexed_pool *ipool = + priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS]; + struct mlx5_shared_action_rss *shared_rss, *shared_rss_last; + int ret = 0; + uint32_t idx; + + ILIST_FOREACH(ipool, priv->rss_shared_actions, idx, shared_rss, next) { + struct mlx5_ind_table_obj *ind_tbl = shared_rss->ind_tbl; + const char *message; + uint32_t queue_idx; + + ret = mlx5_validate_rss_queues(dev, ind_tbl->queues, + ind_tbl->queues_n, + &message, &queue_idx); + if (ret != 0) { + DRV_LOG(ERR, "Port %u cannot use queue %u in RSS: %s", + dev->data->port_id, ind_tbl->queues[queue_idx], + message); + break; + } + } + if (ret != 0) + return ret; + ILIST_FOREACH(ipool, priv->rss_shared_actions, idx, shared_rss, next) { + struct mlx5_ind_table_obj *ind_tbl = shared_rss->ind_tbl; + + ret = mlx5_ind_table_obj_attach(dev, ind_tbl); + if (ret != 0) { + DRV_LOG(ERR, "Port %u could not attach " + "indirection table obj %p", + dev->data->port_id, (void *)ind_tbl); + goto error; + } + } + return 0; +error: + shared_rss_last = shared_rss; + ILIST_FOREACH(ipool, priv->rss_shared_actions, idx, shared_rss, next) { + struct mlx5_ind_table_obj *ind_tbl = shared_rss->ind_tbl; + + if (shared_rss == shared_rss_last) + break; + if (mlx5_ind_table_obj_detach(dev, ind_tbl) != 0) + DRV_LOG(CRIT, "Port %u could not detach " + "indirection table obj %p on rollback", + dev->data->port_id, (void *)ind_tbl); + } + return ret; +} + +/** + * Detach indirect actions of the device from its resources. + * + * @param dev + * Pointer to Ethernet device. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_action_handle_detach(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_indexed_pool *ipool = + priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS]; + struct mlx5_shared_action_rss *shared_rss, *shared_rss_last; + int ret = 0; + uint32_t idx; + + ILIST_FOREACH(ipool, priv->rss_shared_actions, idx, shared_rss, next) { + struct mlx5_ind_table_obj *ind_tbl = shared_rss->ind_tbl; + + ret = mlx5_ind_table_obj_detach(dev, ind_tbl); + if (ret != 0) { + DRV_LOG(ERR, "Port %u could not detach " + "indirection table obj %p", + dev->data->port_id, (void *)ind_tbl); + goto error; + } + } + return 0; +error: + shared_rss_last = shared_rss; + ILIST_FOREACH(ipool, priv->rss_shared_actions, idx, shared_rss, next) { + struct mlx5_ind_table_obj *ind_tbl = shared_rss->ind_tbl; + + if (shared_rss == shared_rss_last) + break; + if (mlx5_ind_table_obj_attach(dev, ind_tbl) != 0) + DRV_LOG(CRIT, "Port %u could not attach " + "indirection table obj %p on rollback", + dev->data->port_id, (void *)ind_tbl); + } + return ret; +} + #ifndef HAVE_MLX5DV_DR #define MLX5_DOMAIN_SYNC_FLOW ((1 << 0) | (1 << 1)) #else diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 8f94125f26..6bc7946cc3 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1574,6 +1574,8 @@ void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev, struct mlx5_flow_meter_policy *mtr_policy); int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev); int mlx5_flow_discover_dr_action_support(struct rte_eth_dev *dev); +int mlx5_action_handle_attach(struct rte_eth_dev *dev); +int mlx5_action_handle_detach(struct rte_eth_dev *dev); int mlx5_action_handle_flush(struct rte_eth_dev *dev); void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id); int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh); diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index a90cb497d1..6d010059f1 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -222,6 +222,10 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); +int mlx5_ind_table_obj_attach(struct rte_eth_dev *dev, + struct mlx5_ind_table_obj *ind_tbl); +int mlx5_ind_table_obj_detach(struct rte_eth_dev *dev, + struct mlx5_ind_table_obj *ind_tbl); struct mlx5_list_entry *mlx5_hrxq_create_cb(void *tool_ctx, void *cb_ctx); int mlx5_hrxq_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 60673d014d..47124f6e81 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2028,6 +2028,26 @@ mlx5_ind_table_obj_new(struct rte_eth_dev *dev, const uint16_t *queues, return ind_tbl; } +static int +mlx5_ind_table_obj_check_standalone(struct rte_eth_dev *dev __rte_unused, + struct mlx5_ind_table_obj *ind_tbl) +{ + uint32_t refcnt; + + refcnt = __atomic_load_n(&ind_tbl->refcnt, __ATOMIC_RELAXED); + if (refcnt <= 1) + return 0; + /* + * Modification of indirection tables having more than 1 + * reference is unsupported. + */ + DRV_LOG(DEBUG, + "Port %u cannot modify indirection table %p (refcnt %u > 1).", + dev->data->port_id, (void *)ind_tbl, refcnt); + rte_errno = EINVAL; + return -rte_errno; +} + /** * Modify an indirection table. * @@ -2060,18 +2080,8 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, MLX5_ASSERT(standalone); RTE_SET_USED(standalone); - if (__atomic_load_n(&ind_tbl->refcnt, __ATOMIC_RELAXED) > 1) { - /* - * Modification of indirection ntables having more than 1 - * reference unsupported. Intended for standalone indirection - * tables only. - */ - DRV_LOG(DEBUG, - "Port %u cannot modify indirection table (refcnt> 1).", - dev->data->port_id); - rte_errno = EINVAL; + if (mlx5_ind_table_obj_check_standalone(dev, ind_tbl) < 0) return -rte_errno; - } for (i = 0; i != queues_n; ++i) { if (!mlx5_rxq_get(dev, queues[i])) { ret = -rte_errno; @@ -2097,6 +2107,73 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, return ret; } +/** + * Attach an indirection table to its queues. + * + * @param dev + * Pointer to Ethernet device. + * @param ind_table + * Indirection table to attach. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_ind_table_obj_attach(struct rte_eth_dev *dev, + struct mlx5_ind_table_obj *ind_tbl) +{ + unsigned int i; + int ret; + + ret = mlx5_ind_table_obj_modify(dev, ind_tbl, ind_tbl->queues, + ind_tbl->queues_n, true); + if (ret != 0) { + DRV_LOG(ERR, "Port %u could not modify indirect table obj %p", + dev->data->port_id, (void *)ind_tbl); + return ret; + } + for (i = 0; i < ind_tbl->queues_n; i++) + mlx5_rxq_get(dev, ind_tbl->queues[i]); + return 0; +} + +/** + * Detach an indirection table from its queues. + * + * @param dev + * Pointer to Ethernet device. + * @param ind_table + * Indirection table to detach. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_ind_table_obj_detach(struct rte_eth_dev *dev, + struct mlx5_ind_table_obj *ind_tbl) +{ + struct mlx5_priv *priv = dev->data->dev_private; + const unsigned int n = rte_is_power_of_2(ind_tbl->queues_n) ? + log2above(ind_tbl->queues_n) : + log2above(priv->config.ind_table_max_size); + unsigned int i; + int ret; + + ret = mlx5_ind_table_obj_check_standalone(dev, ind_tbl); + if (ret != 0) + return ret; + MLX5_ASSERT(priv->obj_ops.ind_table_modify); + ret = priv->obj_ops.ind_table_modify(dev, n, NULL, 0, ind_tbl); + if (ret != 0) { + DRV_LOG(ERR, "Port %u could not modify indirect table obj %p", + dev->data->port_id, (void *)ind_tbl); + return ret; + } + for (i = 0; i < ind_tbl->queues_n; i++) + mlx5_rxq_release(dev, ind_tbl->queues[i]); + return ret; +} + int mlx5_hrxq_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 3cbf5816a1..6295c6b3e9 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -14,6 +14,7 @@ #include #include "mlx5.h" +#include "mlx5_flow.h" #include "mlx5_mr.h" #include "mlx5_rx.h" #include "mlx5_tx.h" @@ -1161,6 +1162,14 @@ mlx5_dev_start(struct rte_eth_dev *dev) mlx5_rxq_timestamp_set(dev); /* Set a mask and offset of scheduling on timestamp into Tx queues. */ mlx5_txq_dynf_timestamp_set(dev); + /* Attach indirection table objects detached on port stop. */ + ret = mlx5_action_handle_attach(dev); + if (ret) { + DRV_LOG(ERR, + "port %u failed to attach indirect actions: %s", + dev->data->port_id, rte_strerror(rte_errno)); + goto error; + } /* * In non-cached mode, it only needs to start the default mreg copy * action and no flow created by application exists anymore. @@ -1238,6 +1247,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev) /* All RX queue flags will be cleared in the flush interface. */ mlx5_flow_list_flush(dev, MLX5_FLOW_TYPE_GEN, true); mlx5_flow_meter_rxq_flush(dev); + mlx5_action_handle_detach(dev); mlx5_rx_intr_vec_disable(dev); priv->sh->port[priv->dev_port - 1].ih_port_id = RTE_MAX_ETHPORTS; priv->sh->port[priv->dev_port - 1].devx_ih_port_id = RTE_MAX_ETHPORTS;