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 6BD3DA05D3 for ; Tue, 21 May 2019 04:34:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C88D75A6E; Tue, 21 May 2019 04:34:52 +0200 (CEST) Received: from tama500.ecl.ntt.co.jp (tama500.ecl.ntt.co.jp [129.60.39.148]) by dpdk.org (Postfix) with ESMTP id 7096B4C9D for ; Tue, 21 May 2019 04:34:50 +0200 (CEST) Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4L2YnGn009128; Tue, 21 May 2019 11:34:49 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 48EC7638845; Tue, 21 May 2019 11:34:49 +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 3A42F638A37; Tue, 21 May 2019 11:34:49 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Tue, 21 May 2019 11:32:23 +0900 Message-Id: <1558405944-8355-8-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558405944-8355-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1558405944-8355-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 7/8] shared/sec: rename func for parsing MAC addr 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 `decode_mac_addr_str_value()` to `parse_mac_addr()` and refactor the function. Signed-off-by: Yasufumi Ogawa --- .../secondary/spp_worker_th/cmd_parser.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c index fc30463..064b18f 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.c +++ b/src/shared/secondary/spp_worker_th/cmd_parser.c @@ -597,22 +597,23 @@ parse_port_pcp(void *output, const char *arg_val, return SPP_RET_OK; } -/* decoding procedure of mac address string */ +/* Parse mac address string. */ static int -decode_mac_addr_str_value(void *output, const char *arg_val, - int allow_override __attribute__ ((unused))) +parse_mac_addr(void *output, const char *arg_val, + int allow_override __attribute__ ((unused))) { - int64_t ret = SPP_RET_OK; + int64_t res; const char *str_val = arg_val; - /* if default specification, convert to internal dummy address */ + /* If given value is the default, use dummy address instead. */ if (unlikely(strcmp(str_val, SPP_DEFAULT_CLASSIFIED_SPEC_STR) == 0)) str_val = SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR; - ret = spp_change_mac_str_to_int64(str_val); - if (unlikely(ret < SPP_RET_OK)) { + /* Check if the given value is valid. */ + res = spp_change_mac_str_to_int64(str_val); + if (unlikely(res < SPP_RET_OK)) { RTE_LOG(ERR, SPP_COMMAND_PROC, - "Bad mac address string. val=%s\n", str_val); + "Invalid MAC address `%s`.\n", str_val); return SPP_RET_NG; } @@ -759,7 +760,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { .name = "mac address", .offset = offsetof(struct spp_command, spec.cls_table.mac), - .func = decode_mac_addr_str_value + .func = parse_mac_addr }, { .name = "port", @@ -792,7 +793,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = { .name = "mac address", .offset = offsetof(struct spp_command, spec.cls_table.mac), - .func = decode_mac_addr_str_value + .func = parse_mac_addr }, { .name = "port", -- 2.17.1