Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH 0/6] Revise name of funcs for parsing actions
@ 2019-05-21  2:31 ogawa.yasufumi
  2019-05-21  2:31 ` [spp] [PATCH 1/6] shared/sec: rename parse comp action val ogawa.yasufumi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:31 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

SPP worker processes defines a series of actions for given resources,
but the name of functions for parsing the actinos are not incorrect or
ambiguous in meaning. This series of update is to revise them.

Yasufumi Ogawa (6):
  shared/sec: rename parse comp action val
  shared/sec: rename func for parsing comp name
  shared/sec: refacotr comments for parse comp name
  shared/sec: rename func for parsing lcore ID
  shared/sec: rename func of parsing comp type
  shared/sec: rename parsing comp action

 .../secondary/spp_worker_th/cmd_parser.c      | 63 ++++++++++---------
 src/shared/secondary/spp_worker_th/spp_proc.c |  2 +-
 2 files changed, 36 insertions(+), 29 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 1/6] shared/sec: rename parse comp action val
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
@ 2019-05-21  2:31 ` ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 2/6] shared/sec: rename func for parsing comp name ogawa.yasufumi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:31 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

The name `decode_component_action_value` is too long and not intuitive.
This update is to fix the issue by renaming to `parse_comp_action`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index ae845f4..6fc3a51 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -299,10 +299,10 @@ parse_lcore_id(void *output, const char *arg_val)
 
 /* decoding procedure of action for component command */
 static int
