From: Bing Zhao <bingz@nvidia.com>
To: orika@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com,
andrew.rybchenko@oktetlabs.ru, matan@nvidia.com,
viacheslavo@nvidia.com
Cc: dev@dpdk.org, ajit.khaparde@broadcom.com, getelson@nvidia.com,
andreyv@nvidia.com
Subject: [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command
Date: Sat, 10 Apr 2021 22:03:46 +0800 [thread overview]
Message-ID: <1618063428-206842-3-git-send-email-bingz@nvidia.com> (raw)
In-Reply-To: <1618063428-206842-1-git-send-email-bingz@nvidia.com>
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces are also need to be updated to do the adaption.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
app/test-pmd/cmdline.c | 24 ++---
app/test-pmd/cmdline_flow.c | 252 ++++++++++++++++++++++----------------------
app/test-pmd/config.c | 160 ++++++++++++++--------------
app/test-pmd/testpmd.h | 28 ++---
4 files changed, 232 insertions(+), 232 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f44116b..c28a3d2 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1002,23 +1002,23 @@ static void cmd_help_long_parsed(void *parsed_result,
" List and destroy aged flows"
" flow rules\n\n"
- "flow shared_action {port_id} create"
- " [action_id {shared_action_id}]"
+ "flow indirect_action {port_id} create"
+ " [action_id {indirect_action_id}]"
" [ingress] [egress]"
" action {action} / end\n"
- " Create shared action.\n\n"
+ " Create indirect action.\n\n"
- "flow shared_action {port_id} update"
- " {shared_action_id} action {action} / end\n"
- " Update shared action.\n\n"
+ "flow indirect_action {port_id} update"
+ " {indirect_action_id} action {action} / end\n"
+ " Update indirect action.\n\n"
- "flow shared_action {port_id} destroy"
- " action_id {shared_action_id} [...]\n"
- " Destroy specific shared actions.\n\n"
+ "flow indirect_action {port_id} destroy"
+ " action_id {indirect_action_id} [...]\n"
+ " Destroy specific indirect actions.\n\n"
- "flow shared_action {port_id} query"
- " {shared_action_id}\n"
- " Query an existing shared action.\n\n"
+ "flow indirect_action {port_id} query"
+ " {indirect_action_id}\n"
+ " Query an existing indirect action.\n\n"
"set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src"
" (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst"
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 2c40c69..d4e11a8 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -54,7 +54,7 @@ enum index {
PORT_ID,
GROUP_ID,
PRIORITY_LEVEL,
- SHARED_ACTION_ID,
+ INDIRECT_ACTION_ID,
/* Top-level command. */
SET,
@@ -68,7 +68,7 @@ enum index {
/* Top-level command. */
FLOW,
/* Sub-level commands. */
- SHARED_ACTION,
+ INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -108,21 +108,21 @@ enum index {
TUNNEL_SET,
TUNNEL_MATCH,
- /* Shared action arguments */
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+ /* Indirect action arguments */
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
- /* Shared action create arguments */
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+ /* Indirect action create arguments */
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
- /* Shared action destroy arguments */
- SHARED_ACTION_DESTROY_ID,
+ /* Indirect action destroy arguments */
+ INDIRECT_ACTION_DESTROY_ID,
/* Validate/create pattern. */
PATTERN,
@@ -412,8 +412,8 @@ enum index {
ACTION_SAMPLE_RATIO,
ACTION_SAMPLE_INDEX,
ACTION_SAMPLE_INDEX_VALUE,
- ACTION_SHARED,
- SHARED_ACTION_ID2PTR,
+ ACTION_INDIRECT,
+ INDIRECT_ACTION_ID2PTR,
ACTION_MODIFY_FIELD,
ACTION_MODIFY_FIELD_OP,
ACTION_MODIFY_FIELD_OP_VALUE,
@@ -772,10 +772,10 @@ struct buffer {
struct {
uint32_t *action_id;
uint32_t action_id_n;
- } sa_destroy; /**< Shared action destroy arguments. */
+ } ia_destroy; /**< Indirect action destroy arguments. */
struct {
uint32_t action_id;
- } sa; /* Shared action query arguments */
+ } ia; /* Indirect action query arguments */
struct {
struct rte_flow_attr attr;
struct tunnel_ops tunnel_ops;
@@ -833,20 +833,20 @@ struct parse_action_priv {
.size = s, \
})
-static const enum index next_sa_create_attr[] = {
- SHARED_ACTION_CREATE_ID,
- SHARED_ACTION_INGRESS,
- SHARED_ACTION_EGRESS,
- SHARED_ACTION_TRANSFER,
- SHARED_ACTION_SPEC,
+static const enum index next_ia_create_attr[] = {
+ INDIRECT_ACTION_CREATE_ID,
+ INDIRECT_ACTION_INGRESS,
+ INDIRECT_ACTION_EGRESS,
+ INDIRECT_ACTION_TRANSFER,
+ INDIRECT_ACTION_SPEC,
ZERO,
};
-static const enum index next_sa_subcmd[] = {
- SHARED_ACTION_CREATE,
- SHARED_ACTION_UPDATE,
- SHARED_ACTION_DESTROY,
- SHARED_ACTION_QUERY,
+static const enum index next_ia_subcmd[] = {
+ INDIRECT_ACTION_CREATE,
+ INDIRECT_ACTION_UPDATE,
+ INDIRECT_ACTION_DESTROY,
+ INDIRECT_ACTION_QUERY,
ZERO,
};
@@ -886,8 +886,8 @@ struct parse_action_priv {
ZERO,
};
-static const enum index next_sa_destroy_attr[] = {
- SHARED_ACTION_DESTROY_ID,
+static const enum index next_ia_destroy_attr[] = {
+ INDIRECT_ACTION_DESTROY_ID,
END,
ZERO,
};
@@ -1366,7 +1366,7 @@ struct parse_action_priv {
ACTION_SET_IPV6_DSCP,
ACTION_AGE,
ACTION_SAMPLE,
- ACTION_SHARED,
+ ACTION_INDIRECT,
ACTION_MODIFY_FIELD,
ZERO,
};
@@ -1781,13 +1781,13 @@ static int parse_ipv6_addr(struct context *, const struct token *,
static int parse_port(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa(struct context *, const struct token *,
+static int parse_ia(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
-static int parse_sa_destroy(struct context *ctx, const struct token *token,
+static int parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size);
-static int parse_sa_id2ptr(struct context *ctx, const struct token *token,
+static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len, void *buf,
unsigned int size);
static int comp_none(struct context *, const struct token *,
@@ -1934,10 +1934,10 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_int,
.comp = comp_none,
},
- [SHARED_ACTION_ID] = {
- .name = "{shared_action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ [INDIRECT_ACTION_ID] = {
+ .name = "{indirect_action_id}",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.call = parse_int,
.comp = comp_none,
},
@@ -1947,7 +1947,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.type = "{command} {port_id} [{arg} [...]]",
.help = "manage ingress/egress flow rules",
.next = NEXT(NEXT_ENTRY
- (SHARED_ACTION,
+ (INDIRECT_ACTION,
VALIDATE,
CREATE,
DESTROY,
@@ -1961,42 +1961,42 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_init,
},
/* Top-level command. */
- [SHARED_ACTION] = {
- .name = "shared_action",
+ [INDIRECT_ACTION] = {
+ .name = "indirect_action",
.type = "{command} {port_id} [{arg} [...]]",
- .help = "manage shared actions",
- .next = NEXT(next_sa_subcmd, NEXT_ENTRY(PORT_ID)),
+ .help = "manage indirect actions",
+ .next = NEXT(next_ia_subcmd, NEXT_ENTRY(PORT_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa,
+ .call = parse_ia,
},
/* Sub-level commands. */
- [SHARED_ACTION_CREATE] = {
+ [INDIRECT_ACTION_CREATE] = {
.name = "create",
- .help = "create shared action",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .help = "create indirect action",
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_UPDATE] = {
+ [INDIRECT_ACTION_UPDATE] = {
.name = "update",
- .help = "update shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_SPEC),
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "update indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_SPEC),
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
- .call = parse_sa,
+ .call = parse_ia,
},
- [SHARED_ACTION_DESTROY] = {
+ [INDIRECT_ACTION_DESTROY] = {
.name = "destroy",
- .help = "destroy shared action",
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_DESTROY_ID)),
+ .help = "destroy indirect action",
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_DESTROY_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, port)),
- .call = parse_sa_destroy,
+ .call = parse_ia_destroy,
},
- [SHARED_ACTION_QUERY] = {
+ [INDIRECT_ACTION_QUERY] = {
.name = "query",
- .help = "query shared action",
- .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(SHARED_ACTION_ID)),
- .args = ARGS(ARGS_ENTRY(struct buffer, args.sa.action_id)),
- .call = parse_sa,
+ .help = "query indirect action",
+ .next = NEXT(NEXT_ENTRY(END), NEXT_ENTRY(INDIRECT_ACTION_ID)),
+ .args = ARGS(ARGS_ENTRY(struct buffer, args.ia.action_id)),
+ .call = parse_ia,
},
[VALIDATE] = {
.name = "validate",
@@ -4467,61 +4467,61 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
.call = parse_vc_action_sample_index,
.comp = comp_set_sample_index,
},
- /* Shared action destroy arguments. */
- [SHARED_ACTION_DESTROY_ID] = {
+ /* Indirect action destroy arguments. */
+ [INDIRECT_ACTION_DESTROY_ID] = {
.name = "action_id",
- .help = "specify a shared action id to destroy",
- .next = NEXT(next_sa_destroy_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to destroy",
+ .next = NEXT(next_ia_destroy_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY_PTR(struct buffer,
- args.sa_destroy.action_id)),
- .call = parse_sa_destroy,
+ args.ia_destroy.action_id)),
+ .call = parse_ia_destroy,
},
- /* Shared action create arguments. */
- [SHARED_ACTION_CREATE_ID] = {
+ /* Indirect action create arguments. */
+ [INDIRECT_ACTION_CREATE_ID] = {
.name = "action_id",
- .help = "specify a shared action id to create",
- .next = NEXT(next_sa_create_attr,
- NEXT_ENTRY(SHARED_ACTION_ID)),
+ .help = "specify a indirect action id to create",
+ .next = NEXT(next_ia_create_attr,
+ NEXT_ENTRY(INDIRECT_ACTION_ID)),
.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.attr.group)),
},
- [ACTION_SHARED] = {
- .name = "shared",
- .help = "apply shared action by id",
- .priv = PRIV_ACTION(SHARED, 0),
- .next = NEXT(NEXT_ENTRY(SHARED_ACTION_ID2PTR)),
+ [ACTION_INDIRECT] = {
+ .name = "indirect",
+ .help = "apply indirect action by id",
+ .priv = PRIV_ACTION(INDIRECT, 0),
+ .next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
.call = parse_vc,
},
- [SHARED_ACTION_ID2PTR] = {
+ [INDIRECT_ACTION_ID2PTR] = {
.name = "{action_id}",
- .type = "SHARED_ACTION_ID",
- .help = "shared action id",
+ .type = "INDIRECT_ACTION_ID",
+ .help = "indirect action id",
.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
- .call = parse_sa_id2ptr,
+ .call = parse_ia_id2ptr,
.comp = comp_none,
},
- [SHARED_ACTION_INGRESS] = {
+ [INDIRECT_ACTION_INGRESS] = {
.name = "ingress",
.help = "affect rule to ingress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_EGRESS] = {
+ [INDIRECT_ACTION_EGRESS] = {
.name = "egress",
.help = "affect rule to egress",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_TRANSFER] = {
+ [INDIRECT_ACTION_TRANSFER] = {
.name = "transfer",
.help = "affect rule to transfer",
- .next = NEXT(next_sa_create_attr),
- .call = parse_sa,
+ .next = NEXT(next_ia_create_attr),
+ .call = parse_ia,
},
- [SHARED_ACTION_SPEC] = {
+ [INDIRECT_ACTION_SPEC] = {
.name = "action",
- .help = "specify action to share",
+ .help = "specify action to create indirect handle",
.next = NEXT(next_action),
},
};
@@ -4708,9 +4708,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
return len;
}
-/** Parse tokens for shared action commands. */
+/** Parse tokens for indirect action commands. */
static int
-parse_sa(struct context *ctx, const struct token *token,
+parse_ia(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4723,7 +4723,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
if (!out)
return len;
if (!out->command) {
- if (ctx->curr != SHARED_ACTION)
+ if (ctx->curr != INDIRECT_ACTION)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4735,26 +4735,26 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
return len;
}
switch (ctx->curr) {
- case SHARED_ACTION_CREATE:
- case SHARED_ACTION_UPDATE:
+ case INDIRECT_ACTION_CREATE:
+ case INDIRECT_ACTION_UPDATE:
out->args.vc.actions =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
out->args.vc.attr.group = UINT32_MAX;
/* fallthrough */
- case SHARED_ACTION_QUERY:
+ case INDIRECT_ACTION_QUERY:
out->command = ctx->curr;
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
return len;
- case SHARED_ACTION_EGRESS:
+ case INDIRECT_ACTION_EGRESS:
out->args.vc.attr.egress = 1;
return len;
- case SHARED_ACTION_INGRESS:
+ case INDIRECT_ACTION_INGRESS:
out->args.vc.attr.ingress = 1;
return len;
- case SHARED_ACTION_TRANSFER:
+ case INDIRECT_ACTION_TRANSFER:
out->args.vc.attr.transfer = 1;
return len;
default:
@@ -4763,9 +4763,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
}
-/** Parse tokens for shared action destroy command. */
+/** Parse tokens for indirect action destroy command. */
static int
-parse_sa_destroy(struct context *ctx, const struct token *token,
+parse_ia_destroy(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -4778,8 +4778,8 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
/* Nothing else to do if there is no buffer. */
if (!out)
return len;
- if (!out->command || out->command == SHARED_ACTION) {
- if (ctx->curr != SHARED_ACTION_DESTROY)
+ if (!out->command || out->command == INDIRECT_ACTION) {
+ if (ctx->curr != INDIRECT_ACTION_DESTROY)
return -1;
if (sizeof(*out) > size)
return -1;
@@ -4787,13 +4787,13 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
ctx->objdata = 0;
ctx->object = out;
ctx->objmask = NULL;
- out->args.sa_destroy.action_id =
+ out->args.ia_destroy.action_id =
(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
sizeof(double));
return len;
}
- action_id = out->args.sa_destroy.action_id
- + out->args.sa_destroy.action_id_n++;
+ action_id = out->args.ia_destroy.action_id
+ + out->args.ia_destroy.action_id_n++;
if ((uint8_t *)action_id > (uint8_t *)out + size)
return -1;
ctx->objdata = 0;
@@ -7043,7 +7043,7 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
}
static int
-parse_sa_id2ptr(struct context *ctx, const struct token *token,
+parse_ia_id2ptr(struct context *ctx, const struct token *token,
const char *str, unsigned int len,
void *buf, unsigned int size)
{
@@ -7060,9 +7060,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
ctx->object = action;
if (ret != (int)len)
return ret;
- /* set shared action */
+ /* set indirect action */
if (action) {
- action->conf = port_shared_action_get_by_id(ctx->port, id);
+ action->conf = port_action_handle_get_by_id(ctx->port, id);
ret = (action->conf) ? ret : -1;
}
return ret;
@@ -7600,27 +7600,27 @@ static int comp_set_modify_field_id(struct context *, const struct token *,
cmd_flow_parsed(const struct buffer *in)
{
switch (in->command) {
- case SHARED_ACTION_CREATE:
- port_shared_action_create(
+ case INDIRECT_ACTION_CREATE:
+ port_action_handle_create(
in->port, in->args.vc.attr.group,
- &((const struct rte_flow_shared_action_conf) {
+ &((const struct rte_flow_indir_action_conf) {
.ingress = in->args.vc.attr.ingress,
.egress = in->args.vc.attr.egress,
.transfer = in->args.vc.attr.transfer,
}),
in->args.vc.actions);
break;
- case SHARED_ACTION_DESTROY:
- port_shared_action_destroy(in->port,
- in->args.sa_destroy.action_id_n,
- in->args.sa_destroy.action_id);
+ case INDIRECT_ACTION_DESTROY:
+ port_action_handle_destroy(in->port,
+ in->args.ia_destroy.action_id_n,
+ in->args.ia_destroy.action_id);
break;
- case SHARED_ACTION_UPDATE:
- port_shared_action_update(in->port, in->args.vc.attr.group,
+ case INDIRECT_ACTION_UPDATE:
+ port_action_handle_update(in->port, in->args.vc.attr.group,
in->args.vc.actions);
break;
- case SHARED_ACTION_QUERY:
- port_shared_action_query(in->port, in->args.sa.action_id);
+ case INDIRECT_ACTION_QUERY:
+ port_action_handle_query(in->port, in->args.ia.action_id);
break;
case VALIDATE:
port_flow_validate(in->port, &in->args.vc.attr,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ef0b978..1eec061 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1391,38 +1391,38 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
}
}
-static struct port_shared_action *
+static struct port_indirect_action *
action_get_by_id(portid_t port_id, uint32_t id)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)
return NULL;
port = &ports[port_id];
- ppsa = &port->actions_list;
- while (*ppsa) {
- if ((*ppsa)->id == id) {
- psa = *ppsa;
+ ppia = &port->actions_list;
+ while (*ppia) {
+ if ((*ppia)->id == id) {
+ pia = *ppia;
break;
}
- ppsa = &(*ppsa)->next;
+ ppia = &(*ppia)->next;
}
- if (!psa)
- printf("Failed to find shared action #%u on port %u\n",
+ if (!pia)
+ printf("Failed to find indirect action #%u on port %u\n",
id, port_id);
- return psa;
+ return pia;
}
static int
action_alloc(portid_t port_id, uint32_t id,
- struct port_shared_action **action)
+ struct port_indirect_action **action)
{
struct rte_port *port;
- struct port_shared_action **ppsa;
- struct port_shared_action *psa = NULL;
+ struct port_indirect_action **ppia;
+ struct port_indirect_action *pia = NULL;
*action = NULL;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1433,7 +1433,7 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
/* taking first available ID */
if (port->actions_list) {
if (port->actions_list->id == UINT32_MAX - 1) {
- printf("Highest shared action ID is already"
+ printf("Highest indirect action ID is already"
" assigned, delete it first\n");
return -ENOMEM;
}
@@ -1442,70 +1442,70 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
id = 0;
}
}
- psa = calloc(1, sizeof(*psa));
- if (!psa) {
- printf("Allocation of port %u shared action failed\n",
+ pia = calloc(1, sizeof(*pia));
+ if (!pia) {
+ printf("Allocation of port %u indirect action failed\n",
port_id);
return -ENOMEM;
}
- ppsa = &port->actions_list;
- while (*ppsa && (*ppsa)->id > id)
- ppsa = &(*ppsa)->next;
- if (*ppsa && (*ppsa)->id == id) {
- printf("Shared action #%u is already assigned,"
+ ppia = &port->actions_list;
+ while (*ppia && (*ppia)->id > id)
+ ppia = &(*ppia)->next;
+ if (*ppia && (*ppia)->id == id) {
+ printf("Indirect action #%u is already assigned,"
" delete it first\n", id);
- free(psa);
+ free(pia);
return -EINVAL;
}
- psa->next = *ppsa;
- psa->id = id;
- *ppsa = psa;
- *action = psa;
+ pia->next = *ppia;
+ pia->id = id;
+ *ppia = pia;
+ *action = pia;
return 0;
}
-/** Create shared action */
+/** Create indirect action */
int
-port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action)
{
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
- ret = action_alloc(port_id, id, &psa);
+ ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
- psa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;
- age->context = &psa->age_type;
+ pia->age_type = ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION;
+ age->context = &pia->age_type;
}
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x22, sizeof(error));
- psa->action = rte_flow_shared_action_create(port_id, conf, action,
+ pia->handle = rte_flow_action_handle_create(port_id, conf, action,
&error);
- if (!psa->action) {
- uint32_t destroy_id = psa->id;
- port_shared_action_destroy(port_id, 1, &destroy_id);
+ if (!pia->handle) {
+ uint32_t destroy_id = pia->id;
+ port_action_handle_destroy(port_id, 1, &destroy_id);
return port_flow_complain(&error);
}
- psa->type = action->type;
- printf("Shared action #%u created\n", psa->id);
+ pia->type = action->type;
+ printf("Indirect action #%u created\n", pia->id);
return 0;
}
-/** Destroy shared action */
+/** Destroy indirect action */
int
-port_shared_action_destroy(portid_t port_id,
+port_action_handle_destroy(portid_t port_id,
uint32_t n,
const uint32_t *actions)
{
struct rte_port *port;
- struct port_shared_action **tmp;
+ struct port_indirect_action **tmp;
uint32_t c = 0;
int ret = 0;
@@ -1519,9 +1519,9 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
- struct port_shared_action *psa = *tmp;
+ struct port_indirect_action *pia = *tmp;
- if (actions[i] != psa->id)
+ if (actions[i] != pia->id)
continue;
/*
* Poisoning to make sure PMDs update it in case
@@ -1529,14 +1529,14 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
*/
memset(&error, 0x33, sizeof(error));
- if (psa->action && rte_flow_shared_action_destroy(
- port_id, psa->action, &error)) {
+ if (pia->handle && rte_flow_action_handle_destroy(
+ port_id, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
- *tmp = psa->next;
- printf("Shared action #%u destroyed\n", psa->id);
- free(psa);
+ *tmp = pia->next;
+ printf("Indirect action #%u destroyed\n", pia->id);
+ free(pia);
break;
}
if (i == n)
@@ -1547,60 +1547,60 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
}
-/** Get shared action by port + id */
-struct rte_flow_shared_action *
-port_shared_action_get_by_id(portid_t port_id, uint32_t id)
+/** Get indirect action by port + id */
+struct rte_flow_action_handle *
+port_action_handle_get_by_id(portid_t port_id, uint32_t id)
{
- struct port_shared_action *psa = action_get_by_id(port_id, id);
+ struct port_indirect_action *pia = action_get_by_id(port_id, id);
- return (psa) ? psa->action : NULL;
+ return (pia) ? pia->handle : NULL;
}
-/** Update shared action */
+/** Update indirect action */
int
-port_shared_action_update(portid_t port_id, uint32_t id,
+port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action)
{
struct rte_flow_error error;
- struct rte_flow_shared_action *shared_action;
+ struct rte_flow_action_handle *action_handle;
- shared_action = port_shared_action_get_by_id(port_id, id);
- if (!shared_action)
+ action_handle = port_action_handle_get_by_id(port_id, id);
+ if (!action_handle)
return -EINVAL;
- if (rte_flow_shared_action_update(port_id, shared_action, action,
+ if (rte_flow_action_handle_update(port_id, action_handle, action,
&error)) {
return port_flow_complain(&error);
}
- printf("Shared action #%u updated\n", id);
+ printf("Indirect action #%u updated\n", id);
return 0;
}
int
-port_shared_action_query(portid_t port_id, uint32_t id)
+port_action_handle_query(portid_t port_id, uint32_t id)
{
struct rte_flow_error error;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
uint64_t default_data;
void *data = NULL;
int ret = 0;
- psa = action_get_by_id(port_id, id);
- if (!psa)
+ pia = action_get_by_id(port_id, id);
+ if (!pia)
return -EINVAL;
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
case RTE_FLOW_ACTION_TYPE_AGE:
data = &default_data;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
return -1;
}
- if (rte_flow_shared_action_query(port_id, psa->action, data, &error))
+ if (rte_flow_action_handle_query(port_id, pia->handle, data, &error))
ret = port_flow_complain(&error);
- switch (psa->type) {
+ switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_RSS:
if (!ret)
printf("Shared RSS action:\n\trefs:%u\n",
@@ -1622,8 +1622,8 @@ struct rte_flow_shared_action *
data = NULL;
break;
default:
- printf("Shared action %u (type: %d) on port %u doesn't support"
- " query\n", id, psa->type, port_id);
+ printf("Indirect action %u (type: %d) on port %u doesn't"
+ " support query\n", id, pia->type, port_id);
ret = -1;
}
return ret;
@@ -2033,7 +2033,7 @@ struct rte_flow_shared_action *
enum age_action_context_type *type;
union {
struct port_flow *pf;
- struct port_shared_action *psa;
+ struct port_indirect_action *pia;
} ctx;
if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2083,11 +2083,11 @@ struct rte_flow_shared_action *
&ctx.pf->id))
total++;
break;
- case ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:
- ctx.psa = container_of(type, struct port_shared_action,
- age_type);
- printf("%-20s\t%" PRIu32 "\n", "Shared action",
- ctx.psa->id);
+ case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
+ ctx.pia = container_of(type,
+ struct port_indirect_action, age_type);
+ printf("%-20s\t%" PRIu32 "\n", "Indirect action",
+ ctx.pia->id);
break;
default:
printf("Error: invalid context type %u\n", port_id);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index a87ccb0..d1eaaad 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -151,7 +151,7 @@ struct fwd_stream {
*/
enum age_action_context_type {
ACTION_AGE_CONTEXT_TYPE_FLOW,
- ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,
+ ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,
};
/** Descriptor for a single flow. */
@@ -165,12 +165,12 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-/* Descriptor for shared action */
-struct port_shared_action {
- struct port_shared_action *next; /**< Next flow in list. */
- uint32_t id; /**< Shared action ID. */
+/* Descriptor for indirect action */
+struct port_indirect_action {
+ struct port_indirect_action *next; /**< Next flow in list. */
+ uint32_t id; /**< Indirect action ID. */
enum rte_flow_action_type type; /**< Action type. */
- struct rte_flow_shared_action *action; /**< Shared action handle. */
+ struct rte_flow_action_handle *handle; /**< Indirect action handle. */
enum age_action_context_type age_type; /**< Age action context type. */
};
@@ -222,8 +222,8 @@ struct rte_port {
uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
uint8_t slave_flag; /**< bonding slave port */
struct port_flow *flow_list; /**< Associated flows. */
- struct port_shared_action *actions_list;
- /**< Associated shared actions. */
+ struct port_indirect_action *actions_list;
+ /**< Associated indirect actions. */
LIST_HEAD(, port_flow_tunnel) flow_tunnel_list;
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -801,14 +801,14 @@ void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
void port_reg_display(portid_t port_id, uint32_t reg_off);
void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
-int port_shared_action_create(portid_t port_id, uint32_t id,
- const struct rte_flow_shared_action_conf *conf,
+int port_action_handle_create(portid_t port_id, uint32_t id,
+ const struct rte_flow_indir_action_conf *conf,
const struct rte_flow_action *action);
-int port_shared_action_destroy(portid_t port_id,
+int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
-struct rte_flow_shared_action *port_shared_action_get_by_id(portid_t port_id,
+struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
-int port_shared_action_update(portid_t port_id, uint32_t id,
+int port_action_handle_update(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_flow_validate(portid_t port_id,
const struct rte_flow_attr *attr,
@@ -820,7 +820,7 @@ int port_flow_create(portid_t port_id,
const struct rte_flow_item *pattern,
const struct rte_flow_action *actions,
const struct tunnel_ops *tunnel_ops);
-int port_shared_action_query(portid_t port_id, uint32_t id);
+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 port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
--
1.8.3.1
next prev parent reply other threads:[~2021-04-10 14:04 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
2021-03-17 8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
2021-03-17 16:10 ` Bing Zhao
2021-03-22 14:59 ` Andrew Rybchenko
2021-04-06 9:05 ` Bing Zhao
2021-03-22 14:54 ` Andrew Rybchenko
2021-04-06 9:07 ` Bing Zhao
2021-04-06 9:48 ` Thomas Monjalon
2021-04-06 11:02 ` Bing Zhao
2021-04-06 12:18 ` Thomas Monjalon
2021-04-07 3:16 ` Ajit Khaparde
2021-04-07 6:11 ` Bing Zhao
2021-04-08 14:46 ` [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs Bing Zhao
2021-04-09 3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-12 19:42 ` Ferruh Yigit
2021-04-13 1:26 ` Bing Zhao
2021-04-13 14:00 ` Ori Kam
2021-04-13 12:36 ` Andrey Vesnovaty
2021-04-15 13:55 ` Andrew Rybchenko
2021-04-15 14:10 ` Thomas Monjalon
2021-04-15 16:02 ` Andrew Rybchenko
2021-04-10 14:03 ` Bing Zhao [this message]
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action Bing Zhao
2021-04-10 14:03 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API Bing Zhao
2021-04-12 19:40 ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
2021-04-13 1:22 ` Bing Zhao
2021-04-13 7:23 ` Thomas Monjalon
2021-04-13 7:24 ` Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
2021-04-15 15:51 ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-15 15:56 ` Ori Kam
2021-04-15 17:59 ` Ajit Khaparde
2021-04-16 6:58 ` Bing Zhao
2021-04-16 7:03 ` Thomas Monjalon
2021-04-16 15:00 ` Ajit Khaparde
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
2021-04-16 17:33 ` [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 12:26 ` Thomas Monjalon
2021-04-19 15:05 ` Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
2021-04-19 14:28 ` [dpdk-dev] [PATCH v5] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
2021-04-19 14:38 ` [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:50 ` Thomas Monjalon
2021-04-19 15:09 ` 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=1618063428-206842-3-git-send-email-bingz@nvidia.com \
--to=bingz@nvidia.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=andreyv@nvidia.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=getelson@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.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 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).