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 DA4E6A0542; Tue, 6 Sep 2022 09:04:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84CB640143; Tue, 6 Sep 2022 09:04:26 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 62F6B400D6; Tue, 6 Sep 2022 09:04:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662447864; x=1693983864; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rh2CemVF/Ls8UUFbaZGrFHF4R5TvIgH9s8iCbpMICvY=; b=QtgGl6LnXcyi2WPoNrcIXwKGs8APpk5kfmQ1kNnPgxyrdjBjm3WVq2IT YsHEb8GZ71aKmrFx3a8mP7G8XQG9WkjLwyHqqvR0ESkKJSJhpcoWDHUuv szUJd8UuWvvnsnfvWTpr0Hl0Mp5PKc48EViRy2S9UAiZNFhBUByz9wCh7 WQUbCmbb/HA/DjKzoN+RvbZNTc59McyvHIHNQjeUgKQ6YWMVhBp8h7jNc TBereagV9FgGZufD1OTBz+Cbj7h8CNh2fYdr5njhupgu+W7IGogh2JGJh 8bZCNfsG6t5N99H4DGaMxZqlB0boCOXVG4ZmJSZzyK/CiIFB2avFwFaMW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="279536806" X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="279536806" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 00:04:23 -0700 X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="675563995" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 00:04:19 -0700 From: Peng Zhang To: dev@dpdk.org Cc: andrew.rybchenko@oktetlabs.ru, aman.deep.singh@intel.com, yuying.zhang@intel.com, Peng Zhang , stable@dpdk.org Subject: [PATCH v3] app/testpmd: fix incorrect queues state of secondary process Date: Tue, 6 Sep 2022 22:53:10 +0800 Message-Id: <20220906145310.8849-1-peng1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220819100940.657437-1-peng1x.zhang@intel.com> References: <20220819100940.657437-1-peng1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 + #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]); + } + } 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++) { -- 2.25.1