-decode_component_action_value(void *output, const char *arg_val,
-				int allow_override __attribute__ ((unused)))
+parse_comp_action(void *output, const char *arg_val,
+		int allow_override __attribute__ ((unused)))
 {
-	int ret = SPP_RET_OK;
+	int ret;
 	ret = get_list_idx(arg_val, CMD_ACT_LIST);
 	if (unlikely(ret <= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -797,7 +797,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 			.name = "action",
 			.offset = offsetof(struct spp_command,
 					spec.comp.wk_action),
-			.func = decode_component_action_value
+			.func = parse_comp_action
 		},
 		{
 			.name = "component name",
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 2/6] shared/sec: rename func for parsing comp name
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
  2019-05-21  2:31 ` [spp] [PATCH 1/6] shared/sec: rename parse comp action val ogawa.yasufumi
@ 2019-05-21  2:32 ` ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 3/6] shared/sec: refacotr comments for parse " ogawa.yasufumi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:32 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename function `decode_component_name_value()` to
`parse_comp_name()` which is enough to describe the behaviour.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 8 ++++----
 src/shared/secondary/spp_worker_th/spp_proc.c   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 6fc3a51..e99cdeb 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -325,10 +325,10 @@ parse_comp_action(void *output, const char *arg_val,
 
 /* decoding procedure of action for component command */
 static int
-decode_component_name_value(void *output, const char *arg_val,
-				int allow_override __attribute__ ((unused)))
+parse_comp_name(void *output, const char *arg_val,
+		int allow_override __attribute__ ((unused)))
 {
-	int ret = SPP_RET_OK;
+	int ret;
 	struct sppwk_cmd_comp *component = output;
 
 	/* "stop" has no core ID parameter. */
@@ -802,7 +802,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "component name",
 			.offset = offsetof(struct spp_command, spec.comp),
-			.func = decode_component_name_value
+			.func = parse_comp_name
 		},
 		{
 			.name = "core",
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.c b/src/shared/secondary/spp_worker_th/spp_proc.c
index 53dd3f8..e552bf1 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.c
+++ b/src/shared/secondary/spp_worker_th/spp_proc.c
@@ -730,7 +730,7 @@ int
 spp_get_component_id(const char *name)
 {
 	struct spp_component_info *component_info =
-					g_mng_data_addr.p_component_info;
+		g_mng_data_addr.p_component_info;
 
 	int cnt = 0;
 	if (name[0] == '\0')
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 3/6] shared/sec: refacotr comments for parse comp name
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
  2019-05-21  2:31 ` [spp] [PATCH 1/6] shared/sec: rename parse comp action val ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 2/6] shared/sec: rename func for parsing comp name ogawa.yasufumi
@ 2019-05-21  2:32 ` " ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 4/6] shared/sec: rename func for parsing lcore ID ogawa.yasufumi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:32 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to refactor comments for function for parsing component
name which is updated previous patch.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index e99cdeb..cf6c4a1 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -323,7 +323,7 @@ parse_comp_action(void *output, const char *arg_val,
 	return SPP_RET_OK;
 }
 
-/* decoding procedure of action for component command */
+/* Parse given name `arg_val` of component. */
 static int
 parse_comp_name(void *output, const char *arg_val,
 		int allow_override __attribute__ ((unused)))
@@ -331,12 +331,13 @@ parse_comp_name(void *output, const char *arg_val,
 	int ret;
 	struct sppwk_cmd_comp *component = output;
 
-	/* "stop" has no core ID parameter. */
+	/* Parsing the name is required only for action `start`. */
 	if (component->wk_action == SPPWK_ACT_START) {
+		/* Get lcore ID as comp name, or NG code. */
 		ret = spp_get_component_id(arg_val);
 		if (unlikely(ret >= 0)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
-					"Component name in used. val=%s\n",
+					"Comp name '%s' is already used.\n",
 					arg_val);
 			return SPP_RET_NG;
 		}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 4/6] shared/sec: rename func for parsing lcore ID
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
                   ` (2 preceding siblings ...)
  2019-05-21  2:32 ` [spp] [PATCH 3/6] shared/sec: refacotr comments for parse " ogawa.yasufumi
@ 2019-05-21  2:32 ` ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 5/6] shared/sec: rename func of parsing comp type ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 6/6] shared/sec: rename parsing comp action ogawa.yasufumi
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:32 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename function for parsing lcore ID
`decode_component_core_value()` in which the lcore vaule is not
understandable to `parse_comp_lcore_id()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index cf6c4a1..b03f9b8 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -350,14 +350,14 @@ parse_comp_name(void *output, const char *arg_val,
 	return SPP_RET_OK;
 }
 
-/* decoding procedure of core id for component command */
+/* Parse given lcore ID of `arg_val` of component. */
 static int
-decode_component_core_value(void *output, const char *arg_val,
+parse_comp_lcore_id(void *output, const char *arg_val,
 				int allow_override __attribute__ ((unused)))
 {
 	struct sppwk_cmd_comp *component = output;
 
-	/* "stop" has no core ID parameter. */
+	/* Parsing lcore is required only for action `start`. */
 	if (component->wk_action != SPPWK_ACT_START)
 		return SPP_RET_OK;
 
@@ -808,7 +808,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "core",
 			.offset = offsetof(struct spp_command, spec.comp),
-			.func = decode_component_core_value
+			.func = parse_comp_lcore_id
 		},
 		{
 			.name = "component type",
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 5/6] shared/sec: rename func of parsing comp type
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
                   ` (3 preceding siblings ...)
  2019-05-21  2:32 ` [spp] [PATCH 4/6] shared/sec: rename func for parsing lcore ID ogawa.yasufumi
@ 2019-05-21  2:32 ` ogawa.yasufumi
  2019-05-21  2:32 ` [spp] [PATCH 6/6] shared/sec: rename parsing comp action ogawa.yasufumi
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:32 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to redundant rename `decode_component_type_value()` to
`parse_comp_type()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index b03f9b8..7d56146 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -364,22 +364,25 @@ parse_comp_lcore_id(void *output, const char *arg_val,
 	return parse_lcore_id(&component->core, arg_val);
 }
 
-/* decoding procedure of type for component command */
+/**
+ * Parse given type of component of `arg_val`. Return OK code if succeeded, or
+ * NG code.
+ */
 static int
-decode_component_type_value(void *output, const char *arg_val,
-				int allow_override __attribute__ ((unused)))
+parse_comp_type(void *output, const char *arg_val,
+		int allow_override __attribute__ ((unused)))
 {
 	enum spp_component_type comp_type;
 	struct sppwk_cmd_comp *component = output;
 
-	/* "stop" has no type parameter. */
+	/* Parsing comp type is required only for action `start`. */
 	if (component->wk_action != SPPWK_ACT_START)
 		return SPP_RET_OK;
 
 	comp_type = get_comp_type_from_str(arg_val);
 	if (unlikely(comp_type <= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
-				"Unknown component type. val=%s\n",
+				"Unknown component type '%s'.\n",
 				arg_val);
 		return SPP_RET_NG;
 	}
@@ -813,7 +816,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 		{
 			.name = "component type",
 			.offset = offsetof(struct spp_command, spec.comp),
-			.func = decode_component_type_value
+			.func = parse_comp_type
 		},
 		SPPWK_CMD_NO_PARAMS,
 	},
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [spp] [PATCH 6/6] shared/sec: rename parsing comp action
  2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
                   ` (4 preceding siblings ...)
  2019-05-21  2:32 ` [spp] [PATCH 5/6] shared/sec: rename func of parsing comp type ogawa.yasufumi
@ 2019-05-21  2:32 ` ogawa.yasufumi
  5 siblings, 0 replies; 7+ messages in thread
From: ogawa.yasufumi @ 2019-05-21  2:32 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to redundant rename `decode_port_action_value()` to
`parse_port_action()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 7d56146..88b4b4f 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -303,10 +303,11 @@ parse_comp_action(void *output, const char *arg_val,
 		int allow_override __attribute__ ((unused)))
 {
 	int ret;
+	/* Get index of registered commands. */
 	ret = get_list_idx(arg_val, CMD_ACT_LIST);
 	if (unlikely(ret <= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
-				"Unknown component action. val=%s\n",
+				"Given invalid cmd `%s`.\n",
 				arg_val);
 		return SPP_RET_NG;
 	}
@@ -391,12 +392,13 @@ parse_comp_type(void *output, const char *arg_val,
 	return SPP_RET_OK;
 }
 
-/* decoding procedure of action for port command */
+/* Parse given action for port of `arg_val`. */
 static int
-decode_port_action_value(void *output, const char *arg_val,
-				int allow_override __attribute__ ((unused)))
+parse_port_action(void *output, const char *arg_val,
+		int allow_override __attribute__ ((unused)))
 {
-	int ret = SPP_RET_OK;
+	int ret;
+	/* Get index of registered commands. */
 	ret = get_list_idx(arg_val, CMD_ACT_LIST);
 	if (unlikely(ret <= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -405,6 +407,7 @@ decode_port_action_value(void *output, const char *arg_val,
 		return SPP_RET_NG;
 	}
 
+	/* TODO(yasufum) fix not explicit checking this condition. */
 	if (unlikely(ret != SPPWK_ACT_ADD) &&
 			unlikely(ret != SPPWK_ACT_DEL)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -413,7 +416,7 @@ decode_port_action_value(void *output, const char *arg_val,
 		return SPP_RET_NG;
 	}
 
-	*(int *)output = ret;
+	*(int *)output = ret;  /* TODO(yasufum) confirm the statement is OK. */
 	return SPP_RET_OK;
 }
 
@@ -825,7 +828,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
 			.name = "action",
 			.offset = offsetof(struct spp_command,
 					spec.port.wk_action),
-			.func = decode_port_action_value
+			.func = parse_port_action
 		},
 		{
 			.name = "port",
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  2:31 [spp] [PATCH 0/6] Revise name of funcs for parsing actions ogawa.yasufumi
2019-05-21  2:31 ` [spp] [PATCH 1/6] shared/sec: rename parse comp action val ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 2/6] shared/sec: rename func for parsing comp name ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 3/6] shared/sec: refacotr comments for parse " ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 4/6] shared/sec: rename func for parsing lcore ID ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 5/6] shared/sec: rename func of parsing comp type ogawa.yasufumi
2019-05-21  2:32 ` [spp] [PATCH 6/6] shared/sec: rename parsing comp action ogawa.yasufumi

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