app/testpmd: flush flow templates when port is removed
Add explicit flushing of template tables, pattern and actions templates, when a port is closed or detached. Signed-off-by: Suanming Mou <suanmingm@nvidia.com> Acked-by: Aman Singh <aman.deep.singh@intel.com>
This commit is contained in:
parent
6b3c67212f
commit
6d736e0568
@ -2293,6 +2293,42 @@ port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Flush pattern template */
|
||||||
|
int
|
||||||
|
port_flow_pattern_template_flush(portid_t port_id)
|
||||||
|
{
|
||||||
|
struct rte_port *port;
|
||||||
|
struct port_template **tmp;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
|
||||||
|
port_id == (portid_t)RTE_PORT_ALL)
|
||||||
|
return -EINVAL;
|
||||||
|
port = &ports[port_id];
|
||||||
|
tmp = &port->pattern_templ_list;
|
||||||
|
while (*tmp) {
|
||||||
|
struct rte_flow_error error;
|
||||||
|
struct port_template *pit = *tmp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Poisoning to make sure PMDs update it in case
|
||||||
|
* of error.
|
||||||
|
*/
|
||||||
|
memset(&error, 0x33, sizeof(error));
|
||||||
|
if (pit->template.pattern_template &&
|
||||||
|
rte_flow_pattern_template_destroy(port_id,
|
||||||
|
pit->template.pattern_template, &error)) {
|
||||||
|
printf("Pattern template #%u not destroyed\n", pit->id);
|
||||||
|
ret = port_flow_complain(&error);
|
||||||
|
tmp = &pit->next;
|
||||||
|
} else {
|
||||||
|
*tmp = pit->next;
|
||||||
|
free(pit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/** Create actions template */
|
/** Create actions template */
|
||||||
int
|
int
|
||||||
port_flow_actions_template_create(portid_t port_id, uint32_t id,
|
port_flow_actions_template_create(portid_t port_id, uint32_t id,
|
||||||
@ -2373,6 +2409,43 @@ port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Flush actions template */
|
||||||
|
int
|
||||||
|
port_flow_actions_template_flush(portid_t port_id)
|
||||||
|
{
|
||||||
|
struct rte_port *port;
|
||||||
|
struct port_template **tmp;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
|
||||||
|
port_id == (portid_t)RTE_PORT_ALL)
|
||||||
|
return -EINVAL;
|
||||||
|
port = &ports[port_id];
|
||||||
|
tmp = &port->actions_templ_list;
|
||||||
|
while (*tmp) {
|
||||||
|
struct rte_flow_error error;
|
||||||
|
struct port_template *pat = *tmp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Poisoning to make sure PMDs update it in case
|
||||||
|
* of error.
|
||||||
|
*/
|
||||||
|
memset(&error, 0x33, sizeof(error));
|
||||||
|
|
||||||
|
if (pat->template.actions_template &&
|
||||||
|
rte_flow_actions_template_destroy(port_id,
|
||||||
|
pat->template.actions_template, &error)) {
|
||||||
|
ret = port_flow_complain(&error);
|
||||||
|
printf("Actions template #%u not destroyed\n", pat->id);
|
||||||
|
tmp = &pat->next;
|
||||||
|
} else {
|
||||||
|
*tmp = pat->next;
|
||||||
|
free(pat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/** Create table */
|
/** Create table */
|
||||||
int
|
int
|
||||||
port_flow_template_table_create(portid_t port_id, uint32_t id,
|
port_flow_template_table_create(portid_t port_id, uint32_t id,
|
||||||
@ -2503,6 +2576,44 @@ port_flow_template_table_destroy(portid_t port_id,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Flush table */
|
||||||
|
int
|
||||||
|
port_flow_template_table_flush(portid_t port_id)
|
||||||
|
{
|
||||||
|
struct rte_port *port;
|
||||||
|
struct port_table **tmp;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
|
||||||
|
port_id == (portid_t)RTE_PORT_ALL)
|
||||||
|
return -EINVAL;
|
||||||
|
port = &ports[port_id];
|
||||||
|
tmp = &port->table_list;
|
||||||
|
while (*tmp) {
|
||||||
|
struct rte_flow_error error;
|
||||||
|
struct port_table *pt = *tmp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Poisoning to make sure PMDs update it in case
|
||||||
|
* of error.
|
||||||
|
*/
|
||||||
|
memset(&error, 0x33, sizeof(error));
|
||||||
|
|
||||||
|
if (pt->table &&
|
||||||
|
rte_flow_template_table_destroy(port_id,
|
||||||
|
pt->table,
|
||||||
|
&error)) {
|
||||||
|
ret = port_flow_complain(&error);
|
||||||
|
printf("Template table #%u not destroyed\n", pt->id);
|
||||||
|
tmp = &pt->next;
|
||||||
|
} else {
|
||||||
|
*tmp = pt->next;
|
||||||
|
free(pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/** Enqueue create flow rule operation. */
|
/** Enqueue create flow rule operation. */
|
||||||
int
|
int
|
||||||
port_queue_flow_create(portid_t port_id, queueid_t queue_id,
|
port_queue_flow_create(portid_t port_id, queueid_t queue_id,
|
||||||
|
@ -3276,6 +3276,9 @@ flush_port_owned_resources(portid_t pi)
|
|||||||
mcast_addr_pool_destroy(pi);
|
mcast_addr_pool_destroy(pi);
|
||||||
port_flow_flush(pi);
|
port_flow_flush(pi);
|
||||||
port_flex_item_flush(pi);
|
port_flex_item_flush(pi);
|
||||||
|
port_flow_template_table_flush(pi);
|
||||||
|
port_flow_pattern_template_flush(pi);
|
||||||
|
port_flow_actions_template_flush(pi);
|
||||||
port_action_handle_flush(pi);
|
port_action_handle_flush(pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,18 +912,21 @@ int port_flow_pattern_template_create(portid_t port_id, uint32_t id,
|
|||||||
const struct rte_flow_item *pattern);
|
const struct rte_flow_item *pattern);
|
||||||
int port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
|
int port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
|
||||||
const uint32_t *template);
|
const uint32_t *template);
|
||||||
|
int port_flow_pattern_template_flush(portid_t port_id);
|
||||||
int port_flow_actions_template_create(portid_t port_id, uint32_t id,
|
int port_flow_actions_template_create(portid_t port_id, uint32_t id,
|
||||||
const struct rte_flow_actions_template_attr *attr,
|
const struct rte_flow_actions_template_attr *attr,
|
||||||
const struct rte_flow_action *actions,
|
const struct rte_flow_action *actions,
|
||||||
const struct rte_flow_action *masks);
|
const struct rte_flow_action *masks);
|
||||||
int port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
|
int port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
|
||||||
const uint32_t *template);
|
const uint32_t *template);
|
||||||
|
int port_flow_actions_template_flush(portid_t port_id);
|
||||||
int port_flow_template_table_create(portid_t port_id, uint32_t id,
|
int port_flow_template_table_create(portid_t port_id, uint32_t id,
|
||||||
const struct rte_flow_template_table_attr *table_attr,
|
const struct rte_flow_template_table_attr *table_attr,
|
||||||
uint32_t nb_pattern_templates, uint32_t *pattern_templates,
|
uint32_t nb_pattern_templates, uint32_t *pattern_templates,
|
||||||
uint32_t nb_actions_templates, uint32_t *actions_templates);
|
uint32_t nb_actions_templates, uint32_t *actions_templates);
|
||||||
int port_flow_template_table_destroy(portid_t port_id,
|
int port_flow_template_table_destroy(portid_t port_id,
|
||||||
uint32_t n, const uint32_t *table);
|
uint32_t n, const uint32_t *table);
|
||||||
|
int port_flow_template_table_flush(portid_t port_id);
|
||||||
int port_queue_flow_create(portid_t port_id, queueid_t queue_id,
|
int port_queue_flow_create(portid_t port_id, queueid_t queue_id,
|
||||||
bool postpone, uint32_t table_id,
|
bool postpone, uint32_t table_id,
|
||||||
uint32_t pattern_idx, uint32_t actions_idx,
|
uint32_t pattern_idx, uint32_t actions_idx,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user