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 8AAC74326F for ; Thu, 2 Nov 2023 14:15:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF25740ED8; Thu, 2 Nov 2023 14:15:18 +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 261EF40A76 for ; Thu, 2 Nov 2023 14:15:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698930917; 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=eX12WtYQ9GawnD8Lt7vOFiqiWR1U7Bt93aByfOTwg+E=; b=d+dHpUFuMKkHq+Mg9N81ZBCOmjCz47JMj+BPgHyHTfN0PjcVGjv/Xeich1wGRJmhatoF7S phyOWv/iTf3KN0mqAzO+LO95OFjxFgZ9Bs/8ugCpMk7uyNg8XU0RWTaVRsczUoWWgDoXCW jqwP2OCx7snagx47mxd18DGiuW0L3qU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-tdCU6_kfMAO8IwgCdsCFuw-1; Thu, 02 Nov 2023 09:15:15 -0400 X-MC-Unique: tdCU6_kfMAO8IwgCdsCFuw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1EDFA89C8EF; Thu, 2 Nov 2023 13:15:15 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3315D492BFA; Thu, 2 Nov 2023 13:15:14 +0000 (UTC) From: Kevin Traynor To: Jie Hai Cc: Ferruh Yigit , dpdk stable Subject: patch 'app/testpmd: fix primary process not polling all queues' has been queued to stable release 21.11.6 Date: Thu, 2 Nov 2023 13:12:47 +0000 Message-ID: <20231102131254.315947-101-ktraynor@redhat.com> In-Reply-To: <20231102131254.315947-1-ktraynor@redhat.com> References: <20231102131254.315947-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/08/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/097657f9bc334a0fc69215e33bf25e5277d41e22 Thanks. Kevin --- >From 097657f9bc334a0fc69215e33bf25e5277d41e22 Mon Sep 17 00:00:00 2001 From: Jie Hai Date: Fri, 8 Sep 2023 19:29:01 +0800 Subject: [PATCH] app/testpmd: fix primary process not polling all queues [ upstream commit 37b68fa1445cb6fe287178607bac6fa3d90b835f ] Here's how the problem arises. step1: Start the app. dpdk-testpmd -a 0000:35:00.0 -l 0-3 -- -i --rxq=10 --txq=10 step2: Perform the following steps and send traffic. As expected, queue 7 does not send or receive packets, and other queues do. port 0 rxq 7 stop port 0 txq 7 stop set fwd mac start step3: Perform the following steps and send traffic. All queues are expected to send and receive packets normally, but that's not the case for queue 7. stop port stop all port start all start show port xstats all In fact, only the value of rx_q7_packets for queue 7 is not zero, which means queue 7 is enabled for the driver but is not involved in packet receiving and forwarding by software. If we check queue state by command 'show rxq info 0 7' and 'show txq info 0 7', we see queue 7 is started as other queues are. Rx queue state: started Tx queue state: started The queue 7 is started but cannot forward. That's the problem. We know that each stream has a read-only "disabled" field that control if this stream should be used to forward. This field depends on testpmd local queue state, please see commit 3c4426db54fc ("app/testpmd: do not poll stopped queues"). DPDK framework maintains ethdev queue state that drivers reported, which indicates the real state of queues. There are commands that update these two kind queue state such as 'port X rxq|txq start|stop'. But these operations take effect only in one stop-start round. In the following stop-start round, the preceding operations do not take effect anymore. However, only the ethdev queue state is updated, causing the testpmd and ethdev state information to diverge and causing unexpected side effects as above problem. There was a similar problem for the secondary process, please see commit 5028f207a4fa ("app/testpmd: fix secondary process packet forwarding"). This patch applies its workaround with some difference to the primary process. Not all PMDs implement rte_eth_rx_queue_info_get and rte_eth_tx_queue_info_get, however they may support deferred_start with primary process. To not break their behavior, retain the original testpmd local queue state for those PMDs. Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") Signed-off-by: Jie Hai Acked-by: Ferruh Yigit --- app/test-pmd/testpmd.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9f4a0e0a78..5f34641e90 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2376,4 +2376,11 @@ update_rx_queue_state(uint16_t port_id, uint16_t queue_id) rx_qinfo.queue_state; } else if (rc == -ENOTSUP) { + /* + * Do not change the rxq state for primary process + * to ensure that the PMDs do not implement + * rte_eth_rx_queue_info_get can forward as before. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + return; /* * Set the rxq state to RTE_ETH_QUEUE_STATE_STARTED @@ -2401,4 +2408,11 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) tx_qinfo.queue_state; } else if (rc == -ENOTSUP) { + /* + * Do not change the txq state for primary process + * to ensure that the PMDs do not implement + * rte_eth_tx_queue_info_get can forward as before. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + return; /* * Set the txq state to RTE_ETH_QUEUE_STATE_STARTED @@ -2415,5 +2429,5 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) static void -update_queue_state(void) +update_queue_state(portid_t pid) { portid_t pi; @@ -2421,4 +2435,7 @@ update_queue_state(void) RTE_ETH_FOREACH_DEV(pi) { + if (pid != pi && pid != (portid_t)RTE_PORT_ALL) + continue; + for (qi = 0; qi < nb_rxq; qi++) update_rx_queue_state(pi, qi); @@ -2468,6 +2485,5 @@ start_packet_forwarding(int with_tx_first) if (stream_init != NULL) { - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(RTE_PORT_ALL); for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) stream_init(fwd_streams[i]); @@ -3127,6 +3143,5 @@ start_port(portid_t pid) } - if (rte_eal_process_type() == RTE_PROC_SECONDARY) - update_queue_state(); + update_queue_state(pi); if (at_least_one_port_successfully_started && !no_link_check) -- 2.41.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-11-02 13:09:43.209083868 +0000 +++ 0101-app-testpmd-fix-primary-process-not-polling-all-queu.patch 2023-11-02 13:09:40.923163688 +0000 @@ -1 +1 @@ -From 37b68fa1445cb6fe287178607bac6fa3d90b835f Mon Sep 17 00:00:00 2001 +From 097657f9bc334a0fc69215e33bf25e5277d41e22 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 37b68fa1445cb6fe287178607bac6fa3d90b835f ] + @@ -61 +62,0 @@ -Cc: stable@dpdk.org @@ -70 +71 @@ -index b3d6ce7127..595b77748c 100644 +index 9f4a0e0a78..5f34641e90 100644 @@ -73 +74 @@ -@@ -2426,4 +2426,11 @@ update_rx_queue_state(uint16_t port_id, uint16_t queue_id) +@@ -2376,4 +2376,11 @@ update_rx_queue_state(uint16_t port_id, uint16_t queue_id) @@ -85 +86 @@ -@@ -2451,4 +2458,11 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) +@@ -2401,4 +2408,11 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) @@ -97 +98 @@ -@@ -2465,5 +2479,5 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) +@@ -2415,5 +2429,5 @@ update_tx_queue_state(uint16_t port_id, uint16_t queue_id) @@ -104 +105 @@ -@@ -2471,4 +2485,7 @@ update_queue_state(void) +@@ -2421,4 +2435,7 @@ update_queue_state(void) @@ -112 +113 @@ -@@ -2518,6 +2535,5 @@ start_packet_forwarding(int with_tx_first) +@@ -2468,6 +2485,5 @@ start_packet_forwarding(int with_tx_first) @@ -120 +121 @@ -@@ -3282,6 +3298,5 @@ start_port(portid_t pid) +@@ -3127,6 +3143,5 @@ start_port(portid_t pid)