[dpdk-stable] patch 'app/testpmd: update forward engine beginning' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:30:17 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.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 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/f8466ee10ff01f35dd4de5ad9b0df1eb59a91f82

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From f8466ee10ff01f35dd4de5ad9b0df1eb59a91f82 Mon Sep 17 00:00:00 2001
From: Alvin Zhang <alvinx.zhang at intel.com>
Date: Thu, 23 Sep 2021 16:01:28 +0800
Subject: [PATCH] app/testpmd: update forward engine beginning
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit a78040c990cb7beac2a7daac8f18646c54e2fd07 ]

For each forward engine, there may be some special conditions
must be met before the forwarding runs.

Adding checks for these conditions in configuring is not suitable,
because one condition may rely on multiple configurations, and the
conditions required by each forward engine is not general.

The best solution is each forward engine has a callback to check
whether these conditions are met, and then testpmd can call the
callback to determine whether the forwarding can be started.

There was a void callback 'port_fwd_begin' in forward engine,
it did some initialization for forwarding, this patch updates its
return value then we can add some checks in it to confirm whether
the forwarding can be started. In addition, this patch calls the
callback before the forwarding stats is reset and then launches the
forwarding engine.

Bugzilla ID: 797

Signed-off-by: Alvin Zhang <alvinx.zhang at intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li at intel.com>
---
 app/test-pmd/ieee1588fwd.c |  3 ++-
 app/test-pmd/noisy_vnf.c   |  4 +++-
 app/test-pmd/testpmd.c     | 38 ++++++++++++++++++++++++++------------
 app/test-pmd/testpmd.h     |  2 +-
 app/test-pmd/txonly.c      |  3 ++-
 5 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index e3b98e3e0c..a949d24d5c 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -198,10 +198,11 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	port_ieee1588_tx_timestamp_check(fs->rx_port);
 }
 
-static void
+static int
 port_ieee1588_fwd_begin(portid_t pi)
 {
 	rte_eth_timesync_enable(pi);
+	return 0;
 }
 
 static void
diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c
index 382a4c2aae..e4434bea95 100644
--- a/app/test-pmd/noisy_vnf.c
+++ b/app/test-pmd/noisy_vnf.c
@@ -231,7 +231,7 @@ noisy_fwd_end(portid_t pi)
 	rte_free(noisy_cfg[pi]);
 }
 
-static void
+static int
 noisy_fwd_begin(portid_t pi)
 {
 	struct noisy_config *n;
@@ -273,6 +273,8 @@ noisy_fwd_begin(portid_t pi)
 		rte_exit(EXIT_FAILURE,
 			 "--noisy-lkup-memory-size must be > 0\n");
 	}
+
+	return 0;
 }
 
 struct fwd_engine noisy_vnf_engine = {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5288c04ab6..75714ff648 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2074,16 +2074,10 @@ run_one_txonly_burst_on_core(void *fwd_arg)
 static void
 launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore)
 {
-	port_fwd_begin_t port_fwd_begin;
 	unsigned int i;
 	unsigned int lc_id;
 	int diag;
 
-	port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin;
-	if (port_fwd_begin != NULL) {
-		for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
-			(*port_fwd_begin)(fwd_ports_ids[i]);
-	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_lcores; i++) {
 		lc_id = fwd_lcores_cpuids[i];
 		if ((interactive == 0) || (lc_id != rte_lcore_id())) {
@@ -2128,10 +2122,35 @@ start_packet_forwarding(int with_tx_first)
 		printf("Packet forwarding already started\n");
 		return;
 	}
-	test_done = 0;
 
 	fwd_config_setup();
 
+	port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin;
+	if (port_fwd_begin != NULL) {
+		for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
+			if (port_fwd_begin(fwd_ports_ids[i])) {
+				fprintf(stderr,
+					"Packet forwarding is not ready\n");
+				return;
+			}
+		}
+	}
+
+	if (with_tx_first) {
+		port_fwd_begin = tx_only_engine.port_fwd_begin;
+		if (port_fwd_begin != NULL) {
+			for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
+				if (port_fwd_begin(fwd_ports_ids[i])) {
+					fprintf(stderr,
+						"Packet forwarding is not ready\n");
+					return;
+				}
+			}
+		}
+	}
+
+	test_done = 0;
+
 	if(!no_flush_rx)
 		flush_fwd_rx_queues();
 
