From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: <elibr@nvidia.com>, <asafp@nvidia.com>, <tmonjalon@nvidia.com>,
Ori Kam <orika@nvidia.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>
Subject: [PATCH V2 1/2] app/testpmd: change flow rule type
Date: Thu, 16 Mar 2023 16:19:33 +0200 [thread overview]
Message-ID: <20230316141934.23181-1-getelson@nvidia.com> (raw)
In-Reply-To: <20230222141139.3233715-2-elibr@nvidia.com>
From: Eli Britstein <elibr@nvidia.com>
Change flow rule type to be uint64_t (instead of currently uint32_t) to
be able to accommodate larger IDs, as a pre-step towards allowing user-id
to flows.
Signed-off-by: Eli Britstein <elibr@nvidia.com>
---
app/test-pmd/cmdline_flow.c | 12 ++++++------
app/test-pmd/config.c | 34 ++++++++++++++++++----------------
app/test-pmd/testpmd.h | 10 +++++-----
3 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 9309607f11..aab0df91c2 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -1085,16 +1085,16 @@ struct buffer {
uint8_t *data;
} vc; /**< Validate/create arguments. */
struct {
- uint32_t *rule;
- uint32_t rule_n;
+ uint64_t *rule;
+ uint64_t rule_n;
} destroy; /**< Destroy arguments. */
struct {
char file[128];
bool mode;
- uint32_t rule;
+ uint64_t rule;
} dump; /**< Dump arguments. */
struct {
- uint32_t rule;
+ uint64_t rule;
struct rte_flow_action action;
} query; /**< Query arguments. */
struct {
@@ -9683,7 +9683,7 @@ parse_qo_destroy(struct context *ctx, const struct token *token,
void *buf, unsigned int size)
{
struct buffer *out = buf;
- uint32_t *flow_id;
+ uint64_t *flow_id;
/* Token name must match. */
if (parse_default(ctx, token, str, len, NULL, 0) < 0)
@@ -10899,7 +10899,7 @@ comp_rule_id(struct context *ctx, const struct token *token,
port = &ports[ctx->port];
for (pf = port->flow_list; pf != NULL; pf = pf->next) {
if (buf && i == ent)
- return snprintf(buf, size, "%u", pf->id);
+ return snprintf(buf, size, "%"PRIu64, pf->id);
++i;
}
if (buf)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 018536f177..804af98c0e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2725,7 +2725,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
flow = rte_flow_async_create_by_index(port_id, queue_id, &op_attr, pt->table,
rule_idx, actions, actions_idx, job, &error);
if (!flow) {
- uint32_t flow_id = pf->id;
+ uint64_t flow_id = pf->id;
port_queue_flow_destroy(port_id, queue_id, true, 1, &flow_id);
free(job);
return port_flow_complain(&error);
@@ -2736,14 +2736,14 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
pf->flow = flow;
job->pf = pf;
port->flow_list = pf;
- printf("Flow rule #%u creation enqueued\n", pf->id);
+ printf("Flow rule #%"PRIu64" creation enqueued\n", pf->id);
return 0;
}
/** Enqueue number of destroy flow rules operations. */
int
port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,
- bool postpone, uint32_t n, const uint32_t *rule)
+ bool postpone, uint32_t n, const uint64_t *rule)
{
struct rte_flow_op_attr op_attr = { .postpone = postpone };
struct rte_port *port;
@@ -2790,7 +2790,8 @@ port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,
ret = port_flow_complain(&error);
continue;
}
- printf("Flow rule #%u destruction enqueued\n", pf->id);
+ printf("Flow rule #%"PRIu64" destruction enqueued\n",
+ pf->id);
*tmp = pf->next;
break;
}
@@ -3089,7 +3090,7 @@ port_queue_flow_push(portid_t port_id, queueid_t queue_id)
/** Pull queue operation results from the queue. */
static int
port_queue_aged_flow_destroy(portid_t port_id, queueid_t queue_id,
- const uint32_t *rule, int nb_flows)
+ const uint64_t *rule, int nb_flows)
{
struct rte_port *port = &ports[port_id];
struct rte_flow_op_result *res;
@@ -3152,7 +3153,7 @@ port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy)
{
void **contexts;
int nb_context, total = 0, idx;
- uint32_t *rules = NULL;
+ uint64_t *rules = NULL;
struct rte_port *port;
struct rte_flow_error error;
enum age_action_context_type *type;
@@ -3208,7 +3209,7 @@ port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy)
switch (*type) {
case ACTION_AGE_CONTEXT_TYPE_FLOW:
ctx.pf = container_of(type, struct port_flow, age_type);
- printf("%-20s\t%" PRIu32 "\t%" PRIu32 "\t%" PRIu32
+ printf("%-20s\t%" PRIu64 "\t%" PRIu32 "\t%" PRIu32
"\t%c%c%c\t\n",
"Flow",
ctx.pf->id,
@@ -3356,13 +3357,13 @@ port_flow_create(portid_t port_id,
port->flow_list = pf;
if (tunnel_ops->enabled)
port_flow_tunnel_offload_cmd_release(port_id, tunnel_ops, pft);
- printf("Flow rule #%u created\n", pf->id);
+ printf("Flow rule #%"PRIu64" created\n", pf->id);
return 0;
}
/** Destroy a number of flow rules. */
int
-port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
+port_flow_destroy(portid_t port_id, uint32_t n, const uint64_t *rule)
{
struct rte_port *port;
struct port_flow **tmp;
@@ -3391,7 +3392,7 @@ port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
ret = port_flow_complain(&error);
continue;
}
- printf("Flow rule #%u destroyed\n", pf->id);
+ printf("Flow rule #%"PRIu64" destroyed\n", pf->id);
*tmp = pf->next;
free(pf);
break;
@@ -3436,7 +3437,7 @@ port_flow_flush(portid_t port_id)
/** Dump flow rules. */
int
-port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
+port_flow_dump(portid_t port_id, bool dump_all, uint64_t rule_id,
const char *file_name)
{
int ret = 0;
@@ -3465,7 +3466,8 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
}
}
if (found == false) {
- fprintf(stderr, "Failed to dump to flow %d\n", rule_id);
+ fprintf(stderr, "Failed to dump to flow %"PRIu64"\n",
+ rule_id);
return -EINVAL;
}
}
@@ -3495,7 +3497,7 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
/** Query a flow rule. */
int
-port_flow_query(portid_t port_id, uint32_t rule,
+port_flow_query(portid_t port_id, uint64_t rule,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
@@ -3517,7 +3519,7 @@ port_flow_query(portid_t port_id, uint32_t rule,
if (pf->id == rule)
break;
if (!pf) {
- fprintf(stderr, "Flow rule #%u not found\n", rule);
+ fprintf(stderr, "Flow rule #%"PRIu64" not found\n", rule);
return -ENOENT;
}
ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
@@ -3624,7 +3626,7 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
switch (*type) {
case ACTION_AGE_CONTEXT_TYPE_FLOW:
ctx.pf = container_of(type, struct port_flow, age_type);
- printf("%-20s\t%" PRIu32 "\t%" PRIu32 "\t%" PRIu32
+ printf("%-20s\t%" PRIu64 "\t%" PRIu32 "\t%" PRIu32
"\t%c%c%c\t\n",
"Flow",
ctx.pf->id,
@@ -3702,7 +3704,7 @@ port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group)
const struct rte_flow_action *action = pf->rule.actions;
const char *name;
- printf("%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t",
+ printf("%" PRIu64 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t",
pf->id,
pf->rule.attr->group,
pf->rule.attr->priority,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index bdfbfd36d3..c2b0a0a48b 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -216,7 +216,7 @@ struct port_table {
struct port_flow {
struct port_flow *next; /**< Next flow in list. */
struct port_flow *tmp; /**< Temporary linking. */
- uint32_t id; /**< Flow rule ID. */
+ uint64_t id; /**< Flow rule ID. */
struct rte_flow *flow; /**< Opaque flow object returned by PMD. */
struct rte_flow_conv_rule rule; /**< Saved flow rule description. */
enum age_action_context_type age_type; /**< Age action context type. */
@@ -966,7 +966,7 @@ int port_queue_flow_create(portid_t port_id, queueid_t queue_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions);
int port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,
- bool postpone, uint32_t n, const uint32_t *rule);
+ bool postpone, uint32_t n, const uint64_t *rule);
int port_queue_action_handle_create(portid_t port_id, uint32_t queue_id,
bool postpone, uint32_t id,
const struct rte_flow_indir_action_conf *conf,
@@ -1002,11 +1002,11 @@ int port_action_handle_query(portid_t port_id, uint32_t id);
void update_age_action_context(const struct rte_flow_action *actions,
struct port_flow *pf);
int mcast_addr_pool_destroy(portid_t port_id);
-int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
+int port_flow_destroy(portid_t port_id, uint32_t n, const uint64_t *rule);
int port_flow_flush(portid_t port_id);
int port_flow_dump(portid_t port_id, bool dump_all,
- uint32_t rule, const char *file_name);
-int port_flow_query(portid_t port_id, uint32_t rule,
+ uint64_t rule, const char *file_name);
+int port_flow_query(portid_t port_id, uint64_t rule,
const struct rte_flow_action *action);
void port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group);
void port_flow_aged(portid_t port_id, uint8_t destroy);
--
2.25.1
next prev parent reply other threads:[~2023-03-16 14:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 14:11 [PATCH 1/2] app/testpmd: change rule type Eli Britstein
2023-02-22 14:11 ` [PATCH 2/2] app/testpmd: user assigned flow ID to flows Eli Britstein
2023-02-22 16:50 ` Thomas Monjalon
2023-03-16 14:19 ` Gregory Etelson [this message]
2023-03-16 14:19 ` [PATCH V2 2/2] app/testpmd: assign custom ID to flow rules Gregory Etelson
2023-06-02 20:19 ` Ferruh Yigit
2023-06-30 10:21 ` Ferruh Yigit
2023-07-04 8:25 ` Ori Kam
2023-07-04 14:40 ` Ferruh Yigit
2023-06-02 20:19 ` [PATCH V2 1/2] app/testpmd: change flow rule type Ferruh Yigit
2023-03-01 1:00 ` [PATCH 1/2] app/testpmd: change " 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=20230316141934.23181-1-getelson@nvidia.com \
--to=getelson@nvidia.com \
--cc=aman.deep.singh@intel.com \
--cc=asafp@nvidia.com \
--cc=dev@dpdk.org \
--cc=elibr@nvidia.com \
--cc=orika@nvidia.com \
--cc=tmonjalon@nvidia.com \
--cc=yuying.zhang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.