[3/3] app/testpmd: fix meter mark handle update
Checks
Commit Message
The indirect action handle update for the METER_MERK action
was implemented only for the async RTE Flow API.
Allow updating the METER_MARK parameters via the old sync method.
Fixes: 9c4a0c1859a3 ("ethdev: add meter color mark flow action")
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
app/test-pmd/config.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
Comments
On Tue, 11 Jul 2023 18:20:44 +0300
Alexander Kozyrev <akozyrev@nvidia.com> wrote:
> + case RTE_FLOW_ACTION_TYPE_METER_MARK:
> + rte_memcpy(&mtr_update.meter_mark, action->conf,
> + sizeof(struct rte_flow_action_meter_mark));
Why use rte_memcpy? memcpy of fixed size is faster.
Also, more static checkers know what memcpy is.
> On Tuesday, July 11, 2023 12:15 PM
> Stephen Hemminger <stephen@networkplumber.org> wrote:
> On Tue, 11 Jul 2023 18:20:44 +0300
> Alexander Kozyrev <akozyrev@nvidia.com> wrote:
>
> > + case RTE_FLOW_ACTION_TYPE_METER_MARK:
> > + rte_memcpy(&mtr_update.meter_mark, action->conf,
> > + sizeof(struct rte_flow_action_meter_mark));
>
> Why use rte_memcpy? memcpy of fixed size is faster.
> Also, more static checkers know what memcpy is.
Ok, not a problem, switching to memcpy.
@@ -1943,6 +1943,7 @@ port_action_handle_update(portid_t port_id, uint32_t id,
struct rte_flow_error error;
struct rte_flow_action_handle *action_handle;
struct port_indirect_action *pia;
+ struct rte_flow_update_meter_mark mtr_update;
const void *update;
action_handle = port_action_handle_get_by_id(port_id, id);
@@ -1956,6 +1957,17 @@ port_action_handle_update(portid_t port_id, uint32_t id,
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
update = action->conf;
break;
+ case RTE_FLOW_ACTION_TYPE_METER_MARK:
+ rte_memcpy(&mtr_update.meter_mark, action->conf,
+ sizeof(struct rte_flow_action_meter_mark));
+ if (mtr_update.meter_mark.profile)
+ mtr_update.profile_valid = 1;
+ if (mtr_update.meter_mark.policy)
+ mtr_update.policy_valid = 1;
+ mtr_update.color_mode_valid = 1;
+ mtr_update.state_valid = 1;
+ update = &mtr_update;
+ break;
default:
update = action;
break;
@@ -3162,8 +3174,10 @@ port_queue_action_handle_update(portid_t port_id,
case RTE_FLOW_ACTION_TYPE_METER_MARK:
rte_memcpy(&mtr_update.meter_mark, action->conf,
sizeof(struct rte_flow_action_meter_mark));
- mtr_update.profile_valid = 1;
- mtr_update.policy_valid = 1;
+ if (mtr_update.meter_mark.profile)
+ mtr_update.profile_valid = 1;
+ if (mtr_update.meter_mark.policy)
+ mtr_update.policy_valid = 1;
mtr_update.color_mode_valid = 1;
mtr_update.init_color_valid = 1;
mtr_update.state_valid = 1;