* [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes
@ 2020-03-09 12:42 Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 1/4] app/testfib: fix possible uninitialized warning Vladimir Medvedkin
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Vladimir Medvedkin @ 2020-03-09 12:42 UTC (permalink / raw)
To: dev
This patch series fixes compillation problems for some platforms.
Also it enables testfib app build with other applications.
Vladimir Medvedkin (4):
app/testfib: fix possible uninitialized warning
app/testfib: fix format string
app/testfib: get rid of libresolv dependency
app: enable test-fib application
app/Makefile | 1 +
app/meson.build | 3 +-
app/test-fib/Makefile | 2 -
app/test-fib/main.c | 118 +++++++++++++++++++++++++-------------------------
4 files changed, 62 insertions(+), 62 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 1/4] app/testfib: fix possible uninitialized warning
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
@ 2020-03-09 12:42 ` Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 2/4] app/testfib: fix format string Vladimir Medvedkin
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Medvedkin @ 2020-03-09 12:42 UTC (permalink / raw)
To: dev; +Cc: vladimir.medvedkin
Compiller can throw warning message for routes and lookup files.
Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: vladimir.medvedkin@intel.com
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
app/test-fib/main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index 3c29ca4..aa83f76 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -362,7 +362,7 @@ complete_v6_addr(uint32_t *addr, uint32_t rnd, int n)
static void
gen_random_rt_6(struct rt_rule_6 *rt, int nh_sz)
{
- uint32_t i, j, k = 0;
+ uint32_t a, i, j, k = 0;
if (config.nb_routes_per_depth[0] != 0) {
memset(rt[k].addr, 0, 16);
@@ -370,7 +370,7 @@ gen_random_rt_6(struct rt_rule_6 *rt, int nh_sz)
rt[k++].nh = rte_rand() & get_max_nh(nh_sz);
}
- for (int a = 0; a < 4; a++) {
+ for (a = 0; a < 4; a++) {
for (i = 1; i <= 32; i++) {
uint32_t rnd;
double edge = 0;
@@ -1145,7 +1145,8 @@ int
main(int argc, char **argv)
{
int ret, af, rt_ent_sz, lookup_ent_sz;
- FILE *fr, *fl;
+ FILE *fr = NULL;
+ FILE *fl = NULL;
uint8_t depth_lim;
ret = rte_eal_init(argc, argv);
@@ -1207,7 +1208,7 @@ main(int argc, char **argv)
rte_exit(-ENOMEM, "Can not alloc lookup table\n");
/* Fill routes table */
- if (config.routes_file == NULL) {
+ if (fr == NULL) {
if (distrib_string != NULL)
ret = parse_distrib(depth_lim, config.nb_routes);
else {
@@ -1243,7 +1244,7 @@ main(int argc, char **argv)
}
/* Fill lookup table with ip's*/
- if (config.lookup_ips_file == NULL)
+ if (fl == NULL)
gen_rnd_lookup_tbl(af);
else {
ret = parse_lookup(fl, af);
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 2/4] app/testfib: fix format string
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 1/4] app/testfib: fix possible uninitialized warning Vladimir Medvedkin
@ 2020-03-09 12:42 ` Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 3/4] app/testfib: get rid of libresolv dependency Vladimir Medvedkin
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Medvedkin @ 2020-03-09 12:42 UTC (permalink / raw)
To: dev; +Cc: vladimir.medvedkin
Change format for uint64_t to to %"PRIu64" to make compiller happy
Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: vladimir.medvedkin@intel.com
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
app/test-fib/main.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index aa83f76..7fd3420 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -790,7 +790,7 @@ dump_rt_4(struct rt_rule_4 *rt)
}
for (i = 0; i < config.nb_routes; i++)
- fprintf(f, NIPQUAD_FMT"/%d %lu\n", NIPQUAD(rt[i].addr),
+ fprintf(f, NIPQUAD_FMT"/%d %"PRIu64"\n", NIPQUAD(rt[i].addr),
rt[i].depth, rt[i].nh);
fclose(f);
@@ -858,7 +858,8 @@ run_v4(void)
return -ret;
}
}
- printf("AVG FIB add %lu\n", (rte_rdtsc_precise() - start) / j);
+ printf("AVG FIB add %"PRIu64"\n",
+ (rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -885,7 +886,7 @@ run_v4(void)
return -ret;
}
}
- printf("AVG LPM add %lu\n",
+ printf("AVG LPM add %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -939,7 +940,7 @@ run_v4(void)
for (j = 0; j < (config.nb_routes - i) / k; j++)
rte_fib_delete(fib, rt[i + j].addr, rt[i + j].depth);
- printf("AVG FIB delete %lu\n",
+ printf("AVG FIB delete %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -951,7 +952,7 @@ run_v4(void)
rte_lpm_delete(lpm, rt[i + j].addr,
rt[i + j].depth);
- printf("AVG LPM delete %lu\n",
+ printf("AVG LPM delete %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -973,7 +974,7 @@ dump_rt_6(struct rt_rule_6 *rt)
}
for (i = 0; i < config.nb_routes; i++) {
- fprintf(f, NIPQUAD6_FMT"/%d %lu\n", NIPQUAD6(rt[i].addr),
+ fprintf(f, NIPQUAD6_FMT"/%d %"PRIu64"\n", NIPQUAD6(rt[i].addr),
rt[i].depth, rt[i].nh);
}
@@ -1036,7 +1037,8 @@ run_v6(void)
return -ret;
}
}
- printf("AVG FIB add %lu\n", (rte_rdtsc_precise() - start) / j);
+ printf("AVG FIB add %"PRIu64"\n",
+ (rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -1063,7 +1065,7 @@ run_v6(void)
return -ret;
}
}
- printf("AVG LPM add %lu\n",
+ printf("AVG LPM add %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -1121,7 +1123,7 @@ run_v6(void)
for (j = 0; j < (config.nb_routes - i) / k; j++)
rte_fib6_delete(fib, rt[i + j].addr, rt[i + j].depth);
- printf("AVG FIB delete %lu\n",
+ printf("AVG FIB delete %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
@@ -1133,7 +1135,7 @@ run_v6(void)
rte_lpm6_delete(lpm, rt[i + j].addr,
rt[i + j].depth);
- printf("AVG LPM delete %lu\n",
+ printf("AVG LPM delete %"PRIu64"\n",
(rte_rdtsc_precise() - start) / j);
i += j;
}
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 3/4] app/testfib: get rid of libresolv dependency
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 1/4] app/testfib: fix possible uninitialized warning Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 2/4] app/testfib: fix format string Vladimir Medvedkin
@ 2020-03-09 12:42 ` Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 4/4] app: enable test-fib application Vladimir Medvedkin
2020-04-10 9:46 ` [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes David Marchand
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Medvedkin @ 2020-03-09 12:42 UTC (permalink / raw)
To: dev
Get rid of using inet_net_pton(). Implement it internally in the app.
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
app/test-fib/Makefile | 2 --
app/test-fib/main.c | 85 +++++++++++++++++++++++++--------------------------
2 files changed, 41 insertions(+), 46 deletions(-)
diff --git a/app/test-fib/Makefile b/app/test-fib/Makefile
index 78b45fe..9da34eb 100644
--- a/app/test-fib/Makefile
+++ b/app/test-fib/Makefile
@@ -11,8 +11,6 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS += -lresolv
-
# all source are stored in SRCS-y
SRCS-y := main.c
diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index 7fd3420..5fb67f3 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -2,14 +2,10 @@
* Copyright(c) 2019 Intel Corporation
*/
-#include <rte_string_fns.h>
#include <getopt.h>
#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
#include <rte_cycles.h>
#include <rte_errno.h>
@@ -444,46 +440,12 @@ gen_rnd_lookup_tbl(int af)
}
static int
-parse_rt_4(FILE *f)
-{
- int ret, i, j = 0;
- char *s, *sp, *in[RT_NUM];
- static const char *dlm = " \t\n";
- int string_tok_nb = RTE_DIM(in);
- struct rt_rule_4 *rt;
-
- rt = (struct rt_rule_4 *)config.rt;
-
- while (fgets(line, sizeof(line), f) != NULL) {
- s = line;
- for (i = 0; i != string_tok_nb; i++) {
- in[i] = strtok_r(s, dlm, &sp);
- if (in[i] == NULL)
- return -EINVAL;
- s = NULL;
- }
-
- ret = inet_net_pton(AF_INET, in[RT_PREFIX], &rt[j].addr,
- sizeof(rt[j].addr));
- if (ret == -1)
- return -errno;
-
- rt[j].addr = rte_be_to_cpu_32(rt[j].addr);
- rt[j].depth = ret;
- config.nb_routes_per_depth[ret]++;
- GET_CB_FIELD(in[RT_NEXTHOP], rt[j].nh, 0,
- UINT32_MAX, 0);
- j++;
- }
- return 0;
-}
-
-static int
-__inet_net_pton6(char *prefix, uint8_t *addr)
+_inet_net_pton(int af, char *prefix, void *addr)
{
const char *dlm = "/";
char *s, *sp;
int ret, depth;
+ unsigned max_depth;
if ((prefix == NULL) || (addr == NULL))
return -EINVAL;
@@ -492,17 +454,52 @@ __inet_net_pton6(char *prefix, uint8_t *addr)
if (s == NULL)
return -EINVAL;
- ret = inet_pton(AF_INET6, s, addr);
+ ret = inet_pton(af, s, addr);
if (ret != 1)
return -errno;
s = strtok_r(NULL, dlm, &sp);
- GET_CB_FIELD(s, depth, 0, 128, 0);
+ max_depth = (af == AF_INET) ? 32 : 128;
+ GET_CB_FIELD(s, depth, 0, max_depth, 0);
return depth;
}
static int
+parse_rt_4(FILE *f)
+{
+ int ret, i, j = 0;
+ char *s, *sp, *in[RT_NUM];
+ static const char *dlm = " \t\n";
+ int string_tok_nb = RTE_DIM(in);
+ struct rt_rule_4 *rt;
+
+ rt = (struct rt_rule_4 *)config.rt;
+
+ while (fgets(line, sizeof(line), f) != NULL) {
+ s = line;
+ for (i = 0; i != string_tok_nb; i++) {
+ in[i] = strtok_r(s, dlm, &sp);
+ if (in[i] == NULL)
+ return -EINVAL;
+ s = NULL;
+ }
+
+ ret = _inet_net_pton(AF_INET, in[RT_PREFIX], &rt[j].addr);
+ if (ret == -1)
+ return -errno;
+
+ rt[j].addr = rte_be_to_cpu_32(rt[j].addr);
+ rt[j].depth = ret;
+ config.nb_routes_per_depth[ret]++;
+ GET_CB_FIELD(in[RT_NEXTHOP], rt[j].nh, 0,
+ UINT32_MAX, 0);
+ j++;
+ }
+ return 0;
+}
+
+static int
parse_rt_6(FILE *f)
{
int ret, i, j = 0;
@@ -522,7 +519,7 @@ parse_rt_6(FILE *f)
s = NULL;
}
- ret = __inet_net_pton6(in[RT_PREFIX], rt[j].addr);
+ ret = _inet_net_pton(AF_INET6, in[RT_PREFIX], rt[j].addr);
if (ret < 0)
return ret;
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 4/4] app: enable test-fib application
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
` (2 preceding siblings ...)
2020-03-09 12:42 ` [dpdk-dev] [PATCH 3/4] app/testfib: get rid of libresolv dependency Vladimir Medvedkin
@ 2020-03-09 12:42 ` Vladimir Medvedkin
2020-04-10 9:46 ` [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes David Marchand
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Medvedkin @ 2020-03-09 12:42 UTC (permalink / raw)
To: dev
Build test-fib application
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
app/Makefile | 1 +
app/meson.build | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/Makefile b/app/Makefile
index db9d2d5..9fd62fb 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -11,6 +11,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_ACL) += test-acl
DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test-cmdline
DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test-pipeline
DIRS-$(CONFIG_RTE_LIBRTE_IPSEC) += test-sad
+DIRS-$(CONFIG_RTE_LIBRTE_FIB) += test-fib
ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y)
DIRS-$(CONFIG_RTE_TEST_BBDEV) += test-bbdev
diff --git a/app/meson.build b/app/meson.build
index 71109cc..3f3512f 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -16,7 +16,8 @@ apps = [
'test-eventdev',
'test-pipeline',
'test-pmd',
- 'test-sad']
+ 'test-sad',
+ 'test-fib']
# for BSD only
lib_execinfo = cc.find_library('execinfo', required: false)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
` (3 preceding siblings ...)
2020-03-09 12:42 ` [dpdk-dev] [PATCH 4/4] app: enable test-fib application Vladimir Medvedkin
@ 2020-04-10 9:46 ` David Marchand
4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2020-04-10 9:46 UTC (permalink / raw)
To: Vladimir Medvedkin; +Cc: dev
On Mon, Mar 9, 2020 at 1:42 PM Vladimir Medvedkin
<vladimir.medvedkin@intel.com> wrote:
>
> This patch series fixes compillation problems for some platforms.
> Also it enables testfib app build with other applications.
>
> Vladimir Medvedkin (4):
> app/testfib: fix possible uninitialized warning
> app/testfib: fix format string
> app/testfib: get rid of libresolv dependency
> app: enable test-fib application
Series applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-10 9:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 12:42 [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 1/4] app/testfib: fix possible uninitialized warning Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 2/4] app/testfib: fix format string Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 3/4] app/testfib: get rid of libresolv dependency Vladimir Medvedkin
2020-03-09 12:42 ` [dpdk-dev] [PATCH 4/4] app: enable test-fib application Vladimir Medvedkin
2020-04-10 9:46 ` [dpdk-dev] [PATCH 0/4] app/testfib: testfib app various fixes David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).