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:16:11 +0200
committerMatias Elo <matias.elo@nokia.com>2020-12-23 09:57:05 +0200
commitb46b23bc4b50ec57d89cb376ae7478a5d134a139 (patch)
tree1ee51ee13f6f6fbc3fe7cae16747726f869db026 /platform/linux-dpdk/odp_system_info.c
parent035e1c1724025352e327a2df1da31222a2276a59 (diff)
linux-dpdk: system: use dpdk function rte_strsplit() directly
Remove copy of DPDK rte_strsplit() 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.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/platform/linux-dpdk/odp_system_info.c b/platform/linux-dpdk/odp_system_info.c
index f63ee77fb..3a0f59648 100644
--- a/platform/linux-dpdk/odp_system_info.c
+++ b/platform/linux-dpdk/odp_system_info.c
@@ -32,6 +32,7 @@
#include <inttypes.h>
#include <ctype.h>
+#include <rte_string_fns.h>
#include <rte_version.h>
/* sysconf */
@@ -114,34 +115,6 @@ static uint64_t default_huge_page_size(void)
}
/*
- * split string into tokens. largely "inspired" by dpdk:
- * lib/librte_eal/common/eal_common_string_fns.c: rte_strsplit
- */
-static int strsplit(char *string, int stringlen,
- char **tokens, int maxtokens, char delim)
-{
- int i, tok = 0;
- int tokstart = 1; /* first token is right at start of string */
-
- if (string == NULL || tokens == NULL)
- return -1;
-
- for (i = 0; i < stringlen; i++) {
- if (string[i] == '\0' || tok >= maxtokens)
- break;
- if (tokstart) {
- tokstart = 0;
- tokens[tok++] = &string[i];
- }
- if (string[i] == delim) {
- string[i] = '\0';
- tokstart = 1;
- }
- }
- return tok;
-}
-
-/*
* 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.
@@ -232,8 +205,8 @@ static char *get_hugepage_dir(uint64_t hugepage_sz)
hugepage_sz = default_size;
while (fgets(buf, sizeof(buf), fd)) {
- if (strsplit(buf, sizeof(buf), tokens,
- _FIELDNAME_MAX, split_tok) != _FIELDNAME_MAX) {
+ if (rte_strsplit(buf, sizeof(buf), tokens,
+ _FIELDNAME_MAX, split_tok) != _FIELDNAME_MAX) {
ODP_ERR("Error parsing %s\n", proc_mounts);
break; /* return NULL */
}