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 08/11] shared/sec: refactor updating classifier info
Date: Mon, 24 Jun 2019 11:25:01 +0900	[thread overview]
Message-ID: <20190624022504.18752-9-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624022504.18752-1-yasufum.o@gmail.com>

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

Rename spp_classifier_mac_update() to update_classifier(), and revise
names of vars and log messages in the function for refactoring.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 .../secondary/spp_worker_th/cmd_utils.c       |  2 +-
 src/shared/secondary/spp_worker_th/vf_deps.h  |  2 +-
 src/vf/classifier_mac.c                       | 23 ++++++++++---------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index ae6be1a..d5faa35 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -891,7 +891,7 @@ update_comp_info(void)
 
 #ifdef SPP_VF_MODULE
 		if (comp_info->wk_type == SPPWK_TYPE_CLS)
-			ret = spp_classifier_mac_update(comp_info);
+			ret = update_classifier(comp_info);
 		else
 			ret = spp_forward_update(comp_info);
 #endif /* SPP_VF_MODULE */
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index 9b59b3d..8d3cd81 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -60,7 +60,7 @@ free_mac_classifier(struct mac_classifier *mac_clf)
  * @retval SPP_RET_OK If succeeded.
  * @retval SPP_RET_NG If failed.
  */
-int spp_classifier_mac_update(struct sppwk_comp_info *comp_info);
+int update_classifier(struct sppwk_comp_info *comp_info);
 
 /**
  * Update forwarder info.
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 232ed19..f6074e4 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -695,26 +695,27 @@ spp_classifier_mac_init(void)
 
 /* classifier(mac address) update component info. */
 int
-spp_classifier_mac_update(struct sppwk_comp_info *wk_comp_info)
+update_classifier(struct sppwk_comp_info *wk_comp_info)
 {
-	int ret = SPP_RET_NG;
-	int id = wk_comp_info->comp_id;
-	struct management_info *mng_info = g_mng_infos + id;
-	struct cls_comp_info *cmp_info = NULL;
+	int ret;
+	int wk_id = wk_comp_info->comp_id;
+	struct management_info *mng_info = g_mng_infos + wk_id;
+	struct cls_comp_info *cls_info = NULL;
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
-			"Component[%u] Start update component.\n", id);
+			"Start updating classifier, id=%u.\n", wk_id);
 
-	cmp_info = mng_info->cmp_infos + mng_info->upd_index;
+	/* TODO(yasufum) rename `infos`. */
+	cls_info = mng_info->cmp_infos + mng_info->upd_index;
 
 	/* initialize update side classifier information */
-	ret = init_component_info(cmp_info, wk_comp_info);
+	ret = init_component_info(cls_info, wk_comp_info);
 	if (unlikely(ret != SPP_RET_OK)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-				"Cannot update classifier mac. ret=%d\n", ret);
+				"Cannot update classifier, ret=%d.\n", ret);
 		return ret;
 	}
-	memcpy(cmp_info->name, wk_comp_info->name, STR_LEN_NAME);
+	memcpy(cls_info->name, wk_comp_info->name, STR_LEN_NAME);
 
 	/* change index of reference side */
 	mng_info->upd_index = mng_info->ref_index;
@@ -729,7 +730,7 @@ spp_classifier_mac_update(struct sppwk_comp_info *wk_comp_info)
 	uninit_component_info(mng_info->cmp_infos + mng_info->upd_index);
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
-			"Component[%u] Complete update component.\n", id);
+			"Done update classifier, id=%u.\n", wk_id);
 
 	return SPP_RET_OK;
 }
-- 
2.17.1


  parent reply	other threads:[~2019-06-24  2:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  2:24 [spp] [PATCH 00/11] Refactor libs for classifier in spp_vf yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 01/11] shared/sec: refactor defines of VLAN " yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 02/11] shared/sec: rename struct mac_classification yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 03/11] shared/sec: refactor comments in vf_deps.h yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 04/11] shared/sec: rename struct classified_data yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 05/11] shared/sec: revise usage of term component_info yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 06/11] shared/sec: revise members of struct cls_port_info yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 07/11] shared/sec: rename func free_mac_classification yasufum.o
2019-06-24  2:25 ` yasufum.o [this message]
2019-06-24  2:25 ` [spp] [PATCH 09/11] shared/sec: refactor updating forwarder yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 10/11] shared/sec: refactor getting classifier status yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 11/11] shared/sec: refactor setup cls table stat in JSON 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=20190624022504.18752-9-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).