app/testpmd: fix the rule number parsing

Message ID 20230630133002.435747-1-bingz@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix the rule number parsing |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Bing Zhao June 30, 2023, 1:30 p.m. UTC
  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")
Cc: akozyrev@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Ori Kam July 10, 2023, 7:39 a.m. UTC | #1
Hi Bing

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> 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.
> 
> Fixes: c4b38873346b ("app/testpmd: add flow table management")
> Cc: akozyrev@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ferruh Yigit July 10, 2023, 10:11 a.m. UTC | #2
On 7/10/2023 8:39 AM, Ori Kam wrote:
> Hi Bing
> 
>> -----Original Message-----
>> From: Bing Zhao <bingz@nvidia.com>
>> 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.
>>
>> Fixes: c4b38873346b ("app/testpmd: add flow table management")
>> Cc: akozyrev@nvidia.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bing Zhao <bingz@nvidia.com>
>> ---
> 
> Acked-by: Ori Kam <orika@nvidia.com>
> 

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

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5771281125..bd626e2347 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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;
 	}