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 ACFA4A0C4B; Thu, 21 Oct 2021 09:36:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9817C410E2; Thu, 21 Oct 2021 09:36:28 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by mails.dpdk.org (Postfix) with ESMTP id 6F6EF40142 for ; Thu, 21 Oct 2021 09:36:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WB4LPQRq0kYU7eTxYwVn96v+kVkqXfUo3Cpt5RhRNY+ZBDvx15PUN+PXJF3PfaVH2xDqGiC2qug+2ECJ9L6//jN/qE/zw0g7uGtAlPDNNp37cH42TIXy2Rk+90HZzygR43clrJt/d24+60p9ZiWajvJK36y1onhJYn6Sf0Vb7D0TaWTRzxIkqY1Z6jzFL06tUuz5Xo3xCvKIyT9cBhTWA6Y7SANmAzi2wG3cczpgxf68l2wEjb+aXxCmEuZhzHUlQfbAKyNo0zhVtzYSLGSCwJHEnxkkEqVqdpXjVIgTpBiS8qGy//r4myVXdZCmEEGJcBJehbrpefGzjnatqOg2mw== 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=U9bnog3Q3UOF8mLIv0xI9udQBwnUc6ouB6J9iaGv22s=; b=GqRTZg8/Qp+dBGibIAcWdltVoUeasaIpNdWZKVr/qMFg4OO401EjX8E2h7IE2DG0kt6DA9H9bX6d5v7+nVZJ3zUszQPrTVhHeHIWWvMU/UjCWam80fb0rwu3UI4Vj0bzXzweIjg70XBniLaki4ETWi6oilBbw42XJTFYIqEQGLM23uz5loAWJXmlkjMRPJuTjhV4zs09SO7CrfpjYs7sAG8St0CGcSudg9fVtKOL9y9EvsNVw6HcgL0F9Qab/MRTc1+w2l3jC3q1kMrMVApOaYMAgO5Sf5bwhJLGV+nKyq2sY72y/HOjMQJMvALyHdIPJj7DsHrFYeaUwr8o5uHLfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=U9bnog3Q3UOF8mLIv0xI9udQBwnUc6ouB6J9iaGv22s=; b=sJuRPyT/16pqxPWzDSgX5s702mVmSc8s4UkFgto72Yxy+jUHT0GWGMNNNHQGvZY5vBqoW809/XqNsnPKkHx4vl09dRiqjom1xJ0rRq2Wx7OU6CgwpH0LGeOApKKLY1NThOIRmxl6MyElSAKpHgnDAhIYGIYrvEcOwgpplg6IdZ5QwOPw+sH+6EzyzUwZk/Qe975RId/9WQ0H3Md0DI6l0jx0jS1aAVM8bAdN8yYeCZC2G5Nr4hVC/uAMw+fcYCBwk0n5hX7emy6fGPeQL/fzDz344uJyF524pNAzODuZd8wH2kqE3XU50a6G+BEh6V9Db+v93eFu2axzAA+0R1jCHA== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5152.namprd12.prod.outlook.com (2603:10b6:5:393::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Thu, 21 Oct 2021 07:36:25 +0000 Received: from DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32]) by DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32%6]) with mapi id 15.20.4628.018; Thu, 21 Oct 2021 07:36:25 +0000 From: Ori Kam To: Dmitry Kozlyuk , "dev@dpdk.org" CC: Ori Kam , NBU-Contact-Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Thread-Topic: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow rules on restart Thread-Index: AQHXxkXjSyEqp7D8W0i+x0DDjSsmYKvdD/2w Date: Thu, 21 Oct 2021 07:36:25 +0000 Message-ID: References: <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211021063503.3632732-1-dkozlyuk@nvidia.com> <20211021063503.3632732-2-dkozlyuk@nvidia.com> In-Reply-To: <20211021063503.3632732-2-dkozlyuk@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oss.nvidia.com; dkim=none (message not signed) header.d=none;oss.nvidia.com; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b6abff29-6fa9-4b0e-2910-08d994657c8c x-ms-traffictypediagnostic: DM4PR12MB5152: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: 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: fKq+95F8v21I1UDFda5kmzuYrtxIKuFvEdjiqIQP36Ll/HDVQZp9yE0uV1yCocU7xLrGD5c8GfPJJWT+RewmtJxfEUqwnUYL6YQDi7mNSPCiu7fTrC2cr7530totvjK0W/EuxyHiOKOAwNIe5A6oaijAYy9w081g/XqmRL0J4THjxr9BgcviMQqA6g9SYLlSHakVRiUuDAoWOJhfUnEaSS3XU62VF4HrAbsbUyLuIGN1Wd67o1vSCiJRB9m0azLksLAYelwKEcF6xqlQlT9ZLpESyO+fS+MzZKz/Wx1bEpAkhovygLlErpx1tuuJFOnCTySXaCXGQR9m/WfX52KPqVTU/AAuyGav+qP6ap6mE/v0Mqy5ReFo6a+xgnrm2U/6JVuGNNcbT89+y/oFU3nzUUpFv2mL4H9ekQKPxZVVCDy8zq4Fc9e1ane5UmsDG004lO1ysa+AjMAqYfTdp/oSY6Zg0/+ZEBna+123CWx7GAjGU2UCLNmdk/qG6aBzTubSqH7AoqzZ/faNHt2+SMgQ1tmFtn/vNR8dEemeqiV3r2A72SGWSZVHlhMmW6OUGtap4rOt/pD30tIezynZ/348iTk4fS5xKCwapTKSPmhve9eZiuM+ElU2H7gLuODItCjYR0HVmFo5DhO+wdjkOjwy8H038n/9vBJuZTA9WWjFGcrsGixnjhIpQa/TchN60kI561yl4tfqWfPlD59ZI+0aKA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR12MB5400.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(33656002)(316002)(53546011)(122000001)(76116006)(8936002)(55016002)(54906003)(8676002)(38100700002)(9686003)(110136005)(186003)(7696005)(71200400001)(86362001)(5660300002)(66446008)(66946007)(508600001)(66476007)(52536014)(2906002)(83380400001)(38070700005)(4326008)(66556008)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xvgfNMaL9PjzRh0cGk82BNmRHB1oTdP/rsxchwLvb3NLp4UBR2kIn3XmI8NM?= =?us-ascii?Q?XXj31H1FuEavxVahSj2MZ8sYnICYl/k1vIvQ6Dje45WiwKepopugTx/TgnOF?= =?us-ascii?Q?Jq/63UQmrJqTh0ce5dcA5jKN3VxQb3nf6O/4CgXyN/FBpEWM06o3hRKJphsa?= =?us-ascii?Q?o0VOsUICHMrK93LpuqX0alIaHSXdm+KG95pg61lkrK4M+LtlZnKCpAR40ZLP?= =?us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sOOTw+R6Abrj54Jrap4fmqhKXIin+K/f?= =?us-ascii?Q?Dc6SiDyRrJDme73Fi0aw+eSJUwNG90iLC7fiI5oi11E788XcMetne0whvX9W?= =?us-ascii?Q?OjYlasBSWg90HayUg4vCM88rsidyzKD6udkMou2HHKoOvUNsej6rSwBmkQTb?= =?us-ascii?Q?n2KUt5YQtNoDdGkW5cO6bFdLB/5TxkcgYjbqgv5lZTTpvI8bDAKDzaDhPSfv?= =?us-ascii?Q?wgUX6msybNRWWCw4nXmRqSNn1gwjDEuOAJ3ZG1ZmDdmI4COopwaYnTjAS+n7?= =?us-ascii?Q?EkTXweHxr7nwltFjAQFAfP7V4qyzJILKJAPiA5aHnF0o59gt0pvtZgr2DZGV?= =?us-ascii?Q?lYIDHhqk2dYNSOJT5lrS+oK1Q8uV/750aWSAYev49MSDCDciFAchALU75Wpj?= =?us-ascii?Q?CRyXvtc0IpZpLWY=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR12MB5400.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6abff29-6fa9-4b0e-2910-08d994657c8c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2021 07:36:25.0449 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: orika@nvidia.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5152 Subject: Re: [dpdk-dev] [PATCH v4 1/6] 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" Hi Dmitry, > -----Original Message----- > From: dev On Behalf Of Dmitry Kozlyuk > Sent: Thursday, October 21, 2021 9:35 AM > To: dev@dpdk.org > Cc: Ori Kam ; NBU-Contact-Thomas Monjalon ; > Ferruh Yigit ; Andrew Rybchenko > Subject: [dpdk-dev] [PATCH v4 1/6] ethdev: add capability to keep flow ru= les on restart >=20 > Previously, it was 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 (a combination of an item/action type > and a value of the transfer bit is called a ruel feature). >=20 > 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 and it is declared that the application must > flush the rules before stopping the device. > Allow the application to test for persistence of rules using > a particular feature by attempting to create a flow rule > using that feature 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. >=20 > Rule persistence across a reconfigurations is not required, > because tracking all the rules and configuration-dependent resources > they use may be infeasible. In case a PMD cannot keep the rules > across reconfiguration, it is allowed just to report an error. > Application must then flush the rules before attempting it. >=20 > Signed-off-by: Dmitry Kozlyuk > --- > doc/guides/prog_guide/rte_flow.rst | 31 ++++++++++++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 7 +++++++ > lib/ethdev/rte_flow.h | 1 + > 3 files changed, 39 insertions(+) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index aeba374182..9beaae3df3 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -87,6 +87,37 @@ 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. >=20 > +When the device is stopped, its rules do not process the traffic. > +In particular, transfer rules created using some device > +stop affecting the traffic even if they refer to different ports. > + > +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised, > +rules 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_flush()`` or ``rte_flow_destroy(= )`` > +before stopping the device to ensure no rules remain. > + > +If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is advertised, this means > +the PMD can keep at least some rules across the device stop and start. > +However, ``rte_eth_dev_configure()`` may fail if any rules remain, > +so the application must flush them before attempting a reconfiguration. > +Keeping may be unsupported for some types of rule items and actions, > +as well as depending on the value of flow attributes transfer bit. > +A combination of a single an item or action type > +and a value of the transfer bit is called a rule feature. > +For example: a COUNT action with the transfer bit set. > +To test if rules with a particular feature are kept, the application mus= t try > +to create a valid rule using this feature when the device is not started > +(either before the first start or after a stop). > +If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``, > +all rules using this feature must be flushed by the application > +before stopping the device. > +If it succeeds, such rules will be kept when the device is stopped, > +provided they do not use other features that are not supported. > +Rules that are created when the device is stopped, including the rules > +created for the test, will be kept after the device is started. > + > The following sections cover: >=20 > - **Attributes** (represented by ``struct rte_flow_attr``): properties o= f a > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index 014270d316..9cf23fecce 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-ent= ered > * 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 > /**@}*/ >=20 > /* > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h > index 2b6efeef8c..16ef33819b 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -3676,6 +3676,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. */ > }; >=20 > /** > -- > 2.25.1 Acked-by: Ori Kam Best, Ori