summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasufumi Ogawa <yasufum.o@gmail.com>2019-09-12 20:40:25 +0900
committerYasufumi Ogawa <yasufum.o@gmail.com>2019-10-04 22:06:14 +0900
commit293cbf1932c74db60c6b1ccc0fc99356433e6cd8 (patch)
treee7e46ad2be3224f2e0b5a57cba665012735cef5f
parentf60d0f362828e6aac4ec2dfb6736fef89c4867ae (diff)
downloadspp-293cbf1932c74db60c6b1ccc0fc99356433e6cd8.zip
spp-293cbf1932c74db60c6b1ccc0fc99356433e6cd8.tar.gz
spp-293cbf1932c74db60c6b1ccc0fc99356433e6cd8.tar.xz
shared: refactor func spp_check_core_update
spp_check_core_update() is used for inspecting lcore information of given ID is updated or not. If it is not updated, it returns SPP_RET_NG. However, it is not appropriate NG for the case just made no changed. This update is to change to return 0 if info is not changed, or 1. Name of function is also changed to sppwk_is_lcore_updated() to be more specific for the usage. Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
-rw-r--r--src/mirror/spp_mirror.c2
-rw-r--r--src/shared/secondary/spp_worker_th/cmd_utils.c8
-rw-r--r--src/shared/secondary/spp_worker_th/cmd_utils.h8
3 files changed, 9 insertions, 9 deletions
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 4f0820d..e5852aa 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -457,7 +457,7 @@ slave_main(void *arg __attribute__ ((unused)))
if (status != SPPWK_LCORE_RUNNING)
continue;
- if (spp_check_core_update(lcore_id) == SPPWK_RET_OK) {
+ if (sppwk_is_lcore_updated(lcore_id) == 1) {
/* Setting with the flush command trigger. */
info->ref_index = (info->upd_index+1) % TWO_SIDES;
core = get_core_info(lcore_id);
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 58db631..1606d4f 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -506,15 +506,15 @@ get_core_info(unsigned int lcore_id)
return &(info->core[info->ref_index]);
}
-/* Check core index change */
+/* Check lcore info of given ID is updated */
int
-spp_check_core_update(unsigned int lcore_id)
+sppwk_is_lcore_updated(unsigned int lcore_id)
{
struct core_mng_info *info = (g_mng_data.p_core_info + lcore_id);
if (info->ref_index == info->upd_index)
- return SPPWK_RET_OK;
+ return 1;
else
- return SPPWK_RET_NG;
+ return 0;
}
/* Check if component is using port. */
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 4e2f888..db12e75 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -208,13 +208,13 @@ void del_vhost_sockfile(struct sppwk_port_info *vhost);
struct core_info *get_core_info(unsigned int lcore_id);
/**
- * Check core index change
+ * Check lcore info of given ID is updated.
*
* @param lcore_id Lcore ID.
- * @retval SPPWK_RET_OK If index is updated.
- * @retval SPPWK_RET_NG If index is not updated.
+ * @retval 1 If it is updated.
+ * @retval 0 If it is not updated.
*/
-int spp_check_core_update(unsigned int lcore_id);
+int sppwk_is_lcore_updated(unsigned int lcore_id);
/**
* Check if component is using port.