Skip to contentSkip to conversation

app/testpmd: fix slave port reset action

PATCH Applied Qiming Yang 3 participants 3 messages Oct 12, 2022 – Oct 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix slave port reset action

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")
---
 app/test-pmd/testpmd.c                | 18 ++++++++++--------
 doc/guides/testpmd_app_ug/run_app.rst |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)
app/test-pmd/testpmd.c +10 -8
index 5b0f0838dc..6ce3cdabd9 100644
@@ -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);
+			}
 		}
 	}
 
doc/guides/testpmd_app_ug/run_app.rst +1 -0
index abc3ec10a0..7657b4afad 100644
@@ -600,6 +600,7 @@ as follows:
 - ``dev_configure``
 - ``dev_start``
 - ``dev_stop``
+- ``dev_reset``
 - ``rx_queue_setup``
 - ``tx_queue_setup``
 - ``rx_queue_release``
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Qiming Yang

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")
Quoted 5 lines
---
  app/test-pmd/testpmd.c                | 18 ++++++++++--------
  doc/guides/testpmd_app_ug/run_app.rst |  1 +
  2 files changed, 11 insertions(+), 8 deletions(-)