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 5B1E442DC7; Tue, 4 Jul 2023 04:22:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4973D40F18; Tue, 4 Jul 2023 04:22:51 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 9657140E03 for ; Tue, 4 Jul 2023 04:22:49 +0200 (CEST) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Qw64v5nZLzqVTW; Tue, 4 Jul 2023 10:22:23 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) 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 10:22:47 +0800 Message-ID: Date: Tue, 4 Jul 2023 10:22:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] app/testpmd: fix invalid queue ID when start port To: Jie Hai , Aman Singh , Yuying Zhang , Ferruh Yigit , Shiyang He CC: , , References: <20230703110232.28494-1-haijie1@huawei.com> From: "lihuisong (C)" In-Reply-To: <20230703110232.28494-1-haijie1@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) 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 在 2023/7/3 19:02, Jie Hai 写道: > 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. Error on invalid queue ID occurs if we start testpmd > with two ports and detach-attach one of them and start the other How do start the first port? start packet forwarding? > port first. That's because the attached port has zero queues and > that differs from the 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 according to the num of queues > reported by driver instead of testpmd. > > 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 | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 1fc70650e0a4..c8ce67d0de9f 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2479,13 +2479,22 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) > static void > update_queue_state(void) > { > + struct rte_port *port; > + uint16_t nb_rx_queues; > + uint16_t nb_tx_queues; > portid_t pi; > queueid_t qi; > > RTE_ETH_FOREACH_DEV(pi) { > - for (qi = 0; qi < nb_rxq; qi++) > + port = &ports[pi]; > + if (eth_dev_info_get_print_err(pi, &port->dev_info) != 0) > + continue; Is this something to do for the dettach-attached port? If so I don't think this is the root method. Because the global ports[attached_port_id] isn't initialized, and the attached port isn't started. And the first port cannot be start to forward(start_packet_forwarding will do check this). Another possible reason is that the attached port status is incorrect. Please take a look at the following patchset. http://patches.dpdk.org/project/dpdk/list/?series=&submitter=2085&state=&q=&archive=&delegate= > + > + nb_rx_queues = RTE_MIN(nb_rxq, port->dev_info.nb_rx_queues); > + nb_tx_queues = RTE_MIN(nb_txq, port->dev_info.nb_tx_queues); > + for (qi = 0; qi < nb_rx_queues; qi++) > update_rx_queue_state(pi, qi); > - for (qi = 0; qi < nb_txq; qi++) > + for (qi = 0; qi < nb_tx_queues; qi++) > update_tx_queue_state(pi, qi); > } > }