DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: add size parameter to raw_encap action
@ 2023-10-26  7:30 Gregory Etelson
  2024-02-08 22:50 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Gregory Etelson @ 2023-10-26  7:30 UTC (permalink / raw)
  To: dev; +Cc: getelson,  , Ori Kam, Aman Singh, Yuying Zhang

Testpmd always provides RAW_ENCAP flow action configuration with
encap buffer and the buffer size.
That implementation does not allow to create non-masked raw_encap
action in the template API actions template.

The patch adds the `size` parameter to testpmd `raw_encap` action
configuration.
Testpmd can create non-masked raw-encap action template and specify
encap buffer during flow creation.

Example:

# total data size is 50
testpmd> set raw_encap 0 \
         eth src is 11:22:33:44:55:66 dst is aa:bb:cc:dd:01:aa / \
         ipv4 src is 31.31.31.31 dst is 63.63.63.1 / udp src is 1 / \
         vxlan vni is 1 / end_set

testpmd> flow actions_template 0 create ingress \
         actions_template_id 50 \
         template raw_encap size 50 / jump / end \
         mask raw_encap size 50 / jump / end \

tstpmd> flow queue 0 create 0 template_table 0 \
        pattern_template 0 actions_template 0 postpone no \
        pattern ... end \
        actions raw_encap index 0 / jump group 1 / end

The new `size` parameter is mutually exclusive with the existing
`index` parameter.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6c8571154e..b231c3fd03 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -647,6 +647,7 @@ enum index {
 	ACTION_DEC_TCP_ACK_VALUE,
 	ACTION_RAW_ENCAP,
 	ACTION_RAW_DECAP,
+	ACTION_RAW_ENCAP_SIZE,
 	ACTION_RAW_ENCAP_INDEX,
 	ACTION_RAW_ENCAP_INDEX_VALUE,
 	ACTION_RAW_DECAP_INDEX,
@@ -2389,6 +2390,7 @@ static const enum index action_dec_tcp_ack[] = {
 };
 
 static const enum index action_raw_encap[] = {
+	ACTION_RAW_ENCAP_SIZE,
 	ACTION_RAW_ENCAP_INDEX,
 	ACTION_NEXT,
 	ZERO,
@@ -6761,6 +6763,14 @@ static const struct token token_list[] = {
 		.next = NEXT(action_raw_encap),
 		.call = parse_vc_action_raw_encap,
 	},
+	[ACTION_RAW_ENCAP_SIZE] = {
+		.name = "size",
+		.help = "raw encap size",
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT),
+			     NEXT_ENTRY(COMMON_UNSIGNED)),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_action_raw_encap, size)),
+		.call = parse_vc_conf,
+	},
 	[ACTION_RAW_ENCAP_INDEX] = {
 		.name = "index",
 		.help = "the index of raw_encap_confs",
@@ -9456,8 +9466,6 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token,
 			  unsigned int size)
 {
 	struct buffer *out = buf;
-	struct rte_flow_action *action;
-	struct action_raw_encap_data *action_raw_encap_data = NULL;
 	int ret;
 
 	ret = parse_vc(ctx, token, str, len, buf, size);
@@ -9468,16 +9476,9 @@ parse_vc_action_raw_encap(struct context *ctx, const struct token *token,
 		return ret;
 	if (!out->args.vc.actions_n)
 		return -1;
-	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
 	/* Point to selected object. */
 	ctx->object = out->args.vc.data;
 	ctx->objmask = NULL;
-	/* Copy the headers to the buffer. */
-	action_raw_encap_data = ctx->object;
-	action_raw_encap_data->conf.data = raw_encap_confs[0].data;
-	action_raw_encap_data->conf.preserve = NULL;
-	action_raw_encap_data->conf.size = raw_encap_confs[0].size;
-	action->conf = &action_raw_encap_data->conf;
 	return ret;
 }
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-09 16:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26  7:30 [PATCH] app/testpmd: add size parameter to raw_encap action Gregory Etelson
2024-02-08 22:50 ` Ferruh Yigit
2024-02-09 11:03 ` Dariusz Sosnowski
2024-02-09 13:43   ` Dariusz Sosnowski
2024-02-09 13:55     ` Ferruh Yigit
2024-02-09 14:01       ` Gregory Etelson
2024-02-09 15:00         ` Ferruh Yigit
2024-02-09 16:00 ` Dariusz Sosnowski
2024-02-09 16:32   ` Ferruh Yigit

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).