diff options
author | Ricardo Salveti <ricardo.salveti@linaro.org> | 2016-07-18 15:30:53 -0300 |
---|---|---|
committer | Ricardo Salveti <ricardo.salveti@linaro.org> | 2016-07-18 15:31:22 -0300 |
commit | 5d4e5dcd8a186778b3d78e27c81550d07a288fd2 (patch) | |
tree | b84800fce31e7233445a7997c19df409c2a364ea | |
parent | a41e6ff15809d40e0f9bbc9576bf8f7f80fbec1d (diff) |
Imported Upstream version 16.07-rc3
Change-Id: I321148bfa234858ba1986d109470b7aa280cd429
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
113 files changed, 467 insertions, 596 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index f996c2ed..9c763529 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -253,7 +253,7 @@ F: app/test/test_link_bonding* F: examples/bond/ Linux KNI -M: Helin Zhang <helin.zhang@intel.com> +M: Ferruh Yigit <ferruh.yigit@intel.com> F: lib/librte_eal/linuxapp/kni/ F: lib/librte_kni/ F: doc/guides/prog_guide/kernel_nic_interface.rst diff --git a/app/pdump/main.c b/app/pdump/main.c index 2087c159..e0ff8bea 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -55,6 +55,7 @@ #include <rte_ring.h> #include <rte_pdump.h> +#define CMD_LINE_OPT_PDUMP "pdump" #define PDUMP_PORT_ARG "port" #define PDUMP_PCI_ARG "device_id" #define PDUMP_QUEUE_ARG "queue" @@ -64,6 +65,8 @@ #define PDUMP_RING_SIZE_ARG "ring-size" #define PDUMP_MSIZE_ARG "mbuf-size" #define PDUMP_NUM_MBUFS_ARG "total-num-mbufs" +#define CMD_LINE_OPT_SER_SOCK_PATH "server-socket-path" +#define CMD_LINE_OPT_CLI_SOCK_PATH "client-socket-path" #define VDEV_PCAP "eth_pcap_%s_%d,tx_pcap=%s" #define VDEV_IFACE "eth_pcap_%s_%d,tx_iface=%s" @@ -166,6 +169,8 @@ struct parse_val { int num_tuples; static struct rte_eth_conf port_conf_default; volatile uint8_t quit_signal; +static char server_socket_path[PATH_MAX]; +static char client_socket_path[PATH_MAX]; /**< display usage */ static void @@ -178,8 +183,11 @@ pdump_usage(const char *prgname) " tx-dev=<iface or pcap file>," "[ring-size=<ring size>default:16384]," "[mbuf-size=<mbuf data size>default:2176]," - "[total-num-mbufs=<number of mbufs>default:65535]" - "'\n", + "[total-num-mbufs=<number of mbufs>default:65535]'\n" + "[--server-socket-path=<server socket dir>" + "default:/var/run/.dpdk/ (or) ~/.dpdk/]\n" + "[--client-socket-path=<client socket dir>" + "default:/var/run/.dpdk/ (or) ~/.dpdk/]\n", prgname); } @@ -226,9 +234,6 @@ parse_rxtxdev(const char *key, const char *value, void *extra_args) /* identify the tx stream type for pcap vdev */ if (if_nametoindex(pt->tx_dev)) pt->tx_vdev_stream_type = IFACE; - } else { - printf("invalid dev type %s, must be rx or tx\n", value); - return -1; } return 0; @@ -407,6 +412,8 @@ launch_args_parse(int argc, char **argv, char *prgname) int option_index; static struct option long_option[] = { {"pdump", 1, 0, 0}, + {"server-socket-path", 1, 0, 0}, + {"client-socket-path", 1, 0, 0}, {NULL, 0, 0, 0} }; @@ -418,14 +425,32 @@ launch_args_parse(int argc, char **argv, char *prgname) long_option, &option_index)) != EOF) { switch (opt) { case 0: - if (!strncmp(long_option[option_index].name, "pdump", - MAX_LONG_OPT_SZ)) { + if (!strncmp(long_option[option_index].name, + CMD_LINE_OPT_PDUMP, + sizeof(CMD_LINE_OPT_PDUMP))) { ret = parse_pdump(optarg); if (ret) { pdump_usage(prgname); return -1; } } + + if (!strncmp(long_option[option_index].name, + CMD_LINE_OPT_SER_SOCK_PATH, + sizeof(CMD_LINE_OPT_SER_SOCK_PATH))) { + snprintf(server_socket_path, + sizeof(server_socket_path), "%s", + optarg); + } + + if (!strncmp(long_option[option_index].name, + CMD_LINE_OPT_CLI_SOCK_PATH, + sizeof(CMD_LINE_OPT_CLI_SOCK_PATH))) { + snprintf(client_socket_path, + sizeof(client_socket_path), "%s", + optarg); + } + break; default: pdump_usage(prgname); @@ -719,6 +744,22 @@ enable_pdump(void) struct pdump_tuples *pt; int ret = 0, ret1 = 0; + if (server_socket_path[0] != 0) + ret = rte_pdump_set_socket_dir(server_socket_path, + RTE_PDUMP_SOCKET_SERVER); + if (ret == 0 && client_socket_path[0] != 0) { + ret = rte_pdump_set_socket_dir(client_socket_path, + RTE_PDUMP_SOCKET_CLIENT); + } + if (ret < 0) { + cleanup_pdump_resources(); + rte_exit(EXIT_FAILURE, + "failed to set socket paths of server:%s, " + "client:%s\n", + server_socket_path, + client_socket_path); + } + for (i = 0; i < num_tuples; i++) { pt = &pdump_t[i]; if (pt->dir == RTE_PDUMP_FLAG_RXTX) { @@ -729,7 +770,7 @@ enable_pdump(void) RTE_PDUMP_FLAG_RX, pt->rx_ring, pt->mp, NULL); - ret = rte_pdump_enable_by_deviceid( + ret1 = rte_pdump_enable_by_deviceid( pt->device_id, pt->queue, RTE_PDUMP_FLAG_TX, diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b7f28e96..1428974e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -907,7 +907,6 @@ flush_fwd_rx_queues(void) timer_tsc += diff_tsc; } while ((nb_rx > 0) && (timer_tsc < timer_period)); - prev_tsc = cur_tsc; timer_tsc = 0; } } diff --git a/app/test/Makefile b/app/test/Makefile index 2de8c7a6..6015b19f 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -33,6 +33,9 @@ include $(RTE_SDK)/mk/rte.vars.mk ifeq ($(CONFIG_RTE_APP_TEST),y) +# default rule +all: + # Define an externally linked resource. A linked resource is an arbitrary # file that is linked into the test binary. The application refers to this # resource by name. The linked generates identifiers beg_<name> and end_<name> diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py index 1e6b422c..c69705ed 100644 --- a/app/test/autotest_data.py +++ b/app/test/autotest_data.py @@ -99,18 +99,6 @@ parallel_test_group_list = [ "Func" : default_autotest, "Report" : None, }, - { - "Name" : "Dump rings", - "Command" : "dump_ring", - "Func" : dump_autotest, - "Report" : None, - }, - { - "Name" : "Dump mempools", - "Command" : "dump_mempool", - "Func" : dump_autotest, - "Report" : None, - }, ] }, { diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py index 291a8213..bd99e19e 100644 --- a/app/test/autotest_runner.py +++ b/app/test/autotest_runner.py @@ -33,7 +33,7 @@ # The main logic behind running autotests in parallel -import multiprocessing, sys, pexpect, time, os, StringIO, csv +import multiprocessing, subprocess, sys, pexpect, re, time, os, StringIO, csv # wait for prompt def wait_prompt(child): @@ -105,6 +105,11 @@ def run_test_group(cmdline, test_group): results.append((0, "Success", "Start %s" % test_group["Prefix"], time.time() - start_time, startuplog.getvalue(), None)) + # parse the binary for available test commands + binary = cmdline.split()[0] + symbols = subprocess.check_output(['nm', binary]).decode('utf-8') + avail_cmds = re.findall('test_register_(\w+)', symbols) + # run all tests in test group for test in test_group["Tests"]: @@ -124,7 +129,10 @@ def run_test_group(cmdline, test_group): print >>logfile, "\n%s %s\n" % ("-"*20, test["Name"]) # run test function associated with the test - result = test["Func"](child, test["Command"]) + if test["Command"] in avail_cmds: + result = test["Func"](child, test["Command"]) + else: + result = (0, "Skipped [Not Available]") # make a note when the test was finished end_time = time.time() diff --git a/app/test/test.h b/app/test/test.h index 81828bee..467b9c07 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -250,11 +250,16 @@ struct test_command { void add_test_command(struct test_command *t); -#define REGISTER_TEST_COMMAND(t) \ -static void __attribute__((used)) testfn_##t(void);\ -void __attribute__((constructor, used)) testfn_##t(void)\ -{\ - add_test_command(&t);\ -} +/* Register a test function with its command string */ +#define REGISTER_TEST_COMMAND(cmd, func) \ + static struct test_command test_struct_##cmd = { \ + .command = RTE_STR(cmd), \ + .callback = func, \ + }; \ + static void __attribute__((constructor, used)) \ + test_register_##cmd(void) \ + { \ + add_test_command(&test_struct_##cmd); \ + } #endif diff --git a/app/test/test_acl.c b/app/test/test_acl.c index 2b827904..28955f08 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -1682,8 +1682,4 @@ test_acl(void) return 0; } -static struct test_command acl_cmd = { - .command = "acl_autotest", - .callback = test_acl, -}; -REGISTER_TEST_COMMAND(acl_cmd); +REGISTER_TEST_COMMAND(acl_autotest, test_acl); diff --git a/app/test/test_alarm.c b/app/test/test_alarm.c index d83591c9..ecb2f6d4 100644 --- a/app/test/test_alarm.c +++ b/app/test/test_alarm.c @@ -253,8 +253,4 @@ test_alarm(void) return 0; } -static struct test_command alarm_cmd = { - .command = "alarm_autotest", - .callback = test_alarm, -}; -REGISTER_TEST_COMMAND(alarm_cmd); +REGISTER_TEST_COMMAND(alarm_autotest, test_alarm); diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c index 588f5309..b5e7e1b7 100644 --- a/app/test/test_atomic.c +++ b/app/test/test_atomic.c @@ -374,8 +374,4 @@ test_atomic(void) return 0; } -static struct test_command atomic_cmd = { - .command = "atomic_autotest", - .callback = test_atomic, -}; -REGISTER_TEST_COMMAND(atomic_cmd); +REGISTER_TEST_COMMAND(atomic_autotest, test_atomic); diff --git a/app/test/test_byteorder.c b/app/test/test_byteorder.c index a088489b..8ae31142 100644 --- a/app/test/test_byteorder.c +++ b/app/test/test_byteorder.c @@ -92,8 +92,4 @@ test_byteorder(void) return 0; } -static struct test_command byteorder_cmd = { - .command = "byteorder_autotest", - .callback = test_byteorder, -}; -REGISTER_TEST_COMMAND(byteorder_cmd); +REGISTER_TEST_COMMAND(byteorder_autotest, test_byteorder); diff --git a/app/test/test_cmdline.c b/app/test/test_cmdline.c index 2b5840fb..38c7256f 100644 --- a/app/test/test_cmdline.c +++ b/app/test/test_cmdline.c @@ -89,8 +89,4 @@ test_cmdline(void) return 0; } -static struct test_command cmdline_cmd = { - .command = "cmdline_autotest", - .callback = test_cmdline, -}; -REGISTER_TEST_COMMAND(cmdline_cmd); +REGISTER_TEST_COMMAND(cmdline_autotest, test_cmdline); diff --git a/app/test/test_common.c b/app/test/test_common.c index 66e91098..8effa2f9 100644 --- a/app/test/test_common.c +++ b/app/test/test_common.c @@ -169,8 +169,4 @@ test_common(void) return ret; } -static struct test_command common_cmd = { - .command = "common_autotest", - .callback = test_common, -}; -REGISTER_TEST_COMMAND(common_cmd); +REGISTER_TEST_COMMAND(common_autotest, test_common); diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c index d083c869..0e5ebe78 100644 --- a/app/test/test_cpuflags.c +++ b/app/test/test_cpuflags.c @@ -199,8 +199,4 @@ test_cpuflags(void) return 0; } -static struct test_command cpuflags_cmd = { - .command = "cpuflags_autotest", - .callback = test_cpuflags, -}; -REGISTER_TEST_COMMAND(cpuflags_cmd); +REGISTER_TEST_COMMAND(cpuflags_autotest, test_cpuflags); diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 33325a8b..647787d2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -4164,10 +4164,6 @@ test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/) gbl_cryptodev_type = RTE_CRYPTODEV_QAT_SYM_PMD; return unit_test_suite_runner(&cryptodev_qat_testsuite); } -static struct test_command cryptodev_qat_cmd = { - .command = "cryptodev_qat_autotest", - .callback = test_cryptodev_qat, -}; static int test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/) @@ -4177,11 +4173,6 @@ test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite); } -static struct test_command cryptodev_aesni_mb_cmd = { - .command = "cryptodev_aesni_mb_autotest", - .callback = test_cryptodev_aesni_mb, -}; - static int test_cryptodev_aesni_gcm(void) { @@ -4190,11 +4181,6 @@ test_cryptodev_aesni_gcm(void) return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite); } -static struct test_command cryptodev_aesni_gcm_cmd = { - .command = "cryptodev_aesni_gcm_autotest", - .callback = test_cryptodev_aesni_gcm, -}; - static int test_cryptodev_null(void) { @@ -4203,11 +4189,6 @@ test_cryptodev_null(void) return unit_test_suite_runner(&cryptodev_null_testsuite); } -static struct test_command cryptodev_null_cmd = { - .command = "cryptodev_null_autotest", - .callback = test_cryptodev_null, -}; - static int test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/) { @@ -4216,11 +4197,6 @@ test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite); } -static struct test_command cryptodev_sw_snow3g_cmd = { - .command = "cryptodev_sw_snow3g_autotest", - .callback = test_cryptodev_sw_snow3g, -}; - static int test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/) { @@ -4229,14 +4205,9 @@ test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite); } -static struct test_command cryptodev_sw_kasumi_cmd = { - .command = "cryptodev_sw_kasumi_autotest", - .callback = test_cryptodev_sw_kasumi, -}; - -REGISTER_TEST_COMMAND(cryptodev_qat_cmd); -REGISTER_TEST_COMMAND(cryptodev_aesni_mb_cmd); -REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_cmd); -REGISTER_TEST_COMMAND(cryptodev_null_cmd); -REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_cmd); -REGISTER_TEST_COMMAND(cryptodev_sw_kasumi_cmd); +REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat); +REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb); +REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_autotest, test_cryptodev_aesni_gcm); +REGISTER_TEST_COMMAND(cryptodev_null_autotest, test_cryptodev_null); +REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_autotest, test_cryptodev_sw_snow3g); +REGISTER_TEST_COMMAND(cryptodev_sw_kasumi_autotest, test_cryptodev_sw_kasumi); diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 815c41ff..2398d844 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -2919,27 +2919,7 @@ perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_snow3g_testsuite); } -static struct test_command cryptodev_aesni_mb_perf_cmd = { - .command = "cryptodev_aesni_mb_perftest", - .callback = perftest_aesni_mb_cryptodev, -}; - -static struct test_command cryptodev_qat_perf_cmd = { - .command = "cryptodev_qat_perftest", - .callback = perftest_qat_cryptodev, -}; - -static struct test_command cryptodev_sw_snow3g_perf_cmd = { - .command = "cryptodev_sw_snow3g_perftest", - .callback = perftest_sw_snow3g_cryptodev, -}; - -static struct test_command cryptodev_qat_snow3g_perf_cmd = { - .command = "cryptodev_qat_snow3g_perftest", - .callback = perftest_qat_snow3g_cryptodev, -}; - -REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perf_cmd); -REGISTER_TEST_COMMAND(cryptodev_qat_perf_cmd); -REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perf_cmd); -REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perf_cmd); +REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev); +REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev); +REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev); +REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev); diff --git a/app/test/test_cycles.c b/app/test/test_cycles.c index d8fa5171..f6c043a4 100644 --- a/app/test/test_cycles.c +++ b/app/test/test_cycles.c @@ -89,8 +89,4 @@ test_cycles(void) return 0; } -static struct test_command cycles_cmd = { - .command = "cycles_autotest", - .callback = test_cycles, -}; -REGISTER_TEST_COMMAND(cycles_cmd); +REGISTER_TEST_COMMAND(cycles_autotest, test_cycles); diff --git a/app/test/test_debug.c b/app/test/test_debug.c index 7c3ee926..0a3b2c46 100644 --- a/app/test/test_debug.c +++ b/app/test/test_debug.c @@ -146,8 +146,4 @@ test_debug(void) return 0; } -static struct test_command debug_cmd = { - .command = "debug_autotest", - .callback = test_debug, -}; -REGISTER_TEST_COMMAND(debug_cmd); +REGISTER_TEST_COMMAND(debug_autotest, test_debug); diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c index e5a9aa0b..151ac2ac 100644 --- a/app/test/test_devargs.c +++ b/app/test/test_devargs.c @@ -131,8 +131,4 @@ test_devargs(void) return -1; } -static struct test_command devargs_cmd = { - .command = "devargs_autotest", - .callback = test_devargs, -}; -REGISTER_TEST_COMMAND(devargs_cmd); +REGISTER_TEST_COMMAND(devargs_autotest, test_devargs); diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 00b1d413..85cb8f39 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -576,8 +576,4 @@ err: return -1; } -static struct test_command distributor_cmd = { - .command = "distributor_autotest", - .callback = test_distributor, -}; -REGISTER_TEST_COMMAND(distributor_cmd); +REGISTER_TEST_COMMAND(distributor_autotest, test_distributor); diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c index 92b22201..7947fe9b 100644 --- a/app/test/test_distributor_perf.c +++ b/app/test/test_distributor_perf.c @@ -257,8 +257,4 @@ test_distributor_perf(void) return 0; } -static struct test_command distributor_perf_cmd = { - .command = "distributor_perf_autotest", - .callback = test_distributor_perf, -}; -REGISTER_TEST_COMMAND(distributor_perf_cmd); +REGISTER_TEST_COMMAND(distributor_perf_autotest, test_distributor_perf); diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 93ae6e76..6202f057 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1441,8 +1441,4 @@ test_eal_flags(void) return ret; } -static struct test_command eal_flags_cmd = { - .command = "eal_flags_autotest", - .callback = test_eal_flags, -}; -REGISTER_TEST_COMMAND(eal_flags_cmd); +REGISTER_TEST_COMMAND(eal_flags_autotest, test_eal_flags); diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c index 1cbcb9d9..78978120 100644 --- a/app/test/test_eal_fs.c +++ b/app/test/test_eal_fs.c @@ -203,8 +203,4 @@ test_eal_fs(void) return 0; } -static struct test_command eal_fs_cmd = { - .command = "eal_fs_autotest", - .callback = test_eal_fs, -}; -REGISTER_TEST_COMMAND(eal_fs_cmd); +REGISTER_TEST_COMMAND(eal_fs_autotest, test_eal_fs); diff --git a/app/test/test_errno.c b/app/test/test_errno.c index f221eac7..388decbb 100644 --- a/app/test/test_errno.c +++ b/app/test/test_errno.c @@ -113,8 +113,4 @@ test_errno(void) return 0; } -static struct test_command errno_cmd = { - .command = "errno_autotest", - .callback = test_errno, -}; -REGISTER_TEST_COMMAND(errno_cmd); +REGISTER_TEST_COMMAND(errno_autotest, test_errno); diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index d6e9dd8f..baa01ffc 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -507,8 +507,4 @@ test_func_reentrancy(void) return 0; } -static struct test_command func_reentrancy_cmd = { - .command = "func_reentrancy_autotest", - .callback = test_func_reentrancy, -}; -REGISTER_TEST_COMMAND(func_reentrancy_cmd); +REGISTER_TEST_COMMAND(func_reentrancy_autotest, test_func_reentrancy); diff --git a/app/test/test_hash.c b/app/test/test_hash.c index 29abcd9e..94300e19 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -1514,8 +1514,4 @@ test_hash(void) return 0; } -static struct test_command hash_cmd = { - .command = "hash_autotest", - .callback = test_hash, -}; -REGISTER_TEST_COMMAND(hash_cmd); +REGISTER_TEST_COMMAND(hash_autotest, test_hash); diff --git a/app/test/test_hash_functions.c b/app/test/test_hash_functions.c index f767a486..9652b04d 100644 --- a/app/test/test_hash_functions.c +++ b/app/test/test_hash_functions.c @@ -319,8 +319,4 @@ test_hash_functions(void) return 0; } -static struct test_command hash_functions_cmd = { - .command = "hash_functions_autotest", - .callback = test_hash_functions, -}; -REGISTER_TEST_COMMAND(hash_functions_cmd); +REGISTER_TEST_COMMAND(hash_functions_autotest, test_hash_functions); diff --git a/app/test/test_hash_multiwriter.c b/app/test/test_hash_multiwriter.c index b0f31b00..40af95d4 100644 --- a/app/test/test_hash_multiwriter.c +++ b/app/test/test_hash_multiwriter.c @@ -278,10 +278,4 @@ test_hash_multiwriter_main(void) return r; } - -static struct test_command hash_scaling_cmd = { - .command = "hash_multiwriter_autotest", - .callback = test_hash_multiwriter_main, -}; - -REGISTER_TEST_COMMAND(hash_scaling_cmd); +REGISTER_TEST_COMMAND(hash_multiwriter_autotest, test_hash_multiwriter_main); diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c index 9d53c141..c0051b20 100644 --- a/app/test/test_hash_perf.c +++ b/app/test/test_hash_perf.c @@ -656,8 +656,4 @@ test_hash_perf(void) return 0; } -static struct test_command hash_perf_cmd = { - .command = "hash_perf_autotest", - .callback = test_hash_perf, -}; -REGISTER_TEST_COMMAND(hash_perf_cmd); +REGISTER_TEST_COMMAND(hash_perf_autotest, test_hash_perf); diff --git a/app/test/test_hash_scaling.c b/app/test/test_hash_scaling.c index 1c4c75d6..46c48e54 100644 --- a/app/test/test_hash_scaling.c +++ b/app/test/test_hash_scaling.c @@ -217,9 +217,4 @@ test_hash_scaling_main(void) return r; } - -static struct test_command hash_scaling_cmd = { - .command = "hash_scaling_autotest", - .callback = test_hash_scaling_main, -}; -REGISTER_TEST_COMMAND(hash_scaling_cmd); +REGISTER_TEST_COMMAND(hash_scaling_autotest, test_hash_scaling_main); diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c index df6d2618..371101f0 100644 --- a/app/test/test_interrupts.c +++ b/app/test/test_interrupts.c @@ -548,8 +548,4 @@ out: return ret; } -static struct test_command interrupt_cmd = { - .command = "interrupt_autotest", - .callback = test_interrupt, -}; -REGISTER_TEST_COMMAND(interrupt_cmd); +REGISTER_TEST_COMMAND(interrupt_autotest, test_interrupt); diff --git a/app/test/test_ivshmem.c b/app/test/test_ivshmem.c index 4e614884..ae9fd6cc 100644 --- a/app/test/test_ivshmem.c +++ b/app/test/test_ivshmem.c @@ -430,8 +430,4 @@ test_ivshmem(void) return -1; } -static struct test_command ivshmem_cmd = { - .command = "ivshmem_autotest", - .callback = test_ivshmem, -}; -REGISTER_TEST_COMMAND(ivshmem_cmd); +REGISTER_TEST_COMMAND(ivshmem_autotest, test_ivshmem); diff --git a/app/test/test_kni.c b/app/test/test_kni.c index 7243ade1..309741cb 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -633,8 +633,4 @@ fail: return ret; } -static struct test_command kni_cmd = { - .command = "kni_autotest", - .callback = test_kni, -}; -REGISTER_TEST_COMMAND(kni_cmd); +REGISTER_TEST_COMMAND(kni_autotest, test_kni); diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c index 6be85122..4d9e805b 100644 --- a/app/test/test_kvargs.c +++ b/app/test/test_kvargs.c @@ -232,8 +232,4 @@ test_kvargs(void) return 0; } -static struct test_command kvargs_cmd = { - .command = "kvargs_autotest", - .callback = test_kvargs, -}; -REGISTER_TEST_COMMAND(kvargs_cmd); +REGISTER_TEST_COMMAND(kvargs_autotest, test_kvargs); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index eeb13954..32296604 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -5002,8 +5002,4 @@ test_link_bonding(void) return unit_test_suite_runner(&link_bonding_test_suite); } -static struct test_command link_bonding_cmd = { - .command = "link_bonding_autotest", - .callback = test_link_bonding, -}; -REGISTER_TEST_COMMAND(link_bonding_cmd); +REGISTER_TEST_COMMAND(link_bonding_autotest, test_link_bonding); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index a3f1f088..53caa3e9 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -1599,9 +1599,4 @@ test_link_bonding_mode4(void) return unit_test_suite_runner(&link_bonding_mode4_test_suite); } -static struct test_command link_bonding_cmd = { - .command = "link_bonding_mode4_autotest", - .callback = test_link_bonding_mode4, -}; - -REGISTER_TEST_COMMAND(link_bonding_cmd); +REGISTER_TEST_COMMAND(link_bonding_mode4_autotest, test_link_bonding_mode4); diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index 0a3162ea..34f1c166 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -670,9 +670,4 @@ test_link_bonding_rssconf(void) return unit_test_suite_runner(&link_bonding_rssconf_test_suite); } -static struct test_command test_link_bonding_rssconf_cmd = { - .command = "link_bonding_rssconf_autotest", - .callback = test_link_bonding_rssconf, -}; - -REGISTER_TEST_COMMAND(test_link_bonding_rssconf_cmd); +REGISTER_TEST_COMMAND(link_bonding_rssconf_autotest, test_link_bonding_rssconf); diff --git a/app/test/test_logs.c b/app/test/test_logs.c index d0a99623..6985ddde 100644 --- a/app/test/test_logs.c +++ b/app/test/test_logs.c @@ -86,8 +86,4 @@ test_logs(void) return 0; } -static struct test_command logs_cmd = { - .command = "logs_autotest", - .callback = test_logs, -}; -REGISTER_TEST_COMMAND(logs_cmd); +REGISTER_TEST_COMMAND(logs_autotest, test_logs); diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index f6930fbd..b6ad2ebd 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -1238,8 +1238,4 @@ test_lpm(void) return global_status; } -static struct test_command lpm_cmd = { - .command = "lpm_autotest", - .callback = test_lpm, -}; -REGISTER_TEST_COMMAND(lpm_cmd); +REGISTER_TEST_COMMAND(lpm_autotest, test_lpm); diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c index 458a10bf..0fd0ef71 100644 --- a/app/test/test_lpm6.c +++ b/app/test/test_lpm6.c @@ -1764,8 +1764,4 @@ test_lpm6(void) return global_status; } -static struct test_command lpm6_cmd = { - .command = "lpm6_autotest", - .callback = test_lpm6, -}; -REGISTER_TEST_COMMAND(lpm6_cmd); +REGISTER_TEST_COMMAND(lpm6_autotest, test_lpm6); diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c index b7d46314..be47d4a1 100644 --- a/app/test/test_lpm6_perf.c +++ b/app/test/test_lpm6_perf.c @@ -184,8 +184,4 @@ test_lpm6_perf(void) return 0; } -static struct test_command lpm6_perf_cmd = { - .command = "lpm6_perf_autotest", - .callback = test_lpm6_perf, -}; -REGISTER_TEST_COMMAND(lpm6_perf_cmd); +REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf); diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 41da811c..58eb415e 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -242,8 +242,4 @@ test_lpm_perf(void) return 0; } -static struct test_command lpm_perf_cmd = { - .command = "lpm_perf_autotest", - .callback = test_lpm_perf, -}; -REGISTER_TEST_COMMAND(lpm_perf_cmd); +REGISTER_TEST_COMMAND(lpm_perf_autotest, test_lpm_perf); diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c index a04a751a..0673d85b 100644 --- a/app/test/test_malloc.c +++ b/app/test/test_malloc.c @@ -959,8 +959,4 @@ test_malloc(void) return 0; } -static struct test_command malloc_cmd = { - .command = "malloc_autotest", - .callback = test_malloc, -}; -REGISTER_TEST_COMMAND(malloc_cmd); +REGISTER_TEST_COMMAND(malloc_autotest, test_malloc); diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 8664885d..684ad80f 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -1026,8 +1026,4 @@ test_mbuf(void) return 0; } -static struct test_command mbuf_cmd = { - .command = "mbuf_autotest", - .callback = test_mbuf, -}; -REGISTER_TEST_COMMAND(mbuf_cmd); +REGISTER_TEST_COMMAND(mbuf_autotest, test_mbuf); diff --git a/app/test/test_memcpy.c b/app/test/test_memcpy.c index 8195e209..1d93dd53 100644 --- a/app/test/test_memcpy.c +++ b/app/test/test_memcpy.c @@ -159,8 +159,4 @@ test_memcpy(void) return 0; } -static struct test_command memcpy_cmd = { - .command = "memcpy_autotest", - .callback = test_memcpy, -}; -REGISTER_TEST_COMMAND(memcpy_cmd); +REGISTER_TEST_COMMAND(memcpy_autotest, test_memcpy); diff --git a/app/test/test_memcpy_perf.c b/app/test/test_memcpy_perf.c index be69eada..ff3aaaac 100644 --- a/app/test/test_memcpy_perf.c +++ b/app/test/test_memcpy_perf.c @@ -351,8 +351,4 @@ test_memcpy_perf(void) return 0; } -static struct test_command memcpy_perf_cmd = { - .command = "memcpy_perf_autotest", - .callback = test_memcpy_perf, -}; -REGISTER_TEST_COMMAND(memcpy_perf_cmd); +REGISTER_TEST_COMMAND(memcpy_perf_autotest, test_memcpy_perf); diff --git a/app/test/test_memory.c b/app/test/test_memory.c index 6816385b..921bdc88 100644 --- a/app/test/test_memory.c +++ b/app/test/test_memory.c @@ -86,8 +86,4 @@ test_memory(void) return 0; } -static struct test_command memory_cmd = { - .command = "memory_autotest", - .callback = test_memory, -}; -REGISTER_TEST_COMMAND(memory_cmd); +REGISTER_TEST_COMMAND(memory_autotest, test_memory); diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index 9ea98314..46ad6702 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -609,8 +609,4 @@ err: return -1; } -static struct test_command mempool_cmd = { - .command = "mempool_autotest", - .callback = test_mempool, -}; -REGISTER_TEST_COMMAND(mempool_cmd); +REGISTER_TEST_COMMAND(mempool_autotest, test_mempool); diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c index 4fac04cd..c0b3f5ce 100644 --- a/app/test/test_mempool_perf.c +++ b/app/test/test_mempool_perf.c @@ -381,8 +381,4 @@ test_mempool_perf(void) return 0; } -static struct test_command mempool_perf_cmd = { - .command = "mempool_perf_autotest", - .callback = test_mempool_perf, -}; -REGISTER_TEST_COMMAND(mempool_perf_cmd); +REGISTER_TEST_COMMAND(mempool_perf_autotest, test_mempool_perf); diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index cadd86f6..7ae31cf7 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -872,8 +872,4 @@ test_memzone(void) return 0; } -static struct test_command memzone_cmd = { - .command = "memzone_autotest", - .callback = test_memzone, -}; -REGISTER_TEST_COMMAND(memzone_cmd); +REGISTER_TEST_COMMAND(memzone_autotest, test_memzone); diff --git a/app/test/test_meter.c b/app/test/test_meter.c index bc76391f..26b05657 100644 --- a/app/test/test_meter.c +++ b/app/test/test_meter.c @@ -494,8 +494,4 @@ test_meter(void) } -static struct test_command meter_cmd = { - .command = "meter_autotest", - .callback = test_meter, -}; -REGISTER_TEST_COMMAND(meter_cmd); +REGISTER_TEST_COMMAND(meter_autotest, test_meter); diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index f66b68f2..26c4afd6 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -282,8 +282,4 @@ test_mp_secondary(void) return run_object_creation_tests(); } -static struct test_command multiprocess_cmd = { - .command = "multiprocess_autotest", - .callback = test_mp_secondary, -}; -REGISTER_TEST_COMMAND(multiprocess_cmd); +REGISTER_TEST_COMMAND(multiprocess_autotest, test_mp_secondary); diff --git a/app/test/test_pci.c b/app/test/test_pci.c index 354a0ad9..69f78d92 100644 --- a/app/test/test_pci.c +++ b/app/test/test_pci.c @@ -315,8 +315,4 @@ test_pci(void) return 0; } -static struct test_command pci_cmd = { - .command = "pci_autotest", - .callback = test_pci, -}; -REGISTER_TEST_COMMAND(pci_cmd); +REGISTER_TEST_COMMAND(pci_autotest, test_pci); diff --git a/app/test/test_per_lcore.c b/app/test/test_per_lcore.c index f452cdb0..747513d4 100644 --- a/app/test/test_per_lcore.c +++ b/app/test/test_per_lcore.c @@ -136,8 +136,4 @@ test_per_lcore(void) return 0; } -static struct test_command per_lcore_cmd = { - .command = "per_lcore_autotest", - .callback = test_per_lcore, -}; -REGISTER_TEST_COMMAND(per_lcore_cmd); +REGISTER_TEST_COMMAND(per_lcore_autotest, test_per_lcore); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 3d56cd29..e055aa07 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -910,8 +910,4 @@ test_set_rxtx_sc(cmdline_fixed_string_t type) return -1; } -static struct test_command pmd_perf_cmd = { - .command = "pmd_perf_autotest", - .callback = test_pmd_perf, -}; -REGISTER_TEST_COMMAND(pmd_perf_cmd); +REGISTER_TEST_COMMAND(pmd_perf_autotest, test_pmd_perf); diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 34fea09c..47374db2 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -526,8 +526,4 @@ test_pmd_ring(void) return 0; } -static struct test_command ring_pmd_cmd = { - .command = "ring_pmd_autotest", - .callback = test_pmd_ring, -}; -REGISTER_TEST_COMMAND(ring_pmd_cmd); +REGISTER_TEST_COMMAND(ring_pmd_autotest, test_pmd_ring); diff --git a/app/test/test_pmd_ring_perf.c b/app/test/test_pmd_ring_perf.c index 3077dbad..af011f7d 100644 --- a/app/test/test_pmd_ring_perf.c +++ b/app/test/test_pmd_ring_perf.c @@ -181,8 +181,4 @@ test_ring_pmd_perf(void) return 0; } -static struct test_command ring_pmd_perf_cmd = { - .command = "ring_pmd_perf_autotest", - .callback = test_ring_pmd_perf, -}; -REGISTER_TEST_COMMAND(ring_pmd_perf_cmd); +REGISTER_TEST_COMMAND(ring_pmd_perf_autotest, test_ring_pmd_perf); diff --git a/app/test/test_power.c b/app/test/test_power.c index 64a23054..b2e1344c 100644 --- a/app/test/test_power.c +++ b/app/test/test_power.c @@ -104,8 +104,4 @@ fail_all: return -1; } -static struct test_command power_cmd = { - .command = "power_autotest", - .callback = test_power, -}; -REGISTER_TEST_COMMAND(power_cmd); +REGISTER_TEST_COMMAND(power_autotest, test_power); diff --git a/app/test/test_power_acpi_cpufreq.c b/app/test/test_power_acpi_cpufreq.c index 0fb15699..64f5dd56 100644 --- a/app/test/test_power_acpi_cpufreq.c +++ b/app/test/test_power_acpi_cpufreq.c @@ -537,8 +537,4 @@ fail_all: return -1; } -static struct test_command power_acpi_cpufreq_cmd = { - .command = "power_acpi_cpufreq_autotest", - .callback = test_power_acpi_cpufreq, -}; -REGISTER_TEST_COMMAND(power_acpi_cpufreq_cmd); +REGISTER_TEST_COMMAND(power_acpi_cpufreq_autotest, test_power_acpi_cpufreq); diff --git a/app/test/test_power_kvm_vm.c b/app/test/test_power_kvm_vm.c index ff468c1e..253a5f8b 100644 --- a/app/test/test_power_kvm_vm.c +++ b/app/test/test_power_kvm_vm.c @@ -300,8 +300,4 @@ fail_all: return -1; } -static struct test_command power_kvm_vm_cmd = { - .command = "power_kvm_vm_autotest", - .callback = test_power_kvm_vm, -}; -REGISTER_TEST_COMMAND(power_kvm_vm_cmd); +REGISTER_TEST_COMMAND(power_kvm_vm_autotest, test_power_kvm_vm); diff --git a/app/test/test_prefetch.c b/app/test/test_prefetch.c index f8615e24..80afaaf3 100644 --- a/app/test/test_prefetch.c +++ b/app/test/test_prefetch.c @@ -58,8 +58,4 @@ test_prefetch(void) return 0; } -static struct test_command prefetch_cmd = { - .command = "prefetch_autotest", - .callback = test_prefetch, -}; -REGISTER_TEST_COMMAND(prefetch_cmd); +REGISTER_TEST_COMMAND(prefetch_autotest, test_prefetch); diff --git a/app/test/test_red.c b/app/test/test_red.c index 7d1c32c4..348075dc 100644 --- a/app/test/test_red.c +++ b/app/test/test_red.c @@ -1880,20 +1880,6 @@ test_red_all(void) return tell_the_result(num_tests, num_pass); } -static struct test_command red_cmd = { - .command = "red_autotest", - .callback = test_red, -}; -REGISTER_TEST_COMMAND(red_cmd); - -static struct test_command red_cmd_perf = { - .command = "red_perf", - .callback = test_red_perf, -}; -REGISTER_TEST_COMMAND(red_cmd_perf); - -static struct test_command red_cmd_all = { - .command = "red_all", - .callback = test_red_all, -}; -REGISTER_TEST_COMMAND(red_cmd_all); +REGISTER_TEST_COMMAND(red_autotest, test_red); +REGISTER_TEST_COMMAND(red_perf, test_red_perf); +REGISTER_TEST_COMMAND(red_all, test_red_all); diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c index 67f3151b..e8a0a2f2 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -383,8 +383,4 @@ test_reorder(void) return unit_test_suite_runner(&reorder_test_suite); } -static struct test_command reorder_cmd = { - .command = "reorder_autotest", - .callback = test_reorder, -}; -REGISTER_TEST_COMMAND(reorder_cmd); +REGISTER_TEST_COMMAND(reorder_autotest, test_reorder); diff --git a/app/test/test_resource.c b/app/test/test_resource.c index 39a64689..a3a82f13 100644 --- a/app/test/test_resource.c +++ b/app/test/test_resource.c @@ -130,8 +130,4 @@ static int test_resource(void) return 0; } -static struct test_command resource_cmd = { - .command = "resource_autotest", - .callback = test_resource, -}; -REGISTER_TEST_COMMAND(resource_cmd); +REGISTER_TEST_COMMAND(resource_autotest, test_resource); diff --git a/app/test/test_ring.c b/app/test/test_ring.c index 9095e597..ebcb8964 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -1378,8 +1378,4 @@ test_ring(void) return 0; } -static struct test_command ring_cmd = { - .command = "ring_autotest", - .callback = test_ring, -}; -REGISTER_TEST_COMMAND(ring_cmd); +REGISTER_TEST_COMMAND(ring_autotest, test_ring); diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c index 8c47ccb7..320c20cd 100644 --- a/app/test/test_ring_perf.c +++ b/app/test/test_ring_perf.c @@ -414,8 +414,4 @@ test_ring_perf(void) return 0; } -static struct test_command ring_perf_cmd = { - .command = "ring_perf_autotest", - .callback = test_ring_perf, -}; -REGISTER_TEST_COMMAND(ring_perf_cmd); +REGISTER_TEST_COMMAND(ring_perf_autotest, test_ring_perf); diff --git a/app/test/test_rwlock.c b/app/test/test_rwlock.c index b383bba2..50f58ade 100644 --- a/app/test/test_rwlock.c +++ b/app/test/test_rwlock.c @@ -129,8 +129,4 @@ test_rwlock(void) return 0; } -static struct test_command rwlock_cmd = { - .command = "rwlock_autotest", - .callback = test_rwlock, -}; -REGISTER_TEST_COMMAND(rwlock_cmd); +REGISTER_TEST_COMMAND(rwlock_autotest, test_rwlock); diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 9712f9f0..63ab084f 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -213,8 +213,4 @@ test_sched(void) return 0; } -static struct test_command sched_cmd = { - .command = "sched_autotest", - .callback = test_sched, -}; -REGISTER_TEST_COMMAND(sched_cmd); +REGISTER_TEST_COMMAND(sched_autotest, test_sched); diff --git a/app/test/test_spinlock.c b/app/test/test_spinlock.c index 180d6deb..2d94eecc 100644 --- a/app/test/test_spinlock.c +++ b/app/test/test_spinlock.c @@ -333,8 +333,4 @@ test_spinlock(void) return ret; } -static struct test_command spinlock_cmd = { - .command = "spinlock_autotest", - .callback = test_spinlock, -}; -REGISTER_TEST_COMMAND(spinlock_cmd); +REGISTER_TEST_COMMAND(spinlock_autotest, test_spinlock); diff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c index 39e6a9da..8b4359aa 100644 --- a/app/test/test_string_fns.c +++ b/app/test/test_string_fns.c @@ -166,8 +166,4 @@ test_string_fns(void) return 0; } -static struct test_command string_cmd = { - .command = "string_autotest", - .callback = test_string_fns, -}; -REGISTER_TEST_COMMAND(string_cmd); +REGISTER_TEST_COMMAND(string_autotest, test_string_fns); diff --git a/app/test/test_table.c b/app/test/test_table.c index 676dab23..1faa0a6d 100644 --- a/app/test/test_table.c +++ b/app/test/test_table.c @@ -199,8 +199,4 @@ test_table(void) return 0; } -static struct test_command table_cmd = { - .command = "table_autotest", - .callback = test_table, -}; -REGISTER_TEST_COMMAND(table_cmd); +REGISTER_TEST_COMMAND(table_autotest, test_table); diff --git a/app/test/test_tailq.c b/app/test/test_tailq.c index c046a8ac..33a3e8a9 100644 --- a/app/test/test_tailq.c +++ b/app/test/test_tailq.c @@ -154,8 +154,4 @@ test_tailq(void) return ret; } -static struct test_command tailq_cmd = { - .command = "tailq_autotest", - .callback = test_tailq, -}; -REGISTER_TEST_COMMAND(tailq_cmd); +REGISTER_TEST_COMMAND(tailq_autotest, test_tailq); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 8e9dca05..61754a94 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -169,8 +169,4 @@ test_thash(void) return 0; } -static struct test_command thash_cmd = { - .command = "thash_autotest", - .callback = test_thash, -}; -REGISTER_TEST_COMMAND(thash_cmd); +REGISTER_TEST_COMMAND(thash_autotest, test_thash); diff --git a/app/test/test_timer.c b/app/test/test_timer.c index bc07925e..2f6525a5 100644 --- a/app/test/test_timer.c +++ b/app/test/test_timer.c @@ -626,8 +626,4 @@ test_timer(void) return TEST_SUCCESS; } -static struct test_command timer_cmd = { - .command = "timer_autotest", - .callback = test_timer, -}; -REGISTER_TEST_COMMAND(timer_cmd); +REGISTER_TEST_COMMAND(timer_autotest, test_timer); diff --git a/app/test/test_timer_perf.c b/app/test/test_timer_perf.c index 3f7ddd30..fa77efbd 100644 --- a/app/test/test_timer_perf.c +++ b/app/test/test_timer_perf.c @@ -158,8 +158,4 @@ test_timer_perf(void) return 0; } -static struct test_command timer_perf_cmd = { - .command = "timer_perf_autotest", - .callback = test_timer_perf, -}; -REGISTER_TEST_COMMAND(timer_perf_cmd); +REGISTER_TEST_COMMAND(timer_perf_autotest, test_timer_perf); diff --git a/app/test/test_timer_racecond.c b/app/test/test_timer_racecond.c index aef32037..7824ec4b 100644 --- a/app/test/test_timer_racecond.c +++ b/app/test/test_timer_racecond.c @@ -202,8 +202,4 @@ test_timer_racecond(void) return TEST_SUCCESS; } -static struct test_command timer_racecond_cmd = { - .command = "timer_racecond_autotest", - .callback = test_timer_racecond, -}; -REGISTER_TEST_COMMAND(timer_racecond_cmd); +REGISTER_TEST_COMMAND(timer_racecond_autotest, test_timer_racecond); diff --git a/app/test/test_version.c b/app/test/test_version.c index f66827d0..afc0d0b8 100644 --- a/app/test/test_version.c +++ b/app/test/test_version.c @@ -54,8 +54,4 @@ test_version(void) return 0; } -static struct test_command version_cmd = { - .command = "version_autotest", - .callback = test_version, -}; -REGISTER_TEST_COMMAND(version_cmd); +REGISTER_TEST_COMMAND(version_autotest, test_version); diff --git a/doc/guides/contributing/patches.rst b/doc/guides/contributing/patches.rst index 06af91d6..16a21a52 100644 --- a/doc/guides/contributing/patches.rst +++ b/doc/guides/contributing/patches.rst @@ -22,7 +22,7 @@ The DPDK development process has the following features: * Patches are reviewed publicly on the mailing list. * Successfully reviewed patches are merged to the master branch of the repository. -The mailing list for DPDK development is `dev@dpkg.org <http://dpdk.org/ml/archives/dev/>`_. +The mailing list for DPDK development is `dev@dpdk.org <http://dpdk.org/ml/archives/dev/>`_. Contributors will need to `register for the mailing list <http://dpdk.org/ml/listinfo/dev>`_ in order to submit patches. It is also worth registering for the DPDK `Patchwork <http://dpdk.org/dev/patchwxispork/project/dpdk/list/>`_ diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index 4b9895e4..10a10a88 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -341,7 +341,7 @@ Known Issues be preempted by another pthread doing a multi-consumer dequeue on the same ring. - Bypassing this constraint it may cause the 2nd pthread to spin until the 1st one is scheduled again. + Bypassing this constraint may cause the 2nd pthread to spin until the 1st one is scheduled again. Moreover, if the 1st pthread is preempted by a context that has an higher priority, it may even cause a dead lock. This does not mean it cannot be used, simply, there is a need to narrow down the situation when it is used by multi-pthread on the same core. diff --git a/doc/guides/prog_guide/pdump_lib.rst b/doc/guides/prog_guide/pdump_lib.rst index 580ffcbd..0136781a 100644 --- a/doc/guides/prog_guide/pdump_lib.rst +++ b/doc/guides/prog_guide/pdump_lib.rst @@ -75,13 +75,13 @@ the packet capture. The packet capture framework, as part of its initialization, creates the pthread and the server socket in the pthread. The application that calls the framework initialization will have the server socket created, -either under the path that the application has passed or under the default path i.e. either ``/var/run`` for -root user or ``$HOME`` for non root user. +either under the path that the application has passed or under the default path i.e. either ``/var/run/.dpdk`` for +root user or ``~/.dpdk`` for non root user. Applications that request enabling or disabling of the packet capture will have the client socket created either under -the path that the application has passed or under the default path i.e. either ``/var/run/`` for root user or ``$HOME`` -for not root user to send the requests to the server. -The server socket will listen for client requests for enabling or disabling the packet capture. +the path that the application has passed or under the default path i.e. either ``/var/run/.dpdk`` for root user or +``~/.dpdk`` for not root user to send the requests to the server. The server socket will listen for client requests for +enabling or disabling the packet capture. Implementation Details @@ -111,7 +111,7 @@ server socket. The library API ``rte_pdump_set_socket_dir()``, sets the given path as either server socket path or client socket path based on the ``type`` argument of the API. -If the given path is ``NULL``, default path will be selected, i.e. either ``/var/run/`` for root user or ``$HOME`` +If the given path is ``NULL``, default path will be selected, i.e. either ``/var/run/.dpdk`` for root user or ``~/.dpdk`` for non root user. Clients also need to call this API to set their server socket path if the server socket path is different from default path. diff --git a/doc/guides/prog_guide/ring_lib.rst b/doc/guides/prog_guide/ring_lib.rst index 3b92a8f0..9f697538 100644 --- a/doc/guides/prog_guide/ring_lib.rst +++ b/doc/guides/prog_guide/ring_lib.rst @@ -252,8 +252,8 @@ In this example, only the producer head and tail (prod_head and prod_tail) are m The initial state is to have a prod_head and prod_tail pointing at the same location. -Multiple Consumer Enqueue First Step -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple Producers Enqueue First Step +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ On both cores, *ring->prod_head* and ring->cons_tail are copied in local variables. The prod_next local variable points to the next element of the table, @@ -266,11 +266,11 @@ If there is not enough room in the ring (this is detected by checking cons_tail) .. figure:: img/ring-mp-enqueue1.* - Multiple consumer enqueue first step + Multiple producer enqueue first step -Multiple Consumer Enqueue Second Step -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple Producers Enqueue Second Step +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The second step is to modify ring->prod_head in the ring structure to point to the same location as prod_next. This operation is done using a Compare And Swap (CAS) instruction, which does the following operations atomically: @@ -288,11 +288,11 @@ In the figure, the operation succeeded on core 1, and step one restarted on core .. figure:: img/ring-mp-enqueue2.* - Multiple consumer enqueue second step + Multiple producer enqueue second step -Multiple Consumer Enqueue Third Step -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple Producers Enqueue Third Step +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The CAS operation is retried on core 2 with success. @@ -303,11 +303,11 @@ The core 1 updates one element of the ring(obj4), and the core 2 updates another .. figure:: img/ring-mp-enqueue3.* - Multiple consumer enqueue third step + Multiple producer enqueue third step -Multiple Consumer Enqueue Fourth Step -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple Producers Enqueue Fourth Step +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Each core now wants to update ring->prod_tail. A core can only update it if ring->prod_tail is equal to the prod_head local variable. @@ -318,11 +318,11 @@ This is only true on core 1. The operation is finished on core 1. .. figure:: img/ring-mp-enqueue4.* - Multiple consumer enqueue fourth step + Multiple producer enqueue fourth step -Multiple Consumer Enqueue Last Step -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Multiple Producers Enqueue Last Step +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Once ring->prod_tail is updated by core 1, core 2 is allowed to update it too. The operation is also finished on core 2. @@ -332,7 +332,7 @@ The operation is also finished on core 2. .. figure:: img/ring-mp-enqueue5.* - Multiple consumer enqueue last step + Multiple producer enqueue last step Modulo 32-bit Indexes diff --git a/doc/guides/rel_notes/release_16_07.rst b/doc/guides/rel_notes/release_16_07.rst index e2af1474..d3a144fb 100644 --- a/doc/guides/rel_notes/release_16_07.rst +++ b/doc/guides/rel_notes/release_16_07.rst @@ -333,6 +333,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_mbuf.so.2 + librte_mempool.so.2 librte_meter.so.1 + librte_pdump.so.1 librte_pipeline.so.3 librte_pmd_bond.so.1 librte_pmd_ring.so.2 diff --git a/doc/guides/sample_app_ug/pdump.rst b/doc/guides/sample_app_ug/pdump.rst index 96c8709e..ceb038ec 100644 --- a/doc/guides/sample_app_ug/pdump.rst +++ b/doc/guides/sample_app_ug/pdump.rst @@ -33,14 +33,23 @@ dpdk_pdump Application ====================== -The ``dpdk_pdump`` application is a Data Plane Development Kit (DPDK) application that runs as a DPDK secondary process and -is capable of enabling packet capture on dpdk ports. +The ``dpdk_pdump`` tool is a Data Plane Development Kit (DPDK) tool that runs as +a DPDK secondary process and is capable of enabling packet capture on dpdk ports. + + .. Note:: + + * The ``dpdk_pdump`` tool depends on libpcap based PMD which is disabled + by default in the build configuration files, + owing to an external dependency on the libpcap development files + which must be installed on the board. + Once the libpcap development files are installed, the libpcap based PMD + can be enabled by setting CONFIG_RTE_LIBRTE_PMD_PCAP=y and recompiling the DPDK. Running the Application ----------------------- -The application has a ``--pdump`` command line option with various sub arguments: +The tool has a number of command line options: .. code-block:: console @@ -52,18 +61,31 @@ The application has a ``--pdump`` command line option with various sub arguments [ring-size=<ring size>], [mbuf-size=<mbuf data size>], [total-num-mbufs=<number of mbufs>]' + [--server-socket-path=<server socket dir>] + [--client-socket-path=<client socket dir>] + +The ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in +below section. + + .. Note:: + + * Parameters inside the parentheses represents mandatory parameters. -Note: + * Parameters inside the square brackets represents optional parameters. -* Parameters inside the parentheses represents mandatory parameters. + * Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations. -* Parameters inside the square brackets represents optional parameters. +The ``--server-socket-path`` command line option is optional. This represents the server socket directory. +If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/`` +for non root users. -Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations. +The ``--client-socket-path`` command line option is optional. This represents the client socket directory. +If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/`` +for non root users. -Parameters -~~~~~~~~~~ +The ``--pdump`` parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~ ``port``: Port id of the eth device on which packets should be captured. diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index a5e2e389..4c16ef17 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -51,7 +51,6 @@ #define DRV_NAME "enic_pmd" #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Poll-mode Driver" -#define DRV_VERSION "1.0.0.6" #define DRV_COPYRIGHT "Copyright 2008-2015 Cisco Systems, Inc" #define ENIC_WQ_MAX 8 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 3365176a..e6f57bea 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -218,6 +218,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params) pos = rte_hash_add_key(enic->fdir.hash, params); if (pos < 0) { + enic->fdir.stats.f_add++; dev_err(enic, "Add hash key failed\n"); return pos; } diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 3c87b49e..59082d2a 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -142,9 +142,21 @@ static int enicpmd_dev_setup_intr(struct enic *enic) if (!enic->cq[index].ctrl) break; } - if (enic->cq_count != index) return 0; + for (index = 0; index < enic->wq_count; index++) { + if (!enic->wq[index].ctrl) + break; + } + if (enic->wq_count != index) + return 0; + /* check start of packet (SOP) RQs only in case scatter is disabled. */ + for (index = 0; index < enic->rq_count; index++) { + if (!enic->rq[enic_sop_rq(index)].ctrl) + break; + } + if (enic->rq_count != index) + return 0; ret = enic_alloc_intr_resources(enic); if (ret) { @@ -196,7 +208,6 @@ static int enicpmd_dev_tx_queue_start(struct rte_eth_dev *eth_dev, ENICPMD_FUNC_TRACE(); enic_start_wq(enic, queue_idx); - eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -212,8 +223,6 @@ static int enicpmd_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, ret = enic_stop_wq(enic, queue_idx); if (ret) dev_err(enic, "error in stopping wq %d\n", queue_idx); - else - eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; return ret; } @@ -226,7 +235,6 @@ static int enicpmd_dev_rx_queue_start(struct rte_eth_dev *eth_dev, ENICPMD_FUNC_TRACE(); enic_start_rq(enic, queue_idx); - eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -242,8 +250,6 @@ static int enicpmd_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, ret = enic_stop_rq(enic, queue_idx); if (ret) dev_err(enic, "error in stopping rq %d\n", queue_idx); - else - eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; return ret; } diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index d8669cc0..542f0952 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -106,7 +106,7 @@ static void enic_free_wq_buf(struct vnic_wq_buf *buf) { struct rte_mbuf *mbuf = (struct rte_mbuf *)buf->mb; - rte_mempool_put(mbuf->pool, mbuf); + rte_pktmbuf_free_seg(mbuf); buf->mb = NULL; } @@ -123,6 +123,8 @@ static void enic_log_q_error(struct enic *enic) } for (i = 0; i < enic_vnic_rq_count(enic); i++) { + if (!enic->rq[i].in_use) + continue; error_status = vnic_rq_error_status(&enic->rq[i]); if (error_status) dev_err(enic, "RQ[%d] error_status %d\n", i, @@ -172,7 +174,8 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) * which can make ibytes be slightly higher than it should be. */ rx_packet_errors = rte_atomic64_read(&soft_stats->rx_packet_errors); - rx_truncated = rx_packet_errors - stats->rx.rx_errors; + rx_truncated = rx_packet_errors - stats->rx.rx_errors - + stats->rx.rx_no_bufs; r_stats->ipackets = stats->rx.rx_frames_ok - rx_truncated; r_stats->opackets = stats->tx.tx_frames_ok; @@ -518,30 +521,41 @@ void enic_free_rq(void *rxq) void enic_start_wq(struct enic *enic, uint16_t queue_idx) { + struct rte_eth_dev *eth_dev = enic->rte_dev; vnic_wq_enable(&enic->wq[queue_idx]); + eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; } int enic_stop_wq(struct enic *enic, uint16_t queue_idx) { - return vnic_wq_disable(&enic->wq[queue_idx]); + struct rte_eth_dev *eth_dev = enic->rte_dev; + int ret; + + ret = vnic_wq_disable(&enic->wq[queue_idx]); + if (ret) + return ret; + + eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } void enic_start_rq(struct enic *enic, uint16_t queue_idx) { struct vnic_rq *rq_sop = &enic->rq[enic_sop_rq(queue_idx)]; struct vnic_rq *rq_data = &enic->rq[rq_sop->data_queue_idx]; + struct rte_eth_dev *eth_dev = enic->rte_dev; if (rq_data->in_use) vnic_rq_enable(rq_data); rte_mb(); vnic_rq_enable(rq_sop); - + eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED; } int enic_stop_rq(struct enic *enic, uint16_t queue_idx) { int ret1 = 0, ret2 = 0; - + struct rte_eth_dev *eth_dev = enic->rte_dev; struct vnic_rq *rq_sop = &enic->rq[enic_sop_rq(queue_idx)]; struct vnic_rq *rq_data = &enic->rq[rq_sop->data_queue_idx]; @@ -552,8 +566,11 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx) if (ret2) return ret2; - else + else if (ret1) return ret1; + + eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; } int enic_alloc_rq(struct enic *enic, uint16_t queue_idx, @@ -1128,7 +1145,7 @@ int enic_probe(struct enic *enic) struct rte_pci_device *pdev = enic->pdev; int err = -1; - dev_debug(enic, " Initializing ENIC PMD version %s\n", DRV_VERSION); + dev_debug(enic, " Initializing ENIC PMD\n"); enic->bar0.vaddr = (void *)pdev->mem_resource[0].addr; enic->bar0.len = pdev->mem_resource[0].len; diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 2f4a08c5..845a8e66 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -398,7 +398,14 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index) pool = ((struct rte_mbuf *)buf->mb)->pool; for (i = 0; i < nb_to_free; i++) { buf = &wq->bufs[tail_idx]; - m = (struct rte_mbuf *)(buf->mb); + m = __rte_pktmbuf_prefree_seg((struct rte_mbuf *)(buf->mb)); + buf->mb = NULL; + + if (unlikely(m == NULL)) { + tail_idx = enic_ring_incr(desc_count, tail_idx); + continue; + } + if (likely(m->pool == pool)) { RTE_ASSERT(nb_free < ENIC_MAX_WQ_DESCS); free[nb_free++] = m; @@ -409,7 +416,6 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index) pool = m->pool; } tail_idx = enic_ring_incr(desc_count, tail_idx); - buf->mb = NULL; } rte_mempool_put_bulk(pool, (void **)free, nb_free); diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 217853fb..144b2de8 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2738,10 +2738,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en; /* Check if Vector Tx is satisfied */ - if (fm10k_tx_vec_condition_check(txq)) { + if (fm10k_tx_vec_condition_check(txq)) use_sse = 0; - break; - } } if (use_sse) { diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index daac2361..3f9f05ee 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2718,16 +2718,12 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi = pf->main_vsi; - struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) { - i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, false, NULL); + if (dev->data->dev_conf.rxmode.hw_vlan_filter) i40e_vsi_config_vlan_filter(vsi, TRUE); - } else { - i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, true, NULL); + else i40e_vsi_config_vlan_filter(vsi, FALSE); - } } if (mask & ETH_VLAN_STRIP_MASK) { @@ -5777,28 +5773,17 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { uint32_t vid_idx, vid_bit; - struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); - struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0}; - int ret; if (vlan_id > ETH_VLAN_ID_MAX) return; vid_idx = I40E_VFTA_IDX(vlan_id); vid_bit = I40E_VFTA_BIT(vlan_id); - vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id); - if (on) { - ret = i40e_aq_add_vlan(hw, vsi->seid, &vlan_data, 1, NULL); - if (ret != I40E_SUCCESS) - PMD_DRV_LOG(ERR, "Failed to add vlan filter"); + if (on) vsi->vfta[vid_idx] |= vid_bit; - } else { - ret = i40e_aq_remove_vlan(hw, vsi->seid, &vlan_data, 1, NULL); - if (ret != I40E_SUCCESS) - PMD_DRV_LOG(ERR, "Failed to remove vlan filter"); + else vsi->vfta[vid_idx] &= ~vid_bit; - } } /** diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 615de945..fce3381a 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -472,8 +472,8 @@ mlx5_wqe_write_inline_vlan(struct txq *txq, volatile union mlx5_wqe *wqe, (uint8_t *)addr, 12); rte_memcpy((uint8_t *)(uintptr_t)wqe->inl.eseg.inline_hdr_start + 12, &vlan, sizeof(vlan)); - rte_memcpy((uint8_t *)(uintptr_t)wqe->inl.eseg.inline_hdr_start + 16, - ((uint8_t *)addr + 12), 2); + rte_memcpy((uint8_t *)((uintptr_t)wqe->inl.eseg.inline_hdr_start + 16), + (uint8_t *)(addr + 12), 2); addr += MLX5_ETH_VLAN_INLINE_HEADER_SIZE - sizeof(vlan); length -= MLX5_ETH_VLAN_INLINE_HEADER_SIZE - sizeof(vlan); size = (sizeof(wqe->inl.ctrl.ctrl) + diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 782d7d38..6b4f66e9 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -342,7 +342,7 @@ virtio_user_pmd_devinit(const char *name, const char *params) goto end; } - if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1) + if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1) { ret = rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PATH, &get_string_arg, &path); if (ret < 0) { @@ -350,7 +350,7 @@ virtio_user_pmd_devinit(const char *name, const char *params) VIRTIO_USER_ARG_PATH); goto end; } - else { + } else { PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio-user\n", VIRTIO_USER_ARG_QUEUE_SIZE); goto end; diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 24857f2d..537cee1f 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -221,14 +221,22 @@ lcore_rx(struct lcore_params *p) struct rte_mbuf *bufs[BURST_SIZE*2]; const uint16_t nb_rx = rte_eth_rx_burst(port, 0, bufs, BURST_SIZE); + if (unlikely(nb_rx == 0)) { + if (++port == nb_ports) + port = 0; + continue; + } app_stats.rx.rx_pkts += nb_rx; rte_distributor_process(d, bufs, nb_rx); const uint16_t nb_ret = rte_distributor_returned_pkts(d, bufs, BURST_SIZE*2); app_stats.rx.returned_pkts += nb_ret; - if (unlikely(nb_ret == 0)) + if (unlikely(nb_ret == 0)) { + if (++port == nb_ports) + port = 0; continue; + } uint16_t sent = rte_ring_enqueue_burst(r, (void *)bufs, nb_ret); app_stats.rx.enqueued_pkts += sent; diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index f78743d0..1ca144b8 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -384,7 +384,8 @@ send_single_packet(struct rte_mbuf *m, uint8_t port) } static inline void -inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip) +inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip, + uint16_t lim) { struct rte_mbuf *m; uint32_t i, j, res, sa_idx; @@ -399,15 +400,15 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip) for (i = 0; i < ip->num; i++) { m = ip->pkts[i]; res = ip->res[i]; - if (res & DISCARD) { - rte_pktmbuf_free(m); - continue; - } if (res & BYPASS) { ip->pkts[j++] = m; continue; } - /* Check return SA SPI matches pkt SPI */ + if (res & DISCARD || i < lim) { + rte_pktmbuf_free(m); + continue; + } + /* Only check SPI match for processed IPSec packets */ sa_idx = ip->res[i] & PROTECT_MASK; if (sa_idx == 0 || !inbound_sa_check(sa, m, sa_idx)) { rte_pktmbuf_free(m); @@ -423,11 +424,14 @@ process_pkts_inbound(struct ipsec_ctx *ipsec_ctx, struct ipsec_traffic *traffic) { struct rte_mbuf *m; - uint16_t idx, nb_pkts_in, i; + uint16_t idx, nb_pkts_in, i, n_ip4, n_ip6; nb_pkts_in = ipsec_inbound(ipsec_ctx, traffic->ipsec.pkts, traffic->ipsec.num, MAX_PKT_BURST); + n_ip4 = traffic->ip4.num; + n_ip6 = traffic->ip6.num; + /* SP/ACL Inbound check ipsec and ip4 */ for (i = 0; i < nb_pkts_in; i++) { m = traffic->ipsec.pkts[i]; @@ -447,9 +451,11 @@ process_pkts_inbound(struct ipsec_ctx *ipsec_ctx, rte_pktmbuf_free(m); } - inbound_sp_sa(ipsec_ctx->sp4_ctx, ipsec_ctx->sa_ctx, &traffic->ip4); + inbound_sp_sa(ipsec_ctx->sp4_ctx, ipsec_ctx->sa_ctx, &traffic->ip4, + n_ip4); - inbound_sp_sa(ipsec_ctx->sp6_ctx, ipsec_ctx->sa_ctx, &traffic->ip6); + inbound_sp_sa(ipsec_ctx->sp6_ctx, ipsec_ctx->sa_ctx, &traffic->ip6, + n_ip6); } static inline void diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index a1ce7127..dd39cc16 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -45,6 +45,8 @@ #include <ctype.h> #include <errno.h> #include <getopt.h> +#include <fcntl.h> +#include <unistd.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> @@ -588,10 +590,18 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) static void generate_random_key(uint8_t *key, unsigned length) { - unsigned i; + int fd; + int ret; + + fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) + rte_exit(EXIT_FAILURE, "Failed to generate random key\n"); - for (i = 0; i < length; i++) - key[i] = rand() % 0xff; + ret = read(fd, key, length); + close(fd); + + if (ret != (signed)length) + rte_exit(EXIT_FAILURE, "Failed to generate random key\n"); } static struct rte_cryptodev_sym_session * @@ -1195,8 +1205,6 @@ l2fwd_crypto_parse_timer_period(struct l2fwd_crypto_options *options, static void l2fwd_crypto_default_options(struct l2fwd_crypto_options *options) { - srand(time(NULL)); - options->portmask = 0xffffffff; options->nb_ports_per_lcore = 1; options->refresh_period = 10000; diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index 698fa0a1..988cbbce 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c +SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 1852c4a4..a335e04b 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -158,6 +158,7 @@ DPDK_16.07 { pci_get_sysfs_path; rte_keepalive_mark_sleep; rte_keepalive_register_relay_callback; + rte_rtm_supported; rte_thread_setname; } DPDK_16.04; diff --git a/lib/librte_eal/common/arch/x86/rte_spinlock.c b/lib/librte_eal/common/arch/x86/rte_spinlock.c new file mode 100644 index 00000000..c383e9f0 --- /dev/null +++ b/lib/librte_eal/common/arch/x86/rte_spinlock.c @@ -0,0 +1,45 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdint.h> + +#include "rte_cpuflags.h" + +uint8_t rte_rtm_supported; /* cache the flag to avoid the overhead + of the rte_cpu_get_flag_enabled function */ + +static void __attribute__((constructor)) +rte_rtm_init(void) +{ + rte_rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); +} diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h index 02f95cbb..8e630c21 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h +++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h @@ -94,24 +94,17 @@ rte_spinlock_trylock (rte_spinlock_t *sl) } #endif -static uint8_t rtm_supported; /* cache the flag to avoid the overhead - of the rte_cpu_get_flag_enabled function */ - -static inline void __attribute__((constructor)) -rte_rtm_init(void) -{ - rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); -} +extern uint8_t rte_rtm_supported; static inline int rte_tm_supported(void) { - return rtm_supported; + return rte_rtm_supported; } static inline int rte_try_tm(volatile int *lock) { - if (!rtm_supported) + if (!rte_rtm_supported) return 0; int retries = RTE_RTM_MAX_RETRIES; diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h index 37102227..eacc86c1 100644 --- a/lib/librte_eal/common/include/rte_version.h +++ b/lib/librte_eal/common/include/rte_version.h @@ -77,7 +77,7 @@ extern "C" { * 0-15 = release candidates * 16 = release */ -#define RTE_VER_RELEASE 2 +#define RTE_VER_RELEASE 3 /** * Macro to compute a version number usable for comparisons diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 1a976931..182729c0 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -106,6 +106,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_keepalive.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c +SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 46cd6831..5f478c59 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -431,7 +431,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) } else { memreg[0].offset = reg.offset; memreg[0].size = table_start; - memreg[1].offset = table_end; + memreg[1].offset = reg.offset + table_end; memreg[1].size = reg.size - table_end; RTE_LOG(DEBUG, EAL, @@ -474,7 +474,9 @@ pci_vfio_map_resource(struct rte_pci_device *dev) /* if there's a second part, try to map it */ if (map_addr != MAP_FAILED && memreg[1].offset && memreg[1].size) { - void *second_addr = RTE_PTR_ADD(bar_addr, memreg[1].offset); + void *second_addr = RTE_PTR_ADD(bar_addr, + memreg[1].offset - + (uintptr_t)reg.offset); map_addr = pci_map_resource(second_addr, vfio_dev_fd, memreg[1].offset, memreg[1].size, diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index fcb0ab38..702f7a2e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -344,7 +344,8 @@ vfio_is_enabled(const char *modname) } const struct vfio_iommu_type * -vfio_set_iommu_type(int vfio_container_fd) { +vfio_set_iommu_type(int vfio_container_fd) +{ unsigned idx; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { const struct vfio_iommu_type *t = &iommu_types[idx]; @@ -366,7 +367,8 @@ vfio_set_iommu_type(int vfio_container_fd) { } int -vfio_has_supported_extensions(int vfio_container_fd) { +vfio_has_supported_extensions(int vfio_container_fd) +{ int ret; unsigned idx, n_extensions = 0; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a617b9e4..db8c9845 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -162,6 +162,7 @@ DPDK_16.07 { pci_get_sysfs_path; rte_keepalive_mark_sleep; rte_keepalive_register_relay_callback; + rte_rtm_supported; rte_thread_setname; } DPDK_16.04; diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 92cedf2f..9ac7081c 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -77,7 +77,7 @@ struct ip_frag_key { uint32_t key_len; /**< src/dst key length */ }; -/* +/** * @internal Fragmented packet to reassemble. * First two entries in the frags[] array are for the last and first fragments. */ @@ -151,7 +151,7 @@ struct ipv6_extension_fragment { -/* +/** * Create a new IP fragmentation table. * * @param bucket_num @@ -174,14 +174,14 @@ struct rte_ip_frag_tbl * rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, uint32_t max_entries, uint64_t max_cycles, int socket_id); -/* +/** * Free allocated IP fragmentation table. * - * @param btl + * @param tbl * Fragmentation table to free. */ static inline void -rte_ip_frag_table_destroy( struct rte_ip_frag_tbl *tbl) +rte_ip_frag_table_destroy(struct rte_ip_frag_tbl *tbl) { rte_free(tbl); } @@ -215,7 +215,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_direct, struct rte_mempool *pool_indirect); -/* +/** * This function implements reassembly of fragmented IPv6 packets. * Incoming mbuf should have its l2_len/l3_len fields setup correctly. * @@ -241,7 +241,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); -/* +/** * Return a pointer to the packet's fragment header, if found. * It only looks at the extension header that's right after the fixed IPv6 * header, and doesn't follow the whole chain of extension headers. @@ -291,7 +291,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_direct, struct rte_mempool *pool_indirect); -/* +/** * This function implements reassembly of fragmented IPv4 packets. * Incoming mbufs should have its l2_len/l3_len fields setup correclty. * @@ -314,7 +314,7 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); -/* +/** * Check if the IPv4 packet is fragmented * * @param hdr @@ -333,7 +333,7 @@ rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { return ip_flag != 0 || ip_ofs != 0; } -/* +/** * Free mbufs on a given death row. * * @param dr @@ -345,7 +345,7 @@ void rte_ip_frag_free_death_row(struct rte_ip_frag_death_row *dr, uint32_t prefetch); -/* +/** * Dump fragmentation table statistics to file. * * @param f diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 6ec09063..8806633b 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -199,7 +199,11 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags, sz->header_size = RTE_ALIGN_CEIL(sz->header_size, RTE_MEMPOOL_ALIGN); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG sz->trailer_size = sizeof(struct rte_mempool_objtlr); +#else + sz->trailer_size = 0; +#endif /* element size is 8 bytes-aligned at least */ sz->elt_size = RTE_ALIGN_CEIL(elt_size, sizeof(uint64_t)); diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index fb7052e1..4a8fbb1e 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -163,6 +163,8 @@ struct rte_mempool_objhdr { */ STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + /** * Mempool object trailer structure * @@ -170,11 +172,11 @@ STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr); * trailer structure containing a cookie preventing memory corruptions. */ struct rte_mempool_objtlr { -#ifdef RTE_LIBRTE_MEMPOOL_DEBUG uint64_t cookie; /**< Debug cookie. */ -#endif }; +#endif + /** * A list of memory where objects are stored */ diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index 22ed4769..9b921ce2 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -449,6 +449,7 @@ pdump_get_socket_path(char *buffer, int bufsz, enum rte_pdump_socktype type) char dpdk_dir[PATH_MAX] = {0}; char dir[PATH_MAX] = {0}; char *dir_home = NULL; + int ret = 0; if (type == RTE_PDUMP_SOCKET_SERVER && server_socket_dir[0] != 0) snprintf(dir, sizeof(dir), "%s", server_socket_dir); @@ -475,7 +476,16 @@ pdump_get_socket_path(char *buffer, int bufsz, enum rte_pdump_socktype type) dpdk_dir, SOCKET_DIR); } - mkdir(dir, 700); + ret = mkdir(dir, 700); + /* if user passed socket path is invalid, return immediately */ + if (ret < 0 && errno != EEXIST) { + RTE_LOG(ERR, PDUMP, + "Failed to create dir:%s:%s\n", dir, + strerror(errno)); + rte_errno = errno; + return -1; + } + if (type == RTE_PDUMP_SOCKET_SERVER) snprintf(buffer, bufsz, SERVER_SOCKET, dir); else @@ -667,8 +677,8 @@ pdump_create_client_socket(struct pdump_request *p) "client socket(): %s:pid(%d):tid(%u), %s:%d\n", strerror(errno), pid, rte_sys_gettid(), __func__, __LINE__); - ret = errno; - return ret; + rte_errno = errno; + return -1; } ret = pdump_get_socket_path(addr.sun_path, sizeof(addr.sun_path), @@ -677,6 +687,7 @@ pdump_create_client_socket(struct pdump_request *p) RTE_LOG(ERR, PDUMP, "Failed to get client socket path: %s:%d\n", __func__, __LINE__); + rte_errno = errno; goto exit; } addr.sun_family = AF_UNIX; @@ -688,7 +699,7 @@ pdump_create_client_socket(struct pdump_request *p) RTE_LOG(ERR, PDUMP, "client bind(): %s, %s:%d\n", strerror(errno), __func__, __LINE__); - ret = errno; + rte_errno = errno; break; } @@ -701,6 +712,7 @@ pdump_create_client_socket(struct pdump_request *p) RTE_LOG(ERR, PDUMP, "Failed to get server socket path: %s:%d\n", __func__, __LINE__); + rte_errno = errno; break; } serv_addr.sun_family = AF_UNIX; @@ -711,7 +723,8 @@ pdump_create_client_socket(struct pdump_request *p) RTE_LOG(ERR, PDUMP, "failed to send to server:%s, %s:%d\n", strerror(errno), __func__, __LINE__); - ret = errno; + rte_errno = errno; + ret = -1; break; } @@ -722,7 +735,8 @@ pdump_create_client_socket(struct pdump_request *p) RTE_LOG(ERR, PDUMP, "failed to recv from server:%s, %s:%d\n", strerror(errno), __func__, __LINE__); - ret = errno; + rte_errno = errno; + ret = -1; break; } ret = server_resp.err_value; diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 15ca9562..bc00518a 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -147,10 +147,15 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0}; desc = &vq->desc[desc_idx]; - if (unlikely(desc->len < dev->vhost_hlen)) + desc_addr = gpa_to_vva(dev, desc->addr); + /* + * Checking of 'desc_addr' placed outside of 'unlikely' macro to avoid + * performance issue with some versions of gcc (4.8.4 and 5.3.0) which + * otherwise stores offset on the stack instead of in a register. + */ + if (unlikely(desc->len < dev->vhost_hlen) || !desc_addr) return -1; - desc_addr = gpa_to_vva(dev, desc->addr); rte_prefetch0((void *)(uintptr_t)desc_addr); virtio_enqueue_offload(m, &virtio_hdr.hdr); @@ -182,7 +187,10 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, return -1; desc = &vq->desc[desc->next]; - desc_addr = gpa_to_vva(dev, desc->addr); + desc_addr = gpa_to_vva(dev, desc->addr); + if (unlikely(!desc_addr)) + return -1; + desc_offset = 0; desc_avail = desc->len; } @@ -387,10 +395,10 @@ copy_mbuf_to_desc_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, LOG_DEBUG(VHOST_DATA, "(%d) current index %d | end index %d\n", dev->vid, cur_idx, end_idx); - if (buf_vec[vec_idx].buf_len < dev->vhost_hlen) - return -1; - desc_addr = gpa_to_vva(dev, buf_vec[vec_idx].buf_addr); + if (buf_vec[vec_idx].buf_len < dev->vhost_hlen || !desc_addr) + return 0; + rte_prefetch0((void *)(uintptr_t)desc_addr); virtio_hdr.num_buffers = end_idx - start_idx; @@ -425,6 +433,8 @@ copy_mbuf_to_desc_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, vec_idx++; desc_addr = gpa_to_vva(dev, buf_vec[vec_idx].buf_addr); + if (unlikely(!desc_addr)) + return 0; /* Prefetch buffer address. */ rte_prefetch0((void *)(uintptr_t)desc_addr); @@ -507,7 +517,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, *(volatile uint16_t *)&vq->used->idx += nr_used; vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx), sizeof(vq->used->idx)); - vq->last_used_idx = end; + vq->last_used_idx += nr_used; } if (likely(pkt_idx)) { @@ -688,6 +698,9 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, return -1; desc_addr = gpa_to_vva(dev, desc->addr); + if (unlikely(!desc_addr)) + return -1; + hdr = (struct virtio_net_hdr *)((uintptr_t)desc_addr); rte_prefetch0(hdr); @@ -701,6 +714,9 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, desc = &vq->desc[desc->next]; desc_addr = gpa_to_vva(dev, desc->addr); + if (unlikely(!desc_addr)) + return -1; + rte_prefetch0((void *)(uintptr_t)desc_addr); desc_offset = 0; @@ -737,6 +753,9 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, desc = &vq->desc[desc->next]; desc_addr = gpa_to_vva(dev, desc->addr); + if (unlikely(!desc_addr)) + return -1; + rte_prefetch0((void *)(uintptr_t)desc_addr); desc_offset = 0; diff --git a/lib/librte_vhost/vhost_user/fd_man.c b/lib/librte_vhost/vhost_user/fd_man.c index 087aaed6..c691339a 100644 --- a/lib/librte_vhost/vhost_user/fd_man.c +++ b/lib/librte_vhost/vhost_user/fd_man.c @@ -71,20 +71,22 @@ fdset_find_free_slot(struct fdset *pfdset) return fdset_find_fd(pfdset, -1); } -static void +static int fdset_add_fd(struct fdset *pfdset, int idx, int fd, fd_cb rcb, fd_cb wcb, void *dat) { struct fdentry *pfdentry; - if (pfdset == NULL || idx >= MAX_FDS) - return; + if (pfdset == NULL || idx >= MAX_FDS || fd >= FD_SETSIZE) + return -1; pfdentry = &pfdset->fd[idx]; pfdentry->fd = fd; pfdentry->rcb = rcb; pfdentry->wcb = wcb; pfdentry->dat = dat; + + return 0; } /** @@ -150,12 +152,11 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) /* Find a free slot in the list. */ i = fdset_find_free_slot(pfdset); - if (i == -1) { + if (i == -1 || fdset_add_fd(pfdset, i, fd, rcb, wcb, dat) < 0) { pthread_mutex_unlock(&pfdset->fd_mutex); return -2; } - fdset_add_fd(pfdset, i, fd, rcb, wcb, dat); pfdset->num++; pthread_mutex_unlock(&pfdset->fd_mutex); diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c index a0d83f3c..f0ea3a27 100644 --- a/lib/librte_vhost/vhost_user/vhost-net-user.c +++ b/lib/librte_vhost/vhost_user/vhost-net-user.c @@ -257,6 +257,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) int vid; size_t size; struct vhost_user_connection *conn; + int ret; conn = malloc(sizeof(*conn)); if (conn == NULL) { @@ -278,7 +279,15 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) conn->vsocket = vsocket; conn->vid = vid; - fdset_add(&vhost_user.fdset, fd, vhost_user_msg_handler, NULL, conn); + ret = fdset_add(&vhost_user.fdset, fd, vhost_user_msg_handler, + NULL, conn); + if (ret < 0) { + free(conn); + close(fd); + RTE_LOG(ERR, VHOST_CONFIG, + "failed to add fd %d into vhost server fdset\n", + fd); + } } /* call back when there is new vhost-user connection from client */ @@ -470,8 +479,14 @@ vhost_user_create_server(struct vhost_user_socket *vsocket) goto err; vsocket->listenfd = fd; - fdset_add(&vhost_user.fdset, fd, vhost_user_server_new_connection, + ret = fdset_add(&vhost_user.fdset, fd, vhost_user_server_new_connection, NULL, vsocket); + if (ret < 0) { + RTE_LOG(ERR, VHOST_CONFIG, + "failed to add listen fd %d to vhost server fdset\n", + fd); + goto err; + } return 0; diff --git a/mk/rte.app.mk b/mk/rte.app.mk index ea229618..886dbdd8 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -176,6 +176,8 @@ ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy) LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib endif +MAPFLAGS = -Map=$@.map --cref + .PHONY: all all: install @@ -190,13 +192,13 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) ifeq ($(LINK_USING_CC),1) -override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) -O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ - -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \ - $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS)) +O_TO_EXE = $(CC) -o $@ $(CFLAGS) $(OBJS-y) $(call linkerprefix, \ + $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + $(MAPFLAGS)) else -O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ - -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS) +O_TO_EXE = $(LD) -o $@ $(OBJS-y) \ + $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + $(MAPFLAGS) endif O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," LD $(@)") diff --git a/scripts/test-build.sh b/scripts/test-build.sh index 5bcecfc3..d2cafc19 100755 --- a/scripts/test-build.sh +++ b/scripts/test-build.sh @@ -39,6 +39,7 @@ default_path=$PATH # - DPDK_DEP_CFLAGS # - DPDK_DEP_LDFLAGS # - DPDK_DEP_MOFED (y/[n]) +# - DPDK_DEP_NUMA (y/[n]) # - DPDK_DEP_PCAP (y/[n]) # - DPDK_DEP_SSL (y/[n]) # - DPDK_DEP_SZE (y/[n]) @@ -95,12 +96,13 @@ configs=${*:-$DPDK_BUILD_TEST_CONFIGS} success=false on_exit () { - if [ "$DPDK_NOTIFY" = notify-send ] ; then - if $success ; then + if $success ; then + [ "$DPDK_NOTIFY" != notify-send ] || \ notify-send -u low --icon=dialog-information 'DPDK build' 'finished' - elif [ -z "$signal" ] ; then + elif [ -z "$signal" ] ; then + [ -z "$dir" ] || echo "failed to build $dir" >&2 + [ "$DPDK_NOTIFY" != notify-send ] || \ notify-send -u low --icon=dialog-error 'DPDK build' 'failed' - fi fi } # catch manual interrupt to ignore notification @@ -118,6 +120,7 @@ reset_env () unset DPDK_DEP_CFLAGS unset DPDK_DEP_LDFLAGS unset DPDK_DEP_MOFED + unset DPDK_DEP_NUMA unset DPDK_DEP_PCAP unset DPDK_DEP_SSL unset DPDK_DEP_SZE @@ -154,9 +157,8 @@ config () # <directory> <target> <options> sed -ri 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config ) # Automatic configuration - ! echo $2 | grep -q '^x86_64' || \ + test "$DPDK_DEP_NUMA" != y || \ sed -ri 's,(NUMA=)n,\1y,' $1/.config - sed -ri 's,(PCI_CONFIG=)n,\1y,' $1/.config sed -ri 's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config sed -ri 's,(BYPASS=)n,\1y,' $1/.config test "$DPDK_DEP_ARCHIVE" != y || \ @@ -231,6 +233,7 @@ for conf in $configs ; do O=$(readlink -m $dir/examples/performance-thread) unset RTE_TARGET echo "################## $dir done." + unset dir done if ! $short ; then |