app/test: minor updates
authorBruce Richardson <bruce.richardson@intel.com>
Wed, 12 Feb 2014 16:05:56 +0000 (16:05 +0000)
committerDavid Marchand <david.marchand@6wind.com>
Wed, 26 Feb 2014 09:22:33 +0000 (10:22 +0100)
Minor fixes/updates to the autotest app, including:
* replace hard-coded values with #defines in rte_power.h
* replace local DIM() macro with common RTE_DIM

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
app/test/commands.c
app/test/test_kni.c
app/test/test_power.c
app/test/test_red.c

index f09bc90..6b14d2c 100644 (file)
@@ -64,7 +64,6 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
-#include <rte_timer.h>
 
 #include <cmdline_rdline.h>
 #include <cmdline_parse.h>
@@ -215,7 +214,7 @@ cmdline_parse_token_string_t cmd_autotest_autotest =
                        "timer_autotest#malloc_autotest#"
                        "memcpy_autotest#hash_autotest#"
                        "lpm_autotest#debug_autotest#"
-                       "lpm6_autotest#debug_autotest#"
+                       "lpm6_autotest#"
                        "errno_autotest#tailq_autotest#"
                        "string_autotest#multiprocess_autotest#"
                        "cpuflags_autotest#eal_flags_autotest#"
index b2ecfdc..cd87c3c 100644 (file)
@@ -210,6 +210,7 @@ test_kni_loop(__rte_unused void *arg)
                                        rte_pktmbuf_free(pkts_burst[i]);
                                }
                        }
+                       rte_delay_ms(10);
                }
        } else if (lcore_id == lcore_egress) {
                while (1) {
@@ -220,6 +221,7 @@ test_kni_loop(__rte_unused void *arg)
                        stats.egress += num;
                        for (nb_tx = 0; nb_tx < num; nb_tx++)
                                rte_pktmbuf_free(pkts_burst[nb_tx]);
+                       rte_delay_ms(10);
                }
        }
 
index bcc98d1..5bc90c8 100644 (file)
@@ -200,7 +200,7 @@ check_power_set_freq(void)
                                                TEST_POWER_LCORE_ID);
                return -1;
        }
-       ret = rte_power_set_freq(TEST_POWER_LCORE_ID, 3);
+       ret = rte_power_set_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
        if (ret < 0) {
                printf("Fail to set freq index on lcore %u\n",
                                        TEST_POWER_LCORE_ID);
@@ -208,7 +208,7 @@ check_power_set_freq(void)
        }
 
        /* Check the current frequency */
-       ret = check_cur_freq(TEST_POWER_LCORE_ID, 3);
+       ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1);
        if (ret < 0)
                return -1;
 
@@ -416,6 +416,12 @@ test_power(void)
        if (ret < 0)
                goto fail_all;
 
+       if (total_freq_num < 2) {
+               rte_power_exit(TEST_POWER_LCORE_ID);
+               printf("Frequency can not be changed due to CPU itself\n");
+               return 0;
+       }
+
        ret = check_power_get_freq();
        if (ret < 0)
                goto fail_all;
index 5ad1e26..f394425 100644 (file)
@@ -53,7 +53,6 @@
 #pragma warning(disable:181)        /* Arg incompatible with format string */
 #endif
 
-#define DIM(x) (sizeof(x)/sizeof(x[0]))
 #define TEST_HZ_PER_KHZ 1000
 #define TEST_NSEC_MARGIN 500        /**< nanosecond margin when calculating clk freq */
 
