git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lpm: fix pipeline apps
[dpdk.git]
/
app
/
test
/
test_red.c
diff --git
a/app/test/test_red.c
b/app/test/test_red.c
index
bb62aba
..
81c9d67
100644
(file)
--- a/
app/test/test_red.c
+++ b/
app/test/test_red.c
@@
-43,8
+43,6
@@
#include "test.h"
#include "test.h"
-#ifdef RTE_LIBRTE_SCHED
-
#include <rte_red.h>
#ifdef __INTEL_COMPILER
#include <rte_red.h>
#ifdef __INTEL_COMPILER
@@
-148,16
+146,7
@@
static void rdtsc_prof_init(struct rdtsc_prof *p, const char *name)
static inline void rdtsc_prof_start(struct rdtsc_prof *p)
{
static inline void rdtsc_prof_start(struct rdtsc_prof *p)
{
-#ifdef __PIC__
- asm volatile (
- "mov %%ebx, %%edi\n"
- "cpuid\n"
- "xchgl %%ebx, %%edi;\n"
- : : : "%eax", "%edi", "%ecx", "%edx" );
-#else
- asm( "cpuid" : : : "%eax", "%ebx", "%ecx", "%edx" );
-#endif
- p->clk_start = rte_rdtsc();
+ p->clk_start = rte_rdtsc_precise();
}
static inline void rdtsc_prof_end(struct rdtsc_prof *p)
}
static inline void rdtsc_prof_end(struct rdtsc_prof *p)
@@
-240,7
+229,7
@@
static double calc_drop_prob(uint32_t min_th, uint32_t max_th,
} else {
drop_prob = 1.0;
}
} else {
drop_prob = 1.0;
}
- return
(drop_prob)
;
+ return
drop_prob
;
}
/**
}
/**
@@
-260,7
+249,7
@@
static int check_drop_rate(double *diff, double drop_rate, double drop_prob, dou
ret = 0;
}
}
ret = 0;
}
}
- return
(ret)
;
+ return
ret
;
}
/**
}
/**
@@
-280,7
+269,7
@@
static int check_avg(double *diff, double avg, double exp_avg, double tolerance)
ret = 0;
}
}
ret = 0;
}
}
- return
(ret)
;
+ return
ret
;
}
/**
}
/**
@@
-314,10
+303,10
@@
static uint64_t get_machclk_freq(void)
USEC_PER_MSEC); /**< diff is in micro secs */
if (diff == 0)
USEC_PER_MSEC); /**< diff is in micro secs */
if (diff == 0)
- return
(0)
;
+ return
0
;
clk_freq_hz = ((end - start) * USEC_PER_SEC / diff);
clk_freq_hz = ((end - start) * USEC_PER_SEC / diff);
- return
(clk_freq_hz)
;
+ return
clk_freq_hz
;
}
/**
}
/**
@@
-337,14
+326,14
@@
test_rte_red_init(struct test_config *tcfg)
(uint16_t)tcfg->tconfig->min_th,
(uint16_t)tcfg->tconfig->max_th,
(uint16_t)tcfg->tconfig->maxp_inv[i]) != 0) {
(uint16_t)tcfg->tconfig->min_th,
(uint16_t)tcfg->tconfig->max_th,
(uint16_t)tcfg->tconfig->maxp_inv[i]) != 0) {
- return
(FAIL)
;
+ return
FAIL
;
}
}
*tcfg->tqueue->q = 0;
*tcfg->tvar->dropped = 0;
*tcfg->tvar->enqueued = 0;
}
}
*tcfg->tqueue->q = 0;
*tcfg->tvar->dropped = 0;
*tcfg->tvar->enqueued = 0;
- return
(PASS)
;
+ return
PASS
;
}
/**
}
/**
@@
-375,11
+364,11
@@
increase_actual_qsize(struct rte_red_config *red_cfg,
* check if target actual queue size has been reached
*/
if (*q != level)
* check if target actual queue size has been reached
*/
if (*q != level)
- return
(-1)
;
+ return
-1
;
/**
* success
*/
/**
* success
*/
- return
(0)
;
+ return
0
;
}
/**
}
/**
@@
-406,11
+395,11
@@
increase_average_qsize(struct rte_red_config *red_cfg,
*/
avg = rte_red_get_avg_int(red_cfg, red);
if (avg != level)
*/
avg = rte_red_get_avg_int(red_cfg, red);
if (avg != level)
- return
(-1)
;
+ return
-1
;
/**
* success
*/
/**
* success
*/
- return
(0)
;
+ return
0
;
}
/**
}
/**
@@
-583,7
+572,7
@@
static enum test_result func_test1(struct test_config *tcfg)
(double)tcfg->tqueue->drop_tolerance);
}
out:
(double)tcfg->tqueue->drop_tolerance);
}
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-694,7
+683,7
@@
static enum test_result func_test2(struct test_config *tcfg)
(double)tcfg->tqueue->drop_tolerance);
}
out:
(double)tcfg->tqueue->drop_tolerance);
}
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-807,7
+796,7
@@
static enum test_result func_test3(struct test_config *tcfg)
diff <= (double)tcfg->tqueue->avg_tolerance ? "pass" : "fail");
}
out:
diff <= (double)tcfg->tqueue->avg_tolerance ? "pass" : "fail");
}
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-949,7
+938,7
@@
static enum test_result func_test4(struct test_config *tcfg)
diff, (double)tcfg->tqueue->avg_tolerance,
diff <= (double)tcfg->tqueue->avg_tolerance ? "pass" : "fail");
out:
diff, (double)tcfg->tqueue->avg_tolerance,
diff <= (double)tcfg->tqueue->avg_tolerance ? "pass" : "fail");
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1089,7
+1078,7
@@
static enum test_result func_test5(struct test_config *tcfg)
diff, (double)tcfg->tqueue->drop_tolerance);
}
out:
diff, (double)tcfg->tqueue->drop_tolerance);
}
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1220,7
+1209,7
@@
static enum test_result func_test6(struct test_config *tcfg)
diff <= tcfg->tqueue->avg_tolerance ? "pass" : "fail");
}
out:
diff <= tcfg->tqueue->avg_tolerance ? "pass" : "fail");
}
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1391,7
+1380,7
@@
static enum test_result perf1_test(struct test_config *tcfg)
rdtsc_prof_print(&prof);
out:
rdtsc_prof_print(&prof);
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1578,7
+1567,7
@@
static enum test_result perf2_test(struct test_config *tcfg)
rdtsc_prof_print(&prof);
out:
rdtsc_prof_print(&prof);
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1742,7
+1731,7
@@
static enum test_result ovfl_test1(struct test_config *tcfg)
*tcfg->tvar->enqueued, *tcfg->tvar->dropped,
drop_prob * 100.0, drop_rate * 100.0);
out:
*tcfg->tvar->enqueued, *tcfg->tvar->dropped,
drop_prob * 100.0, drop_rate * 100.0);
out:
- return
(result)
;
+ return
result
;
}
/**
}
/**
@@
-1861,7
+1850,8
@@
test_invalid_parameters(void)
return 0;
}
return 0;
}
-int test_red(void)
+static int
+test_red(void)
{
uint32_t num_tests = 0;
uint32_t num_pass = 0;
{
uint32_t num_tests = 0;
uint32_t num_pass = 0;
@@
-1880,16
+1870,11
@@
int test_red(void)
printf("[total: %u, pass: %u, fail: %u]\n", num_tests, num_pass, num_tests - num_pass);
ret = -1;
}
printf("[total: %u, pass: %u, fail: %u]\n", num_tests, num_pass, num_tests - num_pass);
ret = -1;
}
- return (ret);
-}
-
-#else
-
-int
-test_red(void)
-{
- printf("The SCHED library is not included in this build\n");
- return 0;
+ return ret;
}
}
-#endif
+static struct test_command red_cmd = {
+ .command = "red_autotest",
+ .callback = test_red,
+};
+REGISTER_TEST_COMMAND(red_cmd);