On 06/02/15 12:46, Nicolas Morey-Chaisemartin wrote:
On 06/02/2015 11:19 AM, Stuart Haslam wrote:
On Mon, Jun 01, 2015 at 06:44:10PM +0200, Nicolas Morey-Chaisemartin wrote:
Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
---
test/performance/odp_pktio_perf.c | 72 +++++++++++++++++++++++++++++----------
1 file changed, 54 insertions(+), 18 deletions(-)
diff --git a/test/performance/odp_pktio_perf.c
b/test/performance/odp_pktio_perf.c
index fbe27a0..bb557b0 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -75,6 +75,8 @@ typedef struct {
batch */
int schedule; /* 1: receive packets via scheduler
0: receive packets via direct deq */
+ uint32_t rx_batch_len; /* Number of packets to receive in a single
+ batch */
uint64_t pps; /* Attempted packet rate */
int verbose; /* Print verbose information, such as per
thread statistics */
@@ -358,12 +360,41 @@ static void *run_thread_tx(void *arg)
return NULL;
}
-static void *run_thread_rx(void *arg TEST_UNUSED)
+static int receive_packets(odp_queue_t pollq,
+ odp_event_t *event_tbl, unsigned num_pkts)
+{
+ int n_ev = 0;
+
+ if (num_pkts == 0)
+ return 0;
+
+ if (pollq != ODP_QUEUE_INVALID) {
+ if (num_pkts == 1) {
+ event_tbl[0] = odp_queue_deq(pollq);
+ n_ev = event_tbl[0] != ODP_EVENT_INVALID;
+ } else {
+ n_ev = odp_queue_deq_multi(pollq, event_tbl, num_pkts);
+ }
+ } else {
+ event_tbl[0] = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
+ n_ev = event_tbl[0] != ODP_EVENT_INVALID;
Why not call odp_schedule_multi() for num_pkts > 1?
Otherwise the patch looks good.
Because I'm still new to ODP and hadn't seen this one yet :)
I'll post a new patch with support for odp_schedule_multi, as soon as I get
your opinion on the default value that rx_batch_len should have.
Nicolas
Btw, is odp_queue_deq faster than odp_queue_deq_multi for 1 packet? If
not why do we need odp_queue_deq then?
Maxim.
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp