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 6BF99A0487 for ; Wed, 3 Jul 2019 10:37:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46BD4F04; Wed, 3 Jul 2019 10:37:42 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 32468F04 for ; Wed, 3 Jul 2019 10:37:41 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id f25so836893pgv.10 for ; Wed, 03 Jul 2019 01:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=IeOBcjaCTjLRqlod9+bCtywwPrpbldGjkgIri/RL+5c=; b=h9cX+D+sF009i5jSLRQ5T/b4UmkPKowJR3eRPVfKPgrI2rMi+V5tFKwBcicg0DWiIQ xST7iD65v86fsIr8eHs0zG+HlJVGyUI+IHfBWfU5OP9fNK85JXX1ruxCtQEr0n3nsQEI 1x8EKFdsvUakzbolKCnz6x+Uaz2oA5txnkFhkMX5Bb60uWQH3iN9N6C7kQmlxQXelAQR BaYyrwWmujRZrKeyRod2R2vGP5N0U8LNtcAeOVGH/kq7koM8zAUk2KxaoXCYtKNf2e2/ dfngM5r7pT6pjzrg2d26jeOTOHo4b2A1BoMABqNeT5jo2e8QzGVuumvAPYqL7bCD6gV1 Mz2w== 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:in-reply-to :references; bh=IeOBcjaCTjLRqlod9+bCtywwPrpbldGjkgIri/RL+5c=; b=sUWeFIg+MNMj96N5MUNMQ8fRlsxzXolL3P8/LNjsKhHDYFWI0k0I0HDOt67o/+aAYi 2WzD8Ge7YdAHZGTylBa2AvhJxT4Y7md3xq8O+IvP8rkULAqFa5UCnCeR822AtPhyXYg8 MqabfC4+Q8krldYH11IOqvF5TyFRCgYaRjsMQkGHasT0F11HBWBzsYszBhWnaVP7u88f kHT950Z88A9d8i362q3IgdjZ+fNoiH1NRKrJYsurTv4TV8XfAgA8H3wkyD2tW8qXbfe7 Y2KsJJWlw+wSBaPq74SmcT/KO3TN8CamXr8GZS6wNCcZKNq82CpWYGB52nJw7c7MjF9/ KgoA== X-Gm-Message-State: APjAAAXhn3jaG3g/UpweHz8z0BLvAsUulG4uwFee0lHsIVnaKr6TEy1e 0MfkEXR9aXl7mP2kLWP4sGCXszZA X-Google-Smtp-Source: APXvYqyhXosLFAbuoYTKz1FaHs2R53ZZy2vonDLNn2p+GhtCE1K6Y9y3VbgKrqxbikHl2D0u8Tzp7w== X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr11004032pju.81.1562143060141; Wed, 03 Jul 2019 01:37:40 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id 201sm3228160pfz.24.2019.07.03.01.37.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jul 2019 01:37:39 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Wed, 3 Jul 2019 17:37:35 +0900 Message-Id: <20190703083735.1432-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703074320.36403-1-yasufum.o@gmail.com> References: <20190703074320.36403-1-yasufum.o@gmail.com> Subject: [spp] [PATCH v2] 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 --- .../secondary/spp_worker_th/cmd_parser.c | 6 +++--- .../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 | 18 +++++++++--------- 7 files changed, 27 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..72e7b97 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,23 @@ 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