aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/odp_system_info.c
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2020-11-18 18:21:54 +0200
committerMatias Elo <matias.elo@nokia.com>2020-12-23 09:57:05 +0200
commit7329e722ea800485ce3493d592b8fd909f56636f (patch)
treefa96ef93f4cd506932103cc582584a60f210093c /platform/linux-dpdk/odp_system_info.c
parentb46b23bc4b50ec57d89cb376ae7478a5d134a139 (diff)
linux-dpdk: system: use dpdk function rte_str_to_size() directly
Remove copy of DPDK rte_str_to_size() function. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-dpdk/odp_system_info.c')
-rw-r--r--platform/linux-dpdk/odp_system_info.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/platform/linux-dpdk/odp_system_info.c b/platform/linux-dpdk/odp_system_info.c
index 3a0f59648..e9c81328f 100644
--- a/platform/linux-dpdk/odp_system_info.c
+++ b/platform/linux-dpdk/odp_system_info.c
@@ -115,56 +115,6 @@ static uint64_t default_huge_page_size(void)
}
/*
- * Converts a numeric string to the equivalent uint64_t value.
- * As well as straight number conversion, also recognises the suffixes
- * k, m and g for kilobytes, megabytes and gigabytes respectively.
- *
- * If a negative number is passed in i.e. a string with the first non-black
- * character being "-", zero is returned. Zero is also returned in the case of
- * an error with the strtoull call in the function.
- * largely "inspired" by dpdk:
- * lib/librte_eal/common/include/rte_common.h: rte_str_to_size
- *
- * param str
- * String containing number to convert.
- * return
- * Number.
- */
-static inline uint64_t str_to_size(const char *str)
-{
- char *endptr;
- unsigned long long size;
-
- while (isspace((int)*str))
- str++;
- if (*str == '-')
- return 0;
-
- errno = 0;
- size = strtoull(str, &endptr, 0);
- if (errno)
- return 0;
-
- if (*endptr == ' ')
- endptr++; /* allow 1 space gap */
-
- switch (*endptr) {
- case 'G':
- case 'g':
- size *= 1024; /* fall-through */
- case 'M':
- case 'm':
- size *= 1024; /* fall-through */
- case 'K':
- case 'k':
- size *= 1024; /* fall-through */
- default:
- break;
- }
- return size;
-}
-
-/*
* returns a malloced string containing the name of the directory for
* huge pages of a given size (0 for default)
* largely "inspired" by dpdk:
@@ -222,8 +172,7 @@ static char *get_hugepage_dir(uint64_t hugepage_sz)
break;
}
} else { /* there is an explicit page size, so check it */
- pagesz =
- str_to_size(&pagesz_str[pagesize_opt_len]);
+ pagesz = rte_str_to_size(&pagesz_str[pagesize_opt_len]);
if (pagesz == hugepage_sz) {
retval = strdup(tokens[MOUNTPT]);
break;