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 15CA942D58; Mon, 26 Jun 2023 11:31:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95BEC41149; Mon, 26 Jun 2023 11:31:05 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id D19E14067B for ; Mon, 26 Jun 2023 11:31:03 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QqMvz1HBYzlWCQ; Mon, 26 Jun 2023 17:28:15 +0800 (CST) Received: from [10.67.103.42] (10.67.103.42) 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; Mon, 26 Jun 2023 17:30:56 +0800 Message-ID: Date: Mon, 26 Jun 2023 17:30:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4] app/testpmd: fix primary process not polling all queues To: Ali Alnubani , Aman Singh , Yuying Zhang , Anatoly Burakov , Matan Azrad , Dmitry Kozlyuk CC: "dev@dpdk.org" , "liudongdong3@huawei.com" , "shiyangx.he@intel.com" , "ferruh.yigit@amd.com" , Raslan Darawsheh References: <20230529022649.51425-1-haijie1@huawei.com> <20230609090340.3942-1-haijie1@huawei.com> From: Jie Hai In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.42] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 On 2023/6/23 0:40, Ali Alnubani wrote: >> -----Original Message----- >> From: Jie Hai >> Sent: Friday, June 9, 2023 12:04 PM >> To: Aman Singh ; Yuying Zhang >> ; Anatoly Burakov ; >> Matan Azrad ; Dmitry Kozlyuk >> >> Cc: dev@dpdk.org; liudongdong3@huawei.com; shiyangx.he@intel.com; >> ferruh.yigit@amd.com >> Subject: [PATCH v4] app/testpmd: fix primary process not polling all queues >> >> Here's how the problem arises. >> step1: Start the app. >> dpdk-testpmd -a 0000:35:00.0 -l 0-3 -- -i --rxq=10 --txq=10 >> >> step2: Perform the following steps and send traffic. As expected, >> queue 7 does not send or receive packets, and other queues do. >> port 0 rxq 7 stop >> port 0 txq 7 stop >> set fwd mac >> start >> >> step3: Perform the following steps and send traffic. All queues >> are expected to send and receive packets normally, but that's not >> the case for queue 7. >> stop >> port stop all >> port start all >> start >> show port xstats all >> >> In fact, only the value of rx_q7_packets for queue 7 is not zero, >> which means queue 7 is enabled for the driver but is not involved >> in packet receiving and forwarding by software. If we check queue >> state by command 'show rxq info 0 7' and 'show txq info 0 7', >> we see queue 7 is started as other queues are. >> Rx queue state: started >> Tx queue state: started >> The queue 7 is started but cannot forward. That's the problem. >> >> We know that each stream has a read-only "disabled" field that >> control if this stream should be used to forward. This field >> depends on testpmd local queue state, please see >> commit 3c4426db54fc ("app/testpmd: do not poll stopped queues"). >> DPDK framework maintains ethdev queue state that drivers reported, >> which indicates the real state of queues. >> >> There are commands that update these two kind queue state such as >> 'port X rxq|txq start|stop'. But these operations take effect only >> in one stop-start round. In the following stop-start round, the >> preceding operations do not take effect anymore. However, only >> the ethdev queue state is updated, causing the testpmd and ethdev >> state information to diverge and causing unexpected side effects >> as above problem. >> >> There was a similar problem for the secondary process, please see >> commit 5028f207a4fa ("app/testpmd: fix secondary process packet >> forwarding"). >> >> This patch applies its workaround with some difference to the >> primary process. Not all PMDs implement rte_eth_rx_queue_info_get and >> rte_eth_tx_queue_info_get, however they may support deferred_start >> with primary process. To not break their behavior, retain the original >> testpmd local queue state for those PMDs. >> >> Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") >> Cc: stable@dpdk.org >> >> Signed-off-by: Jie Hai >> --- > > Hi Jie, > > I see the error below when starting a representor port after reattaching it with this patch, is it expected? > > $ sudo ./build /app/dpdk-testpmd -n 4 -a 0000:08:00.0,dv_esw_en=1,representor=vf0-1 -a auxiliary: -a 00:00.0 --iova-mode="va" -- -i > [..] > testpmd> port stop all > testpmd> port close 0 > testpmd> device detach 0000:08:00.0 > testpmd> port attach 0000:08:00.0,dv_esw_en=1,representor=0-1 > testpmd> port start 1 > Configuring Port 1 (socket 0) > Port 1: FA:9E:D8:5F:D7:D8 > Invalid Rx queue_id=0 > testpmd: Failed to get rx queue info > Invalid Tx queue_id=0 > testpmd: Failed to get tx queue info > > Regards, > Ali Hi Ali, Thanks for your feedback. When update_queue_state is called, the status of all queues on all ports are updated. The number of queues is nb_rxq|nb_txq which is stored locally by testpmd process. All ports on the same process shares the same nb_rxq|nb_txq. After detached and attached, the number of queues of port 0 is 0. And it changes only when the port is reconfigured by testpmd, which is when port 0 is started. If we start port 1 first, update_queue_state will update nb_rxq|nb_txq queues state of port 0, and that's invalid because there's zero queues. If this patch is not applied, the same problem occurs when the secondary process detaches and attaches the port, and then starts the port in the multi-process scenario. I will submit a patch to fix this problem. When port starts, update queue state based on the number of queues reported by the driver. Thanks, Jie Hai