[v7,5/5] app/testpmd: stop forwarding in new or destroy event

Message ID 20240130063648.32131-6-lihuisong@huawei.com (mailing list archive)
State New
Delegated to: Ferruh Yigit
Series app/testpmd: support multiple process attach and detach port |


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-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-sample-apps-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-mellanox-Performance success Performance Testing PASS

Commit Message

lihuisong (C) Jan. 30, 2024, 6:36 a.m. UTC
  When testpmd receives the new or destroy event, the port related
information will be updated. Testpmd must stop packet forwarding
before updating the information to avoid some serious problems.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
 app/test-pmd/testpmd.c | 4 ++++
 1 file changed, 4 insertions(+)


diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index db985d33a3..dfdd7e723d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3968,6 +3968,8 @@  eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 	switch (type) {
+		if (test_done == 0)
+			stop_packet_forwarding();
 		if (setup_on_probe_event)
@@ -3978,6 +3980,8 @@  eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 				"Could not set up deferred device removal\n");
+		if (test_done == 0)
+			stop_packet_forwarding();
 		ports[port_id].port_status = RTE_PORT_CLOSED;
 		printf("Port %u is closed\n", port_id);
 		if (rte_eal_alarm_set(100000, remove_invalid_ports_callback,