patch 'app/testpmd: fix secondary process packet forwarding' has been queued to stable release 21.11.4

Kevin Traynor ktraynor at redhat.com
Wed Mar 15 15:36:13 CET 2023


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 <shiyangx.he at intel.com>
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 <shiyangx.he at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
 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 at 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)



More information about the stable mailing list