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 7487DA0466 for ; Fri, 31 May 2019 05:39:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 669D01B94B; Fri, 31 May 2019 05:39:34 +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 875E24F91 for ; Fri, 31 May 2019 05:39:32 +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 x4V3dVL5023690; Fri, 31 May 2019 12:39:31 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 727506395DE; Fri, 31 May 2019 12:39:31 +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 62A026395D8; Fri, 31 May 2019 12:39:31 +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:59 +0900 Message-Id: <1559273819-26243-7-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559273819-26243-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1559273819-26243-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 6/6] shared/sec: rename struct spp_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 The name of struct `spp_command` is too wide in meaning. It is just a set of attributes of command for SPP worker thread actually. This update is to rename it to `sppwk_cmd_attrs`. Signed-off-by: Yasufumi Ogawa --- .../secondary/spp_worker_th/cmd_parser.c | 47 ++++++++++--------- .../secondary/spp_worker_th/cmd_parser.h | 8 ++-- .../secondary/spp_worker_th/cmd_runner.c | 20 ++++---- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c index 0f0e64c..621bea4 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.c +++ b/src/shared/secondary/spp_worker_th/cmd_parser.c @@ -796,25 +796,25 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { /* classifier_table(mac) */ { .name = "action", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.wk_action), .func = parse_cls_action }, { .name = "type", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.type), .func = parse_cls_type }, { .name = "mac address", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.mac), .func = parse_mac_addr }, { .name = "port", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table), .func = parse_cls_port }, @@ -823,31 +823,31 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { /* classifier_table(VLAN) */ { .name = "action", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.wk_action), .func = parse_cls_action }, { .name = "type", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.type), .func = parse_cls_type }, { .name = "vlan id", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.vid), .func = parse_cls_vid }, { .name = "mac address", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table.mac), .func = parse_mac_addr }, { .name = "port", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.cls_table), .func = parse_cls_port }, @@ -859,23 +859,23 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { /* component */ { .name = "action", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.comp.wk_action), .func = parse_comp_action }, { .name = "component name", - .offset = offsetof(struct spp_command, spec.comp), + .offset = offsetof(struct sppwk_cmd_attrs, spec.comp), .func = parse_comp_name }, { .name = "core", - .offset = offsetof(struct spp_command, spec.comp), + .offset = offsetof(struct sppwk_cmd_attrs, spec.comp), .func = parse_comp_lcore_id }, { .name = "component type", - .offset = offsetof(struct spp_command, spec.comp), + .offset = offsetof(struct sppwk_cmd_attrs, spec.comp), .func = parse_comp_type }, SPPWK_CMD_NO_PARAMS, @@ -883,38 +883,39 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { /* port */ { .name = "action", - .offset = offsetof(struct spp_command, + .offset = offsetof(struct sppwk_cmd_attrs, spec.port.wk_action), .func = parse_port_action }, { .name = "port", - .offset = offsetof(struct spp_command, spec.port), + .offset = offsetof(struct sppwk_cmd_attrs, spec.port), .func = parse_port }, { .name = "port rxtx", - .offset = offsetof(struct spp_command, spec.port), + .offset = offsetof(struct sppwk_cmd_attrs, spec.port), .func = parse_port_rxtx }, { .name = "component name", - .offset = offsetof(struct spp_command, spec.port.name), + .offset = offsetof(struct sppwk_cmd_attrs, + spec.port.name), .func = parse_comp_name_portcmd }, { .name = "port vlan operation", - .offset = offsetof(struct spp_command, spec.port), + .offset = offsetof(struct sppwk_cmd_attrs, spec.port), .func = parse_port_vlan_ops }, { .name = "port vid", - .offset = offsetof(struct spp_command, spec.port), + .offset = offsetof(struct sppwk_cmd_attrs, spec.port), .func = parse_port_vid }, { .name = "port pcp", - .offset = offsetof(struct spp_command, spec.port), + .offset = offsetof(struct sppwk_cmd_attrs, spec.port), .func = parse_port_pcp }, SPPWK_CMD_NO_PARAMS, @@ -1130,7 +1131,7 @@ sppwk_parse_req( int i; /* decode request */ - request->num_command = 1; + request->nof_cmds = 1; ret = parse_wk_cmd(request, request_str, wk_err_msg); if (unlikely(ret != SPP_RET_OK)) { RTE_LOG(ERR, WK_CMD_PARSER, @@ -1139,10 +1140,10 @@ sppwk_parse_req( ret, (int)request_str_len, request_str); return ret; } - request->num_valid_command = 1; + request->nof_valid_cmds = 1; /* check getter command */ - for (i = 0; i < request->num_valid_command; ++i) { + for (i = 0; i < request->nof_valid_cmds; ++i) { switch (request->commands[i].type) { case SPPWK_CMDTYPE_CLIENT_ID: request->is_requested_client_id = 1; diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h index de4dcba..5a7df84 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.h +++ b/src/shared/secondary/spp_worker_th/cmd_parser.h @@ -108,7 +108,7 @@ struct sppwk_cmd_port { }; /* TODO(yasufum) Add usage and desc for members. What's command descriptors? */ -struct spp_command { +struct sppwk_cmd_attrs { enum sppwk_cmd_type type; /**< command type */ union { /**< command descriptors */ @@ -121,9 +121,9 @@ struct spp_command { /* Request parameters. */ struct sppwk_cmd_req { - int num_command; /**< Number of accepted commands */ - int num_valid_command; /**< Number of executed commands */ - struct spp_command commands[SPPWK_MAX_CMDS]; /**< list of cmds */ + int nof_cmds; /**< Number of accepted commands */ + int nof_valid_cmds; /**< Number of executed commands */ + struct sppwk_cmd_attrs commands[SPPWK_MAX_CMDS]; /**< list of cmds */ int is_requested_client_id; int is_requested_status; diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c index 3c80db9..c3e1c9c 100644 --- a/src/shared/secondary/spp_worker_th/cmd_runner.c +++ b/src/shared/secondary/spp_worker_th/cmd_runner.c @@ -726,7 +726,7 @@ append_json_block_brackets(const char *name, char **output, const char *str) /* Execute one command. */ static int -exec_one_cmd(const struct spp_command *cmd) +exec_one_cmd(const struct sppwk_cmd_attrs *cmd) { int ret; @@ -856,7 +856,7 @@ prepare_parse_err_msg(struct cmd_result *results, const char *tmp_buff; char error_messege[CMD_ERR_MSG_LEN]; - for (i = 0; i < request->num_command; i++) { + for (i = 0; i < request->nof_cmds; i++) { if (wk_err_msg->code == 0) set_cmd_result(&results[i], CMD_SUCCESS, ""); else @@ -865,7 +865,7 @@ prepare_parse_err_msg(struct cmd_result *results, if (wk_err_msg->code != 0) { tmp_buff = get_parse_err_msg(wk_err_msg, error_messege); - set_cmd_result(&results[request->num_valid_command], + set_cmd_result(&results[request->nof_valid_cmds], CMD_FAILED, tmp_buff); } } @@ -1482,7 +1482,7 @@ append_info_value(const char *name, char **output) static void send_decode_error_response(int *sock, const struct sppwk_cmd_req *request, - struct cmd_result *command_results) + struct cmd_result *cmd_results) { int ret = SPP_RET_NG; char *msg, *tmp_buff; @@ -1496,7 +1496,7 @@ send_decode_error_response(int *sock, /* create & append result array */ ret = append_command_results_value("results", &tmp_buff, - request->num_command, command_results); + request->nof_cmds, cmd_results); if (unlikely(ret < SPP_RET_OK)) { spp_strbuf_free(tmp_buff); RTE_LOG(ERR, WK_CMD_RUNNER, @@ -1541,7 +1541,7 @@ send_decode_error_response(int *sock, static void send_command_result_response(int *sock, const struct sppwk_cmd_req *request, - struct cmd_result *command_results) + struct cmd_result *cmd_results) { int ret = SPP_RET_NG; char *msg, *tmp_buff; @@ -1555,7 +1555,7 @@ send_command_result_response(int *sock, /* create & append result array */ ret = append_command_results_value("results", &tmp_buff, - request->num_command, command_results); + request->nof_cmds, cmd_results); if (unlikely(ret < SPP_RET_OK)) { spp_strbuf_free(tmp_buff); RTE_LOG(ERR, WK_CMD_RUNNER, @@ -1650,16 +1650,16 @@ exec_cmds(int *sock, const char *req_str, size_t req_str_len) RTE_LOG(DEBUG, WK_CMD_RUNNER, "Num of cmds is %d, and valid cmds is %d\n", - cmd_req.num_command, cmd_req.num_valid_command); + cmd_req.nof_cmds, cmd_req.nof_valid_cmds); /* execute commands */ - for (i = 0; i < cmd_req.num_command ; ++i) { + for (i = 0; i < cmd_req.nof_cmds; ++i) { ret = exec_one_cmd(cmd_req.commands + i); if (unlikely(ret != SPP_RET_OK)) { set_cmd_result(&cmd_results[i], CMD_FAILED, "error occur"); /* Does not execute remaining commands */ - for (++i; i < cmd_req.num_command ; ++i) + for (++i; i < cmd_req.nof_cmds; ++i) set_cmd_result(&cmd_results[i], CMD_INVALID, ""); break; -- 2.17.1