@@ -1583,6 +1583,12 @@ static const enum index next_async_insert_subcmd[] = {
ZERO,
};
+static const enum index next_async_pattern_subcmd[] = {
+ QUEUE_PATTERN_TEMPLATE,
+ QUEUE_ACTIONS_TEMPLATE,
+ ZERO,
+};
+
static const enum index item_param[] = {
ITEM_PARAM_IS,
ITEM_PARAM_SPEC,
@@ -3786,7 +3792,7 @@ static const struct token token_list[] = {
[QUEUE_RULE_ID] = {
.name = "rule_index",
.help = "specify flow rule index",
- .next = NEXT(NEXT_ENTRY(QUEUE_ACTIONS_TEMPLATE),
+ .next = NEXT(next_async_pattern_subcmd,
NEXT_ENTRY(COMMON_UNSIGNED)),
.args = ARGS(ARGS_ENTRY(struct buffer,
args.vc.rule_id)),
@@ -2636,8 +2636,8 @@ port_flow_template_table_create(portid_t port_id, uint32_t id,
}
pt->nb_pattern_templates = nb_pattern_templates;
pt->nb_actions_templates = nb_actions_templates;
- rte_memcpy(&pt->flow_attr, &table_attr->flow_attr,
- sizeof(struct rte_flow_attr));
+ rte_memcpy(&pt->attr, table_attr,
+ sizeof(struct rte_flow_template_table_attr));
printf("Template table #%u created\n", pt->id);
return 0;
}
@@ -2835,7 +2835,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
}
job->type = QUEUE_JOB_TYPE_FLOW_CREATE;
- pf = port_flow_new(&pt->flow_attr, pattern, actions, &error);
+ pf = port_flow_new(&pt->attr.flow_attr, pattern, actions, &error);
if (!pf) {
free(job);
return port_flow_complain(&error);
@@ -2846,12 +2846,22 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x11, sizeof(error));
- if (rule_idx == UINT32_MAX)
+ if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_PATTERN)
flow = rte_flow_async_create(port_id, queue_id, &op_attr, pt->table,
pattern, pattern_idx, actions, actions_idx, job, &error);
- else
+ else if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX)
flow = rte_flow_async_create_by_index(port_id, queue_id, &op_attr, pt->table,
rule_idx, actions, actions_idx, job, &error);
+ else if (pt->attr.insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX_WITH_PATTERN)
+ flow = rte_flow_async_create_by_index_with_pattern(port_id, queue_id, &op_attr,
+ pt->table, rule_idx, pattern, pattern_idx, actions, actions_idx, job,
+ &error);
+ else {
+ free(pf);
+ free(job);
+ printf("Insertion type %d is invalid\n", pt->attr.insertion_type);
+ return -EINVAL;
+ }
if (!flow) {
free(pf);
free(job);
@@ -3060,7 +3070,7 @@ port_queue_flow_update(portid_t port_id, queueid_t queue_id,
}
job->type = QUEUE_JOB_TYPE_FLOW_UPDATE;
- uf = port_flow_new(&pt->flow_attr, pf->rule.pattern_ro, actions, &error);
+ uf = port_flow_new(&pt->attr.flow_attr, pf->rule.pattern_ro, actions, &error);
if (!uf) {
free(job);
return port_flow_complain(&error);
@@ -220,7 +220,7 @@ struct port_table {
uint32_t id; /**< Table ID. */
uint32_t nb_pattern_templates; /**< Number of pattern templates. */
uint32_t nb_actions_templates; /**< Number of actions templates. */
- struct rte_flow_attr flow_attr; /**< Flow attributes. */
+ struct rte_flow_template_table_attr attr; /**< Table attributes. */
struct rte_flow_template_table *table; /**< PMD opaque template object */
};