@@ -429,7 +428,7 @@ static uint32_t  ft_enqueued[] ={0};
 
 static struct test_rte_red_config ft_tconfig =  {
        .rconfig = ft_wrconfig,
-       .num_cfg = DIM(ft_wrconfig),
+       .num_cfg = RTE_DIM(ft_wrconfig),
        .wq_log2 = ft_wq_log2,
        .min_th = 32,
        .max_th = 128,
@@ -438,7 +437,7 @@ static struct test_rte_red_config ft_tconfig =  {
 
 static struct test_queue ft_tqueue = {
        .rdata = ft_rtdata,
-       .num_queues = DIM(ft_rtdata),
+       .num_queues = RTE_DIM(ft_rtdata),
        .qconfig = ft_qconfig,
        .q = ft_q,
        .q_ramp_up = 1000000,
@@ -522,7 +521,7 @@ static enum test_result func_test1(struct test_config *tcfg)
 
        printf("%s", tcfg->htxt); 
 
-       for (i = 0; i < DIM(ft1_tlevels); i++) {
+       for (i = 0; i < RTE_DIM(ft1_tlevels); i++) {
                const char *label = NULL;
                uint32_t avg = 0;
                double drop_rate = 0.0;
@@ -598,7 +597,7 @@ static struct rte_red_config ft2_rconfig[10];
 
 static struct test_rte_red_config ft2_tconfig =  {
        .rconfig = ft2_rconfig,
-       .num_cfg = DIM(ft2_rconfig),
+       .num_cfg = RTE_DIM(ft2_rconfig),
        .wq_log2 = ft2_wq_log2,
        .min_th = 32,
        .max_th = 128,
@@ -706,7 +705,7 @@ static uint32_t ft3_tlevel[] = {1022};
 
 static struct test_rte_red_config ft3_tconfig =  {
        .rconfig = ft_wrconfig,
-       .num_cfg = DIM(ft_wrconfig),
+       .num_cfg = RTE_DIM(ft_wrconfig),
        .wq_log2 = ft_wq_log2,
        .min_th = 32,
        .max_th = 1023,
@@ -820,7 +819,7 @@ static uint8_t ft4_wq_log2[] = {11};
 
 static struct test_rte_red_config ft4_tconfig =  {
        .rconfig = ft_wrconfig,
-       .num_cfg = DIM(ft_wrconfig),
+       .num_cfg = RTE_DIM(ft_wrconfig),
        .min_th = 32,
        .max_th = 1023,
        .wq_log2 = ft4_wq_log2,
@@ -829,7 +828,7 @@ static struct test_rte_red_config ft4_tconfig =  {
 
 static struct test_queue ft4_tqueue = {
        .rdata = ft_rtdata,
-       .num_queues = DIM(ft_rtdata),
+       .num_queues = RTE_DIM(ft_rtdata),
        .qconfig = ft_qconfig,
        .q = ft_q,
        .q_ramp_up = 1000000,
@@ -968,7 +967,7 @@ static uint32_t ft5_enqueued[] = {0, 0, 0, 0};
 
 static struct test_rte_red_config ft5_tconfig =  {
        .rconfig = ft5_config,
-       .num_cfg = DIM(ft5_config),
+       .num_cfg = RTE_DIM(ft5_config),
        .min_th = 32,
        .max_th = 128,
        .wq_log2 = ft5_wq_log2,
@@ -977,7 +976,7 @@ static struct test_rte_red_config ft5_tconfig =  {
 
 static struct test_queue ft5_tqueue = {
        .rdata = ft5_data,
-       .num_queues = DIM(ft5_data),
+       .num_queues = RTE_DIM(ft5_data),
        .qconfig = ft_qconfig,
        .q = ft5_q,
        .q_ramp_up = 1000000,
@@ -1106,7 +1105,7 @@ static uint32_t ft6_q[4];
 
 static struct test_rte_red_config ft6_tconfig =  {
        .rconfig = ft6_config,
-       .num_cfg = DIM(ft6_config),
+       .num_cfg = RTE_DIM(ft6_config),
        .min_th = 32,
        .max_th = 1023,
        .wq_log2 = ft6_wq_log2,
@@ -1115,7 +1114,7 @@ static struct test_rte_red_config ft6_tconfig =  {
 
 static struct test_queue ft6_tqueue = {
        .rdata = ft6_data,
-       .num_queues = DIM(ft6_data),
+       .num_queues = RTE_DIM(ft6_data),
        .qconfig = ft_qconfig,
        .q = ft6_q,
        .q_ramp_up = 1000000,
@@ -1239,7 +1238,7 @@ static uint32_t pt_enqueued[] = {0};
 
 static struct test_rte_red_config pt_tconfig =  {
        .rconfig = pt_wrconfig,
-       .num_cfg = DIM(pt_wrconfig),
+       .num_cfg = RTE_DIM(pt_wrconfig),
        .wq_log2 = pt_wq_log2,
        .min_th = 32,
        .max_th = 128,
@@ -1248,7 +1247,7 @@ static struct test_rte_red_config pt_tconfig =  {
 
 static struct test_queue pt_tqueue = {
        .rdata = pt_rtdata,
-       .num_queues = DIM(pt_rtdata),
+       .num_queues = RTE_DIM(pt_rtdata),
        .qconfig = pt_qconfig,
        .q = pt_q,
        .q_ramp_up = 1000000,
@@ -1601,7 +1600,7 @@ static uint8_t ovfl_wq_log2[] = {12};
 
 static struct test_rte_red_config ovfl_tconfig =  {
        .rconfig = ovfl_wrconfig,
-       .num_cfg = DIM(ovfl_wrconfig),
+       .num_cfg = RTE_DIM(ovfl_wrconfig),
        .wq_log2 = ovfl_wq_log2,
        .min_th = 32,
        .max_th = 1023,
@@ -1610,7 +1609,7 @@ static struct test_rte_red_config ovfl_tconfig =  {
 
 static struct test_queue ovfl_tqueue = {
        .rdata = ovfl_rtdata,
-       .num_queues = DIM(ovfl_rtdata),
+       .num_queues = RTE_DIM(ovfl_rtdata),
        .qconfig = ovfl_qconfig,
        .q = ovfl_q,
        .q_ramp_up = 1000000,
@@ -1872,8 +1871,8 @@ int test_red(void)
        if (test_invalid_parameters() < 0)
                return -1;
 
-       run_tests(func_tests, DIM(func_tests), &num_tests, &num_pass);
-       run_tests(perf_tests, DIM(perf_tests), &num_tests, &num_pass);
+       run_tests(func_tests, RTE_DIM(func_tests), &num_tests, &num_pass);
+       run_tests(perf_tests, RTE_DIM(perf_tests), &num_tests, &num_pass);
 
        if (num_pass == num_tests) {
                printf("[total: %u, pass: %u]\n", num_tests, num_pass);