app/testpmd: fix async flow create failure handling

Message ID 20240228185707.186522-1-dsosnowski@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix async flow create failure handling |

Checks

Context Check Description
ci/checkpatch success coding style OK
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-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance fail Performance Testing issues

Commit Message

Dariusz Sosnowski Feb. 28, 2024, 6:57 p.m. UTC
  In case of an error when an asynchronous flow create operation was
enqueued, test-pmd attempted to enqueue a flow destroy operation
of that flow rule.
However, this was incorrect because:

- Flow rule index was used to enqueue a flow destroy operation.
  This flow rule index was not yet initialized, so flow rule number 0
  was always destroyed as a result.
- Since rte_flow_async_create() does not return a handle on error,
  then there is no flow rule to destroy.

test-pmd only needs to free internal memory allocated for
storing a flow rule. Any flow destroy operation is not needed
in this case.

Fixes: ecdc927b99f2 ("app/testpmd: add async flow create/destroy operations")
Cc: akozyrev@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Ferruh Yigit March 1, 2024, 11:55 a.m. UTC | #1
On 2/28/2024 6:57 PM, Dariusz Sosnowski wrote:
> In case of an error when an asynchronous flow create operation was
> enqueued, test-pmd attempted to enqueue a flow destroy operation
> of that flow rule.
> However, this was incorrect because:
> 
> - Flow rule index was used to enqueue a flow destroy operation.
>   This flow rule index was not yet initialized, so flow rule number 0
>   was always destroyed as a result.
> - Since rte_flow_async_create() does not return a handle on error,
>   then there is no flow rule to destroy.
> 
> test-pmd only needs to free internal memory allocated for
> storing a flow rule. Any flow destroy operation is not needed
> in this case.
> 
> Fixes: ecdc927b99f2 ("app/testpmd: add async flow create/destroy operations")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
>

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

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 08d7d0e2f8..8bf2e411b5 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2856,8 +2856,7 @@  port_queue_flow_create(portid_t port_id, queueid_t queue_id,
 		flow = rte_flow_async_create_by_index(port_id, queue_id, &op_attr, pt->table,
 			rule_idx, actions, actions_idx, job, &error);
 	if (!flow) {
-		uint64_t flow_id = pf->id;
-		port_queue_flow_destroy(port_id, queue_id, true, 1, &flow_id);
+		free(pf);
 		free(job);
 		return port_flow_complain(&error);
 	}