From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <dsosnowski@nvidia.com>, <orika@nvidia.com>,
<thomas@monjalon.net>, <matan@nvidia.com>, <ferruh.yigit@amd.com>,
<stephen@networkplumber.org>
Subject: [PATCH v2 4/7] app/testpmd: add insertion by index with pattern option
Date: Wed, 25 Sep 2024 21:05:29 +0300 [thread overview]
Message-ID: <20240925180532.3958656-5-akozyrev@nvidia.com> (raw)
In-Reply-To: <20240925180532.3958656-1-akozyrev@nvidia.com>
Allow to specify both the rule index and the pattern
in the flow rule creation command line parameters.
Both are needed for rte_flow_async_create_by_index_with_pattern().
flow queue 0 create 0 template_table 2 rule_index 5
pattern_template 0 actions_template 0 postpone no pattern eth / end
actions count / queue index 1 / end
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 8 +++++++-
app/test-pmd/config.c | 22 ++++++++++++++++------
app/test-pmd/testpmd.h | 2 +-
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b048821e85..65030936d2 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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)),
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 6f0beafa27..39924d8da9 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9facd7f281..f9ab88d667 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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 */
};
--
2.18.2
next prev parent reply other threads:[~2024-09-25 18:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 0:48 [PATCH 0/6] ethdev: jump to table support Alexander Kozyrev
2024-09-19 0:48 ` [PATCH 1/6] ethdev: add insertion by index with pattern Alexander Kozyrev
2024-09-25 15:01 ` Dariusz Sosnowski
2024-09-19 0:48 ` [PATCH 2/6] app/testpmd: add index with pattern insertion type Alexander Kozyrev
2024-09-25 15:01 ` Dariusz Sosnowski
2024-09-19 0:48 ` [PATCH 3/6] ethdev: add flow rule insertion by index with pattern Alexander Kozyrev
2024-09-25 15:00 ` Dariusz Sosnowski
2024-09-19 0:48 ` [PATCH 4/6] app/testpmd: add insertion by index with pattern option Alexander Kozyrev
2024-09-25 15:01 ` Dariusz Sosnowski
2024-09-19 0:48 ` [PATCH 5/6] ethdev: add jump to table index action Alexander Kozyrev
2024-09-25 15:01 ` Dariusz Sosnowski
2024-09-19 0:48 ` [PATCH 6/6] app/testpmd: " Alexander Kozyrev
2024-09-25 15:02 ` Dariusz Sosnowski
2024-09-25 18:05 ` [PATCH v2 0/7] ethdev: jump to table support Alexander Kozyrev
2024-09-25 18:05 ` [PATCH v2 1/7] ethdev: add insertion by index with pattern Alexander Kozyrev
2024-09-26 8:23 ` Ori Kam
2024-09-25 18:05 ` [PATCH v2 2/7] app/testpmd: add index with pattern insertion type Alexander Kozyrev
2024-09-26 8:24 ` Ori Kam
2024-09-25 18:05 ` [PATCH v2 3/7] ethdev: add flow rule insertion by index with pattern Alexander Kozyrev
2024-09-26 8:26 ` Ori Kam
2024-09-25 18:05 ` Alexander Kozyrev [this message]
2024-09-26 8:48 ` [PATCH v2 4/7] app/testpmd: add insertion by index with pattern option Ori Kam
2024-09-25 18:05 ` [PATCH v2 5/7] ethdev: add jump to table index action Alexander Kozyrev
2024-09-26 8:49 ` Ori Kam
2024-09-25 18:05 ` [PATCH v2 6/7] app/testpmd: " Alexander Kozyrev
2024-09-26 8:49 ` Ori Kam
2024-09-25 18:05 ` [PATCH v2 7/7] ethdev: add trace points to flow insertion by index Alexander Kozyrev
2024-09-26 8:50 ` Ori Kam
2024-09-25 19:28 ` [PATCH v2 0/7] ethdev: jump to table support Dariusz Sosnowski
2024-09-27 1:51 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240925180532.3958656-5-akozyrev@nvidia.com \
--to=akozyrev@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=ferruh.yigit@amd.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).