[dpdk-dev] [PATCH v5 1/2] ethdev: add flow shared action API

Andrey Vesnovaty andreyv at nvidia.com
Thu Oct 8 09:28:46 CEST 2020


Hi, Ajit.

All spelling & rephrases will be fixed in next couple of hours & v7 will be sent. 
PSB response on shared action configuration documentation.
Please respond ASAP since RC1 window about to close very soon.

Thanks,
Andrey

> -----Original Message-----
> From: Ajit Khaparde <ajit.khaparde at broadcom.com>
> Sent: Thursday, October 8, 2020 12:23 AM
> To: Andrey Vesnovaty <andreyv at nvidia.com>
> Cc: dpdk-dev <dev at dpdk.org>; jer at marvell.com; Jerin Jacob
> <jerinjacobk at gmail.com>; NBU-Contact-Thomas Monjalon
> <thomas at monjalon.net>; Ferruh Yigit <ferruh.yigit at intel.com>; Stephen
> Hemminger <stephen at networkplumber.org>; Bruce Richardson
> <bruce.richardson at intel.com>; Ori Kam <orika at nvidia.com>; Slava Ovsiienko
> <viacheslavo at nvidia.com>; andrey.vesnovaty at gmail.com; Ray Kinsella
> <mdr at ashroe.eu>; Neil Horman <nhorman at tuxdriver.com>; Samik Gupta
> <samik.gupta at broadcom.com>; Andrew Rybchenko
> <arybchenko at solarflare.com>
> Subject: Re: [PATCH v5 1/2] ethdev: add flow shared action API
> 
> Please see inline..
> 
> On Wed, Oct 7, 2020 at 5:56 AM Andrey Vesnovaty <andreyv at nvidia.com>
> wrote:
> >
> > This commit introduces extension of DPDK flow action API enabling
> > sharing of single rte_flow_action in multiple flows. The API intended for
> > PMDs, where multiple HW offloaded flows can reuse the same HW
> > essence/object representing flow action and modification of such an
> > essence/object affects all the rules using it.
> >
> > Motivation and example
> > ===
> > Adding or removing one or more queues to RSS used by multiple flow rules
> > imposes per rule toll for current DPDK flow API; the scenario requires
> > for each flow sharing cloned RSS action:
> > - call `rte_flow_destroy()`
> > - call `rte_flow_create()` with modified RSS action
> >
> 
> [snip]
> > Shared action create/use/destroy
> > ===
> > Shared action may be reused by some or none flow rules at any given
> > moment, i.e. shared action reside outside of the context of any flow.
> s/reside/resides
> 
> [snip]
> > testpmd
> > ===
> > In order to utilize introduced API testpmd cli may implement following
> > extension
> > create/update/destroy/query shared action accordingly
> >
> > flow shared_action (port) create {action_id (id)} (action) / end
> Same comment as in testpmd patch. Please add the ability to specify
> and parse direction.
> 
> > flow shared_action (port) update (id) (action) / end
> > flow shared_action (port) destroy action_id (id) {action_id (id) [...]}
> > flow shared_action (port) query (id)
> >
> > testpmd example
> > ===
> >
> > configure rss to queues 1 & 2
> >
> > > flow shared_action 0 create action_id 100 rss queues 1 2 end / end
> >
> > create flow rule utilizing shared action
> >
> > > flow create 0 ingress \
> >     pattern eth dst is 0c:42:a1:15:fd:ac / ipv6 / tcp / end \
> >   actions shared 100 / end
> >
> > add 2 more queues
> >
> > > flow shared_action 0 modify 100 rss queues 1 2 3 4 end / end
> >
> > example
> > ===
> >
> > struct rte_flow_action actions[2];
> > struct rte_flow_action action;
> > /* skipped: initialize action */
> > struct rte_flow_shared_action *handle = rte_flow_shared_action_create(
> >                                         port_id, &action, &error);
> > actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
> > actions[0].conf = handle;
> direction?
> 
> > actions[1].type = RTE_FLOW_ACTION_TYPE_END;
> > /* skipped: init attr0 & pattern0 args */
> [snip]
> 
> > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > index da8bfa5489..383d516fbd 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -1714,7 +1714,8 @@ enum rte_flow_action_type {
> >         /**
> >          * Enables counters for this flow rule.
> >          *
> > -        * These counters can be retrieved and reset through rte_flow_query(),
> > +        * These counters can be retrieved and reset through rte_flow_query() or
> > +        * rte_flow_shared_action_query() if the action provided via handle,
> >          * see struct rte_flow_query_count.
> >          *
> >          * See struct rte_flow_action_count.
> > @@ -2132,6 +2133,14 @@ enum rte_flow_action_type {
> >          * see enum RTE_ETH_EVENT_FLOW_AGED
> >          */
> >         RTE_FLOW_ACTION_TYPE_AGE,
> > +
> > +       /**
> > +        * Describe action shared a cross multiple flow rules.
> s/a cross/across
> 
> > +        *
> > +        * Allow multiple rules reference the same action by handle (see
> > +        * struct rte_flow_shared_action).
> > +        */
> > +       RTE_FLOW_ACTION_TYPE_SHARED,
> >  };
> >
> >  /**
> > @@ -2693,6 +2702,20 @@ struct rte_flow_action_set_dscp {
> >         uint8_t dscp;
> >  };
> >
> > +
> > +/**
> > + * RTE_FLOW_ACTION_TYPE_SHARED
> > + *
> > + * Opaque type returned after successfully creating a shared action.
> > + *
> > + * This handle can be used to manage and query the related action:
> > + * - share it a cross multiple flow rules
> s/a cross/across
> 
> > + * - update action configuration
> > + * - query action data
> > + * - destroy action
> > + */
> > +struct rte_flow_shared_action;
> > +
> >  /* Mbuf dynamic field offset for metadata. */
> >  extern int32_t rte_flow_dynf_metadata_offs;
> >
> > @@ -3357,6 +3380,144 @@ int
> >  rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
> >                         uint32_t nb_contexts, struct rte_flow_error *error);
> >
> > +/**
> > + * Specify shared action configuration
> > + */
> > +struct rte_flow_shared_action_conf {
> > +       uint32_t ingress:1;
> > +       /**< Action valid for rules applied to ingress traffic. */
> > +       uint32_t egress:1;
> > +       /**< Action valid for rules applied to egress traffic. */
> Add a note to indicate only one of these shall be set.
> 

"only" -> "at least"
Action should be valid for at least one direction but some actions
valid for both ingress & egress. For example, shared counter can
be incremented on both incoming & outgoing packets.  

> > +};
> > +
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice.
> > + *
> [snip]


More information about the dev mailing list