[v2] app/testpmd: fix quit to stop all ports before close

Message ID 20190104122833.49245-1-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] app/testpmd: fix quit to stop all ports before close |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Cristian Dumitrescu Jan. 4, 2019, 12:28 p.m. UTC
  This patch proposes a slightly different test-pmd quit operation: stop
all devices before starting to close any device. Basically, stop all
moving parts before beginning to remove them. The current test-pmd quit
is stopping and closing each device before moving to the next device.

If all devices in the system are independent of each other, this
difference is usually not important. In case of Soft NIC devices, any
such virtual device typically depends on one or more physical devices
being alive, as it accesses their queues, so this difference becomes
important.

Without this straightforward fix, all the Soft NIC devices need to be
manually stopped before the quit command is issued, otherwise the quit
command can sometimes crash the test-pmd application.

Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
Cc: stable@dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
Changes in V2:
-reworded title
-added Fixes and Cc lines

 app/test-pmd/testpmd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Iremonger, Bernard Jan. 4, 2019, 1:47 p.m. UTC | #1
> -----Original Message-----
> From: Dumitrescu, Cristian
> Sent: Friday, January 4, 2019 12:29 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] app/testpmd: fix quit to stop all ports before close
> 
> This patch proposes a slightly different test-pmd quit operation: stop all devices
> before starting to close any device. Basically, stop all moving parts before
> beginning to remove them. The current test-pmd quit is stopping and closing
> each device before moving to the next device.
> 
> If all devices in the system are independent of each other, this difference is
> usually not important. In case of Soft NIC devices, any such virtual device
> typically depends on one or more physical devices being alive, as it accesses
> their queues, so this difference becomes important.
> 
> Without this straightforward fix, all the Soft NIC devices need to be manually
> stopped before the quit command is issued, otherwise the quit command can
> sometimes crash the test-pmd application.
> 
> Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  
Ferruh Yigit Jan. 9, 2019, 12:26 p.m. UTC | #2
On 1/4/2019 1:47 PM, Iremonger, Bernard wrote:
>> -----Original Message-----
>> From: Dumitrescu, Cristian
>> Sent: Friday, January 4, 2019 12:29 PM
>> To: dev@dpdk.org
>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>;
>> stable@dpdk.org
>> Subject: [PATCH v2] app/testpmd: fix quit to stop all ports before close
>>
>> This patch proposes a slightly different test-pmd quit operation: stop all devices
>> before starting to close any device. Basically, stop all moving parts before
>> beginning to remove them. The current test-pmd quit is stopping and closing
>> each device before moving to the next device.
>>
>> If all devices in the system are independent of each other, this difference is
>> usually not important. In case of Soft NIC devices, any such virtual device
>> typically depends on one or more physical devices being alive, as it accesses
>> their queues, so this difference becomes important.
>>
>> Without this straightforward fix, all the Soft NIC devices need to be manually
>> stopped before the quit command is issued, otherwise the quit command can
>> sometimes crash the test-pmd application.
>>
>> Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> 
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

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

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8d584b008..15a948828 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2391,9 +2391,13 @@  pmd_test_exit(void)
 	if (ports != NULL) {
 		no_link_check = 1;
 		RTE_ETH_FOREACH_DEV(pt_id) {
-			printf("\nShutting down port %d...\n", pt_id);
+			printf("\nStopping port %d...\n", pt_id);
 			fflush(stdout);
 			stop_port(pt_id);
+		}
+		RTE_ETH_FOREACH_DEV(pt_id) {
+			printf("\nShutting down port %d...\n", pt_id);
+			fflush(stdout);
 			close_port(pt_id);
 
 			/*