Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH] shared/sec: rename members of enum sppwk_port_ops
@ 2019-07-01  4:11 yasufum.o
  0 siblings, 0 replies; only message in thread
From: yasufum.o @ 2019-07-01  4:11 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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

Name of Members of enum `sppwk_port_ops` such as
`SPPWK_PORT_ABL_OPS_ADD_VLANTAG` or `SPPWK_PORT_ABL_OPS_DEL_VLANTAG`
are too long. It is enough, for example `SPPWK_PORT_OPS_ADD_VLAN` or
so.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/mirror/mir_cmd_runner.c                            | 10 +++++-----
 src/pcap/cmd_utils.h                                   |  6 +++---
 src/shared/secondary/spp_worker_th/cmd_parser.c        |  8 ++++----
 src/shared/secondary/spp_worker_th/cmd_res_formatter.c |  6 +++---
 src/shared/secondary/spp_worker_th/cmd_utils.h         |  6 +++---
 src/shared/secondary/spp_worker_th/spp_port.c          |  8 ++++----
 src/vf/vf_cmd_runner.c                                 | 10 +++++-----
 7 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/mirror/mir_cmd_runner.c b/src/mirror/mir_cmd_runner.c
index 307b3f6..2f63f77 100644
--- a/src/mirror/mir_cmd_runner.c
+++ b/src/mirror/mir_cmd_runner.c
@@ -176,10 +176,10 @@ update_port(enum sppwk_action wk_action,
 		if (port_idx >= SPP_RET_OK) {
 			/* registered */
 			/* TODO(yasufum) confirm it is needed for spp_mirror. */
-			if (port_attrs->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
+			if (port_attrs->ops == SPPWK_PORT_OPS_ADD_VLAN) {
 				while ((cnt < PORT_ABL_MAX) &&
 					    (port_info->port_attrs[cnt].ops !=
-					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
+					    SPPWK_PORT_OPS_ADD_VLAN))
 					cnt++;
 				if (cnt >= PORT_ABL_MAX) {
 					RTE_LOG(ERR, MIR_CMD_RUNNER, "update VLAN tag "
@@ -201,10 +201,10 @@ update_port(enum sppwk_action wk_action,
 			return SPP_RET_NG;
 		}
 
-		if (port_attrs->ops != SPPWK_PORT_ABL_OPS_NONE) {
+		if (port_attrs->ops != SPPWK_PORT_OPS_NONE) {
 			while ((cnt < PORT_ABL_MAX) &&
 					(port_info->port_attrs[cnt].ops !=
-					SPPWK_PORT_ABL_OPS_NONE)) {
+					SPPWK_PORT_OPS_NONE)) {
 				cnt++;
 			}
 			if (cnt >= PORT_ABL_MAX) {
@@ -226,7 +226,7 @@ update_port(enum sppwk_action wk_action,
 	case SPPWK_ACT_DEL:
 		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
 			if (port_info->port_attrs[cnt].ops ==
-					SPPWK_PORT_ABL_OPS_NONE)
+					SPPWK_PORT_OPS_NONE)
 				continue;
 
 			if (port_info->port_attrs[cnt].dir == dir)
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index e3714a5..f2cb9ef 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -76,9 +76,9 @@ enum sppwk_worker_type {
  * (e.g. add vlan tag or delete vlan tag)
  */
 enum sppwk_port_ops {
-	SPPWK_PORT_ABL_OPS_NONE,
-	SPPWK_PORT_ABL_OPS_ADD_VLANTAG,
-	SPPWK_PORT_ABL_OPS_DEL_VLANTAG,
+	SPPWK_PORT_OPS_NONE,
+	SPPWK_PORT_OPS_ADD_VLAN,  /* Add vlan tag. */
+	SPPWK_PORT_OPS_DEL_VLAN,  /* Delete vlan tag. */
 };
 
 /* getopt_long return value for long option */
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 7933ed2..84de7e4 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -543,7 +543,7 @@ parse_port_vlan_ops(void *output, const char *arg_val,
 	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
 	switch (port_attrs->ops) {
-	case SPPWK_PORT_ABL_OPS_NONE:
+	case SPPWK_PORT_OPS_NONE:
 		ret = get_list_idx(arg_val, PORT_ABILITY_LIST);
 		if (unlikely(ret <= 0)) {
 			RTE_LOG(ERR, WK_CMD_PARSER,
@@ -554,7 +554,7 @@ parse_port_vlan_ops(void *output, const char *arg_val,
 		port_attrs->ops = ret;
 		port_attrs->dir = port->dir;
 		break;
-	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
+	case SPPWK_PORT_OPS_ADD_VLAN:
 		/* Nothing to do. */
 		break;
 	default:
@@ -575,7 +575,7 @@ parse_port_vid(void *output, const char *arg_val,
 	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
 	switch (port_attrs->ops) {
-	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
+	case SPPWK_PORT_OPS_ADD_VLAN:
 		vlan_id = get_int_in_range(&port_attrs->capability.vlantag.vid,
 			arg_val, 0, ETH_VLAN_ID_MAX);
 		if (unlikely(vlan_id < SPP_RET_OK)) {
@@ -604,7 +604,7 @@ parse_port_pcp(void *output, const char *arg_val,
 	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
 	switch (port_attrs->ops) {
-	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
+	case SPPWK_PORT_OPS_ADD_VLAN:
 		pcp = get_int_in_range(&port_attrs->capability.vlantag.pcp,
 				arg_val, 0, SPP_VLAN_PCP_MAX);
 		if (unlikely(pcp < SPP_RET_OK)) {
diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
index c18f8e5..73ef4c2 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
@@ -157,8 +157,8 @@ append_vlan_block(const char *name, char **output,
 	spp_port_ability_get_info(port_id, dir, &port_attrs);
 	for (i = 0; i < PORT_ABL_MAX; i++) {
 		switch (port_attrs[i].ops) {
-		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
-		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
+		case SPPWK_PORT_OPS_ADD_VLAN:
+		case SPPWK_PORT_OPS_DEL_VLAN:
 			ret = append_vlan_value(&tmp_buff, port_attrs[i].ops,
 					port_attrs[i].capability.vlantag.vid,
 					port_attrs[i].capability.vlantag.pcp);
@@ -178,7 +178,7 @@ append_vlan_block(const char *name, char **output,
 		}
 	}
 	if (i == PORT_ABL_MAX) {
-		ret = append_vlan_value(&tmp_buff, SPPWK_PORT_ABL_OPS_NONE,
+		ret = append_vlan_value(&tmp_buff, SPPWK_PORT_OPS_NONE,
 				0, 0);
 		if (unlikely(ret < SPP_RET_OK))
 			return SPP_RET_NG;
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 69e0a69..1d32228 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -113,9 +113,9 @@ enum sppwk_port_dir {
  * (e.g. add vlan tag or delete vlan tag)
  */
 enum sppwk_port_ops {
-	SPPWK_PORT_ABL_OPS_NONE,
-	SPPWK_PORT_ABL_OPS_ADD_VLANTAG,
-	SPPWK_PORT_ABL_OPS_DEL_VLANTAG,
+	SPPWK_PORT_OPS_NONE,
+	SPPWK_PORT_OPS_ADD_VLAN,  /* Add vlan tag. */
+	SPPWK_PORT_OPS_DEL_VLAN,  /* Delete vlan tag. */
 };
 
 /* getopt_long return value for long option */
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index cc87200..6fe0dc5 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -276,12 +276,12 @@ port_ability_set_ability(struct sppwk_port_info *port,
 				sizeof(struct sppwk_port_attrs));
 
 		switch (port_attrs_out[out_cnt].ops) {
-		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
+		case SPPWK_PORT_OPS_ADD_VLAN:
 			tag = &port_attrs_out[out_cnt].capability.vlantag;
 			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
 					tag->vid, tag->pcp));
 			break;
-		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
+		case SPPWK_PORT_OPS_DEL_VLAN:
 		default:
 			/* Nothing to do. */
 			break;
@@ -335,11 +335,11 @@ port_ability_each_operation(uint16_t port_id,
 	struct sppwk_port_attrs *port_attrs = NULL;
 
 	spp_port_ability_get_info(port_id, dir, &port_attrs);
-	if (unlikely(port_attrs[0].ops == SPPWK_PORT_ABL_OPS_NONE))
+	if (unlikely(port_attrs[0].ops == SPPWK_PORT_OPS_NONE))
 		return nb_pkts;
 
 	for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
-		if (port_attrs[cnt].ops == SPPWK_PORT_ABL_OPS_NONE)
+		if (port_attrs[cnt].ops == SPPWK_PORT_OPS_NONE)
 			break;
 
 		ok_pkts = port_ability_function_list[port_attrs[cnt].ops](
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index e9388e0..fe37a19 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -297,10 +297,10 @@ update_port(enum sppwk_action wk_action,
 		port_idx = get_idx_port_info(port_info, *nof_ports, ports);
 		if (port_idx >= SPP_RET_OK) {
 			/* registered */
-			if (port_attrs->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
+			if (port_attrs->ops == SPPWK_PORT_OPS_ADD_VLAN) {
 				while ((cnt < PORT_ABL_MAX) &&
 					    (port_info->port_attrs[cnt].ops !=
-					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
+					    SPPWK_PORT_OPS_ADD_VLAN))
 					cnt++;
 				if (cnt >= PORT_ABL_MAX) {
 					RTE_LOG(ERR, VF_CMD_RUNNER, "update VLAN tag "
@@ -322,10 +322,10 @@ update_port(enum sppwk_action wk_action,
 			return SPP_RET_NG;
 		}
 
-		if (port_attrs->ops != SPPWK_PORT_ABL_OPS_NONE) {
+		if (port_attrs->ops != SPPWK_PORT_OPS_NONE) {
 			while ((cnt < PORT_ABL_MAX) &&
 					(port_info->port_attrs[cnt].ops !=
-					SPPWK_PORT_ABL_OPS_NONE)) {
+					SPPWK_PORT_OPS_NONE)) {
 				cnt++;
 			}
 			if (cnt >= PORT_ABL_MAX) {
@@ -347,7 +347,7 @@ update_port(enum sppwk_action wk_action,
 	case SPPWK_ACT_DEL:
 		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
 			if (port_info->port_attrs[cnt].ops ==
-					SPPWK_PORT_ABL_OPS_NONE)
+					SPPWK_PORT_OPS_NONE)
 				continue;
 
 			if (port_info->port_attrs[cnt].dir == dir)
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01  4:11 [spp] [PATCH] shared/sec: rename members of enum sppwk_port_ops yasufum.o

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