On Wed, Jan 15, 2020 at 11:25:09PM -0600, Honnappa Nagarahalli wrote: > Adjust the performance test cases to test rte_ring_xxx_elem APIs. > > Signed-off-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> > Reviewed-by: Gavin Hu <gavin...@arm.com> > --- > app/test/test_ring_perf.c | 454 +++++++++++++++++++++++--------------- > 1 file changed, 273 insertions(+), 181 deletions(-) > > diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c > index 6c2aca483..8d1217951 100644 > --- a/app/test/test_ring_perf.c > +++ b/app/test/test_ring_perf.c
[...] > -static int > -test_ring_perf(void) > +/* Run all tests for a given element size */ > +static __rte_always_inline int > +test_ring_perf_esize(const int esize) > { > struct lcore_pair cores; > struct rte_ring *r = NULL; > > - r = rte_ring_create(RING_NAME, RING_SIZE, rte_socket_id(), 0); > + /* > + * Performance test for legacy/_elem APIs > + * SP-SC/MP-MC, single > + */ > + r = test_ring_create(RING_NAME, esize, RING_SIZE, rte_socket_id(), 0); > if (r == NULL) > return -1; > > - printf("### Testing single element and burst enq/deq ###\n"); > - test_single_enqueue_dequeue(r); > - test_burst_enqueue_dequeue(r); > + printf("\n### Testing single element enq/deq ###\n"); > + if (test_single_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_SPSC | TEST_RING_ELEM_SINGLE) < 0) > + return -1; the ring is not freed on error (same below) > + if (test_single_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_MPMC | TEST_RING_ELEM_SINGLE) < 0) > + return -1; > + > + printf("\n### Testing burst enq/deq ###\n"); > + if (test_burst_bulk_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BURST) < 0) > + return -1; > + if (test_burst_bulk_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_MPMC | TEST_RING_ELEM_BURST) < 0) > + return -1; > > - printf("\n### Testing empty dequeue ###\n"); > - test_empty_dequeue(r); > + printf("\n### Testing bulk enq/deq ###\n"); > + if (test_burst_bulk_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK) < 0) > + return -1; > + if (test_burst_bulk_enqueue_dequeue(r, esize, > + TEST_RING_THREAD_MPMC | TEST_RING_ELEM_BULK) < 0) > + return -1; > > - printf("\n### Testing using a single lcore ###\n"); > - test_bulk_enqueue_dequeue(r); > + printf("\n### Testing empty bulk deq ###\n"); > + test_empty_dequeue(r, esize, > + TEST_RING_THREAD_SPSC | TEST_RING_ELEM_BULK); > + test_empty_dequeue(r, esize, > + TEST_RING_THREAD_MPMC | TEST_RING_ELEM_BULK); > > if (get_two_hyperthreads(&cores) == 0) { > printf("\n### Testing using two hyperthreads ###\n"); > - run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); > + if (run_on_core_pair(&cores, r, esize) < 0) > + return -1; > } > if (get_two_cores(&cores) == 0) { > printf("\n### Testing using two physical cores ###\n"); > - run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); > + if (run_on_core_pair(&cores, r, esize) < 0) > + return -1; > } > if (get_two_sockets(&cores) == 0) { > printf("\n### Testing using two NUMA nodes ###\n"); > - run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk); > + if (run_on_core_pair(&cores, r, esize) < 0) > + return -1; > } > > printf("\n### Testing using all slave nodes ###\n"); > - run_on_all_cores(r); > + if (run_on_all_cores(r, esize) < 0) > + return -1; > > rte_ring_free(r); > + > + return 0; > +}