Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 1/2] shared/sec: rename members of sppwk_lcore_status
Date: Wed, 26 Jun 2019 14:36:32 +0900	[thread overview]
Message-ID: <20190626053633.39963-2-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190626053633.39963-1-yasufum.o@gmail.com>

From: Yasufumi Ogawa <yasufum.o@gmail.com>

This update is to rename members of enum `sppwk_lcore_status` which
defines each of status of worker threads, such as idling or running or
so.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/mirror/mir_cmd_runner.c                   |  9 +++----
 src/mirror/spp_mirror.c                       | 24 +++++++++----------
 .../secondary/spp_worker_th/cmd_utils.c       |  8 +++----
 .../secondary/spp_worker_th/cmd_utils.h       | 15 ++++++------
 src/vf/spp_vf.c                               | 24 +++++++++----------
 src/vf/vf_cmd_runner.c                        |  9 +++----
 6 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/src/mirror/mir_cmd_runner.c b/src/mirror/mir_cmd_runner.c
index f63a84b..17c2c27 100644
--- a/src/mirror/mir_cmd_runner.c
+++ b/src/mirror/mir_cmd_runner.c
@@ -39,9 +39,10 @@ update_comp(enum sppwk_action wk_action, const char *name,
 	switch (wk_action) {
 	case SPPWK_ACT_START:
 		info = (core_info + lcore_id);
-		if (info->status == SPP_CORE_UNUSE) {
-			RTE_LOG(ERR, MIR_CMD_RUNNER, "Core %d is not available because "
-				"it is in SPP_CORE_UNUSE state.\n", lcore_id);
+		if (info->status == SPPWK_LCORE_UNUSED) {
+			RTE_LOG(ERR, MIR_CMD_RUNNER,
+					"Not available lcore %d for %s.\n",
+					lcore_id, "SPPWK_LCORE_UNUSED");
 			return SPP_RET_NG;
 		}
 
@@ -302,7 +303,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
 	struct sppwk_comp_info *comp_info = NULL;
 
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
-		if (spp_get_core_status(lcore_id) == SPP_CORE_UNUSE)
+		if (spp_get_core_status(lcore_id) == SPPWK_LCORE_UNUSED)
 			continue;
 
 		core = get_core_info(lcore_id);
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 898755d..695f3ac 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -414,16 +414,16 @@ slave_main(void *arg __attribute__ ((unused)))
 	int ret = SPP_RET_OK;
 	int cnt = 0;
 	unsigned int lcore_id = rte_lcore_id();
-	enum sppwk_lcore_status status = SPP_CORE_STOP;
+	enum sppwk_lcore_status status = SPPWK_LCORE_STOPPED;
 	struct core_mng_info *info = &g_core_info[lcore_id];
 	struct core_info *core = get_core_info(lcore_id);
 
 	RTE_LOG(INFO, MIRROR, "Slave started on lcore %d.\n", lcore_id);
-	set_core_status(lcore_id, SPP_CORE_IDLE);
+	set_core_status(lcore_id, SPPWK_LCORE_IDLING);
 
 	while ((status = spp_get_core_status(lcore_id)) !=
-			SPP_CORE_STOP_REQUEST) {
-		if (status != SPP_CORE_FORWARD)
+			SPPWK_LCORE_REQ_STOP) {
+		if (status != SPPWK_LCORE_RUNNING)
 			continue;
 
 		if (spp_check_core_update(lcore_id) == SPP_RET_OK) {
@@ -449,7 +449,7 @@ slave_main(void *arg __attribute__ ((unused)))
 		}
 	}
 
-	set_core_status(lcore_id, SPP_CORE_STOP);
+	set_core_status(lcore_id, SPPWK_LCORE_STOPPED);
 	RTE_LOG(INFO, MIRROR, "Terminated slave on lcore %d.\n", lcore_id);
 	return ret;
 }
@@ -544,13 +544,13 @@ main(int argc, char *argv[])
 		}
 
 		/* Set the status of main thread to idle */
-		g_core_info[master_lcore].status = SPP_CORE_IDLE;
-		int ret_wait = check_core_status_wait(SPP_CORE_IDLE);
+		g_core_info[master_lcore].status = SPPWK_LCORE_IDLING;
+		int ret_wait = check_core_status_wait(SPPWK_LCORE_IDLING);
 		if (unlikely(ret_wait != 0))
 			break;
 
 		/* Start forwarding */
-		set_all_core_status(SPP_CORE_FORWARD);
+		set_all_core_status(SPPWK_LCORE_RUNNING);
 #ifdef SPP_MIRROR_SHALLOWCOPY
 		RTE_LOG(INFO, MIRROR,
 			"My ID %d start handling messagei(ShallowCopy)\n", 0);
@@ -567,7 +567,7 @@ main(int argc, char *argv[])
 		int ret_do = 0;
 #ifndef USE_UT_SPP_VF
 		while (likely(g_core_info[master_lcore].status !=
-				SPP_CORE_STOP_REQUEST)) {
+				SPPWK_LCORE_REQ_STOP)) {
 #else
 		{
 #endif
@@ -587,7 +587,7 @@ main(int argc, char *argv[])
 		}
 
 		if (unlikely(ret_do != SPP_RET_OK)) {
-			set_all_core_status(SPP_CORE_STOP_REQUEST);
+			set_all_core_status(SPPWK_LCORE_REQ_STOP);
 			break;
 		}
 
@@ -596,8 +596,8 @@ main(int argc, char *argv[])
 	}
 
 	/* Finalize to exit */
