diff mbox

[PATCHv7,11/35] performance: odp_pktio_perf: using agnostic function for ODP threads

Message ID 1463490282-23277-12-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard May 17, 2016, 1:04 p.m. UTC
odp_pktio_perf is changed to use the implementation agnostic ODP thread
create and join functions, from helpers.
odp_pktio_perf is no longer aware on how the odpthread is implemented any
longer.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/performance/odp_pktio_perf.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 57635d3..e1efc4a 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -303,7 +303,7 @@  static int send_packets(odp_pktout_queue_t pktout,
  * Main packet transmit routine. Transmit packets at a fixed rate for
  * specified length of time.
  */
-static void *run_thread_tx(void *arg)
+static int run_thread_tx(void *arg)
 {
 	test_globals_t *globals;
 	int thr_id;
@@ -381,7 +381,7 @@  static void *run_thread_tx(void *arg)
 	       odp_time_to_ns(stats->s.idle_ticks) /
 	       (uint64_t)ODP_TIME_MSEC_IN_NS);
 
-	return NULL;
+	return 0;
 }
 
 static int receive_packets(odp_queue_t queue,
@@ -411,7 +411,7 @@  static int receive_packets(odp_queue_t queue,
 	return n_ev;
 }
 
-static void *run_thread_rx(void *arg)
+static int run_thread_rx(void *arg)
 {
 	test_globals_t *globals;
 	int thr_id, batch_len;
@@ -456,7 +456,7 @@  static void *run_thread_rx(void *arg)
 			break;
 	}
 
-	return NULL;
+	return 0;
 }
 
 /*
@@ -601,11 +601,11 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 			   odp_cpumask_t *thd_mask_rx,
 			   test_status_t *status)
 {
-	odph_linux_pthread_t thd_tbl[MAX_WORKERS];
+	odph_odpthread_t thd_tbl[MAX_WORKERS];
 	thread_args_t args_tx, args_rx;
 	uint64_t expected_tx_cnt;
 	int num_tx_workers, num_rx_workers;
-	odph_linux_thr_params_t thr_params;
+	odph_odpthread_params_t thr_params;
 
 	memset(&thr_params, 0, sizeof(thr_params));
 	thr_params.thr_type = ODP_THREAD_WORKER;
@@ -623,7 +623,7 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 	thr_params.start  = run_thread_rx;
 	thr_params.arg    = &args_rx;
 	args_rx.batch_len = gbl_args->args.rx_batch_len;
-	odph_linux_pthread_create(&thd_tbl[0], thd_mask_rx, &thr_params);
+	odph_odpthreads_create(&thd_tbl[0], thd_mask_rx, &thr_params);
 	odp_barrier_wait(&gbl_args->rx_barrier);
 	num_rx_workers = odp_cpumask_count(thd_mask_rx);
 
@@ -634,13 +634,12 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 	args_tx.pps       = status->pps_curr / num_tx_workers;
 	args_tx.duration  = gbl_args->args.duration;
 	args_tx.batch_len = gbl_args->args.tx_batch_len;
-	odph_linux_pthread_create(&thd_tbl[num_rx_workers], thd_mask_tx,
-				  &thr_params);
+	odph_odpthreads_create(&thd_tbl[num_rx_workers], thd_mask_tx,
+			       &thr_params);
 	odp_barrier_wait(&gbl_args->tx_barrier);
 
 	/* wait for transmitter threads to terminate */
-	odph_linux_pthread_join(&thd_tbl[num_rx_workers],
-				num_tx_workers);
+	odph_odpthreads_join(&thd_tbl[num_rx_workers]);
 
 	/* delay to allow transmitted packets to reach the receivers */
 	odp_time_wait_ns(SHUTDOWN_DELAY_NS);
@@ -649,7 +648,7 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 	odp_atomic_store_u32(&shutdown, 1);
 
 	/* wait for receivers */
-	odph_linux_pthread_join(&thd_tbl[0], num_rx_workers);
+	odph_odpthreads_join(&thd_tbl[0]);
 
 	if (!status->warmup)
 		return process_results(expected_tx_cnt, status);