Skip to contentSkip to conversation

app/testpmd: add flow update CLI command

PATCH Applied Alexander Kozyrev 3 participants 3 messages Jun 12, 2023 – Jun 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: add flow update CLI command

Add testpmd CLI interface for the flow update API.
flow queue 1 update 2 rule 3 actions_template 4 postpone yes
pattern end actions queue index 3 / end

---
 app/test-pmd/cmdline_flow.c | 29 ++++++++++++
 app/test-pmd/config.c       | 92 ++++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h      |  5 ++
 3 files changed, 125 insertions(+), 1 deletion(-)
app/test-pmd/cmdline_flow.c +29 -0
index 00bac0a60d..5771281125 100644
@@ -132,6 +132,7 @@ enum index {
 	/* Queue arguments. */
 	QUEUE_CREATE,
 	QUEUE_DESTROY,
+	QUEUE_UPDATE,
 	QUEUE_AGED,
 	QUEUE_INDIRECT_ACTION,
 
@@ -146,6 +147,9 @@ enum index {
 	QUEUE_DESTROY_ID,
 	QUEUE_DESTROY_POSTPONE,
 
+	/* Queue update arguments. */
+	QUEUE_UPDATE_ID,
+
 	/* Queue indirect action arguments */
 	QUEUE_INDIRECT_ACTION_CREATE,
 	QUEUE_INDIRECT_ACTION_LIST_CREATE,
@@ -1312,6 +1316,7 @@ static const enum index next_table_destroy_attr[] = {
 static const enum index next_queue_subcmd[] = {
 	QUEUE_CREATE,
 	QUEUE_DESTROY,
+	QUEUE_UPDATE,
 	QUEUE_AGED,
 	QUEUE_INDIRECT_ACTION,
 	ZERO,
@@ -3408,6 +3413,14 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY(struct buffer, queue)),
 		.call = parse_qo_destroy,
 	},
+	[QUEUE_UPDATE] = {
+		.name = "update",
+		.help = "update a flow rule",
+		.next = NEXT(NEXT_ENTRY(QUEUE_UPDATE_ID),
+			     NEXT_ENTRY(COMMON_QUEUE_ID)),
+		.args = ARGS(ARGS_ENTRY(struct buffer, queue)),
+		.call = parse_qo,
+	},
 	[QUEUE_AGED] = {
 		.name = "aged",
 		.help = "list and destroy aged flows",
@@ -3484,6 +3497,15 @@ static const struct token token_list[] = {
 					    args.destroy.rule)),
 		.call = parse_qo_destroy,
 	},
+	[QUEUE_UPDATE_ID] = {
+		.name = "rule",
+		.help = "specify rule id to update",
+		.next = NEXT(NEXT_ENTRY(QUEUE_ACTIONS_TEMPLATE),
+			NEXT_ENTRY(COMMON_UNSIGNED)),
+		.args = ARGS(ARGS_ENTRY(struct buffer,
+				     args.vc.rule_id)),
+		.call = parse_qo,
+	},
 	/* Queue indirect action arguments */
 	[QUEUE_INDIRECT_ACTION_CREATE] = {
 		.name = "create",
@@ -10207,6 +10229,7 @@ parse_qo(struct context *ctx, const struct token *token,
 	}
 	switch (ctx->curr) {
 	case QUEUE_CREATE:
+	case QUEUE_UPDATE:
 		out->command = ctx->curr;
 		ctx->objdata = 0;
 		ctx->object = out;
@@ -10218,6 +10241,7 @@ parse_qo(struct context *ctx, const struct token *token,
 	case QUEUE_ACTIONS_TEMPLATE:
 	case QUEUE_CREATE_POSTPONE:
 	case QUEUE_RULE_ID:
+	case QUEUE_UPDATE_ID:
 		return len;
 	case ITEM_PATTERN:
 		out->args.vc.pattern =
@@ -12233,6 +12257,11 @@ cmd_flow_parsed(const struct buffer *in)
 					in->args.destroy.rule_n,
 					in->args.destroy.rule);
 		break;
+	case QUEUE_UPDATE:
+		port_queue_flow_update(in->port, in->queue, in->postpone,
+				in->args.vc.rule_id, in->args.vc.act_templ_id,
+				in->args.vc.actions);
+		break;
 	case PUSH:
 		port_queue_flow_push(in->port, in->queue);
 		break;
app/test-pmd/config.c +91 -1

110 lines not on this page · raw message

app/test-pmd/testpmd.h +5 -0
index 5eeb50f67c..1761768add 100644
@@ -110,6 +110,7 @@ enum {
 enum {
 	QUEUE_JOB_TYPE_FLOW_CREATE,
 	QUEUE_JOB_TYPE_FLOW_DESTROY,
+	QUEUE_JOB_TYPE_FLOW_UPDATE,
 	QUEUE_JOB_TYPE_ACTION_CREATE,
 	QUEUE_JOB_TYPE_ACTION_DESTROY,
 	QUEUE_JOB_TYPE_ACTION_UPDATE,
@@ -225,6 +226,7 @@ struct port_flow {
 	struct port_flow *next; /**< Next flow in list. */
 	struct port_flow *tmp; /**< Temporary linking. */
 	uint32_t id; /**< Flow rule ID. */
+	struct port_table *table; /**< Flow table. */
 	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. */
@@ -983,6 +985,9 @@ int port_queue_flow_create(portid_t port_id, queueid_t queue_id,
 			   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);
+int port_queue_flow_update(portid_t port_id, queueid_t queue_id,
+			   bool postpone, uint32_t rule_idx, uint32_t actions_idx,
+			   const struct rte_flow_action *actions);
 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,
Signature · 1 line
2.18.2
Applied
#2 lore raw
Quoted 6 lines · Ori Kam

Hi

Quoted 4 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Tuesday, June 13, 2023 12:14 AM

Quoted 9 lines
Quoted 6 lines

Add testpmd CLI interface for the flow update API.
flow queue 1 update 2 rule 3 actions_template 4 postpone yes
pattern end actions queue index 3 / end

---

Applied to dpdk-next-net/main, thanks.