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

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:23:54 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/11/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/b0901e6d5b88bb3ec324e02b2dd2337a04faa387

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From b0901e6d5b88bb3ec324e02b2dd2337a04faa387 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
Cc: Xueming Li <xuemingl at nvidia.com>

[ 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 adf19cfb9e..60b5942d80 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2342,6 +2342,70 @@ 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.
  */
@@ -2381,9 +2445,12 @@ start_packet_forwarding(int with_tx_first)
 	if (!pkt_fwd_shared_rxq_check())
 		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;
 	if (port_fwd_begin != NULL) {
@@ -3143,6 +3210,9 @@ start_port(portid_t pid)
 		pl[cfg_pi++] = pi;
 	}
 
+	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);
 	else if (at_least_one_port_exist & all_ports_already_started)
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:39.964731200 +0800
+++ 0046-app-testpmd-fix-secondary-process-packet-forwarding.patch	2023-04-09 21:45:38.639042200 +0800
@@ -1 +1 @@
-From 5028f207a4fa6d5cdd86019e43d2e2d80fa21ced Mon Sep 17 00:00:00 2001
+From b0901e6d5b88bb3ec324e02b2dd2337a04faa387 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 5028f207a4fa6d5cdd86019e43d2e2d80fa21ced ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index b6197aa258..0032696608 100644
+index adf19cfb9e..60b5942d80 100644
@@ -26,2 +28,2 @@
-@@ -2397,6 +2397,70 @@ common_fwd_stream_init(struct fwd_stream *fs)
- 	fs->disabled = rx_stopped || tx_stopped;
+@@ -2342,6 +2342,70 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore)
+ 	}
@@ -97 +99 @@
-@@ -2436,9 +2500,12 @@ start_packet_forwarding(int with_tx_first)
+@@ -2381,9 +2445,12 @@ start_packet_forwarding(int with_tx_first)
@@ -111 +113 @@
-@@ -3198,6 +3265,9 @@ start_port(portid_t pid)
+@@ -3143,6 +3210,9 @@ start_port(portid_t pid)


More information about the stable mailing list