From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA8B7A10DA for ; Fri, 2 Aug 2019 11:36:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5A4B1C22A; Fri, 2 Aug 2019 11:36:08 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 5666A1C22A for ; Fri, 2 Aug 2019 11:36:07 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id m9so33304475pls.8 for ; Fri, 02 Aug 2019 02:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=7o6+APAdK9f1OyGVN2IqoR2jxq+Ej3VBwSdiyT3jLmA=; b=BqeIsOIqAYpLQ/ly4gXyu5SO+OY12rucRX2FebWpiogaqNINsxFihiT+W/wZmC9dwM ewaA058FK22fTxtG+fRpPZJMNdcKBIEZ59crfyWJO08KODei8sQp13GJJYzoXRT5kLd3 FSqMfnjXoN6MZuNHcLkgx7033Gf4Dc44XUn1S66MdpNvZeEv+M84CtWt6syht3pIwBYA YTHaKlIStAGMtJ2cEA2T/gZXaRON79JuCcMcL2b7Htqn51utQPAkl221HPaMC92I0cMP xYu3M13AkTWW9x7lCuc2NxLENL90YxVMZ0puhFzCydLoP4udqkn82BY5BwHroVgFHLb8 vM2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=7o6+APAdK9f1OyGVN2IqoR2jxq+Ej3VBwSdiyT3jLmA=; b=NqzWVqlENw9BmSxTwaqe1tF3f/TZP3D6G23B+1AJ42px2YjMY2xW9noBNAmdbJ0K4v br+lis7GiZJg0tYNIblUzlEuYB6SS78fglCL5x0BB57/Z63ZO9PXf5LkWO9FkPnh4DGS wIvigDA8oRcAzL6sCU+XEpnpgL/wjIVHwYsImUkfg1q9a8GTTooFjz0uZeQGizXAPB1a I+WF7D1Zq8PbVPi9fOO5Rpl49SBhcfBHNmj25Rb9dlZOVPvp/l6F0MBTL8rOH3ThEi18 UQ/4MYIhq/C8NbKqRs8UTCgh4Q6WI7tVRc7BluTeuNBCmqMlenuF7x7645MnJ/vjIjmV WDoQ== X-Gm-Message-State: APjAAAVlLy5So+nQJd8yWHAjvs3vMHXI04u5h7sESzTI+QJFZT1J8Co+ u24DuiwiHaAfutsQsLDO4tVkZhnd X-Google-Smtp-Source: APXvYqzZ8VltEq8JRBGkAbOCdvmcI8o/vGMvlA7bEmPjn2bWLXT7QPEFgrwmHr9BSwdoL/8nj3ZMVQ== X-Received: by 2002:a17:902:f213:: with SMTP id gn19mr134104617plb.35.1564738566237; Fri, 02 Aug 2019 02:36:06 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c8c2:de00:9c1a:eba9:3129:63d2]) by smtp.gmail.com with ESMTPSA id c26sm78560551pfr.172.2019.08.02.02.36.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:36:05 -0700 (PDT) From: Yasufumi Ogawa To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Fri, 2 Aug 2019 18:36:02 +0900 Message-Id: <20190802093602.14051-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] shared/sec: rename struct spp_iterate_core_params 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" To simplify, rename struct `spp_iterate_core_params` to `sppwk_lcore_params`. Signed-off-by: Yasufumi Ogawa --- src/mirror/mir_cmd_runner.c | 18 +++++++-------- src/mirror/spp_mirror.c | 4 ++-- src/mirror/spp_mirror.h | 2 +- src/pcap/cmd_runner.c | 22 ++++++++---------- src/pcap/spp_pcap.c | 4 ++-- src/pcap/spp_pcap.h | 9 ++++---- .../spp_worker_th/cmd_res_formatter.c | 3 +-- .../spp_worker_th/cmd_res_formatter.h | 2 +- .../secondary/spp_worker_th/data_types.h | 13 +++++------ src/vf/classifier.c | 5 ++-- src/vf/classifier.h | 2 +- src/vf/forwarder.c | 9 ++++---- src/vf/forwarder.h | 2 +- src/vf/vf_cmd_runner.c | 23 ++++++++----------- 14 files changed, 54 insertions(+), 64 deletions(-) diff --git a/src/mirror/mir_cmd_runner.c b/src/mirror/mir_cmd_runner.c index 846ac4a..730d75f 100644 --- a/src/mirror/mir_cmd_runner.c +++ b/src/mirror/mir_cmd_runner.c @@ -296,7 +296,7 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd) /* Iterate core information to create response to status command */ static int -spp_iterate_core_info(struct spp_iterate_core_params *params) +spp_iterate_core_info(struct sppwk_lcore_params *params) { int ret; int lcore_id, cnt; @@ -310,7 +310,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params) core = get_core_info(lcore_id); if (core->num == 0) { - ret = (*params->element_proc)( + ret = (*params->lcore_proc)( params, lcore_id, "", SPPWK_TYPE_NONE_STR, 0, NULL, 0, NULL); @@ -352,7 +352,7 @@ add_core(const char *name, char **output, void *tmp __attribute__ ((unused))) { int ret = SPPWK_RET_NG; - struct spp_iterate_core_params itr_params; + struct sppwk_lcore_params lcore_params; char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(tmp_buff == NULL)) { RTE_LOG(ERR, MIR_CMD_RUNNER, @@ -362,17 +362,17 @@ add_core(const char *name, char **output, return SPPWK_RET_NG; } - itr_params.output = tmp_buff; - itr_params.element_proc = append_core_element_value; + lcore_params.output = tmp_buff; + lcore_params.lcore_proc = append_core_element_value; - ret = spp_iterate_core_info(&itr_params); + ret = spp_iterate_core_info(&lcore_params); if (unlikely(ret != SPPWK_RET_OK)) { - spp_strbuf_free(itr_params.output); + spp_strbuf_free(lcore_params.output); return SPPWK_RET_NG; } - ret = append_json_array_brackets(output, name, itr_params.output); - spp_strbuf_free(itr_params.output); + ret = append_json_array_brackets(output, name, lcore_params.output); + spp_strbuf_free(lcore_params.output); return ret; } diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c index 6cf7b93..96906fb 100644 --- a/src/mirror/spp_mirror.c +++ b/src/mirror/spp_mirror.c @@ -665,7 +665,7 @@ main(int argc, char *argv[]) /* Mirror get component status */ int get_mirror_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *params) + struct sppwk_lcore_params *params) { int ret = SPPWK_RET_NG; int cnt; @@ -697,7 +697,7 @@ get_mirror_status(unsigned int lcore_id, int id, } /* Set the information with the function specified by the command. */ - ret = (*params->element_proc)(params, lcore_id, path->name, + ret = (*params->lcore_proc)(params, lcore_id, path->name, component_type, path->nof_rx, rx_ports, path->nof_tx, tx_ports); if (unlikely(ret != 0)) diff --git a/src/mirror/spp_mirror.h b/src/mirror/spp_mirror.h index 6c508cf..dafe114 100644 --- a/src/mirror/spp_mirror.h +++ b/src/mirror/spp_mirror.h @@ -23,6 +23,6 @@ * in this file. It is bad dependency for the global variable. */ int get_mirror_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *params); + struct sppwk_lcore_params *params); #endif /* __SPP_MIRROR_H__ */ diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c index 10e72bb..63658a5 100644 --- a/src/pcap/cmd_runner.c +++ b/src/pcap/cmd_runner.c @@ -66,7 +66,7 @@ const char *CAPTURE_STATUS_STRINGS[] = { * append response for status command. */ static int -spp_iterate_core_info(struct spp_iterate_core_params *params) +spp_iterate_core_info(struct sppwk_lcore_params *params) { int ret; int lcore_id; @@ -449,7 +449,7 @@ append_process_type_value(const char *name, char **output, static int append_pcap_core_element_value( - struct spp_iterate_core_params *params, + struct sppwk_lcore_params *params, const unsigned int lcore_id, const char *name, const char *type, const int num_rx, @@ -513,27 +513,25 @@ append_core_value(const char *name, char **output, void *tmp __attribute__ ((unused))) { int ret = SPPWK_RET_NG; - struct spp_iterate_core_params itr_params; + struct sppwk_lcore_params lcore_params; char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(tmp_buff == NULL)) { - RTE_LOG(ERR, PCAP_RUNNER, - "allocate error. (name = %s)\n", - name); + RTE_LOG(ERR, PCAP_RUNNER, "Failed to alloc buff.\n"); return SPPWK_RET_NG; } - itr_params.output = tmp_buff; - itr_params.element_proc = append_pcap_core_element_value; + lcore_params.output = tmp_buff; + lcore_params.lcore_proc = append_pcap_core_element_value; - ret = spp_iterate_core_info(&itr_params); + ret = spp_iterate_core_info(&lcore_params); if (unlikely(ret != SPPWK_RET_OK)) { - spp_strbuf_free(itr_params.output); + spp_strbuf_free(lcore_params.output); return SPPWK_RET_NG; } - ret = append_json_array_brackets(name, output, itr_params.output); - spp_strbuf_free(itr_params.output); + ret = append_json_array_brackets(name, output, lcore_params.output); + spp_strbuf_free(lcore_params.output); return ret; } diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c index 58a2c52..7f8d60a 100644 --- a/src/pcap/spp_pcap.c +++ b/src/pcap/spp_pcap.c @@ -369,7 +369,7 @@ parse_app_args(int argc, char *argv[]) int spp_pcap_get_core_status( unsigned int lcore_id, - struct spp_iterate_core_params *params) + struct sppwk_lcore_params *params) { char role_type[8]; struct pcap_mng_info *info = &g_pcap_info[lcore_id]; @@ -396,7 +396,7 @@ spp_pcap_get_core_status( } /* Set information with specified by the command. */ - res = (*params->element_proc)(params, lcore_id, name, role_type, + res = (*params->lcore_proc)(params, lcore_id, name, role_type, rx_num, rx_ports, 0, NULL); if (unlikely(res != 0)) return SPPWK_RET_NG; diff --git a/src/pcap/spp_pcap.h b/src/pcap/spp_pcap.h index b23fbbc..194e622 100644 --- a/src/pcap/spp_pcap.h +++ b/src/pcap/spp_pcap.h @@ -10,16 +10,15 @@ /** * Pcap get core status * - * @param lcore_id The logical core ID for forwarder and merger. - * @param params - * The pointer to struct spp_iterate_core_params.@n - * Detailed data of pcap status. + * @param lcore_id Lcore ID. + * @param params Pointer to struct sppwk_lcore_params. * * @retval SPPWK_RET_OK succeeded. * @retval SPPWK_RET_NG failed. */ +/* TODO(yasufum) consider to move spp_pcap.c. */ int spp_pcap_get_core_status( unsigned int lcore_id, - struct spp_iterate_core_params *params); + struct sppwk_lcore_params *params); #endif /* __SPP_PCAP_H__ */ diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c index c6a9e3c..85b48af 100644 --- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c +++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c @@ -278,8 +278,7 @@ append_port_array(const char *name, char **output, const int num, */ /* append one element of core information for JSON format */ int -append_core_element_value( - struct spp_iterate_core_params *params, +append_core_element_value(struct sppwk_lcore_params *params, const unsigned int lcore_id, const char *name, const char *type, const int num_rx, const struct sppwk_port_idx *rx_ports, diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.h b/src/shared/secondary/spp_worker_th/cmd_res_formatter.h index 34491d4..393b607 100644 --- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.h +++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.h @@ -48,7 +48,7 @@ int append_port_array(const char *name, char **output, const int num, const struct sppwk_port_idx *ports, const enum sppwk_port_dir dir); -int append_core_element_value(struct spp_iterate_core_params *params, +int append_core_element_value(struct sppwk_lcore_params *params, const unsigned int lcore_id, const char *name, const char *type, const int num_rx, const struct sppwk_port_idx *rx_ports, diff --git a/src/shared/secondary/spp_worker_th/data_types.h b/src/shared/secondary/spp_worker_th/data_types.h index f6dd60f..57bf182 100644 --- a/src/shared/secondary/spp_worker_th/data_types.h +++ b/src/shared/secondary/spp_worker_th/data_types.h @@ -125,14 +125,13 @@ struct iface_info { struct sppwk_port_info ring[RTE_MAX_ETHPORTS]; }; -/* TODO(yasufum) revise using term `iterate`, or comments. */ -struct spp_iterate_core_params; +struct sppwk_lcore_params; /** * Define func to iterate lcore to list core information for showing status - * or so, as a member of struct `spp_iterate_core_params`. + * or so, as a member of struct `sppwk_lcore_params`. */ -typedef int (*spp_iterate_core_element_proc)( - struct spp_iterate_core_params *params, +typedef int (*sppwk_lcore_proc)( + struct sppwk_lcore_params *params, const unsigned int lcore_id, const char *wk_name, /* Name of worker named as component. */ const char *wk_type, /* Type of worker named as component. */ @@ -146,10 +145,10 @@ typedef int (*spp_iterate_core_element_proc)( * showing status or so. */ /* TODO(yasufum) refactor name of func and vars, and comments. */ -struct spp_iterate_core_params { +struct sppwk_lcore_params { char *output; /* Buffer used for output */ /** The function for creating core information */ - spp_iterate_core_element_proc element_proc; + sppwk_lcore_proc lcore_proc; }; #endif /* __SPPWK_DATA_TYPES_H__ */ diff --git a/src/vf/classifier.c b/src/vf/classifier.c index 5743051..622c102 100644 --- a/src/vf/classifier.c +++ b/src/vf/classifier.c @@ -801,7 +801,7 @@ classify_packets(int comp_id) /* classifier iterate component information */ int get_classifier_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *lcore_params) + struct sppwk_lcore_params *lcore_params) { int ret = SPPWK_RET_NG; int i; @@ -839,8 +839,7 @@ get_classifier_status(unsigned int lcore_id, int id, } /* Set the information with the function specified by the command. */ - /* TODO(yasufum) rename `element_proc` */ - ret = (*lcore_params->element_proc)( + ret = (*lcore_params->lcore_proc)( lcore_params, lcore_id, cmp_info->name, SPPWK_TYPE_CLS_STR, nof_rx, rx_ports, nof_tx, tx_ports); if (unlikely(ret != SPPWK_RET_OK)) diff --git a/src/vf/classifier.h b/src/vf/classifier.h index 27bbe9a..2f1eb91 100644 --- a/src/vf/classifier.h +++ b/src/vf/classifier.h @@ -100,6 +100,6 @@ int classify_packets(int comp_id); * in this file. It is bad dependency for the global variable. */ int get_classifier_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *params); + struct sppwk_lcore_params *params); #endif /* _CLASSIFIER_MAC_H_ */ diff --git a/src/vf/forwarder.c b/src/vf/forwarder.c index b019d6c..20c2084 100644 --- a/src/vf/forwarder.c +++ b/src/vf/forwarder.c @@ -56,7 +56,7 @@ init_forwarder(void) /* Get forwarder status. */ int get_forwarder_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *params) + struct sppwk_lcore_params *params) { int ret = SPPWK_RET_NG; int cnt; @@ -92,10 +92,9 @@ get_forwarder_status(unsigned int lcore_id, int id, } /* Set the information with the function specified by the command. */ - ret = (*params->element_proc)( - params, lcore_id, - fwd_path->name, component_type, - fwd_path->nof_rx, rx_ports, fwd_path->nof_tx, tx_ports); + ret = (*params->lcore_proc)(params, lcore_id, fwd_path->name, + component_type, fwd_path->nof_rx, rx_ports, + fwd_path->nof_tx, tx_ports); if (unlikely(ret != SPPWK_RET_OK)) return SPPWK_RET_NG; diff --git a/src/vf/forwarder.h b/src/vf/forwarder.h index 606e5da..fe36934 100644 --- a/src/vf/forwarder.h +++ b/src/vf/forwarder.h @@ -55,6 +55,6 @@ int forward_packets(int id); */ int get_forwarder_status(unsigned int lcore_id, int id, - struct spp_iterate_core_params *params); + struct sppwk_lcore_params *params); #endif /* __SPP_FORWARD_H__ */ diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c index 7d3db66..c94288a 100644 --- a/src/vf/vf_cmd_runner.c +++ b/src/vf/vf_cmd_runner.c @@ -430,7 +430,7 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd) /* Iterate core information to create response to status command */ static int -spp_iterate_core_info(struct spp_iterate_core_params *params) +spp_iterate_core_info(struct sppwk_lcore_params *params) { int ret; int lcore_id, cnt; @@ -444,7 +444,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params) core = get_core_info(lcore_id); if (core->num == 0) { - ret = (*params->element_proc)( + ret = (*params->lcore_proc)( params, lcore_id, "", SPPWK_TYPE_NONE_STR, 0, NULL, 0, NULL); @@ -492,27 +492,24 @@ add_core(const char *name, char **output, void *tmp __attribute__ ((unused))) { int ret = SPPWK_RET_NG; - struct spp_iterate_core_params itr_params; + struct sppwk_lcore_params lcore_params; char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE); if (unlikely(tmp_buff == NULL)) { - RTE_LOG(ERR, VF_CMD_RUNNER, - /* TODO(yasufum) refactor no meaning err msg */ - "allocate error. (name = %s)\n", - name); + RTE_LOG(ERR, VF_CMD_RUNNER, "Failed to alloc buff.\n"); return SPPWK_RET_NG; } - itr_params.output = tmp_buff; - itr_params.element_proc = append_core_element_value; + lcore_params.output = tmp_buff; + lcore_params.lcore_proc = append_core_element_value; - ret = spp_iterate_core_info(&itr_params); + ret = spp_iterate_core_info(&lcore_params); if (unlikely(ret != SPPWK_RET_OK)) { - spp_strbuf_free(itr_params.output); + spp_strbuf_free(lcore_params.output); return SPPWK_RET_NG; } - ret = append_json_array_brackets(output, name, itr_params.output); - spp_strbuf_free(itr_params.output); + ret = append_json_array_brackets(output, name, lcore_params.output); + spp_strbuf_free(lcore_params.output); return ret; } -- 2.17.1