@@ -2140,11 +2159,6 @@ start_packet_forwarding(int with_tx_first)
 
 	fwd_stats_reset();
 	if (with_tx_first) {
-		port_fwd_begin = tx_only_engine.port_fwd_begin;
-		if (port_fwd_begin != NULL) {
-			for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
-				(*port_fwd_begin)(fwd_ports_ids[i]);
-		}
 		while (with_tx_first--) {
 			launch_packet_forwarding(
 					run_one_txonly_burst_on_core);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 927ca587d3..b54958165a 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -266,7 +266,7 @@ struct fwd_lcore {
  *     Forwards packets unchanged on the same port.
  *     Check that sent IEEE1588 PTP packets are timestamped by the hardware.
  */
-typedef void (*port_fwd_begin_t)(portid_t pi);
+typedef int (*port_fwd_begin_t)(portid_t pi);
 typedef void (*port_fwd_end_t)(portid_t pi);
 typedef void (*packet_fwd_t)(struct fwd_stream *fs);
 
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index d55ee7ca00..93d121fd57 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -423,7 +423,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 	get_end_cycles(fs, start_tsc);
 }
 
-static void
+static int
 tx_only_begin(portid_t pi)
 {
 	uint16_t pkt_data_len;
@@ -455,6 +455,7 @@ tx_only_begin(portid_t pi)
 		timestamp_init_req++;
 	/* Make sure all settings are visible on forwarding cores.*/
 	rte_wmb();
+	return 0;
 }
 
 struct fwd_engine tx_only_engine = {
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:07.851812489 +0800
+++ 0133-app-testpmd-update-forward-engine-beginning.patch	2021-11-10 14:17:01.897412539 +0800
@@ -1 +1 @@
-From a78040c990cb7beac2a7daac8f18646c54e2fd07 Mon Sep 17 00:00:00 2001
+From f8466ee10ff01f35dd4de5ad9b0df1eb59a91f82 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit a78040c990cb7beac2a7daac8f18646c54e2fd07 ]
@@ -25 +27,0 @@
-Cc: stable at dpdk.org
@@ -30 +31,0 @@
- app/test-pmd/flowgen.c     |  3 ++-
@@ -36 +37 @@
- 6 files changed, 36 insertions(+), 17 deletions(-)
+ 5 files changed, 34 insertions(+), 16 deletions(-)
@@ -38,17 +38,0 @@
-diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
-index a96169e680..7ebed9fed3 100644
---- a/app/test-pmd/flowgen.c
-+++ b/app/test-pmd/flowgen.c
-@@ -201,10 +201,11 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
- 	get_end_cycles(fs, start_tsc);
- }
- 
--static void
-+static int
- flowgen_begin(portid_t pi)
- {
- 	printf("  number of flows for port %u: %d\n", pi, nb_flows_flowgen);
-+	return 0;
- }
- 
- struct fwd_engine flow_gen_engine = {
@@ -56 +40 @@
-index 9cf10c1c50..b85a4aa87b 100644
+index e3b98e3e0c..a949d24d5c 100644
@@ -95 +79 @@
-index 97ae52e17e..eec4f1b81d 100644
+index 5288c04ab6..75714ff648 100644
@@ -98 +82 @@
-@@ -2172,16 +2172,10 @@ run_one_txonly_burst_on_core(void *fwd_arg)
+@@ -2074,16 +2074,10 @@ run_one_txonly_burst_on_core(void *fwd_arg)
@@ -115,2 +99,2 @@
-@@ -2227,10 +2221,35 @@ start_packet_forwarding(int with_tx_first)
- 		fprintf(stderr, "Packet forwarding already started\n");
+@@ -2128,10 +2122,35 @@ start_packet_forwarding(int with_tx_first)
+ 		printf("Packet forwarding already started\n");
@@ -152 +136 @@
-@@ -2239,11 +2258,6 @@ start_packet_forwarding(int with_tx_first)
+@@ -2140,11 +2159,6 @@ start_packet_forwarding(int with_tx_first)
@@ -165 +149 @@
-index 5863b2f43f..e9d9db06ce 100644
+index 927ca587d3..b54958165a 100644
@@ -168 +152 @@
-@@ -268,7 +268,7 @@ struct fwd_lcore {
+@@ -266,7 +266,7 @@ struct fwd_lcore {
@@ -178 +162 @@
-index 40655801cc..6b3651f855 100644
+index d55ee7ca00..93d121fd57 100644
@@ -181 +165 @@
-@@ -435,7 +435,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
+@@ -423,7 +423,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
@@ -190 +174 @@
-@@ -467,6 +467,7 @@ tx_only_begin(portid_t pi)
+@@ -455,6 +455,7 @@ tx_only_begin(portid_t pi)


More information about the stable mailing list