patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Feifei Wang <feifei.wang2@arm.com>
To: Harry van Haaren <harry.van.haaren@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	David Hunt <david.hunt@intel.com>
Cc: dev@dpdk.org, nd@arm.com, Feifei Wang <feifei.wang2@arm.com>,
	stable@dpdk.org, Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [dpdk-stable] [PATCH v4 2/3] examples/eventdev: add info output for main core
Date: Thu, 14 Jan 2021 18:31:00 +0800	[thread overview]
Message-ID: <20210114103101.738262-3-feifei.wang2@arm.com> (raw)
In-Reply-To: <20210114103101.738262-1-feifei.wang2@arm.com>

When the main core is set as tx/rx/sched/worker core, it also needs to
print some information to show this. Thus, add info output for the main
core, and add a "dump" function to print core information for the sake
of code simplicity and easy maintenance.

In the meanwhile, fix the count error. For the variable "worker_idx", it
should be incremented when the core is set as worker core. However, when
the main core is set as rx/tx/sched core, the worker_idx is also
incremented. Though this error may not have a substantial impact due to
that the main core is the last launched core, but it should be corrected
from the perspective of code correctness.

Fixes: 1094ca96689c ("doc: add SW eventdev pipeline to sample app guide")
Cc: harry.van.haaren@intel.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/eventdev_pipeline/main.c | 55 +++++++++++++++++++------------
 1 file changed, 34 insertions(+), 21 deletions(-)

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index e9a591134..3526d4d3d 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -22,6 +22,32 @@ struct config_data cdata = {
 	.worker_cq_depth = 16
 };
 
+static void
+dump_core_info(unsigned int lcore_id, struct worker_data *data,
+		unsigned int worker_idx)
+{
+	if (fdata->rx_core[lcore_id])
+		printf(
+			"[%s()] lcore %d executing NIC Rx\n",
+			__func__, lcore_id);
+
+	if (fdata->tx_core[lcore_id])
+		printf(
+			"[%s()] lcore %d executing NIC Tx\n",
+			__func__, lcore_id);
+
+	if (fdata->sched_core[lcore_id])
+		printf(
+			"[%s()] lcore %d executing scheduler\n",
+			__func__, lcore_id);
+
+	if (fdata->worker_core[lcore_id])
+		printf(
+			"[%s()] lcore %d executing worker, using eventdev port %u\n",
+			__func__, lcore_id,
+			data[worker_idx].port_id);
+}
+
 static bool
 core_in_use(unsigned int lcore_id) {
 	return (fdata->rx_core[lcore_id] || fdata->sched_core[lcore_id] ||
@@ -411,25 +437,7 @@ main(int argc, char **argv)
 			!fdata->sched_core[lcore_id])
 			continue;
 
-		if (fdata->rx_core[lcore_id])
-			printf(
-				"[%s()] lcore %d executing NIC Rx\n",
-				__func__, lcore_id);
-
-		if (fdata->tx_core[lcore_id])
-			printf(
-				"[%s()] lcore %d executing NIC Tx\n",
-				__func__, lcore_id);
-
-		if (fdata->sched_core[lcore_id])
-			printf("[%s()] lcore %d executing scheduler\n",
-					__func__, lcore_id);
-
-		if (fdata->worker_core[lcore_id])
-			printf(
-				"[%s()] lcore %d executing worker, using eventdev port %u\n",
-				__func__, lcore_id,
-				worker_data[worker_idx].port_id);
+		dump_core_info(lcore_id, worker_data, worker_idx);
 
 		err = rte_eal_remote_launch(fdata->cap.worker,
 				&worker_data[worker_idx], lcore_id);
@@ -444,8 +452,13 @@ main(int argc, char **argv)
 
 	lcore_id = rte_lcore_id();
 
-	if (core_in_use(lcore_id))
-		fdata->cap.worker(&worker_data[worker_idx++]);
+	if (core_in_use(lcore_id)) {
+		dump_core_info(lcore_id, worker_data, worker_idx);
+		fdata->cap.worker(&worker_data[worker_idx]);
+
+		if (fdata->worker_core[lcore_id])
+			worker_idx++;
+	}
 
 	rte_eal_mp_wait_lcore();
 
-- 
2.25.1


  parent reply	other threads:[~2021-01-14 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21  5:34 [dpdk-stable] [PATCH] examples/eventdev: move eth stop to the end Feifei Wang
2020-12-21  9:32 ` [dpdk-stable] [PATCH v2] " Feifei Wang
2020-12-21  9:56 ` [dpdk-stable] [PATCH] " Van Haaren, Harry
2020-12-22  5:31   ` [dpdk-stable] 回复: " Feifei Wang
2021-01-05  5:14 ` [dpdk-stable] [PATCH v3] examples/eventdev: refactor ethdev port stop Feifei Wang
2021-01-05 10:09   ` [dpdk-stable] [EXT] " Pavan Nikhilesh Bhagavatula
2021-01-14  6:24     ` [dpdk-stable] 回复: " Feifei Wang
2021-01-14  8:50       ` Feifei Wang
     [not found] ` <20210114103101.738262-1-feifei.wang2@arm.com>
2021-01-14 10:30   ` [dpdk-stable] [PATCH v4 1/3] doc: fix core enabled bug for eventdev pipeline example Feifei Wang
2021-01-14 10:31   ` Feifei Wang [this message]
2021-01-14 10:31   ` [dpdk-stable] [PATCH v4 3/3] examples/eventdev: move eth stop to the end Feifei Wang
2021-01-25 17:51     ` [dpdk-stable] [EXT] " Pavan Nikhilesh Bhagavatula
2021-01-26 13:37       ` [dpdk-stable] [dpdk-dev] " Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210114103101.738262-3-feifei.wang2@arm.com \
    --to=feifei.wang2@arm.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.mcnamara@intel.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).