Soft Patch Panel
 help / color / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] shared: refactor func spp_check_core_update
Date: Thu, 12 Sep 2019 20:40:25 +0900
Message-ID: <20190912114025.12531-1-yasufum.o@gmail.com> (raw)

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

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>
---
 src/mirror/spp_mirror.c                        | 2 +-
 src/shared/secondary/spp_worker_th/cmd_utils.c | 8 ++++----
 src/shared/secondary/spp_worker_th/cmd_utils.h | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index a6bad3a..440c780 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.
-- 
2.17.1


                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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=20190912114025.12531-1-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

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox