From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 2/2] spp_pcap: rename members of sppwk_lcore_status
Date: Wed, 26 Jun 2019 14:36:33 +0900 [thread overview]
Message-ID: <20190626053633.39963-3-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190626053633.39963-1-yasufum.o@gmail.com>
From: Yasufumi Ogawa <yasufum.o@gmail.com>
As same as previous update, this patch 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/pcap/cmd_runner.c | 2 +-
src/pcap/cmd_utils.c | 6 +++---
src/pcap/cmd_utils.h | 18 ++++++++---------
src/pcap/spp_pcap.c | 20 +++++++++----------
.../secondary/spp_worker_th/cmd_utils.h | 2 +-
5 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c
index 48e8eba..5754841 100644
--- a/src/pcap/cmd_runner.c
+++ b/src/pcap/cmd_runner.c
@@ -71,7 +71,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
int lcore_id;
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- if (sppwk_get_lcore_status(lcore_id) == SPP_CORE_UNUSE)
+ if (sppwk_get_lcore_status(lcore_id) == SPPWK_LCORE_UNUSED)
continue;
ret = spp_pcap_get_core_status(lcore_id, params);
diff --git a/src/pcap/cmd_utils.c b/src/pcap/cmd_utils.c
index 66e6d05..69f0fa0 100644
--- a/src/pcap/cmd_utils.c
+++ b/src/pcap/cmd_utils.c
@@ -138,8 +138,8 @@ stop_process(int signal)
master_lcore = rte_get_master_lcore();
(g_mng_data_addr.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);
}
/**
@@ -194,7 +194,7 @@ init_core_info(void)
struct core_mng_info *p_core_info = g_mng_data_addr.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);
*g_mng_data_addr.p_capture_request = SPP_CAPTURE_IDLE;
*g_mng_data_addr.p_capture_status = SPP_CAPTURE_IDLE;
}
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index 9b7ae52..1b757f5 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -12,10 +12,9 @@
#define _SPPWK_CMD_UTILS_H_
/**
- * @file
- * SPP process
+ * @file cmd_utils.h
*
- * SPP component common function.
+ * Command utility functions for SPP worker thread.
*/
#include <netinet/in.h>
@@ -34,14 +33,13 @@
#define SPP_CORE_STATUS_CHECK_MAX 5
/* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
-/* State on core */
+/* 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 for stopping. */
};
/* State on capture */
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index 6762337..80e6aad 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -860,10 +860,10 @@ slave_main(void *arg __attribute__ ((unused)))
pcap_info->thread_no, lcore_id);
pcap_info->type = PCAP_WRITE;
}
- set_core_status(lcore_id, SPP_CORE_IDLE);
+ set_core_status(lcore_id, SPPWK_LCORE_IDLING);
while (1) {
- if (sppwk_get_lcore_status(lcore_id) == SPP_CORE_STOP_REQUEST) {
+ if (sppwk_get_lcore_status(lcore_id) == SPPWK_LCORE_REQ_STOP) {
if (pcap_info->status == SPP_CAPTURE_IDLE)
break;
if (pcap_info->type == PCAP_RECEIVE)
@@ -882,7 +882,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, SPP_PCAP,
"Terminated slave on lcore %d.\n", lcore_id);
return ret;
@@ -1024,19 +1024,19 @@ 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 != 0))
break;
/* Start secondary */
- set_all_core_status(SPP_CORE_FORWARD);
+ set_all_core_status(SPPWK_LCORE_RUNNING);
RTE_LOG(INFO, SPP_PCAP, "[Press Ctrl-C to quit ...]\n");
/* Enter loop for accepting commands */
int ret_do = 0;
while (likely(g_core_info[master_lcore].status !=
- SPP_CORE_STOP_REQUEST)) {
+ SPPWK_LCORE_REQ_STOP)) {
/* Receive command */
ret_do = spp_command_proc_do();
if (unlikely(ret_do != SPPWK_RET_OK))
@@ -1049,7 +1049,7 @@ main(int argc, char *argv[])
}
if (unlikely(ret_do != SPPWK_RET_OK)) {
- set_all_core_status(SPP_CORE_STOP_REQUEST);
+ set_all_core_status(SPPWK_LCORE_REQ_STOP);
break;
}
@@ -1058,8 +1058,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, SPP_PCAP, "Failed to terminate master thread.\n");
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 596ba5e..87c9b2c 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -80,7 +80,7 @@ enum sppwk_lcore_status {
SPPWK_LCORE_STOPPED,
SPPWK_LCORE_IDLING,
SPPWK_LCORE_RUNNING,
- SPPWK_LCORE_REQ_STOP /**< Request stopping */
+ SPPWK_LCORE_REQ_STOP /**< Request for stopping. */
};
/* Type of SPP worker thread. */
--
2.17.1
prev parent 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 ` [spp] [PATCH 1/2] shared/sec: rename " yasufum.o
2019-06-26 5:36 ` yasufum.o [this message]
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-3-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).