From patchwork Tue Jan 20 11:17:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43346 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9BDCF2034D for ; Tue, 20 Jan 2015 11:19:24 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf19567265wes.2 for ; Tue, 20 Jan 2015 03:19:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=fyrA50PSOSnNWByURHZxtu8Rnpk5P2GZpsCKn+LvkqQ=; b=UqI4kAlsXpwXEeQF5LhuchxwzDqwGKkYudpJFaVIHvGxS2ujVKJm8GGMHO6+w2divD P9o20s1pKfF2uiUw0RaIBWrQNWykAqRtGYJOojQ9viuslN5ekSHvE74vlzE0dpK3Euy/ /zsMiN5udPoS5laAkFdpqZGE5zHDHZpXEmPYPtBI4WaMUzbMvaQu4PlcQo9z2J94e5rX dHHaVqXvVG4ZHzaLARooq6ec3zc5NqweeP5M2RzVDC/fbzldJXQRr7pndgwB3miQZ1IS HPrkF7akuwQl6WUuTbLlGw3d7yOze/Mnz/395lXbQg7HON13KWuCOQW2AsqPQDb2Lb15 X2jg== X-Gm-Message-State: ALoCoQmQe6/XH6wcDdSN31KlXaA2MOgollZDhwxIfog4UaLG+IXJvZqJmb59N/DSNGiNKl7QkhRq X-Received: by 10.194.78.42 with SMTP id y10mr194455wjw.4.1421752763935; Tue, 20 Jan 2015 03:19:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.8 with SMTP id ca8ls729379lad.0.gmail; Tue, 20 Jan 2015 03:19:23 -0800 (PST) X-Received: by 10.112.8.41 with SMTP id o9mr36994041lba.40.1421752763760; Tue, 20 Jan 2015 03:19:23 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id lc12si14974467lbb.14.2015.01.20.03.19.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so7534641lab.0 for ; Tue, 20 Jan 2015 03:19:23 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr37540855lal.29.1421752763625; Tue, 20 Jan 2015 03:19:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1380740lbb; Tue, 20 Jan 2015 03:19:22 -0800 (PST) X-Received: by 10.140.30.197 with SMTP id d63mr30676187qgd.13.1421752761617; Tue, 20 Jan 2015 03:19:21 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id s52si21725980qge.45.2015.01.20.03.19.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:21 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDWq6-0006Ed-J7; Tue, 20 Jan 2015 11:19:18 +0000 Received: from mail-qa0-f46.google.com ([209.85.216.46]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDWpw-0006BZ-Bv for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 11:19:08 +0000 Received: by mail-qa0-f46.google.com with SMTP id j7so27464959qaq.5 for ; Tue, 20 Jan 2015 03:19:03 -0800 (PST) X-Received: by 10.229.65.133 with SMTP id j5mr56847674qci.27.1421752743141; Tue, 20 Jan 2015 03:19:03 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id t2sm14975907qae.6.2015.01.20.03.19.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:02 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 13:17:58 +0200 Message-Id: <1421752692-24439-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> References: <1421752692-24439-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 02/16] api: event: odp_schedule and odp_queue_enq X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Changed odp_schedule() and odp_queue_enq() to use events instead of buffers. Signed-off-by: Petri Savolainen --- example/generator/odp_generator.c | 8 ++--- example/ipsec/odp_ipsec.c | 10 +++---- example/ipsec/odp_ipsec_stream.c | 2 +- example/l2fwd/odp_l2fwd.c | 8 ++--- example/packet/odp_pktio.c | 8 ++--- example/timer/odp_timer_test.c | 16 +++++----- platform/linux-generic/include/api/odp_queue.h | 4 +-- platform/linux-generic/include/api/odp_schedule.h | 16 +++++----- platform/linux-generic/odp_crypto.c | 2 +- platform/linux-generic/odp_queue.c | 4 +-- platform/linux-generic/odp_schedule.c | 12 ++++---- platform/linux-generic/odp_timer.c | 2 +- test/performance/odp_scheduling.c | 36 ++++++++++++----------- test/validation/odp_pktio.c | 11 ++++--- test/validation/odp_queue.c | 2 +- test/validation/odp_schedule.c | 8 +++-- 16 files changed, 79 insertions(+), 70 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 4b911a6..547366a 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -372,7 +372,7 @@ static void *gen_send_thread(void *arg) return NULL; } - err = odp_queue_enq(outq_def, odp_packet_to_buffer(pkt)); + err = odp_queue_enq(outq_def, odp_packet_to_event(pkt)); if (err != 0) { EXAMPLE_ERR(" [%02i] send pkt err!\n", thr); return NULL; @@ -502,7 +502,7 @@ static void *gen_recv_thread(void *arg) odp_pktio_t pktio; thread_args_t *thr_args; odp_packet_t pkt; - odp_buffer_t buf; + odp_event_t ev; thr = odp_thread_id(); thr_args = arg; @@ -518,9 +518,9 @@ static void *gen_recv_thread(void *arg) for (;;) { /* Use schedule to get buf from any input queue */ - buf = odp_schedule(NULL, ODP_SCHED_WAIT); + ev = odp_schedule(NULL, ODP_SCHED_WAIT); - pkt = odp_packet_from_buffer(buf); + pkt = odp_packet_from_event(ev); /* Drop packets with errors */ if (odp_unlikely(odp_packet_error(pkt))) { odp_packet_free(pkt); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2fac8a..a59794a 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1037,7 +1037,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) { int thr; odp_packet_t pkt; - odp_buffer_t buf; + odp_event_t ev; unsigned long pkt_cnt = 0; thr = odp_thread_id(); @@ -1053,8 +1053,8 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) odp_queue_t dispatchq; /* Use schedule to get buf from any input queue */ - buf = SCHEDULE(&dispatchq, ODP_SCHED_WAIT); - pkt = odp_packet_from_buffer(buf); + ev = SCHEDULE(&dispatchq, ODP_SCHED_WAIT); + pkt = odp_packet_from_event(ev); /* Determine new work versus completion or sequence number */ if ((completionq != dispatchq) && (seqnumq != dispatchq)) { @@ -1113,7 +1113,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) ctx->state = PKT_STATE_TRANSMIT; } else { ctx->state = PKT_STATE_IPSEC_OUT_SEQ; - odp_queue_enq(seqnumq, buf); + odp_queue_enq(seqnumq, ev); } break; @@ -1131,7 +1131,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) case PKT_STATE_TRANSMIT: - odp_queue_enq(ctx->outq, buf); + odp_queue_enq(ctx->outq, ev); rc = PKT_DONE; break; diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 1e932df..8900483 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -497,7 +497,7 @@ int create_stream_db_inputs(void) break; } stream->created++; - odp_queue_enq(queue, pkt); + odp_queue_enq(queue, odp_packet_to_event(pkt)); /* Count this stream when we create first packet */ if (1 == stream->created) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 10d5d32..445e869 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -111,7 +111,7 @@ static void *pktio_queue_thread(void *arg) int thr; odp_queue_t outq_def; odp_packet_t pkt; - odp_buffer_t buf; + odp_event_t ev; unsigned long pkt_cnt = 0; unsigned long err_cnt = 0; @@ -124,8 +124,8 @@ static void *pktio_queue_thread(void *arg) /* Loop packets */ for (;;) { /* Use schedule to get buf from any input queue */ - buf = odp_schedule(NULL, ODP_SCHED_WAIT); - pkt = odp_packet_from_buffer(buf); + ev = odp_schedule(NULL, ODP_SCHED_WAIT); + pkt = odp_packet_from_event(ev); /* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) { @@ -136,7 +136,7 @@ static void *pktio_queue_thread(void *arg) outq_def = lookup_dest_q(pkt); /* Enqueue the packet for output */ - odp_queue_enq(outq_def, buf); + odp_queue_enq(outq_def, ev); /* Print packet counts every once in a while */ if (odp_unlikely(pkt_cnt++ % 100000 == 0)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 4a392af..e3a26db 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -146,7 +146,7 @@ static void *pktio_queue_thread(void *arg) thread_args_t *thr_args; odp_queue_t outq_def; odp_packet_t pkt; - odp_buffer_t buf; + odp_event_t ev; unsigned long pkt_cnt = 0; unsigned long err_cnt = 0; @@ -170,7 +170,7 @@ static void *pktio_queue_thread(void *arg) #if 1 /* Use schedule to get buf from any input queue */ - buf = odp_schedule(NULL, ODP_SCHED_WAIT); + ev = odp_schedule(NULL, ODP_SCHED_WAIT); #else /* Always dequeue from the same input queue */ buf = odp_queue_deq(inq_def); @@ -178,7 +178,7 @@ static void *pktio_queue_thread(void *arg) continue; #endif - pkt = odp_packet_from_buffer(buf); + pkt = odp_packet_from_event(ev); /* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) { @@ -199,7 +199,7 @@ static void *pktio_queue_thread(void *arg) swap_pkt_addrs(&pkt, 1); /* Enqueue the packet for output */ - odp_queue_enq(outq_def, buf); + odp_queue_enq(outq_def, ev); /* Print packet counts every once in a while */ if (odp_unlikely(pkt_cnt++ % 100000 == 0)) { diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 915d43d..69cde3e 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -114,7 +114,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) tick = odp_timer_current_tick(tp); while ((int)odp_atomic_load_u32(&remain) > 0) { - odp_buffer_t buf; + odp_event_t ev; odp_timer_set_t rc; tick += period; @@ -128,20 +128,20 @@ static void test_abs_timeouts(int thr, test_args_t *args) /* Get the next expired timeout */ /* Use 1.5 second timeout for scheduler */ uint64_t sched_tmo = odp_schedule_wait_time(1500000000ULL); - buf = odp_schedule(&queue, sched_tmo); + ev = odp_schedule(&queue, sched_tmo); /* Check if odp_schedule() timed out, possibly there are no * remaining timeouts to receive */ - if (buf == ODP_BUFFER_INVALID) + if (ev == ODP_EVENT_INVALID) continue; /* Re-check the remain counter */ - if (odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) { + if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { /* Not a default timeout buffer */ - EXAMPLE_ABORT("Unexpected buffer type (%u) received\n", - odp_buffer_type(buf)); + EXAMPLE_ABORT("Unexpected event type (%u) received\n", + odp_event_type(ev)); } - odp_timeout_t tmo = odp_timeout_from_buf(buf); + odp_timeout_t tmo = odp_timeout_from_event(ev); tick = odp_timeout_tick(tmo); ttp = odp_timeout_user_ptr(tmo); - ttp->buf = buf; + ttp->buf = odp_buffer_from_event(ev); if (!odp_timeout_fresh(tmo)) { /* Not the expected expiration tick, timer has * been reset or cancelled or freed */ diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index b0f7185..3caa7c1 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -174,11 +174,11 @@ void *odp_queue_get_context(odp_queue_t queue); * Queue enqueue * * @param queue Queue handle - * @param buf Buffer handle + * @param ev Event handle * * @return 0 if succesful */ -int odp_queue_enq(odp_queue_t queue, odp_buffer_t buf); +int odp_queue_enq(odp_queue_t queue, odp_event_t ev); /** * Enqueue multiple buffers to a queue diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index cdf6705..45fa48c 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -47,21 +47,21 @@ uint64_t odp_schedule_wait_time(uint64_t ns); * Schedule * * Schedules all queues created with ODP_QUEUE_TYPE_SCHED type. Returns - * next highest priority buffer which is available for the calling thread. - * Outputs the source queue of the buffer. If there's no buffer available, waits - * for a buffer according to the wait parameter setting. Returns - * ODP_BUFFER_INVALID if reaches end of the wait period. + * next highest priority event which is available for the calling thread. + * Outputs the source queue of the event. If there's no event available, waits + * for an event according to the wait parameter setting. Returns + * ODP_EVENT_INVALID if reaches end of the wait period. * - * @param from Output parameter for the source queue (where the buffer was + * @param from Output parameter for the source queue (where the event was * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to + * @param wait Minimum time to wait for an event. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait * values. * - * @return Next highest priority buffer, or ODP_BUFFER_INVALID + * @return Next highest priority event, or ODP_EVENT_INVALID */ -odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); +odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); /** * Schedule multiple buffers diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 2f95cbe..b468262 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -391,7 +391,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params, /* If specified during creation post event to completion queue */ if (ODP_QUEUE_INVALID != session->compl_queue) { - odp_queue_enq(session->compl_queue, completion_event); + odp_queue_enq(session->compl_queue, odp_buffer_to_event(completion_event)); *posted = 1; } return 0; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 70c006d..c027f23 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -403,13 +403,13 @@ int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) } -int odp_queue_enq(odp_queue_t handle, odp_buffer_t buf) +int odp_queue_enq(odp_queue_t handle, odp_event_t ev) { odp_buffer_hdr_t *buf_hdr; queue_entry_t *queue; queue = queue_to_qentry(handle); - buf_hdr = odp_buf_to_hdr(buf); + buf_hdr = odp_buf_to_hdr(odp_buffer_from_event(ev)); return queue->s.enqueue(queue, buf_hdr); } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index f7c3588..7b25e8a 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -198,7 +198,7 @@ void odp_schedule_queue(odp_queue_t queue, int prio) pri_queue = select_pri_queue(queue, prio); desc_buf = queue_sched_buf(queue); - odp_queue_enq(pri_queue, desc_buf); + odp_queue_enq(pri_queue, odp_buffer_to_event(desc_buf)); } @@ -207,7 +207,7 @@ void odp_schedule_release_atomic(void) if (sched_local.pri_queue != ODP_QUEUE_INVALID && sched_local.num == 0) { /* Release current atomic queue */ - odp_queue_enq(sched_local.pri_queue, sched_local.desc_buf); + odp_queue_enq(sched_local.pri_queue, odp_buffer_to_event(sched_local.desc_buf)); sched_local.pri_queue = ODP_QUEUE_INVALID; } } @@ -297,7 +297,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], if (odp_queue_type(queue) == ODP_QUEUE_TYPE_PKTIN && !queue_is_destroyed(queue)) - odp_queue_enq(pri_q, desc_buf); + odp_queue_enq(pri_q, odp_buffer_to_event(desc_buf)); continue; } @@ -314,7 +314,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[], sched_local.desc_buf = desc_buf; } else { /* Continue scheduling the queue */ - odp_queue_enq(pri_q, desc_buf); + odp_queue_enq(pri_q, odp_buffer_to_event(desc_buf)); } /* Output the source queue handle */ @@ -367,7 +367,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait, } -odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) +odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) { odp_buffer_t buf; @@ -375,7 +375,7 @@ odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) schedule_loop(out_queue, wait, &buf, 1, MAX_DEQ); - return buf; + return odp_buffer_to_event(buf); } diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index d926ada..322f97f 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -567,7 +567,7 @@ static unsigned timer_expire(odp_timer_pool *tp, uint32_t idx, uint64_t tick) } /* Else ignore buffers of other types */ /* Post the timeout to the destination queue */ - int rc = odp_queue_enq(tim->queue, tmo_buf); + int rc = odp_queue_enq(tim->queue, odp_buffer_to_event(tmo_buf)); if (odp_unlikely(rc != 0)) ODP_ABORT("Failed to enqueue timeout buffer (%d)\n", rc); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index bb005d7..09f5db1 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -65,14 +65,16 @@ typedef struct { */ static void clear_sched_queues(void) { + odp_event_t ev; odp_buffer_t buf; while (1) { - buf = odp_schedule(NULL, ODP_SCHED_NO_WAIT); + ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); - if (buf == ODP_BUFFER_INVALID) + if (ev == ODP_EVENT_INVALID) break; + buf = odp_buffer_from_event(ev); odp_buffer_free(buf); } } @@ -109,7 +111,7 @@ static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio) return -1; } - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, odp_buffer_to_event(buf))) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -156,7 +158,7 @@ static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio) return -1; } - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, odp_buffer_to_event(buf))) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -286,7 +288,7 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool) t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, odp_buffer_to_event(buf))) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -328,7 +330,7 @@ static int test_schedule_single(const char *str, int thr, odp_buffer_pool_t msg_pool, int prio, odp_barrier_t *barrier) { - odp_buffer_t buf; + odp_event_t ev; odp_queue_t queue; uint64_t t1, t2, cycles, ns; uint32_t i; @@ -340,9 +342,9 @@ static int test_schedule_single(const char *str, int thr, t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - buf = odp_schedule(&queue, ODP_SCHED_WAIT); + ev = odp_schedule(&queue, ODP_SCHED_WAIT); - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, ev)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -354,14 +356,14 @@ static int test_schedule_single(const char *str, int thr, tot = i; while (1) { - buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT); + ev = odp_schedule(&queue, ODP_SCHED_NO_WAIT); - if (buf == ODP_BUFFER_INVALID) + if (ev == ODP_EVENT_INVALID) break; tot++; - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, ev)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -404,7 +406,7 @@ static int test_schedule_many(const char *str, int thr, odp_buffer_pool_t msg_pool, int prio, odp_barrier_t *barrier) { - odp_buffer_t buf; + odp_event_t ev; odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; @@ -419,9 +421,9 @@ static int test_schedule_many(const char *str, int thr, t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - buf = odp_schedule(&queue, ODP_SCHED_WAIT); + ev = odp_schedule(&queue, ODP_SCHED_WAIT); - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, ev)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -433,14 +435,14 @@ static int test_schedule_many(const char *str, int thr, tot = i; while (1) { - buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT); + ev = odp_schedule(&queue, ODP_SCHED_NO_WAIT); - if (buf == ODP_BUFFER_INVALID) + if (ev == ODP_EVENT_INVALID) break; tot++; - if (odp_queue_enq(queue, buf)) { + if (odp_queue_enq(queue, ev)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index d1eb0d5..b404a14 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -266,16 +266,19 @@ static odp_packet_t wait_for_packet(odp_queue_t queue, uint32_t seq, uint64_t ns) { uint64_t start, now, diff; + odp_event_t ev; odp_buffer_t buf; odp_packet_t pkt = ODP_PACKET_INVALID; start = odp_time_cycles(); do { - if (queue != ODP_QUEUE_INVALID) + if (queue != ODP_QUEUE_INVALID) { buf = queue_deq_wait_time(queue, ns); - else - buf = odp_schedule(NULL, ns); + } else { + ev = odp_schedule(NULL, ns); + buf = odp_buffer_from_event(ev); + } if (buf != ODP_BUFFER_INVALID && odp_buffer_type(buf) == ODP_BUFFER_TYPE_PACKET) { @@ -326,7 +329,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, /* send packet(s) out */ if (num_pkts == 1) - ret = odp_queue_enq(pktio_a->outq, tx_buf[0]); + ret = odp_queue_enq(pktio_a->outq, odp_buffer_to_event(tx_buf[0])); else ret = odp_queue_enq_multi(pktio_a->outq, tx_buf, num_pkts); diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c index 0613fd0..a083c26 100644 --- a/test/validation/odp_queue.c +++ b/test/validation/odp_queue.c @@ -68,7 +68,7 @@ static void test_odp_queue_sunnyday(void) msg_pool = odp_buffer_pool_lookup("msg_pool"); buf = odp_buffer_alloc(msg_pool); - odp_queue_enq(queue_id, buf); + odp_queue_enq(queue_id, odp_buffer_to_event(buf)); CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id)); odp_buffer_free(buf); diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 5df3c86..8f33f69 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -102,6 +102,7 @@ static void *schedule_common_(void *arg) odp_barrier_wait(&globals->barrier); while (1) { + odp_event_t ev; odp_buffer_t buf; odp_queue_t from; int num = 0; @@ -127,7 +128,8 @@ static void *schedule_common_(void *arg) for (j = 0; j < num; j++) odp_buffer_free(bufs[j]); } else { - buf = odp_schedule(&from, ODP_SCHED_NO_WAIT); + ev = odp_schedule(&from, ODP_SCHED_NO_WAIT); + buf = odp_buffer_from_event(ev); if (buf == ODP_BUFFER_INVALID) continue; num = 1; @@ -203,9 +205,11 @@ static void fill_queues(thread_args_t *args) for (k = 0; k < args->num_bufs; k++) { odp_buffer_t buf; + odp_event_t ev; buf = odp_buffer_alloc(pool); CU_ASSERT(buf != ODP_BUFFER_INVALID); - CU_ASSERT(odp_queue_enq(queue, buf) == 0); + ev = odp_buffer_to_event(buf); + CU_ASSERT(odp_queue_enq(queue, ev) == 0); } } }