From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 44273A045E for ; Fri, 31 May 2019 05:38:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7AE041B95B; Fri, 31 May 2019 05:38:41 +0200 (CEST) Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id 9908A1B94D for ; Fri, 31 May 2019 05:38:39 +0200 (CEST) Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4V3ccht023659; Fri, 31 May 2019 12:38:38 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5B6686395EE; Fri, 31 May 2019 12:38:38 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 57B4F6395E8; Fri, 31 May 2019 12:38:38 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Fri, 31 May 2019 12:36:03 +0900 Message-Id: <1559273765-26130-10-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559273765-26130-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1559273765-26130-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 09/11] shared/sec: rename func for executing command X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa 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 --- .../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