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 31E23A04FD for ; Thu, 18 Aug 2022 10:34:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BA1741109; Thu, 18 Aug 2022 10:34:33 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 6C30140156; Thu, 18 Aug 2022 10:34:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660811670; x=1692347670; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ek4XqgGWy5XPevxBuKmhEMm2zTtOCUH8c+er2UJRd3s=; b=bhFcM01/vZtf4cGpu04VB5gRiQanfBdxR3wW7uLgjO4wTLH12xMHu05o BMa8YEPo+7Wl/z63nNlDu/pq705SZLIOztlVHb9wbSh4xnhyXxW5pYyna ydJEhlsx6iMwuCmYw2bBwJTl9pgLa4i8/zWsg/7zPqnPY/JrpdnwJi1PU lS/4EPg8lAlhcZf8EzZ0+ek5eBIInsZotP0e+TK5yU7nvtrLn6TjYUHZP PsK6N6dqI09v2rSu24h0lzDF+YZauWUAQwjAsZv6KnTnzyahzLP/YI9Dk 7jTBZzWKOejiGTeNAE8mYJ5iBK7xcORZQ7GoTcntSpTfDWXnITitvfa2n Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="293493995" X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="293493995" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 01:34:29 -0700 X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="558446722" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 01:34:27 -0700 From: peng1x.zhang@intel.com To: dev@dpdk.org Cc: aman.deep.singh@intel.com, yuying.zhang@intel.com, Peng Zhang , stable@dpdk.org Subject: [PATCH v2] app/testpmd: fix incorrect queues state of secondary process Date: Fri, 19 Aug 2022 00:25:12 +0800 Message-Id: <20220818162512.653103-1-peng1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Peng Zhang Primary process could set up queues state correctly when starting port, but 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 --- app/test-pmd/testpmd.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index addcbcac85..70f907d96b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -75,6 +75,8 @@ #include "testpmd.h" +#include + #ifndef MAP_HUGETLB /* FreeBSD may not have MAP_HUGETLB (in fact, it probably doesn't) */ #define HUGE_FLAG (0x40000) @@ -2402,9 +2404,23 @@ 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) { + 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_port]; + ports[fs->rx_port].rxq[fs->rx_queue].state = rx_state; + uint8_t tx_state = dev_tx_data->tx_queue_state[fs->tx_port]; + ports[fs->tx_port].txq[fs->tx_queue].state = tx_state; + } stream_init(fwd_streams[i]); + } + } port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; if (port_fwd_begin != NULL) { -- 2.25.1