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 v2] shared/sec: rename enum spp_classifier_type
Date: Wed,  3 Jul 2019 17:37:35 +0900	[thread overview]
Message-ID: <20190703083735.1432-1-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190703074320.36403-1-yasufum.o@gmail.com>

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

This update is to refactor the name of enum `spp_classifier_type` and
its members to be more specific and short.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 .../secondary/spp_worker_th/cmd_parser.c       |  6 +++---
 .../secondary/spp_worker_th/cmd_parser.h       |  2 +-
 src/shared/secondary/spp_worker_th/cmd_utils.c |  2 +-
 src/shared/secondary/spp_worker_th/cmd_utils.h | 10 +++++-----
 src/shared/secondary/spp_worker_th/vf_deps.h   |  2 +-
 src/vf/classifier_mac.c                        | 14 +++++++-------
 src/vf/vf_cmd_runner.c                         | 18 +++++++++---------
 7 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index cd79bdb..931c53b 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -728,7 +728,7 @@ parse_cls_port(void *cls_cmd_attr, const char *arg_val,
 		return SPP_RET_NG;
 	}
 
-	if (cls_attrs->type == SPP_CLASSIFIER_TYPE_MAC)
+	if (cls_attrs->cls_type == SPPWK_CLS_TYPE_MAC)
 		cls_attrs->vid = ETH_VLAN_ID_MAX;
 
 	if (unlikely(cls_attrs->wk_action == SPPWK_ACT_ADD)) {
@@ -783,7 +783,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "type",
 			.offset = offsetof(struct sppwk_cmd_attrs,
-					spec.cls_table.type),
+					spec.cls_table.cls_type),
 			.func = parse_cls_type
 		},
 		{
@@ -810,7 +810,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "type",
 			.offset = offsetof(struct sppwk_cmd_attrs,
-					spec.cls_table.type),
+					spec.cls_table.cls_type),
 			.func = parse_cls_type
 		},
 		{
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h
index d50e3a6..b124dc1 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.h
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.h
@@ -80,7 +80,7 @@ const char *sppwk_cmd_type_str(enum sppwk_cmd_type ctype);
 /* `classifier_table` command specific parameters. */
 struct sppwk_cls_cmd_attrs {
 	enum sppwk_action wk_action;  /**< add or del */
-	enum spp_classifier_type type;  /**< currently only for mac */
+	enum sppwk_cls_type cls_type;  /**< currently only for MAC. */
 	int vid;  /**< VLAN ID  */
 	char mac[SPPWK_VAL_BUFSZ];  /**< MAC address  */
 	struct sppwk_port_idx port;/**< Destination port type and number */
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 6f93400..6072186 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -69,7 +69,7 @@ log_hexdumped(const char *obj_name, const void *obj_addr, const size_t size)
 	}
 }
 
