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 B36B4A0C41; Tue, 19 Oct 2021 17:22:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9971641216; Tue, 19 Oct 2021 17:22:48 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2042.outbound.protection.outlook.com [40.107.92.42]) by mails.dpdk.org (Postfix) with ESMTP id 5DD8F411C1 for ; Tue, 19 Oct 2021 17:22:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uo/cMCPMtzHcGs1JzbJ8CJnl3PWPyyT0dPD9hr+DqVVQch7e6EEwo5IAyIPwHd4rDGT9tEfCisb5shxbEONpGN6vNxRf22phL6CZsyyTlaBZ0F1APrXF5TVUfLradP1ggEkjJyl4nV/4F6fFEOkZunRQ4U3Fkj5w5cx06HMjfYhhEn5A1TRKPg4VpRaRJfrU8fc4+aq35TMUNY1RL89FhKv7Jt502d88qOd70Pdbp+tghOxeO2wxmFRcq6i1N6F2r+KDKCLnvkZ0/qzxh4FNJsSQbH9r5AWpgnJCTBFxoK9gCA+p7fItyHSE4Lilr7UB0baSg0K00BuJr4Y+ITRdiw== 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=PCEFPwi9tZzBsF1kTvW0XEpXrUbYZJyUfLOzqmny9HE=; b=ndjfrWf4YxoW5KlLyi679ePmr8UNBkS3zdR8JS4ufSlcoT7zqY4U7GL8ypYYbK/IX29zs9PdNvutMM+MfQWcAEiq1HlR+uhTIBzOuyQnVy0aHkdn+9v+WOrhgAU8hUl6A4JvIODfmWlQTHwcsgdFMPOXrhZoJL/h/m9Uu5oJy8geLhSrD6DTrLuLtGOwAB4WqhgPfY0yDsE0NeH115kW3/5Jr4HGywlzUVy01hRDMG7M5AwMg1F3pdfg/KHWPXfTfg5DVMC2bhLO/iMgKIEWLliV8EiIaF22JfyAfhMKMKCHvU5x02NEUNBebaQRp9NWppQ1FZgWCqvCKsqOwKTwXA== 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=PCEFPwi9tZzBsF1kTvW0XEpXrUbYZJyUfLOzqmny9HE=; b=VzHK3KFJDv9q84QKBJeYbDI+7dbCfjKvQ4CpvN7ocffWWZ+LXdupg4DC5f+9QGrVT8XotqNppekeV9TUDyHjNG4I+fZbqqb0x8tp9fcsTvZkTHP2TD8WDhE+agmZXWz/UDYQDUfxSm7euXD6dHUxuUE90QBEIZ4kjKZ36jzxgavSRg7cpjMR15443T8BcgRSHXho2xDV+IlK2C8p7pw7reZNKBoGOX2rJAVLA2ashLB42GbbyscnfC6jRv/GkCA1jF82l68dKhA5Pvcn81jHUmQUdxabp4j9eYs0AHVPQyll+l6DS9+scRmNdhlPbUvkLJa+JWskttyIY66suwiROQ== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5359.namprd12.prod.outlook.com (2603:10b6:5:39e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 15:22:46 +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.015; Tue, 19 Oct 2021 15:22:46 +0000 From: Ori Kam To: Dmitry Kozlyuk , "dev@dpdk.org" CC: Qi Zhang , Ori Kam , NBU-Contact-Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Thread-Topic: [dpdk-dev] [PATCH v3 1/6] ethdev: add capability to keep flow rules on restart Thread-Index: AQHXxOYkuY4QNuXCBUWqH/acjZ9LJKvabLtQ Date: Tue, 19 Oct 2021 15:22:46 +0000 Message-ID: References: <20211015161822.3099818-1-dkozlyuk@nvidia.com> <20211019123722.3414694-1-dkozlyuk@nvidia.com> <20211019123722.3414694-2-dkozlyuk@nvidia.com> In-Reply-To: <20211019123722.3414694-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: a56dba29-df5b-4c43-f69e-08d993144db2 x-ms-traffictypediagnostic: DM4PR12MB5359: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: 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: Y/lghdHZ7HIXVoR6KcpH2DvrcekU/tH2nHnYUSl+jkGXqfVmKnN5vmcDLBna+39guhXoyZEOWU2NO9dJgYCJblrOB3JSgs6dYVkPwn98wLA48Rnmv0p1ChrqBJv8s5Wz3/futPeEPr6WcgjpkaaCWpxlQGeNhz9M3ZghC9PA461SLFqxUqIONNPGbIyf0kbFfnYssApCPObtIevvXO0dc/lc4HF8KSMsHf6tG3+UIoCWIHhKWMDyy4yKmy8t2DOPHusfO5kk5Q0UBu1BzAFnQ/ZO49rQ7CRMGf2yTuode8Wp3zP9u90cYhejUw8pvXrMbRPg9fIYwI33Rot5tnrw7iKqjfUXim4xy1uI+FLH1PeXt4+ZItJVTSK1DvQzeWm3OHvf96YYd9CA4m+oUQAQmg8TASZmxYovc9Mvelzy6Uv3sn9F2YbSeYtsTea4WLBIq2Obz8c54dppr5GEZpCXLodaHVEu7IvuHNfFbo3FbLPs+1da/h2MAsFybupUP+ixzRGlgDgHHEl/QHX4cRoT77y2RPIDsFLln0gxD8ajw73nQGJHldqd0BdKPp+ciS8VrZtgnGEkhNfLmmIqF/ctzvP1y9lYqe7UdTpIhInG0NXGdD/WvHIvBHafHR3vvI5ICcVQ9Qh8oKwkXy2SFOnt+SiEYYhhUJdBWxhbPBobkgkTSp8mthD7YG3KtDl7dSvr+YYrHMryHyO4Smm1X1jMNg== 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)(4326008)(316002)(110136005)(8936002)(8676002)(38100700002)(86362001)(2906002)(7696005)(71200400001)(54906003)(6506007)(38070700005)(53546011)(55016002)(52536014)(5660300002)(122000001)(66446008)(9686003)(66556008)(64756008)(508600001)(66476007)(186003)(83380400001)(66946007)(76116006)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?p/75aHDMOW8HTHtXcnxBdr0EQHTCpw+IaFDwatZ7eKuemuAHwlGZMUVPjKuy?= =?us-ascii?Q?pNxvRcY6/ZBQ8yxWiahjILPPw7oZ/BAadWRrbj/XyiZ1/2/lF9TeuuV4tDJg?= =?us-ascii?Q?NLQP+EgSr9DAMC6IiW4FFjC37JRBDRjqvpQC5ToJT60bUJuORQgTBkNrntAG?= =?us-ascii?Q?oP6dKCKGHrve1WHqCMZZqPyY/tdwJet5gcw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3qbzVbpvTlxln3tf7vEgdA3dXQyVXsjmsR9qRsW4z7qjVLkbTGPvvL8?= =?us-ascii?Q?qaV7ftbOI/4dkZKSBYNCVyGgClWdHfaH9hsxq7vFeKAdhwIdmiXrSZ2oxC4O?= =?us-ascii?Q?n8DQqQ8jFbIGNtpEFYuep8eBVA/QFr9lcpmgZQx6d+3wloAguMSmCNKhkE/s?= =?us-ascii?Q?+Y1cNH3IM3dym/0PjzaGeyla8OXAfet5iTNu6d/W5OYicx/oomDU76jCs3Lu?= =?us-ascii?Q?cJ0f57HKssKVuZPwe965AR6k0UH4kmPywP5ZEm+xDYVhlykIPOLjFJv+3VOR?= =?us-ascii?Q?1VbFAdrBMleqRVxCEbONHAheGsHC?= x-ms-exchange-transport-forked: True 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: a56dba29-df5b-4c43-f69e-08d993144db2 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 15:22:46.0554 (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: ykoCBsbcy1THRgoww3vPxRPjpXzDSKeCSxakchzcCkoRYEuLfrDI33p85qT9pHb9CmMGEbv+LAdEh+Mm0yviig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5359 Subject: Re: [dpdk-dev] [PATCH v3 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: Tuesday, October 19, 2021 3:37 PM > To: dev@dpdk.org > Cc: Qi Zhang ; Ori Kam ; NBU-= Contact-Thomas > Monjalon ; Ferruh Yigit ; An= drew Rybchenko > > Subject: [dpdk-dev] [PATCH v3 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 developer= s, because they wouldn't need > to save and restore them. > However, due to the number of flows and possible creation rate it is impr= actical to save all flow rules in > DPDK layer. This means that flow rules persistence really depends on whet= her PMD and HW can > implement it efficiently. It can also be limited by the rule item and act= ion types, and its attributes > transfer bit (a combination of an item/action type and a value of the tra= nsfer bit is called a ruel > feature). >=20 > Add a device capability bit for PMDs that can keep at least some of the f= low 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 persitence 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 d= evice 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 start= ed. >=20 > Rule persistence across a reconfigurations is not required, because track= ing all the rules and > configuration-dependent resources they use may be infeasible. In case a P= MD 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 | 25 +++++++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 7 +++++++ > lib/ethdev/rte_flow.h | 1 + > 3 files changed, 33 insertions(+) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index 2b42d5ec8c..ff67b211e3 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -87,6 +87,31 @@ 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 > +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 an item or action type and a value of the transfer bit > +is called a rule feature. > +To test if rules with a particular feature are kept, the application > +must try to create a valid rule using this feature 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``, rules > +using this feature are flushed when the device is stopped. > +If it suceeds, 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 6d80514ba7..a0b= 388bb25 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 a8994506= 1a..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. */ > }; >=20 > /** > -- > 2.25.1 Acked-by: Ori Kam Best, Ori