From patchwork Wed Jan 21 15:15:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43453 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1E0A218DB for ; Wed, 21 Jan 2015 15:18:00 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gf13sf11200502lab.0 for ; Wed, 21 Jan 2015 07:17:59 -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=3+JD5hgzD/nGnDK7G3hNKQzuWodaMEcvYZh+Gen/bYc=; b=dKCbiVMjDMnHhNrvRcLr3ZH6Arn/5S44X0ogPhQDKeXll/QU1etdypHjLSrFHQbx21 EvnJFCKMvZ4T+FQypoRK5z8qt2za8CZ9XaV7C0q5BtxEEwOTjht5WtR2wEgh4ev3Ilka Th95VfkHOUlxhgBzhsxpgwZSgn587YM2Qwzps1099h/MPVAIsR0W6u5Eu+EdZ/eBR2NN +Nk9dOyScQP94ZkdYKAGbZCiL5YD0jVn9MiTI1HXZIKQKM78jYTkL0VQA+PfF/KJCH4p Yu7MgzVmpG4dE7PKConuu7K7aPWAeP6wt5UaYit7J5Yq1E4a3ed2nF49isZasr2l6zH9 8Jww== X-Gm-Message-State: ALoCoQlJ5YPeYkJa6QC2OvoSMM0u5F1jJCsHAziePxufzwwtJTn/BBl6Hmxp7jq3C6iV+557Onur X-Received: by 10.112.137.136 with SMTP id qi8mr395136lbb.13.1421853479792; Wed, 21 Jan 2015 07:17:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.70 with SMTP id lm6ls51302lac.41.gmail; Wed, 21 Jan 2015 07:17:59 -0800 (PST) X-Received: by 10.112.154.70 with SMTP id vm6mr44942986lbb.18.1421853479616; Wed, 21 Jan 2015 07:17:59 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id gh10si18214556lbc.38.2015.01.21.07.17.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:59 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so16275862lab.12 for ; Wed, 21 Jan 2015 07:17:59 -0800 (PST) X-Received: by 10.152.197.5 with SMTP id iq5mr44618257lac.6.1421853479459; Wed, 21 Jan 2015 07:17:59 -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 c8csp1810342lbb; Wed, 21 Jan 2015 07:17:58 -0800 (PST) X-Received: by 10.236.40.14 with SMTP id e14mr24970784yhb.81.1421853474859; Wed, 21 Jan 2015 07:17:54 -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 f9si4777003qag.126.2015.01.21.07.17.52 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:54 -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 1YDx2U-00083q-9G; Wed, 21 Jan 2015 15:17:50 +0000 Received: from mail-qc0-f181.google.com ([209.85.216.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDx24-0007wb-Cc for lng-odp@lists.linaro.org; Wed, 21 Jan 2015 15:17:24 +0000 Received: by mail-qc0-f181.google.com with SMTP id l6so27791877qcy.12 for ; Wed, 21 Jan 2015 07:17:19 -0800 (PST) X-Received: by 10.224.49.136 with SMTP id v8mr55291369qaf.51.1421853439142; Wed, 21 Jan 2015 07:17:19 -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 91sm415056qgf.1.2015.01.21.07.17.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 07:17:18 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 21 Jan 2015 17:15:36 +0200 Message-Id: <1421853343-22138-10-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> References: <1421853343-22138-1-git-send-email-petri.savolainen@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCH v3 09/16] api: timer: Use odp_event_t instead of odp_buffer_t 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.53 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 timer API to use odp_event_t instead of odp_buffer_t. Signed-off-by: Petri Savolainen --- example/timer/odp_timer_test.c | 28 ++++++------ platform/linux-generic/include/api/odp_timer.h | 63 ++++++++++---------------- platform/linux-generic/odp_timer.c | 28 ++++-------- test/validation/odp_timer.c | 55 +++++++++++----------- 4 files changed, 77 insertions(+), 97 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 49e1451..d3b74bd 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -62,8 +62,8 @@ static const char *timerset2str(odp_timer_set_t val) return "too early"; case ODP_TIMER_TOOLATE: return "too late"; - case ODP_TIMER_NOBUF: - return "no buffer"; + case ODP_TIMER_NOEVENT: + return "no event"; default: return "?"; } @@ -72,7 +72,7 @@ static const char *timerset2str(odp_timer_set_t val) /** @private Helper struct for timers */ struct test_timer { odp_timer_t tim; - odp_buffer_t buf; + odp_event_t ev; }; /** @private Array of all timer helper structs */ @@ -86,6 +86,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) odp_queue_t queue; uint64_t tick; struct test_timer *ttp; + odp_buffer_t buf; EXAMPLE_DBG(" [%i] test_timeouts\n", thr); @@ -106,11 +107,12 @@ static void test_abs_timeouts(int thr, test_args_t *args) EXAMPLE_ERR("Failed to allocate timer\n"); return; } - ttp->buf = odp_buffer_alloc(pool); - if (ttp->buf == ODP_BUFFER_INVALID) { + buf = odp_buffer_alloc(pool); + if (buf == ODP_BUFFER_INVALID) { EXAMPLE_ERR("Failed to allocate buffer\n"); return; } + ttp->ev = odp_buffer_to_event(buf); tick = odp_timer_current_tick(tp); while ((int)odp_atomic_load_u32(&remain) > 0) { @@ -118,7 +120,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) odp_timer_set_t rc; tick += period; - rc = odp_timer_set_abs(ttp->tim, tick, &ttp->buf); + rc = odp_timer_set_abs(ttp->tim, tick, &ttp->ev); if (odp_unlikely(rc != ODP_TIMER_SUCCESS)) { /* Too early or too late timeout requested */ EXAMPLE_ABORT("odp_timer_set_abs() failed: %s\n", @@ -143,14 +145,14 @@ static void test_abs_timeouts(int thr, test_args_t *args) if (ev == ODP_EVENT_INVALID) break; /* No more timeouts */ if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { - /* Not a default timeout buffer */ + /* Not a default timeout event */ EXAMPLE_ABORT("Unexpected event type (%u) received\n", odp_event_type(ev)); } odp_timeout_t tmo = odp_timeout_from_event(ev); tick = odp_timeout_tick(tmo); ttp = odp_timeout_user_ptr(tmo); - ttp->buf = odp_buffer_from_event(ev); + ttp->ev = ev; if (!odp_timeout_fresh(tmo)) { /* Not the expected expiration tick, timer has * been reset or cancelled or freed */ @@ -163,12 +165,12 @@ static void test_abs_timeouts(int thr, test_args_t *args) } /* Cancel and free last timer used */ - (void)odp_timer_cancel(ttp->tim, &ttp->buf); - if (ttp->buf != ODP_BUFFER_INVALID) - odp_buffer_free(ttp->buf); + (void)odp_timer_cancel(ttp->tim, &ttp->ev); + if (ttp->ev != ODP_EVENT_INVALID) + odp_buffer_free(odp_buffer_from_event(ttp->ev)); else - EXAMPLE_ERR("Lost timeout buffer at timer cancel\n"); - /* Since we have cancelled the timer, there is no timeout buffer to + EXAMPLE_ERR("Lost timeout event at timer cancel\n"); + /* Since we have cancelled the timer, there is no timeout event to * return from odp_timer_free() */ (void)odp_timer_free(ttp->tim); } diff --git a/platform/linux-generic/include/api/odp_timer.h b/platform/linux-generic/include/api/odp_timer.h index cb17b7b..075263a 100644 --- a/platform/linux-generic/include/api/odp_timer.h +++ b/platform/linux-generic/include/api/odp_timer.h @@ -20,7 +20,6 @@ extern "C" { #include #include -#include #include #include @@ -86,10 +85,10 @@ typedef enum { * timer pool. */ ODP_TIMER_TOOLATE = -2, /** - * Timer set operation failed because no timeout buffer specified and no - * timeout buffer present in the timer (timer inactive/expired). + * Timer set operation failed because no timeout event specified and no + * timeout event present in the timer (timer inactive/expired). */ - ODP_TIMER_NOBUF = -3 + ODP_TIMER_NOEVENT = -3 } odp_timer_set_t; /** Maximum timer pool name length in chars (including null char) */ @@ -214,29 +213,29 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, * Free a timer * * Free (destroy) a timer, reclaiming associated resources. - * The timeout buffer for an active timer will be returned. - * The timeout buffer for an expired timer will not be returned. It is the + * The timeout event for an active timer will be returned. + * The timeout event for an expired timer will not be returned. It is the * responsibility of the application to handle this timeout when it is received. * * @param tim Timer handle - * @return Buffer handle of timeout buffer or ODP_BUFFER_INVALID + * @return Event handle of timeout event or ODP_EVENT_INVALID */ -odp_buffer_t odp_timer_free(odp_timer_t tim); +odp_event_t odp_timer_free(odp_timer_t tim); /** - * Set a timer (absolute time) with a user-provided timeout buffer + * Set a timer (absolute time) with a user-provided timeout event * * Set (arm) the timer to expire at specific time. The timeout - * buffer will be enqueued when the timer expires. + * event will be enqueued when the timer expires. * * Note: any invalid parameters will be treated as programming errors and will * cause the application to abort. * * @param tim Timer * @param abs_tck Expiration time in absolute timer ticks - * @param[in,out] tmo_buf Reference to a buffer variable that points to - * timeout buffer or NULL to reuse the existing timeout buffer. Any existing - * timeout buffer that is replaced by a successful set operation will be + * @param[in,out] tmo_ev Reference to an event variable that points to + * timeout event or NULL to reuse the existing timeout event. Any existing + * timeout event that is replaced by a successful set operation will be * returned here. * * @retval ODP_TIMER_SUCCESS Operation succeeded @@ -244,15 +243,15 @@ odp_buffer_t odp_timer_free(odp_timer_t tim); * early * @retval ODP_TIMER_TOOLATE Operation failed because expiration tick too * late - * @retval ODP_TIMER_NOBUF Operation failed because timeout buffer not + * @retval ODP_TIMER_NOEVENT Operation failed because timeout event not * specified in odp_timer_set call and not present in timer */ int odp_timer_set_abs(odp_timer_t tim, uint64_t abs_tck, - odp_buffer_t *tmo_buf); + odp_event_t *tmo_ev); /** - * Set a timer with a relative expiration time and user-provided buffer. + * Set a timer with a relative expiration time and user-provided event. * * Set (arm) the timer to expire at a relative future time. * @@ -262,9 +261,9 @@ int odp_timer_set_abs(odp_timer_t tim, * @param tim Timer * @param rel_tck Expiration time in timer ticks relative to current time of * the timer pool the timer belongs to - * @param[in,out] tmo_buf Reference to a buffer variable that points to - * timeout buffer or NULL to reuse the existing timeout buffer. Any existing - * timeout buffer that is replaced by a successful set operation will be + * @param[in,out] tmo_ev Reference to an event variable that points to + * timeout event or NULL to reuse the existing timeout event. Any existing + * timeout event that is replaced by a successful set operation will be * returned here. * * @retval ODP_TIMER_SUCCESS Operation succeeded @@ -272,18 +271,18 @@ int odp_timer_set_abs(odp_timer_t tim, * early * @retval ODP_TIMER_TOOLATE Operation failed because expiration tick too * late - * @retval ODP_TIMER_NOBUF Operation failed because timeout buffer not + * @retval ODP_TIMER_NOEVENT Operation failed because timeout event not * specified in call and not present in timer */ int odp_timer_set_rel(odp_timer_t tim, uint64_t rel_tck, - odp_buffer_t *tmo_buf); + odp_event_t *tmo_ev); /** * Cancel a timer * * Cancel a timer, preventing future expiration and delivery. Return any - * present timeout buffer. + * present timeout event. * * A timer that has already expired may be impossible to cancel and the timeout * will instead be delivered to the destination queue. @@ -292,23 +291,11 @@ int odp_timer_set_rel(odp_timer_t tim, * cause the application to abort. * * @param tim Timer - * @param[out] tmo_buf Pointer to a buffer variable - * @retval 0 Success, active timer cancelled, timeout returned in '*tmo_buf' + * @param[out] tmo_ev Pointer to an event variable + * @retval 0 Success, active timer cancelled, timeout returned in '*tmo_ev' * @retval -1 Failure, timer already expired (or inactive) */ -int odp_timer_cancel(odp_timer_t tim, odp_buffer_t *tmo_buf); - -/** - * Return timeout handle that is associated with timeout buffer - * - * Note: any invalid parameters will cause undefined behavior and may cause - * the application to abort or crash. - * - * @param buf A buffer of type ODP_BUFFER_TYPE_TIMEOUT - * - * @return timeout handle - */ -odp_timeout_t odp_timeout_from_buf(odp_buffer_t buf); +int odp_timer_cancel(odp_timer_t tim, odp_event_t *tmo_ev); /** * Return timeout handle that is associated with timeout event @@ -316,7 +303,7 @@ odp_timeout_t odp_timeout_from_buf(odp_buffer_t buf); * Note: any invalid parameters will cause undefined behavior and may cause * the application to abort or crash. * - * @param buf An event of type ODP_EVENT_TIMEOUT + * @param ev An event of type ODP_EVENT_TIMEOUT * * @return timeout handle */ diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 9233226..120954c 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -740,17 +740,17 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, return ODP_TIMER_INVALID; } -odp_buffer_t odp_timer_free(odp_timer_t hdl) +odp_event_t odp_timer_free(odp_timer_t hdl) { odp_timer_pool *tp = handle_to_tp(hdl); uint32_t idx = handle_to_idx(hdl, tp); odp_buffer_t old_buf = timer_free(tp, idx); - return old_buf; + return odp_buffer_to_event(old_buf); } int odp_timer_set_abs(odp_timer_t hdl, uint64_t abs_tck, - odp_buffer_t *tmo_buf) + odp_event_t *tmo_ev) { odp_timer_pool *tp = handle_to_tp(hdl); uint32_t idx = handle_to_idx(hdl, tp); @@ -759,15 +759,15 @@ int odp_timer_set_abs(odp_timer_t hdl, return ODP_TIMER_TOOEARLY; if (odp_unlikely(abs_tck > cur_tick + tp->max_rel_tck)) return ODP_TIMER_TOOLATE; - if (timer_reset(idx, abs_tck, tmo_buf, tp)) + if (timer_reset(idx, abs_tck, (odp_buffer_t *)tmo_ev, tp)) return ODP_TIMER_SUCCESS; else - return ODP_TIMER_NOBUF; + return ODP_TIMER_NOEVENT; } int odp_timer_set_rel(odp_timer_t hdl, uint64_t rel_tck, - odp_buffer_t *tmo_buf) + odp_event_t *tmo_ev) { odp_timer_pool *tp = handle_to_tp(hdl); uint32_t idx = handle_to_idx(hdl, tp); @@ -776,34 +776,26 @@ int odp_timer_set_rel(odp_timer_t hdl, return ODP_TIMER_TOOEARLY; if (odp_unlikely(rel_tck > tp->max_rel_tck)) return ODP_TIMER_TOOLATE; - if (timer_reset(idx, abs_tck, tmo_buf, tp)) + if (timer_reset(idx, abs_tck, (odp_buffer_t *)tmo_ev, tp)) return ODP_TIMER_SUCCESS; else - return ODP_TIMER_NOBUF; + return ODP_TIMER_NOEVENT; } -int odp_timer_cancel(odp_timer_t hdl, odp_buffer_t *tmo_buf) +int odp_timer_cancel(odp_timer_t hdl, odp_event_t *tmo_ev) { odp_timer_pool *tp = handle_to_tp(hdl); uint32_t idx = handle_to_idx(hdl, tp); /* Set the expiration tick of the timer to TMO_INACTIVE */ odp_buffer_t old_buf = timer_cancel(tp, idx, TMO_INACTIVE); if (old_buf != ODP_BUFFER_INVALID) { - *tmo_buf = old_buf; + *tmo_ev = odp_buffer_to_event(old_buf); return 0; /* Active timer cancelled, timeout returned */ } else { return -1; /* Timer already expired, no timeout returned */ } } -odp_timeout_t odp_timeout_from_buf(odp_buffer_t buf) -{ - /* This check not mandated by the API specification */ - if (_odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) - ODP_ABORT("Buffer not a timeout"); - return (odp_timeout_t)timeout_hdr_from_buf(buf); -} - odp_timeout_t odp_timeout_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index adc1554..4e4cc5b 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -37,25 +37,25 @@ static int min(int a, int b) /* @private Timer helper structure */ struct test_timer { odp_timer_t tim; /* Timer handle */ - odp_buffer_t buf; /* Timeout buffer */ - odp_buffer_t buf2; /* Copy of buffer handle */ + odp_event_t ev; /* Timeout event */ + odp_event_t ev2; /* Copy of event handle */ uint64_t tick; /* Expiration tick or TICK_INVALID */ }; #define TICK_INVALID (~(uint64_t)0) -/* @private Handle a received (timeout) buffer */ -static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick) +/* @private Handle a received (timeout) event */ +static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) { /* Use assert() for internal correctness checks of test program */ - assert(buf != ODP_BUFFER_INVALID); - if (odp_event_type(odp_buffer_to_event(buf)) != ODP_EVENT_TIMEOUT) { - /* Not a timeout buffer */ - CU_FAIL("Unexpected buffer type received"); + assert(ev != ODP_EVENT_INVALID); + if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { + /* Not a timeout event */ + CU_FAIL("Unexpected event type received"); return; } /* Read the metadata from the timeout */ - odp_timeout_t tmo = odp_timeout_from_buf(buf); + odp_timeout_t tmo = odp_timeout_from_event(ev); odp_timer_t tim = odp_timeout_timer(tmo); uint64_t tick = odp_timeout_tick(tmo); struct test_timer *ttp = odp_timeout_user_ptr(tmo); @@ -65,7 +65,7 @@ static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick) if (ttp == NULL) CU_FAIL("odp_timeout_user_ptr() null user ptr"); - if (ttp->buf2 != buf) + if (ttp->ev2 != ev) CU_FAIL("odp_timeout_user_ptr() wrong user ptr"); if (ttp->tim != tim) CU_FAIL("odp_timeout_timer() wrong timer"); @@ -95,8 +95,8 @@ static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick) } /* Use assert() for correctness check of test program itself */ - assert(ttp->buf == ODP_BUFFER_INVALID); - ttp->buf = buf; + assert(ttp->ev == ODP_EVENT_INVALID); + ttp->ev = ev; } /* @private Worker thread entrypoint which performs timer alloc/set/cancel/free @@ -123,10 +123,12 @@ static void *worker_entrypoint(void *arg) tt[i].tim = odp_timer_alloc(tp, queue, &tt[i]); if (tt[i].tim == ODP_TIMER_INVALID) CU_FAIL_FATAL("Failed to allocate timer"); - tt[i].buf = odp_buffer_alloc(tbp); - if (tt[i].buf == ODP_BUFFER_INVALID) + /* Timeout alloc is needed. + * With this alloc call pool/event type should be buffer. */ + tt[i].ev = odp_buffer_to_event(odp_buffer_alloc(tbp)); + if (tt[i].ev == ODP_EVENT_INVALID) CU_FAIL_FATAL("Failed to allocate timeout buffer"); - tt[i].buf2 = tt[i].buf; + tt[i].ev2 = tt[i].ev; tt[i].tick = TICK_INVALID; } @@ -140,7 +142,7 @@ static void *worker_entrypoint(void *arg) (rand_r(&seed) % RANGE_MS) * 1000000ULL); odp_timer_set_t rc; - rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].buf); + rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); if (rc != ODP_TIMER_SUCCESS) { CU_FAIL("Failed to set timer"); } else { @@ -159,26 +161,24 @@ static void *worker_entrypoint(void *arg) for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) { odp_event_t ev; while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) { - odp_buffer_t buf; - buf = odp_buffer_from_event(ev); /* Subtract one from prev_tick to allow for timeouts * to be delivered a tick late */ - handle_tmo(buf, false, prev_tick - 1); + handle_tmo(ev, false, prev_tick - 1); nrcv++; } prev_tick = odp_timer_current_tick(tp); i = rand_r(&seed) % NTIMERS; - if (tt[i].buf == ODP_BUFFER_INVALID && + if (tt[i].ev == ODP_EVENT_INVALID && (rand_r(&seed) % 2 == 0)) { /* Timer active, cancel it */ - int rc = odp_timer_cancel(tt[i].tim, &tt[i].buf); + int rc = odp_timer_cancel(tt[i].tim, &tt[i].ev); if (rc != 0) /* Cancel failed, timer already expired */ ntoolate++; tt[i].tick = TICK_INVALID; ncancel++; } else { - if (tt[i].buf != ODP_BUFFER_INVALID) + if (tt[i].ev != ODP_EVENT_INVALID) /* Timer inactive => set */ nset++; else @@ -193,7 +193,7 @@ static void *worker_entrypoint(void *arg) do { cur_tick = odp_timer_current_tick(tp); rc = odp_timer_set_rel(tt[i].tim, - tck, &tt[i].buf); + tck, &tt[i].ev); } while (cur_tick != odp_timer_current_tick(tp)); if (rc == ODP_TIMER_TOOEARLY || rc == ODP_TIMER_TOOLATE) { @@ -212,13 +212,13 @@ static void *worker_entrypoint(void *arg) /* Cancel and free all timers */ uint32_t nstale = 0; for (i = 0; i < NTIMERS; i++) { - (void)odp_timer_cancel(tt[i].tim, &tt[i].buf); + (void)odp_timer_cancel(tt[i].tim, &tt[i].ev); tt[i].tick = TICK_INVALID; - if (tt[i].buf == ODP_BUFFER_INVALID) + if (tt[i].ev == ODP_EVENT_INVALID) /* Cancel too late, timer already expired and * timoeut buffer enqueued */ nstale++; - if (odp_timer_free(tt[i].tim) != ODP_BUFFER_INVALID) + if (odp_timer_free(tt[i].tim) != ODP_EVENT_INVALID) CU_FAIL("odp_timer_free"); } @@ -237,8 +237,7 @@ static void *worker_entrypoint(void *arg) while (nstale != 0) { odp_event_t ev = odp_queue_deq(queue); if (ev != ODP_EVENT_INVALID) { - odp_buffer_t buf = odp_buffer_from_event(ev); - handle_tmo(buf, true, 0/*Dont' care for stale tmo's*/); + handle_tmo(ev, true, 0/*Dont' care for stale tmo's*/); nstale--; } else { CU_FAIL("Failed to receive stale timeout");