ethdev: introduce action context APIs
A message that is not in the archive (sent off-list or not yet received): [email protected]
17/03/2021 08:59, Bing Zhao:
Quoted 11 lines
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
Quoted 3 lines
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.
Hi Thomas,
Quoted 24 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, March 17, 2021 4:29 PM
To: Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 10 lines
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
Quoted 7 lines
Quoted 2 lines
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.
Quoted 1 line
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.
Quoted 2 lines
BR. Bing
Quoted 29 lines · Bing Zhao
Hi Thomas,
Quoted 27 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, March 17, 2021 4:29 PM
To: Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 10 lines
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_queryQuoted 2 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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_actionas the input parameter. It would limit the ability of updating, sincerte_flow_actiononly 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.
Hi Andrew,
Thanks for your comments.
Quoted 52 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, March 22, 2021 11:00 PM
To: Bing Zhao <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
Quoted 27 lines · Bing Zhao
Hi Thomas,
Quoted 25 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, March 17, 2021 4:29 PM
To: Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
flows or different ports. Or it could also be used by a single
flow.
Quoted 1 line
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_actionas the input parameter. It would limit the ability of updating, sincerte_flow_actiononly have the "conf" w/o any mask or flag bits.Quoted 1 line
Quoted 5 lines
Quoted 1 line
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
Quoted 12 lines · Thomas Monjalon
17/03/2021 08:59, Bing Zhao:
Quoted 11 lines
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
Quoted 6 lines
Quoted 3 lines
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
Hi Thomas and Andrew,
Quoted 27 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, March 22, 2021 10:55 PM
To: NBU-Contact-Thomas Monjalon <[email protected]>; Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
Quoted 2 lines · Thomas Monjalon
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 8 lines
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a single
flow.
Quoted 4 lines
Quoted 1 line
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
06/04/2021 11:07, Bing Zhao:
Quoted 21 lines
Hi Thomas and Andrew,
From: Andrew Rybchenko <[email protected]>
Quoted 18 lines · Thomas Monjalon
Quoted 2 lines
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a single
flow.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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.
Hi Thomas,
Quoted 38 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 6, 2021 5:48 PM
To: Bing Zhao <[email protected]>
Cc: Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: Re: [RFC] ethdev: introduce action context APIsExternal email: Use caution opening links or attachments
06/04/2021 11:07, Bing Zhao:
Quoted 20 lines
Hi Thomas and Andrew,
From: Andrew Rybchenko <[email protected]>
Quoted 17 lines · Thomas Monjalon
Quoted 2 lines
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a
single
Quoted 5 lines
Quoted 5 lines
flow.
Quoted 4 lines
Quoted 1 line
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
Quoted 8 lines
shared.
Quoted 4 lines
Quoted 2 lines
+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/
Quoted 3 lines
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
06/04/2021 13:02, Bing Zhao:
Quoted 39 lines
From: Thomas Monjalon <[email protected]>
Quoted 25 lines
06/04/2021 11:07, Bing Zhao:
Quoted 18 lines
From: Andrew Rybchenko <[email protected]>
Quoted 17 lines · Thomas Monjalon
Quoted 2 lines
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a
single
Quoted 5 lines
Quoted 5 lines
flow.
Quoted 4 lines
Quoted 1 line
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 notQuoted 8 lines
shared.
Quoted 4 lines
Quoted 2 lines
+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/Quoted 1 line
Quoted 7 lines
Quoted 2 lines
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".
Quoted 25 lines · Thomas Monjalon
06/04/2021 11:07, Bing Zhao:
Quoted 23 lines
Hi Thomas and Andrew,
From: Andrew Rybchenko <[email protected]>
Quoted 20 lines · Thomas Monjalon
Quoted 2 lines
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a single
flow.
Quoted 2 lines
Quoted 1 line
The name "shared" is improper in a sense.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
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?
Quoted 4 lines
Please explain here the naming reason.
Hi,
Quoted 43 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Wednesday, April 7, 2021 11:16 AM
To: NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Bing Zhao <[email protected]>; Andrew Rybchenko <[email protected]>; Ori Kam <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [RFC] ethdev: introduce action context APIsQuoted 22 lines · Thomas Monjalon
06/04/2021 11:07, Bing Zhao:
Quoted 20 lines
Hi Thomas and Andrew,
From: Andrew Rybchenko <[email protected]>
Quoted 17 lines · Thomas Monjalon
Quoted 2 lines
17/03/2021 08:59, Bing Zhao:
Quoted 1 line
The new functions rte_flow_action_ctx* that were added will
replace
Quoted 11 lines
Quoted 11 lines
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_queryWhen creating a action context, it could be shared among
different
Quoted 1 line
Quoted 1 line
flows or different ports. Or it could also be used by a
single
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
flow.
Quoted 4 lines
Quoted 1 line
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 notshared.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
+1
Quoted 8 lines
Quoted 1 line
Quoted 1 line
In another email, I explained the change a bit more. Please
check and give comments, thank you all.
Quoted 2 lines
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/
Quoted 4 lines
Quoted 4 lines
Please explain here the naming reason.
RFC PATCH v2 1/1 ethdev: introduce indirect action APIs
In reply to a message not in the archiveRight 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.
--- lib/librte_ethdev/rte_flow.h | 114 ++++++++++++++++------------ lib/librte_ethdev/rte_flow_driver.h | 26 +++---- 2 files changed, 78 insertions(+), 62 deletions(-)
lib/librte_ethdev/rte_flow.h +65 -49
@@ -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 {
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
Signature · 1 line
2.30.0.windows.2
PATCH 1/1 ethdev: introduce indirect action APIs
In reply to a message not in the archiveRight 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.
--- 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(-)
doc/guides/rel_notes/release_21_05.rst +3 -0
@@ -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 -----------
lib/librte_ethdev/rte_flow.c +24 -24
106 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +65 -49
219 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
2.30.0.windows.2
v2 cover Change shared action API to action handle API
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(-)
Signature · 1 line
1.8.3.1
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.
--- 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(-)
doc/guides/rel_notes/release_21_05.rst +3 -0
@@ -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 -----------
lib/librte_ethdev/rte_flow.c +28 -28
122 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +67 -51
235 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
Quoted 60 lines · Bing Zhao
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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.
Quoted 7 lines
Signed-off-by Bing Zhao <[email protected]>--- 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?
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
Hi Ferruh,
Quoted 96 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 3:42 AM
To: Bing Zhao <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [PATCH v2 1/4] ethdev: introduce indirect action APIsExternal email: Use caution opening links or attachments
Quoted 2 lines · Bing Zhao
Right now, rte_flow_shared_action_* APIs are used for some shared actions, like RSS, count. The shared action should be created
before
Quoted 1 line
using it inside a flow. These shared actions sometimes are not
really
Quoted 3 lines
shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the
Quoted 8 lines
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, namedshared_action. It is created from a direct actioni, like count or rss, and thenused
Quoted 1 line
in the flow rules with an object handle. The PMD will take
care
Quoted 7 lines
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.
Quoted 1 line
The indirect action object could be shared by different flows or
used
Quoted 3 lines
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 ineach
Quoted 3 lines
driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be
replaced.
Quoted 5 lines
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
Quoted 3 lines
will replace the
rte_flow_actionstruct pointer due to the facts:
1. Some action may not support fields updating. In the example ofa
Quoted 4 lines
counter, the only "update" supported should be the reset. So passing a
rte_flow_actionstruct pointer is meaningless and there is even no such corresponding action struct. What's more, if more than one operations should be supported, for someother
Quoted 3 lines
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 whichpart(s)
Quoted 2 lines
to update.
For different types of indirect action objects, the pointercould
Quoted 1 line
either be the same of rte_flow_action* struct - in order not
to
Quoted 4 lines
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
Quoted 5 lines
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not tobreak
Quoted 8 lines
the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.Signed-off-by Bing Zhao <[email protected]>--- doc/guides/rel_notes/release_21_05.rst | 3 + lib/librte_ethdev/rte_flow.c | 56 ++++++++-------- lib/librte_ethdev/rte_flow.h | 118
Quoted 5 lines
+++++++++++++++++++--------------
Quoted 2 lines
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.
Quoted 3 lines
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
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
Quoted 105 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Tuesday, April 13, 2021 4:27 AM
Subject: RE: [PATCH v2 1/4] ethdev: introduce indirect action APIsHi Ferruh,
Quoted 96 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 3:42 AM
To: Bing Zhao <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [PATCH v2 1/4] ethdev: introduce indirect action APIsExternal email: Use caution opening links or attachments
Quoted 2 lines · Bing Zhao
Right now, rte_flow_shared_action_* APIs are used for some shared actions, like RSS, count. The shared action should be created
before
Quoted 1 line
using it inside a flow. These shared actions sometimes are not
really
Quoted 3 lines
shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the
Quoted 8 lines
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, namedshared_action. It is created from a direct actioni, like count or rss, and thenused
Quoted 1 line
in the flow rules with an object handle. The PMD will take
care
Quoted 7 lines
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.
Quoted 1 line
The indirect action object could be shared by different flows or
used
Quoted 3 lines
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 ineach
Quoted 3 lines
driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be
replaced.
Quoted 5 lines
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
Quoted 3 lines
will replace the
rte_flow_actionstruct pointer due to the facts:
1. Some action may not support fields updating. In the example ofa
Quoted 4 lines
counter, the only "update" supported should be the reset. So passing a
rte_flow_actionstruct pointer is meaningless and there is even no such corresponding action struct. What's more, if more than one operations should be supported, for someother
Quoted 3 lines
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 whichpart(s)
Quoted 2 lines
to update.
For different types of indirect action objects, the pointercould
Quoted 1 line
either be the same of rte_flow_action* struct - in order not
to
Quoted 4 lines
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
Quoted 5 lines
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not tobreak
Quoted 8 lines
the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.Signed-off-by Bing Zhao <[email protected]>--- doc/guides/rel_notes/release_21_05.rst | 3 + lib/librte_ethdev/rte_flow.c | 56 ++++++++-------- lib/librte_ethdev/rte_flow.h | 118
Quoted 8 lines
Quoted 5 lines
+++++++++++++++++++--------------
Quoted 2 lines
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
Quoted 11 lines
Quoted 3 lines
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
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
In reply to Bing ZhaoQuoted 555 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Saturday, April 10, 2021 5:04 PM
To: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: [PATCH v2 1/4] ethdev: introduce indirect action APIsRight 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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.Signed-off-by Bing Zhao <[email protected]>--- 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(-)doc/guides/rel_notes/release_21_05.rst +3
-0@@ -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 -----------lib/librte_ethdev/rte_flow.c +22
-22@@ -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){
lib/librte_ethdev/rte_flow.c +4
-4int 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){
lib/librte_ethdev/rte_flow.c +2
-2@@ -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);}
lib/librte_ethdev/rte_flow.h +0
-0@@ -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
lib/librte_ethdev/rte_flow.h +53
-39-* 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.lib/librte_ethdev/rte_flow.h +11
-12@@ -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 {lib/librte_ethdev/rte_flow_driver.h +13
-13@@ -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() */ lib/librte_ethdev/version.map +4
-5@@ -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 { --
Quoted 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
In reply to Bing ZhaoQuoted 54 lines · Bing Zhao
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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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.
Quoted 7 lines
All the underlayer PMD callbacks will be moved to these new APIs.
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.Signed-off-by Bing Zhao <[email protected]>
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.
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
15/04/2021 15:55, Andrew Rybchenko:
Quoted 61 lines · Bing Zhao
Quoted 60 lines
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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.
Quoted 5 lines
Quoted 1 line
Signed-off-by Bing Zhao <[email protected]>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?
Re: [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs
Quoted 64 lines · Thomas Monjalon
15/04/2021 15:55, Andrew Rybchenko:
Quoted 63 lines · Bing Zhao
Quoted 61 lines
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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.Signed-off-by Bing Zhao <[email protected]>
Quoted 9 lines
Quoted 3 lines
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.
PATCH v2 2/4 app/test-pmd: change to indirect action command
In reply to Bing ZhaoSince 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.
--- 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(-)
app/test-pmd/cmdline.c +12 -12
@@ -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"
app/test-pmd/cmdline_flow.c +126 -126
462 lines not on this page · raw message
app/test-pmd/config.c +80 -80
304 lines not on this page · raw message
app/test-pmd/testpmd.h +14 -14
@@ -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);
Signature · 1 line
1.8.3.1
PATCH v2 3/4 doc: update user guide for indirect action
In reply to Bing ZhaoThe testpmd application user guide is updated. All the "shared action" related parts are replaced with "indirect action" to have a correct explanation.
--- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 94 ++++++++++++++--------------- 1 file changed, 47 insertions(+), 47 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +47 -47
@@ -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 ~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v2 4/4 net/mlx5: adaption to indirect action API
In reply to Bing ZhaoSince 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.
--- 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(-)
drivers/net/mlx5/mlx5.c +1 -1
@@ -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;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -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.
drivers/net/mlx5/mlx5_flow.c +121 -117
498 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +12 -12
@@ -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 30enum { -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);
drivers/net/mlx5/mlx5_flow_dv.c +44 -41
204 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
In reply to Bing ZhaoQuoted 9 lines · Bing Zhao
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
---
Quoted 6 lines
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
Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
Hi Ferruh,
Thanks for your comments.
Quoted 34 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 3:40 AM
To: Bing Zhao <[email protected]>; Ori Kam <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [PATCH v2 0/4] Change shared action API to action handle APIExternal email: Use caution opening links or attachments
Quoted 9 lines · Bing Zhao
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
---Quoted 6 lines
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 APIHi Bing,
Quoted 9 lines
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.
Quoted 7 lines
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.
Quoted 3 lines
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.
Quoted 3 lines
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
13/04/2021 03:22, Bing Zhao:
Quoted 14 lines
From: Ferruh Yigit <[email protected]>
Quoted 13 lines
Quoted 6 lines
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 APIHi 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.
Quoted 6 lines
Quoted 4 lines
One way to handle this is:
- first add new function/structs
- switch app & pmd to new function/structs
- remove old function/structsSure, 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.
Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API
Thanks, I will squash the commits.
Quoted 41 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 13, 2021 3:24 PM
To: Ferruh Yigit <[email protected]>; Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle APIExternal email: Use caution opening links or attachments
13/04/2021 03:22, Bing Zhao:
Quoted 12 lines
From: Ferruh Yigit <[email protected]>
Quoted 11 lines
Quoted 6 lines
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 APIHi Bing,
How the patchset constructed will cause build error in patch by patch build, since first patch removes some struct/functions
that
Quoted 8 lines
Quoted 6 lines
are in use.
One way to handle this is:
- first add new function/structs
- switch app & pmd to new function/structs
- remove old function/structsSure, 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.
v3 cover Change shared action API to action handle API
In reply to Bing ZhaoThe 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(-)
Signature · 1 line
2.19.0.windows.1
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.
--- 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(-)
app/test-pmd/cmdline.c +12 -12
@@ -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"
app/test-pmd/cmdline_flow.c +126 -126
465 lines not on this page · raw message
app/test-pmd/config.c +80 -80
304 lines not on this page · raw message
app/test-pmd/testpmd.h +14 -14
@@ -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);
doc/guides/prog_guide/rte_flow.rst +14 -13
@@ -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 |
doc/guides/rel_notes/release_21_05.rst +3 -0
@@ -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 -----------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +47 -47
170 lines not on this page · raw message
drivers/net/mlx5/mlx5.c +1 -1
@@ -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;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -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.
drivers/net/mlx5/mlx5_flow.c +121 -117
498 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +12 -12
@@ -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 30enum { -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);
drivers/net/mlx5/mlx5_flow_dv.c +44 -41
204 lines not on this page · raw message
lib/librte_ethdev/rte_flow.c +28 -28
122 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +67 -51
235 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
2.19.0.windows.1
Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
Hi Bing
Quoted 69 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Thursday, April 15, 2021 6:52 PM
Subject: [PATCH v3 1/1] ethdev: introduce indirect action APIsRight 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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.
Quoted 8 lines
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 <[email protected]>Acked-by Andrey Vesnovaty <[email protected]>---
Thanks,
Ori
Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
In reply to Bing ZhaoQuoted 59 lines · Bing Zhao
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, namedshared_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_actionstruct 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 arte_flow_actionstruct 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.
Quoted 5 lines
All the underlayer PMD callbacks will be moved to these new APIs.
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_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?
Quoted 8 lines
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 <[email protected]>Acked-by Andrey Vesnovaty <[email protected]>
Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
Hi Ajit,
Quoted 83 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Friday, April 16, 2021 2:00 AM
To: Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; dpdk- dev <[email protected]>; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [PATCH v3 1/1] ethdev: introduce indirect action APIsQuoted 3 lines · Bing Zhao
Right now, rte_flow_shared_action_* APIs are used for some shared actions, like RSS, count. The shared action should be created
before
Quoted 27 lines
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, namedshared_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.Quoted 1 line
The old name "shared" is improper in a sense and should be
replaced.
Quoted 2 lines
Since the APIs are changed from "rte_flow_shared_action*" to the
new
Quoted 1 line
"rte_flow_action_handle*", the testpmd application code and
command
Quoted 2 lines
line interfaces also need to be updated to do the adaption. The testpmd application user guide is also updated. All the
"shared
Quoted 1 line
action" related parts are replaced with "indirect action" to have
a
Quoted 6 lines
correct explanation.
The parameter of "update" interface is also changed. A general pointer will replace the
rte_flow_actionstruct pointer due to the facts:
1. Some action may not support fields updating. In the example ofa
Quoted 9 lines
counter, the only "update" supported should be the reset. So passing a
rte_flow_actionstruct 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 pointercould
Quoted 5 lines
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
Quoted 4 lines
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
Quoted 8 lines
Quoted 3 lines
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_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?
Quoted 10 lines
Quoted 2 lines
Since the APIs are changed from "rte_flow_shared_action*" to the
new
Quoted 2 lines
"rte_flow_action_handle*" and the "update" interface's 3rd input parameter is changed to generic pointer, the mlx5 PMD that uses
these
Quoted 4 lines
APIs needs to do the adaption to the new APIs as well.
Signed-off-by Bing Zhao <[email protected]>Acked-by Andrey Vesnovaty <[email protected]>
BR. Bing
Re: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
In reply to Ajit Khaparde15/04/2021 19:59, Ajit Khaparde:
Quoted 10 lines · Bing Zhao
Quoted 9 lines
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, namedshared_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.
[...]
Quoted 7 lines
Quoted 3 lines
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_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 useaction_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.
Ajit Khaparde
Acked-byRe: [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs
Quoted 17 lines · Thomas Monjalon
15/04/2021 19:59, Ajit Khaparde:
Quoted 10 lines · Bing Zhao
Quoted 9 lines
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, namedshared_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.[...]
Quoted 4 lines
Quoted 3 lines
The
RTE_FLOW_ACTION_TYPE_SHAREDis kept for now in order not to break the ABI. All the implementations are changed by usingRTE_FLOW_ACTION_TYPE_INDIRECT.
Quoted 8 lines
Quoted 3 lines
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 useaction_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.
Quoted 3 lines
v4 cover Change shared action API to action handle API
In reply to Bing ZhaoThe 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(-)
Signature · 1 line
2.19.0.windows.1
PATCH v4 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.
--- 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(-)
app/test-pmd/cmdline.c +12 -12
@@ -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"
app/test-pmd/cmdline_flow.c +126 -126
465 lines not on this page · raw message
app/test-pmd/config.c +80 -80
304 lines not on this page · raw message
app/test-pmd/testpmd.h +14 -14
@@ -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);
doc/guides/prog_guide/rte_flow.rst +15 -14
@@ -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 |
doc/guides/rel_notes/release_21_05.rst +3 -0
@@ -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 -----------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +51 -51
174 lines not on this page · raw message
drivers/net/mlx5/mlx5.c +1 -1
@@ -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;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -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.
drivers/net/mlx5/mlx5_flow.c +121 -117
498 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +12 -12
@@ -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 30enum { -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);
drivers/net/mlx5/mlx5_flow_dv.c +44 -41
204 lines not on this page · raw message
lib/librte_ethdev/rte_flow.c +28 -28
122 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +67 -51
235 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
2.19.0.windows.1
Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs
16/04/2021 19:33, Bing Zhao:
doc/guides/rel_notes/release_21_05.rst API Changes · line 237
Quoted 7 lines
doc/guides/rel_notes/release_21_05.rst +1
-0@@ -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.
doc/guides/rel_notes/release_21_05.rst API Changes · line 238
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+ replaced from ``rte_flow_shared_action_*`` to indirect action APIs named
s/APIs/API/
doc/guides/rel_notes/release_21_05.rst API Changes · line 239
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+ ``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``.
doc/guides/testpmd_app_ug/testpmd_funcs.rst
Quoted 4 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2
-0+Creating indirect actions +~~~~~~~~~~~~~~~~~~~~~~~~~
empty line missing after title
Quoted 2 lines
+``flow
indirect_action{port_id} create`` creates indirect action with optional +indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
[...]
Quoted 2 lines
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
empty line
Quoted 4 lines
+``flow
indirect_action{port_id} update`` updates configuration of the indirect +action from its indirect action ID (as returned by
+``flowindirect_action{port_id} create``). It is bound to +``rte_flow_action_handle_update()``::
[...]
Quoted 2 lines
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
same here and other places
Quoted 4 lines
+``flow
indirect_action{port_id} destroy`` destroys one or more indirect actions +from their indirect action IDs (as returned by
+``flowindirect_action{port_id} create``). It is bound to +``rte_flow_action_handle_destroy()``::
[...]
lib/librte_ethdev/rte_flow.h
Quoted 2 lines
lib/librte_ethdev/rte_flow.h +0
-0
We should add a comment to RTE_FLOW_ACTION_TYPE_SHARED, that it is deprecated.
lib/librte_ethdev/rte_flow.h enum rte_flow_action_type { · line 2278
Quoted 8 lines
lib/librte_ethdev/rte_flow.h +8
-0+/** +* 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
Quoted 2 lines
lib/librte_ethdev/rte_flow.h +1
-0+ RTE_FLOW_ACTION_TYPE_INDIRECT, };
[...]
Quoted 3 lines
- * 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/
Quoted 16 lines
+ * 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
*/lib/librte_ethdev/rte_flow.h +1
-1-struct rte_flow_shared_action ; +struct rte_flow_action_handle ;
[...]
Quoted 2 lines
+ * 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.
Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs
Hi Thomas,
All the comments were addressed in the v5.
Many thanks.
Quoted 142 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, April 19, 2021 8:26 PM
To: Ori Kam <[email protected]>; Bing Zhao <[email protected]>
Cc: [email protected]; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; [email protected]; [email protected]; Gregory Etelson <[email protected]>; Andrey Vesnovaty <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIsExternal email: Use caution opening links or attachments
16/04/2021 19:33, Bing Zhao:
doc/guides/rel_notes/release_21_05.rst API Changes · line 237
Quoted 7 lines
doc/guides/rel_notes/release_21_05.rst +1
-0@@ -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
doc/guides/rel_notes/release_21_05.rst API Changes · line 238
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+beens/APIs/API/
An API may cover more than a function, it is an interface globally.doc/guides/rel_notes/release_21_05.rst API Changes · line 239
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+ replaced from ``rte_flow_shared_action_*`` to indirect actionAPIs
doc/guides/rel_notes/release_21_05.rst API Changes · line 240
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+ nameds/APIs/API/
doc/guides/rel_notes/release_21_05.rst API Changes · line 239
Quoted 1 line
doc/guides/rel_notes/release_21_05.rst +1
-0+ ``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``.doc/guides/testpmd_app_ug/testpmd_funcs.rst
Quoted 4 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2
-0+Creating indirect actions +~~~~~~~~~~~~~~~~~~~~~~~~~empty line missing after title
Quoted 2 lines
+``flow
indirect_action{port_id} create`` creates indirect action +with optional indirect action ID. It is bound to``rte_flow_action_handle_create()``::
[...]Quoted 2 lines
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~empty line
Quoted 1 line
+``flow
indirect_action{port_id} update`` updates configurationof
Quoted 3 lines
+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()``::[...]
Quoted 2 lines
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~same here and other places
Quoted 4 lines
+``flow
indirect_action{port_id} destroy`` destroys one or more +indirect actions from their indirect action IDs (as returned by +``flowindirect_action{port_id} create``). It is bound to +``rte_flow_action_handle_destroy()``::[...]
lib/librte_ethdev/rte_flow.h
Quoted 2 lines
lib/librte_ethdev/rte_flow.h +0
-0We should add a comment to
RTE_FLOW_ACTION_TYPE_SHARED, that it is deprecated.lib/librte_ethdev/rte_flow.h
Quoted 2 lines
lib/librte_ethdev/rte_flow.h +2
-0+/** +* Describe indirect action that could be used by a single flow rule
lib/librte_ethdev/rte_flow.h enum rte_flow_action_type {
Quoted 3 lines
lib/librte_ethdev/rte_flow.h +3
-0+* or multiple flow rules. +* +* Allow flow rule(s) reference the same action by the indirect action
Quoted 1 line
+ * handle (see struct
rte_flow_action_handle), rules couldbe on the
lib/librte_ethdev/rte_flow.h enum rte_flow_action_type { · line 2278
Quoted 2 lines
lib/librte_ethdev/rte_flow.h +2
-0+* 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_handleQuoted 2 lines
+
RTE_FLOW_ACTION_TYPE_INDIRECT,
};[...]
Quoted 1 line
- * Opaque type returned after successfully creating a shared
action.
Quoted 1 line
+ * Opaque type returned after successfully creating an indirect
action object.
Quoted 1 line
+ * The definition of the object handle will be different per
driver
Quoted 1 line
+ or
s/will be/is/
Quoted 8 lines
+ * 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 relatedimmediate action:
Quoted 8 lines
+ * - referenced in single flow rule or across multiple flow rules
+ * over multiple ports
+ * - update action object configuration
+ * - query action object data
+ * - destroy action object
*/lib/librte_ethdev/rte_flow.h +1
-1-struct rte_flow_shared_action ; +struct rte_flow_action_handle ;[...]
Quoted 9 lines
Quoted 1 line
+ * Create an indirect action object that can be used by flow
create,
Quoted 2 lines
+ 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
PATCH v5 1/1 Change shared action API to action handle API
In reply to Bing ZhaoThe 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(-)
Signature · 1 line
2.5.5
PATCH v5 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.
--- 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(-)
app/test-pmd/cmdline.c +12 -12
@@ -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"
app/test-pmd/cmdline_flow.c +126 -126
465 lines not on this page · raw message
app/test-pmd/config.c +80 -80
304 lines not on this page · raw message
app/test-pmd/testpmd.h +14 -14
@@ -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);
doc/guides/prog_guide/rte_flow.rst +15 -14
@@ -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 |
doc/guides/rel_notes/release_21_05.rst +7 -0
@@ -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 -----------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +55 -51
178 lines not on this page · raw message
drivers/net/mlx5/mlx5.c +1 -1
@@ -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;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -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.
drivers/net/mlx5/mlx5_flow.c +121 -117
498 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +12 -12
@@ -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 30enum { -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);
drivers/net/mlx5/mlx5_flow_dv.c +44 -41
204 lines not on this page · raw message
lib/librte_ethdev/rte_flow.c +28 -28
122 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +68 -51
242 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
2.5.5
v5 cover Change shared action API to action handle API
In reply to Bing ZhaoThe 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(-)
Signature · 1 line
2.19.0.windows.1
PATCH v5 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.
--- 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(-)
app/test-pmd/cmdline.c +12 -12
@@ -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"
app/test-pmd/cmdline_flow.c +126 -126
465 lines not on this page · raw message
app/test-pmd/config.c +80 -80
304 lines not on this page · raw message
app/test-pmd/testpmd.h +14 -14
@@ -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);
doc/guides/prog_guide/rte_flow.rst +15 -14
@@ -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 |
doc/guides/rel_notes/release_21_05.rst +7 -0
@@ -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 -----------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +55 -51
178 lines not on this page · raw message
drivers/net/mlx5/mlx5.c +1 -1
@@ -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;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -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.
drivers/net/mlx5/mlx5_flow.c +121 -117
498 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +12 -12
@@ -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 30enum { -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);
drivers/net/mlx5/mlx5_flow_dv.c +44 -41
204 lines not on this page · raw message
lib/librte_ethdev/rte_flow.c +28 -28
122 lines not on this page · raw message
lib/librte_ethdev/rte_flow.h +68 -51
242 lines not on this page · raw message
lib/librte_ethdev/rte_flow_driver.h +13 -13
@@ -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() */
lib/librte_ethdev/version.map +4 -4
@@ -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 {
Signature · 1 line
2.19.0.windows.1
Re: [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs
19/04/2021 16:38, Bing Zhao:
Quoted 2 lines
The new functions rte_flow_action_handle_* are added to replace the current shared functions rte_flow_shared_action_*.
[...]
Quoted 4 lines
Signed-off-by Bing Zhao <[email protected]>Acked-by Andrey Vesnovaty <[email protected]>Acked-by Ori Kam <[email protected]>Acked-by Ajit Khaparde <[email protected]>
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs
Quoted 11 lines · Thomas Monjalon
19/04/2021 16:38, Bing Zhao:
Quoted 2 lines
The new functions rte_flow_action_handle_* are added to replace the current shared functions rte_flow_shared_action_*.
[...]
Quoted 4 lines
Signed-off-by Bing Zhao <[email protected]>Acked-by Andrey Vesnovaty <[email protected]>Acked-by Ori Kam <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Thomas Monjalon <[email protected]>
Applied to dpdk-next-net/main, thanks.