DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jie Hai <haijie1@huawei.com>
To: Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	Shiyang He <shiyangx.he@intel.com>
Cc: <dev@dpdk.org>, <liudongdong3@huawei.com>, <alialnu@nvidia.com>
Subject: [PATCH v2] app/testpmd: fix invalid queue ID when start port
Date: Tue, 4 Jul 2023 16:45:06 +0800	[thread overview]
Message-ID: <20230704084507.12788-1-haijie1@huawei.com> (raw)
In-Reply-To: <20230703110232.28494-1-haijie1@huawei.com>

Function update_queue_state updates queue state of all queues
of all ports, using the queue num nb_rxq|nb_txq stored locally
by testpmd. An error on the invalid queue ID occurs if we run
testpmd with two ports and detach-attach one of them and start
the other port first. This is because the attached port has not
been configured and has no queues, which differs from nb_rxq|nb_txq.
The similar error happens in multi-process senoris if secondary
process attaches a port and starts it.

This patch updates queue state of the specified port, which has
been configured by primary process. As the secondary process
cannot configure the ports, make sure that the secondary process
starts the port only after the primary process has done so.

Fixes: 141a520b35f7 ("app/testpmd: fix primary process not polling all queues")
Fixes: 5028f207a4fa ("app/testpmd: fix secondary process packet forwarding")
Cc: stable@dpdk.org

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 app/test-pmd/testpmd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--
v1->v2:
1. Fix spelling mistakes.
2. Update queue state of a specified port insead of all port in start_port()

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1fc70650e0a4..904184d0836b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2477,12 +2477,15 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id)
 }
 
 static void
-update_queue_state(void)
+update_queue_state(portid_t pid)
 {
 	portid_t pi;
 	queueid_t qi;
 
 	RTE_ETH_FOREACH_DEV(pi) {
+		if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
+			continue;
+
 		for (qi = 0; qi < nb_rxq; qi++)
 			update_rx_queue_state(pi, qi);
 		for (qi = 0; qi < nb_txq; qi++)
@@ -2530,7 +2533,7 @@ start_packet_forwarding(int with_tx_first)
 		return;
 
 	if (stream_init != NULL) {
-		update_queue_state();
+		update_queue_state(RTE_PORT_ALL);
 		for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++)
 			stream_init(fwd_streams[i]);
 	}
@@ -3293,7 +3296,7 @@ start_port(portid_t pid)
 		pl[cfg_pi++] = pi;
 	}
 
-	update_queue_state();
+	update_queue_state(pid);
 
 	if (at_least_one_port_successfully_started && !no_link_check)
 		check_all_ports_link_status(RTE_PORT_ALL);
-- 
2.33.0


  parent reply	other threads:[~2023-07-04  8:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 11:02 [PATCH] " Jie Hai
2023-07-03 12:33 ` Ali Alnubani
2023-07-04  2:01   ` Jie Hai
2023-07-04  2:22 ` lihuisong (C)
2023-07-04  8:45 ` Jie Hai [this message]
2023-07-04  9:16   ` [PATCH v2] " Ali Alnubani
2023-07-04  9:42   ` fengchengwen
2023-07-04 10:59   ` Ferruh Yigit
2023-07-05  3:16     ` lihuisong (C)
2023-07-05  8:02       ` Ferruh Yigit
2023-07-05  8:07         ` Ferruh Yigit
2023-07-05  9:40         ` lihuisong (C)
2023-07-05 11:41           ` Ferruh Yigit
2023-07-06  2:48             ` lihuisong (C)

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=20230704084507.12788-1-haijie1@huawei.com \
    --to=haijie1@huawei.com \
    --cc=alialnu@nvidia.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=liudongdong3@huawei.com \
    --cc=shiyangx.he@intel.com \
    --cc=yuying.zhang@intel.com \
    /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).