Skip to content

Commit

Permalink
app/testpmd: fix flow update
Browse files Browse the repository at this point in the history
If actions provided to "flow update..." command contained an age
action, then testpmd did not update the age action context
accordingly.

Thus "flow aged <port_id> destroy" command can not
execute successfully.

Fix was done with next steps
1. Generate new port flow entry to add/replace action(s).
2. Set age context if age action is present.
3. Replace flow in the flow list.

Fixes: 2d9c7e5 ("app/testpmd: support updating flow rule actions")
Cc: [email protected]

Signed-off-by: Danylo Vodopianov <[email protected]>
Acked-by: Dariusz Sosnowski <[email protected]>
  • Loading branch information
dvo-plv authored and tmonjalo committed Nov 19, 2024
1 parent be22019 commit 5b7d82e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion app/test-pmd/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3882,7 +3882,8 @@ port_flow_update(portid_t port_id, uint32_t rule_id,
const struct rte_flow_action *actions, bool is_user_id)
{
struct rte_port *port;
struct port_flow **flow_list;
struct port_flow **flow_list, *uf;
struct rte_flow_action_age *age = age_action_get(actions);

if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
Expand All @@ -3897,6 +3898,16 @@ port_flow_update(portid_t port_id, uint32_t rule_id,
flow_list = &flow->next;
continue;
}

/* Update flow action(s) with new action(s) */
uf = port_flow_new(flow->rule.attr_ro, flow->rule.pattern_ro, actions, &error);
if (!uf)
return port_flow_complain(&error);
if (age) {
flow->age_type = ACTION_AGE_CONTEXT_TYPE_FLOW;
age->context = &flow->age_type;
}

/*
* Poisoning to make sure PMDs update it in case
* of error.
Expand All @@ -3913,6 +3924,14 @@ port_flow_update(portid_t port_id, uint32_t rule_id,
printf("Flow rule #%"PRIu64
" updated with new actions\n",
flow->id);

uf->next = flow->next;
uf->id = flow->id;
uf->user_id = flow->user_id;
uf->flow = flow->flow;
*flow_list = uf;

free(flow);
return 0;
}
printf("Failed to find flow %"PRIu32"\n", rule_id);
Expand Down

0 comments on commit 5b7d82e

Please sign in to comment.