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 814C541E9F for ; Wed, 15 Mar 2023 15:37:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72B4E42C76; Wed, 15 Mar 2023 15:37:13 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2057D42D13 for ; Wed, 15 Mar 2023 15:37:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678891031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCBlx1a5bEbGifkbg7ZSCyYqrilIfsQBJjRO0EHimEQ=; b=KjeS44dM+Mc/a+76f5cpiZHnTLnyKcKUykHr372q+JuEqRBYklgnF6GSn1FRNmyqhmXFCw 6YIMfDg0fDDewSMJVUBEqVdgPZR23JpcmsJZZv4KMdZv35fbhvPm8k4uL6tA2KGJ3kUcVa EFG1JjYWTTxk3xqx7QGZJPHWTGeuBy8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-599-jiXqNtFBP_mS4b_O-CXNiw-1; Wed, 15 Mar 2023 10:37:08 -0400 X-MC-Unique: jiXqNtFBP_mS4b_O-CXNiw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3187101A557; Wed, 15 Mar 2023 14:37:07 +0000 (UTC) Received: from rh.Home (unknown [10.39.192.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D3B740C6E68; Wed, 15 Mar 2023 14:37:06 +0000 (UTC) From: Kevin Traynor To: Shiyang He Cc: Ferruh Yigit , dpdk stable Subject: patch 'app/testpmd: fix secondary process packet forwarding' has been queued to stable release 21.11.4 Date: Wed, 15 Mar 2023 14:36:13 +0000 Message-Id: <20230315143640.677317-20-ktraynor@redhat.com> In-Reply-To: <20230315143640.677317-1-ktraynor@redhat.com> References: <20230315143640.677317-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Hi, FYI, your patch has been queued to stable release 21.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/20/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/66c0e09464a597f2bc66bc9f8d3a251ddb2283a0 Thanks. Kevin --- >From 66c0e09464a597f2bc66bc9f8d3a251ddb2283a0 Mon Sep 17 00:00:00 2001 From: Shiyang He Date: Wed, 8 Mar 2023 16:19:47 +0000 Subject: [PATCH] app/testpmd: fix secondary process packet forwarding [ upstream commit 5028f207a4fa6d5cdd86019e43d2e2d80fa21ced ] 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") Signed-off-by: Shiyang He Reviewed-by: Ferruh Yigit --- app/test-pmd/testpmd.c | 72 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 61c0200a22..9f4a0e0a78 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2364,4 +2364,68 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore) } +static void +update_rx_queue_state(uint16_t port_id, uint16_t queue_id) +{ + struct rte_eth_rxq_info rx_qinfo; + int32_t rc; + + rc = rte_eth_rx_queue_info_get(port_id, + queue_id, &rx_qinfo); + if (rc == 0) { + ports[port_id].rxq[queue_id].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[port_id].rxq[queue_id].state = + RTE_ETH_QUEUE_STATE_STARTED; + } else { + TESTPMD_LOG(WARNING, + "Failed to get rx queue info\n"); + } +} + +static void +update_tx_queue_state(uint16_t port_id, uint16_t queue_id) +{ + struct rte_eth_txq_info tx_qinfo; + int32_t rc; + + rc = rte_eth_tx_queue_info_get(port_id, + queue_id, &tx_qinfo); + if (rc == 0) { + ports[port_id].txq[queue_id].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[port_id].txq[queue_id].state = + RTE_ETH_QUEUE_STATE_STARTED; + } else { + TESTPMD_LOG(WARNING, + "Failed to get tx queue info\n"); + } +} + +static void +update_queue_state(void) +{ + portid_t pi; + queueid_t qi; + + RTE_ETH_FOREACH_DEV(pi) { + for (qi = 0; qi < nb_rxq; qi++) + update_rx_queue_state(pi, qi); + for (qi = 0; qi < nb_txq; qi++) + update_tx_queue_state(pi, qi); + } +} + /* * Launch packet forwarding configuration. @@ -2403,7 +2467,10 @@ start_packet_forwarding(int with_tx_first) return; - if (stream_init != NULL) + if (stream_init != NULL) { + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + update_queue_state(); for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) stream_init(fwd_streams[i]); + } port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; @@ -3060,4 +3127,7 @@ start_port(portid_t pid) } + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + update_queue_state(); + if (at_least_one_port_successfully_started && !no_link_check) check_all_ports_link_status(RTE_PORT_ALL); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-03-15 14:30:21.093538051 +0000 +++ 0020-app-testpmd-fix-secondary-process-packet-forwarding.patch 2023-03-15 14:30:20.579123678 +0000 @@ -1 +1 @@ -From 5028f207a4fa6d5cdd86019e43d2e2d80fa21ced Mon Sep 17 00:00:00 2001 +From 66c0e09464a597f2bc66bc9f8d3a251ddb2283a0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5028f207a4fa6d5cdd86019e43d2e2d80fa21ced ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index b6197aa258..0032696608 100644 +index 61c0200a22..9f4a0e0a78 100644 @@ -26 +27 @@ -@@ -2398,4 +2398,68 @@ common_fwd_stream_init(struct fwd_stream *fs) +@@ -2364,4 +2364,68 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore) @@ -95 +96 @@ -@@ -2437,7 +2501,10 @@ start_packet_forwarding(int with_tx_first) +@@ -2403,7 +2467,10 @@ start_packet_forwarding(int with_tx_first) @@ -107 +108 @@ -@@ -3199,4 +3266,7 @@ start_port(portid_t pid) +@@ -3060,4 +3127,7 @@ start_port(portid_t pid)