DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@amd.com>, <orika@nvidia.com>, <rasland@nvidia.com>,
	<matan@nvidia.com>, <arybchenko@solarflare.com>
Subject: [PATCH v2 3/9] app/testpmd: add shared indirect action support
Date: Tue, 7 Feb 2023 16:02:00 +0200	[thread overview]
Message-ID: <20230207140206.29139-3-viacheslavo@nvidia.com> (raw)
In-Reply-To: <20230207140206.29139-1-viacheslavo@nvidia.com>

The shared indirect action can be shared between ports,
action should be created on single port and the handle
can be used in the templates and flows on multiple ports,
example:

  flow configure 0 queues_number 1 queues_size 64 counters_number 64
  flow configure 1 queues_number 1 queues_size 64 counters_number 0 \
                   host_port 0 flags 1

  flow indirect_action 0 create ingress action_id 0 action count / end

  flow actions_template 0 create ingress actions_template_id 8
       template indirect 0 / queue index 0 / end
       mask count / queue index 0 / end

  flow actions_template 1 create ingress actions_template_id 18
       template shared_indirect 0 0 / queue index 0 / end
       mask count / queue index 0 / end

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 53 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b88756903b..734959ba9b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -595,6 +595,8 @@ enum index {
 	ACTION_SAMPLE_INDEX,
 	ACTION_SAMPLE_INDEX_VALUE,
 	ACTION_INDIRECT,
+	ACTION_SHARED_INDIRECT,
+	INDIRECT_ACTION_PORT,
 	INDIRECT_ACTION_ID2PTR,
 	ACTION_MODIFY_FIELD,
 	ACTION_MODIFY_FIELD_OP,
@@ -1882,6 +1884,7 @@ static const enum index next_action[] = {
 	ACTION_AGE_UPDATE,
 	ACTION_SAMPLE,
 	ACTION_INDIRECT,
+	ACTION_SHARED_INDIRECT,
 	ACTION_MODIFY_FIELD,
 	ACTION_CONNTRACK,
 	ACTION_CONNTRACK_UPDATE,
@@ -2387,6 +2390,9 @@ static int parse_ia_destroy(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 parse_ia_port(struct context *ctx, const struct token *token,
+			 const char *str, unsigned int len, void *buf,
+			 unsigned int size);
 static int parse_mp(struct context *, const struct token *,
 		    const char *, unsigned int,
 		    void *, unsigned int);
@@ -6374,6 +6380,23 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
 		.call = parse_vc,
 	},
+	[ACTION_SHARED_INDIRECT] = {
+		.name = "shared_indirect",
+		.help = "apply indirect action by id and port",
+		.priv = PRIV_ACTION(INDIRECT, 0),
+		.next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_PORT)),
+		.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t)),
+			     ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
+		.call = parse_vc,
+	},
+	[INDIRECT_ACTION_PORT] = {
+		.name = "{indirect_action_port}",
+		.type = "INDIRECT_ACTION_PORT",
+		.help = "indirect action port",
+		.next = NEXT(NEXT_ENTRY(INDIRECT_ACTION_ID2PTR)),
+		.call = parse_ia_port,
+		.comp = comp_none,
+	},
 	[INDIRECT_ACTION_ID2PTR] = {
 		.name = "{action_id}",
 		.type = "INDIRECT_ACTION_ID",
@@ -9788,6 +9811,31 @@ parse_port(struct context *ctx, const struct token *token,
 	return ret;
 }
 
+/** Parse tokens for shared indirect actions. */
+static int
+parse_ia_port(struct context *ctx, const struct token *token,
+	      const char *str, unsigned int len,
+	      void *buf, unsigned int size)
+{
+	struct rte_flow_action *action = ctx->object;
+	uint32_t id;
+	int ret;
+
+	(void)buf;
+	(void)size;
+	ctx->objdata = 0;
+	ctx->object = &id;
+	ctx->objmask = NULL;
+	ret = parse_int(ctx, token, str, len, ctx->object, sizeof(id));
+	ctx->object = action;
+	if (ret != (int)len)
+		return ret;
+	/* set indirect action */
+	if (action)
+		action->conf = (void *)(uintptr_t)id;
+	return ret;
+}
+
 static int
 parse_ia_id2ptr(struct context *ctx, const struct token *token,
 		const char *str, unsigned int len,
@@ -9808,7 +9856,10 @@ parse_ia_id2ptr(struct context *ctx, const struct token *token,
 		return ret;
 	/* set indirect action */
 	if (action) {
-		action->conf = port_action_handle_get_by_id(ctx->port, id);
+		portid_t port_id = ctx->port;
+		if (ctx->prev == INDIRECT_ACTION_PORT)
+			port_id = (portid_t)(uintptr_t)action->conf;
+		action->conf = port_action_handle_get_by_id(port_id, id);
 		ret = (action->conf) ? ret : -1;
 	}
 	return ret;
-- 
2.18.1


  parent reply	other threads:[~2023-02-07 14:02 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28 16:54 [RFC] ethdev: sharing indirect actions between ports Viacheslav Ovsiienko
2023-01-08 14:20 ` Ori Kam
2023-01-18 12:07 ` Thomas Monjalon
2023-01-18 15:17   ` Ori Kam
2023-01-18 16:21     ` Thomas Monjalon
2023-01-18 16:37       ` Slava Ovsiienko
2023-01-20 12:22         ` Andrew Rybchenko
2023-01-26 15:15           ` Ori Kam
2023-02-06  9:52 ` [PATCH 1/9] " Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 2/9] net/mlx5/hws: Matcher, Free FT from RTC id before set the new value Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 3/9] net/mlx5/hws: fix disconnecting matcher Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 4/9] common/mlx5: add cross port object sharing capability Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 5/9] net/mlx5: add cross port shared mode for HW steering Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 6/9] net/mlx5: support counters in cross port shared mode Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 7/9] app/testpmd: add host port parameter into flow config Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 8/9] app/testpmd: add shared indirect action support Viacheslav Ovsiienko
2023-02-06  9:52   ` [PATCH 9/9] doc: update cross-port indirect shared action Viacheslav Ovsiienko
2023-02-07 14:01   ` [PATCH v2 1/9] ethdev: sharing indirect actions between ports Viacheslav Ovsiienko
2023-02-07 14:01     ` [PATCH v2 2/9] app/testpmd: add host port parameter into flow config Viacheslav Ovsiienko
2023-02-09 14:48       ` Ori Kam
2023-02-07 14:02     ` Viacheslav Ovsiienko [this message]
2023-02-09 14:48       ` [PATCH v2 3/9] app/testpmd: add shared indirect action support Ori Kam
2023-02-07 14:02     ` [PATCH v2 4/9] net/mlx5/hws: free FT from RTC id before set the new value Viacheslav Ovsiienko
2023-02-07 14:02     ` [PATCH v2 5/9] net/mlx5/hws: fix disconnecting matcher Viacheslav Ovsiienko
2023-02-07 14:02     ` [PATCH v2 6/9] common/mlx5: add cross port object sharing capability Viacheslav Ovsiienko
2023-02-07 14:02     ` [PATCH v2 7/9] net/mlx5: add cross port shared mode for HW steering Viacheslav Ovsiienko
2023-02-07 14:02     ` [PATCH v2 8/9] net/mlx5: support counters in cross port shared mode Viacheslav Ovsiienko
2023-02-07 14:02     ` [PATCH v2 9/9] doc: update cross-port indirect shared action Viacheslav Ovsiienko
2023-02-09 14:49       ` Ori Kam
2023-02-10 14:35       ` Ferruh Yigit
2023-02-08 12:21     ` [PATCH v2 1/9] ethdev: sharing indirect actions between ports Ori Kam
2023-02-09 14:47     ` Ori Kam
2023-02-10 14:34     ` Ferruh Yigit
2023-02-10 14:38       ` Slava Ovsiienko
2023-02-10 15:17   ` [PATCH v3 0/3] *ethdev: sharing indirect actions between port* Viacheslav Ovsiienko
2023-02-10 15:17     ` [PATCH v3 1/3] ethdev: sharing indirect actions between ports Viacheslav Ovsiienko
2023-02-10 15:17     ` [PATCH v3 2/3] app/testpmd: add host port parameter into flow config Viacheslav Ovsiienko
2023-02-10 15:17     ` [PATCH v3 3/3] app/testpmd: add shared indirect action support Viacheslav Ovsiienko
2023-02-10 23:02     ` [PATCH v3 0/3] *ethdev: sharing indirect actions between port* Ferruh Yigit
2023-02-13 13:37   ` [PATCH v4 0/5] net/mlx5: sharing indirect actions between port Viacheslav Ovsiienko
2023-02-13 13:37     ` [PATCH v4 1/5] net/mlx5/hws: free FT from RTC ID before set the new value Viacheslav Ovsiienko
2023-02-13 13:37     ` [PATCH v4 2/5] net/mlx5/hws: fix disconnecting matcher Viacheslav Ovsiienko
2023-02-13 13:37     ` [PATCH v4 3/5] common/mlx5: add cross port object sharing capability Viacheslav Ovsiienko
2023-02-13 13:37     ` [PATCH v4 4/5] net/mlx5: add cross port shared mode for HW steering Viacheslav Ovsiienko
2023-02-13 13:37     ` [PATCH v4 5/5] net/mlx5: support counters in cross port shared mode Viacheslav Ovsiienko
2023-02-15 13:29     ` [PATCH v4 0/5] net/mlx5: sharing indirect actions between port Raslan Darawsheh

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=20230207140206.29139-3-viacheslavo@nvidia.com \
    --to=viacheslavo@nvidia.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@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).