Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 4/8] shared/sec: rename parsing vlan operations
Date: Tue, 21 May 2019 11:32:20 +0900	[thread overview]
Message-ID: <1558405944-8355-5-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1558405944-8355-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to rename `decode_port_vlan_operation()` to
`parse_port_vlan_ops()`, and enum `spp_port_ability_ope` to
`sppwk_port_abl_ops` and its members to be more specific.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 .../secondary/spp_worker_th/cmd_parser.c      | 28 ++++++++++---------
 .../secondary/spp_worker_th/command_proc.c    | 26 ++++++++---------
 src/shared/secondary/spp_worker_th/spp_port.c | 12 ++++----
 src/shared/secondary/spp_worker_th/spp_proc.h | 14 +++++-----
 4 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 0c65018..7f678d5 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -506,17 +506,19 @@ parse_comp_name_portcmd(void *output, const char *arg_val,
 	return SPP_RET_OK;
 }
 
-/* decoding procedure of vlan operation for port command */
+/* Parse vlan operation for port command. */
+/* TODO(yasufum) add desc for how to be used. */
+/* TODO(yasufum) add desc for what is port ability. */
 static int
-decode_port_vlan_operation(void *output, const char *arg_val,
-				int allow_override __attribute__ ((unused)))
+parse_port_vlan_ops(void *output, const char *arg_val,
+		int allow_override __attribute__ ((unused)))
 {
-	int ret = SPP_RET_OK;
+	int ret;
 	struct sppwk_cmd_port *port = output;
 	struct spp_port_ability *ability = &port->ability;
 
-	switch (ability->ope) {
-	case SPP_PORT_ABILITY_OPE_NONE:
+	switch (ability->ops) {
+	case SPPWK_PORT_ABL_OPS_NONE:
 		ret = get_list_idx(arg_val, PORT_ABILITY_LIST);
 		if (unlikely(ret <= 0)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -524,10 +526,10 @@ decode_port_vlan_operation(void *output, const char *arg_val,
 					arg_val);
 			return SPP_RET_NG;
 		}
-		ability->ope  = ret;
+		ability->ops  = ret;
 		ability->rxtx = port->rxtx;
 		break;
-	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		/* Nothing to do. */
 		break;
 	default:
@@ -547,8 +549,8 @@ decode_port_vid(void *output, const char *arg_val,
 	struct sppwk_cmd_port *port = output;
 	struct spp_port_ability *ability = &port->ability;
 
-	switch (ability->ope) {
-	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+	switch (ability->ops) {
+	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		ret = get_int_in_range(&ability->data.vlantag.vid,
 			arg_val, 0, ETH_VLAN_ID_MAX);
 		if (unlikely(ret < SPP_RET_OK)) {
@@ -575,8 +577,8 @@ decode_port_pcp(void *output, const char *arg_val,
 	struct sppwk_cmd_port *port = output;
 	struct spp_port_ability *ability = &port->ability;
 
-	switch (ability->ope) {
-	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+	switch (ability->ops) {
+	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		ret = get_int_in_range(&ability->data.vlantag.pcp,
 				arg_val, 0, SPP_VLAN_PCP_MAX);
 		if (unlikely(ret < SPP_RET_OK)) {
@@ -850,7 +852,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "port vlan operation",
 			.offset = offsetof(struct spp_command, spec.port),
-			.func = decode_port_vlan_operation
+			.func = parse_port_vlan_ops
 		},
 		{
 			.name = "port vid",
diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index 19f96d7..fbc0c90 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -411,10 +411,10 @@ spp_update_port(enum sppwk_action wk_action,
 		/* Check whether a port has been already registered. */
 		if (ret_check >= SPP_RET_OK) {
 			/* registered */
-			if (ability->ope == SPP_PORT_ABILITY_OPE_ADD_VLANTAG) {
+			if (ability->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
 				while ((cnt < SPP_PORT_ABILITY_MAX) &&
-					    (port_info->ability[cnt].ope !=
-					    SPP_PORT_ABILITY_OPE_ADD_VLANTAG))
+					    (port_info->ability[cnt].ops !=
+					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
 					cnt++;
 				if (cnt >= SPP_PORT_ABILITY_MAX) {
 					RTE_LOG(ERR, APP, "update VLAN tag "
@@ -436,10 +436,10 @@ spp_update_port(enum sppwk_action wk_action,
 			return SPP_RET_NG;
 		}
 
-		if (ability->ope != SPP_PORT_ABILITY_OPE_NONE) {
+		if (ability->ops != SPPWK_PORT_ABL_OPS_NONE) {
 			while ((cnt < SPP_PORT_ABILITY_MAX) &&
-					(port_info->ability[cnt].ope !=
-					SPP_PORT_ABILITY_OPE_NONE)) {
+					(port_info->ability[cnt].ops !=
+					SPPWK_PORT_ABL_OPS_NONE)) {
 				cnt++;
 			}
 			if (cnt >= SPP_PORT_ABILITY_MAX) {
@@ -460,8 +460,8 @@ spp_update_port(enum sppwk_action wk_action,
 
 	case SPPWK_ACT_DEL:
 		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
-			if (port_info->ability[cnt].ope ==
-					SPP_PORT_ABILITY_OPE_NONE)
+			if (port_info->ability[cnt].ops ==
+					SPPWK_PORT_ABL_OPS_NONE)
 				continue;
 
 			if (port_info->ability[cnt].rxtx == rxtx)
@@ -1045,10 +1045,10 @@ append_vlan_block(const char *name, char **output,
 
 	spp_port_ability_get_info(port_id, rxtx, &info);
 	for (i = 0; i < SPP_PORT_ABILITY_MAX; i++) {
-		switch (info[i].ope) {
-		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
-		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
-			ret = append_vlan_value(&tmp_buff, info[i].ope,
+		switch (info[i].ops) {
+		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
+		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
+			ret = append_vlan_value(&tmp_buff, info[i].ops,
 					info[i].data.vlantag.vid,
 					info[i].data.vlantag.pcp);
 			if (unlikely(ret < SPP_RET_OK))
@@ -1067,7 +1067,7 @@ append_vlan_block(const char *name, char **output,
 		}
 	}
 	if (i == SPP_PORT_ABILITY_MAX) {
-		ret = append_vlan_value(&tmp_buff, SPP_PORT_ABILITY_OPE_NONE,
+		ret = append_vlan_value(&tmp_buff, SPPWK_PORT_ABL_OPS_NONE,
 				0, 0);
 		if (unlikely(ret < SPP_RET_OK))
 			return SPP_RET_NG;
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index 9c0e109..5b02d90 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -284,13 +284,13 @@ port_ability_set_ability(
 		memcpy(&out_ability[out_cnt], &in_ability[in_cnt],
 				sizeof(struct spp_port_ability));
 
-		switch (out_ability[out_cnt].ope) {
-		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		switch (out_ability[out_cnt].ops) {
+		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 			tag = &out_ability[out_cnt].data.vlantag;
 			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
 					tag->vid, tag->pcp));
 			break;
-		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
 		default:
 			/* Nothing to do. */
 			break;
@@ -344,14 +344,14 @@ port_ability_each_operation(uint16_t port_id,
 	struct spp_port_ability *info = NULL;
 
 	spp_port_ability_get_info(port_id, rxtx, &info);
-	if (unlikely(info[0].ope == SPP_PORT_ABILITY_OPE_NONE))
+	if (unlikely(info[0].ops == SPPWK_PORT_ABL_OPS_NONE))
 		return nb_pkts;
 
 	for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
-		if (info[cnt].ope == SPP_PORT_ABILITY_OPE_NONE)
+		if (info[cnt].ops == SPPWK_PORT_ABL_OPS_NONE)
 			break;
 
-		ok_pkts = port_ability_function_list[info[cnt].ope](
+		ok_pkts = port_ability_function_list[info[cnt].ops](
 				pkts, ok_pkts, &info->data);
 	}
 
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.h b/src/shared/secondary/spp_worker_th/spp_proc.h
index 8f9f11d..ffd8972 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.h
+++ b/src/shared/secondary/spp_worker_th/spp_proc.h
@@ -123,10 +123,10 @@ enum spp_port_rxtx {
  * Port ability operation which indicates vlan tag operation on the port
  * (e.g. add vlan tag or delete vlan tag)
  */
-enum spp_port_ability_ope {
-	SPP_PORT_ABILITY_OPE_NONE,	  /**< none */
-	SPP_PORT_ABILITY_OPE_ADD_VLANTAG, /**< add VLAN tag */
-	SPP_PORT_ABILITY_OPE_DEL_VLANTAG, /**< delete VLAN tag */
+enum sppwk_port_abl_ops {
+	SPPWK_PORT_ABL_OPS_NONE,
+	SPPWK_PORT_ABL_OPS_ADD_VLANTAG,
+	SPPWK_PORT_ABL_OPS_DEL_VLANTAG,
 };
 
 /* getopt_long return value for long option */
@@ -174,9 +174,9 @@ union spp_ability_data {
 
 /** Port ability information */
 struct spp_port_ability {
-	enum spp_port_ability_ope ope; /**< Operation */
-	enum spp_port_rxtx rxtx;       /**< rx/tx identifier */
-	union spp_ability_data data;   /**< Port ability data */
+	enum sppwk_port_abl_ops ops;  /**< Port ability Operations */
+	enum spp_port_rxtx rxtx;      /**< rx/tx identifier */
+	union spp_ability_data data;  /**< Port ability data */
 };
 
 /* Attributes for classifying . */
-- 
2.17.1


  parent reply	other threads:[~2019-05-21  2:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  2:32 [spp] [PATCH 0/8] Refactor funcs for parsing port cmd ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 1/8] shared/sec: rename parsing port for " ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 2/8] shared/sec: rename parsing rx and tx ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 3/8] shared/sec: rename parsing comp for port cmd ogawa.yasufumi
2019-05-21  2:32 ` ogawa.yasufumi [this message]
2019-05-21  2:32 ` [spp] [PATCH 5/8] shared/sec: rename func for parsing VLAN ID ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 6/8] shared/sec: rename func for parsing PCP ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 7/8] shared/sec: rename func for parsing MAC addr ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 8/8] shared/sec: rename func to convert MAC addr type ogawa.yasufumi

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=1558405944-8355-5-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --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).