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 E001C41D49; Thu, 23 Feb 2023 08:08:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D150143082; Thu, 23 Feb 2023 08:08:57 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 185F54021F; Thu, 23 Feb 2023 08:08:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677136135; x=1708672135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lVYmjRNFVBXhHs0M6/AWehPfaIgAd3Et125FCTzSf1w=; b=kemZADGDwErLukZfjAtT8is/G/cjW0I/dvjRLYc0WnkWp2EB3j4sqWci xmhFjkLgNlD29PMxI1AXuMGSE8Rg+9OXPWjLEHfuHAv2F+kLGxOcBBR39 92XTgw5a5Tyq4wyJt7niQtvFo6Ey1+SCHegihj2FVRJlZa2ufR2HxkLp9 LsfOCIPC0munA7L2BZ6JWaF9hRiabJLLaQJmwmJqNxqDkpPXYqZD2950Q E705gQJ/dMaxNu5pvr/NxxNv1jYOZLfBovJEmsTKMtUM2pC/a1dE8dq4H NRbYSk78cZpp+BZsnHkwFNfRAZqmEX49pYggwQRpqCctiXuIKlsJHZH4t g==; X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="334502279" X-IronPort-AV: E=Sophos;i="5.97,320,1669104000"; d="scan'208";a="334502279" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2023 23:08:54 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="672375109" X-IronPort-AV: E=Sophos;i="5.97,320,1669104000"; d="scan'208";a="672375109" Received: from unknown (HELO root..) ([10.239.252.115]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2023 23:08:51 -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 v3] app/testpmd: fix secondary process not forwarding Date: Thu, 23 Feb 2023 14:41:06 +0000 Message-Id: <20230223144106.707999-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 v3: Add return value description --- app/test-pmd/testpmd.c | 45 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0c14325b8d..a050472aea 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2418,9 +2418,50 @@ 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 == 0) { + ports[fs->rx_port].rxq[fs->rx_queue].state = + rx_qinfo.queue_state; + } else if (rc == -ENOTSUP) { + /* Set the rxq state to RTE_ETH_QUEUE_STATE_STARTED + * to ensure that the PMDs do not implement + * rte_eth_rx_queue_info_get can forward. + */ + 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 == 0) { + ports[fs->tx_port].txq[fs->tx_queue].state = + tx_qinfo.queue_state; + } else if (rc == -ENOTSUP) { + /* Set the txq state to RTE_ETH_QUEUE_STATE_STARTED + * to ensure that the PMDs do not implement + * rte_eth_tx_queue_info_get can forward. + */ + 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