patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Qiming Yang <qiming.yang@intel.com>
To: dev@dpdk.org, andrew.rybchenko@oktetlabs.ru
Cc: Qiming Yang <qiming.yang@intel.com>, stable@dpdk.org
Subject: [PATCH] app/testpmd: fix slave port reset action
Date: Wed, 12 Oct 2022 07:43:59 +0000	[thread overview]
Message-ID: <20221012074359.878049-1-qiming.yang@intel.com> (raw)

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(-)

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``
-- 
2.25.1


             reply	other threads:[~2022-10-12  7:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  7:43 Qiming Yang [this message]
2022-10-13 17:42 ` Singh, Aman Deep
2022-10-17  7:50   ` Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221012074359.878049-1-qiming.yang@intel.com \
    --to=qiming.yang@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).