-/* Get core status */
+/* Get status of lcore of given ID. */
 enum sppwk_lcore_status
 spp_get_core_status(unsigned int lcore_id)
 {
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 87c9b2c..a935312 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -93,10 +93,10 @@ enum sppwk_worker_type {
 };
 
 /* Classifier Type */
-enum spp_classifier_type {
-	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
-	SPP_CLASSIFIER_TYPE_MAC,  /**< MAC address */
-	SPP_CLASSIFIER_TYPE_VLAN  /**< VLAN ID */
+enum sppwk_cls_type {
+	SPPWK_CLS_TYPE_NONE,
+	SPPWK_CLS_TYPE_MAC,
+	SPPWK_CLS_TYPE_VLAN
 };
 
 /* Direction of RX or TX on a port. */
@@ -258,7 +258,7 @@ struct spp_iterate_classifier_table_params;
  */
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
-		enum spp_classifier_type type,
+		enum sppwk_cls_type cls_type,
 		int vid, const char *mac,
 		const struct sppwk_port_idx *port);
 
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index fd3c201..83ddf09 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -108,7 +108,7 @@ int update_comp_info(struct sppwk_comp_info *p_comp_info, int *p_change_comp);
 
 int append_classifier_element_value(
 		struct spp_iterate_classifier_table_params *params,
-		enum spp_classifier_type type,
+		enum sppwk_cls_type cls_type,
 		int vid, const char *mac,
 		const struct sppwk_port_idx *port);
 
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index c7873e3..9c4bedf 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -878,11 +878,11 @@ iterate_adding_mac_entry(
 	uint32_t next;
 	struct sppwk_port_idx port;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	enum spp_classifier_type type;
+	enum sppwk_cls_type cls_type;
 
-	type = SPP_CLASSIFIER_TYPE_VLAN;
+	cls_type = SPPWK_CLS_TYPE_VLAN;
 	if (unlikely(vid == VLAN_UNTAGGED_VID))
-		type = SPP_CLASSIFIER_TYPE_MAC;
+		cls_type = SPPWK_CLS_TYPE_MAC;
 
 	if (mac_cls->default_cls_idx >= 0) {
 		port.iface_type = (port_info +
@@ -897,8 +897,8 @@ iterate_adding_mac_entry(
 		 * Append "default" entry. `element_proc` is a funciton
 		 * pointer to append_classifier_element_value().
 		 */
-		(*params->element_proc)(params, type, vid, SPPWK_TERM_DEFAULT,
-				&port);
+		(*params->element_proc)(params, cls_type, vid,
+				SPPWK_TERM_DEFAULT, &port);
 	}
 
 	next = 0;
@@ -920,8 +920,8 @@ iterate_adding_mac_entry(
 		 * Append each entry of MAC address. `element_proc` is a
 		 * funciton pointer to append_classifier_element_value().
 		 */
-		(*params->element_proc)(params, type, vid, mac_addr_str,
-				&port);
+		(*params->element_proc)(params, cls_type, vid,
+				mac_addr_str, &port);
 	}
 }
 
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index f5854b0..72e7b97 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -28,7 +28,7 @@ const char *CLS_TYPE_A_LIST[] = {
 /* Update classifier table with given action, add or del. */
 static int
 update_cls_table(enum sppwk_action wk_action,
-		enum spp_classifier_type type __attribute__ ((unused)),
+		enum sppwk_cls_type cls_type __attribute__ ((unused)),
 		int vid, const char *mac_str,
 		const struct sppwk_port_idx *port)
 {
@@ -383,7 +383,7 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd)
 	case SPPWK_CMDTYPE_CLS_MAC:
 	case SPPWK_CMDTYPE_CLS_VLAN:
 		ret = update_cls_table(cmd->spec.cls_table.wk_action,
-				cmd->spec.cls_table.type,
+				cmd->spec.cls_table.cls_type,
 				cmd->spec.cls_table.vid,
 				cmd->spec.cls_table.mac,
 				&cmd->spec.cls_table.port);
@@ -555,7 +555,7 @@ update_comp_info(struct sppwk_comp_info *p_comp_info, int *p_change_comp)
 int
 append_classifier_element_value(
 		struct spp_iterate_classifier_table_params *params,
-		enum spp_classifier_type type,
+		enum sppwk_cls_type cls_type,
 		int vid, const char *mac,
 		const struct sppwk_port_idx *port)
 {
@@ -567,23 +567,23 @@ append_classifier_element_value(
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
 		RTE_LOG(ERR, VF_CMD_RUNNER,
-				/* TODO(yasufum) refactor no meaning err msg */
-				"allocate error. (name = classifier_table)\n");
+				"Failed to allocate buffer.\n");
 		return ret;
 	}
 
 	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
-	ret = append_json_str_value(&tmp_buff, "type", CLS_TYPE_A_LIST[type]);
+	ret = append_json_str_value(&tmp_buff, "type",
+			CLS_TYPE_A_LIST[cls_type]);
 	if (unlikely(ret < SPP_RET_OK))
 		return ret;
 
 	memset(value_str, 0x00, STR_LEN_SHORT);
-	switch (type) {
-	case SPP_CLASSIFIER_TYPE_MAC:
+	switch (cls_type) {
+	case SPPWK_CLS_TYPE_MAC:
 		sprintf(value_str, "%s", mac);
 		break;
-	case SPP_CLASSIFIER_TYPE_VLAN:
+	case SPPWK_CLS_TYPE_VLAN:
 		sprintf(value_str, "%d/%s", vid, mac);
 		break;
 	default:
-- 
2.17.1


           reply	other threads:[~2019-07-03  8:37 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20190703074320.36403-1-yasufum.o@gmail.com>]

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=20190703083735.1432-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
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).