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 006D5A046B for ; Wed, 26 Jun 2019 07:36:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EDB784F98; Wed, 26 Jun 2019 07:36:51 +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 A278F4F98 for ; Wed, 26 Jun 2019 07:36:50 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id t7so756191plr.11 for ; Tue, 25 Jun 2019 22:36:50 -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=AyXnXLgp+WoABFg8DmlA2Ur9poHtlS364uXOPUit6n4=; b=iFrFnl2wt11XBRGAQpBAo9QLCkJR6sNQMIqspFM05TyiwZnJ1DAoDBj0lkpChBLsxy RuDxmDGZjq4CbxOMQrum6arJVTu9Z7qbpM5vhycl1+znslczUkwuz34eap9ykXcbCjQ1 Me5uPXaanAmQiHvIRiADrZhO+N2f/GsdQhx7XJ1B0auvaFLxV92DsTIFvm2baZInsi+X wbqrjFwybm9ceyqYCApsF+6J6r/E05iLtVxG/Jb2fXdLzW0BC7XD/32LxSocKU0zlYRc FljPOQQThsoWOeQnZgusNQgrrZ28Dm23ZXSYmwJoS7xC2AytGRjzfQb/qVMS4X3c9EBO J0UQ== 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=AyXnXLgp+WoABFg8DmlA2Ur9poHtlS364uXOPUit6n4=; b=HMMazkwXwyxCK7RKIqxf22tnuM8uSupz96O9NId+snPjv3yXHF0HSu/QsrIOyz2DfW UheA//lofUICK5Z7VBOjRw21XyE6t5vHWmuuNrv281l0n6RXz4T7hO1RJ4tVo0hJppwQ acBZ72U9QRSmM+4zjcAi5/DxLr5n121+QFm+UUXV7J9KWcHiGKFDGPcL+7xjvHcL/HJs +cj/XdWvX9TxwP4gk3GSlJ+/4sFZUsS8Q9d1H7EsmNR6X6N7rqYknRjyuGAEUmTsIrej GMjjS5Wh4wRPBE9E7mXXkOxS4U6Ozggzjn/pwDPqVLiWoYdDBPN7+0U2EkuHgNAiL3T6 d3vw== X-Gm-Message-State: APjAAAVeEPTBM5hoCB2UWVfHtuLVzjls2U67nAKT8V43KL3SZlOT+Rf9 4IYoqouMYQfBrVik0Tg6aLXjTbtF X-Google-Smtp-Source: APXvYqzgvHx1aUYeIaWJSVP6Ecq4g9ei9Ifx97CoGkCcGOWlS0HTPcl2C9IQDTCMB7bBy9tvC+wgVw== X-Received: by 2002:a17:902:7d86:: with SMTP id a6mr3126116plm.199.1561527409393; Tue, 25 Jun 2019 22:36:49 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id p2sm24298412pfb.118.2019.06.25.22.36.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 22:36:49 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Wed, 26 Jun 2019 14:36:45 +0900 Message-Id: <20190626053645.40019-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] shared/sec: rename enum spp_classifier_type 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 refactor the name of enum `spp_classifier_type` and its members to be more specific and short. Signed-off-by: Yasufumi Ogawa --- src/shared/secondary/spp_worker_th/cmd_parser.c | 6 +++--- src/shared/secondary/spp_worker_th/cmd_parser.h | 2 +- src/shared/secondary/spp_worker_th/cmd_utils.c | 2 +- src/shared/secondary/spp_worker_th/cmd_utils.h | 10 +++++----- src/shared/secondary/spp_worker_th/vf_deps.h | 2 +- src/vf/classifier_mac.c | 14 +++++++------- src/vf/vf_cmd_runner.c | 17 ++++++++--------- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c index cd79bdb..931c53b 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.c +++ b/src/shared/secondary/spp_worker_th/cmd_parser.c @@ -728,7 +728,7 @@ parse_cls_port(void *cls_cmd_attr, const char *arg_val, return SPP_RET_NG; } - if (cls_attrs->type == SPP_CLASSIFIER_TYPE_MAC) + if (cls_attrs->cls_type == SPPWK_CLS_TYPE_MAC) cls_attrs->vid = ETH_VLAN_ID_MAX; if (unlikely(cls_attrs->wk_action == SPPWK_ACT_ADD)) { @@ -783,7 +783,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { .name = "type", .offset = offsetof(struct sppwk_cmd_attrs, - spec.cls_table.type), + spec.cls_table.cls_type), .func = parse_cls_type }, { @@ -810,7 +810,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { { .name = "type", .offset = offsetof(struct sppwk_cmd_attrs, - spec.cls_table.type), + spec.cls_table.cls_type), .func = parse_cls_type }, { diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h index d50e3a6..b124dc1 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.h +++ b/src/shared/secondary/spp_worker_th/cmd_parser.h @@ -80,7 +80,7 @@ const char *sppwk_cmd_type_str(enum sppwk_cmd_type ctype); /* `classifier_table` command specific parameters. */ struct sppwk_cls_cmd_attrs { enum sppwk_action wk_action; /**< add or del */ - enum spp_classifier_type type; /**< currently only for mac */ + enum sppwk_cls_type cls_type; /**< currently only for MAC. */ int vid; /**< VLAN ID */ char mac[SPPWK_VAL_BUFSZ]; /**< MAC address */ struct sppwk_port_idx port;/**< Destination port type and number */ diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c index 6f93400..6072186 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.c +++ b/src/shared/secondary/spp_worker_th/cmd_utils.c @@ -69,7 +69,7 @@ log_hexdumped(const char *obj_name, const void *obj_addr, const size_t size) } } -/* Get core status */ +/* Get status of lcore of given ID. */ enum sppwk_lcore_status spp_get_core_status(unsigned int lcore_id) { diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h index 87c9b2c..a935312 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.h +++ b/src/shared/secondary/spp_worker_th/cmd_utils.h @@ -93,10 +93,10 @@ enum sppwk_worker_type { }; /* Classifier Type */ -enum spp_classifier_type { - SPP_CLASSIFIER_TYPE_NONE, /**< Type none */ - SPP_CLASSIFIER_TYPE_MAC, /**< MAC address */ - SPP_CLASSIFIER_TYPE_VLAN /**< VLAN ID */ +enum sppwk_cls_type { + SPPWK_CLS_TYPE_NONE, + SPPWK_CLS_TYPE_MAC, + SPPWK_CLS_TYPE_VLAN }; /* Direction of RX or TX on a port. */ @@ -258,7 +258,7 @@ struct spp_iterate_classifier_table_params; */ typedef int (*spp_iterate_classifier_element_proc)( struct spp_iterate_classifier_table_params *params, - enum spp_classifier_type type, + enum sppwk_cls_type cls_type, int vid, const char *mac, const struct sppwk_port_idx *port); diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h index fd3c201..83ddf09 100644 --- a/src/shared/secondary/spp_worker_th/vf_deps.h +++ b/src/shared/secondary/spp_worker_th/vf_deps.h @@ -108,7 +108,7 @@ int update_comp_info(struct sppwk_comp_info *p_comp_info, int *p_change_comp); int append_classifier_element_value( struct spp_iterate_classifier_table_params *params, - enum spp_classifier_type type, + enum sppwk_cls_type cls_type, int vid, const char *mac, const struct sppwk_port_idx *port); diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c index c7873e3..9c4bedf 100644 --- a/src/vf/classifier_mac.c +++ b/src/vf/classifier_mac.c @@ -878,11 +878,11 @@ iterate_adding_mac_entry( uint32_t next; struct sppwk_port_idx port; char mac_addr_str[ETHER_ADDR_STR_BUF_SZ]; - enum spp_classifier_type type; + enum sppwk_cls_type cls_type; - type = SPP_CLASSIFIER_TYPE_VLAN; + cls_type = SPPWK_CLS_TYPE_VLAN; if (unlikely(vid == VLAN_UNTAGGED_VID)) - type = SPP_CLASSIFIER_TYPE_MAC; + cls_type = SPPWK_CLS_TYPE_MAC; if (mac_cls->default_cls_idx >= 0) { port.iface_type = (port_info + @@ -897,8 +897,8 @@ iterate_adding_mac_entry( * Append "default" entry. `element_proc` is a funciton * pointer to append_classifier_element_value(). */ - (*params->element_proc)(params, type, vid, SPPWK_TERM_DEFAULT, - &port); + (*params->element_proc)(params, cls_type, vid, + SPPWK_TERM_DEFAULT, &port); } next = 0; @@ -920,8 +920,8 @@ iterate_adding_mac_entry( * Append each entry of MAC address. `element_proc` is a * funciton pointer to append_classifier_element_value(). */ - (*params->element_proc)(params, type, vid, mac_addr_str, - &port); + (*params->element_proc)(params, cls_type, vid, + mac_addr_str, &port); } } diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c index f5854b0..b28d8a6 100644 --- a/src/vf/vf_cmd_runner.c +++ b/src/vf/vf_cmd_runner.c @@ -28,7 +28,7 @@ const char *CLS_TYPE_A_LIST[] = { /* Update classifier table with given action, add or del. */ static int update_cls_table(enum sppwk_action wk_action, - enum spp_classifier_type type __attribute__ ((unused)), + enum sppwk_cls_type cls_type __attribute__ ((unused)), int vid, const char *mac_str, const struct sppwk_port_idx *port) { @@ -383,7 +383,7 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd) case SPPWK_CMDTYPE_CLS_MAC: case SPPWK_CMDTYPE_CLS_VLAN: ret = update_cls_table(cmd->spec.cls_table.wk_action, - cmd->spec.cls_table.type, + cmd->spec.cls_table.cls_type, cmd->spec.cls_table.vid, cmd->spec.cls_table.mac, &cmd->spec.cls_table.port); @@ -555,7 +555,7 @@ update_comp_info(struct sppwk_comp_info *p_comp_info, int *p_change_comp) int append_classifier_element_value( struct spp_iterate_classifier_table_params *params, - enum spp_classifier_type type, + enum sppwk_cls_type cls_type, int vid, const char *mac, const struct sppwk_port_idx *port) { @@ -567,23 +567,22 @@ append_classifier_element_value( 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 = classifier_table)\n"); + "Failed to allocate buffer.\n"); return ret; } spp_format_port_string(port_str, port->iface_type, port->iface_no); - ret = append_json_str_value(&tmp_buff, "type", CLS_TYPE_A_LIST[type]); + ret = append_json_str_value(&tmp_buff, "type", CLS_TYPE_A_LIST[cls_type]); if (unlikely(ret < SPP_RET_OK)) return ret; memset(value_str, 0x00, STR_LEN_SHORT); - switch (type) { - case SPP_CLASSIFIER_TYPE_MAC: + switch (cls_type) { + case SPPWK_CLS_TYPE_MAC: sprintf(value_str, "%s", mac); break; - case SPP_CLASSIFIER_TYPE_VLAN: + case SPPWK_CLS_TYPE_VLAN: sprintf(value_str, "%d/%s", vid, mac); break; default: -- 2.17.1