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 CCBF8A034F; Fri, 15 Oct 2021 18:18:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0D3B4112E; Fri, 15 Oct 2021 18:18:48 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id B61BB4111E for ; Fri, 15 Oct 2021 18:18:45 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) 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; Fri, 15 Oct 2021 09:18:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coJbBjvbmM4ico1l87u/jQC1HYzkoSRf2fdBTnklOha9Am1NEsq3HYbLfjaeT5PGcDn4MCM7zbKwtvhcUAB+CADu+WVLPkXWYL9dLSFv41DrqglEbUq80O11aXoKiaa9BEOZN056Os81eazq3AsRQRpM2ESr2ARCHERvzaK6/3yjM87u+rDuaaCI+i5dzxd1wLKhiwzDHeICnr/zdKAZNTr6m9dJo/qa8D9034bGZG+tW6b9hS/63QZzhFBHsh4FnmV9e3i+gU5uLtzghCPoBYdOoyArZ/x6gp6GgEUuuFgn/zIjhAv02RP9YHEy96OuFGsdDDsmC/Ry0caQi/HWMQ== 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=/tEggOzUPrcmYDf/aToJehiBrdHqjqmUvbN/zwjH4HY=; b=Sy0qkBSA/AeNTqGRtVNLuSjqhUgALTN/PIfKtL1B3co+MXVwGES5Uf7pzyix6RL0nmhMzTFWxya2goHOi/uQozPe14dZf4DShfMBFPzqw17DkZ89SSWB3M2IDlo7dxSinyXTsXb0rqO4dM91tcGIaak4inNcii5NeKQEYh0kW9UFbrMgG3ztnB8r+pfZ+dVpRLbSOaYs13++x1nlBAXVdg5l1w0g8ui7DCHz6r8tkUszvNXsvjTso4ae8Om0SrQY+cnOGnfpZt3DTenKLdG/RHQSitrHGmssrdGtjSAy8KNO57Nekb4TVRi9GqDe173qP6hF92JsVsL+VR9jNdpYCA== 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=/tEggOzUPrcmYDf/aToJehiBrdHqjqmUvbN/zwjH4HY=; b=DVQr89fN41fz4I6L2sYlARxI5mzY1drUhOyvo43pqNB50TWDn7XD7OWXi5XaZnjjtIvHjXp1HGLsXHJMXr9vbf5GlZ2n0YEHpcnU3i93UUJ9N6hebvVt/ihLTQtj6YPPExR9dutc+w5sOiAd3M9uD4Oye54ninw8sQOlvLgH3ALFDQ0pcrUaYu6JPJyY3ohPb7RFrmLHfNikz76hKw6iPz0mDwvivJ2xngp01lcTOszlxDkuxXECKTU66HZkhLlpLKb97j6hVqdX58Nvfebbkk8jKVyrlvDMPu6aVZmMktC3f6y2SFQk3alaYO4yk9UPrOpvAWF4zDbhW+/w8Fqzig== Received: from DM5PR1101CA0009.namprd11.prod.outlook.com (2603:10b6:4:4c::19) by MWHPR12MB1775.namprd12.prod.outlook.com (2603:10b6:300:109::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Fri, 15 Oct 2021 16:18:39 +0000 Received: from DM6NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:4:4c::4) by DM5PR1101CA0009.outlook.office365.com (2603:10b6:4:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14 via Frontend Transport; Fri, 15 Oct 2021 16:18:39 +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 DM6NAM11FT032.mail.protection.outlook.com (10.13.173.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Fri, 15 Oct 2021 16:18:39 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 15 Oct 2021 16:18:37 +0000 From: Dmitry Kozlyuk To: CC: Ori Kam , Thomas Monjalon , "Ferruh Yigit" , Andrew Rybchenko Date: Fri, 15 Oct 2021 19:18:18 +0300 Message-ID: <20211015161822.3099818-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015161822.3099818-1-dkozlyuk@nvidia.com> References: <20211005005216.2427489-1-dkozlyuk@nvidia.com> <20211015161822.3099818-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] 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: 28f9210f-16f3-43c6-d0d4-08d98ff772fd X-MS-TrafficTypeDiagnostic: MWHPR12MB1775: 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:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QmskpVVlyYUWTMaIbPI+DWx+POQukKEMtvTRepJt4g6mNuC6nS8TM493B6CZpDdC1+O+HeWnYjksrn/UGwPXwFwgZjzlHnecZAj5SrtA9XMj4ROX+2/ojDPMY9NSR9IaxTLNbDH+RnWw9b9LKloyX7EKcfqpgHOETqEg1BkLP754GPiYY1nFmAYObr5JxvlZUeNtUmeK3tumI4m0SBLUnyhSP6t32+OGY4ZL86UorD/EJc7IiKOhAwmx0FcQxljbzeVsnN89eBWpGd2O1R9WDLfz+K1w/bR4bSaxiTRyIrziSZOjKT+ABbphwS1MdXcoiUQjUs+AVCbTThofqiQYq+/GY8cXbf5kjKZuLni6Wv7nebpN9K6dUeyB79F08EHK1cQnc5ceNj0/+jQ9oM/ZRjKcAm26fToI6Mjly1jLpjUcj5xTzhRKiN5k0pVvaK9SXMWEU5cOOO2l0rM0Vme9EGuuuRmKTFNGIuGUhn14O/g2XsSxu8eN/JMMcyEgirnBV0CZGm91nir6711OCA2qFr7x+/UDPH27jXTkoM2u1PHz8lGvy4hX0QHCEs/SewEgtiU4iA5JOuzy26JqlE4ql/wL+9jgvpwxvZ0G+rAcVIqvZetBPhNN0GSDjTrqak7Ghmdu3dlXD8W843Y+3k0FDgsXmlMcwB5kPtzglvttX7VQYZO7F7nhxZJRAVbYbzeqNqBiHSY5YywYncSZW8bj4A== 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)(83380400001)(47076005)(55016002)(2616005)(36906005)(7636003)(2906002)(1076003)(8936002)(36860700001)(6666004)(316002)(6286002)(54906003)(356005)(26005)(70206006)(4326008)(5660300002)(508600001)(6916009)(16526019)(186003)(36756003)(82310400003)(86362001)(336012)(8676002)(107886003)(7696005)(70586007)(426003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2021 16:18:39.7487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28f9210f-16f3-43c6-d0d4-08d98ff772fd 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: DM6NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1775 Subject: [dpdk-dev] [PATCH v2 1/5] 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" Currently, it is 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, which together comprise the rule kind. 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, which is now explicitly stated. Declare that the application can test for persitence of flow rules of a particular kind by attempting to create a rule of that kind 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. If the device is being reconfigured in a way that is incompatible with existing flow rules, PMD is required to report an error. This is mandatory, because flow API does not supply users with capabilities, so this is the only way for a user to learn that configuration is invalid. For example, if queue count changes and the action of a flow rule specifies queues that are going away, the user must update or remove the flow rule before removing the queues. Signed-off-by: Dmitry Kozlyuk --- doc/guides/prog_guide/rte_flow.rst | 27 +++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 7 +++++++ lib/ethdev/rte_flow.h | 1 + 3 files changed, 35 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2b42d5ec8c..b0ced4209b 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -87,6 +87,33 @@ 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. +By default it is unspecified if the flow rules persist after the device stop. +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, +then rules must be explicitly flushed before stopping the device +if the application needs to ensure they are removed. +If it is advertised, this means the PMD can keep at least some rules +across the device stop and start with possible reconfiguration in between. +However, it may be only supported for some kinds of rules. +The kind is a combination of the following rule properties: + +- the sequence of item types; +- the sequence of action types; +- the value of the transfer attribute. + +To test if a particular kind of rules is kept, the application must try +to create a valid rule of that kind when the device is stopped +(after it has been configured or started previously). +If it succeeds, all rules of the same kind are kept at the device stop. +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, +rules of this kind are flushed when the device is stopped. +Rules of a kept kind that are created when the device is stopped, including +the rules created for the test, will be kept after the device is started. +Some configuration changes may be incompatible with existing rules. +In this case ``rte_eth_dev_configure()``, ``rte_eth_rx/tx_queue_setup()``, +and/or ``rte_eth_dev_start()`` will fail with a log message from the PMD that +should be similar to the one that would be emitted by ``rte_flow_create()`` +if an attempt was made to create the offending rule with the new configuration. + 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 6d80514ba7..a0b388bb25 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 a89945061a..aa0182d021 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3344,6 +3344,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. */ }; /** -- 2.25.1