From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A60C342DD0; Tue, 4 Jul 2023 10:47:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B88F40E03; Tue, 4 Jul 2023 10:47:53 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id C58AC40042 for ; Tue, 4 Jul 2023 10:47:51 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QwGb36xt0zLncw; Tue, 4 Jul 2023 16:45:35 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 4 Jul 2023 16:47:47 +0800 From: Jie Hai To: Aman Singh , Yuying Zhang , Ferruh Yigit , Shiyang He CC: , , Subject: [PATCH v2] app/testpmd: fix invalid queue ID when start port Date: Tue, 4 Jul 2023 16:45:06 +0800 Message-ID: <20230704084507.12788-1-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230703110232.28494-1-haijie1@huawei.com> References: <20230703110232.28494-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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