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 C571541CFA; Tue, 21 Feb 2023 09:12:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA3BD43181; Tue, 21 Feb 2023 09:12:14 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id DE12040E5A; Tue, 21 Feb 2023 09:12:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676967133; x=1708503133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EqURBr/LONZFJjGIPee9YWX0NXSlWoKKQttK6hhGBpw=; b=giB2lqrWDxhie+xTJkTQeydFqXEV5giep9ACgtxnRnfoHyc5JA5JzWjt of1t50XdBHQ0WcpNC0Xut+PSgX5GAAX0m0ejwny+o9QtiyHGKaXAmOVRa A8awRbniftJ4sdCcPV6+vWSq0c9pSbe9hoq4YHGxj4WeqluAaLoy6+zAt nUDhPRd7Zvc+olKtdK3rlQLMUu+msYsL9TgWqmJww3a/n8J7sMIWH1h0g s+iRnoH0S/JklR8JwL6RP/jJBZOY95Lb12XYO3YkBpTl1yADyeBADsfst boJOJQtJft+9zpD7WGDJJh4cv6LrmBcFR08GtpRZt5g0CGPhIdtHT2FH1 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10627"; a="395054509" X-IronPort-AV: E=Sophos;i="5.97,315,1669104000"; d="scan'208";a="395054509" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2023 00:12:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10627"; a="917094667" X-IronPort-AV: E=Sophos;i="5.97,315,1669104000"; d="scan'208";a="917094667" Received: from unknown (HELO root..) ([10.239.252.115]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2023 00:12:08 -0800 From: Shiyang He To: dev@dpdk.org Cc: yidingx.zhou@intel.com, Shiyang He , stable@dpdk.org, Yuying Zhang , Aman Singh , Anatoly Burakov , Matan Azrad , Dmitry Kozlyuk Subject: [PATCH v2] app/testpmd: fix secondary process not forwarding Date: Tue, 21 Feb 2023 15:44:18 +0000 Message-Id: <20230221154418.153972-1-shiyangx.he@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221230075554.25244-1-shiyangx.he@intel.com> References: <20221230075554.25244-1-shiyangx.he@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 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: 3c4426db54fc ("app/testpmd: do not poll stopped queues") Cc: stable@dpdk.org Signed-off-by: Shiyang He Acked-by: Yuying Zhang v2: Add function return value processing --- app/test-pmd/testpmd.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0c14325b8d..b450f3f6c4 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2418,9 +2418,40 @@ 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_SECONDARY) { + 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 if (-ENOTSUP == rc) + ports[fs->rx_port].rxq[fs->rx_queue].state = + RTE_ETH_QUEUE_STATE_STARTED; + 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 if (-ENOTSUP == rc) + ports[fs->tx_port].txq[fs->tx_queue].state = + RTE_ETH_QUEUE_STATE_STARTED; + else + TESTPMD_LOG(WARNING, + "Failed to get tx queue info\n"); + } stream_init(fwd_streams[i]); + } + } port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; if (port_fwd_begin != NULL) { -- 2.37.2