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 172B2A0551 for ; Wed, 7 Sep 2022 03:53:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1311D400D6; Wed, 7 Sep 2022 03:53:23 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 454C640042; Wed, 7 Sep 2022 03:53:21 +0200 (CEST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MMlZs63CvznVq3; Wed, 7 Sep 2022 09:50:45 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 7 Sep 2022 09:53:19 +0800 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.2375.24; Wed, 7 Sep 2022 09:53:18 +0800 Message-ID: <6f5b04f7-d6a0-a3b8-2e45-ec3e1744a3d2@huawei.com> Date: Wed, 7 Sep 2022 09:53:18 +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 v3] app/testpmd: fix incorrect queues state of secondary process To: Peng Zhang , CC: , , , References: <20220819100940.657437-1-peng1x.zhang@intel.com> <20220906145310.8849-1-peng1x.zhang@intel.com> From: "lihuisong (C)" In-Reply-To: <20220906145310.8849-1-peng1x.zhang@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 在 2022/9/6 22:53, Peng Zhang 写道: > Primary process could set up queues state correctly when starting port, > while secondary process not. Under multi-process scenario, "stream_init" > function would get wrong queues state for secondary process. > > This commit is to get queues state from ethdev which is located in > shared memory. > > Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") > Cc: stable@dpdk.org > > Signed-off-by: Peng Zhang > > --- > v3: > - Modify the parameter of rx or tx queue state array > v2: > - Change the way of getting secondary process queues states > --- > app/test-pmd/testpmd.c | 22 +++++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index addcbcac85..977ec4fa28 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -75,6 +75,8 @@ > > #include "testpmd.h" > > +#include This header file is internal, app shouldn't use it. > + > #ifndef MAP_HUGETLB > /* FreeBSD may not have MAP_HUGETLB (in fact, it probably doesn't) */ > #define HUGE_FLAG (0x40000) > @@ -2402,10 +2404,24 @@ 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++) > - stream_init(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) { > + struct fwd_stream *fs = fwd_streams[i]; > + struct rte_eth_dev_data *dev_rx_data, *dev_tx_data; > + > + dev_rx_data = (&rte_eth_devices[fs->rx_port])->data; > + dev_tx_data = (&rte_eth_devices[fs->tx_port])->data; > + > + uint8_t rx_state = dev_rx_data->rx_queue_state[fs->rx_queue]; > + ports[fs->rx_port].rxq[fs->rx_queue].state = rx_state; > + uint8_t tx_state = dev_tx_data->tx_queue_state[fs->tx_queue]; > + ports[fs->tx_port].txq[fs->tx_queue].state = tx_state; > + } > > + stream_init(fwd_streams[i]); > + } > + } > Suggest that an API in ethdev layer can be encapsulated to obtain the device Rx/Tx queue state. Both primary and secondary process get or set queue state by this API. > port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; > if (port_fwd_begin != NULL) { > for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {