app/testpmd: fix slave port reset action

Message ID 20221012074359.878049-1-qiming.yang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series app/testpmd: fix slave port reset action |

Checks

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

Commit Message

Qiming Yang Oct. 12, 2022, 7:43 a.m. UTC
  As stop action has been forbidden in secondary process, so
the reset action should also not be allowed.

Fixes: a550baf24af9 ("app/testpmd: support multi-process")
Cc: stable@dpdk.org

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 app/test-pmd/testpmd.c                | 18 ++++++++++--------
 doc/guides/testpmd_app_ug/run_app.rst |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)
  

Comments

Singh, Aman Deep Oct. 13, 2022, 5:42 p.m. UTC | #1
On 10/12/2022 1:13 PM, Qiming Yang wrote:
> As stop action has been forbidden in secondary process, so
> the reset action should also not be allowed.
>
> Fixes: a550baf24af9 ("app/testpmd: support multi-process")
> Cc: stable@dpdk.org
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>

Acked-by: Aman Singh<aman.deep.singh@intel.com>

> ---
>   app/test-pmd/testpmd.c                | 18 ++++++++++--------
>   doc/guides/testpmd_app_ug/run_app.rst |  1 +
>   2 files changed, 11 insertions(+), 8 deletions(-)
>
  
Andrew Rybchenko Oct. 17, 2022, 7:50 a.m. UTC | #2
On 10/13/22 20:42, Singh, Aman Deep wrote:
> On 10/12/2022 1:13 PM, Qiming Yang wrote:
>> As stop action has been forbidden in secondary process, so
>> the reset action should also not be allowed.
>>
>> Fixes: a550baf24af9 ("app/testpmd: support multi-process")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> 
> Acked-by: Aman Singh<aman.deep.singh@intel.com>

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

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5b0f0838dc..6ce3cdabd9 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3333,14 +3333,16 @@  reset_port(portid_t pid)
 			continue;
 		}
 
-		diag = rte_eth_dev_reset(pi);
-		if (diag == 0) {
-			port = &ports[pi];
-			port->need_reconfig = 1;
-			port->need_reconfig_queues = 1;
-		} else {
-			fprintf(stderr, "Failed to reset port %d. diag=%d\n",
-				pi, diag);
+		if (is_proc_primary()) {
+			diag = rte_eth_dev_reset(pi);
+			if (diag == 0) {
+				port = &ports[pi];
+				port->need_reconfig = 1;
+				port->need_reconfig_queues = 1;
+			} else {
+				fprintf(stderr, "Failed to reset port %d. diag=%d\n",
+					pi, diag);
+			}
 		}
 	}
 
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index abc3ec10a0..7657b4afad 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -600,6 +600,7 @@  as follows:
 - ``dev_configure``
 - ``dev_start``
 - ``dev_stop``
+- ``dev_reset``
 - ``rx_queue_setup``
 - ``tx_queue_setup``
 - ``rx_queue_release``