All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: "NBU-Contact-Thomas Monjalon (EXTERNAL)" <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Matan Azrad <matan@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	Slava Ovsiienko <viacheslavo@nvidia.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	"ivan.malov@oktetlabs.ru" <ivan.malov@oktetlabs.ru>,
	"jerinj@marvell.com" <jerinj@marvell.com>
Subject: RE: [PATCH v4 2/2] ethdev: add quota flow action and item
Date: Thu, 19 Jan 2023 09:13:54 +0000	[thread overview]
Message-ID: <IA1PR12MB6332111DCDE9BD17D99DB868A5C49@IA1PR12MB6332.namprd12.prod.outlook.com> (raw)
In-Reply-To: <3529184.clyjiGRsXx@thomas>

Hello Thomas,

> Is this patch related to query/update of indirect flow action?
> It looks like it should be in a separate series.
> 

Quota flow action updates relay on rte_flow_action_handle_query_update().
Also, the function is used in the testmd patch section.

> 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 <getelson@nvidia.com>
> > Acked-by: Ori Kam <orika@nvidia.com>
> > ---
> > 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.
>

Will fix in v5.
 
> >  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"?
> 

The flow action provides information only - it does not affect flow in any way.
Application needs to match on quota flow item after quota action to discover quota state.
It's also up to application how to react on quota state. 

> > +      *
> > +      * @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?
> 

Negative quota is kind of a loan extended by a hardware if it provides such option.
If quota value is -T, application must provide at least (T+1) tokens to return quota to PASS state. 

> > +};
> > +
> > +/**
> > + * @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_*).
> >        */
> 
> 


  reply	other threads:[~2023-01-19  9:14 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  7:35 [PATCH 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2022-12-21  7:35 ` [PATCH 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-08 13:47   ` Ori Kam
2023-01-04  9:56 ` [PATCH 1/2] ethdev: add query_update sync and async function calls Ori Kam
2023-01-11  9:28   ` Gregory Etelson
2023-01-11  9:22 ` [PATCH v2 " Gregory Etelson
2023-01-11  9:22   ` [PATCH v2 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-11 12:20 ` [PATCH v3 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-11 12:20   ` [PATCH v3 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-18 10:31 ` [PATCH v4 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-18 10:31   ` [PATCH v4 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-18 14:03     ` Thomas Monjalon
2023-01-19  9:13       ` Gregory Etelson [this message]
2023-01-19  9:31         ` Thomas Monjalon
2023-01-19  9:39           ` Gregory Etelson
2023-01-18 13:56   ` [PATCH v4 1/2] ethdev: add query_update sync and async function calls Thomas Monjalon
2023-01-18 17:34     ` Gregory Etelson
2023-01-19  8:44       ` Thomas Monjalon
2023-01-19 13:25 ` [PATCH v5 " Gregory Etelson
2023-01-19 13:25   ` [PATCH v5 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-19 16:47 ` [PATCH v6 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-19 16:47   ` [PATCH v6 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-20  8:52     ` Andrew Rybchenko
2023-01-24  9:26       ` Gregory Etelson
2023-01-20  8:35   ` [PATCH v6 1/2] ethdev: add query_update sync and async function calls Andrew Rybchenko
2023-01-20 10:46     ` Gregory Etelson
2023-01-20 11:22       ` Andrew Rybchenko
2023-01-20 16:50         ` Gregory Etelson
2023-02-01 11:00           ` Andrew Rybchenko
2023-02-01 14:03             ` Gregory Etelson
2023-01-24  9:37 ` [PATCH v7 " Gregory Etelson
2023-01-24  9:37   ` [PATCH v7 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-01 11:22     ` Andrew Rybchenko
2023-02-01 15:09       ` Gregory Etelson
2023-02-01 11:16   ` [PATCH v7 1/2] ethdev: add query_update sync and async function calls Andrew Rybchenko
2023-02-01 14:52     ` Gregory Etelson
2023-02-01 15:16 ` [PATCH v8 " Gregory Etelson
2023-02-01 15:16   ` [PATCH v8 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-02  9:17     ` Andrew Rybchenko
2023-02-01 17:30   ` [PATCH v8 1/2] ethdev: add query_update sync and async function calls Ori Kam
2023-02-02  9:15   ` Andrew Rybchenko
2023-02-02 10:24     ` Gregory Etelson
2023-02-02 10:30       ` Andrew Rybchenko
2023-02-02 10:44         ` Gregory Etelson
2023-02-02 10:47           ` Andrew Rybchenko
2023-02-02 11:54 ` [PATCH v9 1/2] ethdev: add query and update " Gregory Etelson
2023-02-02 11:54   ` [PATCH v9 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-02 12:13   ` [PATCH v9 1/2] ethdev: add query and update sync and async function calls Andrew Rybchenko
2023-02-09 19:16     ` Gregory Etelson
2023-02-02 13:47 ` [PATCH v10 " Gregory Etelson
2023-02-02 13:47   ` [PATCH v10 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-19 17:04     ` Thomas Monjalon
2023-02-07 16:03   ` [PATCH v10 1/2] ethdev: add query and update sync and async function calls Gregory Etelson
2023-02-09 15:13   ` Ferruh Yigit
2023-02-09 16:10     ` Gregory Etelson
2023-02-12 11:13     ` Gregory Etelson
2023-02-13 12:30       ` Gregory Etelson
2023-02-16 15:43   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=IA1PR12MB6332111DCDE9BD17D99DB868A5C49@IA1PR12MB6332.namprd12.prod.outlook.com \
    --to=getelson@nvidia.com \
    --cc=aman.deep.singh@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=jerinj@marvell.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.