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 04F284240D; Wed, 18 Jan 2023 15:03:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDD4F400D6; Wed, 18 Jan 2023 15:03:52 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by mails.dpdk.org (Postfix) with ESMTP id A32D84003F for ; Wed, 18 Jan 2023 15:03:51 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 9BE653200914; Wed, 18 Jan 2023 09:03:49 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 18 Jan 2023 09:03:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1674050629; x= 1674137029; bh=gDeuhtAnybEap8nsekI7nKahyCrPh0WfQMc+6UHUufs=; b=T E5cXE+Naiq30Z/A+gne9qLkNAtOVfO38Gdm3ii/X66Rm2+CvmTXeBmNu+L/ITe9V kRGIjVLC54IPWFcidONp1GmtgKMjPHHcOjrhZzvEARWNsBQteozPh61yAhkVPs0S 30OelWfTBLqi6nwo21CEhNWVsmGvTTaftgkcpmU/IJfjb0ByYxNrPwVCrDEXOTfW 7QSbVmK4d+NYrN7ewYN14VhaQLWNaVzxycZB1qQtx/dPg5i4M/7JMXrSmLzGNRGS IeQnmbw3hzWHpc61QDqCTYcdtKNtI+jRuZ4+UIWGcZ2f01lRCSUO6vuBS4oEYqkL rQCalrTBpEgwi3qloi1/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1674050629; x= 1674137029; bh=gDeuhtAnybEap8nsekI7nKahyCrPh0WfQMc+6UHUufs=; b=E /rQNE/9XFOpxUUA90IsdR7tAF66VEYzxAf0YpIzWgoUNZG7JNtjc+u4EmpMX+m3E kY9jtVx1nt2qdQgR5xj7l/PP/TaDez0AtqzXL+r6sK9XJA/B5D28Asaqfwj5rNn/ H277MObWZFEV56AueCRodPpZTL810zQTlzv82T4CoGld80WQGPYDtiGacwaHiRpI IHzu3w90elYH2Jc+KJXthreSQWmS8hsa505p9FEAR0wrUaX7k4+1+0ydJYz0fYUQ OxUPfVaS1Fhk7lR3U/ESJujMDIL1PZ1mDynzuMDUet5TBh8SjZfGHsZjqwmiSuQU NOJQ7UopW9xIGC7/kxeRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtkedgiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 18 Jan 2023 09:03:47 -0500 (EST) From: Thomas Monjalon To: Gregory Etelson Cc: dev@dpdk.org, matan@nvidia.com, rasland@nvidia.com, Ori Kam , Aman Singh , Yuying Zhang , Ferruh Yigit , Viacheslav Ovsiienko , Andrew Rybchenko , ivan.malov@oktetlabs.ru, jerinj@marvell.com Subject: Re: [PATCH v4 2/2] ethdev: add quota flow action and item Date: Wed, 18 Jan 2023 15:03:46 +0100 Message-ID: <3529184.clyjiGRsXx@thomas> In-Reply-To: <20230118103109.4052-2-getelson@nvidia.com> References: <20221221073547.988-1-getelson@nvidia.com> <20230118103109.4052-1-getelson@nvidia.com> <20230118103109.4052-2-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Is this patch related to query/update of indirect flow action? It looks like it should be in a separate series. 18/01/2023 11:31, Gregory Etelson: > Quota action limits traffic according to pre-defined configuration. > Quota reflects overall traffic usage regardless bandwidth. > Quota flow action initialized with signed tokens number value. > Quota flow action updates tokens number according to > these rules: > 1. if quota was configured to count packet length, for each packet > of size S, tokens number reduced by S. > 2. If quota was configured to count packets, each packet decrements > tokens number. > quota action sets packet metadata according to a number of remaining > tokens number: > PASS - remaining tokens number is non-negative. > BLOCK - remaining tokens number is negative. > > Quota flow item matches on that data > > Application updates tokens number in quota flow action > with SET or ADD calls: > SET(QUOTA, val) - arm quota with new tokens number set to val > ADD(QUOTA, val) - increase existing quota tokens number by val > > Both SET and ADD return to application number of tokens stored in port > before update. > > Application must create a rule with quota action to mark flow and > match on the mark with quota item in following flow rule. > > Signed-off-by: Gregory Etelson > Acked-by: Ori Kam > --- > v2: Remove RTE_FLOW_QU_DEFAULT query-update mode. > v3: Update release notes. > --- > app/test-pmd/cmdline_flow.c | 394 ++++++++++++++++++++++++- > app/test-pmd/config.c | 82 ++++- > app/test-pmd/testpmd.h | 11 + > doc/guides/nics/features/default.ini | 2 + > doc/guides/nics/features/mlx5.ini | 2 + > doc/guides/nics/mlx5.rst | 12 + mlx5 feature should be documented and marked in the patch having the implementation code, not in ethdev API. > doc/guides/prog_guide/rte_flow.rst | 41 +++ > doc/guides/rel_notes/release_23_03.rst | 27 ++ > lib/ethdev/rte_flow.c | 2 + > lib/ethdev/rte_flow.h | 123 ++++++++ > 10 files changed, 686 insertions(+), 10 deletions(-) [...] > + /** > + * Apply quota verdict - PASS or BLOCK to a flow. Is "to" really wanted here? What about "pass or block a flow"? > + * > + * @see struct rte_flow_action_quota > + * @see struct rte_flow_query_quota > + * @see struct rte_flow_update_quota > + */ > + RTE_FLOW_ACTION_TYPE_QUOTA, > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * QUOTA operational mode. > + * > + * @see struct rte_flow_action_quota > + */ > +enum rte_flow_quota_mode { > + RTE_FLOW_QUOTA_MODE_PACKET = 1, /** Count packets */ > + RTE_FLOW_QUOTA_MODE_L2 = 2, /** Count packet bytes starting from L2 */ > + RTE_FLOW_QUOTA_MODE_L3 = 3, /** Count packet bytes starting from L3 */ > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Create QUOTA action. > + * > + * @see RTE_FLOW_ACTION_TYPE_QUOTA > + */ > +struct rte_flow_action_quota { > + enum rte_flow_quota_mode mode; /** quota operational mode */ > + int64_t quota; /** quota value */ What means a negative quota? > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Query indirect QUOTA action. > + * > + * @see RTE_FLOW_ACTION_TYPE_QUOTA > + * > + */ > +struct rte_flow_query_quota { > + int64_t quota; /** quota value */ > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Indirect QUOTA update operations. > + * > + * @see struct rte_flow_update_quota > + */ > +enum rte_flow_update_quota_op { > + RTE_FLOW_UPDATE_QUOTA_SET, /** set new quota value */ > + RTE_FLOW_UPDATE_QUOTA_ADD, /** increase existing quota with new value */ > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * @see RTE_FLOW_ACTION_TYPE_QUOTA > + * > + * Update indirect QUOTA action. > + */ > +struct rte_flow_update_quota { > + enum rte_flow_update_quota_op op; /** update operation */ > + int64_t quota; /** quota value */ > }; > > /** > @@ -4854,6 +4967,11 @@ struct rte_flow_port_info { > * @see RTE_FLOW_ACTION_TYPE_CONNTRACK > */ > uint32_t max_nb_conn_tracks; > + /** > + * Maximum number of quota actions. > + * @see RTE_FLOW_ACTION_TYPE_QUOTA > + */ > + uint32_t max_nb_quotas; > /** > * Port supported flags (RTE_FLOW_PORT_FLAG_*). > */ > @@ -4932,6 +5050,11 @@ struct rte_flow_port_attr { > * @see RTE_FLOW_ACTION_TYPE_CONNTRACK > */ > uint32_t nb_conn_tracks; > + /** > + * Maximum number of quota actions. > + * @see RTE_FLOW_ACTION_TYPE_QUOTA > + */ > + uint32_t nb_quotas; > /** > * Port flags (RTE_FLOW_PORT_FLAG_*). > */