-	g_core_info[master_lcore].status = SPP_CORE_STOP;
-	int ret_core_end = check_core_status_wait(SPP_CORE_STOP);
+	g_core_info[master_lcore].status = SPPWK_LCORE_STOPPED;
+	int ret_core_end = check_core_status_wait(SPPWK_LCORE_STOPPED);
 	if (unlikely(ret_core_end != 0))
 		RTE_LOG(ERR, MIRROR, "Failed to terminate master thread.\n");
 
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 32929ec..6f93400 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -130,7 +130,7 @@ set_all_core_status(enum sppwk_lcore_status status)
 }
 
 /**
- * Set all of component status to SPP_CORE_STOP_REQUEST if received signal
+ * Set all of component status to SPPWK_LCORE_REQ_STOP if received signal
  * is SIGTERM or SIGINT
  */
 void
@@ -144,8 +144,8 @@ stop_process(int signal)
 
 	master_lcore = rte_get_master_lcore();
 	(g_mng_data.p_core_info + master_lcore)->status =
-		SPP_CORE_STOP_REQUEST;
-	set_all_core_status(SPP_CORE_STOP_REQUEST);
+		SPPWK_LCORE_REQ_STOP;
+	set_all_core_status(SPPWK_LCORE_REQ_STOP);
 }
 
 /**
@@ -397,7 +397,7 @@ init_core_info(void)
 	struct core_mng_info *p_core_info = g_mng_data.p_core_info;
 	memset(p_core_info, 0x00,
 			sizeof(struct core_mng_info)*RTE_MAX_LCORE);
-	set_all_core_status(SPP_CORE_STOP);
+	set_all_core_status(SPPWK_LCORE_STOPPED);
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		(p_core_info + cnt)->ref_index = 0;
 		(p_core_info + cnt)->upd_index = 1;
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index f33bc62..596ba5e 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -74,14 +74,13 @@
 #define CORE_TYPE_FORWARD_STR	     "forward"
 #define CORE_TYPE_MIRROR_STR	     "mirror"
 
-/* State on component */
+/* Status of a component on lcore. */
 enum sppwk_lcore_status {
-	SPP_CORE_UNUSE,        /**< Not used */
-	SPP_CORE_STOP,         /**< Stopped */
-	SPP_CORE_IDLE,         /**< Idling */
-	SPP_CORE_FORWARD,      /**< Forwarding  */
-	SPP_CORE_STOP_REQUEST, /**< Request stopping */
-	SPP_CORE_IDLE_REQUEST /**< Request idling */
+	SPPWK_LCORE_UNUSED,
+	SPPWK_LCORE_STOPPED,
+	SPPWK_LCORE_IDLING,
+	SPPWK_LCORE_RUNNING,
+	SPPWK_LCORE_REQ_STOP  /**< Request stopping */
 };
 
 /* Type of SPP worker thread. */
@@ -336,7 +335,7 @@ void set_core_status(unsigned int lcore_id, enum sppwk_lcore_status status);
 void set_all_core_status(enum sppwk_lcore_status status);
 
 /**
- * Set all comp status to SPP_CORE_STOP_REQUEST if received SIGTERM or SIGINT.
+ * Set all comp status to SPPWK_LCORE_REQ_STOP if received SIGTERM or SIGINT.
  *
  * @param[in] signal Received signal.
  */
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 0068329..18a3619 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -140,16 +140,16 @@ slave_main(void *arg __attribute__ ((unused)))
 	int ret = 0;
 	int cnt = 0;
 	unsigned int lcore_id = rte_lcore_id();
-	enum sppwk_lcore_status status = SPP_CORE_STOP;
+	enum sppwk_lcore_status status = SPPWK_LCORE_STOPPED;
 	struct core_mng_info *info = &g_core_info[lcore_id];
 	struct core_info *core = get_core_info(lcore_id);
 
 	RTE_LOG(INFO, APP, "Slave started on lcore %d.\n", lcore_id);
