From patchwork Wed Sep 1 08:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 97672 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 2A935A0C58; Wed, 1 Sep 2021 10:56:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1138840698; Wed, 1 Sep 2021 10:56:17 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by mails.dpdk.org (Postfix) with ESMTP id EB1024013F for ; Wed, 1 Sep 2021 10:56:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWudJJHmTm4rTHk4Q8diOA6wudAsXxYXhjmDasxr9jSIXkl2kQS1RdaG2YzKQFcA2LtK1S+pIga6Enx8OrdFziOmCwBFEPMys1NfZYu9Q0tE77Iof0c3rSxDgwRBu8TB/WiM67bxIFAgxcFfWQhr35gfC+y9EURJ+FBuh1XaGoXuJYdEz2H0ZR7aqbNzU8pxJRHuvaPeBcJsytSPZxcjL4HHp+rBWkk1eunBykDWrC0KbqkcDx89TLySGiWbLe6qLMmCMEaqoh84bbtD/ibvIFVqkkDPCgbYVhr9Wy6M5N8m5fAqmyOgmL3ClfYEUwbYaQYOT1YNQDie5vZxFV1/6w== 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-SenderADCheck; bh=GYOQAEt0FMHBv3MJjxhW8wDiWassvuKEcLU0JplQves=; b=nizDTuAYZ1cMkhhY5kYkJiXsA0Lkf8zlMW6QPXIbINkxyACAMQsaU9mYYhhORKxZ+gZtjPfD+AmQffFC+rjWnx5NOrXHwcT5MtuDeCjFCb1M9f8+t9aI3SlLAuIYCTfUTRWO+uipAuNpf/wX2w/S8hvYsPnz2v1kts5ZkG8baM5WsUUfqbkFGbN6NJyiaoYsL9nuMJmHxi9/+p1BurWsv56uEZ4sQaoSd9J0ysbn0NvegzEOt56Si4J8uinjy6y8wu1YD15BoQR8Eu4qZ+9KDwzi/XxI2rxIDzq3f9JQ6IMZUu3d2c+B54noby+LETGBlwUBqBDDwxwRs0vXlcA9PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=oktetlabs.ru smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=GYOQAEt0FMHBv3MJjxhW8wDiWassvuKEcLU0JplQves=; b=pEJsKFocSoEjloX1D8MFuJVrvwsBZ5irQoVPoSgNJVlZhkBAy4A44+1oaLIUlHSdtyNd8a2NICCFh/iBJs3/ZadjbPkOIqtWTsAGTaXsjqRDKyTdYLYQ/fxEyeDP580WwyKjBmsSU4OJfyDBPQjewC6epLMnfa/SmKHNbX2T5/CW/bv4SM4LRHagdOf9hrO101natSaKyZQNMa/CGqR4YwEHP0ZzFU5QtXrzJDxDFtiw0VcfR39P5syQi6RkCuj+/ZvvEcAFXjTphgbZIiWG2mpVEtckhLcyJOTzUZyvFX2THRtONGClSt4vE9QVWFoKcduyZmoFTr73sIcUTmWMqA== Received: from BN6PR1701CA0022.namprd17.prod.outlook.com (2603:10b6:405:15::32) by BYAPR12MB3045.namprd12.prod.outlook.com (2603:10b6:a03:ac::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.24; Wed, 1 Sep 2021 08:56:14 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:405:15:cafe::94) by BN6PR1701CA0022.outlook.office365.com (2603:10b6:405:15::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:56:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; 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 BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:56:13 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:55:35 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:55:33 +0000 From: Dmitry Kozlyuk To: CC: Matan Azrad , Ori Kam , "Thomas Monjalon" , Ferruh Yigit , Andrew Rybchenko Date: Wed, 1 Sep 2021 11:55:15 +0300 Message-ID: <20210901085516.3647814-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901085516.3647814-1-dkozlyuk@nvidia.com> References: <20210901085516.3647814-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58532def-36b3-44bc-f8d5-08d96d2659e1 X-MS-TrafficTypeDiagnostic: BYAPR12MB3045: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TuKnVtLEMDRxGQOjm2IUJ1gnjcpCnvRaNI9BpHj9J1mMhrTDfsNc4DRgwF3BEdCKchhqfi3c/Q795PkbfUkTKPzhLKSiDHNNTzZ/OoVQAsYnXaCRxyV6zOWd1MA40jZs55fOFhpXKz17+2P/GLl/RlslV0thKnT/hYV7uRYCXN/tLKt6U8PGHirJE00yvXdu6T2zmIGoQ7DGrEGZCDQoXVRDQR69rSwg77rv0gwu1Brli3jv0PhKJ3+yNBU1D/+leJgikltJQH2pJyIvI1bAEWioKhXbyR/hK0eNEoJmSyGw3yW+C/UyMwZ+Kv8V6ZhmlqBUpxj80yWp33ms1Gu4hq/eQZdxUfYNpNlSmx36yW94yiX51nbhDCBr1U19NCWE1bzOU9WcEV9mL764LXcYvR+H4e3glh9pEP+c27lhVK6cmEGbXYaFvjl0M6WXJn6+EYUv92i1JwB69HYiqPwa/R+Nr05stohiVOOJ4mCB8hGyxBiG+gs2F87yZ4XfoEmqxc22wq3Stbab1KnZV9tqcOJ3uyW4yV/mChVxAMhjm9g/+N8qjSgYScY9xcStI/EAQ1prgnY+91v9Nuh+kpSkdGfFFuLkbPYTK5Yt5RQTGSWWheCk9kqvPqJomNJsBglSmzzh/XeQOLSpLJCioZX7fpT8HhNhnhTPlM4kXHu80DQcJuejsaDzDYJvWG4BpXJVp293VQSHSAceD5IEbKpuTw== 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)(136003)(396003)(346002)(39860400002)(376002)(46966006)(36840700001)(86362001)(82310400003)(36756003)(426003)(1076003)(8936002)(2616005)(336012)(36906005)(55016002)(83380400001)(186003)(2906002)(316002)(8676002)(6916009)(47076005)(36860700001)(356005)(54906003)(4326008)(82740400003)(5660300002)(6666004)(16526019)(70586007)(70206006)(7636003)(26005)(6286002)(7696005)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 08:56:13.2183 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58532def-36b3-44bc-f8d5-08d96d2659e1 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: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3045 Subject: [dpdk-dev] [RFC PATCH 1/2] 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 can 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 is proposed for PMDs to advertise this capability if supported using a new flag. 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 Acked-by: Matan Azrad Acked-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 9 +++++++++ lib/ethdev/rte_ethdev.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2b42d5ec8c..0a03097a7c 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -87,6 +87,15 @@ 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 flow rules are implicitly destroyed when the device is stopped. +If the device advertises ``RTE_DEV_CAPA_FLOW_RULE_KEEP``, flow rules persist +across device stop and start with possible reconfiguration in between. +Some configuration changes may be incompatible with existing flow rules, +in this case ``rte_eth_dev_configure()`` or ``rte_eth_rx/tx_queue_setup()`` +will fail. At this point PMD developers are encouraged to log errors identical +to the ones that would be emitted by ``rte_flow_create()`` if the new +configuration was active. + 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 d2b27c351f..1616bdf2dd 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1448,6 +1448,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 keeps flow rules across restart and reconfiguration. */ +#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004 /**@}*/ /* From patchwork Wed Sep 1 08:55:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 97671 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 93E79A0C58; Wed, 1 Sep 2021 10:55:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78D94410F6; Wed, 1 Sep 2021 10:55:44 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2054.outbound.protection.outlook.com [40.107.101.54]) by mails.dpdk.org (Postfix) with ESMTP id 4C30D410F2 for ; Wed, 1 Sep 2021 10:55:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9dyRGMehL3AF8wQ7nWNTeZ/l8mYiJDGAMhI6INFdGL94AHfH9zp6Q+HGEDsvsT2alLHSsDRXuXQaqlSqd2oNBJG9NAMulQnToJFtGHJGbUwfBZYzYd0StX+SfsUNDbA7d0wssXqklg1hbKuglnAeu2rHCIDfzOP96gEEPTAIVrO9Bm7snvRLxGwZRc+bylBZCidQaxBUf3zMwix9bjt3WcbsoIxGa80gl98z2mksPX/tMEZdWghKOmmQtHO0rbw8iRzoXYBhHAz9wUEgHKRdbfRaQHGcPAFmGvzFAfc/xqylpI5ay4EUfD1Q2fueLSsSXdLLn6tb65sE90Y5cr5mA== 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; bh=QL3MZwbD8KqEmu2fIRxSw89HtT4FiXumt+e15JZVeZM=; b=UV50vZx3XQ7rnHurRf8zOl9B+SMdR2a5+s3AgnzxSiejPKyIg7e7/GGw71KQh1HA0VLoLtc7ZLaUgxMp4fGD5HZS5BaiJ1mQBwuJk1JipSGCiwBDF80iJ+fLOtoeBSErKWfMZRIiagJC6P3RqY7GVCnnoER3rV+BFZ0/dhAlZL7twxNcG4jFJzZy4Ltdw1D6n+/IbyaH15KFg/h6/SGrOy+nevmswAgXVLL9e31MH510ullJ1hcat2bQayLC0GN0HbWZug53z/g/iEOwnNAL2cikIJx3S8inpUAI0DkhUdQMbK+otEFbkXYXwNFd74ABRJVm6lsul8DVyekaBck25g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=oktetlabs.ru smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=QL3MZwbD8KqEmu2fIRxSw89HtT4FiXumt+e15JZVeZM=; b=Wv4S7LNSM0wi8/yHJZZDRsiTR1txouxmjyyVCWlAcbyyBA12DpHr8X6bsx1wh2HNSiG35Y+wqpYubt579BDXr+qI6BK06l8JTy1xQDsXEISn6Zc1mHdOMSudfs6rdk4xg/WJZwl06VI6WiD0g05VJPX+qxGqSQOwHWhrwTCwh4LD9HQSvFr5e3BLhkQPglM0927HOSX/86lspcmr2QfCokaXayzrulW8lu9xnbObzN8Fp8fOocaqppcwnSf/EAN9fpNaL730/H1Tcpzq/38A40U6g+EvyKlyv86gcr48cnbgHhI3jt5Zs6/CoNlFlCUCEFsDEb+Eg4syvINexRrs5w== Received: from CO1PR15CA0071.namprd15.prod.outlook.com (2603:10b6:101:20::15) by CY4PR12MB1846.namprd12.prod.outlook.com (2603:10b6:903:11b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Wed, 1 Sep 2021 08:55:38 +0000 Received: from CO1NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:101:20:cafe::df) by CO1PR15CA0071.outlook.office365.com (2603:10b6:101:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:55:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by CO1NAM11FT008.mail.protection.outlook.com (10.13.175.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:55:38 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:55:37 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:55:35 +0000 From: Dmitry Kozlyuk To: CC: Matan Azrad , Ori Kam , "Thomas Monjalon" , Ferruh Yigit , "Andrew Rybchenko" Date: Wed, 1 Sep 2021 11:55:16 +0300 Message-ID: <20210901085516.3647814-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901085516.3647814-1-dkozlyuk@nvidia.com> References: <20210901085516.3647814-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef90198b-783c-4092-0238-08d96d2644e8 X-MS-TrafficTypeDiagnostic: CY4PR12MB1846: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CUKIjDR4uaHOE1NRf+8BaeB8MCsfZfYLlf+l6t/ibpZ06JCIIThRGPG+itxJBQV6JRedCxB2d7/tGtWVU4VUq/o9KBs+YwhQk2Dr0JezrVJ4YVIhkzJNj03oRsp1hvo71Rgt5uDVL+VBUko2GiMPGyIyGWrEjYwnKlkeSVBSbb/aeDltXAeGoXs3yk/KGvx764arkTpxUtX/qocJ/B0oNitCLROrK6D/MVZoNnr7qFs0LmxgaCQLiJrM9Bip/dzdXSNc/Jyt03TPMBP8R1JugU6wcCvJhRlXbwEMCVkRLW4KEJBxVY5FL9bB16+qFgf/TsCUqgx9nHMF7T94KdW61eNIGAJPS7ZxHdRt/vByNTL4U4W6kGdRn0hJzp4LTxiF9aqPl0kZD5hBlYXF94PAZX/26R4Xuzj8xkVfKBcgLU+xu2KlthfC3+W3Xi7d7jLKC0Qr1+xugohyaQBwsgXlYopnredILOm7Ju07lBTdagxm1FfMPwmsaD5Coq6MvY4UJ3tlxjWoPAtWL4r5Qvj2XkUJv/nyVnXkIHMhxZ+ybz1J7hDvevymTrd8DmFxYCKo0RqdEaVOnNYTFwlL5R8p0sLLd29Bg+EA1ug/ELheA0Ii/3WCkiWrI4sN76jITW8bdsMEt3WpuUfaVzYPZ1XJOxAO9ENfx8IqZrODrsehcObwIqR4dRiaAwNkM3mkukuvoPbJQKgZGl8jSCI5Cch6vA== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(186003)(336012)(2906002)(55016002)(26005)(36906005)(36860700001)(426003)(16526019)(316002)(4326008)(54906003)(70586007)(1076003)(7636003)(47076005)(70206006)(5660300002)(508600001)(6286002)(82310400003)(356005)(83380400001)(36756003)(8936002)(6916009)(2616005)(86362001)(8676002)(7696005)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 08:55:38.0706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef90198b-783c-4092-0238-08d96d2644e8 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1846 Subject: [dpdk-dev] [RFC PATCH 2/2] ethdev: add capability to keep 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" rte_flow_action_handle_create() did not mention what happens with an indirect action when a device is stopped, possibly reconfigured, and started again. It is natural for some indirect actions to be persistent, like counters and meters; keeping others just saves application time and complexity. However, not all PMDs can support it. It is proposed to add a device capability to indicate if indirect actions are kept across the above sequence or implicitly destroyed. It may happen that in the future a PMD acquires support for a type of indirect actions that it cannot keep across a restart. It is undesirable to stop advertising the capability so that applications that don't use actions of the problematic type can still take advantage of it. This is why PMDs are allowed to keep only a subset of indirect actions provided that the vendor mandatorily documents it. If the device is being reconfigured in a way that is incompatible with an existing indirect action, 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 RSS indirect action specifies queues that are going away, the user must update the action before removing the queues or remove the action and all flow rules that were using it. Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad Acked-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++ lib/ethdev/rte_ethdev.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 0a03097a7c..da90b52f48 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2794,6 +2794,18 @@ 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()``. +By default indirect actions are destroyed when the device is stopped. +If the device advertises ``RTE_ETH_DEV_CAPA_FLOW_INDIRECT_ACTION_KEEP``, +indirect actions persist across the device stop and start with possible +reconfiguration in between. Some configuration changes may be incompatible +with existing indirect actions, in this case ``rte_eth_dev_configure()`` and/or +``rte_eth_rx/tx_queue_setup()`` will fail. At this point PMD developers +are encouraged to log errors identical to the ones that would be emitted by +``rte_flow_action_handle_create()`` if the new configuration was active. +Even if this capability is advertised, there may be kinds of indirect actions +that the device cannot keep. They are implicitly destroyed at device stop. +PMD developers must document such kinds of actions if applicable. + .. _table_rte_flow_action_handle: .. table:: INDIRECT diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 1616bdf2dd..c3be5afcb2 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1450,6 +1450,11 @@ struct rte_eth_conf { #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 /** Device keeps flow rules across restart and reconfiguration. */ #define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP 0x00000004 +/** + * Device keeps indirect actions across restart and reconfiguration. + * For a specific PMD this may not be applicable to certain action types. + */ +#define RTE_ETH_DEV_CAPA_FLOW_INDIRECT_ACTION_KEEP 0x00000008 /**@}*/ /*