* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
[not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
@ 2021-03-17 8:28 ` Thomas Monjalon
2021-03-17 16:10 ` Bing Zhao
2021-03-22 14:54 ` Andrew Rybchenko
2021-04-08 14:46 ` [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs Bing Zhao
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2 siblings, 2 replies; 46+ messages in thread
From: Thomas Monjalon @ 2021-03-17 8:28 UTC (permalink / raw)
To: Bing Zhao; +Cc: orika, ferruh.yigit, andrew.rybchenko, dev
17/03/2021 08:59, Bing Zhao:
> The new functions rte_flow_action_ctx* that were added will replace
> the curret shared functions rte_flow_shared_action_*.
> - rte_flow_shared_action_create
> - rte_flow_shared_action_destroy
> - rte_flow_shared_action_update
> - rte_flow_shared_action_query
> + rte_flow_action_ctx_create
> + rte_flow_action_ctx_destroy
> + rte_flow_action_ctx_update
> + rte_flow_action_ctx_query
>
> When creating a action context, it could be shared among different
> flows or different ports. Or it could also be used by a single flow.
> The name "shared" is improper in a sense.
Is it the only reason for the change?
I better understand "shared" even if it is sometimes not shared.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
@ 2021-03-17 16:10 ` Bing Zhao
2021-03-22 14:59 ` Andrew Rybchenko
2021-03-22 14:54 ` Andrew Rybchenko
1 sibling, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-03-17 16:10 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon; +Cc: Ori Kam, ferruh.yigit, andrew.rybchenko, dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, March 17, 2021 4:29 PM
> To: Bing Zhao <bingz@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com;
> andrew.rybchenko@oktetlabs.ru; dev@dpdk.org
> Subject: Re: [RFC] ethdev: introduce action context APIs
>
> External email: Use caution opening links or attachments
>
>
> 17/03/2021 08:59, Bing Zhao:
> > The new functions rte_flow_action_ctx* that were added will
> replace
> > the curret shared functions rte_flow_shared_action_*.
> > - rte_flow_shared_action_create
> > - rte_flow_shared_action_destroy
> > - rte_flow_shared_action_update
> > - rte_flow_shared_action_query
> > + rte_flow_action_ctx_create
> > + rte_flow_action_ctx_destroy
> > + rte_flow_action_ctx_update
> > + rte_flow_action_ctx_query
> >
> > When creating a action context, it could be shared among different
> > flows or different ports. Or it could also be used by a single
> flow.
> > The name "shared" is improper in a sense.
>
> Is it the only reason for the change?
> I better understand "shared" even if it is sometimes not shared.
Another reason is as written in the description of commit message, currently the update interface use the rte_flow_action as the input parameter. It would limit the ability of updating, since rte_flow_action only have the "conf" w/o any mask or flag bits.
If only part of the fields need to be updated, it couldn't meet the needs.
>
>
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
2021-03-17 16:10 ` Bing Zhao
@ 2021-03-22 14:54 ` Andrew Rybchenko
2021-04-06 9:07 ` Bing Zhao
1 sibling, 1 reply; 46+ messages in thread
From: Andrew Rybchenko @ 2021-03-22 14:54 UTC (permalink / raw)
To: Thomas Monjalon, Bing Zhao; +Cc: orika, ferruh.yigit, dev
On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> 17/03/2021 08:59, Bing Zhao:
>> The new functions rte_flow_action_ctx* that were added will replace
>> the curret shared functions rte_flow_shared_action_*.
>> - rte_flow_shared_action_create
>> - rte_flow_shared_action_destroy
>> - rte_flow_shared_action_update
>> - rte_flow_shared_action_query
>> + rte_flow_action_ctx_create
>> + rte_flow_action_ctx_destroy
>> + rte_flow_action_ctx_update
>> + rte_flow_action_ctx_query
>>
>> When creating a action context, it could be shared among different
>> flows or different ports. Or it could also be used by a single flow.
>> The name "shared" is improper in a sense.
>
> Is it the only reason for the change?
> I better understand "shared" even if it is sometimes not shared.
+1
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-03-17 16:10 ` Bing Zhao
@ 2021-03-22 14:59 ` Andrew Rybchenko
2021-04-06 9:05 ` Bing Zhao
0 siblings, 1 reply; 46+ messages in thread
From: Andrew Rybchenko @ 2021-03-22 14:59 UTC (permalink / raw)
To: Bing Zhao, NBU-Contact-Thomas Monjalon; +Cc: Ori Kam, ferruh.yigit, dev
On 3/17/21 7:10 PM, Bing Zhao wrote:
> Hi Thomas,
>
>> -----Original Message-----
>> From: Thomas Monjalon <thomas@monjalon.net>
>> Sent: Wednesday, March 17, 2021 4:29 PM
>> To: Bing Zhao <bingz@nvidia.com>
>> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com;
>> andrew.rybchenko@oktetlabs.ru; dev@dpdk.org
>> Subject: Re: [RFC] ethdev: introduce action context APIs
>>
>> External email: Use caution opening links or attachments
>>
>>
>> 17/03/2021 08:59, Bing Zhao:
>>> The new functions rte_flow_action_ctx* that were added will
>> replace
>>> the curret shared functions rte_flow_shared_action_*.
>>> - rte_flow_shared_action_create
>>> - rte_flow_shared_action_destroy
>>> - rte_flow_shared_action_update
>>> - rte_flow_shared_action_query
>>> + rte_flow_action_ctx_create
>>> + rte_flow_action_ctx_destroy
>>> + rte_flow_action_ctx_update
>>> + rte_flow_action_ctx_query
>>>
>>> When creating a action context, it could be shared among different
>>> flows or different ports. Or it could also be used by a single
>> flow.
>>> The name "shared" is improper in a sense.
>>
>> Is it the only reason for the change?
>> I better understand "shared" even if it is sometimes not shared.
>
> Another reason is as written in the description of commit message, currently the update interface use the rte_flow_action as the input parameter. It would limit the ability of updating, since rte_flow_action only have the "conf" w/o any mask or flag bits.
>
> If only part of the fields need to be updated, it couldn't meet the needs.
Sorry, it is too vague. Context in the RFC looks insufficient
to understand it. Please, provide more details and real-life
examples.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-03-22 14:59 ` Andrew Rybchenko
@ 2021-04-06 9:05 ` Bing Zhao
0 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-06 9:05 UTC (permalink / raw)
To: Andrew Rybchenko, NBU-Contact-Thomas Monjalon; +Cc: Ori Kam, ferruh.yigit, dev
Hi Andrew,
Thanks for your comments.
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Monday, March 22, 2021 11:00 PM
> To: Bing Zhao <bingz@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>
> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [RFC] ethdev: introduce action context APIs
>
> External email: Use caution opening links or attachments
>
>
> On 3/17/21 7:10 PM, Bing Zhao wrote:
> > Hi Thomas,
> >
> >> -----Original Message-----
> >> From: Thomas Monjalon <thomas@monjalon.net>
> >> Sent: Wednesday, March 17, 2021 4:29 PM
> >> To: Bing Zhao <bingz@nvidia.com>
> >> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com;
> >> andrew.rybchenko@oktetlabs.ru; dev@dpdk.org
> >> Subject: Re: [RFC] ethdev: introduce action context APIs
> >>
> >> External email: Use caution opening links or attachments
> >>
> >>
> >> 17/03/2021 08:59, Bing Zhao:
> >>> The new functions rte_flow_action_ctx* that were added will
> >> replace
> >>> the curret shared functions rte_flow_shared_action_*.
> >>> - rte_flow_shared_action_create
> >>> - rte_flow_shared_action_destroy
> >>> - rte_flow_shared_action_update
> >>> - rte_flow_shared_action_query
> >>> + rte_flow_action_ctx_create
> >>> + rte_flow_action_ctx_destroy
> >>> + rte_flow_action_ctx_update
> >>> + rte_flow_action_ctx_query
> >>>
> >>> When creating a action context, it could be shared among
> different
> >>> flows or different ports. Or it could also be used by a single
> >> flow.
> >>> The name "shared" is improper in a sense.
> >>
> >> Is it the only reason for the change?
> >> I better understand "shared" even if it is sometimes not shared.
> >
> > Another reason is as written in the description of commit message,
> currently the update interface use the rte_flow_action as the input
> parameter. It would limit the ability of updating, since
> rte_flow_action only have the "conf" w/o any mask or flag bits.
> >
> > If only part of the fields need to be updated, it couldn't meet
> the needs.
>
> Sorry, it is too vague. Context in the RFC looks insufficient to
> understand it. Please, provide more details and real-life examples.
Take the next RFC of "conntrack" for example, in the actions structure definition, there are more than a dozen of fields to define the action itself. When an updating is required, sometimes, only part of these fields need to be updated.
__rte_experimental
int
rte_flow_shared_action_update(uint16_t port_id,
struct rte_flow_shared_action *action,
const struct rte_flow_action *update,
struct rte_flow_error *error);
In the current API, the 3rd input parameter "update" has the same struct type "rte_flow_action", and unlike the "rte_flow_item", no "mask" field is contained in the action struct, only "conf". When doing a update, the software has to take all the information pointed by the "conf" and do a whole update. The partial update couldn't be supported with the current update interface definition.
By changing the pointer type from "const struct rte_flow_action *" to the " const void *", it would be much more flexible.
1. For the current implementation that "update" interface has already been used, only a minor change in the PMD is needed, to cast the generic pointer to the action pointer before getting the new "conf".
2. For the new actions implementation that will use the "update" interface, the pointer type will be depends on the need. If no partial is required, it could be the same as before, a action pointer. Or else, a wrapper structure pointer will be used to indicate which field(s) inside to update.
I hope this description would be a bit more detailed about the purpose of this change.
And since the "update" interface needs to be updated, we could change the other 3 interfaces with proper names. What do you think?
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-03-22 14:54 ` Andrew Rybchenko
@ 2021-04-06 9:07 ` Bing Zhao
2021-04-06 9:48 ` Thomas Monjalon
0 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-06 9:07 UTC (permalink / raw)
To: Andrew Rybchenko, NBU-Contact-Thomas Monjalon; +Cc: Ori Kam, ferruh.yigit, dev
Hi Thomas and Andrew,
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Monday, March 22, 2021 10:55 PM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; Bing Zhao
> <bingz@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [RFC] ethdev: introduce action context APIs
>
> External email: Use caution opening links or attachments
>
>
> On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > 17/03/2021 08:59, Bing Zhao:
> >> The new functions rte_flow_action_ctx* that were added will
> replace
> >> the curret shared functions rte_flow_shared_action_*.
> >> - rte_flow_shared_action_create
> >> - rte_flow_shared_action_destroy
> >> - rte_flow_shared_action_update
> >> - rte_flow_shared_action_query
> >> + rte_flow_action_ctx_create
> >> + rte_flow_action_ctx_destroy
> >> + rte_flow_action_ctx_update
> >> + rte_flow_action_ctx_query
> >>
> >> When creating a action context, it could be shared among
> different
> >> flows or different ports. Or it could also be used by a single
> flow.
> >> The name "shared" is improper in a sense.
> >
> > Is it the only reason for the change?
> > I better understand "shared" even if it is sometimes not shared.
>
> +1
In another email, I explained the change a bit more. Please check and give comments, thank you all.
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-04-06 9:07 ` Bing Zhao
@ 2021-04-06 9:48 ` Thomas Monjalon
2021-04-06 11:02 ` Bing Zhao
2021-04-07 3:16 ` Ajit Khaparde
0 siblings, 2 replies; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-06 9:48 UTC (permalink / raw)
To: Bing Zhao; +Cc: Andrew Rybchenko, Ori Kam, ferruh.yigit, dev
06/04/2021 11:07, Bing Zhao:
> Hi Thomas and Andrew,
>
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > > 17/03/2021 08:59, Bing Zhao:
> > >> The new functions rte_flow_action_ctx* that were added will
> > replace
> > >> the curret shared functions rte_flow_shared_action_*.
> > >> - rte_flow_shared_action_create
> > >> - rte_flow_shared_action_destroy
> > >> - rte_flow_shared_action_update
> > >> - rte_flow_shared_action_query
> > >> + rte_flow_action_ctx_create
> > >> + rte_flow_action_ctx_destroy
> > >> + rte_flow_action_ctx_update
> > >> + rte_flow_action_ctx_query
> > >>
> > >> When creating a action context, it could be shared among
> > different
> > >> flows or different ports. Or it could also be used by a single
> > flow.
> > >> The name "shared" is improper in a sense.
> > >
> > > Is it the only reason for the change?
> > > I better understand "shared" even if it is sometimes not shared.
> >
> > +1
>
> In another email, I explained the change a bit more. Please check and give comments, thank you all.
Any link to this email from inbox.dpdk.org?
Please explain here the naming reason.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-04-06 9:48 ` Thomas Monjalon
@ 2021-04-06 11:02 ` Bing Zhao
2021-04-06 12:18 ` Thomas Monjalon
2021-04-07 3:16 ` Ajit Khaparde
1 sibling, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-06 11:02 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon; +Cc: Andrew Rybchenko, Ori Kam, ferruh.yigit, dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 6, 2021 5:48 PM
> To: Bing Zhao <bingz@nvidia.com>
> Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Ori Kam
> <orika@nvidia.com>; ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [RFC] ethdev: introduce action context APIs
>
> External email: Use caution opening links or attachments
>
>
> 06/04/2021 11:07, Bing Zhao:
> > Hi Thomas and Andrew,
> >
> > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > > > 17/03/2021 08:59, Bing Zhao:
> > > >> The new functions rte_flow_action_ctx* that were added will
> > > replace
> > > >> the curret shared functions rte_flow_shared_action_*.
> > > >> - rte_flow_shared_action_create
> > > >> - rte_flow_shared_action_destroy
> > > >> - rte_flow_shared_action_update
> > > >> - rte_flow_shared_action_query
> > > >> + rte_flow_action_ctx_create
> > > >> + rte_flow_action_ctx_destroy
> > > >> + rte_flow_action_ctx_update
> > > >> + rte_flow_action_ctx_query
> > > >>
> > > >> When creating a action context, it could be shared among
> > > different
> > > >> flows or different ports. Or it could also be used by a
> single
> > > flow.
> > > >> The name "shared" is improper in a sense.
> > > >
> > > > Is it the only reason for the change?
> > > > I better understand "shared" even if it is sometimes not
> shared.
> > >
> > > +1
> >
> > In another email, I explained the change a bit more. Please check
> and give comments, thank you all.
>
> Any link to this email from inbox.dpdk.org?
The link is here.
http://inbox.dpdk.org/dev/MN2PR12MB29097FE55676D5D389D86C46D0769@MN2PR12MB2909.namprd12.prod.outlook.com/
>
> Please explain here the naming reason.
>
The naming reasons are listed below:
1. The "shared_action*" is incorrect or improper naming of the interface.
2. The "_update" interface needs to be changed to support the partial updating capability.
3. Since we need to modify the update interface, this is a chance to change the improper *experimental* interfaces naming to make them more proper.
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-04-06 11:02 ` Bing Zhao
@ 2021-04-06 12:18 ` Thomas Monjalon
0 siblings, 0 replies; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-06 12:18 UTC (permalink / raw)
To: Bing Zhao; +Cc: Andrew Rybchenko, Ori Kam, ferruh.yigit, dev
06/04/2021 13:02, Bing Zhao:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 06/04/2021 11:07, Bing Zhao:
> > > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > > > > 17/03/2021 08:59, Bing Zhao:
> > > > >> The new functions rte_flow_action_ctx* that were added will
> > > > replace
> > > > >> the curret shared functions rte_flow_shared_action_*.
> > > > >> - rte_flow_shared_action_create
> > > > >> - rte_flow_shared_action_destroy
> > > > >> - rte_flow_shared_action_update
> > > > >> - rte_flow_shared_action_query
> > > > >> + rte_flow_action_ctx_create
> > > > >> + rte_flow_action_ctx_destroy
> > > > >> + rte_flow_action_ctx_update
> > > > >> + rte_flow_action_ctx_query
> > > > >>
> > > > >> When creating a action context, it could be shared among
> > > > different
> > > > >> flows or different ports. Or it could also be used by a
> > single
> > > > flow.
> > > > >> The name "shared" is improper in a sense.
> > > > >
> > > > > Is it the only reason for the change?
> > > > > I better understand "shared" even if it is sometimes not
> > shared.
> > > >
> > > > +1
> > >
> > > In another email, I explained the change a bit more. Please check
> > and give comments, thank you all.
> >
> > Any link to this email from inbox.dpdk.org?
>
> The link is here.
> http://inbox.dpdk.org/dev/MN2PR12MB29097FE55676D5D389D86C46D0769@MN2PR12MB2909.namprd12.prod.outlook.com/
>
> >
> > Please explain here the naming reason.
> >
>
> The naming reasons are listed below:
> 1. The "shared_action*" is incorrect or improper naming of the interface.
> 2. The "_update" interface needs to be changed to support the partial updating capability.
> 3. Since we need to modify the update interface, this is a chance to change the improper *experimental* interfaces naming to make them more proper.
It does not explain why "action_ctx" is a better name than "shared_action".
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-04-06 9:48 ` Thomas Monjalon
2021-04-06 11:02 ` Bing Zhao
@ 2021-04-07 3:16 ` Ajit Khaparde
2021-04-07 6:11 ` Bing Zhao
1 sibling, 1 reply; 46+ messages in thread
From: Ajit Khaparde @ 2021-04-07 3:16 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Bing Zhao, Andrew Rybchenko, Ori Kam, ferruh.yigit, dev
[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]
On Tue, Apr 6, 2021 at 2:48 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 06/04/2021 11:07, Bing Zhao:
> > Hi Thomas and Andrew,
> >
> > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > > > 17/03/2021 08:59, Bing Zhao:
> > > >> The new functions rte_flow_action_ctx* that were added will
> > > replace
> > > >> the curret shared functions rte_flow_shared_action_*.
> > > >> - rte_flow_shared_action_create
> > > >> - rte_flow_shared_action_destroy
> > > >> - rte_flow_shared_action_update
> > > >> - rte_flow_shared_action_query
> > > >> + rte_flow_action_ctx_create
> > > >> + rte_flow_action_ctx_destroy
> > > >> + rte_flow_action_ctx_update
> > > >> + rte_flow_action_ctx_query
> > > >>
> > > >> When creating a action context, it could be shared among
> > > different
> > > >> flows or different ports. Or it could also be used by a single
> > > flow.
> > > >> The name "shared" is improper in a sense.
> > > >
> > > > Is it the only reason for the change?
> > > > I better understand "shared" even if it is sometimes not shared.
> > >
> > > +1
> >
> > In another email, I explained the change a bit more. Please check and give comments, thank you all.
>
> Any link to this email from inbox.dpdk.org?
I don't see the RFC/patch even on patchwork or inbox.
Can you send a link to the mail/patch which initiated the discussion?
>
> Please explain here the naming reason.
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
2021-04-07 3:16 ` Ajit Khaparde
@ 2021-04-07 6:11 ` Bing Zhao
0 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-07 6:11 UTC (permalink / raw)
To: Ajit Khaparde, NBU-Contact-Thomas Monjalon
Cc: Andrew Rybchenko, Ori Kam, ferruh.yigit, dev
Hi,
> -----Original Message-----
> From: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Sent: Wednesday, April 7, 2021 11:16 AM
> To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
> Cc: Bing Zhao <bingz@nvidia.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Ori Kam <orika@nvidia.com>;
> ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC] ethdev: introduce action context APIs
>
> On Tue, Apr 6, 2021 at 2:48 AM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> >
> > 06/04/2021 11:07, Bing Zhao:
> > > Hi Thomas and Andrew,
> > >
> > > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > On 3/17/21 11:28 AM, Thomas Monjalon wrote:
> > > > > 17/03/2021 08:59, Bing Zhao:
> > > > >> The new functions rte_flow_action_ctx* that were added will
> > > > replace
> > > > >> the curret shared functions rte_flow_shared_action_*.
> > > > >> - rte_flow_shared_action_create
> > > > >> - rte_flow_shared_action_destroy
> > > > >> - rte_flow_shared_action_update
> > > > >> - rte_flow_shared_action_query
> > > > >> + rte_flow_action_ctx_create
> > > > >> + rte_flow_action_ctx_destroy
> > > > >> + rte_flow_action_ctx_update
> > > > >> + rte_flow_action_ctx_query
> > > > >>
> > > > >> When creating a action context, it could be shared among
> > > > different
> > > > >> flows or different ports. Or it could also be used by a
> single
> > > > flow.
> > > > >> The name "shared" is improper in a sense.
> > > > >
> > > > > Is it the only reason for the change?
> > > > > I better understand "shared" even if it is sometimes not
> shared.
> > > >
> > > > +1
> > >
> > > In another email, I explained the change a bit more. Please
> check and give comments, thank you all.
> >
> > Any link to this email from inbox.dpdk.org?
>
> I don't see the RFC/patch even on patchwork or inbox.
> Can you send a link to the mail/patch which initiated the discussion?
>
Please refer to these two:
http://inbox.dpdk.org/dev/MN2PR12MB2909FE144AADF25350C4CBFFD0769@MN2PR12MB2909.namprd12.prod.outlook.com/
http://inbox.dpdk.org/dev/MN2PR12MB29097FE55676D5D389D86C46D0769@MN2PR12MB2909.namprd12.prod.outlook.com/
> >
> > Please explain here the naming reason.
> >
> >
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs
[not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
@ 2021-04-08 14:46 ` Bing Zhao
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-08 14:46 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko; +Cc: dev, ajit.khaparde
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action shoule be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
All the command lines in testpmd application with "shared_action*"
are replaced with "indirect_action*".
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer paramter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
lib/librte_ethdev/rte_flow.h | 114 ++++++++++++++++------------
lib/librte_ethdev/rte_flow_driver.h | 26 +++----
2 files changed, 78 insertions(+), 62 deletions(-)
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 6cc57136ac..880e0b50fb 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * Describe indirect action that could be used by a single flow rule
+ * or multiple flow rules.
+ *
+ * Allow flow rule(s) reference the same action by the indirect action
+ * handle (see struct rte_flow_action_handle), rules could be on the
+ * same port or across different ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle will be different per driver or
+ * per immediate action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related immediate action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3628,25 +3644,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3655,16 +3668,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used by flow create, and
+ * could also be shared by different flows.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3678,9 +3692,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3688,12 +3702,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3708,27 +3722,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3739,32 +3756,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the orginal action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3776,10 +3793,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index da594d9256..8d825eb245 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -83,27 +83,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
--
2.30.0.windows.2
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH] ethdev: introduce indirect action APIs
[not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
2021-04-08 14:46 ` [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-09 3:54 ` Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
` (4 more replies)
2 siblings, 5 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-09 3:54 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko; +Cc: dev, ajit.khaparde
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action shoule be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
All the command lines in testpmd application with "shared_action*"
are replaced with "indirect_action*".
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer paramter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
doc/guides/rel_notes/release_21_05.rst | 3 +
lib/librte_ethdev/rte_flow.c | 48 +++++------
lib/librte_ethdev/rte_flow.h | 114 ++++++++++++++-----------
lib/librte_ethdev/rte_flow_driver.h | 26 +++---
lib/librte_ethdev/version.map | 8 +-
5 files changed, 109 insertions(+), 90 deletions(-)
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 6f5858c8f6..abdaf90b3f 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -166,6 +166,9 @@ API Changes
* pci: The value ``PCI_ANY_ID`` is marked as deprecated
and can be replaced with ``RTE_PCI_ANY_ID``.
+* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
+ replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
+ ``rte_flow_action_handle_*``.
ABI Changes
-----------
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index e07e617d74..5ae9397440 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -1067,53 +1067,53 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1121,18 +1121,18 @@ rte_flow_shared_action_update(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1141,11 +1141,11 @@ rte_flow_shared_action_query(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 6cc57136ac..880e0b50fb 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * Describe indirect action that could be used by a single flow rule
+ * or multiple flow rules.
+ *
+ * Allow flow rule(s) reference the same action by the indirect action
+ * handle (see struct rte_flow_action_handle), rules could be on the
+ * same port or across different ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle will be different per driver or
+ * per immediate action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related immediate action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3628,25 +3644,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3655,16 +3668,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used by flow create, and
+ * could also be shared by different flows.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3678,9 +3692,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3688,12 +3702,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3708,27 +3722,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3739,32 +3756,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the orginal action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3776,10 +3793,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index da594d9256..8d825eb245 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -83,27 +83,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388e96..4eb561a89a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
2.30.0.windows.2
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
@ 2021-04-10 14:03 ` Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
` (4 more replies)
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
` (3 subsequent siblings)
4 siblings, 5 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-10 14:03 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The patch set includes:
1. API changes
2. testpmd adaption and guide update
3. driver update (only net/mlx5 impacted)
---
v2: add adaptions of testpmd and driver part
---
Bing Zhao (4):
ethdev: introduce indirect action APIs
app/test-pmd: change to indirect action command
doc: update user guide for indirect action
net/mlx5: adaption to indirect action API
app/test-pmd/cmdline.c | 24 +--
app/test-pmd/cmdline_flow.c | 252 ++++++++++++++--------------
app/test-pmd/config.c | 160 +++++++++---------
app/test-pmd/testpmd.h | 28 ++--
doc/guides/rel_notes/release_21_05.rst | 3 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 94 +++++------
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++++++-------------
drivers/net/mlx5/mlx5_flow.h | 24 +--
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++++-----
lib/librte_ethdev/rte_flow.c | 56 +++----
lib/librte_ethdev/rte_flow.h | 118 +++++++------
lib/librte_ethdev/rte_flow_driver.h | 26 +--
lib/librte_ethdev/version.map | 8 +-
15 files changed, 574 insertions(+), 548 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
@ 2021-04-10 14:03 ` Bing Zhao
2021-04-12 19:42 ` Ferruh Yigit
` (2 more replies)
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command Bing Zhao
` (3 subsequent siblings)
4 siblings, 3 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-10 14:03 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
All the command lines in testpmd application with "shared_action*"
are replaced with "indirect_action*".
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
doc/guides/rel_notes/release_21_05.rst | 3 +
lib/librte_ethdev/rte_flow.c | 56 ++++++++--------
lib/librte_ethdev/rte_flow.h | 118 +++++++++++++++++++--------------
lib/librte_ethdev/rte_flow_driver.h | 26 ++++----
lib/librte_ethdev/version.map | 8 +--
5 files changed, 115 insertions(+), 96 deletions(-)
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 374d6d9..6c0ac46 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -164,6 +164,9 @@ API Changes
from ``rte_thread_tls_*`` to ``rte_thread_*`` to avoid naming redundancy
and confusion with the transport layer security term.
+* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
+ replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
+ ``rte_flow_action_handle_*``.
ABI Changes
-----------
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index e07e617..27a1615 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -180,12 +180,12 @@ struct rte_flow_desc_data {
MK_FLOW_ACTION(MODIFY_FIELD,
sizeof(struct rte_flow_action_modify_field)),
/**
- * Shared action represented as handle of type
- * (struct rte_flow_shared action *) stored in conf field (see
+ * Indirect action represented as handle of type
+ * (struct rte_flow_action_handle *) stored in conf field (see
* struct rte_flow_action); no need for additional structure to * store
- * shared action handle.
+ * indirect action handle.
*/
- MK_FLOW_ACTION(SHARED, 0),
+ MK_FLOW_ACTION(INDIRECT, 0),
};
int
@@ -1067,53 +1067,53 @@ enum rte_flow_conv_item_spec_type {
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1121,18 +1121,18 @@ struct rte_flow_shared_action *
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1141,11 +1141,11 @@ struct rte_flow_shared_action *
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 6cc5713..91ae25b 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
* Enables counters for this flow rule.
*
* These counters can be retrieved and reset through rte_flow_query() or
- * rte_flow_shared_action_query() if the action provided via handle,
+ * rte_flow_action_handle_query() if the action provided via handle,
* see struct rte_flow_query_count.
*
* See struct rte_flow_action_count.
@@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * Describe indirect action that could be used by a single flow rule
+ * or multiple flow rules.
+ *
+ * Allow flow rule(s) reference the same action by the indirect action
+ * handle (see struct rte_flow_action_handle), rules could be on the
+ * same port or across different ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2357,7 +2367,7 @@ struct rte_flow_query_age {
* ``struct rte_flow_query_count``.
*
* @deprecated Shared attribute is deprecated, use generic
- * RTE_FLOW_ACTION_TYPE_SHARED action.
+ * RTE_FLOW_ACTION_TYPE_INDIRECT action.
*
* The shared flag indicates whether the counter is unique to the flow rule the
* action is specified with, or whether it is a shared counter.
@@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle will be different per driver or
+ * per immediate action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related immediate action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3628,25 +3644,22 @@ struct rte_flow_desc {
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3655,16 +3668,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used by flow create, and
+ * could also be shared by different flows.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3678,9 +3692,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3688,12 +3702,12 @@ struct rte_flow_shared_action *
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3708,27 +3722,30 @@ struct rte_flow_shared_action *
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3739,32 +3756,32 @@ struct rte_flow_shared_action *
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the direct action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3776,10 +3793,9 @@ struct rte_flow_shared_action *
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index da594d9..8d825eb 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -83,27 +83,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388..4eb561a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
1.8.3.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-10 14:03 ` Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action Bing Zhao
` (2 subsequent siblings)
4 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-10 14:03 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces are also need to be updated to do the adaption.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
app/test-pmd/cmdline.c | 24 ++---
app/test-pmd/cmdline_flow.c | 252 ++++++++++++++++++++++----------------------
app/test-pmd/config.c | 160 ++++++++++++++--------------
app/test-pmd/testpmd.h | 28 ++---
4 files changed, 232 insertions(+), 232 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f44116b..c28a3d2 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 2c40c69..d4e11a8 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -108,21 +108,21 @@ enum index {
TUNNEL_SET,
TUNNEL_MATCH,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -412,8 +412,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -772,10 +772,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -833,20 +833,20 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -886,8 +886,8 @@ struct parse_action_priv {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1366,7 +1366,7 @@ struct parse_action_priv {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1781,13 +1781,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1934,10 +1934,10 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1947,7 +1947,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1961,42 +1961,42 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4467,61 +4467,61 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4708,9 +4708,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4723,7 +4723,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4735,26 +4735,26 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4763,9 +4763,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4778,8 +4778,8 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4787,13 +4787,13 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7043,7 +7043,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7060,9 +7060,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7600,27 +7600,27 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ef0b978..1eec061 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1391,38 +1391,38 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1433,7 +1433,7 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1442,70 +1442,70 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1519,9 +1519,9 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1529,14 +1529,14 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1547,60 +1547,60 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1622,8 +1622,8 @@ struct rte_flow_shared_action *
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2033,7 +2033,7 @@ struct rte_flow_shared_action *
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2083,11 +2083,11 @@ struct rte_flow_shared_action *
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index a87ccb0..d1eaaad 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
--
1.8.3.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command Bing Zhao
@ 2021-04-10 14:03 ` Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API Bing Zhao
2021-04-12 19:40 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
4 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-10 14:03 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The testpmd application user guide is updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 94 ++++++++++++++---------------
1 file changed, 47 insertions(+), 47 deletions(-)
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2b407a3..42d3d23 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4049,10 +4049,10 @@ This section lists supported actions and their attributes, if any.
- ``dscp_value {unsigned}``: The new DSCP value to be set
-- ``shared``: Use shared action created via
- ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+ ``flow indirect_action {port_id} create``
- - ``shared_action_id {unsigned}``: Shared action ID to use
+ - ``indirect_action_id {unsigned}``: Indirect action ID to use
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
@@ -4343,113 +4343,113 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
testpmd> flow aged 0
Port 0 total aged flows: 0
-Creating shared actions
+Creating indirect actions
~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
- flow shared_action {port_id} create [action_id {shared_action_id}]
+ flow indirect_action {port_id} create [action_id {indirect_action_id}]
[ingress] [egress] [transfer] action {action} / end
If successful, it will show::
- Shared action #[...] created
+ Indirect action #[...] created
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
some error occurred::
- Shared action #[...] is already assigned, delete it first
+ Indirect action #[...] is already assigned, delete it first
::
Caught error type [...] ([...]): [...]
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
- testpmd> flow shared_action 0 create action_id 100 \
+ testpmd> flow indirect_action 0 create action_id 100 \
ingress action rss queues 1 2 end / end
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
port 0::
- testpmd> flow shared_action 0 create action_id \
+ testpmd> flow indirect_action 0 create action_id \
ingress action rss queues 0 1 end / end
-Updating shared actions
+Updating indirect actions
~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
- flow shared_action {port_id} update {shared_action_id}
+ flow indirect_action {port_id} update {indirect_action_id}
action {action} / end
If successful, it will show::
- Shared action #[...] updated
+ Indirect action #[...] updated
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
(in create example above rss queues were 1 and 2)::
- testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+ testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
-Destroying shared actions
+Destroying indirect actions
~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
- flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+ flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
If successful, it will show::
- Shared action #[...] destroyed
+ Indirect action #[...] destroyed
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
Caught error type [...] ([...]): [...]
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
- testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+ testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
-Query shared actions
+Query indirect actions
~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ Indirect RSS action:
refs:[...]
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Query shared action having id 100::
+Query indirect action having id 100::
- testpmd> flow shared_action 0 query 100
+ testpmd> flow indirect_action 0 query 100
Sample QinQ flow rules
~~~~~~~~~~~~~~~~~~~~~~
--
1.8.3.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
` (2 preceding siblings ...)
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action Bing Zhao
@ 2021-04-10 14:03 ` Bing Zhao
2021-04-12 19:40 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
4 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-10 14:03 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, mlx5 PMD needs to do the
adaption to the new APIs.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 ++++++++++++++++++++--------------------
drivers/net/mlx5/mlx5_flow.h | 24 ++--
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++++++-------
5 files changed, 180 insertions(+), 173 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 593532d..a198476 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1342,7 +1342,7 @@ struct mlx5_dev_ctx_shared *
* then this will return directly without any action.
*/
mlx5_flow_list_flush(dev, &priv->flows, true);
- mlx5_shared_action_flush(dev);
+ mlx5_action_handle_flush(dev);
mlx5_flow_meter_flush(dev, NULL);
/* Prevent crashes when queues are still in use. */
dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807d..6e9c4b9 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
/*
* Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c347f81..546b9ea 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -583,23 +583,23 @@ enum mlx5_expansion {
},
};
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
static int
@@ -638,10 +638,10 @@ enum mlx5_expansion {
.query = mlx5_flow_query,
.dev_dump = mlx5_flow_dev_dump,
.get_aged_flows = mlx5_flow_get_aged_flows,
- .shared_action_create = mlx5_shared_action_create,
- .shared_action_destroy = mlx5_shared_action_destroy,
- .shared_action_update = mlx5_shared_action_update,
- .shared_action_query = mlx5_shared_action_query,
+ .action_handle_create = mlx5_action_handle_create,
+ .action_handle_destroy = mlx5_action_handle_destroy,
+ .action_handle_update = mlx5_action_handle_update,
+ .action_handle_query = mlx5_action_handle_query,
.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
.tunnel_match = mlx5_flow_tunnel_match,
.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3417,31 +3417,31 @@ struct mlx5_aso_age_action*
return &pool->actions[offset - 1];
}
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
- struct rte_flow_shared_action *action; /**< Shared action */
- int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+ struct rte_flow_action_handle *action; /**< Indirect action handle. */
+ int index; /**< Index in related array of rte_flow_action. */
};
/**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
* from this call.
*
* @param[in] dev
* Pointer to Ethernet device.
* @param[in] actions
* List of actions to translate.
- * @param[out] shared
- * List to store translated shared actions.
- * @param[in, out] shared_n
- * Size of *shared* array. On return should be updated with number of shared
- * actions retrieved from the *actions* list.
+ * @param[out] handle
+ * List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ * Size of *handle* array. On return should be updated with number of
+ * indirect actions retrieved from the *actions* list.
* @param[out] translated_actions
- * List of actions where all shared actions were translated to non shared
+ * List of actions where all indirect actions were translated to direct
* if possible. NULL if no translation took place.
* @param[out] error
* Pointer to the error structure.
@@ -3450,10 +3450,10 @@ struct mlx5_translated_shared_action {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
- struct mlx5_translated_shared_action *shared,
- int *shared_n,
+ struct mlx5_translated_action_handle *handle,
+ int *indir_n,
struct rte_flow_action **translated_actions,
struct rte_flow_error *error)
{
@@ -3462,23 +3462,23 @@ struct mlx5_translated_shared_action {
size_t actions_size;
int n;
int copied_n = 0;
- struct mlx5_translated_shared_action *shared_end = NULL;
+ struct mlx5_translated_action_handle *handle_end = NULL;
for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
- if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+ if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
continue;
- if (copied_n == *shared_n) {
+ if (copied_n == *indir_n) {
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
NULL, "too many shared actions");
}
- rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+ rte_memcpy(&handle[copied_n].action, &actions[n].conf,
sizeof(actions[n].conf));
- shared[copied_n].index = n;
+ handle[copied_n].index = n;
copied_n++;
}
n++;
- *shared_n = copied_n;
+ *indir_n = copied_n;
if (!copied_n)
return 0;
actions_size = sizeof(struct rte_flow_action) * n;
@@ -3488,28 +3488,28 @@ struct mlx5_translated_shared_action {
return -ENOMEM;
}
memcpy(translated, actions, actions_size);
- for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+ for (handle_end = handle + copied_n; handle < handle_end; handle++) {
struct mlx5_shared_action_rss *shared_rss;
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
- - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx &
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
- translated[shared->index].type =
+ translated[handle->index].type =
RTE_FLOW_ACTION_TYPE_RSS;
- translated[shared->index].conf =
+ translated[handle->index].conf =
&shared_rss->origin;
break;
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
if (priv->sh->flow_hit_aso_en) {
- translated[shared->index].type =
+ translated[handle->index].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_AGE;
- translated[shared->index].conf =
+ translated[handle->index].conf =
(void *)(uintptr_t)idx;
break;
}
@@ -3518,7 +3518,7 @@ struct mlx5_translated_shared_action {
mlx5_free(translated);
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "invalid shared action type");
+ NULL, "invalid indirect action type");
}
}
*translated_actions = translated;
@@ -3540,21 +3540,21 @@ struct mlx5_translated_shared_action {
*/
static uint32_t
flow_get_shared_rss_action(struct rte_eth_dev *dev,
- struct mlx5_translated_shared_action *shared,
+ struct mlx5_translated_action_handle *handle,
int shared_n)
{
- struct mlx5_translated_shared_action *shared_end;
+ struct mlx5_translated_action_handle *handle_end;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_shared_action_rss *shared_rss;
- for (shared_end = shared + shared_n; shared < shared_end; shared++) {
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+ for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
uint32_t idx = act_idx &
- ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
idx);
@@ -5564,9 +5564,9 @@ struct mlx5_hlist_entry *
struct rte_flow *flow = NULL;
struct mlx5_flow *dev_flow;
const struct rte_flow_action_rss *rss = NULL;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
union {
struct mlx5_flow_expand_rss buf;
uint8_t buffer[2048];
@@ -5606,9 +5606,9 @@ struct mlx5_hlist_entry *
MLX5_ASSERT(wks);
rss_desc = &wks->rss_desc;
- ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret < 0) {
MLX5_ASSERT(translated_actions == NULL);
@@ -5669,8 +5669,8 @@ struct mlx5_hlist_entry *
buf->entries = 1;
buf->entry[0].pattern = (void *)(uintptr_t)items;
}
- rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
- shared_actions_n);
+ rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+ indir_actions_n);
for (i = 0; i < buf->entries; ++i) {
/* Initialize flow split data. */
flow_split_info.prefix_layers = 0;
@@ -5849,14 +5849,14 @@ struct rte_flow *
struct rte_flow_error *error)
{
int hairpin_flow;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
const struct rte_flow_action *actions;
struct rte_flow_action *translated_actions = NULL;
- int ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ int ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret)
@@ -7226,12 +7226,12 @@ struct mlx5_meter_domains_infos *
/* Wrapper for driver action_validate op callback */
static int
flow_drv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action validation unsupported";
+ static const char err_msg[] = "indirect action validation unsupported";
if (!fops->action_validate) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7247,8 +7247,8 @@ struct mlx5_meter_domains_infos *
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7259,11 +7259,11 @@ struct mlx5_meter_domains_infos *
* @note: wrapper for driver action_create op callback.
*/
static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action destruction unsupported";
+ static const char err_msg[] = "indirect action destruction unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7274,18 +7274,18 @@ struct mlx5_meter_domains_infos *
NULL, err_msg);
return -rte_errno;
}
- return fops->action_destroy(dev, action, error);
+ return fops->action_destroy(dev, handle, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action update unsupported";
+ static const char err_msg[] = "indirect action update unsupported";
if (!fops->action_update) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7293,18 +7293,18 @@ struct mlx5_meter_domains_infos *
NULL, err_msg);
return -rte_errno;
}
- return fops->action_update(dev, action, action_conf, error);
+ return fops->action_update(dev, handle, update, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action query unsupported";
+ static const char err_msg[] = "indirect action query unsupported";
if (!fops->action_query) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7312,29 +7312,31 @@ struct mlx5_meter_domains_infos *
NULL, err_msg);
return -rte_errno;
}
- return fops->action_query(dev, action, data, error);
+ return fops->action_query(dev, handle, data, error);
}
/**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param conf
+ * Pointer to indirect action object configuration.
* @param[in] action
- * Action configuration for shared action creation.
+ * Action configuration for indirect action object creation.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
* @return
* A valid handle in case of success, NULL otherwise and rte_errno is set.
*/
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action creation unsupported";
+ static const char err_msg[] = "indirect action creation unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7351,19 +7353,20 @@ struct mlx5_meter_domains_infos *
}
/**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] shared_action
- * Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ * Handle for the indirect action to be updated.
+ * @param[in] update
* Action specification used to modify the action pointed by handle.
- * *action* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7372,9 +7375,9 @@ struct mlx5_meter_domains_infos *
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
struct rte_flow_attr attr = { .transfer = 0 };
@@ -7382,26 +7385,27 @@ struct mlx5_meter_domains_infos *
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
- ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+ ret = flow_drv_action_validate(dev, NULL,
+ (const struct rte_flow_action *)update, fops, error);
if (ret)
return ret;
- return flow_drv_action_update(dev, shared_action, action->conf, fops,
+ return flow_drv_action_update(dev, handle, update, fops,
error);
}
/**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
*
* This function allows retrieving action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the indirect action to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -7412,8 +7416,8 @@ struct mlx5_meter_domains_infos *
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -7421,11 +7425,11 @@ struct mlx5_meter_domains_infos *
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
- return flow_drv_action_query(dev, action, data, fops, error);
+ return flow_drv_action_query(dev, handle, data, fops, error);
}
/**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
*
* @param dev
* Pointer to Ethernet device.
@@ -7434,7 +7438,7 @@ struct mlx5_meter_domains_infos *
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
{
struct rte_flow_error error;
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7444,8 +7448,8 @@ struct mlx5_meter_domains_infos *
ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
priv->rss_shared_actions, idx, shared_rss, next) {
- ret |= mlx5_shared_action_destroy(dev,
- (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+ ret |= mlx5_action_handle_destroy(dev,
+ (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
}
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ec673c2..56674eb 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -39,11 +39,11 @@ enum mlx5_rte_flow_action_type {
MLX5_RTE_FLOW_ACTION_TYPE_AGE,
};
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
enum {
- MLX5_SHARED_ACTION_TYPE_RSS,
- MLX5_SHARED_ACTION_TYPE_AGE,
+ MLX5_INDIRECT_ACTION_TYPE_RSS,
+ MLX5_INDIRECT_ACTION_TYPE_AGE,
};
/* Matches on selected register. */
@@ -1152,7 +1152,7 @@ struct mlx5_shared_action_rss {
rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
};
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
uint32_t id;
};
@@ -1233,26 +1233,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_validate_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_destroy_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_update_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *action,
+ const void *update,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_query_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *action,
void *data,
struct rte_flow_error *error);
typedef int (*mlx5_flow_sync_domain_t)
@@ -1483,7 +1483,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
struct rte_mtr_error *error);
int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1818895..86a59b1 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12873,7 +12873,7 @@ struct mlx5_cache_entry *
*/
static uint32_t
__flow_dv_action_rss_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
@@ -12896,7 +12896,7 @@ struct mlx5_cache_entry *
"cannot allocate resource memory");
goto error_rss_init;
}
- if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+ if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
rte_flow_error_set(error, E2BIG,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"rss action number out of range");
@@ -13009,7 +13009,7 @@ struct mlx5_cache_entry *
}
/**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
* (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
@@ -13018,7 +13018,7 @@ struct mlx5_cache_entry *
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * Action specification used to create shared action.
+ * Action specification used to create indirect action.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13027,9 +13027,9 @@ struct mlx5_cache_entry *
* A valid shared action handle in case of success, NULL otherwise and
* rte_errno is set.
*/
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
flow_dv_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
@@ -13039,13 +13039,13 @@ struct mlx5_cache_entry *
switch (action->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
if (ret) {
struct mlx5_aso_age_action *aso_age =
flow_aso_age_get_by_idx(dev, ret);
@@ -13060,19 +13060,19 @@ struct mlx5_cache_entry *
NULL, "action type not supported");
break;
}
- return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+ return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
}
/**
- * Destroy the shared action.
+ * Destroy the indirect action.
* Release action related resources on the NIC and the memory.
* Lock free, (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be removed.
+ * @param[in] handle
+ * The indirect action object handle to be removed.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13082,25 +13082,25 @@ struct mlx5_cache_entry *
*/
static int
flow_dv_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
int ret;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
return __flow_dv_action_rss_release(dev, idx, error);
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
ret = flow_dv_aso_age_release(dev, idx);
if (ret)
/*
* In this case, the last flow has a reference will
* actually release the age action.
*/
- DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+ DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
" released with references %d.", idx, ret);
return 0;
default:
@@ -13183,12 +13183,13 @@ struct mlx5_cache_entry *
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be updated.
- * @param[in] action_conf
- * Action specification used to modify *action*.
- * *action_conf* should be of type correlating with type of the *action*,
- * otherwise considered as invalid.
+ * @param[in] handle
+ * The indirect action object handle to be updated.
+ * @param[in] update
+ * Action specification used to modify the action pointed by *handle*.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13198,16 +13199,18 @@ struct mlx5_cache_entry *
*/
static int
flow_dv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *err)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ const void *action_conf;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
+ action_conf = ((const struct rte_flow_action *)update)->conf;
return __flow_dv_action_rss_update(dev, idx, action_conf, err);
default:
return rte_flow_error_set(err, ENOTSUP,
@@ -13219,17 +13222,17 @@ struct mlx5_cache_entry *
static int
flow_dv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action, void *data,
+ const struct rte_flow_action_handle *handle, void *data,
struct rte_flow_error *error)
{
struct mlx5_age_param *age_param;
struct rte_flow_query_age *resp;
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
resp = data;
resp->aged = __atomic_load_n(&age_param->state,
@@ -14005,7 +14008,7 @@ struct mlx5_cache_entry *
}
/**
- * Validate shared action.
+ * Validate indirect action.
* Dispatcher for action type specific validation.
*
* @param[in] dev
@@ -14013,7 +14016,7 @@ struct mlx5_cache_entry *
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * The shared action object to validate.
+ * The indirect action object to validate.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -14023,7 +14026,7 @@ struct mlx5_cache_entry *
*/
static int
flow_dv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
--
1.8.3.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
` (3 preceding siblings ...)
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API Bing Zhao
@ 2021-04-12 19:40 ` Ferruh Yigit
2021-04-13 1:22 ` Bing Zhao
4 siblings, 1 reply; 46+ messages in thread
From: Ferruh Yigit @ 2021-04-12 19:40 UTC (permalink / raw)
To: Bing Zhao, orika, thomas, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
On 4/10/2021 3:03 PM, Bing Zhao wrote:
> The patch set includes:
> 1. API changes
> 2. testpmd adaption and guide update
> 3. driver update (only net/mlx5 impacted)
>
> ---
> v2: add adaptions of testpmd and driver part
> ---
>
> Bing Zhao (4):
> ethdev: introduce indirect action APIs
> app/test-pmd: change to indirect action command
> doc: update user guide for indirect action
> net/mlx5: adaption to indirect action API
>
Hi Bing,
How the patchset constructed will cause build error in patch by patch build,
since first patch removes some struct/functions that are in use.
One way to handle this is:
- first add new function/structs
- switch app & pmd to new function/structs
- remove old function/structs
And another issue is this support has been added on 20.11, and we are changing
it in the second release after it.
Of course it is OK to change the API by time, that is why we have experimental
APIs, but the concern is if the development is driven by single vendor without a
consensus or enough reviews, and my worry is if same thing happening again.
The author and reviewers of the original patch is already cc'ed, I think it
would be good to have their ack to the change.
Thanks,
ferruh
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-12 19:42 ` Ferruh Yigit
2021-04-13 1:26 ` Bing Zhao
2021-04-13 12:36 ` Andrey Vesnovaty
2021-04-15 13:55 ` Andrew Rybchenko
2 siblings, 1 reply; 46+ messages in thread
From: Ferruh Yigit @ 2021-04-12 19:42 UTC (permalink / raw)
To: Bing Zhao, orika, thomas, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
On 4/10/2021 3:03 PM, Bing Zhao wrote:
> Right now, rte_flow_shared_action_* APIs are used for some shared
> actions, like RSS, count. The shared action should be created before
> using it inside a flow. These shared actions sometimes are not
> really shared but just some indirect actions decoupled from a flow.
>
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
>
> There are two types of flow actions:
> 1. the direct (normal) actions that could be created and stored
> within a flow rule. Such action is tied to its flow rule and
> cannot be reused.
> 2. the indirect action, in the past, named shared_action. It is
> created from a direct actioni, like count or rss, and then used
> in the flow rules with an object handle. The PMD will take care
> of the retrieve from indirect action to the direct action
> when it is referenced.
>
> The indirect action is accessed (update / query) w/o any flow rule,
> just via the action object handle. For example, when querying or
> resetting a counter, it could be done out of any flow using this
> counter, but only the handle of the counter action object is
> required.
> The indirect action object could be shared by different flows or
> used by a single flow, depending on the direct action type and
> the real-life requirements.
> The handle of an indirect action object is opaque and defined in
> each driver and possibly different per direct action type.
>
> The old name "shared" is improper in a sense and should be replaced.
>
> All the command lines in testpmd application with "shared_action*"
> are replaced with "indirect_action*".
>
> The parameter of "update" interface is also changed. A general
> pointer will replace the rte_flow_action struct pointer due to the
> facts:
> 1. Some action may not support fields updating. In the example of a
> counter, the only "update" supported should be the reset. So
> passing a rte_flow_action struct pointer is meaningless and
> there is even no such corresponding action struct. What's more,
> if more than one operations should be supported, for some other
> action, such pointer parameter may not meet the need.
> 2. Some action may need conditional or partial update, the current
> parameter will not provide the ability to indicate which part(s)
> to update.
> For different types of indirect action objects, the pointer could
> either be the same of rte_flow_action* struct - in order not to
> break the current driver implementation, or some wrapper
> structures with bits as masks to indicate which part to be
> updated, depending on real needs of the corresponding direct
> action. For different direct actions, the structures of indirect
> action objects updating will be different.
>
> All the underlayer PMD callbacks will be moved to these new APIs.
>
> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break the ABI. All the implementations are changed by using
> RTE_FLOW_ACTION_TYPE_INDIRECT.
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> ---
> doc/guides/rel_notes/release_21_05.rst | 3 +
> lib/librte_ethdev/rte_flow.c | 56 ++++++++--------
> lib/librte_ethdev/rte_flow.h | 118 +++++++++++++++++++--------------
> lib/librte_ethdev/rte_flow_driver.h | 26 ++++----
> lib/librte_ethdev/version.map | 8 +--
Isn't there any documentation to update with this change?
If the shared action API is not documented at all, can you please add
documentation for the action handle API?
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
2021-04-12 19:40 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
@ 2021-04-13 1:22 ` Bing Zhao
2021-04-13 7:23 ` Thomas Monjalon
0 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-13 1:22 UTC (permalink / raw)
To: Ferruh Yigit, Ori Kam, NBU-Contact-Thomas Monjalon,
andrew.rybchenko, Matan Azrad, Slava Ovsiienko
Cc: dev, ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
Hi Ferruh,
Thanks for your comments.
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 3:40 AM
> To: Bing Zhao <bingz@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>;
> andrew.rybchenko@oktetlabs.ru; Matan Azrad <matan@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> Subject: Re: [PATCH v2 0/4] Change shared action API to action
> handle API
>
> External email: Use caution opening links or attachments
>
>
> On 4/10/2021 3:03 PM, Bing Zhao wrote:
> > The patch set includes:
> > 1. API changes
> > 2. testpmd adaption and guide update
> > 3. driver update (only net/mlx5 impacted)
> >
> > ---
> > v2: add adaptions of testpmd and driver part
> > ---
> >
> > Bing Zhao (4):
> > ethdev: introduce indirect action APIs
> > app/test-pmd: change to indirect action command
> > doc: update user guide for indirect action
> > net/mlx5: adaption to indirect action API
> >
>
> Hi Bing,
>
> How the patchset constructed will cause build error in patch by
> patch build, since first patch removes some struct/functions that
> are in use.
>
> One way to handle this is:
> - first add new function/structs
> - switch app & pmd to new function/structs
> - remove old function/structs
>
Sure, I will reorganize the patch set in this way. Thanks for this.
>
> And another issue is this support has been added on 20.11, and we
> are changing it in the second release after it.
> Of course it is OK to change the API by time, that is why we have
> experimental APIs, but the concern is if the development is driven
> by single vendor without a consensus or enough reviews, and my worry
> is if same thing happening again.
The change itself is not big, most of them are the naming convention. The most important change is one input parameter of the "update" interface.
Yes, I agree with your concern. Are there any other reviewers suggested for this change? (I got the name list from the script)
It would be very helpful if they could give some comments or some suggestions.
>
> The author and reviewers of the original patch is already cc'ed, I
> think it would be good to have their ack to the change.
Yes, I will ping them.
>
> Thanks,
> ferruh
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-12 19:42 ` Ferruh Yigit
@ 2021-04-13 1:26 ` Bing Zhao
2021-04-13 14:00 ` Ori Kam
0 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-13 1:26 UTC (permalink / raw)
To: Ferruh Yigit, Ori Kam, NBU-Contact-Thomas Monjalon,
andrew.rybchenko, Matan Azrad, Slava Ovsiienko
Cc: dev, ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
Hi Ferruh,
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 3:42 AM
> To: Bing Zhao <bingz@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>;
> andrew.rybchenko@oktetlabs.ru; Matan Azrad <matan@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> Subject: Re: [PATCH v2 1/4] ethdev: introduce indirect action APIs
>
> External email: Use caution opening links or attachments
>
>
> On 4/10/2021 3:03 PM, Bing Zhao wrote:
> > Right now, rte_flow_shared_action_* APIs are used for some shared
> > actions, like RSS, count. The shared action should be created
> before
> > using it inside a flow. These shared actions sometimes are not
> really
> > shared but just some indirect actions decoupled from a flow.
> >
> > The new functions rte_flow_action_handle_* are added to replace
> the
> > current shared functions rte_flow_shared_action_*.
> >
> > There are two types of flow actions:
> > 1. the direct (normal) actions that could be created and stored
> > within a flow rule. Such action is tied to its flow rule and
> > cannot be reused.
> > 2. the indirect action, in the past, named shared_action. It is
> > created from a direct actioni, like count or rss, and then
> used
> > in the flow rules with an object handle. The PMD will take
> care
> > of the retrieve from indirect action to the direct action
> > when it is referenced.
> >
> > The indirect action is accessed (update / query) w/o any flow rule,
> > just via the action object handle. For example, when querying or
> > resetting a counter, it could be done out of any flow using this
> > counter, but only the handle of the counter action object is
> required.
> > The indirect action object could be shared by different flows or
> used
> > by a single flow, depending on the direct action type and the
> > real-life requirements.
> > The handle of an indirect action object is opaque and defined in
> each
> > driver and possibly different per direct action type.
> >
> > The old name "shared" is improper in a sense and should be
> replaced.
> >
> > All the command lines in testpmd application with "shared_action*"
> > are replaced with "indirect_action*".
> >
> > The parameter of "update" interface is also changed. A general
> pointer
> > will replace the rte_flow_action struct pointer due to the
> > facts:
> > 1. Some action may not support fields updating. In the example of
> a
> > counter, the only "update" supported should be the reset. So
> > passing a rte_flow_action struct pointer is meaningless and
> > there is even no such corresponding action struct. What's more,
> > if more than one operations should be supported, for some
> other
> > action, such pointer parameter may not meet the need.
> > 2. Some action may need conditional or partial update, the current
> > parameter will not provide the ability to indicate which
> part(s)
> > to update.
> > For different types of indirect action objects, the pointer
> could
> > either be the same of rte_flow_action* struct - in order not
> to
> > break the current driver implementation, or some wrapper
> > structures with bits as masks to indicate which part to be
> > updated, depending on real needs of the corresponding direct
> > action. For different direct actions, the structures of
> indirect
> > action objects updating will be different.
> >
> > All the underlayer PMD callbacks will be moved to these new APIs.
> >
> > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break
> > the ABI. All the implementations are changed by using
> > RTE_FLOW_ACTION_TYPE_INDIRECT.
> >
> > Signed-off-by: Bing Zhao <bingz@nvidia.com>
> > ---
> > doc/guides/rel_notes/release_21_05.rst | 3 +
> > lib/librte_ethdev/rte_flow.c | 56 ++++++++--------
> > lib/librte_ethdev/rte_flow.h | 118
> +++++++++++++++++++--------------
> > lib/librte_ethdev/rte_flow_driver.h | 26 ++++----
> > lib/librte_ethdev/version.map | 8 +--
>
> Isn't there any documentation to update with this change?
Do you mean the release note? I only updated the 20_01 release note part.
>
> If the shared action API is not documented at all, can you please
> add documentation for the action handle API?
In the testpmd usage guide, I found some description and update it together with the testpmd update.
I will check if there is another place to update or add.
Thanks
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
2021-04-13 1:22 ` Bing Zhao
@ 2021-04-13 7:23 ` Thomas Monjalon
2021-04-13 7:24 ` Bing Zhao
0 siblings, 1 reply; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-13 7:23 UTC (permalink / raw)
To: Ferruh Yigit, Bing Zhao
Cc: Ori Kam, andrew.rybchenko, Matan Azrad, Slava Ovsiienko, dev,
ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
13/04/2021 03:22, Bing Zhao:
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> > > Bing Zhao (4):
> > > ethdev: introduce indirect action APIs
> > > app/test-pmd: change to indirect action command
> > > doc: update user guide for indirect action
> > > net/mlx5: adaption to indirect action API
> > >
> >
> > Hi Bing,
> >
> > How the patchset constructed will cause build error in patch by
> > patch build, since first patch removes some struct/functions that
> > are in use.
> >
> > One way to handle this is:
> > - first add new function/structs
> > - switch app & pmd to new function/structs
> > - remove old function/structs
>
> Sure, I will reorganize the patch set in this way. Thanks for this.
This is a drop-in replacement, it should be done in one patch only.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
2021-04-13 7:23 ` Thomas Monjalon
@ 2021-04-13 7:24 ` Bing Zhao
0 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-13 7:24 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon, Ferruh Yigit
Cc: Ori Kam, andrew.rybchenko, Matan Azrad, Slava Ovsiienko, dev,
ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
Thanks, I will squash the commits.
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 13, 2021 3:24 PM
> To: Ferruh Yigit <ferruh.yigit@intel.com>; Bing Zhao
> <bingz@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; andrew.rybchenko@oktetlabs.ru; Matan
> Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to
> action handle API
>
> External email: Use caution opening links or attachments
>
>
> 13/04/2021 03:22, Bing Zhao:
> > From: Ferruh Yigit <ferruh.yigit@intel.com>
> > > > Bing Zhao (4):
> > > > ethdev: introduce indirect action APIs
> > > > app/test-pmd: change to indirect action command
> > > > doc: update user guide for indirect action
> > > > net/mlx5: adaption to indirect action API
> > > >
> > >
> > > Hi Bing,
> > >
> > > How the patchset constructed will cause build error in patch by
> > > patch build, since first patch removes some struct/functions
> that
> > > are in use.
> > >
> > > One way to handle this is:
> > > - first add new function/structs
> > > - switch app & pmd to new function/structs
> > > - remove old function/structs
> >
> > Sure, I will reorganize the patch set in this way. Thanks for this.
>
> This is a drop-in replacement, it should be done in one patch only.
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-12 19:42 ` Ferruh Yigit
@ 2021-04-13 12:36 ` Andrey Vesnovaty
2021-04-15 13:55 ` Andrew Rybchenko
2 siblings, 0 replies; 46+ messages in thread
From: Andrey Vesnovaty @ 2021-04-13 12:36 UTC (permalink / raw)
To: Bing Zhao, Ori Kam, NBU-Contact-Thomas Monjalon, ferruh.yigit,
andrew.rybchenko, Matan Azrad, Slava Ovsiienko
Cc: dev, ajit.khaparde, Gregory Etelson
> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Saturday, April 10, 2021 5:04 PM
> To: Ori Kam <orika@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; ferruh.yigit@intel.com;
> andrew.rybchenko@oktetlabs.ru; Matan Azrad <matan@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> Subject: [PATCH v2 1/4] ethdev: introduce indirect action APIs
>
> Right now, rte_flow_shared_action_* APIs are used for some shared
> actions, like RSS, count. The shared action should be created before
> using it inside a flow. These shared actions sometimes are not
> really shared but just some indirect actions decoupled from a flow.
>
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
>
> There are two types of flow actions:
> 1. the direct (normal) actions that could be created and stored
> within a flow rule. Such action is tied to its flow rule and
> cannot be reused.
> 2. the indirect action, in the past, named shared_action. It is
> created from a direct actioni, like count or rss, and then used
> in the flow rules with an object handle. The PMD will take care
> of the retrieve from indirect action to the direct action
> when it is referenced.
>
> The indirect action is accessed (update / query) w/o any flow rule,
> just via the action object handle. For example, when querying or
> resetting a counter, it could be done out of any flow using this
> counter, but only the handle of the counter action object is
> required.
> The indirect action object could be shared by different flows or
> used by a single flow, depending on the direct action type and
> the real-life requirements.
> The handle of an indirect action object is opaque and defined in
> each driver and possibly different per direct action type.
>
> The old name "shared" is improper in a sense and should be replaced.
>
> All the command lines in testpmd application with "shared_action*"
> are replaced with "indirect_action*".
>
> The parameter of "update" interface is also changed. A general
> pointer will replace the rte_flow_action struct pointer due to the
> facts:
> 1. Some action may not support fields updating. In the example of a
> counter, the only "update" supported should be the reset. So
> passing a rte_flow_action struct pointer is meaningless and
> there is even no such corresponding action struct. What's more,
> if more than one operations should be supported, for some other
> action, such pointer parameter may not meet the need.
> 2. Some action may need conditional or partial update, the current
> parameter will not provide the ability to indicate which part(s)
> to update.
> For different types of indirect action objects, the pointer could
> either be the same of rte_flow_action* struct - in order not to
> break the current driver implementation, or some wrapper
> structures with bits as masks to indicate which part to be
> updated, depending on real needs of the corresponding direct
> action. For different direct actions, the structures of indirect
> action objects updating will be different.
>
> All the underlayer PMD callbacks will be moved to these new APIs.
>
> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break the ABI. All the implementations are changed by using
> RTE_FLOW_ACTION_TYPE_INDIRECT.
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> ---
> doc/guides/rel_notes/release_21_05.rst | 3 +
> lib/librte_ethdev/rte_flow.c | 56 ++++++++--------
> lib/librte_ethdev/rte_flow.h | 118 +++++++++++++++++++--------------
> lib/librte_ethdev/rte_flow_driver.h | 26 ++++----
> lib/librte_ethdev/version.map | 8 +--
> 5 files changed, 115 insertions(+), 96 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_21_05.rst
> b/doc/guides/rel_notes/release_21_05.rst
> index 374d6d9..6c0ac46 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -164,6 +164,9 @@ API Changes
> from ``rte_thread_tls_*`` to ``rte_thread_*`` to avoid naming redundancy
> and confusion with the transport layer security term.
>
> +* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
> + replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
> + ``rte_flow_action_handle_*``.
>
> ABI Changes
> -----------
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index e07e617..27a1615 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -180,12 +180,12 @@ struct rte_flow_desc_data {
> MK_FLOW_ACTION(MODIFY_FIELD,
> sizeof(struct rte_flow_action_modify_field)),
> /**
> - * Shared action represented as handle of type
> - * (struct rte_flow_shared action *) stored in conf field (see
> + * Indirect action represented as handle of type
> + * (struct rte_flow_action_handle *) stored in conf field (see
> * struct rte_flow_action); no need for additional structure to * store
> - * shared action handle.
> + * indirect action handle.
> */
> - MK_FLOW_ACTION(SHARED, 0),
> + MK_FLOW_ACTION(INDIRECT, 0),
> };
>
> int
> @@ -1067,53 +1067,53 @@ enum rte_flow_conv_item_spec_type {
> NULL, rte_strerror(ENOTSUP));
> }
>
> -struct rte_flow_shared_action *
> -rte_flow_shared_action_create(uint16_t port_id,
> - const struct rte_flow_shared_action_conf *conf,
> +struct rte_flow_action_handle *
> +rte_flow_action_handle_create(uint16_t port_id,
> + const struct rte_flow_indir_action_conf *conf,
> const struct rte_flow_action *action,
> struct rte_flow_error *error)
> {
> - struct rte_flow_shared_action *shared_action;
> + struct rte_flow_action_handle *handle;
> const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
>
> if (unlikely(!ops))
> return NULL;
> - if (unlikely(!ops->shared_action_create)) {
> + if (unlikely(!ops->action_handle_create)) {
> rte_flow_error_set(error, ENOSYS,
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> NULL,
> rte_strerror(ENOSYS));
> return NULL;
> }
> - shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
> - conf, action, error);
> - if (shared_action == NULL)
> + handle = ops->action_handle_create(&rte_eth_devices[port_id],
> + conf, action, error);
> + if (handle == NULL)
> flow_err(port_id, -rte_errno, error);
> - return shared_action;
> + return handle;
> }
>
> int
> -rte_flow_shared_action_destroy(uint16_t port_id,
> - struct rte_flow_shared_action *action,
> - struct rte_flow_error *error)
> +rte_flow_action_handle_destroy(uint16_t port_id,
> + struct rte_flow_action_handle *handle,
> + struct rte_flow_error *error)
> {
> int ret;
> const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
>
> if (unlikely(!ops))
> return -rte_errno;
> - if (unlikely(!ops->shared_action_destroy))
> + if (unlikely(!ops->action_handle_destroy))
> return rte_flow_error_set(error, ENOSYS,
>
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> NULL, rte_strerror(ENOSYS));
> - ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
> - error);
> + ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
> + handle, error);
> return flow_err(port_id, ret, error);
> }
>
> int
> -rte_flow_shared_action_update(uint16_t port_id,
> - struct rte_flow_shared_action *action,
> - const struct rte_flow_action *update,
> +rte_flow_action_handle_update(uint16_t port_id,
> + struct rte_flow_action_handle *handle,
> + const void *update,
> struct rte_flow_error *error)
> {
> int ret;
> @@ -1121,18 +1121,18 @@ struct rte_flow_shared_action *
>
> if (unlikely(!ops))
> return -rte_errno;
> - if (unlikely(!ops->shared_action_update))
> + if (unlikely(!ops->action_handle_update))
> return rte_flow_error_set(error, ENOSYS,
>
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> NULL, rte_strerror(ENOSYS));
> - ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
> + ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
> update, error);
> return flow_err(port_id, ret, error);
> }
>
> int
> -rte_flow_shared_action_query(uint16_t port_id,
> - const struct rte_flow_shared_action *action,
> +rte_flow_action_handle_query(uint16_t port_id,
> + const struct rte_flow_action_handle *handle,
> void *data,
> struct rte_flow_error *error)
> {
> @@ -1141,11 +1141,11 @@ struct rte_flow_shared_action *
>
> if (unlikely(!ops))
> return -rte_errno;
> - if (unlikely(!ops->shared_action_query))
> + if (unlikely(!ops->action_handle_query))
> return rte_flow_error_set(error, ENOSYS,
>
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> NULL, rte_strerror(ENOSYS));
> - ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
> + ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
> data, error);
> return flow_err(port_id, ret, error);
> }
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 6cc5713..91ae25b 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
> * Enables counters for this flow rule.
> *
> * These counters can be retrieved and reset through rte_flow_query()
> or
> - * rte_flow_shared_action_query() if the action provided via handle,
> + * rte_flow_action_handle_query() if the action provided via handle,
> * see struct rte_flow_query_count.
> *
> * See struct rte_flow_action_count.
> @@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
> * See struct rte_flow_action_modify_field.
> */
> RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
> +
> + /**
> + * Describe indirect action that could be used by a single flow rule
> + * or multiple flow rules.
> + *
> + * Allow flow rule(s) reference the same action by the indirect action
> + * handle (see struct rte_flow_action_handle), rules could be on the
> + * same port or across different ports.
> + */
> + RTE_FLOW_ACTION_TYPE_INDIRECT,
> };
>
> /**
> @@ -2357,7 +2367,7 @@ struct rte_flow_query_age {
> * ``struct rte_flow_query_count``.
> *
> * @deprecated Shared attribute is deprecated, use generic
> - * RTE_FLOW_ACTION_TYPE_SHARED action.
> + * RTE_FLOW_ACTION_TYPE_INDIRECT action.
> *
> * The shared flag indicates whether the counter is unique to the flow rule the
> * action is specified with, or whether it is a shared counter.
> @@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
> };
>
> /**
> - * RTE_FLOW_ACTION_TYPE_SHARED
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice
> + *
> + * RTE_FLOW_ACTION_TYPE_INDIRECT
> *
> - * Opaque type returned after successfully creating a shared action.
> + * Opaque type returned after successfully creating an indirect action object.
> + * The definition of the object handle will be different per driver or
> + * per immediate action type.
> *
> - * This handle can be used to manage and query the related action:
> - * - share it across multiple flow rules
> - * - update action configuration
> - * - query action data
> - * - destroy action
> + * This handle can be used to manage and query the related immediate action:
> + * - referenced in single flow rule or across multiple flow rules
> + * over multiple ports
> + * - update action object configuration
> + * - query action object data
> + * - destroy action object
> */
> -struct rte_flow_shared_action;
> +struct rte_flow_action_handle;
>
> /**
> * Field IDs for MODIFY_FIELD action.
> @@ -3628,25 +3644,22 @@ struct rte_flow_desc {
> uint32_t nb_contexts, struct rte_flow_error *error);
>
> /**
> - * Specify shared action configuration
> + * Specify indirect action object configuration
> */
> -struct rte_flow_shared_action_conf {
> +struct rte_flow_indir_action_conf {
> /**
> - * Flow direction for shared action configuration.
> + * Flow direction for the indirect action configuration.
> *
> - * Shared action should be valid at least for one flow direction,
> + * Action should be valid at least for one flow direction,
> * otherwise it is invalid for both ingress and egress rules.
> */
> uint32_t ingress:1;
> /**< Action valid for rules applied to ingress traffic. */
> uint32_t egress:1;
> /**< Action valid for rules applied to egress traffic. */
> -
> /**
> * When set to 1, indicates that the action is valid for
> * transfer traffic; otherwise, for non-transfer traffic.
> - *
> - * See struct rte_flow_attr.
> */
> uint32_t transfer:1;
> };
> @@ -3655,16 +3668,17 @@ struct rte_flow_shared_action_conf {
> * @warning
> * @b EXPERIMENTAL: this API may change without prior notice.
> *
> - * Create shared action for reuse in multiple flow rules.
> - * The created shared action has single state and configuration
> - * across all flow rules using it.
> + * Create an indirect action object that can be used by flow create, and
> + * could also be shared by different flows.
> + * The created object handle has single state and configuration
> + * across all the flow rules using it.
> *
> * @param[in] port_id
> * The port identifier of the Ethernet device.
> * @param[in] conf
> - * Shared action configuration.
> + * Action configuration for the indirect action object creation.
> * @param[in] action
> - * Action configuration for shared action creation.
> + * Specific configuration of the indirect action object.
> * @param[out] error
> * Perform verbose error reporting if not NULL. PMDs initialize this
> * structure in case of error only.
> @@ -3678,9 +3692,9 @@ struct rte_flow_shared_action_conf {
> * - (ENOTSUP) if *action* valid but unsupported.
> */
> __rte_experimental
> -struct rte_flow_shared_action *
> -rte_flow_shared_action_create(uint16_t port_id,
> - const struct rte_flow_shared_action_conf *conf,
> +struct rte_flow_action_handle *
> +rte_flow_action_handle_create(uint16_t port_id,
> + const struct rte_flow_indir_action_conf *conf,
> const struct rte_flow_action *action,
> struct rte_flow_error *error);
>
> @@ -3688,12 +3702,12 @@ struct rte_flow_shared_action *
> * @warning
> * @b EXPERIMENTAL: this API may change without prior notice.
> *
> - * Destroy the shared action by handle.
> + * Destroy indirect action by handle.
> *
> * @param[in] port_id
> * The port identifier of the Ethernet device.
> - * @param[in] action
> - * Handle for the shared action to be destroyed.
> + * @param[in] handle
> + * Handle for the indirect action object to be destroyed.
> * @param[out] error
> * Perform verbose error reporting if not NULL. PMDs initialize this
> * structure in case of error only.
> @@ -3708,27 +3722,30 @@ struct rte_flow_shared_action *
> */
> __rte_experimental
> int
> -rte_flow_shared_action_destroy(uint16_t port_id,
> - struct rte_flow_shared_action *action,
> +rte_flow_action_handle_destroy(uint16_t port_id,
> + struct rte_flow_action_handle *handle,
> struct rte_flow_error *error);
>
> /**
> * @warning
> * @b EXPERIMENTAL: this API may change without prior notice.
> *
> - * Update in-place the shared action configuration pointed by *action* handle
> - * with the configuration provided as *update* argument.
> - * The update of the shared action configuration effects all flow rules reusing
> - * the action via handle.
> + * Update in-place the action configuration and / or state pointed
> + * by action *handle* with the configuration provided as *update* argument.
> + * The update of the action configuration effects all flow rules reusing
> + * the action via *handle*.
> + * The update general pointer provides the ability of partial updating.
> *
> * @param[in] port_id
> * The port identifier of the Ethernet device.
> - * @param[in] action
> - * Handle for the shared action to be updated.
> + * @param[in] handle
> + * Handle for the indirect action object to be updated.
> * @param[in] update
> - * Action specification used to modify the action pointed by handle.
> - * *update* should be of same type with the action pointed by the *action*
> - * handle argument, otherwise considered as invalid.
> + * Update profile specification used to modify the action pointed by handle.
> + * *update* could be with the same type of the immediate action
> corresponding
> + * to the *handle* argument when creating, or a wrapper structure includes
> + * action configuration to be updated and bit fields to indicate the member
> + * of fields inside the action to update.
> * @param[out] error
> * Perform verbose error reporting if not NULL. PMDs initialize this
> * structure in case of error only.
> @@ -3739,32 +3756,32 @@ struct rte_flow_shared_action *
> * - (-EIO) if underlying device is removed.
> * - (-EINVAL) if *update* invalid.
> * - (-ENOTSUP) if *update* valid but unsupported.
> - * - (-ENOENT) if action pointed by *ctx* was not found.
> + * - (-ENOENT) if indirect action object pointed by *handle* was not found.
> * rte_errno is also set.
> */
> __rte_experimental
> int
> -rte_flow_shared_action_update(uint16_t port_id,
> - struct rte_flow_shared_action *action,
> - const struct rte_flow_action *update,
> +rte_flow_action_handle_update(uint16_t port_id,
> + struct rte_flow_action_handle *handle,
> + const void *update,
> struct rte_flow_error *error);
>
> /**
> * @warning
> * @b EXPERIMENTAL: this API may change without prior notice.
> *
> - * Query the shared action by handle.
> + * Query the direct action by corresponding indirect action object handle.
> *
> * Retrieve action-specific data such as counters.
> * Data is gathered by special action which may be present/referenced in
> * more than one flow rule definition.
> *
> - * \see RTE_FLOW_ACTION_TYPE_COUNT
> + * @see RTE_FLOW_ACTION_TYPE_COUNT
> *
> * @param port_id
> * Port identifier of Ethernet device.
> - * @param[in] action
> - * Handle for the shared action to query.
> + * @param[in] handle
> + * Handle for the action object to query.
> * @param[in, out] data
> * Pointer to storage for the associated query data type.
> * @param[out] error
> @@ -3776,10 +3793,9 @@ struct rte_flow_shared_action *
> */
> __rte_experimental
> int
> -rte_flow_shared_action_query(uint16_t port_id,
> - const struct rte_flow_shared_action *action,
> - void *data,
> - struct rte_flow_error *error);
> +rte_flow_action_handle_query(uint16_t port_id,
> + const struct rte_flow_action_handle *handle,
> + void *data, struct rte_flow_error *error);
>
> /* Tunnel has a type and the key information. */
> struct rte_flow_tunnel {
> diff --git a/lib/librte_ethdev/rte_flow_driver.h
> b/lib/librte_ethdev/rte_flow_driver.h
> index da594d9..8d825eb 100644
> --- a/lib/librte_ethdev/rte_flow_driver.h
> +++ b/lib/librte_ethdev/rte_flow_driver.h
> @@ -83,27 +83,27 @@ struct rte_flow_ops {
> void **context,
> uint32_t nb_contexts,
> struct rte_flow_error *err);
> - /** See rte_flow_shared_action_create() */
> - struct rte_flow_shared_action *(*shared_action_create)
> + /** See rte_flow_action_handle_create() */
> + struct rte_flow_action_handle *(*action_handle_create)
> (struct rte_eth_dev *dev,
> - const struct rte_flow_shared_action_conf *conf,
> + const struct rte_flow_indir_action_conf *conf,
> const struct rte_flow_action *action,
> struct rte_flow_error *error);
> - /** See rte_flow_shared_action_destroy() */
> - int (*shared_action_destroy)
> + /** See rte_flow_action_handle_destroy() */
> + int (*action_handle_destroy)
> (struct rte_eth_dev *dev,
> - struct rte_flow_shared_action *shared_action,
> + struct rte_flow_action_handle *handle,
> struct rte_flow_error *error);
> - /** See rte_flow_shared_action_update() */
> - int (*shared_action_update)
> + /** See rte_flow_action_handle_update() */
> + int (*action_handle_update)
> (struct rte_eth_dev *dev,
> - struct rte_flow_shared_action *shared_action,
> - const struct rte_flow_action *update,
> + struct rte_flow_action_handle *handle,
> + const void *update,
> struct rte_flow_error *error);
> - /** See rte_flow_shared_action_query() */
> - int (*shared_action_query)
> + /** See rte_flow_action_handle_query() */
> + int (*action_handle_query)
> (struct rte_eth_dev *dev,
> - const struct rte_flow_shared_action *shared_action,
> + const struct rte_flow_action_handle *handle,
> void *data,
> struct rte_flow_error *error);
> /** See rte_flow_tunnel_decap_set() */
> diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
> index 93ad388..4eb561a 100644
> --- a/lib/librte_ethdev/version.map
> +++ b/lib/librte_ethdev/version.map
> @@ -231,10 +231,6 @@ EXPERIMENTAL {
> rte_eth_fec_get_capability;
> rte_eth_fec_get;
> rte_eth_fec_set;
> - rte_flow_shared_action_create;
> - rte_flow_shared_action_destroy;
> - rte_flow_shared_action_query;
> - rte_flow_shared_action_update;
> rte_flow_tunnel_decap_set;
> rte_flow_tunnel_match;
> rte_flow_get_restore_info;
> @@ -246,6 +242,10 @@ EXPERIMENTAL {
>
> # added in 21.05
> rte_eth_representor_info_get;
> + rte_flow_action_handle_create;
> + rte_flow_action_handle_destroy;
> + rte_flow_action_handle_update;
> + rte_flow_action_handle_query;
> };
>
> INTERNAL {
> --
> 1.8.3.1
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-13 1:26 ` Bing Zhao
@ 2021-04-13 14:00 ` Ori Kam
0 siblings, 0 replies; 46+ messages in thread
From: Ori Kam @ 2021-04-13 14:00 UTC (permalink / raw)
To: Bing Zhao, Ferruh Yigit, NBU-Contact-Thomas Monjalon,
andrew.rybchenko, Matan Azrad, Slava Ovsiienko
Cc: dev, ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Tuesday, April 13, 2021 4:27 AM
> Subject: RE: [PATCH v2 1/4] ethdev: introduce indirect action APIs
>
> Hi Ferruh,
>
> > -----Original Message-----
> > From: Ferruh Yigit <ferruh.yigit@intel.com>
> > Sent: Tuesday, April 13, 2021 3:42 AM
> > To: Bing Zhao <bingz@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-
> > Contact-Thomas Monjalon <thomas@monjalon.net>;
> > andrew.rybchenko@oktetlabs.ru; Matan Azrad <matan@nvidia.com>; Slava
> > Ovsiienko <viacheslavo@nvidia.com>
> > Cc: dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> > <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> > Subject: Re: [PATCH v2 1/4] ethdev: introduce indirect action APIs
> >
> > External email: Use caution opening links or attachments
> >
> >
> > On 4/10/2021 3:03 PM, Bing Zhao wrote:
> > > Right now, rte_flow_shared_action_* APIs are used for some shared
> > > actions, like RSS, count. The shared action should be created
> > before
> > > using it inside a flow. These shared actions sometimes are not
> > really
> > > shared but just some indirect actions decoupled from a flow.
> > >
> > > The new functions rte_flow_action_handle_* are added to replace
> > the
> > > current shared functions rte_flow_shared_action_*.
> > >
> > > There are two types of flow actions:
> > > 1. the direct (normal) actions that could be created and stored
> > > within a flow rule. Such action is tied to its flow rule and
> > > cannot be reused.
> > > 2. the indirect action, in the past, named shared_action. It is
> > > created from a direct actioni, like count or rss, and then
> > used
> > > in the flow rules with an object handle. The PMD will take
> > care
> > > of the retrieve from indirect action to the direct action
> > > when it is referenced.
> > >
> > > The indirect action is accessed (update / query) w/o any flow rule,
> > > just via the action object handle. For example, when querying or
> > > resetting a counter, it could be done out of any flow using this
> > > counter, but only the handle of the counter action object is
> > required.
> > > The indirect action object could be shared by different flows or
> > used
> > > by a single flow, depending on the direct action type and the
> > > real-life requirements.
> > > The handle of an indirect action object is opaque and defined in
> > each
> > > driver and possibly different per direct action type.
> > >
> > > The old name "shared" is improper in a sense and should be
> > replaced.
> > >
> > > All the command lines in testpmd application with "shared_action*"
> > > are replaced with "indirect_action*".
> > >
> > > The parameter of "update" interface is also changed. A general
> > pointer
> > > will replace the rte_flow_action struct pointer due to the
> > > facts:
> > > 1. Some action may not support fields updating. In the example of
> > a
> > > counter, the only "update" supported should be the reset. So
> > > passing a rte_flow_action struct pointer is meaningless and
> > > there is even no such corresponding action struct. What's more,
> > > if more than one operations should be supported, for some
> > other
> > > action, such pointer parameter may not meet the need.
> > > 2. Some action may need conditional or partial update, the current
> > > parameter will not provide the ability to indicate which
> > part(s)
> > > to update.
> > > For different types of indirect action objects, the pointer
> > could
> > > either be the same of rte_flow_action* struct - in order not
> > to
> > > break the current driver implementation, or some wrapper
> > > structures with bits as masks to indicate which part to be
> > > updated, depending on real needs of the corresponding direct
> > > action. For different direct actions, the structures of
> > indirect
> > > action objects updating will be different.
> > >
> > > All the underlayer PMD callbacks will be moved to these new APIs.
> > >
> > > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> > break
> > > the ABI. All the implementations are changed by using
> > > RTE_FLOW_ACTION_TYPE_INDIRECT.
> > >
> > > Signed-off-by: Bing Zhao <bingz@nvidia.com>
> > > ---
> > > doc/guides/rel_notes/release_21_05.rst | 3 +
> > > lib/librte_ethdev/rte_flow.c | 56 ++++++++--------
> > > lib/librte_ethdev/rte_flow.h | 118
> > +++++++++++++++++++--------------
> > > lib/librte_ethdev/rte_flow_driver.h | 26 ++++----
> > > lib/librte_ethdev/version.map | 8 +--
> >
> > Isn't there any documentation to update with this change?
>
> Do you mean the release note? I only updated the 20_01 release note part.
>
You also need to update the prog/guid/rte_flow.rst
> >
> > If the shared action API is not documented at all, can you please
> > add documentation for the action handle API?
>
> In the testpmd usage guide, I found some description and update it together
> with the testpmd update.
> I will check if there is another place to update or add.
>
> Thanks
>
> BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-12 19:42 ` Ferruh Yigit
2021-04-13 12:36 ` Andrey Vesnovaty
@ 2021-04-15 13:55 ` Andrew Rybchenko
2021-04-15 14:10 ` Thomas Monjalon
2 siblings, 1 reply; 46+ messages in thread
From: Andrew Rybchenko @ 2021-04-15 13:55 UTC (permalink / raw)
To: Bing Zhao, orika, thomas, ferruh.yigit, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
On 4/10/21 5:03 PM, Bing Zhao wrote:
> Right now, rte_flow_shared_action_* APIs are used for some shared
> actions, like RSS, count. The shared action should be created before
> using it inside a flow. These shared actions sometimes are not
> really shared but just some indirect actions decoupled from a flow.
>
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
>
> There are two types of flow actions:
> 1. the direct (normal) actions that could be created and stored
> within a flow rule. Such action is tied to its flow rule and
> cannot be reused.
> 2. the indirect action, in the past, named shared_action. It is
> created from a direct actioni, like count or rss, and then used
> in the flow rules with an object handle. The PMD will take care
> of the retrieve from indirect action to the direct action
> when it is referenced.
>
> The indirect action is accessed (update / query) w/o any flow rule,
> just via the action object handle. For example, when querying or
> resetting a counter, it could be done out of any flow using this
> counter, but only the handle of the counter action object is
> required.
> The indirect action object could be shared by different flows or
> used by a single flow, depending on the direct action type and
> the real-life requirements.
> The handle of an indirect action object is opaque and defined in
> each driver and possibly different per direct action type.
>
> The old name "shared" is improper in a sense and should be replaced.
>
> All the command lines in testpmd application with "shared_action*"
> are replaced with "indirect_action*".
>
> The parameter of "update" interface is also changed. A general
> pointer will replace the rte_flow_action struct pointer due to the
> facts:
> 1. Some action may not support fields updating. In the example of a
> counter, the only "update" supported should be the reset. So
> passing a rte_flow_action struct pointer is meaningless and
> there is even no such corresponding action struct. What's more,
> if more than one operations should be supported, for some other
> action, such pointer parameter may not meet the need.
> 2. Some action may need conditional or partial update, the current
> parameter will not provide the ability to indicate which part(s)
> to update.
> For different types of indirect action objects, the pointer could
> either be the same of rte_flow_action* struct - in order not to
> break the current driver implementation, or some wrapper
> structures with bits as masks to indicate which part to be
> updated, depending on real needs of the corresponding direct
> action. For different direct actions, the structures of indirect
> action objects updating will be different.
>
> All the underlayer PMD callbacks will be moved to these new APIs.
>
> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break the ABI. All the implementations are changed by using
> RTE_FLOW_ACTION_TYPE_INDIRECT.
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
Just for the record. I still dislike renaming since "shared" highlights
purpose (what is definitely better), but "indirect" is just a technical
detail on how it is done.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-15 13:55 ` Andrew Rybchenko
@ 2021-04-15 14:10 ` Thomas Monjalon
2021-04-15 16:02 ` Andrew Rybchenko
0 siblings, 1 reply; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-15 14:10 UTC (permalink / raw)
To: Bing Zhao, Andrew Rybchenko
Cc: orika, ferruh.yigit, matan, viacheslavo, dev, ajit.khaparde,
getelson, andreyv
15/04/2021 15:55, Andrew Rybchenko:
> On 4/10/21 5:03 PM, Bing Zhao wrote:
> > Right now, rte_flow_shared_action_* APIs are used for some shared
> > actions, like RSS, count. The shared action should be created before
> > using it inside a flow. These shared actions sometimes are not
> > really shared but just some indirect actions decoupled from a flow.
> >
> > The new functions rte_flow_action_handle_* are added to replace
> > the current shared functions rte_flow_shared_action_*.
> >
> > There are two types of flow actions:
> > 1. the direct (normal) actions that could be created and stored
> > within a flow rule. Such action is tied to its flow rule and
> > cannot be reused.
> > 2. the indirect action, in the past, named shared_action. It is
> > created from a direct actioni, like count or rss, and then used
> > in the flow rules with an object handle. The PMD will take care
> > of the retrieve from indirect action to the direct action
> > when it is referenced.
> >
> > The indirect action is accessed (update / query) w/o any flow rule,
> > just via the action object handle. For example, when querying or
> > resetting a counter, it could be done out of any flow using this
> > counter, but only the handle of the counter action object is
> > required.
> > The indirect action object could be shared by different flows or
> > used by a single flow, depending on the direct action type and
> > the real-life requirements.
> > The handle of an indirect action object is opaque and defined in
> > each driver and possibly different per direct action type.
> >
> > The old name "shared" is improper in a sense and should be replaced.
> >
> > All the command lines in testpmd application with "shared_action*"
> > are replaced with "indirect_action*".
> >
> > The parameter of "update" interface is also changed. A general
> > pointer will replace the rte_flow_action struct pointer due to the
> > facts:
> > 1. Some action may not support fields updating. In the example of a
> > counter, the only "update" supported should be the reset. So
> > passing a rte_flow_action struct pointer is meaningless and
> > there is even no such corresponding action struct. What's more,
> > if more than one operations should be supported, for some other
> > action, such pointer parameter may not meet the need.
> > 2. Some action may need conditional or partial update, the current
> > parameter will not provide the ability to indicate which part(s)
> > to update.
> > For different types of indirect action objects, the pointer could
> > either be the same of rte_flow_action* struct - in order not to
> > break the current driver implementation, or some wrapper
> > structures with bits as masks to indicate which part to be
> > updated, depending on real needs of the corresponding direct
> > action. For different direct actions, the structures of indirect
> > action objects updating will be different.
> >
> > All the underlayer PMD callbacks will be moved to these new APIs.
> >
> > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> > break the ABI. All the implementations are changed by using
> > RTE_FLOW_ACTION_TYPE_INDIRECT.
> >
> > Signed-off-by: Bing Zhao <bingz@nvidia.com>
>
> Just for the record. I still dislike renaming since "shared" highlights
> purpose (what is definitely better), but "indirect" is just a technical
> detail on how it is done.
The difference is that indirect action is not only for sharing.
It allows manipulating an action as an object.
Action object is inserted in flow rules through the indirect action.
Does it make it clearer?
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v3 0/1] Change shared action API to action handle API
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
@ 2021-04-15 15:51 ` Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
` (2 subsequent siblings)
4 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-15 15:51 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The patch set includes:
1. API changes
2. testpmd adaption and guide update
3. driver update (only net/mlx5 is impacted)
4. rte_flow documentation update
---
v2: add adaptions of testpmd and driver part
v3: squash all patches into one and update rte_flow doc
---
Bing Zhao (1):
ethdev: introduce indirect action APIs
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 27 ++-
doc/guides/rel_notes/release_21_05.rst | 3 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 94 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 118 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 588 insertions(+), 561 deletions(-)
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
@ 2021-04-15 15:51 ` Bing Zhao
2021-04-15 15:56 ` Ori Kam
2021-04-15 17:59 ` Ajit Khaparde
0 siblings, 2 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-15 15:51 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
---
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 27 ++-
doc/guides/rel_notes/release_21_05.rst | 3 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 94 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 118 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 588 insertions(+), 561 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5bf1497f2b..4d9e038ce8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0127d9e7d6..c5381c638b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -112,21 +112,21 @@ enum index {
DUMP_ALL,
DUMP_ONE,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -416,8 +416,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -778,10 +778,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -841,12 +841,12 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
@@ -856,11 +856,11 @@ static const enum index next_dump_subcmd[] = {
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -900,8 +900,8 @@ static const enum index next_aged_attr[] = {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1380,7 +1380,7 @@ static const enum index next_action[] = {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1797,13 +1797,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1950,10 +1950,10 @@ static const struct token token_list[] = {
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1963,7 +1963,7 @@ static const struct token token_list[] = {
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1977,42 +1977,42 @@ static const struct token token_list[] = {
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4498,61 +4498,61 @@ static const struct token token_list[] = {
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4739,9 +4739,9 @@ parse_init(struct context *ctx, const struct token *token,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4754,7 +4754,7 @@ parse_sa(struct context *ctx, const struct token *token,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4766,26 +4766,26 @@ parse_sa(struct context *ctx, const struct token *token,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4794,9 +4794,9 @@ parse_sa(struct context *ctx, const struct token *token,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4809,8 +4809,8 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4818,13 +4818,13 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7102,7 +7102,7 @@ parse_port(struct context *ctx, const struct token *token,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7119,9 +7119,9 @@ parse_sa_id2ptr(struct context *ctx, const struct token *token,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7659,27 +7659,27 @@ static void
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 40b2b29725..c219ef25f7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1392,38 +1392,38 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1434,7 +1434,7 @@ action_alloc(portid_t port_id, uint32_t id,
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1443,70 +1443,70 @@ action_alloc(portid_t port_id, uint32_t id,
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1520,9 +1520,9 @@ port_shared_action_destroy(portid_t port_id,
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1530,14 +1530,14 @@ port_shared_action_destroy(portid_t port_id,
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1548,60 +1548,60 @@ port_shared_action_destroy(portid_t port_id,
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1623,8 +1623,8 @@ port_shared_action_query(portid_t port_id, uint32_t id)
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2066,7 +2066,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2116,11 +2116,11 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 36d8535d0c..c314b30f2e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index e1b93ecedf..2ecc48cfff 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1719,7 +1719,7 @@ that counter.
For ports within the same switch domain then the counter id namespace extends
to all ports within that switch domain.
-The shared flag is DEPRECATED and ``SHARED`` ``COUNT`` action should be used
+The shared flag is DEPRECATED and ``INDIRECT`` ``COUNT`` action should be used
to make shared counters.
.. _table_rte_flow_action_count:
@@ -2742,25 +2742,26 @@ packets, and must have a fate action.
| ``actions`` | sub-action list for sampling |
+--------------+---------------------------------+
-Action: ``SHARED``
+Action: ``INDIRECT``
^^^^^^^^^^^^^^^^^^
-Flow utilize shared action by handle as returned from
-``rte_flow_shared_action_create()``.
+Flow utilize indirect action by handle as returned from
+``rte_flow_action_handle_create()``.
-The behaviour of the shared action defined by ``action`` argument of type
-``struct rte_flow_action`` passed to ``rte_flow_shared_action_create()``.
+The behaviour of the indirect action defined by ``action`` argument of type
+``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
-Multiple flows can use the same shared action.
-The shared action can be in-place updated by ``rte_flow_shared_action_update()``
-without destroying flow and creating flow again.
+The indirect action can be used by a single flow or shared among multiple flows.
+The indirect action can be in-place updated by ``rte_flow_action_handle_update()``
+without destroying flow and creating flow again. The fields that could be
+updated depend on the type of the ``action`` and different for every type.
-The shared action specified data (e.g. counter) can be queried by
-``rte_flow_shared_action_query()``.
+The indirect action specified data (e.g. counter) can be queried by
+``rte_flow_action_handle_query()``.
-.. _table_rte_flow_shared_action:
+.. _table_rte_flow_action_handle:
-.. table:: SHARED
+.. table:: INDIRECT
+---------------+
| Field |
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 82ee71152f..e6f99350af 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -234,6 +234,9 @@ API Changes
* pci: The value ``PCI_ANY_ID`` is marked as deprecated
and can be replaced with ``RTE_PCI_ANY_ID``.
+* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
+ replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
+ ``rte_flow_action_handle_*``.
ABI Changes
-----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e3bfed566d..1fa6e2000e 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4057,10 +4057,10 @@ This section lists supported actions and their attributes, if any.
- ``dscp_value {unsigned}``: The new DSCP value to be set
-- ``shared``: Use shared action created via
- ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+ ``flow indirect_action {port_id} create``
- - ``shared_action_id {unsigned}``: Shared action ID to use
+ - ``indirect_action_id {unsigned}``: Indirect action ID to use
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
@@ -4351,113 +4351,113 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
testpmd> flow aged 0
Port 0 total aged flows: 0
-Creating shared actions
+Creating indirect actions
~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
- flow shared_action {port_id} create [action_id {shared_action_id}]
+ flow indirect_action {port_id} create [action_id {indirect_action_id}]
[ingress] [egress] [transfer] action {action} / end
If successful, it will show::
- Shared action #[...] created
+ Indirect action #[...] created
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
some error occurred::
- Shared action #[...] is already assigned, delete it first
+ Indirect action #[...] is already assigned, delete it first
::
Caught error type [...] ([...]): [...]
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
- testpmd> flow shared_action 0 create action_id 100 \
+ testpmd> flow indirect_action 0 create action_id 100 \
ingress action rss queues 1 2 end / end
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
port 0::
- testpmd> flow shared_action 0 create action_id \
+ testpmd> flow indirect_action 0 create action_id \
ingress action rss queues 0 1 end / end
-Updating shared actions
+Updating indirect actions
~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
- flow shared_action {port_id} update {shared_action_id}
+ flow indirect_action {port_id} update {indirect_action_id}
action {action} / end
If successful, it will show::
- Shared action #[...] updated
+ Indirect action #[...] updated
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
(in create example above rss queues were 1 and 2)::
- testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+ testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
-Destroying shared actions
+Destroying indirect actions
~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
- flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+ flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
If successful, it will show::
- Shared action #[...] destroyed
+ Indirect action #[...] destroyed
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
Caught error type [...] ([...]): [...]
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
- testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+ testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
-Query shared actions
+Query indirect actions
~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ Indirect RSS action:
refs:[...]
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Query shared action having id 100::
+Query indirect action having id 100::
- testpmd> flow shared_action 0 query 100
+ testpmd> flow indirect_action 0 query 100
Sample QinQ flow rules
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 02cc2c781e..3bf224c559 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1341,7 +1341,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
* then this will return directly without any action.
*/
mlx5_flow_list_flush(dev, &priv->flows, true);
- mlx5_shared_action_flush(dev);
+ mlx5_action_handle_flush(dev);
mlx5_flow_meter_flush(dev, NULL);
/* Prevent crashes when queues are still in use. */
dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807dcd9..6e9c4b9cdd 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
/*
* Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 84463074a5..68e1ffda9c 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -568,23 +568,23 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
},
};
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
static int
@@ -623,10 +623,10 @@ static const struct rte_flow_ops mlx5_flow_ops = {
.query = mlx5_flow_query,
.dev_dump = mlx5_flow_dev_dump,
.get_aged_flows = mlx5_flow_get_aged_flows,
- .shared_action_create = mlx5_shared_action_create,
- .shared_action_destroy = mlx5_shared_action_destroy,
- .shared_action_update = mlx5_shared_action_update,
- .shared_action_query = mlx5_shared_action_query,
+ .action_handle_create = mlx5_action_handle_create,
+ .action_handle_destroy = mlx5_action_handle_destroy,
+ .action_handle_update = mlx5_action_handle_update,
+ .action_handle_query = mlx5_action_handle_query,
.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
.tunnel_match = mlx5_flow_tunnel_match,
.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3402,31 +3402,31 @@ flow_aso_age_get_by_idx(struct rte_eth_dev *dev, uint32_t age_idx)
return &pool->actions[offset - 1];
}
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
- struct rte_flow_shared_action *action; /**< Shared action */
- int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+ struct rte_flow_action_handle *action; /**< Indirect action handle. */
+ int index; /**< Index in related array of rte_flow_action. */
};
/**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
* from this call.
*
* @param[in] dev
* Pointer to Ethernet device.
* @param[in] actions
* List of actions to translate.
- * @param[out] shared
- * List to store translated shared actions.
- * @param[in, out] shared_n
- * Size of *shared* array. On return should be updated with number of shared
- * actions retrieved from the *actions* list.
+ * @param[out] handle
+ * List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ * Size of *handle* array. On return should be updated with number of
+ * indirect actions retrieved from the *actions* list.
* @param[out] translated_actions
- * List of actions where all shared actions were translated to non shared
+ * List of actions where all indirect actions were translated to direct
* if possible. NULL if no translation took place.
* @param[out] error
* Pointer to the error structure.
@@ -3435,10 +3435,10 @@ struct mlx5_translated_shared_action {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
- struct mlx5_translated_shared_action *shared,
- int *shared_n,
+ struct mlx5_translated_action_handle *handle,
+ int *indir_n,
struct rte_flow_action **translated_actions,
struct rte_flow_error *error)
{
@@ -3447,23 +3447,23 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
size_t actions_size;
int n;
int copied_n = 0;
- struct mlx5_translated_shared_action *shared_end = NULL;
+ struct mlx5_translated_action_handle *handle_end = NULL;
for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
- if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+ if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
continue;
- if (copied_n == *shared_n) {
+ if (copied_n == *indir_n) {
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
NULL, "too many shared actions");
}
- rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+ rte_memcpy(&handle[copied_n].action, &actions[n].conf,
sizeof(actions[n].conf));
- shared[copied_n].index = n;
+ handle[copied_n].index = n;
copied_n++;
}
n++;
- *shared_n = copied_n;
+ *indir_n = copied_n;
if (!copied_n)
return 0;
actions_size = sizeof(struct rte_flow_action) * n;
@@ -3473,28 +3473,28 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
return -ENOMEM;
}
memcpy(translated, actions, actions_size);
- for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+ for (handle_end = handle + copied_n; handle < handle_end; handle++) {
struct mlx5_shared_action_rss *shared_rss;
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
- - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx &
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
- translated[shared->index].type =
+ translated[handle->index].type =
RTE_FLOW_ACTION_TYPE_RSS;
- translated[shared->index].conf =
+ translated[handle->index].conf =
&shared_rss->origin;
break;
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
if (priv->sh->flow_hit_aso_en) {
- translated[shared->index].type =
+ translated[handle->index].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_AGE;
- translated[shared->index].conf =
+ translated[handle->index].conf =
(void *)(uintptr_t)idx;
break;
}
@@ -3503,7 +3503,7 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
mlx5_free(translated);
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "invalid shared action type");
+ NULL, "invalid indirect action type");
}
}
*translated_actions = translated;
@@ -3525,21 +3525,21 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
*/
static uint32_t
flow_get_shared_rss_action(struct rte_eth_dev *dev,
- struct mlx5_translated_shared_action *shared,
+ struct mlx5_translated_action_handle *handle,
int shared_n)
{
- struct mlx5_translated_shared_action *shared_end;
+ struct mlx5_translated_action_handle *handle_end;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_shared_action_rss *shared_rss;
- for (shared_end = shared + shared_n; shared < shared_end; shared++) {
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+ for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
uint32_t idx = act_idx &
- ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
idx);
@@ -5549,9 +5549,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
struct rte_flow *flow = NULL;
struct mlx5_flow *dev_flow;
const struct rte_flow_action_rss *rss = NULL;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
union {
struct mlx5_flow_expand_rss buf;
uint8_t buffer[2048];
@@ -5591,9 +5591,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
MLX5_ASSERT(wks);
rss_desc = &wks->rss_desc;
- ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret < 0) {
MLX5_ASSERT(translated_actions == NULL);
@@ -5654,8 +5654,8 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
buf->entries = 1;
buf->entry[0].pattern = (void *)(uintptr_t)items;
}
- rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
- shared_actions_n);
+ rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+ indir_actions_n);
for (i = 0; i < buf->entries; ++i) {
/* Initialize flow split data. */
flow_split_info.prefix_layers = 0;
@@ -5834,14 +5834,14 @@ mlx5_flow_validate(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
int hairpin_flow;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
const struct rte_flow_action *actions;
struct rte_flow_action *translated_actions = NULL;
- int ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ int ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret)
@@ -7214,12 +7214,12 @@ mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
/* Wrapper for driver action_validate op callback */
static int
flow_drv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action validation unsupported";
+ static const char err_msg[] = "indirect action validation unsupported";
if (!fops->action_validate) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7235,8 +7235,8 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7247,11 +7247,11 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
* @note: wrapper for driver action_create op callback.
*/
static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action destruction unsupported";
+ static const char err_msg[] = "indirect action destruction unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7262,18 +7262,18 @@ mlx5_shared_action_destroy(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_destroy(dev, action, error);
+ return fops->action_destroy(dev, handle, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action update unsupported";
+ static const char err_msg[] = "indirect action update unsupported";
if (!fops->action_update) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7281,18 +7281,18 @@ flow_drv_action_update(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_update(dev, action, action_conf, error);
+ return fops->action_update(dev, handle, update, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action query unsupported";
+ static const char err_msg[] = "indirect action query unsupported";
if (!fops->action_query) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7300,29 +7300,31 @@ flow_drv_action_query(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_query(dev, action, data, error);
+ return fops->action_query(dev, handle, data, error);
}
/**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param conf
+ * Pointer to indirect action object configuration.
* @param[in] action
- * Action configuration for shared action creation.
+ * Action configuration for indirect action object creation.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
* @return
* A valid handle in case of success, NULL otherwise and rte_errno is set.
*/
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action creation unsupported";
+ static const char err_msg[] = "indirect action creation unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7339,19 +7341,20 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
}
/**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] shared_action
- * Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ * Handle for the indirect action to be updated.
+ * @param[in] update
* Action specification used to modify the action pointed by handle.
- * *action* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7360,9 +7363,9 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
struct rte_flow_attr attr = { .transfer = 0 };
@@ -7370,26 +7373,27 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
- ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+ ret = flow_drv_action_validate(dev, NULL,
+ (const struct rte_flow_action *)update, fops, error);
if (ret)
return ret;
- return flow_drv_action_update(dev, shared_action, action->conf, fops,
+ return flow_drv_action_update(dev, handle, update, fops,
error);
}
/**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
*
* This function allows retrieving action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the indirect action to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -7400,8 +7404,8 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -7409,11 +7413,11 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
- return flow_drv_action_query(dev, action, data, fops, error);
+ return flow_drv_action_query(dev, handle, data, fops, error);
}
/**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
*
* @param dev
* Pointer to Ethernet device.
@@ -7422,7 +7426,7 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
{
struct rte_flow_error error;
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7432,8 +7436,8 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev)
ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
priv->rss_shared_actions, idx, shared_rss, next) {
- ret |= mlx5_shared_action_destroy(dev,
- (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+ ret |= mlx5_action_handle_destroy(dev,
+ (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
}
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ec673c29ab..56674eb0d2 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -39,11 +39,11 @@ enum mlx5_rte_flow_action_type {
MLX5_RTE_FLOW_ACTION_TYPE_AGE,
};
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
enum {
- MLX5_SHARED_ACTION_TYPE_RSS,
- MLX5_SHARED_ACTION_TYPE_AGE,
+ MLX5_INDIRECT_ACTION_TYPE_RSS,
+ MLX5_INDIRECT_ACTION_TYPE_AGE,
};
/* Matches on selected register. */
@@ -1152,7 +1152,7 @@ struct mlx5_shared_action_rss {
rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
};
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
uint32_t id;
};
@@ -1233,26 +1233,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_validate_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_destroy_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_update_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *action,
+ const void *update,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_query_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *action,
void *data,
struct rte_flow_error *error);
typedef int (*mlx5_flow_sync_domain_t)
@@ -1483,7 +1483,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
struct rte_mtr_error *error);
int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index e65cc13bd6..d02e97b3f4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12870,7 +12870,7 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev,
*/
static uint32_t
__flow_dv_action_rss_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
@@ -12893,7 +12893,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev,
"cannot allocate resource memory");
goto error_rss_init;
}
- if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+ if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
rte_flow_error_set(error, E2BIG,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"rss action number out of range");
@@ -13006,7 +13006,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
}
/**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
* (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
@@ -13015,7 +13015,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * Action specification used to create shared action.
+ * Action specification used to create indirect action.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13024,9 +13024,9 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* A valid shared action handle in case of success, NULL otherwise and
* rte_errno is set.
*/
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
flow_dv_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
@@ -13036,13 +13036,13 @@ flow_dv_action_create(struct rte_eth_dev *dev,
switch (action->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
if (ret) {
struct mlx5_aso_age_action *aso_age =
flow_aso_age_get_by_idx(dev, ret);
@@ -13057,19 +13057,19 @@ flow_dv_action_create(struct rte_eth_dev *dev,
NULL, "action type not supported");
break;
}
- return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+ return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
}
/**
- * Destroy the shared action.
+ * Destroy the indirect action.
* Release action related resources on the NIC and the memory.
* Lock free, (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be removed.
+ * @param[in] handle
+ * The indirect action object handle to be removed.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13079,25 +13079,25 @@ flow_dv_action_create(struct rte_eth_dev *dev,
*/
static int
flow_dv_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
int ret;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
return __flow_dv_action_rss_release(dev, idx, error);
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
ret = flow_dv_aso_age_release(dev, idx);
if (ret)
/*
* In this case, the last flow has a reference will
* actually release the age action.
*/
- DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+ DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
" released with references %d.", idx, ret);
return 0;
default:
@@ -13180,12 +13180,13 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be updated.
- * @param[in] action_conf
- * Action specification used to modify *action*.
- * *action_conf* should be of type correlating with type of the *action*,
- * otherwise considered as invalid.
+ * @param[in] handle
+ * The indirect action object handle to be updated.
+ * @param[in] update
+ * Action specification used to modify the action pointed by *handle*.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13195,16 +13196,18 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*/
static int
flow_dv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *err)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ const void *action_conf;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
+ action_conf = ((const struct rte_flow_action *)update)->conf;
return __flow_dv_action_rss_update(dev, idx, action_conf, err);
default:
return rte_flow_error_set(err, ENOTSUP,
@@ -13216,17 +13219,17 @@ flow_dv_action_update(struct rte_eth_dev *dev,
static int
flow_dv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action, void *data,
+ const struct rte_flow_action_handle *handle, void *data,
struct rte_flow_error *error)
{
struct mlx5_age_param *age_param;
struct rte_flow_query_age *resp;
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
resp = data;
resp->aged = __atomic_load_n(&age_param->state,
@@ -14002,7 +14005,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
}
/**
- * Validate shared action.
+ * Validate indirect action.
* Dispatcher for action type specific validation.
*
* @param[in] dev
@@ -14010,7 +14013,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * The shared action object to validate.
+ * The indirect action object to validate.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -14020,7 +14023,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
*/
static int
flow_dv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 7241f00353..0d2610b7c4 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -180,12 +180,12 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(MODIFY_FIELD,
sizeof(struct rte_flow_action_modify_field)),
/**
- * Shared action represented as handle of type
- * (struct rte_flow_shared action *) stored in conf field (see
+ * Indirect action represented as handle of type
+ * (struct rte_flow_action_handle *) stored in conf field (see
* struct rte_flow_action); no need for additional structure to * store
- * shared action handle.
+ * indirect action handle.
*/
- MK_FLOW_ACTION(SHARED, 0),
+ MK_FLOW_ACTION(INDIRECT, 0),
};
int
@@ -1068,53 +1068,53 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1122,18 +1122,18 @@ rte_flow_shared_action_update(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1142,11 +1142,11 @@ rte_flow_shared_action_query(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 203c4cde9a..324d00abdc 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
* Enables counters for this flow rule.
*
* These counters can be retrieved and reset through rte_flow_query() or
- * rte_flow_shared_action_query() if the action provided via handle,
+ * rte_flow_action_handle_query() if the action provided via handle,
* see struct rte_flow_query_count.
*
* See struct rte_flow_action_count.
@@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * Describe indirect action that could be used by a single flow rule
+ * or multiple flow rules.
+ *
+ * Allow flow rule(s) reference the same action by the indirect action
+ * handle (see struct rte_flow_action_handle), rules could be on the
+ * same port or across different ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2357,7 +2367,7 @@ struct rte_flow_query_age {
* ``struct rte_flow_query_count``.
*
* @deprecated Shared attribute is deprecated, use generic
- * RTE_FLOW_ACTION_TYPE_SHARED action.
+ * RTE_FLOW_ACTION_TYPE_INDIRECT action.
*
* The shared flag indicates whether the counter is unique to the flow rule the
* action is specified with, or whether it is a shared counter.
@@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle will be different per driver or
+ * per immediate action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related immediate action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3631,25 +3647,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3658,16 +3671,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used by flow create, and
+ * could also be shared by different flows.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3681,9 +3695,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3691,12 +3705,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3711,27 +3725,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3742,32 +3759,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the direct action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3779,10 +3796,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index 6ae1f8c264..46f62c2ec2 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -84,27 +84,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388e96..4eb561a89a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-15 15:56 ` Ori Kam
2021-04-15 17:59 ` Ajit Khaparde
1 sibling, 0 replies; 46+ messages in thread
From: Ori Kam @ 2021-04-15 15:56 UTC (permalink / raw)
To: Bing Zhao, NBU-Contact-Thomas Monjalon, ferruh.yigit,
andrew.rybchenko, Matan Azrad, Slava Ovsiienko
Cc: dev, ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
Hi Bing
> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Thursday, April 15, 2021 6:52 PM
> Subject: [PATCH v3 1/1] ethdev: introduce indirect action APIs
>
> Right now, rte_flow_shared_action_* APIs are used for some shared
> actions, like RSS, count. The shared action should be created before
> using it inside a flow. These shared actions sometimes are not
> really shared but just some indirect actions decoupled from a flow.
>
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
>
> There are two types of flow actions:
> 1. the direct (normal) actions that could be created and stored
> within a flow rule. Such action is tied to its flow rule and
> cannot be reused.
> 2. the indirect action, in the past, named shared_action. It is
> created from a direct actioni, like count or rss, and then used
> in the flow rules with an object handle. The PMD will take care
> of the retrieve from indirect action to the direct action
> when it is referenced.
>
> The indirect action is accessed (update / query) w/o any flow rule,
> just via the action object handle. For example, when querying or
> resetting a counter, it could be done out of any flow using this
> counter, but only the handle of the counter action object is
> required.
> The indirect action object could be shared by different flows or
> used by a single flow, depending on the direct action type and
> the real-life requirements.
> The handle of an indirect action object is opaque and defined in
> each driver and possibly different per direct action type.
>
> The old name "shared" is improper in a sense and should be replaced.
>
> Since the APIs are changed from "rte_flow_shared_action*" to the new
> "rte_flow_action_handle*", the testpmd application code and command
> line interfaces also need to be updated to do the adaption.
> The testpmd application user guide is also updated. All the "shared
> action" related parts are replaced with "indirect action" to have a
> correct explanation.
>
> The parameter of "update" interface is also changed. A general
> pointer will replace the rte_flow_action struct pointer due to the
> facts:
> 1. Some action may not support fields updating. In the example of a
> counter, the only "update" supported should be the reset. So
> passing a rte_flow_action struct pointer is meaningless and
> there is even no such corresponding action struct. What's more,
> if more than one operations should be supported, for some other
> action, such pointer parameter may not meet the need.
> 2. Some action may need conditional or partial update, the current
> parameter will not provide the ability to indicate which part(s)
> to update.
> For different types of indirect action objects, the pointer could
> either be the same of rte_flow_action* struct - in order not to
> break the current driver implementation, or some wrapper
> structures with bits as masks to indicate which part to be
> updated, depending on real needs of the corresponding direct
> action. For different direct actions, the structures of indirect
> action objects updating will be different.
>
> All the underlayer PMD callbacks will be moved to these new APIs.
>
> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break the ABI. All the implementations are changed by using
> RTE_FLOW_ACTION_TYPE_INDIRECT.
>
> Since the APIs are changed from "rte_flow_shared_action*" to the new
> "rte_flow_action_handle*" and the "update" interface's 3rd input
> parameter is changed to generic pointer, the mlx5 PMD that uses these
> APIs needs to do the adaption to the new APIs as well.
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
> ---
Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
2021-04-15 14:10 ` Thomas Monjalon
@ 2021-04-15 16:02 ` Andrew Rybchenko
0 siblings, 0 replies; 46+ messages in thread
From: Andrew Rybchenko @ 2021-04-15 16:02 UTC (permalink / raw)
To: Thomas Monjalon, Bing Zhao
Cc: orika, ferruh.yigit, matan, viacheslavo, dev, ajit.khaparde,
getelson, andreyv
On 4/15/21 5:10 PM, Thomas Monjalon wrote:
> 15/04/2021 15:55, Andrew Rybchenko:
>> On 4/10/21 5:03 PM, Bing Zhao wrote:
>>> Right now, rte_flow_shared_action_* APIs are used for some shared
>>> actions, like RSS, count. The shared action should be created before
>>> using it inside a flow. These shared actions sometimes are not
>>> really shared but just some indirect actions decoupled from a flow.
>>>
>>> The new functions rte_flow_action_handle_* are added to replace
>>> the current shared functions rte_flow_shared_action_*.
>>>
>>> There are two types of flow actions:
>>> 1. the direct (normal) actions that could be created and stored
>>> within a flow rule. Such action is tied to its flow rule and
>>> cannot be reused.
>>> 2. the indirect action, in the past, named shared_action. It is
>>> created from a direct actioni, like count or rss, and then used
>>> in the flow rules with an object handle. The PMD will take care
>>> of the retrieve from indirect action to the direct action
>>> when it is referenced.
>>>
>>> The indirect action is accessed (update / query) w/o any flow rule,
>>> just via the action object handle. For example, when querying or
>>> resetting a counter, it could be done out of any flow using this
>>> counter, but only the handle of the counter action object is
>>> required.
>>> The indirect action object could be shared by different flows or
>>> used by a single flow, depending on the direct action type and
>>> the real-life requirements.
>>> The handle of an indirect action object is opaque and defined in
>>> each driver and possibly different per direct action type.
>>>
>>> The old name "shared" is improper in a sense and should be replaced.
>>>
>>> All the command lines in testpmd application with "shared_action*"
>>> are replaced with "indirect_action*".
>>>
>>> The parameter of "update" interface is also changed. A general
>>> pointer will replace the rte_flow_action struct pointer due to the
>>> facts:
>>> 1. Some action may not support fields updating. In the example of a
>>> counter, the only "update" supported should be the reset. So
>>> passing a rte_flow_action struct pointer is meaningless and
>>> there is even no such corresponding action struct. What's more,
>>> if more than one operations should be supported, for some other
>>> action, such pointer parameter may not meet the need.
>>> 2. Some action may need conditional or partial update, the current
>>> parameter will not provide the ability to indicate which part(s)
>>> to update.
>>> For different types of indirect action objects, the pointer could
>>> either be the same of rte_flow_action* struct - in order not to
>>> break the current driver implementation, or some wrapper
>>> structures with bits as masks to indicate which part to be
>>> updated, depending on real needs of the corresponding direct
>>> action. For different direct actions, the structures of indirect
>>> action objects updating will be different.
>>>
>>> All the underlayer PMD callbacks will be moved to these new APIs.
>>>
>>> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
>>> break the ABI. All the implementations are changed by using
>>> RTE_FLOW_ACTION_TYPE_INDIRECT.
>>>
>>> Signed-off-by: Bing Zhao <bingz@nvidia.com>
>>
>> Just for the record. I still dislike renaming since "shared" highlights
>> purpose (what is definitely better), but "indirect" is just a technical
>> detail on how it is done.
>
> The difference is that indirect action is not only for sharing.
> It allows manipulating an action as an object.
> Action object is inserted in flow rules through the indirect action.
> Does it make it clearer?
>
Yes, I see thanks.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-15 15:56 ` Ori Kam
@ 2021-04-15 17:59 ` Ajit Khaparde
2021-04-16 6:58 ` Bing Zhao
2021-04-16 7:03 ` Thomas Monjalon
1 sibling, 2 replies; 46+ messages in thread
From: Ajit Khaparde @ 2021-04-15 17:59 UTC (permalink / raw)
To: Bing Zhao
Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
Matan Azrad, Slava Ovsiienko, dpdk-dev, Gregory Etelson,
Andrey Vesnovaty
[-- Attachment #1: Type: text/plain, Size: 3892 bytes --]
On Thu, Apr 15, 2021 at 8:52 AM Bing Zhao <bingz@nvidia.com> wrote:
>
> Right now, rte_flow_shared_action_* APIs are used for some shared
> actions, like RSS, count. The shared action should be created before
> using it inside a flow. These shared actions sometimes are not
> really shared but just some indirect actions decoupled from a flow.
>
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
>
> There are two types of flow actions:
> 1. the direct (normal) actions that could be created and stored
> within a flow rule. Such action is tied to its flow rule and
> cannot be reused.
> 2. the indirect action, in the past, named shared_action. It is
> created from a direct actioni, like count or rss, and then used
> in the flow rules with an object handle. The PMD will take care
> of the retrieve from indirect action to the direct action
> when it is referenced.
>
> The indirect action is accessed (update / query) w/o any flow rule,
> just via the action object handle. For example, when querying or
> resetting a counter, it could be done out of any flow using this
> counter, but only the handle of the counter action object is
> required.
> The indirect action object could be shared by different flows or
> used by a single flow, depending on the direct action type and
> the real-life requirements.
> The handle of an indirect action object is opaque and defined in
> each driver and possibly different per direct action type.
>
> The old name "shared" is improper in a sense and should be replaced.
>
> Since the APIs are changed from "rte_flow_shared_action*" to the new
> "rte_flow_action_handle*", the testpmd application code and command
> line interfaces also need to be updated to do the adaption.
> The testpmd application user guide is also updated. All the "shared
> action" related parts are replaced with "indirect action" to have a
> correct explanation.
>
> The parameter of "update" interface is also changed. A general
> pointer will replace the rte_flow_action struct pointer due to the
> facts:
> 1. Some action may not support fields updating. In the example of a
> counter, the only "update" supported should be the reset. So
> passing a rte_flow_action struct pointer is meaningless and
> there is even no such corresponding action struct. What's more,
> if more than one operations should be supported, for some other
> action, such pointer parameter may not meet the need.
> 2. Some action may need conditional or partial update, the current
> parameter will not provide the ability to indicate which part(s)
> to update.
> For different types of indirect action objects, the pointer could
> either be the same of rte_flow_action* struct - in order not to
> break the current driver implementation, or some wrapper
> structures with bits as masks to indicate which part to be
> updated, depending on real needs of the corresponding direct
> action. For different direct actions, the structures of indirect
> action objects updating will be different.
>
> All the underlayer PMD callbacks will be moved to these new APIs.
>
> The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> break the ABI. All the implementations are changed by using
> RTE_FLOW_ACTION_TYPE_INDIRECT.
When I read this somehow indirect did not feel right.
But I don't have a strong suggestion either.
Since it is a context of action or actions maybe we use action_context?
>
> Since the APIs are changed from "rte_flow_shared_action*" to the new
> "rte_flow_action_handle*" and the "update" interface's 3rd input
> parameter is changed to generic pointer, the mlx5 PMD that uses these
> APIs needs to do the adaption to the new APIs as well.
>
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-15 17:59 ` Ajit Khaparde
@ 2021-04-16 6:58 ` Bing Zhao
2021-04-16 7:03 ` Thomas Monjalon
1 sibling, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-16 6:58 UTC (permalink / raw)
To: Ajit Khaparde
Cc: Ori Kam, NBU-Contact-Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko, Matan Azrad, Slava Ovsiienko, dpdk-dev,
Gregory Etelson, Andrey Vesnovaty
Hi Ajit,
> -----Original Message-----
> From: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Sent: Friday, April 16, 2021 2:00 AM
> To: Bing Zhao <bingz@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; dpdk-
> dev <dev@dpdk.org>; Gregory Etelson <getelson@nvidia.com>; Andrey
> Vesnovaty <andreyv@nvidia.com>
> Subject: Re: [PATCH v3 1/1] ethdev: introduce indirect action APIs
>
> On Thu, Apr 15, 2021 at 8:52 AM Bing Zhao <bingz@nvidia.com> wrote:
> >
> > Right now, rte_flow_shared_action_* APIs are used for some shared
> > actions, like RSS, count. The shared action should be created
> before
> > using it inside a flow. These shared actions sometimes are not
> > really shared but just some indirect actions decoupled from a flow.
> >
> > The new functions rte_flow_action_handle_* are added to replace
> > the current shared functions rte_flow_shared_action_*.
> >
> > There are two types of flow actions:
> > 1. the direct (normal) actions that could be created and stored
> > within a flow rule. Such action is tied to its flow rule and
> > cannot be reused.
> > 2. the indirect action, in the past, named shared_action. It is
> > created from a direct actioni, like count or rss, and then used
> > in the flow rules with an object handle. The PMD will take care
> > of the retrieve from indirect action to the direct action
> > when it is referenced.
> >
> > The indirect action is accessed (update / query) w/o any flow rule,
> > just via the action object handle. For example, when querying or
> > resetting a counter, it could be done out of any flow using this
> > counter, but only the handle of the counter action object is
> > required.
> > The indirect action object could be shared by different flows or
> > used by a single flow, depending on the direct action type and
> > the real-life requirements.
> > The handle of an indirect action object is opaque and defined in
> > each driver and possibly different per direct action type.
> >
> > The old name "shared" is improper in a sense and should be
> replaced.
> >
> > Since the APIs are changed from "rte_flow_shared_action*" to the
> new
> > "rte_flow_action_handle*", the testpmd application code and
> command
> > line interfaces also need to be updated to do the adaption.
> > The testpmd application user guide is also updated. All the
> "shared
> > action" related parts are replaced with "indirect action" to have
> a
> > correct explanation.
> >
> > The parameter of "update" interface is also changed. A general
> > pointer will replace the rte_flow_action struct pointer due to the
> > facts:
> > 1. Some action may not support fields updating. In the example of
> a
> > counter, the only "update" supported should be the reset. So
> > passing a rte_flow_action struct pointer is meaningless and
> > there is even no such corresponding action struct. What's more,
> > if more than one operations should be supported, for some other
> > action, such pointer parameter may not meet the need.
> > 2. Some action may need conditional or partial update, the current
> > parameter will not provide the ability to indicate which part(s)
> > to update.
> > For different types of indirect action objects, the pointer
> could
> > either be the same of rte_flow_action* struct - in order not to
> > break the current driver implementation, or some wrapper
> > structures with bits as masks to indicate which part to be
> > updated, depending on real needs of the corresponding direct
> > action. For different direct actions, the structures of
> indirect
> > action objects updating will be different.
> >
> > All the underlayer PMD callbacks will be moved to these new APIs.
> >
> > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> > break the ABI. All the implementations are changed by using
> > RTE_FLOW_ACTION_TYPE_INDIRECT.
> When I read this somehow indirect did not feel right.
> But I don't have a strong suggestion either.
> Since it is a context of action or actions maybe we use
> action_context?
>
The original RFC use the naming proposal "action_context", then there were some comments that it was not as good as "shared action".
The "indirect action" may describe the behavior of the action better than "shared" to my understanding.
In the email from Thomas, the comments may explain it better than mine:
" The difference is that indirect action is not only for sharing.
It allows manipulating an action as an object.
Action object is inserted in flow rules through the indirect action.
Does it make it clearer?"
What do you think?
> >
> > Since the APIs are changed from "rte_flow_shared_action*" to the
> new
> > "rte_flow_action_handle*" and the "update" interface's 3rd input
> > parameter is changed to generic pointer, the mlx5 PMD that uses
> these
> > APIs needs to do the adaption to the new APIs as well.
> >
> > Signed-off-by: Bing Zhao <bingz@nvidia.com>
> > Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-15 17:59 ` Ajit Khaparde
2021-04-16 6:58 ` Bing Zhao
@ 2021-04-16 7:03 ` Thomas Monjalon
2021-04-16 15:00 ` Ajit Khaparde
1 sibling, 1 reply; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-16 7:03 UTC (permalink / raw)
To: Ajit Khaparde
Cc: Bing Zhao, dev, Ori Kam, Ferruh Yigit, Andrew Rybchenko,
Matan Azrad, Slava Ovsiienko, dpdk-dev, Gregory Etelson,
Andrey Vesnovaty
15/04/2021 19:59, Ajit Khaparde:
> On Thu, Apr 15, 2021 at 8:52 AM Bing Zhao <bingz@nvidia.com> wrote:
> > There are two types of flow actions:
> > 1. the direct (normal) actions that could be created and stored
> > within a flow rule. Such action is tied to its flow rule and
> > cannot be reused.
> > 2. the indirect action, in the past, named shared_action. It is
> > created from a direct actioni, like count or rss, and then used
> > in the flow rules with an object handle. The PMD will take care
> > of the retrieve from indirect action to the direct action
> > when it is referenced.
[...]
> > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> > break the ABI. All the implementations are changed by using
> > RTE_FLOW_ACTION_TYPE_INDIRECT.
>
> When I read this somehow indirect did not feel right.
> But I don't have a strong suggestion either.
> Since it is a context of action or actions maybe we use action_context?
This is an action which is not directly described in the flow rule,
but in another object referenced by its handle.
It creates a level of indirection in the rule description.
I think the word "indirect" is accurate.
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
2021-04-16 7:03 ` Thomas Monjalon
@ 2021-04-16 15:00 ` Ajit Khaparde
0 siblings, 0 replies; 46+ messages in thread
From: Ajit Khaparde @ 2021-04-16 15:00 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Bing Zhao, Ori Kam, Ferruh Yigit, Andrew Rybchenko, Matan Azrad,
Slava Ovsiienko, dpdk-dev, Gregory Etelson, Andrey Vesnovaty
[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]
On Fri, Apr 16, 2021 at 12:03 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 15/04/2021 19:59, Ajit Khaparde:
> > On Thu, Apr 15, 2021 at 8:52 AM Bing Zhao <bingz@nvidia.com> wrote:
> > > There are two types of flow actions:
> > > 1. the direct (normal) actions that could be created and stored
> > > within a flow rule. Such action is tied to its flow rule and
> > > cannot be reused.
> > > 2. the indirect action, in the past, named shared_action. It is
> > > created from a direct actioni, like count or rss, and then used
> > > in the flow rules with an object handle. The PMD will take care
> > > of the retrieve from indirect action to the direct action
> > > when it is referenced.
> [...]
> > > The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
> > > break the ABI. All the implementations are changed by using
> > > RTE_FLOW_ACTION_TYPE_INDIRECT.
> >
> > When I read this somehow indirect did not feel right.
> > But I don't have a strong suggestion either.
> > Since it is a context of action or actions maybe we use action_context?
>
> This is an action which is not directly described in the flow rule,
> but in another object referenced by its handle.
> It creates a level of indirection in the rule description.
> I think the word "indirect" is accurate.
Ok. Let's go with that.
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>
>
>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
@ 2021-04-16 17:33 ` Bing Zhao
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
4 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-16 17:33 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The patch set includes:
1. API changes
2. testpmd adaption and guide update
3. driver update (only net/mlx5 is impacted)
4. rte_flow documentation update
---
v2: add adaptions of testpmd and driver part
v3: squash all patches into one and update rte_flow doc
v4: fix the doc format error
---
Bing Zhao (1):
ethdev: introduce indirect action APIs
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 29 +--
doc/guides/rel_notes/release_21_05.rst | 3 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 102 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 118 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 593 insertions(+), 566 deletions(-)
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
@ 2021-04-16 17:33 ` Bing Zhao
2021-04-19 12:26 ` Thomas Monjalon
0 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-16 17:33 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 29 +--
doc/guides/rel_notes/release_21_05.rst | 3 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 102 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 118 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 593 insertions(+), 566 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5bf1497f2b..4d9e038ce8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0127d9e7d6..c5381c638b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -112,21 +112,21 @@ enum index {
DUMP_ALL,
DUMP_ONE,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -416,8 +416,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -778,10 +778,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -841,12 +841,12 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
@@ -856,11 +856,11 @@ static const enum index next_dump_subcmd[] = {
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -900,8 +900,8 @@ static const enum index next_aged_attr[] = {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1380,7 +1380,7 @@ static const enum index next_action[] = {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1797,13 +1797,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1950,10 +1950,10 @@ static const struct token token_list[] = {
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1963,7 +1963,7 @@ static const struct token token_list[] = {
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1977,42 +1977,42 @@ static const struct token token_list[] = {
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4498,61 +4498,61 @@ static const struct token token_list[] = {
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4739,9 +4739,9 @@ parse_init(struct context *ctx, const struct token *token,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4754,7 +4754,7 @@ parse_sa(struct context *ctx, const struct token *token,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4766,26 +4766,26 @@ parse_sa(struct context *ctx, const struct token *token,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4794,9 +4794,9 @@ parse_sa(struct context *ctx, const struct token *token,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4809,8 +4809,8 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4818,13 +4818,13 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7102,7 +7102,7 @@ parse_port(struct context *ctx, const struct token *token,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7119,9 +7119,9 @@ parse_sa_id2ptr(struct context *ctx, const struct token *token,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7659,27 +7659,27 @@ static void
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 40b2b29725..c219ef25f7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1392,38 +1392,38 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1434,7 +1434,7 @@ action_alloc(portid_t port_id, uint32_t id,
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1443,70 +1443,70 @@ action_alloc(portid_t port_id, uint32_t id,
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1520,9 +1520,9 @@ port_shared_action_destroy(portid_t port_id,
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1530,14 +1530,14 @@ port_shared_action_destroy(portid_t port_id,
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1548,60 +1548,60 @@ port_shared_action_destroy(portid_t port_id,
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1623,8 +1623,8 @@ port_shared_action_query(portid_t port_id, uint32_t id)
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2066,7 +2066,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2116,11 +2116,11 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 36d8535d0c..c314b30f2e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index e1b93ecedf..4b54588995 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1719,7 +1719,7 @@ that counter.
For ports within the same switch domain then the counter id namespace extends
to all ports within that switch domain.
-The shared flag is DEPRECATED and ``SHARED`` ``COUNT`` action should be used
+The shared flag is DEPRECATED and ``INDIRECT`` ``COUNT`` action should be used
to make shared counters.
.. _table_rte_flow_action_count:
@@ -2742,25 +2742,26 @@ packets, and must have a fate action.
| ``actions`` | sub-action list for sampling |
+--------------+---------------------------------+
-Action: ``SHARED``
-^^^^^^^^^^^^^^^^^^
+Action: ``INDIRECT``
+^^^^^^^^^^^^^^^^^^^^
-Flow utilize shared action by handle as returned from
-``rte_flow_shared_action_create()``.
+Flow utilize indirect action by handle as returned from
+``rte_flow_action_handle_create()``.
-The behaviour of the shared action defined by ``action`` argument of type
-``struct rte_flow_action`` passed to ``rte_flow_shared_action_create()``.
+The behaviour of the indirect action defined by ``action`` argument of type
+``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
-Multiple flows can use the same shared action.
-The shared action can be in-place updated by ``rte_flow_shared_action_update()``
-without destroying flow and creating flow again.
+The indirect action can be used by a single flow or shared among multiple flows.
+The indirect action can be in-place updated by ``rte_flow_action_handle_update()``
+without destroying flow and creating flow again. The fields that could be
+updated depend on the type of the ``action`` and different for every type.
-The shared action specified data (e.g. counter) can be queried by
-``rte_flow_shared_action_query()``.
+The indirect action specified data (e.g. counter) can be queried by
+``rte_flow_action_handle_query()``.
-.. _table_rte_flow_shared_action:
+.. _table_rte_flow_action_handle:
-.. table:: SHARED
+.. table:: INDIRECT
+---------------+
| Field |
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 82ee71152f..e6f99350af 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -234,6 +234,9 @@ API Changes
* pci: The value ``PCI_ANY_ID`` is marked as deprecated
and can be replaced with ``RTE_PCI_ANY_ID``.
+* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
+ replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
+ ``rte_flow_action_handle_*``.
ABI Changes
-----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e3bfed566d..3397a61074 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4057,10 +4057,10 @@ This section lists supported actions and their attributes, if any.
- ``dscp_value {unsigned}``: The new DSCP value to be set
-- ``shared``: Use shared action created via
- ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+ ``flow indirect_action {port_id} create``
- - ``shared_action_id {unsigned}``: Shared action ID to use
+ - ``indirect_action_id {unsigned}``: Indirect action ID to use
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
@@ -4351,113 +4351,113 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
testpmd> flow aged 0
Port 0 total aged flows: 0
-Creating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+Creating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
- flow shared_action {port_id} create [action_id {shared_action_id}]
+ flow indirect_action {port_id} create [action_id {indirect_action_id}]
[ingress] [egress] [transfer] action {action} / end
If successful, it will show::
- Shared action #[...] created
+ Indirect action #[...] created
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
some error occurred::
- Shared action #[...] is already assigned, delete it first
+ Indirect action #[...] is already assigned, delete it first
::
Caught error type [...] ([...]): [...]
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
- testpmd> flow shared_action 0 create action_id 100 \
+ testpmd> flow indirect_action 0 create action_id 100 \
ingress action rss queues 1 2 end / end
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
port 0::
- testpmd> flow shared_action 0 create action_id \
+ testpmd> flow indirect_action 0 create action_id \
ingress action rss queues 0 1 end / end
-Updating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
- flow shared_action {port_id} update {shared_action_id}
+ flow indirect_action {port_id} update {indirect_action_id}
action {action} / end
If successful, it will show::
- Shared action #[...] updated
+ Indirect action #[...] updated
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
(in create example above rss queues were 1 and 2)::
- testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+ testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
-Destroying shared actions
-~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
- flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+ flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
If successful, it will show::
- Shared action #[...] destroyed
+ Indirect action #[...] destroyed
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
Caught error type [...] ([...]): [...]
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
- testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+ testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
-Query shared actions
-~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+Query indirect actions
+~~~~~~~~~~~~~~~~~~~~~~
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ Indirect RSS action:
refs:[...]
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Query shared action having id 100::
+Query indirect action having id 100::
- testpmd> flow shared_action 0 query 100
+ testpmd> flow indirect_action 0 query 100
Sample QinQ flow rules
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 02cc2c781e..3bf224c559 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1341,7 +1341,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
* then this will return directly without any action.
*/
mlx5_flow_list_flush(dev, &priv->flows, true);
- mlx5_shared_action_flush(dev);
+ mlx5_action_handle_flush(dev);
mlx5_flow_meter_flush(dev, NULL);
/* Prevent crashes when queues are still in use. */
dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807dcd9..6e9c4b9cdd 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
/*
* Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 84463074a5..68e1ffda9c 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -568,23 +568,23 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
},
};
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
static int
@@ -623,10 +623,10 @@ static const struct rte_flow_ops mlx5_flow_ops = {
.query = mlx5_flow_query,
.dev_dump = mlx5_flow_dev_dump,
.get_aged_flows = mlx5_flow_get_aged_flows,
- .shared_action_create = mlx5_shared_action_create,
- .shared_action_destroy = mlx5_shared_action_destroy,
- .shared_action_update = mlx5_shared_action_update,
- .shared_action_query = mlx5_shared_action_query,
+ .action_handle_create = mlx5_action_handle_create,
+ .action_handle_destroy = mlx5_action_handle_destroy,
+ .action_handle_update = mlx5_action_handle_update,
+ .action_handle_query = mlx5_action_handle_query,
.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
.tunnel_match = mlx5_flow_tunnel_match,
.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3402,31 +3402,31 @@ flow_aso_age_get_by_idx(struct rte_eth_dev *dev, uint32_t age_idx)
return &pool->actions[offset - 1];
}
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
- struct rte_flow_shared_action *action; /**< Shared action */
- int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+ struct rte_flow_action_handle *action; /**< Indirect action handle. */
+ int index; /**< Index in related array of rte_flow_action. */
};
/**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
* from this call.
*
* @param[in] dev
* Pointer to Ethernet device.
* @param[in] actions
* List of actions to translate.
- * @param[out] shared
- * List to store translated shared actions.
- * @param[in, out] shared_n
- * Size of *shared* array. On return should be updated with number of shared
- * actions retrieved from the *actions* list.
+ * @param[out] handle
+ * List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ * Size of *handle* array. On return should be updated with number of
+ * indirect actions retrieved from the *actions* list.
* @param[out] translated_actions
- * List of actions where all shared actions were translated to non shared
+ * List of actions where all indirect actions were translated to direct
* if possible. NULL if no translation took place.
* @param[out] error
* Pointer to the error structure.
@@ -3435,10 +3435,10 @@ struct mlx5_translated_shared_action {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
- struct mlx5_translated_shared_action *shared,
- int *shared_n,
+ struct mlx5_translated_action_handle *handle,
+ int *indir_n,
struct rte_flow_action **translated_actions,
struct rte_flow_error *error)
{
@@ -3447,23 +3447,23 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
size_t actions_size;
int n;
int copied_n = 0;
- struct mlx5_translated_shared_action *shared_end = NULL;
+ struct mlx5_translated_action_handle *handle_end = NULL;
for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
- if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+ if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
continue;
- if (copied_n == *shared_n) {
+ if (copied_n == *indir_n) {
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
NULL, "too many shared actions");
}
- rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+ rte_memcpy(&handle[copied_n].action, &actions[n].conf,
sizeof(actions[n].conf));
- shared[copied_n].index = n;
+ handle[copied_n].index = n;
copied_n++;
}
n++;
- *shared_n = copied_n;
+ *indir_n = copied_n;
if (!copied_n)
return 0;
actions_size = sizeof(struct rte_flow_action) * n;
@@ -3473,28 +3473,28 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
return -ENOMEM;
}
memcpy(translated, actions, actions_size);
- for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+ for (handle_end = handle + copied_n; handle < handle_end; handle++) {
struct mlx5_shared_action_rss *shared_rss;
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
- - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx &
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
- translated[shared->index].type =
+ translated[handle->index].type =
RTE_FLOW_ACTION_TYPE_RSS;
- translated[shared->index].conf =
+ translated[handle->index].conf =
&shared_rss->origin;
break;
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
if (priv->sh->flow_hit_aso_en) {
- translated[shared->index].type =
+ translated[handle->index].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_AGE;
- translated[shared->index].conf =
+ translated[handle->index].conf =
(void *)(uintptr_t)idx;
break;
}
@@ -3503,7 +3503,7 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
mlx5_free(translated);
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "invalid shared action type");
+ NULL, "invalid indirect action type");
}
}
*translated_actions = translated;
@@ -3525,21 +3525,21 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
*/
static uint32_t
flow_get_shared_rss_action(struct rte_eth_dev *dev,
- struct mlx5_translated_shared_action *shared,
+ struct mlx5_translated_action_handle *handle,
int shared_n)
{
- struct mlx5_translated_shared_action *shared_end;
+ struct mlx5_translated_action_handle *handle_end;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_shared_action_rss *shared_rss;
- for (shared_end = shared + shared_n; shared < shared_end; shared++) {
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+ for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
uint32_t idx = act_idx &
- ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
idx);
@@ -5549,9 +5549,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
struct rte_flow *flow = NULL;
struct mlx5_flow *dev_flow;
const struct rte_flow_action_rss *rss = NULL;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
union {
struct mlx5_flow_expand_rss buf;
uint8_t buffer[2048];
@@ -5591,9 +5591,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
MLX5_ASSERT(wks);
rss_desc = &wks->rss_desc;
- ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret < 0) {
MLX5_ASSERT(translated_actions == NULL);
@@ -5654,8 +5654,8 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
buf->entries = 1;
buf->entry[0].pattern = (void *)(uintptr_t)items;
}
- rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
- shared_actions_n);
+ rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+ indir_actions_n);
for (i = 0; i < buf->entries; ++i) {
/* Initialize flow split data. */
flow_split_info.prefix_layers = 0;
@@ -5834,14 +5834,14 @@ mlx5_flow_validate(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
int hairpin_flow;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
const struct rte_flow_action *actions;
struct rte_flow_action *translated_actions = NULL;
- int ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ int ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret)
@@ -7214,12 +7214,12 @@ mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
/* Wrapper for driver action_validate op callback */
static int
flow_drv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action validation unsupported";
+ static const char err_msg[] = "indirect action validation unsupported";
if (!fops->action_validate) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7235,8 +7235,8 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7247,11 +7247,11 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
* @note: wrapper for driver action_create op callback.
*/
static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action destruction unsupported";
+ static const char err_msg[] = "indirect action destruction unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7262,18 +7262,18 @@ mlx5_shared_action_destroy(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_destroy(dev, action, error);
+ return fops->action_destroy(dev, handle, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action update unsupported";
+ static const char err_msg[] = "indirect action update unsupported";
if (!fops->action_update) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7281,18 +7281,18 @@ flow_drv_action_update(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_update(dev, action, action_conf, error);
+ return fops->action_update(dev, handle, update, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action query unsupported";
+ static const char err_msg[] = "indirect action query unsupported";
if (!fops->action_query) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7300,29 +7300,31 @@ flow_drv_action_query(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_query(dev, action, data, error);
+ return fops->action_query(dev, handle, data, error);
}
/**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param conf
+ * Pointer to indirect action object configuration.
* @param[in] action
- * Action configuration for shared action creation.
+ * Action configuration for indirect action object creation.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
* @return
* A valid handle in case of success, NULL otherwise and rte_errno is set.
*/
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action creation unsupported";
+ static const char err_msg[] = "indirect action creation unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7339,19 +7341,20 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
}
/**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] shared_action
- * Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ * Handle for the indirect action to be updated.
+ * @param[in] update
* Action specification used to modify the action pointed by handle.
- * *action* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7360,9 +7363,9 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
struct rte_flow_attr attr = { .transfer = 0 };
@@ -7370,26 +7373,27 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
- ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+ ret = flow_drv_action_validate(dev, NULL,
+ (const struct rte_flow_action *)update, fops, error);
if (ret)
return ret;
- return flow_drv_action_update(dev, shared_action, action->conf, fops,
+ return flow_drv_action_update(dev, handle, update, fops,
error);
}
/**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
*
* This function allows retrieving action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the indirect action to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -7400,8 +7404,8 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -7409,11 +7413,11 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
- return flow_drv_action_query(dev, action, data, fops, error);
+ return flow_drv_action_query(dev, handle, data, fops, error);
}
/**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
*
* @param dev
* Pointer to Ethernet device.
@@ -7422,7 +7426,7 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
{
struct rte_flow_error error;
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7432,8 +7436,8 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev)
ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
priv->rss_shared_actions, idx, shared_rss, next) {
- ret |= mlx5_shared_action_destroy(dev,
- (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+ ret |= mlx5_action_handle_destroy(dev,
+ (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
}
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ec673c29ab..56674eb0d2 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -39,11 +39,11 @@ enum mlx5_rte_flow_action_type {
MLX5_RTE_FLOW_ACTION_TYPE_AGE,
};
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
enum {
- MLX5_SHARED_ACTION_TYPE_RSS,
- MLX5_SHARED_ACTION_TYPE_AGE,
+ MLX5_INDIRECT_ACTION_TYPE_RSS,
+ MLX5_INDIRECT_ACTION_TYPE_AGE,
};
/* Matches on selected register. */
@@ -1152,7 +1152,7 @@ struct mlx5_shared_action_rss {
rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
};
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
uint32_t id;
};
@@ -1233,26 +1233,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_validate_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_destroy_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_update_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *action,
+ const void *update,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_query_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *action,
void *data,
struct rte_flow_error *error);
typedef int (*mlx5_flow_sync_domain_t)
@@ -1483,7 +1483,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
struct rte_mtr_error *error);
int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index e65cc13bd6..d02e97b3f4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12870,7 +12870,7 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev,
*/
static uint32_t
__flow_dv_action_rss_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
@@ -12893,7 +12893,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev,
"cannot allocate resource memory");
goto error_rss_init;
}
- if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+ if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
rte_flow_error_set(error, E2BIG,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"rss action number out of range");
@@ -13006,7 +13006,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
}
/**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
* (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
@@ -13015,7 +13015,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * Action specification used to create shared action.
+ * Action specification used to create indirect action.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13024,9 +13024,9 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* A valid shared action handle in case of success, NULL otherwise and
* rte_errno is set.
*/
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
flow_dv_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
@@ -13036,13 +13036,13 @@ flow_dv_action_create(struct rte_eth_dev *dev,
switch (action->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
if (ret) {
struct mlx5_aso_age_action *aso_age =
flow_aso_age_get_by_idx(dev, ret);
@@ -13057,19 +13057,19 @@ flow_dv_action_create(struct rte_eth_dev *dev,
NULL, "action type not supported");
break;
}
- return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+ return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
}
/**
- * Destroy the shared action.
+ * Destroy the indirect action.
* Release action related resources on the NIC and the memory.
* Lock free, (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be removed.
+ * @param[in] handle
+ * The indirect action object handle to be removed.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13079,25 +13079,25 @@ flow_dv_action_create(struct rte_eth_dev *dev,
*/
static int
flow_dv_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
int ret;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
return __flow_dv_action_rss_release(dev, idx, error);
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
ret = flow_dv_aso_age_release(dev, idx);
if (ret)
/*
* In this case, the last flow has a reference will
* actually release the age action.
*/
- DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+ DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
" released with references %d.", idx, ret);
return 0;
default:
@@ -13180,12 +13180,13 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be updated.
- * @param[in] action_conf
- * Action specification used to modify *action*.
- * *action_conf* should be of type correlating with type of the *action*,
- * otherwise considered as invalid.
+ * @param[in] handle
+ * The indirect action object handle to be updated.
+ * @param[in] update
+ * Action specification used to modify the action pointed by *handle*.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13195,16 +13196,18 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*/
static int
flow_dv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *err)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ const void *action_conf;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
+ action_conf = ((const struct rte_flow_action *)update)->conf;
return __flow_dv_action_rss_update(dev, idx, action_conf, err);
default:
return rte_flow_error_set(err, ENOTSUP,
@@ -13216,17 +13219,17 @@ flow_dv_action_update(struct rte_eth_dev *dev,
static int
flow_dv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action, void *data,
+ const struct rte_flow_action_handle *handle, void *data,
struct rte_flow_error *error)
{
struct mlx5_age_param *age_param;
struct rte_flow_query_age *resp;
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
resp = data;
resp->aged = __atomic_load_n(&age_param->state,
@@ -14002,7 +14005,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
}
/**
- * Validate shared action.
+ * Validate indirect action.
* Dispatcher for action type specific validation.
*
* @param[in] dev
@@ -14010,7 +14013,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * The shared action object to validate.
+ * The indirect action object to validate.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -14020,7 +14023,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
*/
static int
flow_dv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 7241f00353..0d2610b7c4 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -180,12 +180,12 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(MODIFY_FIELD,
sizeof(struct rte_flow_action_modify_field)),
/**
- * Shared action represented as handle of type
- * (struct rte_flow_shared action *) stored in conf field (see
+ * Indirect action represented as handle of type
+ * (struct rte_flow_action_handle *) stored in conf field (see
* struct rte_flow_action); no need for additional structure to * store
- * shared action handle.
+ * indirect action handle.
*/
- MK_FLOW_ACTION(SHARED, 0),
+ MK_FLOW_ACTION(INDIRECT, 0),
};
int
@@ -1068,53 +1068,53 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1122,18 +1122,18 @@ rte_flow_shared_action_update(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1142,11 +1142,11 @@ rte_flow_shared_action_query(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 203c4cde9a..324d00abdc 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
* Enables counters for this flow rule.
*
* These counters can be retrieved and reset through rte_flow_query() or
- * rte_flow_shared_action_query() if the action provided via handle,
+ * rte_flow_action_handle_query() if the action provided via handle,
* see struct rte_flow_query_count.
*
* See struct rte_flow_action_count.
@@ -2267,6 +2267,16 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * Describe indirect action that could be used by a single flow rule
+ * or multiple flow rules.
+ *
+ * Allow flow rule(s) reference the same action by the indirect action
+ * handle (see struct rte_flow_action_handle), rules could be on the
+ * same port or across different ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2357,7 +2367,7 @@ struct rte_flow_query_age {
* ``struct rte_flow_query_count``.
*
* @deprecated Shared attribute is deprecated, use generic
- * RTE_FLOW_ACTION_TYPE_SHARED action.
+ * RTE_FLOW_ACTION_TYPE_INDIRECT action.
*
* The shared flag indicates whether the counter is unique to the flow rule the
* action is specified with, or whether it is a shared counter.
@@ -2847,17 +2857,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle will be different per driver or
+ * per immediate action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related immediate action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3631,25 +3647,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3658,16 +3671,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used by flow create, and
+ * could also be shared by different flows.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3681,9 +3695,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3691,12 +3705,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3711,27 +3725,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3742,32 +3759,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the direct action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3779,10 +3796,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index 6ae1f8c264..46f62c2ec2 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -84,27 +84,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388e96..4eb561a89a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-19 12:26 ` Thomas Monjalon
2021-04-19 15:05 ` Bing Zhao
0 siblings, 1 reply; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-19 12:26 UTC (permalink / raw)
To: orika, Bing Zhao
Cc: ferruh.yigit, andrew.rybchenko, matan, viacheslavo, dev,
ajit.khaparde, getelson, andreyv
16/04/2021 19:33, Bing Zhao:
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -234,6 +234,9 @@ API Changes
> * pci: The value ``PCI_ANY_ID`` is marked as deprecated
> and can be replaced with ``RTE_PCI_ANY_ID``.
>
> +* ethdev: The experimental shared action APIs in ``rte_flow.h`` has been
s/APIs/API/
An API may cover more than a function, it is an interface globally.
> + replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
s/APIs/API/
> + ``rte_flow_action_handle_*``.
A blank line is missing here.
I propose a reword:
* ethdev: The experimental flow API for shared action has been generalized
as a flow action handle used in rules through an indirect action.
The functions ``rte_flow_shared_action_*`` manipulating the action object
are replaced with ``rte_flow_action_handle_*``.
The action ``RTE_FLOW_ACTION_TYPE_SHARED`` is deprecated and can be
replaced with ``RTE_FLOW_ACTION_TYPE_INDIRECT``.
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +Creating indirect actions
> +~~~~~~~~~~~~~~~~~~~~~~~~~
empty line missing after title
> +``flow indirect_action {port_id} create`` creates indirect action with optional
> +indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
[...]
> +Updating indirect actions
> +~~~~~~~~~~~~~~~~~~~~~~~~~
empty line
> +``flow indirect_action {port_id} update`` updates configuration of the indirect
> +action from its indirect action ID (as returned by
> +``flow indirect_action {port_id} create``). It is bound to
> +``rte_flow_action_handle_update()``::
[...]
> +Destroying indirect actions
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~
same here and other places
> +``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
> +from their indirect action IDs (as returned by
> +``flow indirect_action {port_id} create``). It is bound to
> +``rte_flow_action_handle_destroy()``::
[...]
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
We should add a comment to RTE_FLOW_ACTION_TYPE_SHARED,
that it is deprecated.
> + /**
> + * Describe indirect action that could be used by a single flow rule
> + * or multiple flow rules.
> + *
> + * Allow flow rule(s) reference the same action by the indirect action
> + * handle (see struct rte_flow_action_handle), rules could be on the
> + * same port or across different ports.
> + */
Proposed reword:
An action handle is referenced in a rule through an indirect action.
The same action handle may be used in multiple rules for the same
or different ethdev ports.
@see rte_flow_action_handle
> + RTE_FLOW_ACTION_TYPE_INDIRECT,
> };
[...]
> - * Opaque type returned after successfully creating a shared action.
> + * Opaque type returned after successfully creating an indirect action object.
> + * The definition of the object handle will be different per driver or
s/will be/is/
> + * per immediate action type.
> *
> - * This handle can be used to manage and query the related action:
> - * - share it across multiple flow rules
> - * - update action configuration
> - * - query action data
> - * - destroy action
> + * This handle can be used to manage and query the related immediate action:
> + * - referenced in single flow rule or across multiple flow rules
> + * over multiple ports
> + * - update action object configuration
> + * - query action object data
> + * - destroy action object
> */
> -struct rte_flow_shared_action;
> +struct rte_flow_action_handle;
[...]
> + * Create an indirect action object that can be used by flow create, and
> + * could also be shared by different flows.
Can be simpler:
Create an indirect action object that can be used in flow rules via its handle.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v5] Change shared action API to action handle API
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
` (2 preceding siblings ...)
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
@ 2021-04-19 14:28 ` Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
4 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-19 14:28 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The patch set includes:
1. API changes
2. testpmd adaption and guide update
3. driver update (only net/mlx5 is impacted)
4. rte_flow documentation update
---
v2: add adaptions of testpmd and driver part
v3: squash all patches into one and update rte_flow doc
v4: fix the doc format error
v5: deprecate "RTE_FLOW_ACTION_TYPE_SHARED" and update description
---
Bing Zhao (1):
ethdev: introduce indirect action APIs
app/test-pmd/cmdline.c | 24 +--
app/test-pmd/cmdline_flow.c | 252 ++++++++++++++--------------
app/test-pmd/config.c | 160 +++++++++---------
app/test-pmd/testpmd.h | 28 ++--
doc/guides/prog_guide/rte_flow.rst | 29 ++--
doc/guides/rel_notes/release_21_05.rst | 7 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 106 ++++++------
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++++++-------------
drivers/net/mlx5/mlx5_flow.h | 24 +--
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++++-----
lib/librte_ethdev/rte_flow.c | 56 +++----
lib/librte_ethdev/rte_flow.h | 119 +++++++------
lib/librte_ethdev/rte_flow_driver.h | 26 +--
lib/librte_ethdev/version.map | 8 +-
16 files changed, 602 insertions(+), 566 deletions(-)
--
2.5.5
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v5] ethdev: introduce indirect action APIs
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
@ 2021-04-19 14:28 ` Bing Zhao
0 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-19 14:28 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
app/test-pmd/cmdline.c | 24 +--
app/test-pmd/cmdline_flow.c | 252 ++++++++++++++--------------
app/test-pmd/config.c | 160 +++++++++---------
app/test-pmd/testpmd.h | 28 ++--
doc/guides/prog_guide/rte_flow.rst | 29 ++--
doc/guides/rel_notes/release_21_05.rst | 7 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 106 ++++++------
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++++++-------------
drivers/net/mlx5/mlx5_flow.h | 24 +--
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++++-----
lib/librte_ethdev/rte_flow.c | 56 +++----
lib/librte_ethdev/rte_flow.h | 119 +++++++------
lib/librte_ethdev/rte_flow_driver.h | 26 +--
lib/librte_ethdev/version.map | 8 +-
16 files changed, 602 insertions(+), 566 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5bf1497..4d9e038 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0127d9e..c5381c6 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -112,21 +112,21 @@ enum index {
DUMP_ALL,
DUMP_ONE,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -416,8 +416,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -778,10 +778,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -841,12 +841,12 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
@@ -856,11 +856,11 @@ static const enum index next_dump_subcmd[] = {
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -900,8 +900,8 @@ static const enum index next_aged_attr[] = {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1380,7 +1380,7 @@ static const enum index next_action[] = {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1797,13 +1797,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1950,10 +1950,10 @@ static const struct token token_list[] = {
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1963,7 +1963,7 @@ static const struct token token_list[] = {
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1977,42 +1977,42 @@ static const struct token token_list[] = {
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4498,61 +4498,61 @@ static const struct token token_list[] = {
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4739,9 +4739,9 @@ parse_init(struct context *ctx, const struct token *token,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4754,7 +4754,7 @@ parse_sa(struct context *ctx, const struct token *token,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4766,26 +4766,26 @@ parse_sa(struct context *ctx, const struct token *token,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4794,9 +4794,9 @@ parse_sa(struct context *ctx, const struct token *token,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4809,8 +4809,8 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4818,13 +4818,13 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7102,7 +7102,7 @@ parse_port(struct context *ctx, const struct token *token,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7119,9 +7119,9 @@ parse_sa_id2ptr(struct context *ctx, const struct token *token,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7659,27 +7659,27 @@ static void
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d4b0e85..868ff34 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1391,38 +1391,38 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1433,7 +1433,7 @@ action_alloc(portid_t port_id, uint32_t id,
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1442,70 +1442,70 @@ action_alloc(portid_t port_id, uint32_t id,
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1519,9 +1519,9 @@ port_shared_action_destroy(portid_t port_id,
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1529,14 +1529,14 @@ port_shared_action_destroy(portid_t port_id,
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1547,60 +1547,60 @@ port_shared_action_destroy(portid_t port_id,
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1622,8 +1622,8 @@ port_shared_action_query(portid_t port_id, uint32_t id)
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2065,7 +2065,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2115,11 +2115,11 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 36d8535..c314b30 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index e1b93ec..4b54588 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1719,7 +1719,7 @@ that counter.
For ports within the same switch domain then the counter id namespace extends
to all ports within that switch domain.
-The shared flag is DEPRECATED and ``SHARED`` ``COUNT`` action should be used
+The shared flag is DEPRECATED and ``INDIRECT`` ``COUNT`` action should be used
to make shared counters.
.. _table_rte_flow_action_count:
@@ -2742,25 +2742,26 @@ packets, and must have a fate action.
| ``actions`` | sub-action list for sampling |
+--------------+---------------------------------+
-Action: ``SHARED``
-^^^^^^^^^^^^^^^^^^
+Action: ``INDIRECT``
+^^^^^^^^^^^^^^^^^^^^
-Flow utilize shared action by handle as returned from
-``rte_flow_shared_action_create()``.
+Flow utilize indirect action by handle as returned from
+``rte_flow_action_handle_create()``.
-The behaviour of the shared action defined by ``action`` argument of type
-``struct rte_flow_action`` passed to ``rte_flow_shared_action_create()``.
+The behaviour of the indirect action defined by ``action`` argument of type
+``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
-Multiple flows can use the same shared action.
-The shared action can be in-place updated by ``rte_flow_shared_action_update()``
-without destroying flow and creating flow again.
+The indirect action can be used by a single flow or shared among multiple flows.
+The indirect action can be in-place updated by ``rte_flow_action_handle_update()``
+without destroying flow and creating flow again. The fields that could be
+updated depend on the type of the ``action`` and different for every type.
-The shared action specified data (e.g. counter) can be queried by
-``rte_flow_shared_action_query()``.
+The indirect action specified data (e.g. counter) can be queried by
+``rte_flow_action_handle_query()``.
-.. _table_rte_flow_shared_action:
+.. _table_rte_flow_action_handle:
-.. table:: SHARED
+.. table:: INDIRECT
+---------------+
| Field |
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 1c2e093..8913dd4 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -270,6 +270,13 @@ API Changes
``rte_cryptodev_raw_dequeue_burst`` got a new parameter
``max_nb_to_dequeue`` to provide flexible control on dequeue.
+* ethdev: The experimental flow API for shared action has been generalized
+ as a flow action handle used in rules through an indirect action.
+ The functions ``rte_flow_shared_action_*`` manipulating the action object
+ are replaced with ``rte_flow_action_handle_*``.
+ The action ``RTE_FLOW_ACTION_TYPE_SHARED`` is deprecated and can be
+ replaced with ``RTE_FLOW_ACTION_TYPE_INDIRECT``.
+
ABI Changes
-----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a736e7d..715e209 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4055,10 +4055,10 @@ This section lists supported actions and their attributes, if any.
- ``dscp_value {unsigned}``: The new DSCP value to be set
-- ``shared``: Use shared action created via
- ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+ ``flow indirect_action {port_id} create``
- - ``shared_action_id {unsigned}``: Shared action ID to use
+ - ``indirect_action_id {unsigned}``: Indirect action ID to use
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
@@ -4349,113 +4349,117 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
testpmd> flow aged 0
Port 0 total aged flows: 0
-Creating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+Creating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
- flow shared_action {port_id} create [action_id {shared_action_id}]
+ flow indirect_action {port_id} create [action_id {indirect_action_id}]
[ingress] [egress] [transfer] action {action} / end
If successful, it will show::
- Shared action #[...] created
+ Indirect action #[...] created
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
some error occurred::
- Shared action #[...] is already assigned, delete it first
+ Indirect action #[...] is already assigned, delete it first
::
Caught error type [...] ([...]): [...]
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
- testpmd> flow shared_action 0 create action_id 100 \
+ testpmd> flow indirect_action 0 create action_id 100 \
ingress action rss queues 1 2 end / end
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
port 0::
- testpmd> flow shared_action 0 create action_id \
+ testpmd> flow indirect_action 0 create action_id \
ingress action rss queues 0 1 end / end
-Updating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
- flow shared_action {port_id} update {shared_action_id}
+ flow indirect_action {port_id} update {indirect_action_id}
action {action} / end
If successful, it will show::
- Shared action #[...] updated
+ Indirect action #[...] updated
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
(in create example above rss queues were 1 and 2)::
- testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+ testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
-Destroying shared actions
-~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
- flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+ flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
If successful, it will show::
- Shared action #[...] destroyed
+ Indirect action #[...] destroyed
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
Caught error type [...] ([...]): [...]
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
- testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+ testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
-Query shared actions
-~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+Query indirect actions
+~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ Indirect RSS action:
refs:[...]
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Query shared action having id 100::
+Query indirect action having id 100::
- testpmd> flow shared_action 0 query 100
+ testpmd> flow indirect_action 0 query 100
Sample QinQ flow rules
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index fcaba2d..7e13b38 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1421,7 +1421,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
* then this will return directly without any action.
*/
mlx5_flow_list_flush(dev, &priv->flows, true);
- mlx5_shared_action_flush(dev);
+ mlx5_action_handle_flush(dev);
mlx5_flow_meter_flush(dev, NULL);
/* Prevent crashes when queues are still in use. */
dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807d..6e9c4b9 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
/*
* Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d8e0bcb..bed8f31 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -567,23 +567,23 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
},
};
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
static int
@@ -622,10 +622,10 @@ static const struct rte_flow_ops mlx5_flow_ops = {
.query = mlx5_flow_query,
.dev_dump = mlx5_flow_dev_dump,
.get_aged_flows = mlx5_flow_get_aged_flows,
- .shared_action_create = mlx5_shared_action_create,
- .shared_action_destroy = mlx5_shared_action_destroy,
- .shared_action_update = mlx5_shared_action_update,
- .shared_action_query = mlx5_shared_action_query,
+ .action_handle_create = mlx5_action_handle_create,
+ .action_handle_destroy = mlx5_action_handle_destroy,
+ .action_handle_update = mlx5_action_handle_update,
+ .action_handle_query = mlx5_action_handle_query,
.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
.tunnel_match = mlx5_flow_tunnel_match,
.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3402,31 +3402,31 @@ flow_aso_age_get_by_idx(struct rte_eth_dev *dev, uint32_t age_idx)
return &pool->actions[offset - 1];
}
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
- struct rte_flow_shared_action *action; /**< Shared action */
- int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+ struct rte_flow_action_handle *action; /**< Indirect action handle. */
+ int index; /**< Index in related array of rte_flow_action. */
};
/**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
* from this call.
*
* @param[in] dev
* Pointer to Ethernet device.
* @param[in] actions
* List of actions to translate.
- * @param[out] shared
- * List to store translated shared actions.
- * @param[in, out] shared_n
- * Size of *shared* array. On return should be updated with number of shared
- * actions retrieved from the *actions* list.
+ * @param[out] handle
+ * List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ * Size of *handle* array. On return should be updated with number of
+ * indirect actions retrieved from the *actions* list.
* @param[out] translated_actions
- * List of actions where all shared actions were translated to non shared
+ * List of actions where all indirect actions were translated to direct
* if possible. NULL if no translation took place.
* @param[out] error
* Pointer to the error structure.
@@ -3435,10 +3435,10 @@ struct mlx5_translated_shared_action {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
- struct mlx5_translated_shared_action *shared,
- int *shared_n,
+ struct mlx5_translated_action_handle *handle,
+ int *indir_n,
struct rte_flow_action **translated_actions,
struct rte_flow_error *error)
{
@@ -3447,23 +3447,23 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
size_t actions_size;
int n;
int copied_n = 0;
- struct mlx5_translated_shared_action *shared_end = NULL;
+ struct mlx5_translated_action_handle *handle_end = NULL;
for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
- if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+ if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
continue;
- if (copied_n == *shared_n) {
+ if (copied_n == *indir_n) {
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
NULL, "too many shared actions");
}
- rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+ rte_memcpy(&handle[copied_n].action, &actions[n].conf,
sizeof(actions[n].conf));
- shared[copied_n].index = n;
+ handle[copied_n].index = n;
copied_n++;
}
n++;
- *shared_n = copied_n;
+ *indir_n = copied_n;
if (!copied_n)
return 0;
actions_size = sizeof(struct rte_flow_action) * n;
@@ -3473,28 +3473,28 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
return -ENOMEM;
}
memcpy(translated, actions, actions_size);
- for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+ for (handle_end = handle + copied_n; handle < handle_end; handle++) {
struct mlx5_shared_action_rss *shared_rss;
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
- - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx &
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
- translated[shared->index].type =
+ translated[handle->index].type =
RTE_FLOW_ACTION_TYPE_RSS;
- translated[shared->index].conf =
+ translated[handle->index].conf =
&shared_rss->origin;
break;
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
if (priv->sh->flow_hit_aso_en) {
- translated[shared->index].type =
+ translated[handle->index].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_AGE;
- translated[shared->index].conf =
+ translated[handle->index].conf =
(void *)(uintptr_t)idx;
break;
}
@@ -3503,7 +3503,7 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
mlx5_free(translated);
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "invalid shared action type");
+ NULL, "invalid indirect action type");
}
}
*translated_actions = translated;
@@ -3525,21 +3525,21 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
*/
static uint32_t
flow_get_shared_rss_action(struct rte_eth_dev *dev,
- struct mlx5_translated_shared_action *shared,
+ struct mlx5_translated_action_handle *handle,
int shared_n)
{
- struct mlx5_translated_shared_action *shared_end;
+ struct mlx5_translated_action_handle *handle_end;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_shared_action_rss *shared_rss;
- for (shared_end = shared + shared_n; shared < shared_end; shared++) {
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+ for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
uint32_t idx = act_idx &
- ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
idx);
@@ -5664,9 +5664,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
struct rte_flow *flow = NULL;
struct mlx5_flow *dev_flow;
const struct rte_flow_action_rss *rss = NULL;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
union {
struct mlx5_flow_expand_rss buf;
uint8_t buffer[2048];
@@ -5707,9 +5707,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
MLX5_ASSERT(wks);
rss_desc = &wks->rss_desc;
- ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret < 0) {
MLX5_ASSERT(translated_actions == NULL);
@@ -5770,8 +5770,8 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
buf->entries = 1;
buf->entry[0].pattern = (void *)(uintptr_t)items;
}
- rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
- shared_actions_n);
+ rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+ indir_actions_n);
for (i = 0; i < buf->entries; ++i) {
/* Initialize flow split data. */
flow_split_info.prefix_layers = 0;
@@ -5950,14 +5950,14 @@ mlx5_flow_validate(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
int hairpin_flow;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
const struct rte_flow_action *actions;
struct rte_flow_action *translated_actions = NULL;
- int ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ int ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret)
@@ -7391,12 +7391,12 @@ mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
/* Wrapper for driver action_validate op callback */
static int
flow_drv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action validation unsupported";
+ static const char err_msg[] = "indirect action validation unsupported";
if (!fops->action_validate) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7412,8 +7412,8 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7424,11 +7424,11 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
* @note: wrapper for driver action_create op callback.
*/
static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action destruction unsupported";
+ static const char err_msg[] = "indirect action destruction unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7439,18 +7439,18 @@ mlx5_shared_action_destroy(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_destroy(dev, action, error);
+ return fops->action_destroy(dev, handle, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action update unsupported";
+ static const char err_msg[] = "indirect action update unsupported";
if (!fops->action_update) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7458,18 +7458,18 @@ flow_drv_action_update(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_update(dev, action, action_conf, error);
+ return fops->action_update(dev, handle, update, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action query unsupported";
+ static const char err_msg[] = "indirect action query unsupported";
if (!fops->action_query) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7477,29 +7477,31 @@ flow_drv_action_query(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_query(dev, action, data, error);
+ return fops->action_query(dev, handle, data, error);
}
/**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param conf
+ * Pointer to indirect action object configuration.
* @param[in] action
- * Action configuration for shared action creation.
+ * Action configuration for indirect action object creation.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
* @return
* A valid handle in case of success, NULL otherwise and rte_errno is set.
*/
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action creation unsupported";
+ static const char err_msg[] = "indirect action creation unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7516,19 +7518,20 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
}
/**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] shared_action
- * Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ * Handle for the indirect action to be updated.
+ * @param[in] update
* Action specification used to modify the action pointed by handle.
- * *action* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7537,9 +7540,9 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
struct rte_flow_attr attr = { .transfer = 0 };
@@ -7547,26 +7550,27 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
- ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+ ret = flow_drv_action_validate(dev, NULL,
+ (const struct rte_flow_action *)update, fops, error);
if (ret)
return ret;
- return flow_drv_action_update(dev, shared_action, action->conf, fops,
+ return flow_drv_action_update(dev, handle, update, fops,
error);
}
/**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
*
* This function allows retrieving action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the indirect action to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -7577,8 +7581,8 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -7586,11 +7590,11 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
- return flow_drv_action_query(dev, action, data, fops, error);
+ return flow_drv_action_query(dev, handle, data, fops, error);
}
/**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
*
* @param dev
* Pointer to Ethernet device.
@@ -7599,7 +7603,7 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
{
struct rte_flow_error error;
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7609,8 +7613,8 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev)
ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
priv->rss_shared_actions, idx, shared_rss, next) {
- ret |= mlx5_shared_action_destroy(dev,
- (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+ ret |= mlx5_action_handle_destroy(dev,
+ (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
}
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index a5b0802..1a74b17 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -38,11 +38,11 @@ enum mlx5_rte_flow_action_type {
MLX5_RTE_FLOW_ACTION_TYPE_AGE,
};
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
enum {
- MLX5_SHARED_ACTION_TYPE_RSS,
- MLX5_SHARED_ACTION_TYPE_AGE,
+ MLX5_INDIRECT_ACTION_TYPE_RSS,
+ MLX5_INDIRECT_ACTION_TYPE_AGE,
};
/* Matches on selected register. */
@@ -1037,7 +1037,7 @@ struct mlx5_shared_action_rss {
rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
};
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
uint32_t id;
};
@@ -1123,26 +1123,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_validate_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_destroy_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_update_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *action,
+ const void *update,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_query_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *action,
void *data,
struct rte_flow_error *error);
typedef int (*mlx5_flow_sync_domain_t)
@@ -1400,7 +1400,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
struct rte_mtr_error *error);
int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index b443eb9..ffd9f63 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -13059,7 +13059,7 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev,
*/
static uint32_t
__flow_dv_action_rss_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
@@ -13082,7 +13082,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev,
"cannot allocate resource memory");
goto error_rss_init;
}
- if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+ if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
rte_flow_error_set(error, E2BIG,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"rss action number out of range");
@@ -13195,7 +13195,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
}
/**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
* (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
@@ -13204,7 +13204,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * Action specification used to create shared action.
+ * Action specification used to create indirect action.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13213,9 +13213,9 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* A valid shared action handle in case of success, NULL otherwise and
* rte_errno is set.
*/
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
flow_dv_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
@@ -13225,13 +13225,13 @@ flow_dv_action_create(struct rte_eth_dev *dev,
switch (action->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
if (ret) {
struct mlx5_aso_age_action *aso_age =
flow_aso_age_get_by_idx(dev, ret);
@@ -13246,19 +13246,19 @@ flow_dv_action_create(struct rte_eth_dev *dev,
NULL, "action type not supported");
break;
}
- return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+ return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
}
/**
- * Destroy the shared action.
+ * Destroy the indirect action.
* Release action related resources on the NIC and the memory.
* Lock free, (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be removed.
+ * @param[in] handle
+ * The indirect action object handle to be removed.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13268,25 +13268,25 @@ flow_dv_action_create(struct rte_eth_dev *dev,
*/
static int
flow_dv_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
int ret;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
return __flow_dv_action_rss_release(dev, idx, error);
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
ret = flow_dv_aso_age_release(dev, idx);
if (ret)
/*
* In this case, the last flow has a reference will
* actually release the age action.
*/
- DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+ DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
" released with references %d.", idx, ret);
return 0;
default:
@@ -13369,12 +13369,13 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be updated.
- * @param[in] action_conf
- * Action specification used to modify *action*.
- * *action_conf* should be of type correlating with type of the *action*,
- * otherwise considered as invalid.
+ * @param[in] handle
+ * The indirect action object handle to be updated.
+ * @param[in] update
+ * Action specification used to modify the action pointed by *handle*.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13384,16 +13385,18 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*/
static int
flow_dv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *err)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ const void *action_conf;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
+ action_conf = ((const struct rte_flow_action *)update)->conf;
return __flow_dv_action_rss_update(dev, idx, action_conf, err);
default:
return rte_flow_error_set(err, ENOTSUP,
@@ -13405,17 +13408,17 @@ flow_dv_action_update(struct rte_eth_dev *dev,
static int
flow_dv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action, void *data,
+ const struct rte_flow_action_handle *handle, void *data,
struct rte_flow_error *error)
{
struct mlx5_age_param *age_param;
struct rte_flow_query_age *resp;
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
resp = data;
resp->aged = __atomic_load_n(&age_param->state,
@@ -14347,7 +14350,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
}
/**
- * Validate shared action.
+ * Validate indirect action.
* Dispatcher for action type specific validation.
*
* @param[in] dev
@@ -14355,7 +14358,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * The shared action object to validate.
+ * The indirect action object to validate.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -14365,7 +14368,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
*/
static int
flow_dv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 7241f00..0d2610b 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -180,12 +180,12 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(MODIFY_FIELD,
sizeof(struct rte_flow_action_modify_field)),
/**
- * Shared action represented as handle of type
- * (struct rte_flow_shared action *) stored in conf field (see
+ * Indirect action represented as handle of type
+ * (struct rte_flow_action_handle *) stored in conf field (see
* struct rte_flow_action); no need for additional structure to * store
- * shared action handle.
+ * indirect action handle.
*/
- MK_FLOW_ACTION(SHARED, 0),
+ MK_FLOW_ACTION(INDIRECT, 0),
};
int
@@ -1068,53 +1068,53 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1122,18 +1122,18 @@ rte_flow_shared_action_update(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1142,11 +1142,11 @@ rte_flow_shared_action_query(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 203c4cd..0447d36 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
* Enables counters for this flow rule.
*
* These counters can be retrieved and reset through rte_flow_query() or
- * rte_flow_shared_action_query() if the action provided via handle,
+ * rte_flow_action_handle_query() if the action provided via handle,
* see struct rte_flow_query_count.
*
* See struct rte_flow_action_count.
@@ -2250,6 +2250,9 @@ enum rte_flow_action_type {
RTE_FLOW_ACTION_TYPE_SAMPLE,
/**
+ * @deprecated
+ * @see RTE_FLOW_ACTION_TYPE_INDIRECT
+ *
* Describe action shared across multiple flow rules.
*
* Allow multiple rules reference the same action by handle (see
@@ -2267,6 +2270,14 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * An action handle is referenced in a rule through an indirect action.
+ *
+ * The same action handle may be used in multiple rules for the same
+ * or different ethdev ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2357,7 +2368,7 @@ struct rte_flow_query_age {
* ``struct rte_flow_query_count``.
*
* @deprecated Shared attribute is deprecated, use generic
- * RTE_FLOW_ACTION_TYPE_SHARED action.
+ * RTE_FLOW_ACTION_TYPE_INDIRECT action.
*
* The shared flag indicates whether the counter is unique to the flow rule the
* action is specified with, or whether it is a shared counter.
@@ -2847,17 +2858,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle is different per driver or
+ * per direct action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related direct action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3631,25 +3648,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3658,16 +3672,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used in flow rules
+ * via its handle.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3681,9 +3696,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3691,12 +3706,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3711,27 +3726,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3742,32 +3760,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the direct action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3779,10 +3797,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index 6ae1f8c..46f62c2 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -84,27 +84,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388..4eb561a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
2.5.5
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
` (3 preceding siblings ...)
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
@ 2021-04-19 14:38 ` Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs Bing Zhao
4 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-19 14:38 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
The patch set includes:
1. API changes
2. testpmd adaption and guide update
3. driver update (only net/mlx5 is impacted)
4. rte_flow documentation update
---
v2: add adaptions of testpmd and driver part
v3: squash all patches into one and update rte_flow doc
v4: fix the doc format error
v5: deprecate "RTE_FLOW_ACTION_TYPE_SHARED" and update description
---
Bing Zhao (1):
ethdev: introduce indirect action APIs
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 29 +--
doc/guides/rel_notes/release_21_05.rst | 7 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 106 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 119 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 602 insertions(+), 566 deletions(-)
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
@ 2021-04-19 14:38 ` Bing Zhao
2021-04-19 14:50 ` Thomas Monjalon
0 siblings, 1 reply; 46+ messages in thread
From: Bing Zhao @ 2021-04-19 14:38 UTC (permalink / raw)
To: orika, thomas, ferruh.yigit, andrew.rybchenko, matan, viacheslavo
Cc: dev, ajit.khaparde, getelson, andreyv
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
app/test-pmd/cmdline.c | 24 +-
app/test-pmd/cmdline_flow.c | 252 ++++++++++----------
app/test-pmd/config.c | 160 ++++++-------
app/test-pmd/testpmd.h | 28 +--
doc/guides/prog_guide/rte_flow.rst | 29 +--
doc/guides/rel_notes/release_21_05.rst | 7 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 106 ++++----
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mlx5/mlx5_defs.h | 4 +-
drivers/net/mlx5/mlx5_flow.c | 238 +++++++++---------
drivers/net/mlx5/mlx5_flow.h | 24 +-
drivers/net/mlx5/mlx5_flow_dv.c | 85 +++----
lib/librte_ethdev/rte_flow.c | 56 ++---
lib/librte_ethdev/rte_flow.h | 119 +++++----
lib/librte_ethdev/rte_flow_driver.h | 26 +-
lib/librte_ethdev/version.map | 8 +-
16 files changed, 602 insertions(+), 566 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5bf1497f2b..4d9e038ce8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0127d9e7d6..c5381c638b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -112,21 +112,21 @@ enum index {
DUMP_ALL,
DUMP_ONE,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -416,8 +416,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -778,10 +778,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -841,12 +841,12 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
@@ -856,11 +856,11 @@ static const enum index next_dump_subcmd[] = {
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -900,8 +900,8 @@ static const enum index next_aged_attr[] = {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1380,7 +1380,7 @@ static const enum index next_action[] = {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1797,13 +1797,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1950,10 +1950,10 @@ static const struct token token_list[] = {
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1963,7 +1963,7 @@ static const struct token token_list[] = {
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1977,42 +1977,42 @@ static const struct token token_list[] = {
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4498,61 +4498,61 @@ static const struct token token_list[] = {
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4739,9 +4739,9 @@ parse_init(struct context *ctx, const struct token *token,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4754,7 +4754,7 @@ parse_sa(struct context *ctx, const struct token *token,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4766,26 +4766,26 @@ parse_sa(struct context *ctx, const struct token *token,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4794,9 +4794,9 @@ parse_sa(struct context *ctx, const struct token *token,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4809,8 +4809,8 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4818,13 +4818,13 @@ parse_sa_destroy(struct context *ctx, const struct token *token,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7102,7 +7102,7 @@ parse_port(struct context *ctx, const struct token *token,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7119,9 +7119,9 @@ parse_sa_id2ptr(struct context *ctx, const struct token *token,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7659,27 +7659,27 @@ static void
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d4b0e850f5..868ff3469b 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1391,38 +1391,38 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1433,7 +1433,7 @@ action_alloc(portid_t port_id, uint32_t id,
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1442,70 +1442,70 @@ action_alloc(portid_t port_id, uint32_t id,
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1519,9 +1519,9 @@ port_shared_action_destroy(portid_t port_id,
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1529,14 +1529,14 @@ port_shared_action_destroy(portid_t port_id,
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1547,60 +1547,60 @@ port_shared_action_destroy(portid_t port_id,
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1622,8 +1622,8 @@ port_shared_action_query(portid_t port_id, uint32_t id)
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2065,7 +2065,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2115,11 +2115,11 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 36d8535d0c..c314b30f2e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index e1b93ecedf..4b54588995 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1719,7 +1719,7 @@ that counter.
For ports within the same switch domain then the counter id namespace extends
to all ports within that switch domain.
-The shared flag is DEPRECATED and ``SHARED`` ``COUNT`` action should be used
+The shared flag is DEPRECATED and ``INDIRECT`` ``COUNT`` action should be used
to make shared counters.
.. _table_rte_flow_action_count:
@@ -2742,25 +2742,26 @@ packets, and must have a fate action.
| ``actions`` | sub-action list for sampling |
+--------------+---------------------------------+
-Action: ``SHARED``
-^^^^^^^^^^^^^^^^^^
+Action: ``INDIRECT``
+^^^^^^^^^^^^^^^^^^^^
-Flow utilize shared action by handle as returned from
-``rte_flow_shared_action_create()``.
+Flow utilize indirect action by handle as returned from
+``rte_flow_action_handle_create()``.
-The behaviour of the shared action defined by ``action`` argument of type
-``struct rte_flow_action`` passed to ``rte_flow_shared_action_create()``.
+The behaviour of the indirect action defined by ``action`` argument of type
+``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
-Multiple flows can use the same shared action.
-The shared action can be in-place updated by ``rte_flow_shared_action_update()``
-without destroying flow and creating flow again.
+The indirect action can be used by a single flow or shared among multiple flows.
+The indirect action can be in-place updated by ``rte_flow_action_handle_update()``
+without destroying flow and creating flow again. The fields that could be
+updated depend on the type of the ``action`` and different for every type.
-The shared action specified data (e.g. counter) can be queried by
-``rte_flow_shared_action_query()``.
+The indirect action specified data (e.g. counter) can be queried by
+``rte_flow_action_handle_query()``.
-.. _table_rte_flow_shared_action:
+.. _table_rte_flow_action_handle:
-.. table:: SHARED
+.. table:: INDIRECT
+---------------+
| Field |
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 1c2e093294..8913dd4f9c 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -270,6 +270,13 @@ API Changes
``rte_cryptodev_raw_dequeue_burst`` got a new parameter
``max_nb_to_dequeue`` to provide flexible control on dequeue.
+* ethdev: The experimental flow API for shared action has been generalized
+ as a flow action handle used in rules through an indirect action.
+ The functions ``rte_flow_shared_action_*`` manipulating the action object
+ are replaced with ``rte_flow_action_handle_*``.
+ The action ``RTE_FLOW_ACTION_TYPE_SHARED`` is deprecated and can be
+ replaced with ``RTE_FLOW_ACTION_TYPE_INDIRECT``.
+
ABI Changes
-----------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a736e7d6e5..715e209fd2 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4055,10 +4055,10 @@ This section lists supported actions and their attributes, if any.
- ``dscp_value {unsigned}``: The new DSCP value to be set
-- ``shared``: Use shared action created via
- ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+ ``flow indirect_action {port_id} create``
- - ``shared_action_id {unsigned}``: Shared action ID to use
+ - ``indirect_action_id {unsigned}``: Indirect action ID to use
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
@@ -4349,113 +4349,117 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
testpmd> flow aged 0
Port 0 total aged flows: 0
-Creating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+Creating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
- flow shared_action {port_id} create [action_id {shared_action_id}]
+ flow indirect_action {port_id} create [action_id {indirect_action_id}]
[ingress] [egress] [transfer] action {action} / end
If successful, it will show::
- Shared action #[...] created
+ Indirect action #[...] created
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
some error occurred::
- Shared action #[...] is already assigned, delete it first
+ Indirect action #[...] is already assigned, delete it first
::
Caught error type [...] ([...]): [...]
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
- testpmd> flow shared_action 0 create action_id 100 \
+ testpmd> flow indirect_action 0 create action_id 100 \
ingress action rss queues 1 2 end / end
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
port 0::
- testpmd> flow shared_action 0 create action_id \
+ testpmd> flow indirect_action 0 create action_id \
ingress action rss queues 0 1 end / end
-Updating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
- flow shared_action {port_id} update {shared_action_id}
+ flow indirect_action {port_id} update {indirect_action_id}
action {action} / end
If successful, it will show::
- Shared action #[...] updated
+ Indirect action #[...] updated
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
(in create example above rss queues were 1 and 2)::
- testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+ testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
-Destroying shared actions
-~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
- flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+ flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
If successful, it will show::
- Shared action #[...] destroyed
+ Indirect action #[...] destroyed
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
Caught error type [...] ([...]): [...]
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
- testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+ testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
-Query shared actions
-~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+Query indirect actions
+~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ Indirect RSS action:
refs:[...]
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
error occurred::
- Failed to find shared action #[...] on port [...]
+ Failed to find indirect action #[...] on port [...]
::
Caught error type [...] ([...]): [...]
-Query shared action having id 100::
+Query indirect action having id 100::
- testpmd> flow shared_action 0 query 100
+ testpmd> flow indirect_action 0 query 100
Sample QinQ flow rules
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index fcaba2d9c7..7e13b38ee0 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1421,7 +1421,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
* then this will return directly without any action.
*/
mlx5_flow_list_flush(dev, &priv->flows, true);
- mlx5_shared_action_flush(dev);
+ mlx5_action_handle_flush(dev);
mlx5_flow_meter_flush(dev, NULL);
/* Prevent crashes when queues are still in use. */
dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807dcd9..6e9c4b9cdd 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
/*
* Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d8e0bcbd02..bed8f3190b 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -567,23 +567,23 @@ static const struct mlx5_flow_expand_node mlx5_support_expansion[] = {
},
};
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
static int
@@ -622,10 +622,10 @@ static const struct rte_flow_ops mlx5_flow_ops = {
.query = mlx5_flow_query,
.dev_dump = mlx5_flow_dev_dump,
.get_aged_flows = mlx5_flow_get_aged_flows,
- .shared_action_create = mlx5_shared_action_create,
- .shared_action_destroy = mlx5_shared_action_destroy,
- .shared_action_update = mlx5_shared_action_update,
- .shared_action_query = mlx5_shared_action_query,
+ .action_handle_create = mlx5_action_handle_create,
+ .action_handle_destroy = mlx5_action_handle_destroy,
+ .action_handle_update = mlx5_action_handle_update,
+ .action_handle_query = mlx5_action_handle_query,
.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
.tunnel_match = mlx5_flow_tunnel_match,
.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3402,31 +3402,31 @@ flow_aso_age_get_by_idx(struct rte_eth_dev *dev, uint32_t age_idx)
return &pool->actions[offset - 1];
}
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
- struct rte_flow_shared_action *action; /**< Shared action */
- int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+ struct rte_flow_action_handle *action; /**< Indirect action handle. */
+ int index; /**< Index in related array of rte_flow_action. */
};
/**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
* from this call.
*
* @param[in] dev
* Pointer to Ethernet device.
* @param[in] actions
* List of actions to translate.
- * @param[out] shared
- * List to store translated shared actions.
- * @param[in, out] shared_n
- * Size of *shared* array. On return should be updated with number of shared
- * actions retrieved from the *actions* list.
+ * @param[out] handle
+ * List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ * Size of *handle* array. On return should be updated with number of
+ * indirect actions retrieved from the *actions* list.
* @param[out] translated_actions
- * List of actions where all shared actions were translated to non shared
+ * List of actions where all indirect actions were translated to direct
* if possible. NULL if no translation took place.
* @param[out] error
* Pointer to the error structure.
@@ -3435,10 +3435,10 @@ struct mlx5_translated_shared_action {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
- struct mlx5_translated_shared_action *shared,
- int *shared_n,
+ struct mlx5_translated_action_handle *handle,
+ int *indir_n,
struct rte_flow_action **translated_actions,
struct rte_flow_error *error)
{
@@ -3447,23 +3447,23 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
size_t actions_size;
int n;
int copied_n = 0;
- struct mlx5_translated_shared_action *shared_end = NULL;
+ struct mlx5_translated_action_handle *handle_end = NULL;
for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
- if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+ if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
continue;
- if (copied_n == *shared_n) {
+ if (copied_n == *indir_n) {
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
NULL, "too many shared actions");
}
- rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+ rte_memcpy(&handle[copied_n].action, &actions[n].conf,
sizeof(actions[n].conf));
- shared[copied_n].index = n;
+ handle[copied_n].index = n;
copied_n++;
}
n++;
- *shared_n = copied_n;
+ *indir_n = copied_n;
if (!copied_n)
return 0;
actions_size = sizeof(struct rte_flow_action) * n;
@@ -3473,28 +3473,28 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
return -ENOMEM;
}
memcpy(translated, actions, actions_size);
- for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+ for (handle_end = handle + copied_n; handle < handle_end; handle++) {
struct mlx5_shared_action_rss *shared_rss;
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
- - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx &
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
- translated[shared->index].type =
+ translated[handle->index].type =
RTE_FLOW_ACTION_TYPE_RSS;
- translated[shared->index].conf =
+ translated[handle->index].conf =
&shared_rss->origin;
break;
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
if (priv->sh->flow_hit_aso_en) {
- translated[shared->index].type =
+ translated[handle->index].type =
(enum rte_flow_action_type)
MLX5_RTE_FLOW_ACTION_TYPE_AGE;
- translated[shared->index].conf =
+ translated[handle->index].conf =
(void *)(uintptr_t)idx;
break;
}
@@ -3503,7 +3503,7 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
mlx5_free(translated);
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "invalid shared action type");
+ NULL, "invalid indirect action type");
}
}
*translated_actions = translated;
@@ -3525,21 +3525,21 @@ flow_shared_actions_translate(struct rte_eth_dev *dev,
*/
static uint32_t
flow_get_shared_rss_action(struct rte_eth_dev *dev,
- struct mlx5_translated_shared_action *shared,
+ struct mlx5_translated_action_handle *handle,
int shared_n)
{
- struct mlx5_translated_shared_action *shared_end;
+ struct mlx5_translated_action_handle *handle_end;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_shared_action_rss *shared_rss;
- for (shared_end = shared + shared_n; shared < shared_end; shared++) {
- uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+ for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
uint32_t idx = act_idx &
- ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
shared_rss = mlx5_ipool_get
(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
idx);
@@ -5664,9 +5664,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
struct rte_flow *flow = NULL;
struct mlx5_flow *dev_flow;
const struct rte_flow_action_rss *rss = NULL;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
union {
struct mlx5_flow_expand_rss buf;
uint8_t buffer[2048];
@@ -5707,9 +5707,9 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
MLX5_ASSERT(wks);
rss_desc = &wks->rss_desc;
- ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret < 0) {
MLX5_ASSERT(translated_actions == NULL);
@@ -5770,8 +5770,8 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
buf->entries = 1;
buf->entry[0].pattern = (void *)(uintptr_t)items;
}
- rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
- shared_actions_n);
+ rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+ indir_actions_n);
for (i = 0; i < buf->entries; ++i) {
/* Initialize flow split data. */
flow_split_info.prefix_layers = 0;
@@ -5950,14 +5950,14 @@ mlx5_flow_validate(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
int hairpin_flow;
- struct mlx5_translated_shared_action
- shared_actions[MLX5_MAX_SHARED_ACTIONS];
- int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+ struct mlx5_translated_action_handle
+ indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+ int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
const struct rte_flow_action *actions;
struct rte_flow_action *translated_actions = NULL;
- int ret = flow_shared_actions_translate(dev, original_actions,
- shared_actions,
- &shared_actions_n,
+ int ret = flow_action_handles_translate(dev, original_actions,
+ indir_actions,
+ &indir_actions_n,
&translated_actions, error);
if (ret)
@@ -7391,12 +7391,12 @@ mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
/* Wrapper for driver action_validate op callback */
static int
flow_drv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action validation unsupported";
+ static const char err_msg[] = "indirect action validation unsupported";
if (!fops->action_validate) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7412,8 +7412,8 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7424,11 +7424,11 @@ flow_drv_action_validate(struct rte_eth_dev *dev,
* @note: wrapper for driver action_create op callback.
*/
static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action destruction unsupported";
+ static const char err_msg[] = "indirect action destruction unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7439,18 +7439,18 @@ mlx5_shared_action_destroy(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_destroy(dev, action, error);
+ return fops->action_destroy(dev, handle, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action update unsupported";
+ static const char err_msg[] = "indirect action update unsupported";
if (!fops->action_update) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7458,18 +7458,18 @@ flow_drv_action_update(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_update(dev, action, action_conf, error);
+ return fops->action_update(dev, handle, update, error);
}
/* Wrapper for driver action_destroy op callback */
static int
flow_drv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *handle,
void *data,
const struct mlx5_flow_driver_ops *fops,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action query unsupported";
+ static const char err_msg[] = "indirect action query unsupported";
if (!fops->action_query) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7477,29 +7477,31 @@ flow_drv_action_query(struct rte_eth_dev *dev,
NULL, err_msg);
return -rte_errno;
}
- return fops->action_query(dev, action, data, error);
+ return fops->action_query(dev, handle, data, error);
}
/**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param conf
+ * Pointer to indirect action object configuration.
* @param[in] action
- * Action configuration for shared action creation.
+ * Action configuration for indirect action object creation.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
* @return
* A valid handle in case of success, NULL otherwise and rte_errno is set.
*/
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- static const char err_msg[] = "shared action creation unsupported";
+ static const char err_msg[] = "indirect action creation unsupported";
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7516,19 +7518,20 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
}
/**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] shared_action
- * Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ * Handle for the indirect action to be updated.
+ * @param[in] update
* Action specification used to modify the action pointed by handle.
- * *action* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -7537,9 +7540,9 @@ mlx5_shared_action_create(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
struct rte_flow_attr attr = { .transfer = 0 };
@@ -7547,26 +7550,27 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
int ret;
- ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+ ret = flow_drv_action_validate(dev, NULL,
+ (const struct rte_flow_action *)update, fops, error);
if (ret)
return ret;
- return flow_drv_action_update(dev, shared_action, action->conf, fops,
+ return flow_drv_action_update(dev, handle, update, fops,
error);
}
/**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
*
* This function allows retrieving action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
*
* @param dev
* Pointer to Ethernet device structure.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the indirect action to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -7577,8 +7581,8 @@ mlx5_shared_action_update(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -7586,11 +7590,11 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
- return flow_drv_action_query(dev, action, data, fops, error);
+ return flow_drv_action_query(dev, handle, data, fops, error);
}
/**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
*
* @param dev
* Pointer to Ethernet device.
@@ -7599,7 +7603,7 @@ mlx5_shared_action_query(struct rte_eth_dev *dev,
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
{
struct rte_flow_error error;
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7609,8 +7613,8 @@ mlx5_shared_action_flush(struct rte_eth_dev *dev)
ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
priv->rss_shared_actions, idx, shared_rss, next) {
- ret |= mlx5_shared_action_destroy(dev,
- (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+ ret |= mlx5_action_handle_destroy(dev,
+ (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
}
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index a5b08024e7..1a74b17aa3 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -38,11 +38,11 @@ enum mlx5_rte_flow_action_type {
MLX5_RTE_FLOW_ACTION_TYPE_AGE,
};
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
enum {
- MLX5_SHARED_ACTION_TYPE_RSS,
- MLX5_SHARED_ACTION_TYPE_AGE,
+ MLX5_INDIRECT_ACTION_TYPE_RSS,
+ MLX5_INDIRECT_ACTION_TYPE_AGE,
};
/* Matches on selected register. */
@@ -1037,7 +1037,7 @@ struct mlx5_shared_action_rss {
rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
};
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
uint32_t id;
};
@@ -1123,26 +1123,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_validate_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_destroy_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *action,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_update_t)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *action,
+ const void *update,
struct rte_flow_error *error);
typedef int (*mlx5_flow_action_query_t)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action,
+ const struct rte_flow_action_handle *action,
void *data,
struct rte_flow_error *error);
typedef int (*mlx5_flow_sync_domain_t)
@@ -1400,7 +1400,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
struct rte_mtr_error *error);
int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index b443eb95f7..ffd9f638c7 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -13059,7 +13059,7 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev,
*/
static uint32_t
__flow_dv_action_rss_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action_rss *rss,
struct rte_flow_error *error)
{
@@ -13082,7 +13082,7 @@ __flow_dv_action_rss_create(struct rte_eth_dev *dev,
"cannot allocate resource memory");
goto error_rss_init;
}
- if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+ if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
rte_flow_error_set(error, E2BIG,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"rss action number out of range");
@@ -13195,7 +13195,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
}
/**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
* (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
@@ -13204,7 +13204,7 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * Action specification used to create shared action.
+ * Action specification used to create indirect action.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13213,9 +13213,9 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,
* A valid shared action handle in case of success, NULL otherwise and
* rte_errno is set.
*/
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
flow_dv_action_create(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
@@ -13225,13 +13225,13 @@ flow_dv_action_create(struct rte_eth_dev *dev,
switch (action->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
break;
case RTE_FLOW_ACTION_TYPE_AGE:
ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
- idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
- MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+ idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+ MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
if (ret) {
struct mlx5_aso_age_action *aso_age =
flow_aso_age_get_by_idx(dev, ret);
@@ -13246,19 +13246,19 @@ flow_dv_action_create(struct rte_eth_dev *dev,
NULL, "action type not supported");
break;
}
- return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+ return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
}
/**
- * Destroy the shared action.
+ * Destroy the indirect action.
* Release action related resources on the NIC and the memory.
* Lock free, (mutex should be acquired by caller).
* Dispatcher for action type specific call.
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be removed.
+ * @param[in] handle
+ * The indirect action object handle to be removed.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13268,25 +13268,25 @@ flow_dv_action_create(struct rte_eth_dev *dev,
*/
static int
flow_dv_action_destroy(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
int ret;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
return __flow_dv_action_rss_release(dev, idx, error);
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
ret = flow_dv_aso_age_release(dev, idx);
if (ret)
/*
* In this case, the last flow has a reference will
* actually release the age action.
*/
- DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+ DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
" released with references %d.", idx, ret);
return 0;
default:
@@ -13369,12 +13369,13 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*
* @param[in] dev
* Pointer to the Ethernet device structure.
- * @param[in] action
- * The shared action object to be updated.
- * @param[in] action_conf
- * Action specification used to modify *action*.
- * *action_conf* should be of type correlating with type of the *action*,
- * otherwise considered as invalid.
+ * @param[in] handle
+ * The indirect action object handle to be updated.
+ * @param[in] update
+ * Action specification used to modify the action pointed by *handle*.
+ * *update* could be of same type with the action pointed by the *handle*
+ * handle argument, or some other structures like a wrapper, depending on
+ * the indirect action type.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -13384,16 +13385,18 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx,
*/
static int
flow_dv_action_update(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *action,
- const void *action_conf,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *err)
{
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ const void *action_conf;
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_RSS:
+ case MLX5_INDIRECT_ACTION_TYPE_RSS:
+ action_conf = ((const struct rte_flow_action *)update)->conf;
return __flow_dv_action_rss_update(dev, idx, action_conf, err);
default:
return rte_flow_error_set(err, ENOTSUP,
@@ -13405,17 +13408,17 @@ flow_dv_action_update(struct rte_eth_dev *dev,
static int
flow_dv_action_query(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *action, void *data,
+ const struct rte_flow_action_handle *handle, void *data,
struct rte_flow_error *error)
{
struct mlx5_age_param *age_param;
struct rte_flow_query_age *resp;
- uint32_t act_idx = (uint32_t)(uintptr_t)action;
- uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
- uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+ uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+ uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
switch (type) {
- case MLX5_SHARED_ACTION_TYPE_AGE:
+ case MLX5_INDIRECT_ACTION_TYPE_AGE:
age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
resp = data;
resp->aged = __atomic_load_n(&age_param->state,
@@ -14347,7 +14350,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
}
/**
- * Validate shared action.
+ * Validate indirect action.
* Dispatcher for action type specific validation.
*
* @param[in] dev
@@ -14355,7 +14358,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
* @param[in] conf
* Shared action configuration.
* @param[in] action
- * The shared action object to validate.
+ * The indirect action object to validate.
* @param[out] error
* Perform verbose error reporting if not NULL. Initialized in case of
* error only.
@@ -14365,7 +14368,7 @@ flow_dv_counter_allocate(struct rte_eth_dev *dev)
*/
static int
flow_dv_action_validate(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *err)
{
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 7241f00353..0d2610b7c4 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -180,12 +180,12 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(MODIFY_FIELD,
sizeof(struct rte_flow_action_modify_field)),
/**
- * Shared action represented as handle of type
- * (struct rte_flow_shared action *) stored in conf field (see
+ * Indirect action represented as handle of type
+ * (struct rte_flow_action_handle *) stored in conf field (see
* struct rte_flow_action); no need for additional structure to * store
- * shared action handle.
+ * indirect action handle.
*/
- MK_FLOW_ACTION(SHARED, 0),
+ MK_FLOW_ACTION(INDIRECT, 0),
};
int
@@ -1068,53 +1068,53 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
NULL, rte_strerror(ENOTSUP));
}
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error)
{
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *handle;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return NULL;
- if (unlikely(!ops->shared_action_create)) {
+ if (unlikely(!ops->action_handle_create)) {
rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
rte_strerror(ENOSYS));
return NULL;
}
- shared_action = ops->shared_action_create(&rte_eth_devices[port_id],
- conf, action, error);
- if (shared_action == NULL)
+ handle = ops->action_handle_create(&rte_eth_devices[port_id],
+ conf, action, error);
+ if (handle == NULL)
flow_err(port_id, -rte_errno, error);
- return shared_action;
+ return handle;
}
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
- struct rte_flow_error *error)
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ struct rte_flow_error *error)
{
int ret;
const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_destroy))
+ if (unlikely(!ops->action_handle_destroy))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_destroy(&rte_eth_devices[port_id], action,
- error);
+ ret = ops->action_handle_destroy(&rte_eth_devices[port_id],
+ handle, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error)
{
int ret;
@@ -1122,18 +1122,18 @@ rte_flow_shared_action_update(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_update))
+ if (unlikely(!ops->action_handle_update))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_update(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_update(&rte_eth_devices[port_id], handle,
update, error);
return flow_err(port_id, ret, error);
}
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error)
{
@@ -1142,11 +1142,11 @@ rte_flow_shared_action_query(uint16_t port_id,
if (unlikely(!ops))
return -rte_errno;
- if (unlikely(!ops->shared_action_query))
+ if (unlikely(!ops->action_handle_query))
return rte_flow_error_set(error, ENOSYS,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, rte_strerror(ENOSYS));
- ret = ops->shared_action_query(&rte_eth_devices[port_id], action,
+ ret = ops->action_handle_query(&rte_eth_devices[port_id], handle,
data, error);
return flow_err(port_id, ret, error);
}
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 203c4cde9a..0447d36002 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1821,7 +1821,7 @@ enum rte_flow_action_type {
* Enables counters for this flow rule.
*
* These counters can be retrieved and reset through rte_flow_query() or
- * rte_flow_shared_action_query() if the action provided via handle,
+ * rte_flow_action_handle_query() if the action provided via handle,
* see struct rte_flow_query_count.
*
* See struct rte_flow_action_count.
@@ -2250,6 +2250,9 @@ enum rte_flow_action_type {
RTE_FLOW_ACTION_TYPE_SAMPLE,
/**
+ * @deprecated
+ * @see RTE_FLOW_ACTION_TYPE_INDIRECT
+ *
* Describe action shared across multiple flow rules.
*
* Allow multiple rules reference the same action by handle (see
@@ -2267,6 +2270,14 @@ enum rte_flow_action_type {
* See struct rte_flow_action_modify_field.
*/
RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
+
+ /**
+ * An action handle is referenced in a rule through an indirect action.
+ *
+ * The same action handle may be used in multiple rules for the same
+ * or different ethdev ports.
+ */
+ RTE_FLOW_ACTION_TYPE_INDIRECT,
};
/**
@@ -2357,7 +2368,7 @@ struct rte_flow_query_age {
* ``struct rte_flow_query_count``.
*
* @deprecated Shared attribute is deprecated, use generic
- * RTE_FLOW_ACTION_TYPE_SHARED action.
+ * RTE_FLOW_ACTION_TYPE_INDIRECT action.
*
* The shared flag indicates whether the counter is unique to the flow rule the
* action is specified with, or whether it is a shared counter.
@@ -2847,17 +2858,23 @@ struct rte_flow_action_set_dscp {
};
/**
- * RTE_FLOW_ACTION_TYPE_SHARED
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_INDIRECT
*
- * Opaque type returned after successfully creating a shared action.
+ * Opaque type returned after successfully creating an indirect action object.
+ * The definition of the object handle is different per driver or
+ * per direct action type.
*
- * This handle can be used to manage and query the related action:
- * - share it across multiple flow rules
- * - update action configuration
- * - query action data
- * - destroy action
+ * This handle can be used to manage and query the related direct action:
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/
-struct rte_flow_shared_action;
+struct rte_flow_action_handle;
/**
* Field IDs for MODIFY_FIELD action.
@@ -3631,25 +3648,22 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
uint32_t nb_contexts, struct rte_flow_error *error);
/**
- * Specify shared action configuration
+ * Specify indirect action object configuration
*/
-struct rte_flow_shared_action_conf {
+struct rte_flow_indir_action_conf {
/**
- * Flow direction for shared action configuration.
+ * Flow direction for the indirect action configuration.
*
- * Shared action should be valid at least for one flow direction,
+ * Action should be valid at least for one flow direction,
* otherwise it is invalid for both ingress and egress rules.
*/
uint32_t ingress:1;
/**< Action valid for rules applied to ingress traffic. */
uint32_t egress:1;
/**< Action valid for rules applied to egress traffic. */
-
/**
* When set to 1, indicates that the action is valid for
* transfer traffic; otherwise, for non-transfer traffic.
- *
- * See struct rte_flow_attr.
*/
uint32_t transfer:1;
};
@@ -3658,16 +3672,17 @@ struct rte_flow_shared_action_conf {
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Create shared action for reuse in multiple flow rules.
- * The created shared action has single state and configuration
- * across all flow rules using it.
+ * Create an indirect action object that can be used in flow rules
+ * via its handle.
+ * The created object handle has single state and configuration
+ * across all the flow rules using it.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
* @param[in] conf
- * Shared action configuration.
+ * Action configuration for the indirect action object creation.
* @param[in] action
- * Action configuration for shared action creation.
+ * Specific configuration of the indirect action object.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3681,9 +3696,9 @@ struct rte_flow_shared_action_conf {
* - (ENOTSUP) if *action* valid but unsupported.
*/
__rte_experimental
-struct rte_flow_shared_action *
-rte_flow_shared_action_create(uint16_t port_id,
- const struct rte_flow_shared_action_conf *conf,
+struct rte_flow_action_handle *
+rte_flow_action_handle_create(uint16_t port_id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
@@ -3691,12 +3706,12 @@ rte_flow_shared_action_create(uint16_t port_id,
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Destroy the shared action by handle.
+ * Destroy indirect action by handle.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be destroyed.
+ * @param[in] handle
+ * Handle for the indirect action object to be destroyed.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3711,27 +3726,30 @@ rte_flow_shared_action_create(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_destroy(uint16_t port_id,
- struct rte_flow_shared_action *action,
+rte_flow_action_handle_destroy(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Update in-place the shared action configuration pointed by *action* handle
- * with the configuration provided as *update* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Update in-place the action configuration and / or state pointed
+ * by action *handle* with the configuration provided as *update* argument.
+ * The update of the action configuration effects all flow rules reusing
+ * the action via *handle*.
+ * The update general pointer provides the ability of partial updating.
*
* @param[in] port_id
* The port identifier of the Ethernet device.
- * @param[in] action
- * Handle for the shared action to be updated.
+ * @param[in] handle
+ * Handle for the indirect action object to be updated.
* @param[in] update
- * Action specification used to modify the action pointed by handle.
- * *update* should be of same type with the action pointed by the *action*
- * handle argument, otherwise considered as invalid.
+ * Update profile specification used to modify the action pointed by handle.
+ * *update* could be with the same type of the immediate action corresponding
+ * to the *handle* argument when creating, or a wrapper structure includes
+ * action configuration to be updated and bit fields to indicate the member
+ * of fields inside the action to update.
* @param[out] error
* Perform verbose error reporting if not NULL. PMDs initialize this
* structure in case of error only.
@@ -3742,32 +3760,32 @@ rte_flow_shared_action_destroy(uint16_t port_id,
* - (-EIO) if underlying device is removed.
* - (-EINVAL) if *update* invalid.
* - (-ENOTSUP) if *update* valid but unsupported.
- * - (-ENOENT) if action pointed by *ctx* was not found.
+ * - (-ENOENT) if indirect action object pointed by *handle* was not found.
* rte_errno is also set.
*/
__rte_experimental
int
-rte_flow_shared_action_update(uint16_t port_id,
- struct rte_flow_shared_action *action,
- const struct rte_flow_action *update,
+rte_flow_action_handle_update(uint16_t port_id,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
*
- * Query the shared action by handle.
+ * Query the direct action by corresponding indirect action object handle.
*
* Retrieve action-specific data such as counters.
* Data is gathered by special action which may be present/referenced in
* more than one flow rule definition.
*
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * @see RTE_FLOW_ACTION_TYPE_COUNT
*
* @param port_id
* Port identifier of Ethernet device.
- * @param[in] action
- * Handle for the shared action to query.
+ * @param[in] handle
+ * Handle for the action object to query.
* @param[in, out] data
* Pointer to storage for the associated query data type.
* @param[out] error
@@ -3779,10 +3797,9 @@ rte_flow_shared_action_update(uint16_t port_id,
*/
__rte_experimental
int
-rte_flow_shared_action_query(uint16_t port_id,
- const struct rte_flow_shared_action *action,
- void *data,
- struct rte_flow_error *error);
+rte_flow_action_handle_query(uint16_t port_id,
+ const struct rte_flow_action_handle *handle,
+ void *data, struct rte_flow_error *error);
/* Tunnel has a type and the key information. */
struct rte_flow_tunnel {
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index 6ae1f8c264..46f62c2ec2 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -84,27 +84,27 @@ struct rte_flow_ops {
void **context,
uint32_t nb_contexts,
struct rte_flow_error *err);
- /** See rte_flow_shared_action_create() */
- struct rte_flow_shared_action *(*shared_action_create)
+ /** See rte_flow_action_handle_create() */
+ struct rte_flow_action_handle *(*action_handle_create)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action_conf *conf,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_destroy() */
- int (*shared_action_destroy)
+ /** See rte_flow_action_handle_destroy() */
+ int (*action_handle_destroy)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
+ struct rte_flow_action_handle *handle,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_update() */
- int (*shared_action_update)
+ /** See rte_flow_action_handle_update() */
+ int (*action_handle_update)
(struct rte_eth_dev *dev,
- struct rte_flow_shared_action *shared_action,
- const struct rte_flow_action *update,
+ struct rte_flow_action_handle *handle,
+ const void *update,
struct rte_flow_error *error);
- /** See rte_flow_shared_action_query() */
- int (*shared_action_query)
+ /** See rte_flow_action_handle_query() */
+ int (*action_handle_query)
(struct rte_eth_dev *dev,
- const struct rte_flow_shared_action *shared_action,
+ const struct rte_flow_action_handle *handle,
void *data,
struct rte_flow_error *error);
/** See rte_flow_tunnel_decap_set() */
diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map
index 93ad388e96..4eb561a89a 100644
--- a/lib/librte_ethdev/version.map
+++ b/lib/librte_ethdev/version.map
@@ -231,10 +231,6 @@ EXPERIMENTAL {
rte_eth_fec_get_capability;
rte_eth_fec_get;
rte_eth_fec_set;
- rte_flow_shared_action_create;
- rte_flow_shared_action_destroy;
- rte_flow_shared_action_query;
- rte_flow_shared_action_update;
rte_flow_tunnel_decap_set;
rte_flow_tunnel_match;
rte_flow_get_restore_info;
@@ -246,6 +242,10 @@ EXPERIMENTAL {
# added in 21.05
rte_eth_representor_info_get;
+ rte_flow_action_handle_create;
+ rte_flow_action_handle_destroy;
+ rte_flow_action_handle_update;
+ rte_flow_action_handle_query;
};
INTERNAL {
--
2.19.0.windows.1
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs Bing Zhao
@ 2021-04-19 14:50 ` Thomas Monjalon
2021-04-19 15:09 ` Ferruh Yigit
0 siblings, 1 reply; 46+ messages in thread
From: Thomas Monjalon @ 2021-04-19 14:50 UTC (permalink / raw)
To: Bing Zhao
Cc: orika, ferruh.yigit, andrew.rybchenko, matan, viacheslavo, dev,
ajit.khaparde, getelson, andreyv
19/04/2021 16:38, Bing Zhao:
> The new functions rte_flow_action_handle_* are added to replace
> the current shared functions rte_flow_shared_action_*.
[...]
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs
2021-04-19 12:26 ` Thomas Monjalon
@ 2021-04-19 15:05 ` Bing Zhao
0 siblings, 0 replies; 46+ messages in thread
From: Bing Zhao @ 2021-04-19 15:05 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon, Ori Kam
Cc: ferruh.yigit, andrew.rybchenko, Matan Azrad, Slava Ovsiienko,
dev, ajit.khaparde, Gregory Etelson, Andrey Vesnovaty
Hi Thomas,
All the comments were addressed in the v5.
Many thanks.
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, April 19, 2021 8:26 PM
> To: Ori Kam <orika@nvidia.com>; Bing Zhao <bingz@nvidia.com>
> Cc: ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru; Matan
> Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> dev@dpdk.org; ajit.khaparde@broadcom.com; Gregory Etelson
> <getelson@nvidia.com>; Andrey Vesnovaty <andreyv@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect
> action APIs
>
> External email: Use caution opening links or attachments
>
>
> 16/04/2021 19:33, Bing Zhao:
> > --- a/doc/guides/rel_notes/release_21_05.rst
> > +++ b/doc/guides/rel_notes/release_21_05.rst
> > @@ -234,6 +234,9 @@ API Changes
> > * pci: The value ``PCI_ANY_ID`` is marked as deprecated
> > and can be replaced with ``RTE_PCI_ANY_ID``.
> >
> > +* ethdev: The experimental shared action APIs in ``rte_flow.h``
> has
> > +been
>
> s/APIs/API/
> An API may cover more than a function, it is an interface globally.
>
> > + replaced from ``rte_flow_shared_action_*`` to indirect action
> APIs
> > + named
>
> s/APIs/API/
>
> > + ``rte_flow_action_handle_*``.
>
> A blank line is missing here.
>
> I propose a reword:
>
> * ethdev: The experimental flow API for shared action has been
> generalized
> as a flow action handle used in rules through an indirect action.
> The functions ``rte_flow_shared_action_*`` manipulating the action
> object
> are replaced with ``rte_flow_action_handle_*``.
> The action ``RTE_FLOW_ACTION_TYPE_SHARED`` is deprecated and can
> be
> replaced with ``RTE_FLOW_ACTION_TYPE_INDIRECT``.
>
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +Creating indirect actions
> > +~~~~~~~~~~~~~~~~~~~~~~~~~
>
> empty line missing after title
>
> > +``flow indirect_action {port_id} create`` creates indirect action
> > +with optional indirect action ID. It is bound to
> ``rte_flow_action_handle_create()``::
> [...]
> > +Updating indirect actions
> > +~~~~~~~~~~~~~~~~~~~~~~~~~
>
> empty line
>
> > +``flow indirect_action {port_id} update`` updates configuration
> of
> > +the indirect action from its indirect action ID (as returned by
> > +``flow indirect_action {port_id} create``). It is bound to
> > +``rte_flow_action_handle_update()``::
> [...]
> > +Destroying indirect actions
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> same here and other places
>
> > +``flow indirect_action {port_id} destroy`` destroys one or more
> > +indirect actions from their indirect action IDs (as returned by
> > +``flow indirect_action {port_id} create``). It is bound to
> > +``rte_flow_action_handle_destroy()``::
>
> [...]
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
>
> We should add a comment to RTE_FLOW_ACTION_TYPE_SHARED, that it is
> deprecated.
>
> > + /**
> > + * Describe indirect action that could be used by a single
> flow rule
> > + * or multiple flow rules.
> > + *
> > + * Allow flow rule(s) reference the same action by the
> indirect action
> > + * handle (see struct rte_flow_action_handle), rules could
> be on the
> > + * same port or across different ports.
> > + */
>
> Proposed reword:
>
> An action handle is referenced in a rule through an indirect action.
>
> The same action handle may be used in multiple rules for the same or
> different ethdev ports.
>
> @see rte_flow_action_handle
>
> > + RTE_FLOW_ACTION_TYPE_INDIRECT,
> > };
> [...]
> > - * Opaque type returned after successfully creating a shared
> action.
> > + * Opaque type returned after successfully creating an indirect
> action object.
> > + * The definition of the object handle will be different per
> driver
> > + or
>
> s/will be/is/
>
> > + * per immediate action type.
> > *
> > - * This handle can be used to manage and query the related action:
> > - * - share it across multiple flow rules
> > - * - update action configuration
> > - * - query action data
> > - * - destroy action
> > + * This handle can be used to manage and query the related
> immediate action:
> > + * - referenced in single flow rule or across multiple flow rules
> > + * over multiple ports
> > + * - update action object configuration
> > + * - query action object data
> > + * - destroy action object
> > */
> > -struct rte_flow_shared_action;
> > +struct rte_flow_action_handle;
>
> [...]
> > + * Create an indirect action object that can be used by flow
> create,
> > + and
> > + * could also be shared by different flows.
>
> Can be simpler:
> Create an indirect action object that can be used in flow rules via
> its handle.
>
BR. Bing
^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs
2021-04-19 14:50 ` Thomas Monjalon
@ 2021-04-19 15:09 ` Ferruh Yigit
0 siblings, 0 replies; 46+ messages in thread
From: Ferruh Yigit @ 2021-04-19 15:09 UTC (permalink / raw)
To: Thomas Monjalon, Bing Zhao
Cc: orika, andrew.rybchenko, matan, viacheslavo, dev, ajit.khaparde,
getelson, andreyv
On 4/19/2021 3:50 PM, Thomas Monjalon wrote:
> 19/04/2021 16:38, Bing Zhao:
>> The new functions rte_flow_action_handle_* are added to replace
>> the current shared functions rte_flow_shared_action_*.
> [...]
>> Signed-off-by: Bing Zhao <bingz@nvidia.com>
>> Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
>> Acked-by: Ori Kam <orika@nvidia.com>
>> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 46+ messages in thread
end of thread, other threads:[~2021-04-19 15:09 UTC | newest]
Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
2021-03-17 16:10 ` Bing Zhao
2021-03-22 14:59 ` Andrew Rybchenko
2021-04-06 9:05 ` Bing Zhao
2021-03-22 14:54 ` Andrew Rybchenko
2021-04-06 9:07 ` Bing Zhao
2021-04-06 9:48 ` Thomas Monjalon
2021-04-06 11:02 ` Bing Zhao
2021-04-06 12:18 ` Thomas Monjalon
2021-04-07 3:16 ` Ajit Khaparde
2021-04-07 6:11 ` Bing Zhao
2021-04-08 14:46 ` [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs Bing Zhao
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-12 19:42 ` Ferruh Yigit
2021-04-13 1:26 ` Bing Zhao
2021-04-13 14:00 ` Ori Kam
2021-04-13 12:36 ` Andrey Vesnovaty
2021-04-15 13:55 ` Andrew Rybchenko
2021-04-15 14:10 ` Thomas Monjalon
2021-04-15 16:02 ` Andrew Rybchenko
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API Bing Zhao
2021-04-12 19:40 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
2021-04-13 1:22 ` Bing Zhao
2021-04-13 7:23 ` Thomas Monjalon
2021-04-13 7:24 ` Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-15 15:56 ` Ori Kam
2021-04-15 17:59 ` Ajit Khaparde
2021-04-16 6:58 ` Bing Zhao
2021-04-16 7:03 ` Thomas Monjalon
2021-04-16 15:00 ` Ajit Khaparde
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 12:26 ` Thomas Monjalon
2021-04-19 15:05 ` Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:50 ` Thomas Monjalon
2021-04-19 15:09 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).