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 231B2A05D3 for ; Tue, 21 May 2019 04:33:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 300844F91; Tue, 21 May 2019 04:33:50 +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 99A8A4C96 for ; Tue, 21 May 2019 04:33:48 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4L2XlPB009102; Tue, 21 May 2019 11:33:47 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id F4013EA78C6; Tue, 21 May 2019 11:33:46 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id E3418EA7A87; Tue, 21 May 2019 11:33:46 +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:31:21 +0900 Message-Id: <1558405882-8201-6-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558405882-8201-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1558405882-8201-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 5/6] shared/sec: fix funcs for getting int and uint 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 `get_uint_value()` was renamed as `get_vlan_uint_val()`, but it is used lcore ID. `get_int_value()` was also renamed as `get_vlan_int_val()` which is used for getting VLAN ID, but can be used for other purposes. The term `vlan` should be removed from these funcs. In addition, the names do not contain that checking the given value is in the given range. This update is to fix the issues. Signed-off-by: Yasufumi Ogawa --- .../secondary/spp_worker_th/cmd_parser.c | 20 +++++++++---------- 1 file changed, 10 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 5658893..e0da244 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.c +++ b/src/shared/secondary/spp_worker_th/cmd_parser.c @@ -220,11 +220,11 @@ get_list_idx(const char *str, const char *list[]) } /** - * Get VLAN ID or PCP as int from given val. It validates if the val is in the - * range from min to max given as third and fourth args. + * Get int from given val. It validates if the val is in the range from min to + * max given as third and fourth args. It is intended to get VLAN ID or PCP. */ static int -get_vlan_int_val(int *output, const char *arg_val, int min, int max) +get_int_in_range(int *output, const char *arg_val, int min, int max) { int ret; char *endptr = NULL; @@ -238,11 +238,11 @@ get_vlan_int_val(int *output, const char *arg_val, int min, int max) } /** - * Get VLAN ID or PCP as uint from given val. It validates if the val is in the - * range from min to max given as third and fourth args. + * Get uint from given val. It validates if the val is in the range from min to + * max given as third and fourth args. It is intended to get lcore ID. */ static int -get_vlan_uint_val(unsigned int *output, const char *arg_val, unsigned int min, +get_uint_in_range(unsigned int *output, const char *arg_val, unsigned int min, unsigned int max) { unsigned int ret; @@ -283,7 +283,7 @@ static int decode_core_value(void *output, const char *arg_val) { int ret = SPP_RET_OK; - ret = get_vlan_uint_val(output, arg_val, 0, RTE_MAX_LCORE-1); + ret = get_uint_in_range(output, arg_val, 0, RTE_MAX_LCORE-1); if (unlikely(ret < 0)) { RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad core id. val=%s\n", arg_val); @@ -536,7 +536,7 @@ decode_port_vid(void *output, const char *arg_val, switch (ability->ope) { case SPP_PORT_ABILITY_OPE_ADD_VLANTAG: - ret = get_vlan_int_val(&ability->data.vlantag.vid, + ret = get_int_in_range(&ability->data.vlantag.vid, arg_val, 0, ETH_VLAN_ID_MAX); if (unlikely(ret < SPP_RET_OK)) { RTE_LOG(ERR, SPP_COMMAND_PROC, @@ -564,7 +564,7 @@ decode_port_pcp(void *output, const char *arg_val, switch (ability->ope) { case SPP_PORT_ABILITY_OPE_ADD_VLANTAG: - ret = get_vlan_int_val(&ability->data.vlantag.pcp, + ret = get_int_in_range(&ability->data.vlantag.pcp, arg_val, 0, SPP_VLAN_PCP_MAX); if (unlikely(ret < SPP_RET_OK)) { RTE_LOG(ERR, SPP_COMMAND_PROC, @@ -651,7 +651,7 @@ decode_classifier_vid_value(void *output, const char *arg_val, int allow_override __attribute__ ((unused))) { int ret = SPP_RET_NG; - ret = get_vlan_int_val(output, arg_val, 0, ETH_VLAN_ID_MAX); + ret = get_int_in_range(output, arg_val, 0, ETH_VLAN_ID_MAX); if (unlikely(ret < SPP_RET_OK)) { RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad VLAN ID. val=%s\n", arg_val); -- 2.17.1