-	set_core_status(lcore_id, SPP_CORE_IDLE);
+	set_core_status(lcore_id, SPPWK_LCORE_IDLING);
 
 	while ((status = spp_get_core_status(lcore_id)) !=
-			SPP_CORE_STOP_REQUEST) {
-		if (status != SPP_CORE_FORWARD)
+			SPPWK_LCORE_REQ_STOP) {
+		if (status != SPPWK_LCORE_RUNNING)
 			continue;
 
 		if (spp_check_core_update(lcore_id) == SPP_RET_OK) {
@@ -182,7 +182,7 @@ slave_main(void *arg __attribute__ ((unused)))
 		}
 	}
 
-	set_core_status(lcore_id, SPP_CORE_STOP);
+	set_core_status(lcore_id, SPPWK_LCORE_STOPPED);
 	RTE_LOG(INFO, APP, "Terminated slave on lcore %d.\n", lcore_id);
 	return ret;
 }
@@ -271,13 +271,13 @@ main(int argc, char *argv[])
 
 		/* Set the status of main thread to idle */
 		master_lcore = rte_get_master_lcore();
-		g_core_info[master_lcore].status = SPP_CORE_IDLE;
-		int ret_wait = check_core_status_wait(SPP_CORE_IDLE);
+		g_core_info[master_lcore].status = SPPWK_LCORE_IDLING;
+		int ret_wait = check_core_status_wait(SPPWK_LCORE_IDLING);
 		if (unlikely(ret_wait != SPP_RET_OK))
 			break;
 
 		/* Start forwarding */
-		set_all_core_status(SPP_CORE_FORWARD);
+		set_all_core_status(SPPWK_LCORE_RUNNING);
 		RTE_LOG(INFO, APP, "My ID %d start handling message\n", 0);
 		RTE_LOG(INFO, APP, "[Press Ctrl-C to quit ...]\n");
 
@@ -288,7 +288,7 @@ main(int argc, char *argv[])
 		int ret_do = SPP_RET_OK;
 #ifndef USE_UT_SPP_VF
 		while (likely(g_core_info[master_lcore].status !=
-				SPP_CORE_STOP_REQUEST)) {
+				SPPWK_LCORE_REQ_STOP)) {
 #else
 		{
 #endif
@@ -308,7 +308,7 @@ main(int argc, char *argv[])
 		}
 
 		if (unlikely(ret_do != SPP_RET_OK)) {
-			set_all_core_status(SPP_CORE_STOP_REQUEST);
+			set_all_core_status(SPPWK_LCORE_REQ_STOP);
 			break;
 		}
 
@@ -317,8 +317,8 @@ main(int argc, char *argv[])
 	}
 
 	/* Finalize to exit */
-	g_core_info[master_lcore].status = SPP_CORE_STOP;
-	int ret_core_end = check_core_status_wait(SPP_CORE_STOP);
+	g_core_info[master_lcore].status = SPPWK_LCORE_STOPPED;
+	int ret_core_end = check_core_status_wait(SPPWK_LCORE_STOPPED);
 	if (unlikely(ret_core_end != SPP_RET_OK))
 		RTE_LOG(ERR, APP, "Failed to terminate master thread.\n");
 
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index d9adc48..f5854b0 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -137,9 +137,10 @@ update_comp(enum sppwk_action wk_action, const char *name,
 	switch (wk_action) {
 	case SPPWK_ACT_START:
 		info = (core_info + lcore_id);
-		if (info->status == SPP_CORE_UNUSE) {
-			RTE_LOG(ERR, VF_CMD_RUNNER, "Core %d is not available because "
-				"it is in SPP_CORE_UNUSE state.\n", lcore_id);
+		if (info->status == SPPWK_LCORE_UNUSED) {
+			RTE_LOG(ERR, VF_CMD_RUNNER,
+					"Not available lcore %d for %s.\n",
+					lcore_id, "SPPWK_LCORE_UNUSED");
 			return SPP_RET_NG;
 		}
 
@@ -436,7 +437,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
 	struct sppwk_comp_info *comp_info = NULL;
 
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
-		if (spp_get_core_status(lcore_id) == SPP_CORE_UNUSE)
+		if (spp_get_core_status(lcore_id) == SPPWK_LCORE_UNUSED)
 			continue;
 
 		core = get_core_info(lcore_id);
-- 
2.17.1


  reply	other threads:[~2019-06-26  5:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  5:36 [spp] [PATCH 0/2] Rename " yasufum.o
2019-06-26  5:36 ` yasufum.o [this message]
2019-06-26  5:36 ` [spp] [PATCH 2/2] spp_pcap: rename " yasufum.o

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=20190626053633.39963-2-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@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).