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 834BFA0C4E; Tue, 2 Nov 2021 14:54:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C1AF41165; Tue, 2 Nov 2021 14:54:38 +0100 (CET) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 1579241157 for ; Tue, 2 Nov 2021 14:54:36 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) 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; Tue, 2 Nov 2021 06:54:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lPG+zQ0JIWckpirHuJrOLL0KIi/3juJ3Fm+8XXBnPafSX/TC95d/e6BO0dUjYR//lVO1Rj2GJ9QIQMn1gaCM2bJPadJqbVuhNnZyCG1I0jYEZu+4fjMUfxfrIEkR30SEH+7d2qnZUqrCPJ+3fyNc2TqZ2qR02Yj1aadR8RabTAgcLwC9Sp1mJ/kyVHyhtJ2gFb+wfqpfalUsHkSXmAa+VRgS4eFj9qf0L25LWajkRf/lSU2pFzVfux5YKe5PxaWUfYEimvaV1S4sTbTa08R5gJmFYqchl6XBnpHNOKElDVQt/vwxq4FhlsZPwq+K24sNyULDYFnqz4vRoqjgM4dY6g== 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=RC0ZdV58kGomw7BbLQTMyGI39SX8nUj7DGunP+cx6fw=; b=OLPwXfvBF+5BiIGV6Msme7viQhbvqekuhooCAEAa2vw0KI8E5J07+/lcLC8azUJA0F53T+9uZkUnF0rsKsnqg2elblaOGin3fsJMeYY9/OMI+2FgtXFH6386isYetMG96qLk4npwBAubYrkF3D1ElZQMfFABH74HagJXbhDM8uXNzTOip9peA2L0JtGHX3MuS6roTvivRFjeckrwbFvy7p34MTHVjO71v4mrh7APTfAzgQo69KrsjWsDT9NyJoo7FCfgCY1Rqbhm4FZcoipbUN+oUPnwtp0io4hLak/oYu35yW1tNOxAbig/eFchA2X/IZLnj16nEmzyI11mRCqImA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net 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=RC0ZdV58kGomw7BbLQTMyGI39SX8nUj7DGunP+cx6fw=; b=cco1eEao01TqS3cRaS/lkvQhU2q4XMtLgDBgNbcVDF90fSwcn80Mg7trsL91dYyXuhKsg80crbECHML7Y8zohRTbkpJOUqXO/avPYqSmd24aUzdYPhm8KpkGJtFhvayKRJMRiPChEPOtiXVeMPVzZh55V7Sy5mIeRCgbIcpwKPYKz9YypoEHN/aBIFjRP/AHX367A6PHHkRo6BYFdCCphhBQ61tzGfqW0th9Tu+e7o1bsiek4y7LduExbug8INYFX5srb8Cp2ajcolaqegvatY5ZYh7PpvpmsR2EFdeGfn4OK3mT+cYgbhwvYAbMSClQaoiEqjooTUo0BolcAFcnNg== Received: from CO2PR04CA0073.namprd04.prod.outlook.com (2603:10b6:102:1::41) by MN2PR12MB4438.namprd12.prod.outlook.com (2603:10b6:208:267::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Tue, 2 Nov 2021 13:54:34 +0000 Received: from CO1NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:102:1:cafe::3a) by CO2PR04CA0073.outlook.office365.com (2603:10b6:102:1::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 2 Nov 2021 13:54:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; 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 CO1NAM11FT027.mail.protection.outlook.com (10.13.174.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 2 Nov 2021 13:54: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; Tue, 2 Nov 2021 13:54:31 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Andrew Rybchenko , Thomas Monjalon , Ferruh Yigit Date: Tue, 2 Nov 2021 15:54:11 +0200 Message-ID: <20211102135415.944050-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102135415.944050-1-dkozlyuk@nvidia.com> References: <20211021063503.3632732-1-dkozlyuk@nvidia.com> <20211102135415.944050-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99320de9-642e-4832-84c3-08d99e084cc7 X-MS-TrafficTypeDiagnostic: MN2PR12MB4438: 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: +FYgDz3R9l/v9rQCJgPx2kRIivPc/7m1SFtq9y4dP1bR3mgD+v86209Q3JNanpYFIJzSbdas1PLB3jICXXZGGCnxd+MreiyrSsnkmDbe9z1IAMnopT5V7ZJceXBPrCIZK7WwbHjlRjqTbS1moRG4YMXLqYiUNiPZ0EotDFUh91tMXDmGs8UXlkb7oPQ1z2fCtfH/XNl6h8alWCU/Xrbs0G2x3YtuFnrGrgs2T9mxsRYFonNn6E+Z5IM8iWMFlzaCz1gLPezTbttcuuTkn2vjg4cfI0y05qrxCl52QZtuVQXvCaYaT2SPj54/ZoL+fCIQ36Db8zbl02FBeR9uXoR6vFpaCyF1BvhdkGJnrkoirO4keBoyJJxZyXIfLo22JMJ5g1PdJHzlEe55bfqj1b9siOknOAqYTjHSdWeEP0qLQ6u2eEBL8TRDqhW5PBFiXOlEIorZ6NVdt2XkAckKbXU+y276O6mUEwqPddhsRmbLla224vsyAdTUF50A2vLMIqONHPBNrTxPKH2nI9ATA7XE64bIzp08ueny+DQfdIDAaYMN2mrMZJ1EdRpsuHd9okCnQp6e9DUCxYyMnO1xnpTWnqTfiEEpQUfWGifzF2Y99LzZgJw/RJw/a8e8ZVGLGn9TyhFoid2RTA1q7panQNKNboMgU362/nEx2gcx8oeexiyEJ282qm8EbmY7Sqkh8546bEJu4dMYNBv5qCSuFwdf1w== 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)(16526019)(26005)(316002)(2906002)(336012)(36860700001)(5660300002)(186003)(2616005)(83380400001)(47076005)(426003)(6286002)(8936002)(36756003)(70586007)(7636003)(55016002)(70206006)(356005)(7696005)(82310400003)(4326008)(107886003)(86362001)(508600001)(8676002)(54906003)(6916009)(6666004)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2021 13:54:33.3577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99320de9-642e-4832-84c3-08d99e084cc7 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: CO1NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4438 Subject: [dpdk-dev] [PATCH v5 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: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 34 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index e01a079230..77de8da973 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2995,6 +2995,37 @@ 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()``. +.. warning:: + + The following description of indirect action persistence + is an experimental behavior that may change without a prior notice. + +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 a18e6ab887..5f803ad1e6 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(). @@ -1698,6 +1699,8 @@ struct rte_eth_conf { #define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2) /** Device supports keeping flow rules across restart. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3) +/** Device supports keeping shared flow objects across restart. */ +#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4) /**@}*/ /* -- 2.25.1