Skip to contentSkip to conversation

app/testpmd: fix the rule number parsing

PATCH Applied Bing Zhao 3 participants 3 messages Jun 30, 2023 – Jul 10, 2023

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 app/testpmd: fix the rule number parsing

When creating a template table, the object pointer of the command line "struct context" was set with an offset from the original out buffer if there is a template ID.

If the "rules_number" is specified after the template IDs, it couldn't be set and passed to the API correctly. With this commit, the pointer is reset before pasring the "rules_number" field.

Fixes c4b38873346b ("app/testpmd: add flow table management")
---
 app/test-pmd/cmdline_flow.c | 6 ++++++
 1 file changed, 6 insertions(+)
app/test-pmd/cmdline_flow.c +6 -0
index 5771281125..bd626e2347 100644
@@ -3369,6 +3369,7 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(COMMON_UNSIGNED)),
 		.args = ARGS(ARGS_ENTRY(struct buffer,
 					args.table.attr.nb_flows)),
+		.call = parse_table,
 	},
 	[TABLE_PATTERN_TEMPLATE] = {
 		.name = "pattern_template",
@@ -10157,6 +10158,11 @@ parse_table(struct context *ctx, const struct token *token,
 			return -1;
 		out->args.table.attr.specialize = RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_VPORT_ORIG;
 		return len;
+	case TABLE_RULES_NUMBER:
+		ctx->objdata = 0;
+		ctx->object = out;
+		ctx->objmask = NULL;
+		return len;
 	default:
 		return -1;
 	}
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Hi Bing

Quoted 12 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Friday, June 30, 2023 4:30 PM

When creating a template table, the object pointer of the command line "struct context" was set with an offset from the original out buffer if there is a template ID.

If the "rules_number" is specified after the template IDs, it couldn't be set and passed to the API correctly. With this commit, the pointer is reset before pasring the "rules_number" field.

Quoted 6 lines
Fixes c4b38873346b ("app/testpmd: add flow table management")

---

Best,
Ori

Applied
#2 lore raw
Quoted 14 lines · Ori Kam

Hi Bing

Quoted 12 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Friday, June 30, 2023 4:30 PM

When creating a template table, the object pointer of the command line "struct context" was set with an offset from the original out buffer if there is a template ID.

If the "rules_number" is specified after the template IDs, it couldn't be set and passed to the API correctly. With this commit, the pointer is reset before pasring the "rules_number" field.

Quoted 9 lines
Quoted 6 lines
Fixes c4b38873346b ("app/testpmd: add flow table management")

---

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