[dpdk-stable] patch 'app/testpmd: fix crash on port reset' has been queued to LTS release 17.11.10

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Dec 19 15:32:56 CET 2019


Hi,

FYI, your patch has been queued to LTS release 17.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/21/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 556e861057f25823c45b3a00969c8a3c546b9034 Mon Sep 17 00:00:00 2001
From: Shougang Wang <shougangx.wang at intel.com>
Date: Tue, 24 Sep 2019 04:49:03 +0000
Subject: [PATCH] app/testpmd: fix crash on port reset

[ upstream commit 1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2 ]

port reset cause crash when ports are not stopped. Fixed by refusing the
reset when port is not stopped.

Fixes: 97f1e196799f ("app/testpmd: add port reset command")

Signed-off-by: Shougang Wang <shougangx.wang at intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
 app/test-pmd/cmdline.c                      | 3 +++
 app/test-pmd/testpmd.c                      | 7 +++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++
 3 files changed, 19 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6d641a24e3..23652496e0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -799,6 +799,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"port close (port_id|all)\n"
 			"    Close all ports or port_id.\n\n"
 
+			"port reset (port_id|all)\n"
+			"    Reset all ports or port_id.\n\n"
+
 			"port attach (ident)\n"
 			"    Attach physical or virtual dev by pci address or virtual device name\n\n"
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index f8c76a6f60..c2d6a75ef6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1860,6 +1860,13 @@ reset_port(portid_t pid)
 	if (port_id_is_invalid(pid, ENABLED_WARN))
 		return;
 
+	port = &ports[pid];
+	if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) ||
+		(pid != (portid_t)RTE_PORT_ALL && !((port->port_status != RTE_PORT_STOPPED) && (port->slave_flag == 0)))) {
+		printf("Can not reset port(s), please stop port(s) first.\n");
+		return;
+	}
+
 	printf("Resetting ports...\n");
 
 	RTE_ETH_FOREACH_DEV(pi) {
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 285dd560bb..0193f93662 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1704,6 +1704,15 @@ Close all ports or a specific port::
 
    testpmd> port close (port_id|all)
 
+port reset
+~~~~~~~~~~
+
+Reset all ports or a specific port::
+
+   testpmd> port reset (port_id|all)
+
+User should stop port(s) before resetting and (re-)start after reset.
+
 port start/stop queue
 ~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-19 14:32:27.489957879 +0000
+++ 0029-app-testpmd-fix-crash-on-port-reset.patch	2019-12-19 14:32:25.757290925 +0000
@@ -1,27 +1,28 @@
-From 1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2 Mon Sep 17 00:00:00 2001
+From 556e861057f25823c45b3a00969c8a3c546b9034 Mon Sep 17 00:00:00 2001
 From: Shougang Wang <shougangx.wang at intel.com>
 Date: Tue, 24 Sep 2019 04:49:03 +0000
 Subject: [PATCH] app/testpmd: fix crash on port reset
 
+[ upstream commit 1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2 ]
+
 port reset cause crash when ports are not stopped. Fixed by refusing the
 reset when port is not stopped.
 
 Fixes: 97f1e196799f ("app/testpmd: add port reset command")
-Cc: stable at dpdk.org
 
 Signed-off-by: Shougang Wang <shougangx.wang at intel.com>
 Acked-by: Bernard Iremonger <bernard.iremonger at intel.com>
 ---
  app/test-pmd/cmdline.c                      | 3 +++
- app/test-pmd/testpmd.c                      | 6 ++++++
+ app/test-pmd/testpmd.c                      | 7 +++++++
  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++
- 3 files changed, 18 insertions(+)
+ 3 files changed, 19 insertions(+)
 
 diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
-index dd4e6e6021..def471d975 100644
+index 6d641a24e3..23652496e0 100644
 --- a/app/test-pmd/cmdline.c
 +++ b/app/test-pmd/cmdline.c
-@@ -758,6 +758,9 @@ static void cmd_help_long_parsed(void *parsed_result,
+@@ -799,6 +799,9 @@ static void cmd_help_long_parsed(void *parsed_result,
  			"port close (port_id|all)\n"
  			"    Close all ports or port_id.\n\n"
  
@@ -32,15 +33,16 @@
  			"    Attach physical or virtual dev by pci address or virtual device name\n\n"
  
 diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
-index 1e3dc44a1c..5701f3141f 100644
+index f8c76a6f60..c2d6a75ef6 100644
 --- a/app/test-pmd/testpmd.c
 +++ b/app/test-pmd/testpmd.c
-@@ -2361,6 +2361,12 @@ reset_port(portid_t pid)
+@@ -1860,6 +1860,13 @@ reset_port(portid_t pid)
  	if (port_id_is_invalid(pid, ENABLED_WARN))
  		return;
  
++	port = &ports[pid];
 +	if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) ||
-+		(pid != (portid_t)RTE_PORT_ALL && !port_is_stopped(pid))) {
++		(pid != (portid_t)RTE_PORT_ALL && !((port->port_status != RTE_PORT_STOPPED) && (port->slave_flag == 0)))) {
 +		printf("Can not reset port(s), please stop port(s) first.\n");
 +		return;
 +	}
@@ -49,10 +51,10 @@
  
  	RTE_ETH_FOREACH_DEV(pi) {
 diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
-index 67f4339ca9..cba5ba1b83 100644
+index 285dd560bb..0193f93662 100644
 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
 +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
-@@ -2041,6 +2041,15 @@ Close all ports or a specific port::
+@@ -1704,6 +1704,15 @@ Close all ports or a specific port::
  
     testpmd> port close (port_id|all)
  
@@ -65,8 +67,8 @@
 +
 +User should stop port(s) before resetting and (re-)start after reset.
 +
- port config - queue ring size
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ port start/stop queue
+ ~~~~~~~~~~~~~~~~~~~~~
  
 -- 
 2.20.1


More information about the stable mailing list