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 98F0DA0C4D; Tue, 19 Oct 2021 14:37:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82E30411A5; Tue, 19 Oct 2021 14:37:53 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 4C4C84119C for ; Tue, 19 Oct 2021 14:37:49 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) 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; Tue, 19 Oct 2021 05:37:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q4i9oV+qQHuIPx8BkfNA8jH0ChWRmTTZ6n+xw/V7Ramcu475Gbh3mPZAnYKIW9UmlX/FkC/PUXT0dPsANdhZx3wc4GWYB1bkzZTJH+lJhQK01Zk8W6uD3ExXbJk2Y6mVvwvSClrRLPrSrCzPtANPlJTxn7NbBxsKgLmwDUxxD++qQV/KYPhl4UsQ0Z9VDXEmTgfQZkIG2dq2XnI1epOnYahh/Rwzpq1/NbVEbdc9+pU4EkIfeZz1/mwno7MieShiLEvVt0u2LmDKmniL8UnrLVSFYhL+LCZgsyIr5V9wW3qHNH3RnyvX9ksKOChUqEjyS7hFek72h78B2YEraOLXmQ== 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=BXYNqTNFd/zQX0bUnq5JzyjptPBLbo4ViEGGTPxvjdk=; b=AIDoznc0syiqJT2zAQhcIt+konAYzLkedUCcS9YyiAXVIFP0LUmz6vO6GIyTEAd6i/C9rKbL6oIr4oQZgcYy1XqhtQWHxesU99Wt8Vh56fRMvqMgweK+KVLaF9uN52KxYABs/htt0c/JWvOZYEknNiqupPFzEy60D84wLgwgrQhtxdIl+l3WFAH2zjhx9Nq2+jomFwjMIEj6GZSZyMaMfZ13Uhf0hLXopnnPdV/swoLYgawDj5vXattFKv8hUuD+h/SCnibS0Tkq+pKTD+NM1kniJfDgGuHoQKNxX/Nvnnoo2Pi62ABaK5u0Df4c3goufa8AG6PXnkagRgi5LdU5eQ== 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=BXYNqTNFd/zQX0bUnq5JzyjptPBLbo4ViEGGTPxvjdk=; b=Xjgs8JBh4K+kWyUIJ3XnGns21Y0XJpDy90PEA2qBHKv+J0DcxZC3zR8HLxOcqB50/bH79EJYRrX0otLE3J8kgYCogabL5CXoKRZvjfv1au4pnN3CWbS1YfwhQuJhDyEb2PXhwk45qpUFvWxenJNVonEf4Q9zhp9rl9DfCpz9DYpslK8EEBmQV1qcHNRHlJoZPsTpn9Z9tpg/KIBIcjC7skbizDqHd22MOsYa4QBixC7vTcmOV75c/qUipcZ2jrd00JBH6L3HAzD0drQrSl6wDyyMEvGkSP1SqCICtE9PS0FBFHJ1/p+KqeqPRi+fLCNpeLrmm37GY2RhhbyZZtfOmw== Received: from DM5PR1101CA0024.namprd11.prod.outlook.com (2603:10b6:4:4c::34) by CY4PR12MB1398.namprd12.prod.outlook.com (2603:10b6:903:40::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 12:37:47 +0000 Received: from DM6NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:4:4c:cafe::f3) by DM5PR1101CA0024.outlook.office365.com (2603:10b6:4:4c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 12:37:47 +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 DM6NAM11FT013.mail.protection.outlook.com (10.13.173.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 12:37:47 +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, 19 Oct 2021 12:37:43 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko Date: Tue, 19 Oct 2021 15:37:18 +0300 Message-ID: <20211019123722.3414694-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019123722.3414694-1-dkozlyuk@nvidia.com> References: <20211015161822.3099818-1-dkozlyuk@nvidia.com> <20211019123722.3414694-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: da91c0b3-b781-4e5d-d104-08d992fd41aa X-MS-TrafficTypeDiagnostic: CY4PR12MB1398: 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:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9qKW6xrs3iW1JTerG4AHOgZ2jkc3MPvAqbU7XDipsUh02Y+8FYyNW7+W7gGkGdmVEJDq4xOV9rxI4gGMk/hh6QS7HEUchOimhsifvQ0Err3jYXT+1qeTf/OnQzSDbde6TmbahCo799OQI2USBClzHBURwZmlFZ69eGeoaxN7M8pusQ7dTmQz6WkPjm4jQ6lN0wsIPTT/YzBc56zB495vyVwjCrTaVIkOEwjuKG00m7Q6Q3iDxmZ+P5y3i/2vagMvKP46ZwLtTpaVGhk7p2NOrXfGSt0qCwd/L7T4zJg+d/6L/hpKg9W4p4XOhR3E7ik4ax1ECoEdcShM6GnPvOXIrHkAIGcr0gKYOGoMNBdh/+9th3MBvRxjkYqXQXiAwqHRY64G7s4Ykr/5g6niOK0NhbWGaz0cvvz74iOMC3oQEaFpqApsYvmMfNsvNtaw4YzUBbpsSKr/zVvS0sAV7UEXR9pKXNNtWKGrL771LKhZp2zQLAGxaH9wNUOBgZmZUVjthppKojmcLdYJ/DrotUml96GsshVLZoRczHtWa2qSHxNHe3P5aWRJ0dVYoXRU0Uaz5bdt1pU5c4ay53VVTatK4W+moEJ5JBtfBCdjv147Qm7RGkwCQe8ProQrLGOA5wEEZ5MCUK9BL9WiTLkXi1PjnGV7Iqur1E35MIxk15CExIRsxuuTG9ahudGREG4VXMjTTpOC8nvBh/BEZN7OYmwyDA== 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)(2906002)(6666004)(6916009)(426003)(4326008)(6286002)(86362001)(82310400003)(1076003)(55016002)(36756003)(7696005)(26005)(16526019)(36860700001)(316002)(70206006)(186003)(8936002)(356005)(107886003)(2616005)(8676002)(5660300002)(508600001)(83380400001)(54906003)(70586007)(336012)(36906005)(47076005)(7636003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 12:37:47.0513 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da91c0b3-b781-4e5d-d104-08d992fd41aa 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: DM6NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1398 Subject: [dpdk-dev] [PATCH v3 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 | 24 ++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index ff67b211e3..19e17f453d 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2810,6 +2810,30 @@ 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. +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 stopped (after it has been configured or started previously). +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +indirect actions of this kind are flushed when the device is stopped. +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 a0b388bb25..12fc7262eb 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