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 7D60E41CF8 for ; Tue, 21 Feb 2023 07:37:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 691CC4315F; Tue, 21 Feb 2023 07:37:50 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 10D1140E5A; Tue, 21 Feb 2023 07:37:48 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PLV0n0CYYzKpwJ; Tue, 21 Feb 2023 14:35:53 +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.17; Tue, 21 Feb 2023 14:37:44 +0800 Message-ID: <81ef949b-54ca-055a-5f94-ddfda879bcd5@huawei.com> Date: Tue, 21 Feb 2023 14:37:44 +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 secondary process not forwarding To: "He, ShiyangX" , "dev@dpdk.org" CC: "Zhou, YidingX" , "stable@dpdk.org" , "Singh, Aman Deep" , "Zhang, Yuying" , "Burakov, Anatoly" , "Li, Xiaoyun" , Alvin Zhang References: <20221230075554.25244-1-shiyangx.he@intel.com> <8ba58719-8f2c-626d-50e2-78031823f21d@huawei.com> From: "lihuisong (C)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 在 2023/2/21 10:52, He, ShiyangX 写道: > >> -----Original Message----- >> From: lihuisong (C) >> Sent: Monday, February 20, 2023 8:46 PM >> To: He, ShiyangX ; dev@dpdk.org >> Cc: Zhou, YidingX ; stable@dpdk.org; Singh, Aman >> Deep ; Zhang, Yuying >> ; Burakov, Anatoly ; >> Li, Xiaoyun ; Alvin Zhang >> Subject: Re: [PATCH] app/testpmd: fix secondary process not forwarding >> >> >> 在 2022/12/30 15:55, Shiyang He 写道: >>> Under multi-process scenario, the secondary process gets queue state >>> from the wrong location (the global variable 'ports'). Therefore, the >>> secondary process can not forward since "stream_init" is not called. >>> >>> This commit fixes the issue by calling 'rte_eth_rx/tx_queue_info_get' >>> to get queue state from shared memory. >>> >>> Fixes: a78040c990cb ("app/testpmd: update forward engine beginning") >> should use this commit: >> Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") > Thanks for your comments, I will ask maintainer to help fix this problem. > >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Shiyang He >>> --- >>> app/test-pmd/testpmd.c | 29 +++++++++++++++++++++++++++-- >>> 1 file changed, 27 insertions(+), 2 deletions(-) >>> >>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index >>> 134d79a555..2c73daf9eb 100644 >>> --- a/app/test-pmd/testpmd.c >>> +++ b/app/test-pmd/testpmd.c >>> @@ -2378,9 +2378,34 @@ start_packet_forwarding(int with_tx_first) >>> if (!pkt_fwd_shared_rxq_check()) >>> return; >>> >>> - if (stream_init != NULL) >>> - for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) >>> + if (stream_init != NULL) { >>> + for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) { >>> + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { >> directly use "rte_eal_process_type() == RTE_PROC_SECONDARY"? > The following action should be executed for all non-primary processes. "all non-primary processes" is which processes? it's only 'secondary' here, not 'auto', right? > >>> + struct fwd_stream *fs = fwd_streams[i]; >>> + struct rte_eth_rxq_info rx_qinfo; >>> + struct rte_eth_txq_info tx_qinfo; >>> + int32_t rc; >>> + rc = rte_eth_rx_queue_info_get(fs->rx_port, >>> + fs->rx_queue, &rx_qinfo); >>> + if (!rc) >>> + ports[fs->rx_port].rxq[fs- >>> rx_queue].state = >>> + rx_qinfo.queue_state; >>> + else >>> + TESTPMD_LOG(WARNING, >>> + "Failed to get rx queue >> info\n"); >>> + >>> + rc = rte_eth_tx_queue_info_get(fs->tx_port, >>> + fs->tx_queue, &tx_qinfo); >>> + if (!rc) >>> + ports[fs->tx_port].txq[fs- >>> tx_queue].state = >>> + tx_qinfo.queue_state; >>> + else >>> + TESTPMD_LOG(WARNING, >>> + "Failed to get tx queue >> info\n"); >> not all PMDs implement rte_eth_rx/tx_queue_info_get() to query the state, >> right? >> Can you set this state to 'START' if the return value is '-ENOTSUP'? > If pmd doesn't implement "rte_eth_rx/tx_queue_info_get()" to query queue state, should use the default value instead of modifying the state, because it may be modified elsewhere. The rx/tx_queue_start/stop() can change Rx/Tx queue state if PMD supports this API. In primary, if PMD doesn't support this API, this queue state do not be changed and still be the original value(RTE_ETH_QUEUE_STATE_STARTED) start_port() sets. However, in secondary, Rx/Tx queue state have not been initialized, your patch also do not it. Namely, their default values are wrong. Our plan needs to ensure that the PMDs that do not support rx/tx_queue_start/stop() or rx/tx_queue_info_get() can forward in secondary. I think we either add the initialization of queue state in start_port() or somewhere else, or make sure it's ok here. >>> + } >>> stream_init(fwd_streams[i]); >>> + } >>> + } >>> >>> port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; >>> if (port_fwd_begin != NULL) {