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 09/11] shared/sec: rename func for executing command
Date: Fri, 31 May 2019 12:36:03 +0900	[thread overview]
Message-ID: <1559273765-26130-10-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559273765-26130-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

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

This update is to rename the name of function from
`execute_command()` to `exec_cmd()`, and to refactor log messages.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 .../secondary/spp_worker_th/cmd_runner.c      | 70 +++++++++----------
 1 file changed, 32 insertions(+), 38 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index f7476c4..0000203 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -206,11 +206,8 @@ update_cls_table(enum sppwk_action wk_action,
 
 /* Assign worker thread or remove on specified lcore. */
 static int
-spp_update_component(
-		enum sppwk_action wk_action,
-		const char *name,
-		unsigned int lcore_id,
-		enum spp_component_type type)
+update_comp(enum sppwk_action wk_action, const char *name,
+		unsigned int lcore_id, enum spp_component_type type)
 {
 	int ret = SPP_RET_NG;
 	int ret_del = -1;
@@ -719,67 +716,64 @@ append_json_block_brackets(const char *name, char **output, const char *str)
 	return SPP_RET_OK;
 }
 
-/* execute one command */
+/* Execute one command. */
 static int
-execute_command(const struct spp_command *command)
+exec_cmd(const struct spp_command *cmd)
 {
-	int ret = SPP_RET_OK;
+	int ret;
 
-	switch (command->type) {
+	switch (cmd->type) {
 	case SPPWK_CMDTYPE_CLS_MAC:
 	case SPPWK_CMDTYPE_CLS_VLAN:
 		RTE_LOG(INFO, SPP_COMMAND_PROC,
-				"Execute classifier_table command.\n");
-		ret = update_cls_table(
-				command->spec.cls_table.wk_action,
-				command->spec.cls_table.type,
-				command->spec.cls_table.vid,
-				command->spec.cls_table.mac,
-				&command->spec.cls_table.port);
+				"Exec classifier_table cmd.\n");
+		ret = update_cls_table(cmd->spec.cls_table.wk_action,
+				cmd->spec.cls_table.type,
+				cmd->spec.cls_table.vid,
+				cmd->spec.cls_table.mac,
+				&cmd->spec.cls_table.port);
 		if (ret == 0) {
-			RTE_LOG(INFO, SPP_COMMAND_PROC,
-					"Execute flush.\n");
+			RTE_LOG(INFO, SPP_COMMAND_PROC, "Exec flush.\n");
 			ret = spp_flush();
 		}
 		break;
 
 	case SPPWK_CMDTYPE_WORKER:
 		RTE_LOG(INFO, SPP_COMMAND_PROC,
-				"Execute component command.\n");
-		ret = spp_update_component(
-				command->spec.comp.wk_action,
-				command->spec.comp.name,
-				command->spec.comp.core,
-				command->spec.comp.type);
+				"Exec component cmd.\n");
+		ret = update_comp(
+				cmd->spec.comp.wk_action,
+				cmd->spec.comp.name,
+				cmd->spec.comp.core,
+				cmd->spec.comp.type);
 		if (ret == 0) {
-			RTE_LOG(INFO, SPP_COMMAND_PROC,
-					"Execute flush.\n");
+			RTE_LOG(INFO, SPP_COMMAND_PROC, "Exec flush.\n");
 			ret = spp_flush();
 		}
 		break;
 
 	case SPPWK_CMDTYPE_PORT:
 		RTE_LOG(INFO, SPP_COMMAND_PROC,
-				"Execute port command. (act = %d)\n",
-				command->spec.port.wk_action);
+				"Exec port command, act=%d.\n",
+				cmd->spec.port.wk_action);
 		ret = spp_update_port(
-				command->spec.port.wk_action,
-				&command->spec.port.port,
-				command->spec.port.rxtx,
-				command->spec.port.name,
-				&command->spec.port.ability);
+				cmd->spec.port.wk_action,
+				&cmd->spec.port.port,
+				cmd->spec.port.rxtx,
+				cmd->spec.port.name,
+				&cmd->spec.port.ability);
 		if (ret == 0) {
-			RTE_LOG(INFO, SPP_COMMAND_PROC,
-					"Execute flush.\n");
+			RTE_LOG(INFO, SPP_COMMAND_PROC, "Exec flush.\n");
 			ret = spp_flush();
 		}
 		break;
 
 	default:
 		RTE_LOG(INFO, SPP_COMMAND_PROC,
-				"Execute other command. type=%d\n",
-				command->type);
+				"Exec other command, type=%d.\n",
+				cmd->type);
 		/* nothing to do here */
+		ret = SPP_RET_OK;
 		break;
 	}
 
@@ -1664,7 +1658,7 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 
 	/* execute commands */
 	for (i = 0; i < request.num_command ; ++i) {
-		ret = execute_command(request.commands + i);
+		ret = exec_cmd(request.commands + i);
 		if (unlikely(ret != SPP_RET_OK)) {
 			set_cmd_result(&command_results[i], CMD_FAILED,
 					"error occur");
-- 
2.17.1


  parent reply	other threads:[~2019-05-31  3:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  3:35 [spp] [PATCH 00/11] Refactor functions for handling commands ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 01/11] shared/sec: rename functions of sppwk_cmd_runner ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 02/11] shared/sec: revise enum for cmd response ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 03/11] shared/sec: refactor passing err in cmd_runner ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 04/11] shared/sec: rename struct for command response ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 05/11] shared/sec: refactor funcs for managing port info ogawa.yasufumi
2019-05-31  3:36 ` [spp] [PATCH 06/11] shared/sec: rename util functions in cmd_runner ogawa.yasufumi
2019-05-31  3:36 ` [spp] [PATCH 07/11] shared/sec: rename func for getting component ID ogawa.yasufumi
2019-05-31  3:36 ` [spp] [PATCH 08/11] shared/sec: refactor func for updating cls table ogawa.yasufumi
2019-05-31  3:36 ` ogawa.yasufumi [this message]
2019-05-31  3:36 ` [spp] [PATCH 10/11] shared/sec: add helpers for logging cmd parser ogawa.yasufumi
2019-05-31  3:36 ` [spp] [PATCH 11/11] shared/sec: rename func for updating port 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=1559273765-26130-10-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).