* [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver @ 2017-12-12 19:27 Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 2/7] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh ` (10 more replies) 0 siblings, 11 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Move octeontx eventdev specific test (test_eventdev_octeontx.c) to driver/event/octeontx. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- .../event/octeontx/selftest_octeontx.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/selftest_octeontx.c (100%) diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/selftest_octeontx.c similarity index 100% rename from test/test/test_eventdev_octeontx.c rename to drivers/event/octeontx/selftest_octeontx.c diff --git a/test/test/Makefile b/test/test/Makefile index bb54c9808..87e3169d2 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 2/7] event/octeontx: modify octeontx eventdev test 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 3/7] event/octeontx: add selftest to device arguments Pavan Nikhilesh ` (9 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Modify test_eventdev_octeontx to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/selftest_octeontx.c | 449 +++++++++++++++++------------ 1 file changed, 258 insertions(+), 191 deletions(-) diff --git a/drivers/event/octeontx/selftest_octeontx.c b/drivers/event/octeontx/selftest_octeontx.c index 8fddb4fd2..2b666007d 100644 --- a/drivers/event/octeontx/selftest_octeontx.c +++ b/drivers/event/octeontx/selftest_octeontx.c @@ -47,11 +47,56 @@ #include <rte_random.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "ssovf_evdev.h" #define NUM_PACKETS (1 << 18) #define MAX_EVENTS (16 * 1024) +#define ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + ssovf_log_dbg("Assert failed %s() line %d failed : " \ + msg , __func__, __LINE__, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define ASSERT_EQUAL(a, b, msg, ...) do { \ + if (!(a == b)) { \ + ssovf_log_dbg("Assert failed %s() line %d failed : " \ + msg , __func__, __LINE__, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define ASSERT_SUCCESS(val, msg, ...) do { \ + typeof(val) _val = (val); \ + if (!(_val == 0)) { \ + ssovf_log_dbg("Assert failed %s() line %d failed (err %d): " \ + msg , __func__, __LINE__, _val, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define ASSERT_NOT_NULL(val, msg, ...) do { \ + if (!(val != NULL)) { \ + ssovf_log_dbg("Assert failed %s() line %d failed : " \ + msg , __func__, __LINE__, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ + octeontx_test_run(setup, teardown, test, #test) + +static int total; +static int passed; +static int failed; +static int unsupported; + static int evdev; static struct rte_mempool *eventdev_test_mempool; @@ -79,11 +124,11 @@ static inline int seqn_list_update(int val) { if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; + return -1; seqn_list[seqn_list_index++] = val; rte_smp_wmb(); - return TEST_SUCCESS; + return 0; } static inline int @@ -93,11 +138,11 @@ seqn_list_check(int limit) for (i = 0; i < limit; i++) { if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); + return -1; } } - return TEST_SUCCESS; + return 0; } struct test_core_param { @@ -114,20 +159,21 @@ testsuite_setup(void) evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", + ssovf_log_dbg("%d: Eventdev %s not found - creating.", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; + ssovf_log_dbg("Error creating eventdev %s", + eventdev_name); + return -1; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; + ssovf_log_dbg("Error finding newly created eventdev"); + return -1; } } - return TEST_SUCCESS; + return 0; } static void @@ -177,31 +223,34 @@ _eventdev_setup(int mode) 512, /* Use very small mbufs */ rte_socket_id()); if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; + ssovf_log_dbg("ERROR creating mempool"); + return -1; } ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); + ASSERT_SUCCESS(ret, "Failed to get event dev info"); + if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) { + ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); + return -1; + } devconf_set_default_sane_values(&dev_conf, &info); if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + ASSERT_SUCCESS(ret, "Failed to configure eventdev"); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); + ssovf_log_dbg( + "test expects the unique priority per queue"); return -ENOTSUP; } @@ -216,35 +265,35 @@ _eventdev_setup(int mode) ret = rte_event_queue_default_conf_get(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); queue_conf.priority = i * step; ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); } } else { /* Configure event queues with default priority */ for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); } } /* Configure event ports */ uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + ASSERT(ret >= 0, "Failed to link all queues port=%d", i); } ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + ASSERT_SUCCESS(ret, "Failed to start device"); - return TEST_SUCCESS; + return 0; } static inline int @@ -311,7 +360,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, @@ -332,7 +381,7 @@ check_excess_events(uint8_t port) for (i = 0; i < 32; i++) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", + ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", ev.mbuf->seqn); } return 0; @@ -346,12 +395,12 @@ generate_random_events(const unsigned int total_events) int ret; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { ret = inject_events( rte_rand() % info.max_event_queue_flows /*flow_id */, @@ -362,7 +411,7 @@ generate_random_events(const unsigned int total_events) 0 /* port */, 1 /* events */); if (ret) - return TEST_FAILED; + return -1; } return ret; } @@ -374,19 +423,19 @@ validate_event(struct rte_event *ev) struct event_attr *attr; attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, + ASSERT_EQUAL(attr->flow_id, ev->flow_id, "flow_id mismatch enq=%d deq =%d", attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, + ASSERT_EQUAL(attr->event_type, ev->event_type, "event_type mismatch enq=%d deq =%d", attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, + ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, "sub_event_type mismatch enq=%d deq =%d", attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, + ASSERT_EQUAL(attr->sched_type, ev->sched_type, "sched_type mismatch enq=%d deq =%d", attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, + ASSERT_EQUAL(attr->queue, ev->queue_id, "queue mismatch enq=%d deq =%d", attr->queue, ev->queue_id); return 0; @@ -405,8 +454,8 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) while (1) { if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; + ssovf_log_dbg("Detected deadlock"); + return -1; } valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); @@ -416,11 +465,11 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) forward_progress_cnt = 0; ret = validate_event(&ev); if (ret) - return TEST_FAILED; + return -1; if (fn != NULL) { ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, + ASSERT_SUCCESS(ret, "Failed to validate test specific event"); } @@ -438,7 +487,7 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, + ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, ev->mbuf->seqn); return 0; } @@ -456,7 +505,7 @@ test_simple_enqdeq(uint8_t sched_type) 0 /* port */, MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); } @@ -491,7 +540,7 @@ test_multi_queue_enq_single_port_deq(void) ret = generate_random_events(MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, NULL); } @@ -514,7 +563,7 @@ static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint32_t range = MAX_EVENTS / queue_count; @@ -522,7 +571,7 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, + ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, queue_count, MAX_EVENTS); @@ -538,7 +587,7 @@ test_multi_queue_priority(void) /* See validate_queue_priority() comments for priority validate logic */ uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); max_evts_roundoff = MAX_EVENTS / queue_count; @@ -548,7 +597,7 @@ test_multi_queue_priority(void) struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; queue = i % queue_count; @@ -576,7 +625,7 @@ worker_multi_port_fn(void *arg) continue; ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); + ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } @@ -587,27 +636,29 @@ static inline int wait_workers_to_join(int lcore, const rte_atomic32_t *count) { uint64_t cycles, print_cycles; + RTE_SET_USED(count); print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != FINISHED) { uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, + ssovf_log_dbg("\r%s: events %d", __func__, rte_atomic32_read(count)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", + ssovf_log_dbg( + "%s: No schedules for seconds, deadlock (%d)", __func__, rte_atomic32_read(count)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; - return TEST_FAILED; + return -1; } } rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; + return 0; } @@ -631,12 +682,12 @@ launch_workers_and_wait(int (*master_worker)(void *), param = malloc(sizeof(struct test_core_param) * nb_workers); if (!param) - return TEST_FAILED; + return -1; ret = rte_event_dequeue_timeout_ticks(evdev, rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); if (ret) - return TEST_FAILED; + return -1; param[0].total_events = &atomic_total_events; param[0].sched_type = sched_type; @@ -679,17 +730,17 @@ test_multi_queue_enq_multi_port_deq(void) ret = generate_random_events(total_events); if (ret) - return TEST_FAILED; + return -1; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } return launch_workers_and_wait(worker_multi_port_fn, @@ -702,7 +753,7 @@ validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, + ASSERT_EQUAL(port, ev->queue_id, "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -718,18 +769,18 @@ test_queue_to_port_single_link(void) int i, nr_links, ret; uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); /* Unlink all connections that created in eventdev_setup */ for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); + ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); } uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); @@ -741,7 +792,7 @@ test_queue_to_port_single_link(void) uint8_t queue = (uint8_t)i; ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); + ASSERT(ret == 1, "Failed to link queue to port %d", i); ret = inject_events( 0x100 /*flow_id */, @@ -752,7 +803,7 @@ test_queue_to_port_single_link(void) i /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; } /* Verify the events generated from correct queue */ @@ -760,10 +811,10 @@ test_queue_to_port_single_link(void) ret = consume_events(i /* port */, total_events, validate_queue_to_port_single_link); if (ret) - return TEST_FAILED; + return -1; } - return TEST_SUCCESS; + return 0; } static int @@ -771,7 +822,7 @@ validate_queue_to_port_multi_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), + ASSERT_EQUAL(port, (ev->queue_id & 0x1), "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -789,27 +840,27 @@ test_queue_to_port_multi_link(void) uint32_t nr_queues = 0; uint32_t nr_ports = 0; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", + ssovf_log_dbg("%s: Not enough ports to test ports=%d", __func__, nr_ports); - return TEST_SUCCESS; + return 0; } /* Unlink all connections that created in eventdev_setup */ for (port = 0; port < nr_ports; port++) { ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", + ASSERT(ret >= 0, "Failed to unlink all queues port=%d", port); } @@ -819,7 +870,7 @@ test_queue_to_port_multi_link(void) for (queue = 0; queue < nr_queues; queue++) { port = queue & 0x1; ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", + ASSERT(ret == 1, "Failed to link queue=%d to port=%d", queue, port); ret = inject_events( @@ -831,7 +882,7 @@ test_queue_to_port_multi_link(void) port /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; if (port == 0) port0_events += total_events; @@ -842,13 +893,13 @@ test_queue_to_port_multi_link(void) ret = consume_events(0 /* port */, port0_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; ret = consume_events(1 /* port */, port1_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; - return TEST_SUCCESS; + return 0; } static int @@ -878,17 +929,17 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.sub_event_type = %d\n", + ssovf_log_dbg("Invalid ev.sub_event_type = %d", ev.sub_event_type); - return TEST_FAILED; + return -1; } } return 0; @@ -902,15 +953,15 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -923,20 +974,20 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_flow_based_pipeline, worker_flow_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } @@ -1033,16 +1084,16 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; + ssovf_log_dbg("Invalid ev.queue_id = %d", ev.queue_id); + return -1; } } @@ -1058,21 +1109,21 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", + ssovf_log_dbg("%s: Not enough queues=%d ports=%d or workers=%d", __func__, queue_count, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1085,20 +1136,20 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_group_based_pipeline, worker_group_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } static int @@ -1201,15 +1252,15 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1222,7 +1273,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) 0 /* port */, MAX_EVENTS /* events */); if (ret) - return TEST_FAILED; + return -1; return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, 0xff /* invalid */); @@ -1244,7 +1295,7 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1286,7 +1337,7 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1357,14 +1408,14 @@ test_producer_consumer_ingress_order_test(int (*fn)(void *)) { uint32_t nr_ports; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; + ssovf_log_dbg("### Not enough cores for %s test.", __func__); + return 0; } launch_workers_and_wait(worker_ordered_flow_producer, fn, @@ -1389,86 +1440,102 @@ test_queue_producer_consumer_ingress_order_test(void) worker_group_based_pipeline); } -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ +static void octeontx_test_run(int (*setup)(void), void (*tdown)(void), + int (*test)(void), const char *name) +{ + if (setup() < 0) { + ssovf_log_selftest("Error setting up test %s", name); + unsupported++; + } else { + if (test() < 0) { + failed++; + ssovf_log_selftest("%s Failed", name); + } else { + passed++; + ssovf_log_selftest("%s Passed", name); + } } -}; -static int + total++; + tdown(); +} + +void test_eventdev_octeontx(void) { - return unit_test_suite_runner(&eventdev_octeontx_testsuite); + testsuite_setup(); + + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_multi_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_single_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_multi_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_mixed_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_flow_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup_priority, eventdev_teardown, + test_multi_queue_priority); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + + ssovf_log_selftest("Total tests : %d", total); + ssovf_log_selftest("Passed : %d", passed); + ssovf_log_selftest("Failed : %d", failed); + ssovf_log_selftest("Not supported : %d", unsupported); + + testsuite_teardown(); } - -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 3/7] event/octeontx: add selftest to device arguments 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 2/7] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver Pavan Nikhilesh ` (8 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_octeontx,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 3 ++- drivers/event/octeontx/ssovf_evdev.c | 43 ++++++++++++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_evdev.h | 6 +++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index fdf1b7385..adffd4f09 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_kvargs -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map @@ -54,6 +54,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += selftest_octeontx.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 117b1453e..80e8d23c7 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -38,6 +38,7 @@ #include <rte_eal.h> #include <rte_ethdev.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_kvargs.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> @@ -592,6 +593,15 @@ ssovf_close(struct rte_eventdev *dev) return 0; } +static int +ssovf_self_test(const char *key __rte_unused, const char *value, + void *opaque) +{ + int *flag = opaque; + *flag = !!atoi(value); + return 0; +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -627,7 +637,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) struct rte_eventdev *eventdev; static int ssovf_init_once; const char *name; + const char *params; int ret; + int self_test; + + static const char *const args[] = { + SSOVF_SELF_TEST_ARG, + NULL + }; name = rte_vdev_device_name(vdev); /* More than one instance is not supported */ @@ -636,6 +653,30 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return -EINVAL; } + params = rte_vdev_device_args(vdev); + if (params != NULL && params[0] != '\0') { + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); + + if (!kvlist) { + ssovf_log_info( + "Ignoring unsupported paramss supplied '%s'", + name); + } else { + int ret = rte_kvargs_process(kvlist, + SSOVF_SELF_TEST_ARG, + ssovf_self_test, &self_test); + if (ret != 0) { + ssovf_log_err( + "%s: Error in selftest", + name); + rte_kvargs_free(kvlist); + return ret; + } + } + + rte_kvargs_free(kvlist); + } + eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev), rte_socket_id()); if (eventdev == NULL) { @@ -686,6 +727,8 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) edev->max_event_ports); ssovf_init_once = 1; + if (self_test) + test_eventdev_octeontx(); return 0; error: diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index b093a3e73..4332d2461 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,6 +57,9 @@ #define ssovf_log_err(fmt, args...) \ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define ssovf_log_selftest(fmt, args...) \ + RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) #define SSO_MAX_VHGRP (64) #define SSO_MAX_VHWS (32) @@ -114,6 +117,8 @@ #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8 +#define SSOVF_SELF_TEST_ARG ("self_test") + /* * In Cavium OcteonTX SoC, all accesses to the device registers are * implictly strongly ordered. So, The relaxed version of IO operation is @@ -196,5 +201,6 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +void test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 2/7] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 3/7] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-13 10:22 ` Van Haaren, Harry 2017-12-12 19:27 ` [dpdk-dev] [PATCH 5/7] event/sw: modify eventdev sw test Pavan Nikhilesh ` (7 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Move software eventdev specific test (test_eventdev_sw) to driver/event/sw. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- test/test/test_eventdev_sw.c => drivers/event/sw/selftest_sw.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_sw.c => drivers/event/sw/selftest_sw.c (100%) diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/selftest_sw.c similarity index 100% rename from test/test/test_eventdev_sw.c rename to drivers/event/sw/selftest_sw.c diff --git a/test/test/Makefile b/test/test/Makefile index 87e3169d2..c551ad964 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver 2017-12-12 19:27 ` [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver Pavan Nikhilesh @ 2017-12-13 10:22 ` Van Haaren, Harry 0 siblings, 0 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-13 10:22 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Tuesday, December 12, 2017 7:27 PM > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver > > Move software eventdev specific test (test_eventdev_sw) to > driver/event/sw. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > test/test/test_eventdev_sw.c => drivers/event/sw/selftest_sw.c | 0 > test/test/Makefile | 1 - > 2 files changed, 1 deletion(-) > rename test/test/test_eventdev_sw.c => drivers/event/sw/selftest_sw.c > (100%) > > diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/selftest_sw.c > similarity index 100% > rename from test/test/test_eventdev_sw.c > rename to drivers/event/sw/selftest_sw.c Rename to sw_evdev_selftest.c for consistency with other filenames With that Acked-by: Harry van Haaren <harry.van.haaren@intel.com> > diff --git a/test/test/Makefile b/test/test/Makefile > index 87e3169d2..c551ad964 100644 > --- a/test/test/Makefile > +++ b/test/test/Makefile > @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) > SRCS-y += test_eventdev.c > SRCS-y += test_event_ring.c > SRCS-y += test_event_eth_rx_adapter.c > -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c > endif > > SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c > -- > 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 5/7] event/sw: modify eventdev sw test 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (2 preceding siblings ...) 2017-12-12 19:27 ` [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 6/7] event/sw: add selftest to device arguments Pavan Nikhilesh ` (6 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Modify test_eventdev_sw to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/sw/selftest_sw.c | 71 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/drivers/event/sw/selftest_sw.c b/drivers/event/sw/selftest_sw.c index 96ed920cc..b97175f5b 100644 --- a/drivers/event/sw/selftest_sw.c +++ b/drivers/event/sw/selftest_sw.c @@ -52,7 +52,7 @@ #include <rte_service_component.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "sw_evdev.h" #define MAX_PORTS 16 #define MAX_QIDS 16 @@ -3038,7 +3038,7 @@ worker_loopback(struct test *t) static struct rte_mempool *eventdev_func_mempool; -static int +void test_sw_eventdev(void) { struct test *t = malloc(sizeof(struct test)); @@ -3049,25 +3049,25 @@ test_sw_eventdev(void) */ release_ev.op = RTE_EVENT_OP_RELEASE; - const char *eventdev_name = "event_sw0"; + const char *eventdev_name = "event_sw"; evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("%d: Eventdev %s not found - creating.\n", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { printf("Error creating eventdev\n"); - return -1; + goto test_fail; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("Error finding newly created eventdev\n"); - return -1; + goto test_fail; } } if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { printf("Failed to get service ID for software event dev\n"); - return -1; + goto test_fail; } rte_service_runstate_set(t->service_id, 1); @@ -3084,7 +3084,7 @@ test_sw_eventdev(void) rte_socket_id()); if (!eventdev_func_mempool) { printf("ERROR creating mempool\n"); - return -1; + goto test_fail; } } t->mbuf_pool = eventdev_func_mempool; @@ -3092,153 +3092,153 @@ test_sw_eventdev(void) ret = test_single_directed_packet(t); if (ret != 0) { printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Directed Forward Credit test...\n"); ret = test_directed_forward_credits(t); if (ret != 0) { printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Single Load Balanced Packet test...\n"); ret = single_packet(t); if (ret != 0) { printf("ERROR - Single Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Unordered Basic test...\n"); ret = unordered_basic(t); if (ret != 0) { printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Basic test...\n"); ret = ordered_basic(t); if (ret != 0) { printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Burst Packets test...\n"); ret = burst_packets(t); if (ret != 0) { printf("ERROR - Burst Packets test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing test...\n"); ret = load_balancing(t); if (ret != 0) { printf("ERROR - Load Balancing test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Directed test...\n"); ret = test_priority_directed(t); if (ret != 0) { printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Atomic test...\n"); ret = test_priority_atomic(t); if (ret != 0) { printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Ordered test...\n"); ret = test_priority_ordered(t); if (ret != 0) { printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Unordered test...\n"); ret = test_priority_unordered(t); if (ret != 0) { printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Invalid QID test...\n"); ret = invalid_qid(t); if (ret != 0) { printf("ERROR - Invalid QID test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing History test...\n"); ret = load_balancing_history(t); if (ret != 0) { printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Inflight Count test...\n"); ret = inflight_counts(t); if (ret != 0) { printf("ERROR - Inflight Count test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Abuse Inflights test...\n"); ret = abuse_inflights(t); if (ret != 0) { printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats test...\n"); ret = xstats_tests(t); if (ret != 0) { printf("ERROR - XStats test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Reset test...\n"); ret = xstats_id_reset_tests(t); if (ret != 0) { printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats Brute Force test...\n"); ret = xstats_brute_force(t); if (ret != 0) { printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Abuse test...\n"); ret = xstats_id_abuse_tests(t); if (ret != 0) { printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running QID Priority test...\n"); ret = qid_priorities(t); if (ret != 0) { printf("ERROR - QID Priority test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Reconfigure test...\n"); ret = ordered_reconfigure(t); if (ret != 0) { printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port LB Single Reconfig test...\n"); ret = port_single_lb_reconfig(t); if (ret != 0) { printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port Reconfig Credits test...\n"); ret = port_reconfig_credits(t); if (ret != 0) { printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Head-of-line-blocking test...\n"); ret = holb(t); if (ret != 0) { printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; + goto test_fail; } if (rte_lcore_count() >= 3) { printf("*** Running Worker loopback test...\n"); ret = worker_loopback(t); if (ret != 0) { printf("ERROR - Worker loopback test FAILED.\n"); - return ret; + goto test_fail; } } else { printf("### Not enough cores for worker loopback test.\n"); @@ -3250,7 +3250,8 @@ test_sw_eventdev(void) */ free(t); - return 0; + printf("SW Eventdev Selftest Successful.\n"); + return; +test_fail: + printf("SW Eventdev Selftest Failed.\n"); } - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 6/7] event/sw: add selftest to device arguments 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (3 preceding siblings ...) 2017-12-12 19:27 ` [dpdk-dev] [PATCH 5/7] event/sw: modify eventdev sw test Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation Pavan Nikhilesh ` (5 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_sw,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/sw/Makefile | 2 ++ drivers/event/sw/sw_evdev.c | 23 +++++++++++++++++++++++ drivers/event/sw/sw_evdev.h | 1 + 3 files changed, 26 insertions(+) diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 2f2b67bac..d4f7677fe 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers endif endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring +LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev # library version @@ -57,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_scheduler.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_xstats.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += selftest_sw.c # export include files SYMLINK-y-include += diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index 5b4a20889..7c16d0de6 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -47,6 +47,7 @@ #define NUMA_NODE_ARG "numa_node" #define SCHED_QUANTA_ARG "sched_quanta" #define CREDIT_QUANTA_ARG "credit_quanta" +#define SELF_TEST_ARG "self_test" static void sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info); @@ -756,6 +757,13 @@ set_credit_quanta(const char *key __rte_unused, const char *value, void *opaque) return 0; } +static int +set_self_test(const char *key __rte_unused, const char *value, void *opaque) +{ + int *test = opaque; + *test = !!atoi(value); + return 0; +} static int32_t sw_sched_service_func(void *args) { @@ -796,6 +804,7 @@ sw_probe(struct rte_vdev_device *vdev) NUMA_NODE_ARG, SCHED_QUANTA_ARG, CREDIT_QUANTA_ARG, + SELF_TEST_ARG, NULL }; const char *name; @@ -805,6 +814,7 @@ sw_probe(struct rte_vdev_device *vdev) int socket_id = rte_socket_id(); int sched_quanta = SW_DEFAULT_SCHED_QUANTA; int credit_quanta = SW_DEFAULT_CREDIT_QUANTA; + int self_test = 0; name = rte_vdev_device_name(vdev); params = rte_vdev_device_args(vdev); @@ -846,6 +856,16 @@ sw_probe(struct rte_vdev_device *vdev) return ret; } + ret = rte_kvargs_process(kvlist, SELF_TEST_ARG, + set_self_test, &self_test); + if (ret != 0) { + SW_LOG_ERR( + "%s: Error parsing self test parameter", + name); + rte_kvargs_free(kvlist); + return ret; + } + rte_kvargs_free(kvlist); } } @@ -897,6 +917,9 @@ sw_probe(struct rte_vdev_device *vdev) dev->data->service_inited = 1; dev->data->service_id = sw->service_id; + if (self_test) + test_sw_eventdev(); + return 0; } diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 085938887..838ff0b58 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -333,5 +333,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +void test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (4 preceding siblings ...) 2017-12-12 19:27 ` [dpdk-dev] [PATCH 6/7] event/sw: add selftest to device arguments Pavan Nikhilesh @ 2017-12-12 19:27 ` Pavan Nikhilesh 2017-12-13 13:48 ` Kovacevic, Marko 2017-12-13 10:19 ` [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Van Haaren, Harry ` (4 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-12 19:27 UTC (permalink / raw) To: jerin.jacob, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Update octeontx and software eventdev documentation to include new selftest feature. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- doc/guides/eventdevs/octeontx.rst | 13 +++++++++++++ doc/guides/eventdevs/sw.rst | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/doc/guides/eventdevs/octeontx.rst b/doc/guides/eventdevs/octeontx.rst index cef004a20..bf2985be1 100644 --- a/doc/guides/eventdevs/octeontx.rst +++ b/doc/guides/eventdevs/octeontx.rst @@ -114,6 +114,19 @@ Example: ./your_eventdev_application --vdev="event_octeontx" + +Selftest +-------- + +The functionality of octeontx eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_octeontx,self_test=1" + + Limitations ----------- diff --git a/doc/guides/eventdevs/sw.rst b/doc/guides/eventdevs/sw.rst index ec49b3b57..671b6c5b9 100644 --- a/doc/guides/eventdevs/sw.rst +++ b/doc/guides/eventdevs/sw.rst @@ -114,6 +114,18 @@ verify possible gains. --vdev="event_sw0,credit_quanta=64" +Selftest +~~~~~~~~ + +The functionality of software eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_sw,self_test=1" + + Limitations ----------- -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation 2017-12-12 19:27 ` [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation Pavan Nikhilesh @ 2017-12-13 13:48 ` Kovacevic, Marko 0 siblings, 0 replies; 87+ messages in thread From: Kovacevic, Marko @ 2017-12-13 13:48 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > Sent: Tuesday, December 12, 2017 7:27 PM > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation > > Update octeontx and software eventdev documentation to include new selftest > feature. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (5 preceding siblings ...) 2017-12-12 19:27 ` [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation Pavan Nikhilesh @ 2017-12-13 10:19 ` Van Haaren, Harry 2017-12-13 10:34 ` Bruce Richardson 2017-12-13 11:19 ` Pavan Nikhilesh Bhagavatula 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (3 subsequent siblings) 10 siblings, 2 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-13 10:19 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > -----Original Message----- > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Tuesday, December 12, 2017 7:27 PM > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > to driver > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > driver/event/octeontx. <snip patch content> Replying to 1st patch, as no cover letter; Summary of patchset: - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c - Enable self tests to run when passed the vdev arg "self-test=1" A few comments on this change; 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. >From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. Specific comments will be sent as replies to the patches. Cheers, -Harry ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 10:19 ` [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Van Haaren, Harry @ 2017-12-13 10:34 ` Bruce Richardson 2017-12-13 11:24 ` Pavan Nikhilesh Bhagavatula 2017-12-13 11:19 ` Pavan Nikhilesh Bhagavatula 1 sibling, 1 reply; 87+ messages in thread From: Bruce Richardson @ 2017-12-13 10:34 UTC (permalink / raw) To: Van Haaren, Harry Cc: Pavan Nikhilesh, jerin.jacob, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J, dev On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > -----Original Message----- > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Tuesday, December 12, 2017 7:27 PM > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > <bruce.richardson@intel.com>; Van Haaren, Harry > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > <liang.j.ma@intel.com> > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > to driver > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > driver/event/octeontx. > > <snip patch content> > > Replying to 1st patch, as no cover letter; > > Summary of patchset: > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > - Enable self tests to run when passed the vdev arg "self-test=1" > > > A few comments on this change; > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > > > Specific comments will be sent as replies to the patches. Cheers, -Harry What I gather from a cursory glance at this set is that the self tests are designed to be triggered via devargs to the device driver, correct? I'm not sure I like this approach, though I do agree with having the tests inside the individual drivers. What I think I would prefer to see is the self-tests being called via an API rather than via devargs. I think we should add a "rte_event_dev_self_test()" API to the eventdev library, and have that then call into the driver-provided tests. This means that self-tests can only be called by applications which are set up to allow the tests to be called, e.g. the autotest binary, while also avoiding the issue of having lots of driver specifics clutter up test binaries. Regards, /Bruce ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 10:34 ` Bruce Richardson @ 2017-12-13 11:24 ` Pavan Nikhilesh Bhagavatula 2017-12-13 11:39 ` Bruce Richardson 0 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2017-12-13 11:24 UTC (permalink / raw) To: Bruce Richardson, jerin.jacob, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev On Wed, Dec 13, 2017 at 10:34:28AM +0000, Bruce Richardson wrote: > On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > > -----Original Message----- > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > > Sent: Tuesday, December 12, 2017 7:27 PM > > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > > <bruce.richardson@intel.com>; Van Haaren, Harry > > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > > <liang.j.ma@intel.com> > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > > to driver > > > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > > driver/event/octeontx. > > > > <snip patch content> > > > > Replying to 1st patch, as no cover letter; > > > > Summary of patchset: > > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > > - Enable self tests to run when passed the vdev arg "self-test=1" > > > > > > A few comments on this change; > > > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > > > > > > Specific comments will be sent as replies to the patches. Cheers, -Harry > > What I gather from a cursory glance at this set is that the self tests > are designed to be triggered via devargs to the device driver, correct? > I'm not sure I like this approach, though I do agree with having the > tests inside the individual drivers. > > What I think I would prefer to see is the self-tests being called via an > API rather than via devargs. I think we should add a > "rte_event_dev_self_test()" API to the eventdev library, and have that > then call into the driver-provided tests. This means that self-tests can > only be called by applications which are set up to allow the tests to be > called, e.g. the autotest binary, while also avoiding the issue of > having lots of driver specifics clutter up test binaries. Agreed, will modify it to ops based scheme so that application can call driver specific `event_dev_self_test` and register selftest in test/test/test_eventdev.c. Although we would like to retain devargs selftest scheme for event_octeontx. I will remove it for event_sw. Does that sound good? > > Regards, > /Bruce Regards, Pavan ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 11:24 ` Pavan Nikhilesh Bhagavatula @ 2017-12-13 11:39 ` Bruce Richardson 0 siblings, 0 replies; 87+ messages in thread From: Bruce Richardson @ 2017-12-13 11:39 UTC (permalink / raw) To: Pavan Nikhilesh Bhagavatula Cc: jerin.jacob, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J, dev On Wed, Dec 13, 2017 at 04:54:29PM +0530, Pavan Nikhilesh Bhagavatula wrote: > On Wed, Dec 13, 2017 at 10:34:28AM +0000, Bruce Richardson wrote: > > On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > > > -----Original Message----- > > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > > > Sent: Tuesday, December 12, 2017 7:27 PM > > > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > > > <bruce.richardson@intel.com>; Van Haaren, Harry > > > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > > > <liang.j.ma@intel.com> > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > > > to driver > > > > > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > > > driver/event/octeontx. > > > > > > <snip patch content> > > > > > > Replying to 1st patch, as no cover letter; > > > > > > Summary of patchset: > > > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > > > - Enable self tests to run when passed the vdev arg "self-test=1" > > > > > > > > > A few comments on this change; > > > > > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > > > > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > > > > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > > > > > > > > > Specific comments will be sent as replies to the patches. Cheers, -Harry > > > > What I gather from a cursory glance at this set is that the self tests > > are designed to be triggered via devargs to the device driver, correct? > > I'm not sure I like this approach, though I do agree with having the > > tests inside the individual drivers. > > > > What I think I would prefer to see is the self-tests being called via an > > API rather than via devargs. I think we should add a > > "rte_event_dev_self_test()" API to the eventdev library, and have that > > then call into the driver-provided tests. This means that self-tests can > > only be called by applications which are set up to allow the tests to be > > called, e.g. the autotest binary, while also avoiding the issue of > > having lots of driver specifics clutter up test binaries. > > Agreed, will modify it to ops based scheme so that application can call driver > specific `event_dev_self_test` and register selftest in > test/test/test_eventdev.c. > > Although we would like to retain devargs selftest scheme for event_octeontx. I > will remove it for event_sw. Does that sound good? > Sure, sounds good to me. Thanks, /Bruce ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 10:19 ` [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Van Haaren, Harry 2017-12-13 10:34 ` Bruce Richardson @ 2017-12-13 11:19 ` Pavan Nikhilesh Bhagavatula 2017-12-13 11:41 ` Bruce Richardson 1 sibling, 1 reply; 87+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2017-12-13 11:19 UTC (permalink / raw) To: Van Haaren, Harry, jerin.jacob, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > -----Original Message----- > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Tuesday, December 12, 2017 7:27 PM > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > <bruce.richardson@intel.com>; Van Haaren, Harry > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > <liang.j.ma@intel.com> > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > to driver > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > driver/event/octeontx. > > <snip patch content> > > Replying to 1st patch, as no cover letter; > > Summary of patchset: > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > - Enable self tests to run when passed the vdev arg "self-test=1" > > > A few comments on this change; > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > I initially thought of abstracting the macros but couldnt find a suitable file to place them in we have two options here, one is to use CFLAGS and include test.h directly (dirty) or have rte_assert/test in eal/common/inlcude. Thoughts? > > Specific comments will be sent as replies to the patches. Cheers, -Harry ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 11:19 ` Pavan Nikhilesh Bhagavatula @ 2017-12-13 11:41 ` Bruce Richardson 2017-12-13 15:50 ` Pavan Nikhilesh Bhagavatula 0 siblings, 1 reply; 87+ messages in thread From: Bruce Richardson @ 2017-12-13 11:41 UTC (permalink / raw) To: Pavan Nikhilesh Bhagavatula Cc: Van Haaren, Harry, jerin.jacob, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J, dev On Wed, Dec 13, 2017 at 04:49:47PM +0530, Pavan Nikhilesh Bhagavatula wrote: > On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > > -----Original Message----- > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > > Sent: Tuesday, December 12, 2017 7:27 PM > > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > > <bruce.richardson@intel.com>; Van Haaren, Harry > > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > > <liang.j.ma@intel.com> > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > > to driver > > > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > > driver/event/octeontx. > > > > <snip patch content> > > > > Replying to 1st patch, as no cover letter; > > > > Summary of patchset: > > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > > - Enable self tests to run when passed the vdev arg "self-test=1" > > > > > > A few comments on this change; > > > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > > > > I initially thought of abstracting the macros but couldnt find a suitable file > to place them in we have two options here, one is to use CFLAGS and include > test.h directly (dirty) or have rte_assert/test in eal/common/inlcude. > > Thoughts? > If other device types, e.g. ethdev or cryptodev, also take the approach of having a self_test API (something I think would be a good thing, and I actually hacked together when working on the i40e rx and tx code), I think we should look to have an rte_test.h header file for such macros to avoid duplication. At this point, moving them to an EAL include may not be worth it for just eventdev. /Bruce ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver 2017-12-13 11:41 ` Bruce Richardson @ 2017-12-13 15:50 ` Pavan Nikhilesh Bhagavatula 0 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2017-12-13 15:50 UTC (permalink / raw) To: Bruce Richardson, jerin.jacob, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev On Wed, Dec 13, 2017 at 11:41:55AM +0000, Bruce Richardson wrote: > On Wed, Dec 13, 2017 at 04:49:47PM +0530, Pavan Nikhilesh Bhagavatula wrote: > > On Wed, Dec 13, 2017 at 10:19:51AM +0000, Van Haaren, Harry wrote: > > > > -----Original Message----- > > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > > > Sent: Tuesday, December 12, 2017 7:27 PM > > > > To: jerin.jacob@caviumnetworks.com; Richardson, Bruce > > > > <bruce.richardson@intel.com>; Van Haaren, Harry > > > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > > > <liang.j.ma@intel.com> > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > Subject: [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test > > > > to driver > > > > > > > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > > > > driver/event/octeontx. > > > > > > <snip patch content> > > > > > > Replying to 1st patch, as no cover letter; > > > > > > Summary of patchset: > > > - Move tests for a specific Eventdev PMD into the PMD dir: drivers/event/x/x_selftest.c > > > - Enable self tests to run when passed the vdev arg "self-test=1" > > > > > > > > > A few comments on this change; > > > > > > 1) We should not lose the capability to run tests as part of the existing unit testing infrastructure. We should not fragment the testing tool - requiring multiple binaries to test a single component. > > > > > > From discussion on #IRC, it seems reasonable to call rte_eal_vdev_init() with "self-test=1" from the test/test/ code, and then we can continue to use the existing test infrastructure despite that the actual tests are now part of each PMD. > > > > > > 2) We should not copy/paste TEST_ASSERT macros into new test files. Abstracting the TEST_ASSERT and other macros out to a header file would solve this duplication. > > > > > > > I initially thought of abstracting the macros but couldnt find a suitable file > > to place them in we have two options here, one is to use CFLAGS and include > > test.h directly (dirty) or have rte_assert/test in eal/common/inlcude. > > > > Thoughts? > > > If other device types, e.g. ethdev or cryptodev, also take the approach of > having a self_test API (something I think would be a good thing, and I > actually hacked together when working on the i40e rx and tx code), I > think we should look to have an rte_test.h header file for such macros > to avoid duplication. > At this point, moving them to an EAL include may not be worth it for > just eventdev. > I think atleast having a basic version of rte_test.h (macros used by test_event_octeontx) would be good rather than taking a hacky path. Later on more stuff could be added when other devices make use of it. > /Bruce > Thanks, Pavan. ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (6 preceding siblings ...) 2017-12-13 10:19 ` [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Van Haaren, Harry @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros Pavan Nikhilesh ` (10 more replies) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (2 subsequent siblings) 10 siblings, 11 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh This patchset aims to remove pmd specific unit test clutter from the common tests directory by moving them into the respective pmd folder. - Patch [1/11] moves basic asserts into eal area so that they can be reused by other devices. - Patch [2/11] introduces new API that an application can use to run the self test. - Patch set [3-6/11] cleans up event_octeontx specific test, updates the selftest ops and provides a devarg 'selftest' to run selftest from any given application after probe is complete. - Patch set [7-9/11] cleans up event_sw specific test and updates the selftest ops. - Patch [10/11] registers selftest command to the common unit test area. Pavan Nikhilesh (11): eal: add common test assert macros eventdev: add API to perform self test event/octeontx: move eventdev octeontx test to driver event/octeontx: modify octeontx eventdev test event/octeontx: update octeontx eventdev selftest ops event/octeontx: add selftest to device arguments event/sw: move eventdev sw test to driver event/sw: modify eventdev sw test event/sw: update software eventdev selftest ops test: register eventdev selftest doc: update eventdev documentation doc/guides/eventdevs/octeontx.rst | 13 + drivers/event/octeontx/Makefile | 3 +- .../event/octeontx/octeontx_evdev_selftest.c | 427 +++++++++++---------- drivers/event/octeontx/ssovf_evdev.c | 45 +++ drivers/event/octeontx/ssovf_evdev.h | 6 + drivers/event/sw/Makefile | 2 + drivers/event/sw/sw_evdev.c | 2 + drivers/event/sw/sw_evdev.h | 1 + .../event/sw/sw_evdev_selftest.c | 70 ++-- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 97 +++++ lib/librte_eventdev/rte_eventdev.c | 10 + lib/librte_eventdev/rte_eventdev.h | 12 + lib/librte_eventdev/rte_eventdev_pmd.h | 11 + lib/librte_eventdev/rte_eventdev_version.map | 6 + test/test/Makefile | 2 - test/test/test_eventdev.c | 7 + 17 files changed, 485 insertions(+), 231 deletions(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/octeontx_evdev_selftest.c (78%) rename test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c (99%) create mode 100644 lib/librte_eal/common/include/rte_test.h -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 18:43 ` Ananyev, Konstantin 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test Pavan Nikhilesh ` (9 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Adding common test assertion macros for unit testing. Taken from test/test.h. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/common/include/rte_test.h diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..eba1059f2 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h rte_vfio.h +INC += rte_bitmap.h rte_vfio.h rte_test.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h new file mode 100644 index 000000000..256117f79 --- /dev/null +++ b/lib/librte_eal/common/include/rte_test.h @@ -0,0 +1,97 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. + */ + +#ifndef _RTE_TEST_H_ +#define _RTE_TEST_H_ + +#include <rte_log.h> + +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ + if (!(a == b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ + if (!(a != b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) do { \ + typeof(val) _val = (val); \ + if (!(_val == 0)) { \ + RTE_LOG(DEBUG, EAL, \ + "Test assert %s line %d failed (err %d): " \ + msg "\n", __func__, __LINE__, _val, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) do { \ + if (!(val != 0)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NULL(val, msg, ...) do { \ + if (!(val == NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ + if (!(val != NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#endif /* _RTE_TEST_H_ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros Pavan Nikhilesh @ 2017-12-14 18:43 ` Ananyev, Konstantin 2017-12-15 9:04 ` Pavan Nikhilesh Bhagavatula 0 siblings, 1 reply; 87+ messages in thread From: Ananyev, Konstantin @ 2017-12-14 18:43 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > Sent: Thursday, December 14, 2017 3:01 PM > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > Ma, Liang J <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > Adding common test assertion macros for unit testing. Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? Konstantin > Taken from test/test.h. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ > 2 files changed, 98 insertions(+), 1 deletion(-) > create mode 100644 lib/librte_eal/common/include/rte_test.h > > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > index 9effd0d45..eba1059f2 100644 > --- a/lib/librte_eal/common/Makefile > +++ b/lib/librte_eal/common/Makefile > @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > INC += rte_malloc.h rte_keepalive.h rte_time.h > INC += rte_service.h rte_service_component.h > -INC += rte_bitmap.h rte_vfio.h > +INC += rte_bitmap.h rte_vfio.h rte_test.h > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > new file mode 100644 > index 000000000..256117f79 > --- /dev/null > +++ b/lib/librte_eal/common/include/rte_test.h > @@ -0,0 +1,97 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. > + */ > + > +#ifndef _RTE_TEST_H_ > +#define _RTE_TEST_H_ > + > +#include <rte_log.h> > + > +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ > + if (!(cond)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ > + if (!(a == b)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ > + if (!(a != b)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) do { \ > + typeof(val) _val = (val); \ > + if (!(_val == 0)) { \ > + RTE_LOG(DEBUG, EAL, \ > + "Test assert %s line %d failed (err %d): " \ > + msg "\n", __func__, __LINE__, _val, \ > + ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) do { \ > + if (!(val != 0)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_NULL(val, msg, ...) do { \ > + if (!(val == NULL)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ > + if (!(val != NULL)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#endif /* _RTE_TEST_H_ */ > -- > 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-14 18:43 ` Ananyev, Konstantin @ 2017-12-15 9:04 ` Pavan Nikhilesh Bhagavatula 2017-12-15 10:58 ` Ananyev, Konstantin 0 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2017-12-15 9:04 UTC (permalink / raw) To: Ananyev, Konstantin, jerin.jacob, santosh.shukla, Richardson,Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev On Thu, Dec 14, 2017 at 06:43:24PM +0000, Ananyev, Konstantin wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > > Sent: Thursday, December 14, 2017 3:01 PM > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > > Ma, Liang J <liang.j.ma@intel.com> > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > Adding common test assertion macros for unit testing. > > Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? > Konstantin The existing RTE_ASSERT/VERIFY use rte_panic(). Pavan > > > Taken from test/test.h. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > --- > > lib/librte_eal/common/Makefile | 2 +- > > lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ > > 2 files changed, 98 insertions(+), 1 deletion(-) > > create mode 100644 lib/librte_eal/common/include/rte_test.h > > > > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > > index 9effd0d45..eba1059f2 100644 > > --- a/lib/librte_eal/common/Makefile > > +++ b/lib/librte_eal/common/Makefile > > @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h > > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > > INC += rte_malloc.h rte_keepalive.h rte_time.h > > INC += rte_service.h rte_service_component.h > > -INC += rte_bitmap.h rte_vfio.h > > +INC += rte_bitmap.h rte_vfio.h rte_test.h > > > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > > new file mode 100644 > > index 000000000..256117f79 > > --- /dev/null > > +++ b/lib/librte_eal/common/include/rte_test.h > > @@ -0,0 +1,97 @@ [...] ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-15 9:04 ` Pavan Nikhilesh Bhagavatula @ 2017-12-15 10:58 ` Ananyev, Konstantin 2017-12-15 11:32 ` Pavan Nikhilesh Bhagavatula 0 siblings, 1 reply; 87+ messages in thread From: Ananyev, Konstantin @ 2017-12-15 10:58 UTC (permalink / raw) To: Pavan Nikhilesh Bhagavatula, jerin.jacob, santosh.shukla, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > -----Original Message----- > From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@caviumnetworks.com] > Sent: Friday, December 15, 2017 9:05 AM > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J <liang.j.ma@intel.com> > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > On Thu, Dec 14, 2017 at 06:43:24PM +0000, Ananyev, Konstantin wrote: > > > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > > > Sent: Thursday, December 14, 2017 3:01 PM > > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > > > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > > > Ma, Liang J <liang.j.ma@intel.com> > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > Adding common test assertion macros for unit testing. > > > > Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? > > Konstantin > > The existing RTE_ASSERT/VERIFY use rte_panic(). Yes, and wouldn't you expect that behavior from assert() call? Seriously where do you plan to use it outside auto test framework? Konstantin > > Pavan > > > > > Taken from test/test.h. > > > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > --- > > > lib/librte_eal/common/Makefile | 2 +- > > > lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ > > > 2 files changed, 98 insertions(+), 1 deletion(-) > > > create mode 100644 lib/librte_eal/common/include/rte_test.h > > > > > > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > > > index 9effd0d45..eba1059f2 100644 > > > --- a/lib/librte_eal/common/Makefile > > > +++ b/lib/librte_eal/common/Makefile > > > @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h > > > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > > > INC += rte_malloc.h rte_keepalive.h rte_time.h > > > INC += rte_service.h rte_service_component.h > > > -INC += rte_bitmap.h rte_vfio.h > > > +INC += rte_bitmap.h rte_vfio.h rte_test.h > > > > > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > > > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > > > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > > > new file mode 100644 > > > index 000000000..256117f79 > > > --- /dev/null > > > +++ b/lib/librte_eal/common/include/rte_test.h > > > @@ -0,0 +1,97 @@ > [...] ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-15 10:58 ` Ananyev, Konstantin @ 2017-12-15 11:32 ` Pavan Nikhilesh Bhagavatula 2018-01-10 19:16 ` Jerin Jacob 0 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2017-12-15 11:32 UTC (permalink / raw) To: Ananyev, Konstantin, jerin.jacob, santosh.shukla, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev On Fri, Dec 15, 2017 at 10:58:10AM +0000, Ananyev, Konstantin wrote: > > > > -----Original Message----- > > From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Friday, December 15, 2017 9:05 AM > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J <liang.j.ma@intel.com> > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > On Thu, Dec 14, 2017 at 06:43:24PM +0000, Ananyev, Konstantin wrote: > > > > > > > > > > -----Original Message----- > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > > > > Sent: Thursday, December 14, 2017 3:01 PM > > > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > > > > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > > > > Ma, Liang J <liang.j.ma@intel.com> > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > > > Adding common test assertion macros for unit testing. > > > > > > Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? > > > Konstantin > > > > The existing RTE_ASSERT/VERIFY use rte_panic(). > > Yes, and wouldn't you expect that behavior from assert() call? We need to print out the number of successful/failure tests so, we need the test to proceed even if an assert fails. In case of `event_octeontx` we have added a new devargs 'selftest' that can be used to test the driver from any given application. > Seriously where do you plan to use it outside auto test framework? We are moving pmd specific tests to respective pmd folder to reduce clutter in auto test area (event devices for now) [1]. So, we need to access the asserts from driver location instead of using CFLAGS to directly include test.h for all the drivers it would be better to have it in eal/common as rte_test. [1] http://dpdk.org/ml/archives/dev/2017-December/083740.html > Konstantin Regards, Pavan > > > > > Pavan > > > > > > > Taken from test/test.h. > > > > > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > --- > > > > lib/librte_eal/common/Makefile | 2 +- > > > > lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ > > > > 2 files changed, 98 insertions(+), 1 deletion(-) > > > > create mode 100644 lib/librte_eal/common/include/rte_test.h > > > > > > > > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > > > > index 9effd0d45..eba1059f2 100644 > > > > --- a/lib/librte_eal/common/Makefile > > > > +++ b/lib/librte_eal/common/Makefile > > > > @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h > > > > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > > > > INC += rte_malloc.h rte_keepalive.h rte_time.h > > > > INC += rte_service.h rte_service_component.h > > > > -INC += rte_bitmap.h rte_vfio.h > > > > +INC += rte_bitmap.h rte_vfio.h rte_test.h > > > > > > > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > > > > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > > > > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > > > > new file mode 100644 > > > > index 000000000..256117f79 > > > > --- /dev/null > > > > +++ b/lib/librte_eal/common/include/rte_test.h > > > > @@ -0,0 +1,97 @@ > > [...] ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2017-12-15 11:32 ` Pavan Nikhilesh Bhagavatula @ 2018-01-10 19:16 ` Jerin Jacob 2018-01-10 20:18 ` Thomas Monjalon 0 siblings, 1 reply; 87+ messages in thread From: Jerin Jacob @ 2018-01-10 19:16 UTC (permalink / raw) To: Pavan Nikhilesh Bhagavatula Cc: Ananyev, Konstantin, santosh.shukla, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J, dev, thomas -----Original Message----- > Date: Fri, 15 Dec 2017 17:02:42 +0530 > From: Pavan Nikhilesh Bhagavatula <pbhagavatula@caviumnetworks.com> > To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, > "jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>, > "santosh.shukla@caviumnetworks.com" <santosh.shukla@caviumnetworks.com>, > "Richardson, Bruce" <bruce.richardson@intel.com>, "Van Haaren, Harry" > <harry.van.haaren@intel.com>, "Eads, Gage" <gage.eads@intel.com>, > "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>, "nipun.gupta@nxp.com" > <nipun.gupta@nxp.com>, "Ma, Liang J" <liang.j.ma@intel.com> > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > User-Agent: NeoMutt/20170609 (1.8.3) > > On Fri, Dec 15, 2017 at 10:58:10AM +0000, Ananyev, Konstantin wrote: > > > > > > > -----Original Message----- > > > From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@caviumnetworks.com] > > > Sent: Friday, December 15, 2017 9:05 AM > > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > > > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J <liang.j.ma@intel.com> > > > Cc: dev@dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > On Thu, Dec 14, 2017 at 06:43:24PM +0000, Ananyev, Konstantin wrote: > > > > > > > > > > > > > -----Original Message----- > > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > > > > > Sent: Thursday, December 14, 2017 3:01 PM > > > > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > > > > > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > > > > > Ma, Liang J <liang.j.ma@intel.com> > > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > > > > > Adding common test assertion macros for unit testing. > > > > > > > > Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? > > > > Konstantin > > > > > > The existing RTE_ASSERT/VERIFY use rte_panic(). > > > > Yes, and wouldn't you expect that behavior from assert() call? > > We need to print out the number of successful/failure tests so, we need the > test to proceed even if an assert fails. > In case of `event_octeontx` we have added a new devargs 'selftest' that can be > used to test the driver from any given application. > > > Seriously where do you plan to use it outside auto test framework? > > We are moving pmd specific tests to respective pmd folder to reduce > clutter in auto test area (event devices for now) [1]. So, we need to access > the asserts from driver location instead of using CFLAGS to directly include > test.h for all the drivers it would be better to have it in eal/common as > rte_test. > > [1] http://dpdk.org/ml/archives/dev/2017-December/083740.html Cc: thomas@monjalon.net Any objection to this patch and/or taking this patch through next-eventdev tree? ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros 2018-01-10 19:16 ` Jerin Jacob @ 2018-01-10 20:18 ` Thomas Monjalon 0 siblings, 0 replies; 87+ messages in thread From: Thomas Monjalon @ 2018-01-10 20:18 UTC (permalink / raw) To: Jerin Jacob Cc: Pavan Nikhilesh Bhagavatula, Ananyev, Konstantin, santosh.shukla, Richardson, Bruce, Van Haaren, Harry, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J, dev 10/01/2018 20:16, Jerin Jacob: > -----Original Message----- > > Date: Fri, 15 Dec 2017 17:02:42 +0530 > > From: Pavan Nikhilesh Bhagavatula <pbhagavatula@caviumnetworks.com> > > To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, > > "jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>, > > "santosh.shukla@caviumnetworks.com" <santosh.shukla@caviumnetworks.com>, > > "Richardson, Bruce" <bruce.richardson@intel.com>, "Van Haaren, Harry" > > <harry.van.haaren@intel.com>, "Eads, Gage" <gage.eads@intel.com>, > > "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>, "nipun.gupta@nxp.com" > > <nipun.gupta@nxp.com>, "Ma, Liang J" <liang.j.ma@intel.com> > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > User-Agent: NeoMutt/20170609 (1.8.3) > > > > On Fri, Dec 15, 2017 at 10:58:10AM +0000, Ananyev, Konstantin wrote: > > > > > > > > > > -----Original Message----- > > > > From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@caviumnetworks.com] > > > > Sent: Friday, December 15, 2017 9:05 AM > > > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > > > > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J <liang.j.ma@intel.com> > > > > Cc: dev@dpdk.org > > > > Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > > > On Thu, Dec 14, 2017 at 06:43:24PM +0000, Ananyev, Konstantin wrote: > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh > > > > > > Sent: Thursday, December 14, 2017 3:01 PM > > > > > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Richardson, Bruce <bruce.richardson@intel.com>; Van > > > > > > Haaren, Harry <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; > > > > > > Ma, Liang J <liang.j.ma@intel.com> > > > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > > > Subject: [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros > > > > > > > > > > > > Adding common test assertion macros for unit testing. > > > > > > > > > > Wonder what's wrong with existing RTE_ASSERT() and RTE_VERIFY()? > > > > > Konstantin > > > > > > > > The existing RTE_ASSERT/VERIFY use rte_panic(). > > > > > > Yes, and wouldn't you expect that behavior from assert() call? > > > > We need to print out the number of successful/failure tests so, we need the > > test to proceed even if an assert fails. > > In case of `event_octeontx` we have added a new devargs 'selftest' that can be > > used to test the driver from any given application. > > > > > Seriously where do you plan to use it outside auto test framework? > > > > We are moving pmd specific tests to respective pmd folder to reduce > > clutter in auto test area (event devices for now) [1]. So, we need to access > > the asserts from driver location instead of using CFLAGS to directly include > > test.h for all the drivers it would be better to have it in eal/common as > > rte_test. > > > > [1] http://dpdk.org/ml/archives/dev/2017-December/083740.html > > Cc: thomas@monjalon.net > > Any objection to this patch and/or taking this patch through next-eventdev tree? I am OK with the idea. But I have some comments on the patch (in v4). ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-19 15:45 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (8 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Add API to perform self test on the underlying event device driver. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- lib/librte_eventdev/rte_eventdev.c | 10 ++++++++++ lib/librte_eventdev/rte_eventdev.h | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 11 +++++++++++ lib/librte_eventdev/rte_eventdev_version.map | 6 ++++++ 4 files changed, 39 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index e0c2a7876..66650c32b 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1092,6 +1092,16 @@ int rte_event_dev_xstats_reset(uint8_t dev_id, return -ENOTSUP; } +int rte_event_dev_selftest(uint8_t dev_id) +{ + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; + + if (dev->dev_ops->dev_selftest != NULL) + return (*dev->dev_ops->dev_selftest)(); + return -ENOTSUP; +} + int rte_event_dev_start(uint8_t dev_id) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index f1949ff7d..4f6465cc3 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1762,6 +1762,18 @@ rte_event_dev_xstats_reset(uint8_t dev_id, const uint32_t ids[], uint32_t nb_ids); +/** + * Trigger the eventdev self test. + * + * @param dev_id + * The identifier of the device + * @return + * - 0: Selftest successful + * - -ENOTSUP if the device doesn't support selftest + * - other values < 0 on failure. + */ +int rte_event_dev_selftest(uint8_t dev_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 6ed40cd38..8bf0462f6 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -603,6 +603,14 @@ typedef int (*eventdev_eth_rx_adapter_stats_get) typedef int (*eventdev_eth_rx_adapter_stats_reset) (const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev); +/** + * Start eventdev selftest. + * + * @return + * Return 0 on success. + */ +typedef int (*eventdev_selftest) + (void); /** Event device operations function pointer table */ struct rte_eventdev_ops { @@ -658,6 +666,9 @@ struct rte_eventdev_ops { /**< Get ethernet Rx stats */ eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; /**< Reset ethernet Rx stats */ + + eventdev_selftest dev_selftest; + /**< Start eventdev Selftest */ }; /** diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 108ae61fb..2aef470b5 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -68,3 +68,9 @@ DPDK_17.11 { rte_event_eth_rx_adapter_stop; } DPDK_17.08; + +DPDK_18.02 { + global: + + rte_event_dev_selftest; +} DPDK_17.11; -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2017-12-19 15:45 ` Van Haaren, Harry 0 siblings, 0 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-19 15:45 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Thursday, December 14, 2017 3:01 PM > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test > > Add API to perform self test on the underlying event device driver. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 03/11] event/octeontx: move eventdev octeontx test to driver 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh ` (7 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Move octeontx eventdev specific test (test_eventdev_octeontx.c) to driver/event/octeontx. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- .../event/octeontx/octeontx_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/octeontx_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/octeontx_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_octeontx.c rename to drivers/event/octeontx/octeontx_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index bb54c9808..87e3169d2 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 04/11] event/octeontx: modify octeontx eventdev test 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (2 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh ` (6 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Modify test_eventdev_octeontx to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/octeontx_evdev_selftest.c | 427 +++++++++++++---------- 1 file changed, 234 insertions(+), 193 deletions(-) diff --git a/drivers/event/octeontx/octeontx_evdev_selftest.c b/drivers/event/octeontx/octeontx_evdev_selftest.c index 8fddb4fd2..3877bca4a 100644 --- a/drivers/event/octeontx/octeontx_evdev_selftest.c +++ b/drivers/event/octeontx/octeontx_evdev_selftest.c @@ -46,12 +46,21 @@ #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_bus_vdev.h> +#include <rte_test.h> -#include "test.h" +#include "ssovf_evdev.h" #define NUM_PACKETS (1 << 18) #define MAX_EVENTS (16 * 1024) +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ + octeontx_test_run(setup, teardown, test, #test) + +static int total; +static int passed; +static int failed; +static int unsupported; + static int evdev; static struct rte_mempool *eventdev_test_mempool; @@ -79,11 +88,11 @@ static inline int seqn_list_update(int val) { if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; + return -1; seqn_list[seqn_list_index++] = val; rte_smp_wmb(); - return TEST_SUCCESS; + return 0; } static inline int @@ -93,11 +102,11 @@ seqn_list_check(int limit) for (i = 0; i < limit; i++) { if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); + return -1; } } - return TEST_SUCCESS; + return 0; } struct test_core_param { @@ -114,20 +123,21 @@ testsuite_setup(void) evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", + ssovf_log_dbg("%d: Eventdev %s not found - creating.", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; + ssovf_log_dbg("Error creating eventdev %s", + eventdev_name); + return -1; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; + ssovf_log_dbg("Error finding newly created eventdev"); + return -1; } } - return TEST_SUCCESS; + return 0; } static void @@ -177,31 +187,34 @@ _eventdev_setup(int mode) 512, /* Use very small mbufs */ rte_socket_id()); if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; + ssovf_log_dbg("ERROR creating mempool"); + return -1; } ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) { + ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); + return -1; + } devconf_set_default_sane_values(&dev_conf, &info); if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); + ssovf_log_dbg( + "test expects the unique priority per queue"); return -ENOTSUP; } @@ -216,35 +229,39 @@ _eventdev_setup(int mode) ret = rte_event_queue_default_conf_get(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", + i); queue_conf.priority = i * step; ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } else { /* Configure event queues with default priority */ for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } /* Configure event ports */ uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", + i); } ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start device"); - return TEST_SUCCESS; + return 0; } static inline int @@ -311,7 +328,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, @@ -332,8 +349,8 @@ check_excess_events(uint8_t port) for (i = 0; i < 32; i++) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); + RTE_TEST_ASSERT_SUCCESS(valid_event, + "Unexpected valid event=%d", ev.mbuf->seqn); } return 0; } @@ -346,12 +363,12 @@ generate_random_events(const unsigned int total_events) int ret; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { ret = inject_events( rte_rand() % info.max_event_queue_flows /*flow_id */, @@ -362,7 +379,7 @@ generate_random_events(const unsigned int total_events) 0 /* port */, 1 /* events */); if (ret) - return TEST_FAILED; + return -1; } return ret; } @@ -374,19 +391,19 @@ validate_event(struct rte_event *ev) struct event_attr *attr; attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, + RTE_TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, "flow_id mismatch enq=%d deq =%d", attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, + RTE_TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, "event_type mismatch enq=%d deq =%d", attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, + RTE_TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, "sub_event_type mismatch enq=%d deq =%d", attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, + RTE_TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, "sched_type mismatch enq=%d deq =%d", attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, "queue mismatch enq=%d deq =%d", attr->queue, ev->queue_id); return 0; @@ -405,8 +422,8 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) while (1) { if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; + ssovf_log_dbg("Detected deadlock"); + return -1; } valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); @@ -416,11 +433,11 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) forward_progress_cnt = 0; ret = validate_event(&ev); if (ret) - return TEST_FAILED; + return -1; if (fn != NULL) { ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate test specific event"); } @@ -438,8 +455,8 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, - ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", + index, ev->mbuf->seqn); return 0; } @@ -456,7 +473,7 @@ test_simple_enqdeq(uint8_t sched_type) 0 /* port */, MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); } @@ -491,7 +508,7 @@ test_multi_queue_enq_single_port_deq(void) ret = generate_random_events(MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, NULL); } @@ -514,7 +531,7 @@ static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint32_t range = MAX_EVENTS / queue_count; @@ -522,7 +539,7 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, + RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, queue_count, MAX_EVENTS); @@ -538,7 +555,7 @@ test_multi_queue_priority(void) /* See validate_queue_priority() comments for priority validate logic */ uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); max_evts_roundoff = MAX_EVENTS / queue_count; @@ -548,7 +565,7 @@ test_multi_queue_priority(void) struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; queue = i % queue_count; @@ -576,7 +593,7 @@ worker_multi_port_fn(void *arg) continue; ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } @@ -587,27 +604,29 @@ static inline int wait_workers_to_join(int lcore, const rte_atomic32_t *count) { uint64_t cycles, print_cycles; + RTE_SET_USED(count); print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != FINISHED) { uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, + ssovf_log_dbg("\r%s: events %d", __func__, rte_atomic32_read(count)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", + ssovf_log_dbg( + "%s: No schedules for seconds, deadlock (%d)", __func__, rte_atomic32_read(count)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; - return TEST_FAILED; + return -1; } } rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; + return 0; } @@ -631,12 +650,12 @@ launch_workers_and_wait(int (*master_worker)(void *), param = malloc(sizeof(struct test_core_param) * nb_workers); if (!param) - return TEST_FAILED; + return -1; ret = rte_event_dequeue_timeout_ticks(evdev, rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); if (ret) - return TEST_FAILED; + return -1; param[0].total_events = &atomic_total_events; param[0].sched_type = sched_type; @@ -679,17 +698,17 @@ test_multi_queue_enq_multi_port_deq(void) ret = generate_random_events(total_events); if (ret) - return TEST_FAILED; + return -1; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } return launch_workers_and_wait(worker_multi_port_fn, @@ -702,7 +721,7 @@ validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(port, ev->queue_id, "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -718,18 +737,19 @@ test_queue_to_port_single_link(void) int i, nr_links, ret; uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); /* Unlink all connections that created in eventdev_setup */ for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, + "Failed to unlink all queues port=%d", i); } uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); @@ -741,7 +761,7 @@ test_queue_to_port_single_link(void) uint8_t queue = (uint8_t)i; ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); + RTE_TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); ret = inject_events( 0x100 /*flow_id */, @@ -752,7 +772,7 @@ test_queue_to_port_single_link(void) i /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; } /* Verify the events generated from correct queue */ @@ -760,10 +780,10 @@ test_queue_to_port_single_link(void) ret = consume_events(i /* port */, total_events, validate_queue_to_port_single_link); if (ret) - return TEST_FAILED; + return -1; } - return TEST_SUCCESS; + return 0; } static int @@ -771,7 +791,7 @@ validate_queue_to_port_multi_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), + RTE_TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -789,27 +809,27 @@ test_queue_to_port_multi_link(void) uint32_t nr_queues = 0; uint32_t nr_ports = 0; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", + ssovf_log_dbg("%s: Not enough ports to test ports=%d", __func__, nr_ports); - return TEST_SUCCESS; + return 0; } /* Unlink all connections that created in eventdev_setup */ for (port = 0; port < nr_ports; port++) { ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", + RTE_TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", port); } @@ -819,7 +839,7 @@ test_queue_to_port_multi_link(void) for (queue = 0; queue < nr_queues; queue++) { port = queue & 0x1; ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", + RTE_TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", queue, port); ret = inject_events( @@ -831,7 +851,7 @@ test_queue_to_port_multi_link(void) port /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; if (port == 0) port0_events += total_events; @@ -842,13 +862,13 @@ test_queue_to_port_multi_link(void) ret = consume_events(0 /* port */, port0_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; ret = consume_events(1 /* port */, port1_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; - return TEST_SUCCESS; + return 0; } static int @@ -878,17 +898,17 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.sub_event_type = %d\n", + ssovf_log_dbg("Invalid ev.sub_event_type = %d", ev.sub_event_type); - return TEST_FAILED; + return -1; } } return 0; @@ -902,15 +922,15 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -923,20 +943,20 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_flow_based_pipeline, worker_flow_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } @@ -1033,16 +1053,16 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; + ssovf_log_dbg("Invalid ev.queue_id = %d", ev.queue_id); + return -1; } } @@ -1058,21 +1078,21 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", + ssovf_log_dbg("%s: Not enough queues=%d ports=%d or workers=%d", __func__, queue_count, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1085,20 +1105,20 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_group_based_pipeline, worker_group_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } static int @@ -1201,15 +1221,15 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1222,7 +1242,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) 0 /* port */, MAX_EVENTS /* events */); if (ret) - return TEST_FAILED; + return -1; return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, 0xff /* invalid */); @@ -1244,7 +1264,7 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1286,7 +1306,7 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1357,14 +1377,14 @@ test_producer_consumer_ingress_order_test(int (*fn)(void *)) { uint32_t nr_ports; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; + ssovf_log_dbg("### Not enough cores for %s test.", __func__); + return 0; } launch_workers_and_wait(worker_ordered_flow_producer, fn, @@ -1389,86 +1409,107 @@ test_queue_producer_consumer_ingress_order_test(void) worker_group_based_pipeline); } -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ +static void octeontx_test_run(int (*setup)(void), void (*tdown)(void), + int (*test)(void), const char *name) +{ + if (setup() < 0) { + ssovf_log_selftest("Error setting up test %s", name); + unsupported++; + } else { + if (test() < 0) { + failed++; + ssovf_log_selftest("%s Failed", name); + } else { + passed++; + ssovf_log_selftest("%s Passed", name); + } } -}; -static int + total++; + tdown(); +} + +int test_eventdev_octeontx(void) { - return unit_test_suite_runner(&eventdev_octeontx_testsuite); -} + testsuite_setup(); + + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_multi_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_single_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_multi_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_mixed_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_flow_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup_priority, eventdev_teardown, + test_multi_queue_priority); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + + ssovf_log_selftest("Total tests : %d", total); + ssovf_log_selftest("Passed : %d", passed); + ssovf_log_selftest("Failed : %d", failed); + ssovf_log_selftest("Not supported : %d", unsupported); + + testsuite_teardown(); + + if (failed) + return -1; -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); + return 0; +} -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 05/11] event/octeontx: update octeontx eventdev selftest ops 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (3 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh ` (5 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Update octeontx eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 3 ++- drivers/event/octeontx/ssovf_evdev.c | 2 ++ drivers/event/octeontx/ssovf_evdev.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index fdf1b7385..1ad638574 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map @@ -54,6 +54,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_evdev_selftest.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 117b1453e..627f5d24b 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -612,6 +612,8 @@ static const struct rte_eventdev_ops ssovf_ops = { .eth_rx_adapter_start = ssovf_eth_rx_adapter_start, .eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop, + .dev_selftest = test_eventdev_octeontx, + .dump = ssovf_dump, .dev_start = ssovf_start, .dev_stop = ssovf_stop, diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index b093a3e73..72a980447 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,6 +57,9 @@ #define ssovf_log_err(fmt, args...) \ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define ssovf_log_selftest(fmt, args...) \ + RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) #define SSO_MAX_VHGRP (64) #define SSO_MAX_VHWS (32) @@ -196,5 +199,6 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +int test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 06/11] event/octeontx: add selftest to device arguments 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (4 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh ` (4 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_octeontx,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 2 +- drivers/event/octeontx/ssovf_evdev.c | 43 ++++++++++++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_evdev.h | 2 ++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 1ad638574..bf45133f7 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 627f5d24b..593ab63ef 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -38,6 +38,7 @@ #include <rte_eal.h> #include <rte_ethdev.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_kvargs.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> @@ -592,6 +593,15 @@ ssovf_close(struct rte_eventdev *dev) return 0; } +static int +ssovf_selftest(const char *key __rte_unused, const char *value, + void *opaque) +{ + int *flag = opaque; + *flag = !!atoi(value); + return 0; +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -629,7 +639,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) struct rte_eventdev *eventdev; static int ssovf_init_once; const char *name; + const char *params; int ret; + int selftest = 0; + + static const char *const args[] = { + SSOVF_SELFTEST_ARG, + NULL + }; name = rte_vdev_device_name(vdev); /* More than one instance is not supported */ @@ -638,6 +655,30 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return -EINVAL; } + params = rte_vdev_device_args(vdev); + if (params != NULL && params[0] != '\0') { + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); + + if (!kvlist) { + ssovf_log_info( + "Ignoring unsupported paramss supplied '%s'", + name); + } else { + int ret = rte_kvargs_process(kvlist, + SSOVF_SELFTEST_ARG, + ssovf_selftest, &selftest); + if (ret != 0) { + ssovf_log_err( + "%s: Error in selftest", + name); + rte_kvargs_free(kvlist); + return ret; + } + } + + rte_kvargs_free(kvlist); + } + eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev), rte_socket_id()); if (eventdev == NULL) { @@ -688,6 +729,8 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) edev->max_event_ports); ssovf_init_once = 1; + if (selftest) + test_eventdev_octeontx(); return 0; error: diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 72a980447..018fbdfa5 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -117,6 +117,8 @@ #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8 +#define SSOVF_SELFTEST_ARG ("selftest") + /* * In Cavium OcteonTX SoC, all accesses to the device registers are * implictly strongly ordered. So, The relaxed version of IO operation is -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 07/11] event/sw: move eventdev software test to driver 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (5 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test Pavan Nikhilesh ` (3 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Move software eventdev specific test (test_eventdev_sw) to driver/event/sw/. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/sw_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_sw.c rename to drivers/event/sw/sw_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index 87e3169d2..c551ad964 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (6 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-19 15:44 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh ` (2 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Modify test_eventdev_sw to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/sw/sw_evdev_selftest.c | 70 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 96ed920cc..0ca11030e 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -52,7 +52,7 @@ #include <rte_service_component.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "sw_evdev.h" #define MAX_PORTS 16 #define MAX_QIDS 16 @@ -3038,7 +3038,7 @@ worker_loopback(struct test *t) static struct rte_mempool *eventdev_func_mempool; -static int +int test_sw_eventdev(void) { struct test *t = malloc(sizeof(struct test)); @@ -3049,25 +3049,25 @@ test_sw_eventdev(void) */ release_ev.op = RTE_EVENT_OP_RELEASE; - const char *eventdev_name = "event_sw0"; + const char *eventdev_name = "event_sw"; evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("%d: Eventdev %s not found - creating.\n", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { printf("Error creating eventdev\n"); - return -1; + goto test_fail; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("Error finding newly created eventdev\n"); - return -1; + goto test_fail; } } if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { printf("Failed to get service ID for software event dev\n"); - return -1; + goto test_fail; } rte_service_runstate_set(t->service_id, 1); @@ -3084,7 +3084,7 @@ test_sw_eventdev(void) rte_socket_id()); if (!eventdev_func_mempool) { printf("ERROR creating mempool\n"); - return -1; + goto test_fail; } } t->mbuf_pool = eventdev_func_mempool; @@ -3092,153 +3092,153 @@ test_sw_eventdev(void) ret = test_single_directed_packet(t); if (ret != 0) { printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Directed Forward Credit test...\n"); ret = test_directed_forward_credits(t); if (ret != 0) { printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Single Load Balanced Packet test...\n"); ret = single_packet(t); if (ret != 0) { printf("ERROR - Single Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Unordered Basic test...\n"); ret = unordered_basic(t); if (ret != 0) { printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Basic test...\n"); ret = ordered_basic(t); if (ret != 0) { printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Burst Packets test...\n"); ret = burst_packets(t); if (ret != 0) { printf("ERROR - Burst Packets test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing test...\n"); ret = load_balancing(t); if (ret != 0) { printf("ERROR - Load Balancing test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Directed test...\n"); ret = test_priority_directed(t); if (ret != 0) { printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Atomic test...\n"); ret = test_priority_atomic(t); if (ret != 0) { printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Ordered test...\n"); ret = test_priority_ordered(t); if (ret != 0) { printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Unordered test...\n"); ret = test_priority_unordered(t); if (ret != 0) { printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Invalid QID test...\n"); ret = invalid_qid(t); if (ret != 0) { printf("ERROR - Invalid QID test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing History test...\n"); ret = load_balancing_history(t); if (ret != 0) { printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Inflight Count test...\n"); ret = inflight_counts(t); if (ret != 0) { printf("ERROR - Inflight Count test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Abuse Inflights test...\n"); ret = abuse_inflights(t); if (ret != 0) { printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats test...\n"); ret = xstats_tests(t); if (ret != 0) { printf("ERROR - XStats test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Reset test...\n"); ret = xstats_id_reset_tests(t); if (ret != 0) { printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats Brute Force test...\n"); ret = xstats_brute_force(t); if (ret != 0) { printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Abuse test...\n"); ret = xstats_id_abuse_tests(t); if (ret != 0) { printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running QID Priority test...\n"); ret = qid_priorities(t); if (ret != 0) { printf("ERROR - QID Priority test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Reconfigure test...\n"); ret = ordered_reconfigure(t); if (ret != 0) { printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port LB Single Reconfig test...\n"); ret = port_single_lb_reconfig(t); if (ret != 0) { printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port Reconfig Credits test...\n"); ret = port_reconfig_credits(t); if (ret != 0) { printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Head-of-line-blocking test...\n"); ret = holb(t); if (ret != 0) { printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; + goto test_fail; } if (rte_lcore_count() >= 3) { printf("*** Running Worker loopback test...\n"); ret = worker_loopback(t); if (ret != 0) { printf("ERROR - Worker loopback test FAILED.\n"); - return ret; + goto test_fail; } } else { printf("### Not enough cores for worker loopback test.\n"); @@ -3250,7 +3250,9 @@ test_sw_eventdev(void) */ free(t); + printf("SW Eventdev Selftest Successful.\n"); return 0; +test_fail: + printf("SW Eventdev Selftest Failed.\n"); + return -1; } - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test Pavan Nikhilesh @ 2017-12-19 15:44 ` Van Haaren, Harry 0 siblings, 0 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-19 15:44 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Thursday, December 14, 2017 3:02 PM > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test > > Modify test_eventdev_sw to be standalone selftest independent of test > framework. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Note that the command to execute the self-test is like so: (Note missing 0 after event_sw) ./app/test --vdev event_sw ... RTE>> eventdev_selftest Acked-by: Harry van Haaren <harry.van.haaren@intel.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (7 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-19 15:46 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 11/11] doc: update eventdev documentation Pavan Nikhilesh 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Update software eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/sw/Makefile | 2 ++ drivers/event/sw/sw_evdev.c | 2 ++ drivers/event/sw/sw_evdev.h | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 2f2b67bac..149258748 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers endif endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring +LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev # library version @@ -57,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_scheduler.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_xstats.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_selftest.c # export include files SYMLINK-y-include += diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index 5b4a20889..565a9898d 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -790,6 +790,8 @@ sw_probe(struct rte_vdev_device *vdev) .xstats_get_names = sw_xstats_get_names, .xstats_get_by_name = sw_xstats_get_by_name, .xstats_reset = sw_xstats_reset, + + .dev_selftest = test_sw_eventdev, }; static const char *const args[] = { diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 085938887..556bad012 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -333,5 +333,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +int test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh @ 2017-12-19 15:46 ` Van Haaren, Harry 0 siblings, 0 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-19 15:46 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Thursday, December 14, 2017 3:02 PM > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev > selftest ops > > Update software eventdev ops to invoke selftest when application invokes > `rte_event_dev_selftest`. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (8 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 2017-12-19 15:27 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 11/11] doc: update eventdev documentation Pavan Nikhilesh 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- test/test/test_eventdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index 1ed2a1ddd..b86efab01 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -1009,4 +1009,11 @@ test_eventdev_common(void) return unit_test_suite_runner(&eventdev_common_testsuite); } +static int +test_eventdev_selftest(void) +{ + return rte_event_dev_selftest(TEST_DEV_ID); +} + REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); +REGISTER_TEST_COMMAND(eventdev_selftest, test_eventdev_selftest); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2017-12-19 15:27 ` Van Haaren, Harry 2017-12-19 18:44 ` Pavan Nikhilesh 0 siblings, 1 reply; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-19 15:27 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Richardson, Bruce, Eads, Gage, hemant.agrawal, nipun.gupta, Ma, Liang J Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Thursday, December 14, 2017 3:02 PM > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > <liang.j.ma@intel.com> [Side note: we shouldn't put everybody on CC all the time..] > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c > index 1ed2a1ddd..b86efab01 100644 > --- a/test/test/test_eventdev.c > +++ b/test/test/test_eventdev.c > @@ -1009,4 +1009,11 @@ test_eventdev_common(void) > return unit_test_suite_runner(&eventdev_common_testsuite); > } > > +static int > +test_eventdev_selftest(void) > +{ > + return rte_event_dev_selftest(TEST_DEV_ID); > +} > + > REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); > +REGISTER_TEST_COMMAND(eventdev_selftest, test_eventdev_selftest); Currently when running the test app, we don't pass any arguments. Running the "eventdev_sw_autotest" command, it will create the required event_sw0 PMD vdev, and launch the tests then. Given the selftest is PMD agnostic, does it makes sense to have a single string "sw" or "octeontx" to run the tests against? Right now it requires that we pass ./app/test --vdev event_sw0 which I think is a burden, particularly when automating this with the meson test infrastructure down the line. Summary; Please add a string parameter that indicates the PMD to run the self-test on. ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest 2017-12-19 15:27 ` Van Haaren, Harry @ 2017-12-19 18:44 ` Pavan Nikhilesh 2017-12-20 11:07 ` Van Haaren, Harry 0 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-19 18:44 UTC (permalink / raw) To: Van Haaren, Harry, jerin.jacob; +Cc: dev Hi Harry, Thanks for the review, comments below. On Tue, Dec 19, 2017 at 03:27:25PM +0000, Van Haaren, Harry wrote: > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Thursday, December 14, 2017 3:02 PM > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > <liang.j.ma@intel.com> > > [Side note: we shouldn't put everybody on CC all the time..] > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Subject: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c > > index 1ed2a1ddd..b86efab01 100644 > > --- a/test/test/test_eventdev.c > > +++ b/test/test/test_eventdev.c > > @@ -1009,4 +1009,11 @@ test_eventdev_common(void) > > return unit_test_suite_runner(&eventdev_common_testsuite); > > } > > > > +static int > > +test_eventdev_selftest(void) > > +{ > > + return rte_event_dev_selftest(TEST_DEV_ID); > > +} > > + > > REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); > > +REGISTER_TEST_COMMAND(eventdev_selftest, test_eventdev_selftest); > > > Currently when running the test app, we don't pass any arguments. Running the "eventdev_sw_autotest" command, it will create the required event_sw0 PMD vdev, and launch the tests then. > > Given the selftest is PMD agnostic, does it makes sense to have a single string "sw" or "octeontx" to run the tests against? Right now it requires that we pass ./app/test --vdev event_sw0 which I think is a burden, particularly when automating this with the meson test infrastructure down the line. > > Summary; Please add a string parameter that indicates the PMD to run the self-test on. > We can't pass extra parameter while running test (it will only accept test name). So, I will register pmd specific test test_eventdev_sw/octeontx which will create the eventdev and call the selftest API. Also, I have mistakenly changed the name from event_sw0 to event_sw do you want me to revert it? or retain the change. Cheers, Pavan. ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest 2017-12-19 18:44 ` Pavan Nikhilesh @ 2017-12-20 11:07 ` Van Haaren, Harry 0 siblings, 0 replies; 87+ messages in thread From: Van Haaren, Harry @ 2017-12-20 11:07 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob; +Cc: dev > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > Sent: Tuesday, December 19, 2017 6:45 PM > To: Van Haaren, Harry <harry.van.haaren@intel.com>; > jerin.jacob@caviumnetworks.com > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest > > Hi Harry, > > Thanks for the review, comments below. > > On Tue, Dec 19, 2017 at 03:27:25PM +0000, Van Haaren, Harry wrote: > > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > > Sent: Thursday, December 14, 2017 3:02 PM > > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; > > > Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry > > > <harry.van.haaren@intel.com>; Eads, Gage <gage.eads@intel.com>; > > > hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, Liang J > > > <liang.j.ma@intel.com> > > > > [Side note: we shouldn't put everybody on CC all the time..] > > > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > Subject: [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest > > > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > > > > > > diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c > > > index 1ed2a1ddd..b86efab01 100644 > > > --- a/test/test/test_eventdev.c > > > +++ b/test/test/test_eventdev.c > > > @@ -1009,4 +1009,11 @@ test_eventdev_common(void) > > > return unit_test_suite_runner(&eventdev_common_testsuite); > > > } > > > > > > +static int > > > +test_eventdev_selftest(void) > > > +{ > > > + return rte_event_dev_selftest(TEST_DEV_ID); > > > +} > > > + > > > REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); > > > +REGISTER_TEST_COMMAND(eventdev_selftest, test_eventdev_selftest); > > > > > > Currently when running the test app, we don't pass any arguments. Running > the "eventdev_sw_autotest" command, it will create the required event_sw0 > PMD vdev, and launch the tests then. > > > > Given the selftest is PMD agnostic, does it makes sense to have a single > string "sw" or "octeontx" to run the tests against? Right now it requires > that we pass ./app/test --vdev event_sw0 which I think is a burden, > particularly when automating this with the meson test infrastructure down > the line. > > > > Summary; Please add a string parameter that indicates the PMD to run the > self-test on. > > > > We can't pass extra parameter while running test (it will only accept test > name). > So, I will register pmd specific test test_eventdev_sw/octeontx which will > create the eventdev and call the selftest API. Sure that works for me. Its probably best to break out the create/run into a helper function, just to save code-duplication: int eventdev_selftest_impl(const char *pmd, const char *opts) { int id = rte_vdev_create(pmd, opts); return rte_eventdev_selftest(id); } int eventdev_selftest_sw() { eventdev_selftest_impl("event_sw", ""); } int eventdev_selftest_octeontx() { eventdev_selftest_impl("event_octeontx", ""); } > Also, I have mistakenly changed the name from event_sw0 to event_sw do you > want > me to revert it? or retain the change. I think it actually makes more sense to use "event_sw" over "event_sw0". The PMD name is constant, while the 0 is an arbitrary instance name. So I think we should keep the change. ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v2 11/11] doc: update eventdev documentation 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh ` (9 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2017-12-14 15:01 ` Pavan Nikhilesh 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-14 15:01 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, bruce.richardson, harry.van.haaren, gage.eads, hemant.agrawal, nipun.gupta, liang.j.ma Cc: dev, Pavan Nikhilesh Update octeontx eventdev documentation to include new selftest feature. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- doc/guides/eventdevs/octeontx.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/guides/eventdevs/octeontx.rst b/doc/guides/eventdevs/octeontx.rst index cef004a20..bf2985be1 100644 --- a/doc/guides/eventdevs/octeontx.rst +++ b/doc/guides/eventdevs/octeontx.rst @@ -114,6 +114,19 @@ Example: ./your_eventdev_application --vdev="event_octeontx" + +Selftest +-------- + +The functionality of octeontx eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_octeontx,self_test=1" + + Limitations ----------- -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (7 preceding siblings ...) 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test Pavan Nikhilesh ` (10 more replies) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 10 siblings, 11 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Adding common test assertion macros for unit testing. Taken from test/test.h. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- v3 Changes: - add eventdev driver specific selftest to test/test v2 Changes: - remove duplications of test macros. - add selftest to test/test. - remove selftest devargs from sw eventdev. lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 97 ++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/common/include/rte_test.h diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..eba1059f2 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h rte_vfio.h +INC += rte_bitmap.h rte_vfio.h rte_test.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h new file mode 100644 index 000000000..256117f79 --- /dev/null +++ b/lib/librte_eal/common/include/rte_test.h @@ -0,0 +1,97 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. + */ + +#ifndef _RTE_TEST_H_ +#define _RTE_TEST_H_ + +#include <rte_log.h> + +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ + if (!(a == b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ + if (!(a != b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) do { \ + typeof(val) _val = (val); \ + if (!(_val == 0)) { \ + RTE_LOG(DEBUG, EAL, \ + "Test assert %s line %d failed (err %d): " \ + msg "\n", __func__, __LINE__, _val, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) do { \ + if (!(val != 0)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NULL(val, msg, ...) do { \ + if (!(val == NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ + if (!(val != NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#endif /* _RTE_TEST_H_ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 9:56 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (9 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add API to perform self test on the underlying event device driver. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- lib/librte_eventdev/rte_eventdev.c | 10 ++++++++++ lib/librte_eventdev/rte_eventdev.h | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 11 +++++++++++ lib/librte_eventdev/rte_eventdev_version.map | 6 ++++++ 4 files changed, 39 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 035bd0017..85496e575 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1114,6 +1114,16 @@ int rte_event_dev_xstats_reset(uint8_t dev_id, return -ENOTSUP; } +int rte_event_dev_selftest(uint8_t dev_id) +{ + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; + + if (dev->dev_ops->dev_selftest != NULL) + return (*dev->dev_ops->dev_selftest)(); + return -ENOTSUP; +} + int rte_event_dev_start(uint8_t dev_id) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 1bbea57db..9201a5af8 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1787,6 +1787,18 @@ rte_event_dev_xstats_reset(uint8_t dev_id, const uint32_t ids[], uint32_t nb_ids); +/** + * Trigger the eventdev self test. + * + * @param dev_id + * The identifier of the device + * @return + * - 0: Selftest successful + * - -ENOTSUP if the device doesn't support selftest + * - other values < 0 on failure. + */ +int rte_event_dev_selftest(uint8_t dev_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 6ed40cd38..8bf0462f6 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -603,6 +603,14 @@ typedef int (*eventdev_eth_rx_adapter_stats_get) typedef int (*eventdev_eth_rx_adapter_stats_reset) (const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev); +/** + * Start eventdev selftest. + * + * @return + * Return 0 on success. + */ +typedef int (*eventdev_selftest) + (void); /** Event device operations function pointer table */ struct rte_eventdev_ops { @@ -658,6 +666,9 @@ struct rte_eventdev_ops { /**< Get ethernet Rx stats */ eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; /**< Reset ethernet Rx stats */ + + eventdev_selftest dev_selftest; + /**< Start eventdev Selftest */ }; /** diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 108ae61fb..2aef470b5 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -68,3 +68,9 @@ DPDK_17.11 { rte_event_eth_rx_adapter_stop; } DPDK_17.08; + +DPDK_18.02 { + global: + + rte_event_dev_selftest; +} DPDK_17.11; -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2018-01-08 9:56 ` Jerin Jacob 2018-01-08 10:34 ` Pavan Nikhilesh 0 siblings, 1 reply; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 9:56 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:29 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test > X-Mailer: git-send-email 2.14.1 > > Add API to perform self test on the underlying event device driver. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Acked-by: Harry van Haaren <harry.van.haaren@intel.com> > --- > + * Start eventdev selftest. > + * > + * @return > + * Return 0 on success. > + */ > +typedef int (*eventdev_selftest) > + (void); I think, The (void) need not to be in a separate line. With above change: Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test 2018-01-08 9:56 ` Jerin Jacob @ 2018-01-08 10:34 ` Pavan Nikhilesh 0 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 10:34 UTC (permalink / raw) To: Jerin Jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev Hi Jerin, Thanks for the review, will send out a v4 addressing the comments. On Mon, Jan 08, 2018 at 03:26:23PM +0530, Jerin Jacob wrote: > -----Original Message----- > > Date: Tue, 26 Dec 2017 00:47:29 +0530 > > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > > gage.eads@intel.com, liang.j.ma@intel.com > > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Subject: [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test > > X-Mailer: git-send-email 2.14.1 > > > > Add API to perform self test on the underlying event device driver. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Acked-by: Harry van Haaren <harry.van.haaren@intel.com> > > --- > > + * Start eventdev selftest. > > + * > > + * @return > > + * Return 0 on success. > > + */ > > +typedef int (*eventdev_selftest) > > + (void); > > I think, The (void) need not to be in a separate line. > > With above change: > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 9:58 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh ` (8 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move octeontx eventdev specific test (test_eventdev_octeontx.c) to driver/event/octeontx. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- .../event/octeontx/octeontx_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/octeontx_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/octeontx_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_octeontx.c rename to drivers/event/octeontx/octeontx_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index bb54c9808..87e3169d2 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2018-01-08 9:58 ` Jerin Jacob 0 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 9:58 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:30 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx > test to driver > X-Mailer: git-send-email 2.14.1 > > Move octeontx eventdev specific test (test_eventdev_octeontx.c) to > driver/event/octeontx. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > .../event/octeontx/octeontx_evdev_selftest.c | 0 > test/test/Makefile | 1 - > 2 files changed, 1 deletion(-) > rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/octeontx_evdev_selftest.c (100%) > > diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/octeontx_evdev_selftest.c > similarity index 100% > rename from test/test/test_eventdev_octeontx.c > rename to drivers/event/octeontx/octeontx_evdev_selftest.c > diff --git a/test/test/Makefile b/test/test/Makefile > index bb54c9808..87e3169d2 100644 > --- a/test/test/Makefile > +++ b/test/test/Makefile > @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c > SRCS-y += test_event_ring.c > SRCS-y += test_event_eth_rx_adapter.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c > -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c > endif > > SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c > -- > 2.14.1 > ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2017-12-26 14:11 ` Neil Horman 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh ` (7 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_octeontx to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/octeontx_evdev_selftest.c | 427 +++++++++++++---------- 1 file changed, 234 insertions(+), 193 deletions(-) diff --git a/drivers/event/octeontx/octeontx_evdev_selftest.c b/drivers/event/octeontx/octeontx_evdev_selftest.c index 8fddb4fd2..3877bca4a 100644 --- a/drivers/event/octeontx/octeontx_evdev_selftest.c +++ b/drivers/event/octeontx/octeontx_evdev_selftest.c @@ -46,12 +46,21 @@ #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_bus_vdev.h> +#include <rte_test.h> -#include "test.h" +#include "ssovf_evdev.h" #define NUM_PACKETS (1 << 18) #define MAX_EVENTS (16 * 1024) +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ + octeontx_test_run(setup, teardown, test, #test) + +static int total; +static int passed; +static int failed; +static int unsupported; + static int evdev; static struct rte_mempool *eventdev_test_mempool; @@ -79,11 +88,11 @@ static inline int seqn_list_update(int val) { if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; + return -1; seqn_list[seqn_list_index++] = val; rte_smp_wmb(); - return TEST_SUCCESS; + return 0; } static inline int @@ -93,11 +102,11 @@ seqn_list_check(int limit) for (i = 0; i < limit; i++) { if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); + return -1; } } - return TEST_SUCCESS; + return 0; } struct test_core_param { @@ -114,20 +123,21 @@ testsuite_setup(void) evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", + ssovf_log_dbg("%d: Eventdev %s not found - creating.", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; + ssovf_log_dbg("Error creating eventdev %s", + eventdev_name); + return -1; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; + ssovf_log_dbg("Error finding newly created eventdev"); + return -1; } } - return TEST_SUCCESS; + return 0; } static void @@ -177,31 +187,34 @@ _eventdev_setup(int mode) 512, /* Use very small mbufs */ rte_socket_id()); if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; + ssovf_log_dbg("ERROR creating mempool"); + return -1; } ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) { + ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); + return -1; + } devconf_set_default_sane_values(&dev_conf, &info); if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); + ssovf_log_dbg( + "test expects the unique priority per queue"); return -ENOTSUP; } @@ -216,35 +229,39 @@ _eventdev_setup(int mode) ret = rte_event_queue_default_conf_get(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", + i); queue_conf.priority = i * step; ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } else { /* Configure event queues with default priority */ for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } /* Configure event ports */ uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", + i); } ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start device"); - return TEST_SUCCESS; + return 0; } static inline int @@ -311,7 +328,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, @@ -332,8 +349,8 @@ check_excess_events(uint8_t port) for (i = 0; i < 32; i++) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); + RTE_TEST_ASSERT_SUCCESS(valid_event, + "Unexpected valid event=%d", ev.mbuf->seqn); } return 0; } @@ -346,12 +363,12 @@ generate_random_events(const unsigned int total_events) int ret; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { ret = inject_events( rte_rand() % info.max_event_queue_flows /*flow_id */, @@ -362,7 +379,7 @@ generate_random_events(const unsigned int total_events) 0 /* port */, 1 /* events */); if (ret) - return TEST_FAILED; + return -1; } return ret; } @@ -374,19 +391,19 @@ validate_event(struct rte_event *ev) struct event_attr *attr; attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, + RTE_TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, "flow_id mismatch enq=%d deq =%d", attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, + RTE_TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, "event_type mismatch enq=%d deq =%d", attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, + RTE_TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, "sub_event_type mismatch enq=%d deq =%d", attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, + RTE_TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, "sched_type mismatch enq=%d deq =%d", attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, "queue mismatch enq=%d deq =%d", attr->queue, ev->queue_id); return 0; @@ -405,8 +422,8 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) while (1) { if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; + ssovf_log_dbg("Detected deadlock"); + return -1; } valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); @@ -416,11 +433,11 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) forward_progress_cnt = 0; ret = validate_event(&ev); if (ret) - return TEST_FAILED; + return -1; if (fn != NULL) { ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate test specific event"); } @@ -438,8 +455,8 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, - ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", + index, ev->mbuf->seqn); return 0; } @@ -456,7 +473,7 @@ test_simple_enqdeq(uint8_t sched_type) 0 /* port */, MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); } @@ -491,7 +508,7 @@ test_multi_queue_enq_single_port_deq(void) ret = generate_random_events(MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, NULL); } @@ -514,7 +531,7 @@ static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint32_t range = MAX_EVENTS / queue_count; @@ -522,7 +539,7 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, + RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, queue_count, MAX_EVENTS); @@ -538,7 +555,7 @@ test_multi_queue_priority(void) /* See validate_queue_priority() comments for priority validate logic */ uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); max_evts_roundoff = MAX_EVENTS / queue_count; @@ -548,7 +565,7 @@ test_multi_queue_priority(void) struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; queue = i % queue_count; @@ -576,7 +593,7 @@ worker_multi_port_fn(void *arg) continue; ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } @@ -587,27 +604,29 @@ static inline int wait_workers_to_join(int lcore, const rte_atomic32_t *count) { uint64_t cycles, print_cycles; + RTE_SET_USED(count); print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != FINISHED) { uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, + ssovf_log_dbg("\r%s: events %d", __func__, rte_atomic32_read(count)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", + ssovf_log_dbg( + "%s: No schedules for seconds, deadlock (%d)", __func__, rte_atomic32_read(count)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; - return TEST_FAILED; + return -1; } } rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; + return 0; } @@ -631,12 +650,12 @@ launch_workers_and_wait(int (*master_worker)(void *), param = malloc(sizeof(struct test_core_param) * nb_workers); if (!param) - return TEST_FAILED; + return -1; ret = rte_event_dequeue_timeout_ticks(evdev, rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); if (ret) - return TEST_FAILED; + return -1; param[0].total_events = &atomic_total_events; param[0].sched_type = sched_type; @@ -679,17 +698,17 @@ test_multi_queue_enq_multi_port_deq(void) ret = generate_random_events(total_events); if (ret) - return TEST_FAILED; + return -1; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } return launch_workers_and_wait(worker_multi_port_fn, @@ -702,7 +721,7 @@ validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(port, ev->queue_id, "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -718,18 +737,19 @@ test_queue_to_port_single_link(void) int i, nr_links, ret; uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); /* Unlink all connections that created in eventdev_setup */ for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, + "Failed to unlink all queues port=%d", i); } uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); @@ -741,7 +761,7 @@ test_queue_to_port_single_link(void) uint8_t queue = (uint8_t)i; ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); + RTE_TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); ret = inject_events( 0x100 /*flow_id */, @@ -752,7 +772,7 @@ test_queue_to_port_single_link(void) i /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; } /* Verify the events generated from correct queue */ @@ -760,10 +780,10 @@ test_queue_to_port_single_link(void) ret = consume_events(i /* port */, total_events, validate_queue_to_port_single_link); if (ret) - return TEST_FAILED; + return -1; } - return TEST_SUCCESS; + return 0; } static int @@ -771,7 +791,7 @@ validate_queue_to_port_multi_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), + RTE_TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -789,27 +809,27 @@ test_queue_to_port_multi_link(void) uint32_t nr_queues = 0; uint32_t nr_ports = 0; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", + ssovf_log_dbg("%s: Not enough ports to test ports=%d", __func__, nr_ports); - return TEST_SUCCESS; + return 0; } /* Unlink all connections that created in eventdev_setup */ for (port = 0; port < nr_ports; port++) { ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", + RTE_TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", port); } @@ -819,7 +839,7 @@ test_queue_to_port_multi_link(void) for (queue = 0; queue < nr_queues; queue++) { port = queue & 0x1; ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", + RTE_TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", queue, port); ret = inject_events( @@ -831,7 +851,7 @@ test_queue_to_port_multi_link(void) port /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; if (port == 0) port0_events += total_events; @@ -842,13 +862,13 @@ test_queue_to_port_multi_link(void) ret = consume_events(0 /* port */, port0_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; ret = consume_events(1 /* port */, port1_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; - return TEST_SUCCESS; + return 0; } static int @@ -878,17 +898,17 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.sub_event_type = %d\n", + ssovf_log_dbg("Invalid ev.sub_event_type = %d", ev.sub_event_type); - return TEST_FAILED; + return -1; } } return 0; @@ -902,15 +922,15 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -923,20 +943,20 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_flow_based_pipeline, worker_flow_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } @@ -1033,16 +1053,16 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; + ssovf_log_dbg("Invalid ev.queue_id = %d", ev.queue_id); + return -1; } } @@ -1058,21 +1078,21 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", + ssovf_log_dbg("%s: Not enough queues=%d ports=%d or workers=%d", __func__, queue_count, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1085,20 +1105,20 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_group_based_pipeline, worker_group_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } static int @@ -1201,15 +1221,15 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1222,7 +1242,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) 0 /* port */, MAX_EVENTS /* events */); if (ret) - return TEST_FAILED; + return -1; return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, 0xff /* invalid */); @@ -1244,7 +1264,7 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1286,7 +1306,7 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1357,14 +1377,14 @@ test_producer_consumer_ingress_order_test(int (*fn)(void *)) { uint32_t nr_ports; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; + ssovf_log_dbg("### Not enough cores for %s test.", __func__); + return 0; } launch_workers_and_wait(worker_ordered_flow_producer, fn, @@ -1389,86 +1409,107 @@ test_queue_producer_consumer_ingress_order_test(void) worker_group_based_pipeline); } -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ +static void octeontx_test_run(int (*setup)(void), void (*tdown)(void), + int (*test)(void), const char *name) +{ + if (setup() < 0) { + ssovf_log_selftest("Error setting up test %s", name); + unsupported++; + } else { + if (test() < 0) { + failed++; + ssovf_log_selftest("%s Failed", name); + } else { + passed++; + ssovf_log_selftest("%s Passed", name); + } } -}; -static int + total++; + tdown(); +} + +int test_eventdev_octeontx(void) { - return unit_test_suite_runner(&eventdev_octeontx_testsuite); -} + testsuite_setup(); + + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_multi_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_single_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_multi_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_mixed_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_flow_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup_priority, eventdev_teardown, + test_multi_queue_priority); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + + ssovf_log_selftest("Total tests : %d", total); + ssovf_log_selftest("Passed : %d", passed); + ssovf_log_selftest("Failed : %d", failed); + ssovf_log_selftest("Not supported : %d", unsupported); + + testsuite_teardown(); + + if (failed) + return -1; -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); + return 0; +} -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2017-12-26 14:11 ` Neil Horman 2017-12-27 5:18 ` Pavan Nikhilesh 0 siblings, 1 reply; 87+ messages in thread From: Neil Horman @ 2017-12-26 14:11 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma, dev On Tue, Dec 26, 2017 at 12:47:31AM +0530, Pavan Nikhilesh wrote: > Modify test_eventdev_octeontx to be standalone selftest independent of > test framework. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > drivers/event/octeontx/octeontx_evdev_selftest.c | 427 +++++++++++++---------- > 1 file changed, 234 insertions(+), 193 deletions(-) > > diff --git a/drivers/event/octeontx/octeontx_evdev_selftest.c b/drivers/event/octeontx/octeontx_evdev_selftest.c > index 8fddb4fd2..3877bca4a 100644 > --- a/drivers/event/octeontx/octeontx_evdev_selftest.c > +++ b/drivers/event/octeontx/octeontx_evdev_selftest.c > @@ -46,12 +46,21 @@ > #include <rte_per_lcore.h> > #include <rte_random.h> > #include <rte_bus_vdev.h> > +#include <rte_test.h> > > -#include "test.h" > +#include "ssovf_evdev.h" > > #define NUM_PACKETS (1 << 18) > #define MAX_EVENTS (16 * 1024) > > +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ > + octeontx_test_run(setup, teardown, test, #test) > + > +static int total; > +static int passed; > +static int failed; > +static int unsupported; > + > static int evdev; > static struct rte_mempool *eventdev_test_mempool; > > @@ -79,11 +88,11 @@ static inline int > seqn_list_update(int val) > { > if (seqn_list_index >= NUM_PACKETS) > - return TEST_FAILED; > + return -1; > > seqn_list[seqn_list_index++] = val; > rte_smp_wmb(); > - return TEST_SUCCESS; > + return 0; > } > > static inline int > @@ -93,11 +102,11 @@ seqn_list_check(int limit) > > for (i = 0; i < limit; i++) { > if (seqn_list[i] != i) { > - printf("Seqn mismatch %d %d\n", seqn_list[i], i); > - return TEST_FAILED; > + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); > + return -1; > } > } > - return TEST_SUCCESS; > + return 0; > } > > struct test_core_param { > @@ -114,20 +123,21 @@ testsuite_setup(void) > > evdev = rte_event_dev_get_dev_id(eventdev_name); > if (evdev < 0) { > - printf("%d: Eventdev %s not found - creating.\n", > + ssovf_log_dbg("%d: Eventdev %s not found - creating.", > __LINE__, eventdev_name); > if (rte_vdev_init(eventdev_name, NULL) < 0) { > - printf("Error creating eventdev %s\n", eventdev_name); > - return TEST_FAILED; > + ssovf_log_dbg("Error creating eventdev %s", > + eventdev_name); > + return -1; > } > evdev = rte_event_dev_get_dev_id(eventdev_name); > if (evdev < 0) { > - printf("Error finding newly created eventdev\n"); > - return TEST_FAILED; > + ssovf_log_dbg("Error finding newly created eventdev"); > + return -1; > } > } > > - return TEST_SUCCESS; > + return 0; > } > > static void > @@ -177,31 +187,34 @@ _eventdev_setup(int mode) > 512, /* Use very small mbufs */ > rte_socket_id()); > if (!eventdev_test_mempool) { > - printf("ERROR creating mempool\n"); > - return TEST_FAILED; > + ssovf_log_dbg("ERROR creating mempool"); > + return -1; > } > > ret = rte_event_dev_info_get(evdev, &info); > - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); > - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, > - "max_num_events=%d < max_events=%d", > - info.max_num_events, MAX_EVENTS); > + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); > + if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) { > + ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d", > + info.max_num_events, MAX_EVENTS); > + return -1; > + } > I'm not sure how any of this is particularly adventageous. You've replaced two ASSERTION macros with one and an additional conditional. The assert macros are just a flexible as their were previously (which is to say, not overly so). So i'm not sure what the advantage of renaming them is. Neil ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test 2017-12-26 14:11 ` Neil Horman @ 2017-12-27 5:18 ` Pavan Nikhilesh 0 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-27 5:18 UTC (permalink / raw) To: Neil Horman, jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev Hi Neil, On Tue, Dec 26, 2017 at 09:11:56AM -0500, Neil Horman wrote: > On Tue, Dec 26, 2017 at 12:47:31AM +0530, Pavan Nikhilesh wrote: > > Modify test_eventdev_octeontx to be standalone selftest independent of > > test framework. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > --- > > drivers/event/octeontx/octeontx_evdev_selftest.c | 427 +++++++++++++---------- > > 1 file changed, 234 insertions(+), 193 deletions(-) > > <snip> > > > > static void > > @@ -177,31 +187,34 @@ _eventdev_setup(int mode) > > 512, /* Use very small mbufs */ > > rte_socket_id()); > > if (!eventdev_test_mempool) { > > - printf("ERROR creating mempool\n"); > > - return TEST_FAILED; > > + ssovf_log_dbg("ERROR creating mempool"); > > + return -1; > > } > > > > ret = rte_event_dev_info_get(evdev, &info); > > - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); > > - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, > > - "max_num_events=%d < max_events=%d", > > - info.max_num_events, MAX_EVENTS); > > + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); > > + if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) { > > + ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d", > > + info.max_num_events, MAX_EVENTS); > > + return -1; > > + } > > > I'm not sure how any of this is particularly adventageous. You've replaced two > ASSERTION macros with one and an additional conditional. The assert macros are > just a flexible as their were previously (which is to say, not overly so). So > i'm not sure what the advantage of renaming them is. This is an unintended artifact while deciding between removing macros and moving them to rte_test, I will clean it up in the next version. Thanks for pointing it out. Pavan > > Neil > ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (2 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 10:09 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh ` (6 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 3 ++- drivers/event/octeontx/ssovf_evdev.c | 2 ++ drivers/event/octeontx/ssovf_evdev.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index fdf1b7385..1ad638574 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map @@ -54,6 +54,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_evdev_selftest.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index b80a6c0ae..0a96fbd7f 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -613,6 +613,8 @@ static const struct rte_eventdev_ops ssovf_ops = { .eth_rx_adapter_start = ssovf_eth_rx_adapter_start, .eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop, + .dev_selftest = test_eventdev_octeontx, + .dump = ssovf_dump, .dev_start = ssovf_start, .dev_stop = ssovf_stop, diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index b093a3e73..72a980447 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,6 +57,9 @@ #define ssovf_log_err(fmt, args...) \ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define ssovf_log_selftest(fmt, args...) \ + RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) #define SSO_MAX_VHGRP (64) #define SSO_MAX_VHWS (32) @@ -196,5 +199,6 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +int test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh @ 2018-01-08 10:09 ` Jerin Jacob 0 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 10:09 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:32 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx > eventdev selftest ops > X-Mailer: git-send-email 2.14.1 > > Update octeontx eventdev ops to invoke selftest when application > invokes `rte_event_dev_selftest`. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > drivers/event/octeontx/Makefile | 3 ++- > drivers/event/octeontx/ssovf_evdev.c | 2 ++ > drivers/event/octeontx/ssovf_evdev.h | 4 ++++ > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile > index fdf1b7385..1ad638574 100644 > --- a/drivers/event/octeontx/Makefile > +++ b/drivers/event/octeontx/Makefile > @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ > CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ > > LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx > -LDLIBS += -lrte_bus_pci > +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf > LDLIBS += -lrte_bus_vdev > > EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map > @@ -54,6 +54,7 @@ LIBABIVER := 1 > # > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_evdev_selftest.c Every other file in this directory starts with ssovf_*. IMO, better to change to ssovf_evdev_selftest.c With above change: Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (3 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 10:14 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh ` (5 subsequent siblings) 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_octeontx,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 2 +- drivers/event/octeontx/ssovf_evdev.c | 43 ++++++++++++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_evdev.h | 2 ++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 1ad638574..bf45133f7 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 0a96fbd7f..8c78b323a 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -38,6 +38,7 @@ #include <rte_eal.h> #include <rte_ethdev.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_kvargs.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> @@ -593,6 +594,15 @@ ssovf_close(struct rte_eventdev *dev) return 0; } +static int +ssovf_selftest(const char *key __rte_unused, const char *value, + void *opaque) +{ + int *flag = opaque; + *flag = !!atoi(value); + return 0; +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -630,7 +640,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) struct rte_eventdev *eventdev; static int ssovf_init_once; const char *name; + const char *params; int ret; + int selftest = 0; + + static const char *const args[] = { + SSOVF_SELFTEST_ARG, + NULL + }; name = rte_vdev_device_name(vdev); /* More than one instance is not supported */ @@ -639,6 +656,30 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return -EINVAL; } + params = rte_vdev_device_args(vdev); + if (params != NULL && params[0] != '\0') { + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); + + if (!kvlist) { + ssovf_log_info( + "Ignoring unsupported paramss supplied '%s'", + name); + } else { + int ret = rte_kvargs_process(kvlist, + SSOVF_SELFTEST_ARG, + ssovf_selftest, &selftest); + if (ret != 0) { + ssovf_log_err( + "%s: Error in selftest", + name); + rte_kvargs_free(kvlist); + return ret; + } + } + + rte_kvargs_free(kvlist); + } + eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev), rte_socket_id()); if (eventdev == NULL) { @@ -689,6 +730,8 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) edev->max_event_ports); ssovf_init_once = 1; + if (selftest) + test_eventdev_octeontx(); return 0; error: diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 72a980447..018fbdfa5 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -117,6 +117,8 @@ #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8 +#define SSOVF_SELFTEST_ARG ("selftest") + /* * In Cavium OcteonTX SoC, all accesses to the device registers are * implictly strongly ordered. So, The relaxed version of IO operation is -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2018-01-08 10:14 ` Jerin Jacob 0 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 10:14 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:33 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device > arguments > X-Mailer: git-send-email 2.14.1 > > Add selftest as a device argument that can be enabled by suppling > 'self_test=1' as a vdev parameter > > --vdev="event_octeontx,self_test=1" > > The selftest is run after vdev creation is successfully > complete. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > /* Initialize and register event driver with DPDK Application */ > static const struct rte_eventdev_ops ssovf_ops = { > .dev_infos_get = ssovf_info_get, > @@ -630,7 +640,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) > struct rte_eventdev *eventdev; > static int ssovf_init_once; > const char *name; > + const char *params; > int ret; > + int selftest = 0; > + > + static const char *const args[] = { > + SSOVF_SELFTEST_ARG, > + NULL > + }; > > name = rte_vdev_device_name(vdev); > /* More than one instance is not supported */ > @@ -639,6 +656,30 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) > return -EINVAL; > } > > + params = rte_vdev_device_args(vdev); > + if (params != NULL && params[0] != '\0') { > + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); > + > + if (!kvlist) { > + ssovf_log_info( > + "Ignoring unsupported paramss supplied '%s'", s/paramss/params > + name); > + } else { > + int ret = rte_kvargs_process(kvlist, > + SSOVF_SELFTEST_ARG, > + ssovf_selftest, &selftest); > + if (ret != 0) { > + ssovf_log_err( > + "%s: Error in selftest", > + name); I think, above three lines can be squashed to one line. With above changes: Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 07/11] event/sw: move eventdev software test to driver 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (4 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 08/11] event/sw: modify eventdev software test Pavan Nikhilesh ` (4 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move software eventdev specific test (test_eventdev_sw) to driver/event/sw/. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/sw_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_sw.c rename to drivers/event/sw/sw_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index 87e3169d2..c551ad964 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 08/11] event/sw: modify eventdev software test 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (5 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh ` (3 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_sw to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/sw_evdev_selftest.c | 70 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 4108b00bf..0e84b2003 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -52,7 +52,7 @@ #include <rte_service_component.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "sw_evdev.h" #define MAX_PORTS 16 #define MAX_QIDS 16 @@ -3042,7 +3042,7 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release) static struct rte_mempool *eventdev_func_mempool; -static int +int test_sw_eventdev(void) { struct test *t = malloc(sizeof(struct test)); @@ -3053,25 +3053,25 @@ test_sw_eventdev(void) */ release_ev.op = RTE_EVENT_OP_RELEASE; - const char *eventdev_name = "event_sw0"; + const char *eventdev_name = "event_sw"; evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("%d: Eventdev %s not found - creating.\n", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { printf("Error creating eventdev\n"); - return -1; + goto test_fail; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("Error finding newly created eventdev\n"); - return -1; + goto test_fail; } } if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { printf("Failed to get service ID for software event dev\n"); - return -1; + goto test_fail; } rte_service_runstate_set(t->service_id, 1); @@ -3088,7 +3088,7 @@ test_sw_eventdev(void) rte_socket_id()); if (!eventdev_func_mempool) { printf("ERROR creating mempool\n"); - return -1; + goto test_fail; } } t->mbuf_pool = eventdev_func_mempool; @@ -3096,146 +3096,146 @@ test_sw_eventdev(void) ret = test_single_directed_packet(t); if (ret != 0) { printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Directed Forward Credit test...\n"); ret = test_directed_forward_credits(t); if (ret != 0) { printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Single Load Balanced Packet test...\n"); ret = single_packet(t); if (ret != 0) { printf("ERROR - Single Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Unordered Basic test...\n"); ret = unordered_basic(t); if (ret != 0) { printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Basic test...\n"); ret = ordered_basic(t); if (ret != 0) { printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Burst Packets test...\n"); ret = burst_packets(t); if (ret != 0) { printf("ERROR - Burst Packets test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing test...\n"); ret = load_balancing(t); if (ret != 0) { printf("ERROR - Load Balancing test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Directed test...\n"); ret = test_priority_directed(t); if (ret != 0) { printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Atomic test...\n"); ret = test_priority_atomic(t); if (ret != 0) { printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Ordered test...\n"); ret = test_priority_ordered(t); if (ret != 0) { printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Unordered test...\n"); ret = test_priority_unordered(t); if (ret != 0) { printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Invalid QID test...\n"); ret = invalid_qid(t); if (ret != 0) { printf("ERROR - Invalid QID test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing History test...\n"); ret = load_balancing_history(t); if (ret != 0) { printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Inflight Count test...\n"); ret = inflight_counts(t); if (ret != 0) { printf("ERROR - Inflight Count test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Abuse Inflights test...\n"); ret = abuse_inflights(t); if (ret != 0) { printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats test...\n"); ret = xstats_tests(t); if (ret != 0) { printf("ERROR - XStats test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Reset test...\n"); ret = xstats_id_reset_tests(t); if (ret != 0) { printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats Brute Force test...\n"); ret = xstats_brute_force(t); if (ret != 0) { printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Abuse test...\n"); ret = xstats_id_abuse_tests(t); if (ret != 0) { printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running QID Priority test...\n"); ret = qid_priorities(t); if (ret != 0) { printf("ERROR - QID Priority test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Reconfigure test...\n"); ret = ordered_reconfigure(t); if (ret != 0) { printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port LB Single Reconfig test...\n"); ret = port_single_lb_reconfig(t); if (ret != 0) { printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port Reconfig Credits test...\n"); ret = port_reconfig_credits(t); if (ret != 0) { printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Head-of-line-blocking test...\n"); ret = holb(t); if (ret != 0) { printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; + goto test_fail; } if (rte_lcore_count() >= 3) { printf("*** Running Worker loopback test...\n"); @@ -3249,7 +3249,7 @@ test_sw_eventdev(void) ret = worker_loopback(t, 1); if (ret != 0) { printf("ERROR - Worker loopback test FAILED.\n"); - return ret; + goto test_fail; } } else { printf("### Not enough cores for worker loopback tests.\n"); @@ -3262,7 +3262,9 @@ test_sw_eventdev(void) */ free(t); + printf("SW Eventdev Selftest Successful.\n"); return 0; +test_fail: + printf("SW Eventdev Selftest Failed.\n"); + return -1; } - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 09/11] event/sw: update software eventdev selftest ops 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (6 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 08/11] event/sw: modify eventdev software test Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest Pavan Nikhilesh ` (2 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update software eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/Makefile | 2 ++ drivers/event/sw/sw_evdev.c | 2 ++ drivers/event/sw/sw_evdev.h | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 2f2b67bac..149258748 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers endif endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring +LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev # library version @@ -57,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_scheduler.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_xstats.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_selftest.c # export include files SYMLINK-y-include += diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index 1ef634093..f40597aae 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -794,6 +794,8 @@ sw_probe(struct rte_vdev_device *vdev) .xstats_get_names = sw_xstats_get_names, .xstats_get_by_name = sw_xstats_get_by_name, .xstats_reset = sw_xstats_reset, + + .dev_selftest = test_sw_eventdev, }; static const char *const args[] = { diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index d08f7d042..b1d2c371c 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -334,5 +334,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +int test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */ -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (7 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 9:49 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-08 11:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Jerin Jacob 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- test/test/test_eventdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index f8ee1bef6..7465251dc 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -1018,4 +1018,26 @@ test_eventdev_common(void) return unit_test_suite_runner(&eventdev_common_testsuite); } +static int +test_eventdev_selftest_impl(const char *pmd, const char *opts) +{ + rte_vdev_init(pmd, opts); + return rte_event_dev_selftest(rte_event_dev_get_dev_id(pmd)); +} + +static int +test_eventdev_selftest_sw(void) +{ + return test_eventdev_selftest_impl("event_sw", ""); +} + +static int +test_eventdev_selftest_octeontx(void) +{ + return test_eventdev_selftest_impl("event_octeontx", ""); +} + REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); +REGISTER_TEST_COMMAND(eventdev_selftest_sw, test_eventdev_selftest_sw); +REGISTER_TEST_COMMAND(eventdev_selftest_octeontx, + test_eventdev_selftest_octeontx); -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2018-01-08 9:49 ` Jerin Jacob 0 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 9:49 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:37 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest > X-Mailer: git-send-email 2.14.1 > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > test/test/test_eventdev.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c > index f8ee1bef6..7465251dc 100644 > --- a/test/test/test_eventdev.c > +++ b/test/test/test_eventdev.c > @@ -1018,4 +1018,26 @@ test_eventdev_common(void) > return unit_test_suite_runner(&eventdev_common_testsuite); > } > > +static int > +test_eventdev_selftest_impl(const char *pmd, const char *opts) > +{ > + rte_vdev_init(pmd, opts); > + return rte_event_dev_selftest(rte_event_dev_get_dev_id(pmd)); > +} > + > +static int > +test_eventdev_selftest_sw(void) > +{ > + return test_eventdev_selftest_impl("event_sw", ""); > +} > + > +static int > +test_eventdev_selftest_octeontx(void) > +{ > + return test_eventdev_selftest_impl("event_octeontx", ""); > +} > + > REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); > +REGISTER_TEST_COMMAND(eventdev_selftest_sw, test_eventdev_selftest_sw); > +REGISTER_TEST_COMMAND(eventdev_selftest_octeontx, > + test_eventdev_selftest_octeontx); > -- > 2.14.1 > ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v3 11/11] doc: update eventdev documentation 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (8 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2017-12-25 19:17 ` Pavan Nikhilesh 2018-01-08 11:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Jerin Jacob 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2017-12-25 19:17 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev documentation to include new selftest feature. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- doc/guides/eventdevs/octeontx.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/guides/eventdevs/octeontx.rst b/doc/guides/eventdevs/octeontx.rst index cef004a20..bf2985be1 100644 --- a/doc/guides/eventdevs/octeontx.rst +++ b/doc/guides/eventdevs/octeontx.rst @@ -114,6 +114,19 @@ Example: ./your_eventdev_application --vdev="event_octeontx" + +Selftest +-------- + +The functionality of octeontx eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_octeontx,self_test=1" + + Limitations ----------- -- 2.14.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh ` (9 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 11/11] doc: update eventdev documentation Pavan Nikhilesh @ 2018-01-08 11:17 ` Jerin Jacob 10 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-08 11:17 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Tue, 26 Dec 2017 00:47:28 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros > X-Mailer: git-send-email 2.14.1 > > Adding common test assertion macros for unit testing. > Taken from test/test.h. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > new file mode 100644 > index 000000000..256117f79 > --- /dev/null > +++ b/lib/librte_eal/common/include/rte_test.h > @@ -0,0 +1,97 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. > + */ > + Use SPDX license plate. With above change: Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (8 preceding siblings ...) 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 02/11] eventdev: add API to perform self test Pavan Nikhilesh ` (10 more replies) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 10 siblings, 11 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Adding common test assertion macros for unit testing. Taken from test/test.h. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- v4 Changes: - add SPDX licence tags. - change octeontx selftest name to 'ssovf_evdev_selftest' v3 Changes: - add eventdev driver specific selftest to test/test v2 Changes: - remove duplications of test macros. - add selftest to test/test. - remove selftest devargs from sw eventdev. lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 69 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/common/include/rte_test.h diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..eba1059f2 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h rte_vfio.h +INC += rte_bitmap.h rte_vfio.h rte_test.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h new file mode 100644 index 000000000..741dd6191 --- /dev/null +++ b/lib/librte_eal/common/include/rte_test.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Cavium, Inc + */ + +#ifndef _RTE_TEST_H_ +#define _RTE_TEST_H_ + +#include <rte_log.h> + +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ + if (!(a == b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ + if (!(a != b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) do { \ + typeof(val) _val = (val); \ + if (!(_val == 0)) { \ + RTE_LOG(DEBUG, EAL, \ + "Test assert %s line %d failed (err %d): " \ + msg "\n", __func__, __LINE__, _val, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) do { \ + if (!(val != 0)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NULL(val, msg, ...) do { \ + if (!(val == NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ + if (!(val != NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#endif /* _RTE_TEST_H_ */ -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 02/11] eventdev: add API to perform self test 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (9 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add API to perform self test on the underlying event device driver. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- lib/librte_eventdev/rte_eventdev.c | 10 ++++++++++ lib/librte_eventdev/rte_eventdev.h | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 10 ++++++++++ lib/librte_eventdev/rte_eventdev_version.map | 6 ++++++ 4 files changed, 38 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 035bd0017..85496e575 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1114,6 +1114,16 @@ int rte_event_dev_xstats_reset(uint8_t dev_id, return -ENOTSUP; } +int rte_event_dev_selftest(uint8_t dev_id) +{ + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; + + if (dev->dev_ops->dev_selftest != NULL) + return (*dev->dev_ops->dev_selftest)(); + return -ENOTSUP; +} + int rte_event_dev_start(uint8_t dev_id) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 1bbea57db..9201a5af8 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1787,6 +1787,18 @@ rte_event_dev_xstats_reset(uint8_t dev_id, const uint32_t ids[], uint32_t nb_ids); +/** + * Trigger the eventdev self test. + * + * @param dev_id + * The identifier of the device + * @return + * - 0: Selftest successful + * - -ENOTSUP if the device doesn't support selftest + * - other values < 0 on failure. + */ +int rte_event_dev_selftest(uint8_t dev_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 6ed40cd38..7c39a040c 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -603,6 +603,13 @@ typedef int (*eventdev_eth_rx_adapter_stats_get) typedef int (*eventdev_eth_rx_adapter_stats_reset) (const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev); +/** + * Start eventdev selftest. + * + * @return + * Return 0 on success. + */ +typedef int (*eventdev_selftest)(void); /** Event device operations function pointer table */ struct rte_eventdev_ops { @@ -658,6 +665,9 @@ struct rte_eventdev_ops { /**< Get ethernet Rx stats */ eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; /**< Reset ethernet Rx stats */ + + eventdev_selftest dev_selftest; + /**< Start eventdev Selftest */ }; /** diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 108ae61fb..2aef470b5 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -68,3 +68,9 @@ DPDK_17.11 { rte_event_eth_rx_adapter_stop; } DPDK_17.08; + +DPDK_18.02 { + global: + + rte_event_dev_selftest; +} DPDK_17.11; -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 03/11] event/octeontx: move eventdev octeontx test to driver 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh ` (8 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move octeontx eventdev specific test (test_eventdev_octeontx.c) to driver/event/octeontx. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- .../event/octeontx/ssovf_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/ssovf_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/ssovf_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_octeontx.c rename to drivers/event/octeontx/ssovf_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index bb54c9808..87e3169d2 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 04/11] event/octeontx: modify octeontx eventdev test 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh ` (7 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_octeontx to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/ssovf_evdev_selftest.c | 457 +++++++++++++------------- 1 file changed, 234 insertions(+), 223 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index 8fddb4fd2..3866ba968 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -1,33 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Cavium, Inc. 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 Cavium, Inc 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc */ #include <rte_atomic.h> @@ -46,12 +18,21 @@ #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_bus_vdev.h> +#include <rte_test.h> -#include "test.h" +#include "ssovf_evdev.h" #define NUM_PACKETS (1 << 18) #define MAX_EVENTS (16 * 1024) +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ + octeontx_test_run(setup, teardown, test, #test) + +static int total; +static int passed; +static int failed; +static int unsupported; + static int evdev; static struct rte_mempool *eventdev_test_mempool; @@ -79,11 +60,11 @@ static inline int seqn_list_update(int val) { if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; + return -1; seqn_list[seqn_list_index++] = val; rte_smp_wmb(); - return TEST_SUCCESS; + return 0; } static inline int @@ -93,11 +74,11 @@ seqn_list_check(int limit) for (i = 0; i < limit; i++) { if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); + return -1; } } - return TEST_SUCCESS; + return 0; } struct test_core_param { @@ -114,20 +95,21 @@ testsuite_setup(void) evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", + ssovf_log_dbg("%d: Eventdev %s not found - creating.", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; + ssovf_log_dbg("Error creating eventdev %s", + eventdev_name); + return -1; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; + ssovf_log_dbg("Error finding newly created eventdev"); + return -1; } } - return TEST_SUCCESS; + return 0; } static void @@ -177,31 +159,32 @@ _eventdev_setup(int mode) 512, /* Use very small mbufs */ rte_socket_id()); if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; + ssovf_log_dbg("ERROR creating mempool"); + return -1; } ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, + "ERROR max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); devconf_set_default_sane_values(&dev_conf, &info); if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); + ssovf_log_dbg( + "test expects the unique priority per queue"); return -ENOTSUP; } @@ -216,35 +199,39 @@ _eventdev_setup(int mode) ret = rte_event_queue_default_conf_get(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", + i); queue_conf.priority = i * step; ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } else { /* Configure event queues with default priority */ for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } /* Configure event ports */ uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", + i); } ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start device"); - return TEST_SUCCESS; + return 0; } static inline int @@ -311,7 +298,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, @@ -332,8 +319,8 @@ check_excess_events(uint8_t port) for (i = 0; i < 32; i++) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); + RTE_TEST_ASSERT_SUCCESS(valid_event, + "Unexpected valid event=%d", ev.mbuf->seqn); } return 0; } @@ -346,12 +333,12 @@ generate_random_events(const unsigned int total_events) int ret; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { ret = inject_events( rte_rand() % info.max_event_queue_flows /*flow_id */, @@ -362,7 +349,7 @@ generate_random_events(const unsigned int total_events) 0 /* port */, 1 /* events */); if (ret) - return TEST_FAILED; + return -1; } return ret; } @@ -374,19 +361,19 @@ validate_event(struct rte_event *ev) struct event_attr *attr; attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, + RTE_TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, "flow_id mismatch enq=%d deq =%d", attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, + RTE_TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, "event_type mismatch enq=%d deq =%d", attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, + RTE_TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, "sub_event_type mismatch enq=%d deq =%d", attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, + RTE_TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, "sched_type mismatch enq=%d deq =%d", attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, "queue mismatch enq=%d deq =%d", attr->queue, ev->queue_id); return 0; @@ -405,8 +392,8 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) while (1) { if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; + ssovf_log_dbg("Detected deadlock"); + return -1; } valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); @@ -416,11 +403,11 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) forward_progress_cnt = 0; ret = validate_event(&ev); if (ret) - return TEST_FAILED; + return -1; if (fn != NULL) { ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate test specific event"); } @@ -438,8 +425,8 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, - ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", + index, ev->mbuf->seqn); return 0; } @@ -456,7 +443,7 @@ test_simple_enqdeq(uint8_t sched_type) 0 /* port */, MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); } @@ -491,7 +478,7 @@ test_multi_queue_enq_single_port_deq(void) ret = generate_random_events(MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, NULL); } @@ -514,7 +501,7 @@ static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint32_t range = MAX_EVENTS / queue_count; @@ -522,7 +509,7 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, + RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, queue_count, MAX_EVENTS); @@ -538,7 +525,7 @@ test_multi_queue_priority(void) /* See validate_queue_priority() comments for priority validate logic */ uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); max_evts_roundoff = MAX_EVENTS / queue_count; @@ -548,7 +535,7 @@ test_multi_queue_priority(void) struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; queue = i % queue_count; @@ -576,7 +563,7 @@ worker_multi_port_fn(void *arg) continue; ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } @@ -587,27 +574,29 @@ static inline int wait_workers_to_join(int lcore, const rte_atomic32_t *count) { uint64_t cycles, print_cycles; + RTE_SET_USED(count); print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != FINISHED) { uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, + ssovf_log_dbg("\r%s: events %d", __func__, rte_atomic32_read(count)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", + ssovf_log_dbg( + "%s: No schedules for seconds, deadlock (%d)", __func__, rte_atomic32_read(count)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; - return TEST_FAILED; + return -1; } } rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; + return 0; } @@ -631,12 +620,12 @@ launch_workers_and_wait(int (*master_worker)(void *), param = malloc(sizeof(struct test_core_param) * nb_workers); if (!param) - return TEST_FAILED; + return -1; ret = rte_event_dequeue_timeout_ticks(evdev, rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); if (ret) - return TEST_FAILED; + return -1; param[0].total_events = &atomic_total_events; param[0].sched_type = sched_type; @@ -679,17 +668,17 @@ test_multi_queue_enq_multi_port_deq(void) ret = generate_random_events(total_events); if (ret) - return TEST_FAILED; + return -1; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } return launch_workers_and_wait(worker_multi_port_fn, @@ -702,7 +691,7 @@ validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(port, ev->queue_id, "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -718,18 +707,19 @@ test_queue_to_port_single_link(void) int i, nr_links, ret; uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); /* Unlink all connections that created in eventdev_setup */ for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, + "Failed to unlink all queues port=%d", i); } uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); @@ -741,7 +731,7 @@ test_queue_to_port_single_link(void) uint8_t queue = (uint8_t)i; ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); + RTE_TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); ret = inject_events( 0x100 /*flow_id */, @@ -752,7 +742,7 @@ test_queue_to_port_single_link(void) i /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; } /* Verify the events generated from correct queue */ @@ -760,10 +750,10 @@ test_queue_to_port_single_link(void) ret = consume_events(i /* port */, total_events, validate_queue_to_port_single_link); if (ret) - return TEST_FAILED; + return -1; } - return TEST_SUCCESS; + return 0; } static int @@ -771,7 +761,7 @@ validate_queue_to_port_multi_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), + RTE_TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -789,27 +779,27 @@ test_queue_to_port_multi_link(void) uint32_t nr_queues = 0; uint32_t nr_ports = 0; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", + ssovf_log_dbg("%s: Not enough ports to test ports=%d", __func__, nr_ports); - return TEST_SUCCESS; + return 0; } /* Unlink all connections that created in eventdev_setup */ for (port = 0; port < nr_ports; port++) { ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", + RTE_TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", port); } @@ -819,7 +809,7 @@ test_queue_to_port_multi_link(void) for (queue = 0; queue < nr_queues; queue++) { port = queue & 0x1; ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", + RTE_TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", queue, port); ret = inject_events( @@ -831,7 +821,7 @@ test_queue_to_port_multi_link(void) port /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; if (port == 0) port0_events += total_events; @@ -842,13 +832,13 @@ test_queue_to_port_multi_link(void) ret = consume_events(0 /* port */, port0_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; ret = consume_events(1 /* port */, port1_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; - return TEST_SUCCESS; + return 0; } static int @@ -878,17 +868,17 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.sub_event_type = %d\n", + ssovf_log_dbg("Invalid ev.sub_event_type = %d", ev.sub_event_type); - return TEST_FAILED; + return -1; } } return 0; @@ -902,15 +892,15 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -923,20 +913,20 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_flow_based_pipeline, worker_flow_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } @@ -1033,16 +1023,16 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; + ssovf_log_dbg("Invalid ev.queue_id = %d", ev.queue_id); + return -1; } } @@ -1058,21 +1048,21 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", + ssovf_log_dbg("%s: Not enough queues=%d ports=%d or workers=%d", __func__, queue_count, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1085,20 +1075,20 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_group_based_pipeline, worker_group_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } static int @@ -1201,15 +1191,15 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1222,7 +1212,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) 0 /* port */, MAX_EVENTS /* events */); if (ret) - return TEST_FAILED; + return -1; return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, 0xff /* invalid */); @@ -1244,7 +1234,7 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1286,7 +1276,7 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1357,14 +1347,14 @@ test_producer_consumer_ingress_order_test(int (*fn)(void *)) { uint32_t nr_ports; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; + ssovf_log_dbg("### Not enough cores for %s test.", __func__); + return 0; } launch_workers_and_wait(worker_ordered_flow_producer, fn, @@ -1389,86 +1379,107 @@ test_queue_producer_consumer_ingress_order_test(void) worker_group_based_pipeline); } -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ +static void octeontx_test_run(int (*setup)(void), void (*tdown)(void), + int (*test)(void), const char *name) +{ + if (setup() < 0) { + ssovf_log_selftest("Error setting up test %s", name); + unsupported++; + } else { + if (test() < 0) { + failed++; + ssovf_log_selftest("%s Failed", name); + } else { + passed++; + ssovf_log_selftest("%s Passed", name); + } } -}; -static int + total++; + tdown(); +} + +int test_eventdev_octeontx(void) { - return unit_test_suite_runner(&eventdev_octeontx_testsuite); -} + testsuite_setup(); + + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_multi_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_single_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_multi_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_mixed_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_flow_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup_priority, eventdev_teardown, + test_multi_queue_priority); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + + ssovf_log_selftest("Total tests : %d", total); + ssovf_log_selftest("Passed : %d", passed); + ssovf_log_selftest("Failed : %d", failed); + ssovf_log_selftest("Not supported : %d", unsupported); + + testsuite_teardown(); + + if (failed) + return -1; -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); + return 0; +} -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 05/11] event/octeontx: update octeontx eventdev selftest ops 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (2 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh ` (6 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 3 ++- drivers/event/octeontx/ssovf_evdev.c | 2 ++ drivers/event/octeontx/ssovf_evdev.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index fdf1b7385..9a6ffdfb1 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map @@ -54,6 +54,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index b80a6c0ae..0a96fbd7f 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -613,6 +613,8 @@ static const struct rte_eventdev_ops ssovf_ops = { .eth_rx_adapter_start = ssovf_eth_rx_adapter_start, .eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop, + .dev_selftest = test_eventdev_octeontx, + .dump = ssovf_dump, .dev_start = ssovf_start, .dev_stop = ssovf_stop, diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index b093a3e73..72a980447 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,6 +57,9 @@ #define ssovf_log_err(fmt, args...) \ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define ssovf_log_selftest(fmt, args...) \ + RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) #define SSO_MAX_VHGRP (64) #define SSO_MAX_VHWS (32) @@ -196,5 +199,6 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +int test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 06/11] event/octeontx: add selftest to device arguments 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (3 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh ` (5 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_octeontx,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 2 +- drivers/event/octeontx/ssovf_evdev.c | 41 ++++++++++++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_evdev.h | 2 ++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 9a6ffdfb1..ff2a11793 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 0a96fbd7f..f092d352b 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -38,6 +38,7 @@ #include <rte_eal.h> #include <rte_ethdev.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_kvargs.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> @@ -593,6 +594,15 @@ ssovf_close(struct rte_eventdev *dev) return 0; } +static int +ssovf_selftest(const char *key __rte_unused, const char *value, + void *opaque) +{ + int *flag = opaque; + *flag = !!atoi(value); + return 0; +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -630,7 +640,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) struct rte_eventdev *eventdev; static int ssovf_init_once; const char *name; + const char *params; int ret; + int selftest = 0; + + static const char *const args[] = { + SSOVF_SELFTEST_ARG, + NULL + }; name = rte_vdev_device_name(vdev); /* More than one instance is not supported */ @@ -639,6 +656,28 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return -EINVAL; } + params = rte_vdev_device_args(vdev); + if (params != NULL && params[0] != '\0') { + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); + + if (!kvlist) { + ssovf_log_info( + "Ignoring unsupported params supplied '%s'", + name); + } else { + int ret = rte_kvargs_process(kvlist, + SSOVF_SELFTEST_ARG, + ssovf_selftest, &selftest); + if (ret != 0) { + ssovf_log_err("%s: Error in selftest", name); + rte_kvargs_free(kvlist); + return ret; + } + } + + rte_kvargs_free(kvlist); + } + eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev), rte_socket_id()); if (eventdev == NULL) { @@ -689,6 +728,8 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) edev->max_event_ports); ssovf_init_once = 1; + if (selftest) + test_eventdev_octeontx(); return 0; error: diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 72a980447..018fbdfa5 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -117,6 +117,8 @@ #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8 +#define SSOVF_SELFTEST_ARG ("selftest") + /* * In Cavium OcteonTX SoC, all accesses to the device registers are * implictly strongly ordered. So, The relaxed version of IO operation is -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 07/11] event/sw: move eventdev software test to driver 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (4 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 08/11] event/sw: modify eventdev software test Pavan Nikhilesh ` (4 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move software eventdev specific test (test_eventdev_sw) to driver/event/sw/. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/sw_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_sw.c rename to drivers/event/sw/sw_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index 87e3169d2..c551ad964 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 08/11] event/sw: modify eventdev software test 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (5 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh ` (3 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_sw to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/sw_evdev_selftest.c | 70 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 4108b00bf..0e84b2003 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -52,7 +52,7 @@ #include <rte_service_component.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "sw_evdev.h" #define MAX_PORTS 16 #define MAX_QIDS 16 @@ -3042,7 +3042,7 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release) static struct rte_mempool *eventdev_func_mempool; -static int +int test_sw_eventdev(void) { struct test *t = malloc(sizeof(struct test)); @@ -3053,25 +3053,25 @@ test_sw_eventdev(void) */ release_ev.op = RTE_EVENT_OP_RELEASE; - const char *eventdev_name = "event_sw0"; + const char *eventdev_name = "event_sw"; evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("%d: Eventdev %s not found - creating.\n", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { printf("Error creating eventdev\n"); - return -1; + goto test_fail; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("Error finding newly created eventdev\n"); - return -1; + goto test_fail; } } if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { printf("Failed to get service ID for software event dev\n"); - return -1; + goto test_fail; } rte_service_runstate_set(t->service_id, 1); @@ -3088,7 +3088,7 @@ test_sw_eventdev(void) rte_socket_id()); if (!eventdev_func_mempool) { printf("ERROR creating mempool\n"); - return -1; + goto test_fail; } } t->mbuf_pool = eventdev_func_mempool; @@ -3096,146 +3096,146 @@ test_sw_eventdev(void) ret = test_single_directed_packet(t); if (ret != 0) { printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Directed Forward Credit test...\n"); ret = test_directed_forward_credits(t); if (ret != 0) { printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Single Load Balanced Packet test...\n"); ret = single_packet(t); if (ret != 0) { printf("ERROR - Single Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Unordered Basic test...\n"); ret = unordered_basic(t); if (ret != 0) { printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Basic test...\n"); ret = ordered_basic(t); if (ret != 0) { printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Burst Packets test...\n"); ret = burst_packets(t); if (ret != 0) { printf("ERROR - Burst Packets test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing test...\n"); ret = load_balancing(t); if (ret != 0) { printf("ERROR - Load Balancing test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Directed test...\n"); ret = test_priority_directed(t); if (ret != 0) { printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Atomic test...\n"); ret = test_priority_atomic(t); if (ret != 0) { printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Ordered test...\n"); ret = test_priority_ordered(t); if (ret != 0) { printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Unordered test...\n"); ret = test_priority_unordered(t); if (ret != 0) { printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Invalid QID test...\n"); ret = invalid_qid(t); if (ret != 0) { printf("ERROR - Invalid QID test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing History test...\n"); ret = load_balancing_history(t); if (ret != 0) { printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Inflight Count test...\n"); ret = inflight_counts(t); if (ret != 0) { printf("ERROR - Inflight Count test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Abuse Inflights test...\n"); ret = abuse_inflights(t); if (ret != 0) { printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats test...\n"); ret = xstats_tests(t); if (ret != 0) { printf("ERROR - XStats test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Reset test...\n"); ret = xstats_id_reset_tests(t); if (ret != 0) { printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats Brute Force test...\n"); ret = xstats_brute_force(t); if (ret != 0) { printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Abuse test...\n"); ret = xstats_id_abuse_tests(t); if (ret != 0) { printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running QID Priority test...\n"); ret = qid_priorities(t); if (ret != 0) { printf("ERROR - QID Priority test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Reconfigure test...\n"); ret = ordered_reconfigure(t); if (ret != 0) { printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port LB Single Reconfig test...\n"); ret = port_single_lb_reconfig(t); if (ret != 0) { printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port Reconfig Credits test...\n"); ret = port_reconfig_credits(t); if (ret != 0) { printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Head-of-line-blocking test...\n"); ret = holb(t); if (ret != 0) { printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; + goto test_fail; } if (rte_lcore_count() >= 3) { printf("*** Running Worker loopback test...\n"); @@ -3249,7 +3249,7 @@ test_sw_eventdev(void) ret = worker_loopback(t, 1); if (ret != 0) { printf("ERROR - Worker loopback test FAILED.\n"); - return ret; + goto test_fail; } } else { printf("### Not enough cores for worker loopback tests.\n"); @@ -3262,7 +3262,9 @@ test_sw_eventdev(void) */ free(t); + printf("SW Eventdev Selftest Successful.\n"); return 0; +test_fail: + printf("SW Eventdev Selftest Failed.\n"); + return -1; } - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 09/11] event/sw: update software eventdev selftest ops 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (6 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 08/11] event/sw: modify eventdev software test Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 10/11] test: register eventdev selftest Pavan Nikhilesh ` (2 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update software eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/Makefile | 2 ++ drivers/event/sw/sw_evdev.c | 2 ++ drivers/event/sw/sw_evdev.h | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 2f2b67bac..149258748 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers endif endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring +LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev # library version @@ -57,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_scheduler.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_xstats.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_selftest.c # export include files SYMLINK-y-include += diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index 1ef634093..f40597aae 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -794,6 +794,8 @@ sw_probe(struct rte_vdev_device *vdev) .xstats_get_names = sw_xstats_get_names, .xstats_get_by_name = sw_xstats_get_by_name, .xstats_reset = sw_xstats_reset, + + .dev_selftest = test_sw_eventdev, }; static const char *const args[] = { diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index d08f7d042..b1d2c371c 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -334,5 +334,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +int test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */ -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 10/11] test: register eventdev selftest 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (7 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-10 20:20 ` [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros Thomas Monjalon 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- test/test/test_eventdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index f8ee1bef6..7465251dc 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -1018,4 +1018,26 @@ test_eventdev_common(void) return unit_test_suite_runner(&eventdev_common_testsuite); } +static int +test_eventdev_selftest_impl(const char *pmd, const char *opts) +{ + rte_vdev_init(pmd, opts); + return rte_event_dev_selftest(rte_event_dev_get_dev_id(pmd)); +} + +static int +test_eventdev_selftest_sw(void) +{ + return test_eventdev_selftest_impl("event_sw", ""); +} + +static int +test_eventdev_selftest_octeontx(void) +{ + return test_eventdev_selftest_impl("event_octeontx", ""); +} + REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); +REGISTER_TEST_COMMAND(eventdev_selftest_sw, test_eventdev_selftest_sw); +REGISTER_TEST_COMMAND(eventdev_selftest_octeontx, + test_eventdev_selftest_octeontx); -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v4 11/11] doc: update eventdev documentation 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (8 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2018-01-08 13:47 ` Pavan Nikhilesh 2018-01-10 20:20 ` [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros Thomas Monjalon 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-08 13:47 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev documentation to include new selftest feature. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- doc/guides/eventdevs/octeontx.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/guides/eventdevs/octeontx.rst b/doc/guides/eventdevs/octeontx.rst index cef004a20..bf2985be1 100644 --- a/doc/guides/eventdevs/octeontx.rst +++ b/doc/guides/eventdevs/octeontx.rst @@ -114,6 +114,19 @@ Example: ./your_eventdev_application --vdev="event_octeontx" + +Selftest +-------- + +The functionality of octeontx eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_octeontx,self_test=1" + + Limitations ----------- -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh ` (9 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 11/11] doc: update eventdev documentation Pavan Nikhilesh @ 2018-01-10 20:20 ` Thomas Monjalon 2018-01-11 7:11 ` Pavan Nikhilesh 10 siblings, 1 reply; 87+ messages in thread From: Thomas Monjalon @ 2018-01-10 20:20 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: dev, jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma 08/01/2018 14:47, Pavan Nikhilesh: > Adding common test assertion macros for unit testing. > Taken from test/test.h. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/include/rte_test.h | 69 ++++++++++++++++++++++++++++++++ > 2 files changed, 70 insertions(+), 1 deletion(-) > create mode 100644 lib/librte_eal/common/include/rte_test.h Is the original file still needed? Can we always use rte_test.h from EAL? > +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ > + if (!(cond)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ > + if (!(a == b)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + return -1; \ > + } \ > +} while (0) Why not call RTE_TEST_ASSERT in all derived macros? ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros 2018-01-10 20:20 ` [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros Thomas Monjalon @ 2018-01-11 7:11 ` Pavan Nikhilesh 0 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 7:11 UTC (permalink / raw) To: Thomas Monjalon, jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev On Wed, Jan 10, 2018 at 09:20:06PM +0100, Thomas Monjalon wrote: > 08/01/2018 14:47, Pavan Nikhilesh: > > Adding common test assertion macros for unit testing. > > Taken from test/test.h. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > > --- > > lib/librte_eal/common/Makefile | 2 +- > > lib/librte_eal/common/include/rte_test.h | 69 ++++++++++++++++++++++++++++++++ > > 2 files changed, 70 insertions(+), 1 deletion(-) > > create mode 100644 lib/librte_eal/common/include/rte_test.h > > Is the original file still needed? The original file still contains macros and structs related to unit test suite, I think everything should be gradually ported to rte_test.h > Can we always use rte_test.h from EAL? I will link the test assert macros rte test assert macros and not remove them for now as it would break other tests. > > > +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ > > + if (!(cond)) { \ > > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > > + return -1; \ > > + } \ > > +} while (0) > > + > > +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ > > + if (!(a == b)) { \ > > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > > + return -1; \ > > + } \ > > +} while (0) > > Why not call RTE_TEST_ASSERT in all derived macros? Agreed, that would reduce code duplication will send a v5 with the changes. ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (9 preceding siblings ...) 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 02/11] eventdev: add API to perform self test Pavan Nikhilesh ` (10 more replies) 10 siblings, 11 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Adding common test assertion macros for unit testing. Replaced common macros in test/test.h with new RTE_TEST_ASSERT_* macros. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- v5 Changes: - rebase patchset - remove duplication between test/test/test.h and rte_test.h by mapping RTE_TEST_ASSERT* macros to test.h v4 Changes: - add SPDX licence tags. - change octeontx selftest name to 'ssovf_evdev_selftest' v3 Changes: - add eventdev driver specific selftest to test/test v2 Changes: - remove duplications of test macros. - add selftest to test/test. - remove selftest devargs from sw eventdev. lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 46 +++++++++++++++++++++ test/test/test.h | 70 +++++--------------------------- 3 files changed, 58 insertions(+), 60 deletions(-) create mode 100644 lib/librte_eal/common/include/rte_test.h diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..eba1059f2 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h rte_vfio.h +INC += rte_bitmap.h rte_vfio.h rte_test.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h new file mode 100644 index 000000000..89e47f47a --- /dev/null +++ b/lib/librte_eal/common/include/rte_test.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Cavium, Inc + */ + +#ifndef _RTE_TEST_H_ +#define _RTE_TEST_H_ + +#include <rte_log.h> + +/* Before including rte_test.h file you can define + * RTE_TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test + * failures. Mostly useful in development phase. + */ +#ifndef RTE_TEST_TRACE_FAILURE +#define RTE_TEST_TRACE_FAILURE(_file, _line, _func) +#endif + + +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) \ + RTE_TEST_ASSERT(a == b, msg, ##__VA_ARGS__) + +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) \ + RTE_TEST_ASSERT(a != b, msg, ##__VA_ARGS__) + +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) \ + RTE_TEST_ASSERT(val == 0, msg, ##__VA_ARGS__) + +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) \ + RTE_TEST_ASSERT(val != 0, msg, ##__VA_ARGS__) + +#define RTE_TEST_ASSERT_NULL(val, msg, ...) \ + RTE_TEST_ASSERT(val == NULL, msg, ##__VA_ARGS__) + +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) \ + RTE_TEST_ASSERT(val != NULL, msg, ##__VA_ARGS__) + +#endif /* _RTE_TEST_H_ */ diff --git a/test/test/test.h b/test/test/test.h index 08ffe949c..0ea18586c 100644 --- a/test/test/test.h +++ b/test/test/test.h @@ -38,7 +38,6 @@ #include <sys/queue.h> #include <rte_common.h> -#include <rte_log.h> #define TEST_SUCCESS (0) #define TEST_FAILED (-1) @@ -50,23 +49,13 @@ # define TEST_TRACE_FAILURE(_file, _line, _func) #endif -#define TEST_ASSERT(cond, msg, ...) do { \ - if (!(cond)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define RTE_TEST_TRACE_FAILURE TEST_TRACE_FAILURE -#define TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ - if (!(a == b)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#include <rte_test.h> + +#define TEST_ASSERT RTE_TEST_ASSERT + +#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL /* Compare two buffers (length in bytes) */ #define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len, msg, ...) do { \ @@ -134,52 +123,15 @@ } \ } while (0) -#define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ - if (!(a != b)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NOT_EQUAL RTE_TEST_ASSERT_NOT_EQUAL -#define TEST_ASSERT_SUCCESS(val, msg, ...) do { \ - typeof(val) _val = (val); \ - if (!(_val == 0)) { \ - printf("TestCase %s() line %d failed (err %d): " \ - msg "\n", __func__, __LINE__, _val, \ - ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_SUCCESS RTE_TEST_ASSERT_SUCCESS -#define TEST_ASSERT_FAIL(val, msg, ...) do { \ - if (!(val != 0)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_FAIL RTE_TEST_ASSERT_FAIL -#define TEST_ASSERT_NULL(val, msg, ...) do { \ - if (!(val == NULL)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NULL RTE_TEST_ASSERT_NULL -#define TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ - if (!(val != NULL)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ - return TEST_FAILED; \ - } \ -} while (0) +#define TEST_ASSERT_NOT_NULL RTE_TEST_ASSERT_NOT_NULL struct unit_test_case { int (*setup)(void); -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 02/11] eventdev: add API to perform self test 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh ` (9 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add API to perform self test on the underlying event device driver. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- lib/librte_eventdev/rte_eventdev.c | 10 ++++++++++ lib/librte_eventdev/rte_eventdev.h | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 10 ++++++++++ lib/librte_eventdev/rte_eventdev_version.map | 6 ++++++ 4 files changed, 38 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 035bd0017..85496e575 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1114,6 +1114,16 @@ int rte_event_dev_xstats_reset(uint8_t dev_id, return -ENOTSUP; } +int rte_event_dev_selftest(uint8_t dev_id) +{ + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; + + if (dev->dev_ops->dev_selftest != NULL) + return (*dev->dev_ops->dev_selftest)(); + return -ENOTSUP; +} + int rte_event_dev_start(uint8_t dev_id) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 1bbea57db..9201a5af8 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1787,6 +1787,18 @@ rte_event_dev_xstats_reset(uint8_t dev_id, const uint32_t ids[], uint32_t nb_ids); +/** + * Trigger the eventdev self test. + * + * @param dev_id + * The identifier of the device + * @return + * - 0: Selftest successful + * - -ENOTSUP if the device doesn't support selftest + * - other values < 0 on failure. + */ +int rte_event_dev_selftest(uint8_t dev_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 6ed40cd38..7c39a040c 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -603,6 +603,13 @@ typedef int (*eventdev_eth_rx_adapter_stats_get) typedef int (*eventdev_eth_rx_adapter_stats_reset) (const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev); +/** + * Start eventdev selftest. + * + * @return + * Return 0 on success. + */ +typedef int (*eventdev_selftest)(void); /** Event device operations function pointer table */ struct rte_eventdev_ops { @@ -658,6 +665,9 @@ struct rte_eventdev_ops { /**< Get ethernet Rx stats */ eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; /**< Reset ethernet Rx stats */ + + eventdev_selftest dev_selftest; + /**< Start eventdev Selftest */ }; /** diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 108ae61fb..2aef470b5 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -68,3 +68,9 @@ DPDK_17.11 { rte_event_eth_rx_adapter_stop; } DPDK_17.08; + +DPDK_18.02 { + global: + + rte_event_dev_selftest; +} DPDK_17.11; -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 03/11] event/octeontx: move eventdev octeontx test to driver 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 02/11] eventdev: add API to perform self test Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh ` (8 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move octeontx eventdev specific test (test_eventdev_octeontx.c) to driver/event/octeontx. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- .../event/octeontx/ssovf_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_octeontx.c => drivers/event/octeontx/ssovf_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_octeontx.c b/drivers/event/octeontx/ssovf_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_octeontx.c rename to drivers/event/octeontx/ssovf_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index bb54c9808..87e3169d2 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -211,7 +211,6 @@ SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 04/11] event/octeontx: modify octeontx eventdev test 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh ` (7 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_octeontx to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/event/octeontx/ssovf_evdev_selftest.c | 425 ++++++++++++++------------ 1 file changed, 232 insertions(+), 193 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index 8fddb4fd2..325c110c8 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -46,12 +46,21 @@ #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_bus_vdev.h> +#include <rte_test.h> -#include "test.h" +#include "ssovf_evdev.h" #define NUM_PACKETS (1 << 18) #define MAX_EVENTS (16 * 1024) +#define OCTEONTX_TEST_RUN(setup, teardown, test) \ + octeontx_test_run(setup, teardown, test, #test) + +static int total; +static int passed; +static int failed; +static int unsupported; + static int evdev; static struct rte_mempool *eventdev_test_mempool; @@ -79,11 +88,11 @@ static inline int seqn_list_update(int val) { if (seqn_list_index >= NUM_PACKETS) - return TEST_FAILED; + return -1; seqn_list[seqn_list_index++] = val; rte_smp_wmb(); - return TEST_SUCCESS; + return 0; } static inline int @@ -93,11 +102,11 @@ seqn_list_check(int limit) for (i = 0; i < limit; i++) { if (seqn_list[i] != i) { - printf("Seqn mismatch %d %d\n", seqn_list[i], i); - return TEST_FAILED; + ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i); + return -1; } } - return TEST_SUCCESS; + return 0; } struct test_core_param { @@ -114,20 +123,21 @@ testsuite_setup(void) evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("%d: Eventdev %s not found - creating.\n", + ssovf_log_dbg("%d: Eventdev %s not found - creating.", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { - printf("Error creating eventdev %s\n", eventdev_name); - return TEST_FAILED; + ssovf_log_dbg("Error creating eventdev %s", + eventdev_name); + return -1; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { - printf("Error finding newly created eventdev\n"); - return TEST_FAILED; + ssovf_log_dbg("Error finding newly created eventdev"); + return -1; } } - return TEST_SUCCESS; + return 0; } static void @@ -177,31 +187,32 @@ _eventdev_setup(int mode) 512, /* Use very small mbufs */ rte_socket_id()); if (!eventdev_test_mempool) { - printf("ERROR creating mempool\n"); - return TEST_FAILED; + ssovf_log_dbg("ERROR creating mempool"); + return -1; } ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, - "max_num_events=%d < max_events=%d", - info.max_num_events, MAX_EVENTS); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS, + "ERROR max_num_events=%d < max_events=%d", + info.max_num_events, MAX_EVENTS); devconf_set_default_sane_values(&dev_conf, &info); if (mode == TEST_EVENTDEV_SETUP_DEQUEUE_TIMEOUT) dev_conf.event_dev_cfg |= RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT; ret = rte_event_dev_configure(evdev, &dev_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { if (queue_count > 8) { - printf("test expects the unique priority per queue\n"); + ssovf_log_dbg( + "test expects the unique priority per queue"); return -ENOTSUP; } @@ -216,35 +227,39 @@ _eventdev_setup(int mode) ret = rte_event_queue_default_conf_get(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get def_conf%d", + i); queue_conf.priority = i * step; ret = rte_event_queue_setup(evdev, i, &queue_conf); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } else { /* Configure event queues with default priority */ for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", + i); } } /* Configure event ports */ uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); - TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, "Failed to link all queues port=%d", + i); } ret = rte_event_dev_start(evdev); - TEST_ASSERT_SUCCESS(ret, "Failed to start device"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start device"); - return TEST_SUCCESS; + return 0; } static inline int @@ -311,7 +326,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, @@ -332,8 +347,8 @@ check_excess_events(uint8_t port) for (i = 0; i < 32; i++) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); - TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); + RTE_TEST_ASSERT_SUCCESS(valid_event, + "Unexpected valid event=%d", ev.mbuf->seqn); } return 0; } @@ -346,12 +361,12 @@ generate_random_events(const unsigned int total_events) int ret; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); ret = rte_event_dev_info_get(evdev, &info); - TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { ret = inject_events( rte_rand() % info.max_event_queue_flows /*flow_id */, @@ -362,7 +377,7 @@ generate_random_events(const unsigned int total_events) 0 /* port */, 1 /* events */); if (ret) - return TEST_FAILED; + return -1; } return ret; } @@ -374,19 +389,19 @@ validate_event(struct rte_event *ev) struct event_attr *attr; attr = rte_pktmbuf_mtod(ev->mbuf, struct event_attr *); - TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, + RTE_TEST_ASSERT_EQUAL(attr->flow_id, ev->flow_id, "flow_id mismatch enq=%d deq =%d", attr->flow_id, ev->flow_id); - TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, + RTE_TEST_ASSERT_EQUAL(attr->event_type, ev->event_type, "event_type mismatch enq=%d deq =%d", attr->event_type, ev->event_type); - TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, + RTE_TEST_ASSERT_EQUAL(attr->sub_event_type, ev->sub_event_type, "sub_event_type mismatch enq=%d deq =%d", attr->sub_event_type, ev->sub_event_type); - TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, + RTE_TEST_ASSERT_EQUAL(attr->sched_type, ev->sched_type, "sched_type mismatch enq=%d deq =%d", attr->sched_type, ev->sched_type); - TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(attr->queue, ev->queue_id, "queue mismatch enq=%d deq =%d", attr->queue, ev->queue_id); return 0; @@ -405,8 +420,8 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) while (1) { if (++forward_progress_cnt > UINT16_MAX) { - printf("Detected deadlock\n"); - return TEST_FAILED; + ssovf_log_dbg("Detected deadlock"); + return -1; } valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); @@ -416,11 +431,11 @@ consume_events(uint8_t port, const uint32_t total_events, validate_event_cb fn) forward_progress_cnt = 0; ret = validate_event(&ev); if (ret) - return TEST_FAILED; + return -1; if (fn != NULL) { ret = fn(index, port, &ev); - TEST_ASSERT_SUCCESS(ret, + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate test specific event"); } @@ -438,8 +453,8 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", index, - ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", + index, ev->mbuf->seqn); return 0; } @@ -456,7 +471,7 @@ test_simple_enqdeq(uint8_t sched_type) 0 /* port */, MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, validate_simple_enqdeq); } @@ -491,7 +506,7 @@ test_multi_queue_enq_single_port_deq(void) ret = generate_random_events(MAX_EVENTS); if (ret) - return TEST_FAILED; + return -1; return consume_events(0 /* port */, MAX_EVENTS, NULL); } @@ -514,7 +529,7 @@ static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint32_t range = MAX_EVENTS / queue_count; @@ -522,7 +537,7 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, + RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, queue_count, MAX_EVENTS); @@ -538,7 +553,7 @@ test_multi_queue_priority(void) /* See validate_queue_priority() comments for priority validate logic */ uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); max_evts_roundoff = MAX_EVENTS / queue_count; @@ -548,7 +563,7 @@ test_multi_queue_priority(void) struct rte_event ev = {.event = 0, .u64 = 0}; m = rte_pktmbuf_alloc(eventdev_test_mempool); - TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); + RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; queue = i % queue_count; @@ -576,7 +591,7 @@ worker_multi_port_fn(void *arg) continue; ret = validate_event(&ev); - TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } @@ -587,27 +602,29 @@ static inline int wait_workers_to_join(int lcore, const rte_atomic32_t *count) { uint64_t cycles, print_cycles; + RTE_SET_USED(count); print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != FINISHED) { uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - printf("\r%s: events %d\n", __func__, + ssovf_log_dbg("\r%s: events %d", __func__, rte_atomic32_read(count)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { - printf("%s: No schedules for seconds, deadlock (%d)\n", + ssovf_log_dbg( + "%s: No schedules for seconds, deadlock (%d)", __func__, rte_atomic32_read(count)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; - return TEST_FAILED; + return -1; } } rte_eal_mp_wait_lcore(); - return TEST_SUCCESS; + return 0; } @@ -631,12 +648,12 @@ launch_workers_and_wait(int (*master_worker)(void *), param = malloc(sizeof(struct test_core_param) * nb_workers); if (!param) - return TEST_FAILED; + return -1; ret = rte_event_dequeue_timeout_ticks(evdev, rte_rand() % 10000000/* 10ms */, &dequeue_tmo_ticks); if (ret) - return TEST_FAILED; + return -1; param[0].total_events = &atomic_total_events; param[0].sched_type = sched_type; @@ -679,17 +696,17 @@ test_multi_queue_enq_multi_port_deq(void) ret = generate_random_events(total_events); if (ret) - return TEST_FAILED; + return -1; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } return launch_workers_and_wait(worker_multi_port_fn, @@ -702,7 +719,7 @@ validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, ev->queue_id, + RTE_TEST_ASSERT_EQUAL(port, ev->queue_id, "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -718,18 +735,19 @@ test_queue_to_port_single_link(void) int i, nr_links, ret; uint32_t port_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &port_count), "Port count get failed"); /* Unlink all connections that created in eventdev_setup */ for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); + RTE_TEST_ASSERT(ret >= 0, + "Failed to unlink all queues port=%d", i); } uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); @@ -741,7 +759,7 @@ test_queue_to_port_single_link(void) uint8_t queue = (uint8_t)i; ret = rte_event_port_link(evdev, i, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); + RTE_TEST_ASSERT(ret == 1, "Failed to link queue to port %d", i); ret = inject_events( 0x100 /*flow_id */, @@ -752,7 +770,7 @@ test_queue_to_port_single_link(void) i /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; } /* Verify the events generated from correct queue */ @@ -760,10 +778,10 @@ test_queue_to_port_single_link(void) ret = consume_events(i /* port */, total_events, validate_queue_to_port_single_link); if (ret) - return TEST_FAILED; + return -1; } - return TEST_SUCCESS; + return 0; } static int @@ -771,7 +789,7 @@ validate_queue_to_port_multi_link(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(index); - TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), + RTE_TEST_ASSERT_EQUAL(port, (ev->queue_id & 0x1), "queue mismatch enq=%d deq =%d", port, ev->queue_id); return 0; @@ -789,27 +807,27 @@ test_queue_to_port_multi_link(void) uint32_t nr_queues = 0; uint32_t nr_ports = 0; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &nr_queues), "Queue count get failed"); - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); if (nr_ports < 2) { - printf("%s: Not enough ports to test ports=%d\n", + ssovf_log_dbg("%s: Not enough ports to test ports=%d", __func__, nr_ports); - return TEST_SUCCESS; + return 0; } /* Unlink all connections that created in eventdev_setup */ for (port = 0; port < nr_ports; port++) { ret = rte_event_port_unlink(evdev, port, NULL, 0); - TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", + RTE_TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", port); } @@ -819,7 +837,7 @@ test_queue_to_port_multi_link(void) for (queue = 0; queue < nr_queues; queue++) { port = queue & 0x1; ret = rte_event_port_link(evdev, port, &queue, NULL, 1); - TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", + RTE_TEST_ASSERT(ret == 1, "Failed to link queue=%d to port=%d", queue, port); ret = inject_events( @@ -831,7 +849,7 @@ test_queue_to_port_multi_link(void) port /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; if (port == 0) port0_events += total_events; @@ -842,13 +860,13 @@ test_queue_to_port_multi_link(void) ret = consume_events(0 /* port */, port0_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; ret = consume_events(1 /* port */, port1_events, validate_queue_to_port_multi_link); if (ret) - return TEST_FAILED; + return -1; - return TEST_SUCCESS; + return 0; } static int @@ -878,17 +896,17 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.sub_event_type = %d\n", + ssovf_log_dbg("Invalid ev.sub_event_type = %d", ev.sub_event_type); - return TEST_FAILED; + return -1; } } return 0; @@ -902,15 +920,15 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -923,20 +941,20 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_flow_based_pipeline, worker_flow_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } @@ -1033,16 +1051,16 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == TEST_SUCCESS) { + if (seqn_list_update(ev.mbuf->seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { - printf("Failed to update seqn_list\n"); - return TEST_FAILED; + ssovf_log_dbg("Failed to update seqn_list"); + return -1; } } else { - printf("Invalid ev.queue_id = %d\n", ev.queue_id); - return TEST_FAILED; + ssovf_log_dbg("Invalid ev.queue_id = %d", ev.queue_id); + return -1; } } @@ -1058,21 +1076,21 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); if (queue_count < 2 || !nr_ports) { - printf("%s: Not enough queues=%d ports=%d or workers=%d\n", + ssovf_log_dbg("%s: Not enough queues=%d ports=%d or workers=%d", __func__, queue_count, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1085,20 +1103,20 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, 0 /* port */, total_events /* events */); if (ret) - return TEST_FAILED; + return -1; ret = launch_workers_and_wait(worker_group_based_pipeline, worker_group_based_pipeline, total_events, nr_ports, out_sched_type); if (ret) - return TEST_FAILED; + return -1; if (in_sched_type != RTE_SCHED_TYPE_PARALLEL && out_sched_type == RTE_SCHED_TYPE_ATOMIC) { /* Check the events order maintained or not */ return seqn_list_check(total_events); } - return TEST_SUCCESS; + return 0; } static int @@ -1201,15 +1219,15 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) uint32_t nr_ports; int ret; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { - printf("%s: Not enough ports=%d or workers=%d\n", __func__, + ssovf_log_dbg("%s: Not enough ports=%d or workers=%d", __func__, nr_ports, rte_lcore_count() - 1); - return TEST_SUCCESS; + return 0; } /* Injects events with m->seqn=0 to total_events */ @@ -1222,7 +1240,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) 0 /* port */, MAX_EVENTS /* events */); if (ret) - return TEST_FAILED; + return -1; return launch_workers_and_wait(fn, fn, MAX_EVENTS, nr_ports, 0xff /* invalid */); @@ -1244,7 +1262,7 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1286,7 +1304,7 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) uint16_t valid_event; uint8_t port = param->port; uint32_t queue_count; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; @@ -1357,14 +1375,14 @@ test_producer_consumer_ingress_order_test(int (*fn)(void *)) { uint32_t nr_ports; - TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT, &nr_ports), "Port count get failed"); nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { - printf("### Not enough cores for %s test.\n", __func__); - return TEST_SUCCESS; + ssovf_log_dbg("### Not enough cores for %s test.", __func__); + return 0; } launch_workers_and_wait(worker_ordered_flow_producer, fn, @@ -1389,86 +1407,107 @@ test_queue_producer_consumer_ingress_order_test(void) worker_group_based_pipeline); } -static struct unit_test_suite eventdev_octeontx_testsuite = { - .suite_name = "eventdev octeontx unit test suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_simple_enqdeq_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_single_port_deq), - TEST_CASE_ST(eventdev_setup_priority, eventdev_teardown, - test_multi_queue_priority), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_queue_enq_multi_port_deq), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_single_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_to_port_multi_link), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_ordered_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_atomic_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_atomic), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_ordered), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_parallel_to_parallel), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_flow_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_queue_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_multi_port_mixed_max_stages_random_sched_type), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_flow_producer_consumer_ingress_order_test), - TEST_CASE_ST(eventdev_setup, eventdev_teardown, - test_queue_producer_consumer_ingress_order_test), - /* Tests with dequeue timeout */ - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_flow_ordered_to_atomic), - TEST_CASE_ST(eventdev_setup_dequeue_timeout, eventdev_teardown, - test_multi_port_queue_ordered_to_atomic), - TEST_CASES_END() /**< NULL terminate unit test array */ +static void octeontx_test_run(int (*setup)(void), void (*tdown)(void), + int (*test)(void), const char *name) +{ + if (setup() < 0) { + ssovf_log_selftest("Error setting up test %s", name); + unsupported++; + } else { + if (test() < 0) { + failed++; + ssovf_log_selftest("%s Failed", name); + } else { + passed++; + ssovf_log_selftest("%s Passed", name); + } } -}; -static int + total++; + tdown(); +} + +int test_eventdev_octeontx(void) { - return unit_test_suite_runner(&eventdev_octeontx_testsuite); -} + testsuite_setup(); + + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_simple_enqdeq_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_queue_enq_multi_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_single_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_to_port_multi_link); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_ordered_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_atomic_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_ordered); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_parallel_to_parallel); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_flow_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_queue_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_multi_port_mixed_max_stages_random_sched_type); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_flow_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_queue_producer_consumer_ingress_order_test); + OCTEONTX_TEST_RUN(eventdev_setup_priority, eventdev_teardown, + test_multi_queue_priority); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_flow_ordered_to_atomic); + OCTEONTX_TEST_RUN(eventdev_setup_dequeue_timeout, eventdev_teardown, + test_multi_port_queue_ordered_to_atomic); + + ssovf_log_selftest("Total tests : %d", total); + ssovf_log_selftest("Passed : %d", passed); + ssovf_log_selftest("Failed : %d", failed); + ssovf_log_selftest("Not supported : %d", unsupported); + + testsuite_teardown(); + + if (failed) + return -1; -REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx); + return 0; +} -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 05/11] event/octeontx: update octeontx eventdev selftest ops 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (2 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh ` (6 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 3 ++- drivers/event/octeontx/ssovf_evdev.c | 2 ++ drivers/event/octeontx/ssovf_evdev.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index fdf1b7385..9a6ffdfb1 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map @@ -54,6 +54,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index b80a6c0ae..0a96fbd7f 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -613,6 +613,8 @@ static const struct rte_eventdev_ops ssovf_ops = { .eth_rx_adapter_start = ssovf_eth_rx_adapter_start, .eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop, + .dev_selftest = test_eventdev_octeontx, + .dump = ssovf_dump, .dev_start = ssovf_start, .dev_stop = ssovf_stop, diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index b093a3e73..72a980447 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,6 +57,9 @@ #define ssovf_log_err(fmt, args...) \ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define ssovf_log_selftest(fmt, args...) \ + RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) #define SSO_MAX_VHGRP (64) #define SSO_MAX_VHWS (32) @@ -196,5 +199,6 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +int test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 06/11] event/octeontx: add selftest to device arguments 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (3 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh ` (5 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Add selftest as a device argument that can be enabled by suppling 'self_test=1' as a vdev parameter --vdev="event_octeontx,self_test=1" The selftest is run after vdev creation is successfully complete. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- drivers/event/octeontx/Makefile | 2 +- drivers/event/octeontx/ssovf_evdev.c | 41 ++++++++++++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_evdev.h | 2 ++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 9a6ffdfb1..ff2a11793 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -42,7 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 0a96fbd7f..f092d352b 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -38,6 +38,7 @@ #include <rte_eal.h> #include <rte_ethdev.h> #include <rte_event_eth_rx_adapter.h> +#include <rte_kvargs.h> #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> @@ -593,6 +594,15 @@ ssovf_close(struct rte_eventdev *dev) return 0; } +static int +ssovf_selftest(const char *key __rte_unused, const char *value, + void *opaque) +{ + int *flag = opaque; + *flag = !!atoi(value); + return 0; +} + /* Initialize and register event driver with DPDK Application */ static const struct rte_eventdev_ops ssovf_ops = { .dev_infos_get = ssovf_info_get, @@ -630,7 +640,14 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) struct rte_eventdev *eventdev; static int ssovf_init_once; const char *name; + const char *params; int ret; + int selftest = 0; + + static const char *const args[] = { + SSOVF_SELFTEST_ARG, + NULL + }; name = rte_vdev_device_name(vdev); /* More than one instance is not supported */ @@ -639,6 +656,28 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return -EINVAL; } + params = rte_vdev_device_args(vdev); + if (params != NULL && params[0] != '\0') { + struct rte_kvargs *kvlist = rte_kvargs_parse(params, args); + + if (!kvlist) { + ssovf_log_info( + "Ignoring unsupported params supplied '%s'", + name); + } else { + int ret = rte_kvargs_process(kvlist, + SSOVF_SELFTEST_ARG, + ssovf_selftest, &selftest); + if (ret != 0) { + ssovf_log_err("%s: Error in selftest", name); + rte_kvargs_free(kvlist); + return ret; + } + } + + rte_kvargs_free(kvlist); + } + eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev), rte_socket_id()); if (eventdev == NULL) { @@ -689,6 +728,8 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) edev->max_event_ports); ssovf_init_once = 1; + if (selftest) + test_eventdev_octeontx(); return 0; error: diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 72a980447..018fbdfa5 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -117,6 +117,8 @@ #define SSO_GRP_GET_PRIORITY 0x7 #define SSO_GRP_SET_PRIORITY 0x8 +#define SSOVF_SELFTEST_ARG ("selftest") + /* * In Cavium OcteonTX SoC, all accesses to the device registers are * implictly strongly ordered. So, The relaxed version of IO operation is -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 07/11] event/sw: move eventdev software test to driver 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (4 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 08/11] event/sw: modify eventdev software test Pavan Nikhilesh ` (4 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Move software eventdev specific test (test_eventdev_sw) to driver/event/sw/. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c | 0 test/test/Makefile | 1 - 2 files changed, 1 deletion(-) rename test/test/test_eventdev_sw.c => drivers/event/sw/sw_evdev_selftest.c (100%) diff --git a/test/test/test_eventdev_sw.c b/drivers/event/sw/sw_evdev_selftest.c similarity index 100% rename from test/test/test_eventdev_sw.c rename to drivers/event/sw/sw_evdev_selftest.c diff --git a/test/test/Makefile b/test/test/Makefile index 87e3169d2..c551ad964 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -210,7 +210,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c SRCS-y += test_event_eth_rx_adapter.c -SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c endif SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 08/11] event/sw: modify eventdev software test 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (5 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh ` (3 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Modify test_eventdev_sw to be standalone selftest independent of test framework. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/sw_evdev_selftest.c | 70 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 4108b00bf..0e84b2003 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -52,7 +52,7 @@ #include <rte_service_component.h> #include <rte_bus_vdev.h> -#include "test.h" +#include "sw_evdev.h" #define MAX_PORTS 16 #define MAX_QIDS 16 @@ -3042,7 +3042,7 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release) static struct rte_mempool *eventdev_func_mempool; -static int +int test_sw_eventdev(void) { struct test *t = malloc(sizeof(struct test)); @@ -3053,25 +3053,25 @@ test_sw_eventdev(void) */ release_ev.op = RTE_EVENT_OP_RELEASE; - const char *eventdev_name = "event_sw0"; + const char *eventdev_name = "event_sw"; evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("%d: Eventdev %s not found - creating.\n", __LINE__, eventdev_name); if (rte_vdev_init(eventdev_name, NULL) < 0) { printf("Error creating eventdev\n"); - return -1; + goto test_fail; } evdev = rte_event_dev_get_dev_id(eventdev_name); if (evdev < 0) { printf("Error finding newly created eventdev\n"); - return -1; + goto test_fail; } } if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { printf("Failed to get service ID for software event dev\n"); - return -1; + goto test_fail; } rte_service_runstate_set(t->service_id, 1); @@ -3088,7 +3088,7 @@ test_sw_eventdev(void) rte_socket_id()); if (!eventdev_func_mempool) { printf("ERROR creating mempool\n"); - return -1; + goto test_fail; } } t->mbuf_pool = eventdev_func_mempool; @@ -3096,146 +3096,146 @@ test_sw_eventdev(void) ret = test_single_directed_packet(t); if (ret != 0) { printf("ERROR - Single Directed Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Directed Forward Credit test...\n"); ret = test_directed_forward_credits(t); if (ret != 0) { printf("ERROR - Directed Forward Credit test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Single Load Balanced Packet test...\n"); ret = single_packet(t); if (ret != 0) { printf("ERROR - Single Packet test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Unordered Basic test...\n"); ret = unordered_basic(t); if (ret != 0) { printf("ERROR - Unordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Basic test...\n"); ret = ordered_basic(t); if (ret != 0) { printf("ERROR - Ordered Basic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Burst Packets test...\n"); ret = burst_packets(t); if (ret != 0) { printf("ERROR - Burst Packets test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing test...\n"); ret = load_balancing(t); if (ret != 0) { printf("ERROR - Load Balancing test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Directed test...\n"); ret = test_priority_directed(t); if (ret != 0) { printf("ERROR - Prioritized Directed test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Atomic test...\n"); ret = test_priority_atomic(t); if (ret != 0) { printf("ERROR - Prioritized Atomic test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Ordered test...\n"); ret = test_priority_ordered(t); if (ret != 0) { printf("ERROR - Prioritized Ordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Prioritized Unordered test...\n"); ret = test_priority_unordered(t); if (ret != 0) { printf("ERROR - Prioritized Unordered test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Invalid QID test...\n"); ret = invalid_qid(t); if (ret != 0) { printf("ERROR - Invalid QID test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Load Balancing History test...\n"); ret = load_balancing_history(t); if (ret != 0) { printf("ERROR - Load Balancing History test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Inflight Count test...\n"); ret = inflight_counts(t); if (ret != 0) { printf("ERROR - Inflight Count test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Abuse Inflights test...\n"); ret = abuse_inflights(t); if (ret != 0) { printf("ERROR - Abuse Inflights test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats test...\n"); ret = xstats_tests(t); if (ret != 0) { printf("ERROR - XStats test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Reset test...\n"); ret = xstats_id_reset_tests(t); if (ret != 0) { printf("ERROR - XStats ID Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats Brute Force test...\n"); ret = xstats_brute_force(t); if (ret != 0) { printf("ERROR - XStats Brute Force test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running XStats ID Abuse test...\n"); ret = xstats_id_abuse_tests(t); if (ret != 0) { printf("ERROR - XStats ID Abuse test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running QID Priority test...\n"); ret = qid_priorities(t); if (ret != 0) { printf("ERROR - QID Priority test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Ordered Reconfigure test...\n"); ret = ordered_reconfigure(t); if (ret != 0) { printf("ERROR - Ordered Reconfigure test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port LB Single Reconfig test...\n"); ret = port_single_lb_reconfig(t); if (ret != 0) { printf("ERROR - Port LB Single Reconfig test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Port Reconfig Credits test...\n"); ret = port_reconfig_credits(t); if (ret != 0) { printf("ERROR - Port Reconfig Credits Reset test FAILED.\n"); - return ret; + goto test_fail; } printf("*** Running Head-of-line-blocking test...\n"); ret = holb(t); if (ret != 0) { printf("ERROR - Head-of-line-blocking test FAILED.\n"); - return ret; + goto test_fail; } if (rte_lcore_count() >= 3) { printf("*** Running Worker loopback test...\n"); @@ -3249,7 +3249,7 @@ test_sw_eventdev(void) ret = worker_loopback(t, 1); if (ret != 0) { printf("ERROR - Worker loopback test FAILED.\n"); - return ret; + goto test_fail; } } else { printf("### Not enough cores for worker loopback tests.\n"); @@ -3262,7 +3262,9 @@ test_sw_eventdev(void) */ free(t); + printf("SW Eventdev Selftest Successful.\n"); return 0; +test_fail: + printf("SW Eventdev Selftest Failed.\n"); + return -1; } - -REGISTER_TEST_COMMAND(eventdev_sw_autotest, test_sw_eventdev); -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 09/11] event/sw: update software eventdev selftest ops 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (6 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 08/11] event/sw: modify eventdev software test Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 10/11] test: register eventdev selftest Pavan Nikhilesh ` (2 subsequent siblings) 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update software eventdev ops to invoke selftest when application invokes `rte_event_dev_selftest`. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> --- drivers/event/sw/Makefile | 2 ++ drivers/event/sw/sw_evdev.c | 2 ++ drivers/event/sw/sw_evdev.h | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 2f2b67bac..149258748 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -44,6 +44,7 @@ CFLAGS += -Wno-missing-field-initializers endif endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring +LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev # library version @@ -57,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_scheduler.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_xstats.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw_evdev_selftest.c # export include files SYMLINK-y-include += diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index 1ef634093..f40597aae 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -794,6 +794,8 @@ sw_probe(struct rte_vdev_device *vdev) .xstats_get_names = sw_xstats_get_names, .xstats_get_by_name = sw_xstats_get_by_name, .xstats_reset = sw_xstats_reset, + + .dev_selftest = test_sw_eventdev, }; static const char *const args[] = { diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index d08f7d042..b1d2c371c 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -334,5 +334,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +int test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */ -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 10/11] test: register eventdev selftest 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (7 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-11 10:29 ` [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros Pavan Nikhilesh 10 siblings, 0 replies; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> --- test/test/test_eventdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index f8ee1bef6..7465251dc 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -1018,4 +1018,26 @@ test_eventdev_common(void) return unit_test_suite_runner(&eventdev_common_testsuite); } +static int +test_eventdev_selftest_impl(const char *pmd, const char *opts) +{ + rte_vdev_init(pmd, opts); + return rte_event_dev_selftest(rte_event_dev_get_dev_id(pmd)); +} + +static int +test_eventdev_selftest_sw(void) +{ + return test_eventdev_selftest_impl("event_sw", ""); +} + +static int +test_eventdev_selftest_octeontx(void) +{ + return test_eventdev_selftest_impl("event_octeontx", ""); +} + REGISTER_TEST_COMMAND(eventdev_common_autotest, test_eventdev_common); +REGISTER_TEST_COMMAND(eventdev_selftest_sw, test_eventdev_selftest_sw); +REGISTER_TEST_COMMAND(eventdev_selftest_octeontx, + test_eventdev_selftest_octeontx); -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (8 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 10/11] test: register eventdev selftest Pavan Nikhilesh @ 2018-01-11 10:21 ` Pavan Nikhilesh 2018-01-11 11:27 ` Jerin Jacob 2018-01-11 10:29 ` [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros Pavan Nikhilesh 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:21 UTC (permalink / raw) To: jerin.jacob, harry.van.haaren, gage.eads, liang.j.ma; +Cc: dev, Pavan Nikhilesh Update octeontx eventdev documentation to include new selftest feature. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- doc/guides/eventdevs/octeontx.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/guides/eventdevs/octeontx.rst b/doc/guides/eventdevs/octeontx.rst index cef004a20..bf2985be1 100644 --- a/doc/guides/eventdevs/octeontx.rst +++ b/doc/guides/eventdevs/octeontx.rst @@ -114,6 +114,19 @@ Example: ./your_eventdev_application --vdev="event_octeontx" + +Selftest +-------- + +The functionality of octeontx eventdev can be verified using this option, +various unit and functional tests are run to verify the sanity. +The tests are run once the vdev creation is successfully complete. + +.. code-block:: console + + --vdev="event_octeontx,self_test=1" + + Limitations ----------- -- 2.15.1 ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation Pavan Nikhilesh @ 2018-01-11 11:27 ` Jerin Jacob 0 siblings, 0 replies; 87+ messages in thread From: Jerin Jacob @ 2018-01-11 11:27 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: harry.van.haaren, gage.eads, liang.j.ma, dev -----Original Message----- > Date: Thu, 11 Jan 2018 15:51:56 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, > gage.eads@intel.com, liang.j.ma@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation > X-Mailer: git-send-email 2.14.1 > > Update octeontx eventdev documentation to include new selftest feature. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> Applied this series to dpdk-next-eventdev/master. Thanks. ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh ` (9 preceding siblings ...) 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation Pavan Nikhilesh @ 2018-01-11 10:29 ` Pavan Nikhilesh 2018-01-11 10:44 ` Thomas Monjalon 10 siblings, 1 reply; 87+ messages in thread From: Pavan Nikhilesh @ 2018-01-11 10:29 UTC (permalink / raw) To: thomas; +Cc: dev +Cc: thomas@monjalon.net On Thu, Jan 11, 2018 at 03:51:46PM +0530, Pavan Nikhilesh wrote: > Adding common test assertion macros for unit testing. > Replaced common macros in test/test.h with new RTE_TEST_ASSERT_* macros. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > --- > > v5 Changes: > - rebase patchset > - remove duplication between test/test/test.h and rte_test.h by mapping > RTE_TEST_ASSERT* macros to test.h > > v4 Changes: > - add SPDX licence tags. > - change octeontx selftest name to 'ssovf_evdev_selftest' > > v3 Changes: > - add eventdev driver specific selftest to test/test > > v2 Changes: > - remove duplications of test macros. > - add selftest to test/test. > - remove selftest devargs from sw eventdev. > > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/include/rte_test.h | 46 +++++++++++++++++++++ > test/test/test.h | 70 +++++--------------------------- > 3 files changed, 58 insertions(+), 60 deletions(-) > create mode 100644 lib/librte_eal/common/include/rte_test.h > > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > index 9effd0d45..eba1059f2 100644 > --- a/lib/librte_eal/common/Makefile > +++ b/lib/librte_eal/common/Makefile > @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > INC += rte_malloc.h rte_keepalive.h rte_time.h > INC += rte_service.h rte_service_component.h > -INC += rte_bitmap.h rte_vfio.h > +INC += rte_bitmap.h rte_vfio.h rte_test.h > > GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h > GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h > diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h > new file mode 100644 > index 000000000..89e47f47a > --- /dev/null > +++ b/lib/librte_eal/common/include/rte_test.h > @@ -0,0 +1,46 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2015 Cavium, Inc > + */ > + > +#ifndef _RTE_TEST_H_ > +#define _RTE_TEST_H_ > + > +#include <rte_log.h> > + > +/* Before including rte_test.h file you can define > + * RTE_TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test > + * failures. Mostly useful in development phase. > + */ > +#ifndef RTE_TEST_TRACE_FAILURE > +#define RTE_TEST_TRACE_FAILURE(_file, _line, _func) > +#endif > + > + > +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ > + if (!(cond)) { \ > + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ > + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > + RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > + return -1; \ > + } \ > +} while (0) > + > +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) \ > + RTE_TEST_ASSERT(a == b, msg, ##__VA_ARGS__) > + > +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) \ > + RTE_TEST_ASSERT(a != b, msg, ##__VA_ARGS__) > + > +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) \ > + RTE_TEST_ASSERT(val == 0, msg, ##__VA_ARGS__) > + > +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) \ > + RTE_TEST_ASSERT(val != 0, msg, ##__VA_ARGS__) > + > +#define RTE_TEST_ASSERT_NULL(val, msg, ...) \ > + RTE_TEST_ASSERT(val == NULL, msg, ##__VA_ARGS__) > + > +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) \ > + RTE_TEST_ASSERT(val != NULL, msg, ##__VA_ARGS__) > + > +#endif /* _RTE_TEST_H_ */ > diff --git a/test/test/test.h b/test/test/test.h > index 08ffe949c..0ea18586c 100644 > --- a/test/test/test.h > +++ b/test/test/test.h > @@ -38,7 +38,6 @@ > #include <sys/queue.h> > > #include <rte_common.h> > -#include <rte_log.h> > > #define TEST_SUCCESS (0) > #define TEST_FAILED (-1) > @@ -50,23 +49,13 @@ > # define TEST_TRACE_FAILURE(_file, _line, _func) > #endif > > -#define TEST_ASSERT(cond, msg, ...) do { \ > - if (!(cond)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define RTE_TEST_TRACE_FAILURE TEST_TRACE_FAILURE > > -#define TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ > - if (!(a == b)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#include <rte_test.h> > + > +#define TEST_ASSERT RTE_TEST_ASSERT > + > +#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL > > /* Compare two buffers (length in bytes) */ > #define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len, msg, ...) do { \ > @@ -134,52 +123,15 @@ > } \ > } while (0) > > -#define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ > - if (!(a != b)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define TEST_ASSERT_NOT_EQUAL RTE_TEST_ASSERT_NOT_EQUAL > > -#define TEST_ASSERT_SUCCESS(val, msg, ...) do { \ > - typeof(val) _val = (val); \ > - if (!(_val == 0)) { \ > - printf("TestCase %s() line %d failed (err %d): " \ > - msg "\n", __func__, __LINE__, _val, \ > - ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define TEST_ASSERT_SUCCESS RTE_TEST_ASSERT_SUCCESS > > -#define TEST_ASSERT_FAIL(val, msg, ...) do { \ > - if (!(val != 0)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define TEST_ASSERT_FAIL RTE_TEST_ASSERT_FAIL > > -#define TEST_ASSERT_NULL(val, msg, ...) do { \ > - if (!(val == NULL)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define TEST_ASSERT_NULL RTE_TEST_ASSERT_NULL > > -#define TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ > - if (!(val != NULL)) { \ > - printf("TestCase %s() line %d failed: " \ > - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ > - TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \ > - return TEST_FAILED; \ > - } \ > -} while (0) > +#define TEST_ASSERT_NOT_NULL RTE_TEST_ASSERT_NOT_NULL > > struct unit_test_case { > int (*setup)(void); > -- > 2.15.1 > ^ permalink raw reply [flat|nested] 87+ messages in thread
* Re: [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros 2018-01-11 10:29 ` [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros Pavan Nikhilesh @ 2018-01-11 10:44 ` Thomas Monjalon 0 siblings, 0 replies; 87+ messages in thread From: Thomas Monjalon @ 2018-01-11 10:44 UTC (permalink / raw) To: Pavan Nikhilesh; +Cc: dev 11/01/2018 11:29, Pavan Nikhilesh: > +Cc: thomas@monjalon.net > On Thu, Jan 11, 2018 at 03:51:46PM +0530, Pavan Nikhilesh wrote: > > Adding common test assertion macros for unit testing. > > Replaced common macros in test/test.h with new RTE_TEST_ASSERT_* macros. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > > --- > > > > v5 Changes: > > - rebase patchset > > - remove duplication between test/test/test.h and rte_test.h by mapping > > RTE_TEST_ASSERT* macros to test.h Very good, thanks. Acked-by: Thomas Monjalon <thomas@monjalon.net> ^ permalink raw reply [flat|nested] 87+ messages in thread
end of thread, other threads:[~2018-01-11 11:28 UTC | newest] Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-12-12 19:27 [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 2/7] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 3/7] event/octeontx: add selftest to device arguments Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 4/7] event/sw: move eventdev sw test to driver Pavan Nikhilesh 2017-12-13 10:22 ` Van Haaren, Harry 2017-12-12 19:27 ` [dpdk-dev] [PATCH 5/7] event/sw: modify eventdev sw test Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 6/7] event/sw: add selftest to device arguments Pavan Nikhilesh 2017-12-12 19:27 ` [dpdk-dev] [PATCH 7/7] doc: update eventdev documentation Pavan Nikhilesh 2017-12-13 13:48 ` Kovacevic, Marko 2017-12-13 10:19 ` [dpdk-dev] [PATCH 1/7] event/octeontx: move eventdev octeontx test to driver Van Haaren, Harry 2017-12-13 10:34 ` Bruce Richardson 2017-12-13 11:24 ` Pavan Nikhilesh Bhagavatula 2017-12-13 11:39 ` Bruce Richardson 2017-12-13 11:19 ` Pavan Nikhilesh Bhagavatula 2017-12-13 11:41 ` Bruce Richardson 2017-12-13 15:50 ` Pavan Nikhilesh Bhagavatula 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 00/11] eventdev: move eventdev pmd specific tests into the pmd dir Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 01/11] eal: add common test assert macros Pavan Nikhilesh 2017-12-14 18:43 ` Ananyev, Konstantin 2017-12-15 9:04 ` Pavan Nikhilesh Bhagavatula 2017-12-15 10:58 ` Ananyev, Konstantin 2017-12-15 11:32 ` Pavan Nikhilesh Bhagavatula 2018-01-10 19:16 ` Jerin Jacob 2018-01-10 20:18 ` Thomas Monjalon 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2017-12-19 15:45 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 08/11] event/sw: modify eventdev software test Pavan Nikhilesh 2017-12-19 15:44 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh 2017-12-19 15:46 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 10/11] test: register eventdev selftest Pavan Nikhilesh 2017-12-19 15:27 ` Van Haaren, Harry 2017-12-19 18:44 ` Pavan Nikhilesh 2017-12-20 11:07 ` Van Haaren, Harry 2017-12-14 15:01 ` [dpdk-dev] [PATCH v2 11/11] doc: update eventdev documentation Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2018-01-08 9:56 ` Jerin Jacob 2018-01-08 10:34 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2018-01-08 9:58 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2017-12-26 14:11 ` Neil Horman 2017-12-27 5:18 ` Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh 2018-01-08 10:09 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh 2018-01-08 10:14 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 08/11] event/sw: modify eventdev software test Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 10/11] test: register eventdev selftest Pavan Nikhilesh 2018-01-08 9:49 ` Jerin Jacob 2017-12-25 19:17 ` [dpdk-dev] [PATCH v3 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-08 11:17 ` [dpdk-dev] [PATCH v3 01/11] eal: add common test assert macros Jerin Jacob 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 08/11] event/sw: modify eventdev software test Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 10/11] test: register eventdev selftest Pavan Nikhilesh 2018-01-08 13:47 ` [dpdk-dev] [PATCH v4 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-10 20:20 ` [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros Thomas Monjalon 2018-01-11 7:11 ` Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 02/11] eventdev: add API to perform self test Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 03/11] event/octeontx: move eventdev octeontx test to driver Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 04/11] event/octeontx: modify octeontx eventdev test Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 05/11] event/octeontx: update octeontx eventdev selftest ops Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 06/11] event/octeontx: add selftest to device arguments Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 07/11] event/sw: move eventdev software test to driver Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 08/11] event/sw: modify eventdev software test Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 09/11] event/sw: update software eventdev selftest ops Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 10/11] test: register eventdev selftest Pavan Nikhilesh 2018-01-11 10:21 ` [dpdk-dev] [PATCH v5 11/11] doc: update eventdev documentation Pavan Nikhilesh 2018-01-11 11:27 ` Jerin Jacob 2018-01-11 10:29 ` [dpdk-dev] [PATCH v5 01/11] eal: add common test assert macros Pavan Nikhilesh 2018-01-11 10:44 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).