]> git.droids-corp.org - dpdk.git/commitdiff
net/hns3: remove magic numbers
authorHuisong Li <lihuisong@huawei.com>
Sat, 6 Nov 2021 01:43:04 +0000 (09:43 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 8 Nov 2021 14:59:14 +0000 (15:59 +0100)
Removing magic numbers with macros.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/hns3/hns3_common.c
drivers/net/hns3/hns3_common.h

index 85316d3425ca7a00e188ee456204dba6f078e934..c306e0b0eded6aecf42e68f4fe7694c859914fd0 100644 (file)
@@ -54,7 +54,7 @@ hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args)
 
        RTE_SET_USED(key);
 
-       val = strtoull(value, NULL, 16);
+       val = strtoull(value, NULL, HNS3_CONVERT_TO_HEXADECIMAL);
        *(uint64_t *)extra_args = val;
 
        return 0;
@@ -67,7 +67,7 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args)
 
        RTE_SET_USED(key);
 
-       val = strtoul(value, NULL, 10);
+       val = strtoul(value, NULL, HNS3_CONVERT_TO_DECIMAL);
        if (val > HNS3_MBX_DEF_TIME_LIMIT_MS && val <= UINT16_MAX)
                *(uint16_t *)extra_args = val;
 
index 094a0bc5ff2634291765594b81a6175a61caa3c0..68f9b1b96ae150856da473c2b5d15d8ac20b7d08 100644 (file)
@@ -9,6 +9,9 @@
 
 #include "hns3_ethdev.h"
 
+#define HNS3_CONVERT_TO_DECIMAL 10
+#define HNS3_CONVERT_TO_HEXADECIMAL 16
+
 enum {
        HNS3_IO_FUNC_HINT_NONE = 0,
        HNS3_IO_FUNC_HINT_VEC,