From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 --- 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 /**@}*/ /* -- 2.25.1