From patchwork Fri Jan 23 11:42:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43616 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E6A45240D9 for ; Fri, 23 Jan 2015 11:43:34 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y19sf3915295wgg.2 for ; Fri, 23 Jan 2015 03:43:34 -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=VbOVeY1agEpJI9ryf8ND362U7byvF/8TKW/+M5ahNXo=; b=Dj/pG+NmHE4aYJhKBbV+SqQAKE/xoO84T71SoryxFDr8aNivaUA1D01TcYRUaG1xEB j98IsPnr3LSNift2T1aX0KK58ns3c/f2v61F9vSz/+kCNTHgjop7iWWWv3JI1Tf/PAHV oN3nyvkdazhWFLQGtT3Apl01mwR9r8LnNhWro6cKIPAQxrT5CzUrGf00YwSUZsRtlhtW Fkmp3AX3OKIY/x1S9xPvPfLG4FMGyliH+lG52H+Wu08cgU0+OJ4r2V6t/ECAoONXTATd 2+twVM+mJE2PWDDrI6C3swYy7H2D45EQAZH06f0oMafqTLkDeEzbfMwUBqzaNaLvxVOm G9bg== X-Gm-Message-State: ALoCoQl2OFLvQ+48dU7VWFh6nX/iuT6PAgaZKr42py8sidm7mZPWSs9Dz8W5Ld6wvgr81kFd9TUT X-Received: by 10.152.2.40 with SMTP id 8mr103925lar.7.1422013414234; Fri, 23 Jan 2015 03:43:34 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.38 with SMTP id ld6ls278799lac.50.gmail; Fri, 23 Jan 2015 03:43:34 -0800 (PST) X-Received: by 10.152.30.6 with SMTP id o6mr6968085lah.64.1422013414012; Fri, 23 Jan 2015 03:43:34 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id g1si1172602lag.18.2015.01.23.03.43.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jan 2015 03:43:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so6531729lbj.11 for ; Fri, 23 Jan 2015 03:43:33 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr6864835lbc.24.1422013413905; Fri, 23 Jan 2015 03:43:33 -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 c8csp220890lbb; Fri, 23 Jan 2015 03:43:32 -0800 (PST) X-Received: by 10.140.95.179 with SMTP id i48mr12455110qge.4.1422013412169; Fri, 23 Jan 2015 03:43:32 -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 7si1645248qgk.40.2015.01.23.03.43.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 23 Jan 2015 03:43:32 -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 1YEce8-0003PL-RU; Fri, 23 Jan 2015 11:43:28 +0000 Received: from mail-qg0-f53.google.com ([209.85.192.53]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YEcdo-0003Lm-Q9 for lng-odp@lists.linaro.org; Fri, 23 Jan 2015 11:43:08 +0000 Received: by mail-qg0-f53.google.com with SMTP id a108so5569953qge.12 for ; Fri, 23 Jan 2015 03:43:03 -0800 (PST) X-Received: by 10.140.97.203 with SMTP id m69mr12362965qge.39.1422013383633; Fri, 23 Jan 2015 03:43: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 f7sm1182892qaq.42.2015.01.23.03.43.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 03:43:02 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 23 Jan 2015 13:42:14 +0200 Message-Id: <1422013344-6655-7-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422013344-6655-1-git-send-email-petri.savolainen@linaro.org> References: <1422013344-6655-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v4 06/16] api: buffer: Removed odp_buffer_type 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.217.180 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 Removed odp_buffer_type() from API and made it internal. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_buffer.h | 15 ---- .../linux-generic/include/api/odp_buffer_pool.h | 5 ++ .../linux-generic/include/odp_buffer_internal.h | 13 +++ platform/linux-generic/odp_buffer.c | 2 +- platform/linux-generic/odp_buffer_pool.c | 4 +- platform/linux-generic/odp_event.c | 4 +- platform/linux-generic/odp_timer.c | 4 +- test/validation/buffer/odp_buffer_pool_test.c | 100 +++++++++++++-------- test/validation/buffer/odp_buffer_test.c | 4 +- test/validation/buffer/odp_packet_test.c | 15 ++-- test/validation/odp_pktio.c | 16 ++-- test/validation/odp_timer.c | 2 +- 12 files changed, 107 insertions(+), 77 deletions(-) diff --git a/platform/linux-generic/include/api/odp_buffer.h b/platform/linux-generic/include/api/odp_buffer.h index 20036f9..2f18aa9 100644 --- a/platform/linux-generic/include/api/odp_buffer.h +++ b/platform/linux-generic/include/api/odp_buffer.h @@ -70,21 +70,6 @@ void *odp_buffer_addr(odp_buffer_t buf); uint32_t odp_buffer_size(odp_buffer_t buf); /** - * Buffer type - * - * @param buf Buffer handle - * - * @return Buffer type - */ -int odp_buffer_type(odp_buffer_t buf); - -#define ODP_BUFFER_TYPE_INVALID ODP_EVENT_TYPE_INVALID -#define ODP_BUFFER_TYPE_ANY 0 -#define ODP_BUFFER_TYPE_RAW ODP_EVENT_BUFFER -#define ODP_BUFFER_TYPE_PACKET ODP_EVENT_PACKET -#define ODP_BUFFER_TYPE_TIMEOUT ODP_EVENT_TIMEOUT - -/** * Tests if buffer is valid * * @param buf Buffer handle diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h index 8380ac1..5c771f4 100644 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ b/platform/linux-generic/include/api/odp_buffer_pool.h @@ -23,6 +23,7 @@ extern "C" { #include #include #include +#include /** @addtogroup odp_buffer * Operations on a buffer pool. @@ -51,6 +52,10 @@ typedef struct odp_buffer_pool_param_t { int buf_type; /**< Buffer type */ } odp_buffer_pool_param_t; +#define ODP_BUFFER_TYPE_RAW ODP_EVENT_BUFFER +#define ODP_BUFFER_TYPE_PACKET ODP_EVENT_PACKET +#define ODP_BUFFER_TYPE_TIMEOUT ODP_EVENT_TIMEOUT + /** * Create a buffer pool * This routine is used to create a buffer pool. It take three diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 39b0b05..9b2c810 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -153,6 +153,19 @@ typedef struct { /* Forward declarations */ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool, size_t size); + +/* + * Buffer type + * + * @param buf Buffer handle + * + * @return Buffer type + */ +int _odp_buffer_type(odp_buffer_t buf); + +#define _ODP_BUFFER_TYPE_ANY 0 + + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index 939332a..e657e00 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -40,7 +40,7 @@ uint32_t odp_buffer_size(odp_buffer_t buf) } -int odp_buffer_type(odp_buffer_t buf) +int _odp_buffer_type(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index eedb380..202d1c7 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -160,7 +160,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name, break; case ODP_BUFFER_TYPE_PACKET: - case ODP_BUFFER_TYPE_ANY: + case _ODP_BUFFER_TYPE_ANY: headroom = ODP_CONFIG_PACKET_HEADROOM; tailroom = ODP_CONFIG_PACKET_TAILROOM; unsegmented = params->buf_size > ODP_CONFIG_PACKET_BUF_LEN_MAX; @@ -561,7 +561,7 @@ void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl) pool->s.params.buf_type == ODP_BUFFER_TYPE_RAW ? "raw" : (pool->s.params.buf_type == ODP_BUFFER_TYPE_PACKET ? "packet" : (pool->s.params.buf_type == ODP_BUFFER_TYPE_TIMEOUT ? "timeout" : - (pool->s.params.buf_type == ODP_BUFFER_TYPE_ANY ? "any" : + (pool->s.params.buf_type == _ODP_BUFFER_TYPE_ANY ? "any" : "unknown")))); ODP_DBG(" pool storage %sODP managed\n", pool->s.flags.user_supplied_shm ? diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index c646f42..285a19b 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -6,6 +6,8 @@ #include #include +#include +#include int odp_event_type(odp_event_t event) { @@ -13,7 +15,7 @@ int odp_event_type(odp_event_t event) buf = odp_buffer_from_event(event); - switch (odp_buffer_type(buf)) { + switch (_odp_buffer_type(buf)) { case ODP_BUFFER_TYPE_RAW: return ODP_EVENT_BUFFER; case ODP_BUFFER_TYPE_PACKET: diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 029e8c2..9233226 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -557,7 +557,7 @@ static unsigned timer_expire(odp_timer_pool *tp, uint32_t idx, uint64_t tick) #endif if (odp_likely(tmo_buf != ODP_BUFFER_INVALID)) { /* Fill in metadata fields in system timeout buffer */ - if (odp_buffer_type(tmo_buf) == ODP_BUFFER_TYPE_TIMEOUT) { + if (_odp_buffer_type(tmo_buf) == ODP_BUFFER_TYPE_TIMEOUT) { /* Convert from buffer to timeout hdr */ odp_timeout_hdr_t *tmo_hdr = timeout_hdr_from_buf(tmo_buf); @@ -799,7 +799,7 @@ int odp_timer_cancel(odp_timer_t hdl, odp_buffer_t *tmo_buf) 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) + if (_odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) ODP_ABORT("Buffer not a timeout"); return (odp_timeout_t)timeout_hdr_from_buf(buf); } diff --git a/test/validation/buffer/odp_buffer_pool_test.c b/test/validation/buffer/odp_buffer_pool_test.c index 6f5eaf7..a5af1d4 100644 --- a/test/validation/buffer/odp_buffer_pool_test.c +++ b/test/validation/buffer/odp_buffer_pool_test.c @@ -53,11 +53,6 @@ static void pool_create_destroy_timeout(void) pool_create_destroy_type(ODP_BUFFER_TYPE_TIMEOUT); } -static void pool_create_destroy_any(void) -{ - pool_create_destroy_type(ODP_BUFFER_TYPE_ANY); -} - static void pool_create_destroy_raw_shm(void) { odp_buffer_pool_t pool; @@ -113,64 +108,97 @@ static void pool_lookup_info_print(void) CU_ASSERT(odp_buffer_pool_destroy(pool) == 0); } -static void pool_alloc_buffer_type(int type) +static void pool_alloc_type(int type) { odp_buffer_pool_t pool; - const int buf_num = 3; - const size_t buf_size = 1500; - odp_buffer_t buffer[buf_num]; - int buf_index; + const int num = 3; + const size_t size = 1500; + odp_buffer_t buffer[num]; + odp_packet_t packet[num]; + odp_event_t ev; + int index; char wrong_type = 0, wrong_size = 0; - pool = pool_create(buf_num, buf_size, type); + pool = pool_create(num, size, type); odp_buffer_pool_print(pool); - /* Try to allocate buf_num buffers from the pool */ - for (buf_index = 0; buf_index < buf_num; buf_index++) { - buffer[buf_index] = odp_buffer_alloc(pool); - if (buffer[buf_index] == ODP_BUFFER_INVALID) + /* Try to allocate num items from the pool */ + for (index = 0; index < num; index++) { + switch (type) { + case ODP_BUFFER_TYPE_RAW: + buffer[index] = odp_buffer_alloc(pool); + + if (buffer[index] == ODP_BUFFER_INVALID) + break; + + ev = odp_buffer_to_event(buffer[index]); + if (odp_event_type(ev) != ODP_EVENT_BUFFER) + wrong_type = 1; + if (odp_buffer_size(buffer[index]) < size) + wrong_size = 1; + if (wrong_type || wrong_size) + odp_buffer_print(buffer[index]); + break; + + case ODP_BUFFER_TYPE_PACKET: + packet[index] = odp_packet_alloc(pool, size); + + if (packet[index] == ODP_PACKET_INVALID) + break; + + ev = odp_packet_to_event(packet[index]); + if (odp_event_type(ev) != ODP_EVENT_PACKET) + wrong_type = 1; break; - if (odp_buffer_type(buffer[buf_index]) != type) - wrong_type = 1; - if (odp_buffer_size(buffer[buf_index]) < buf_size) - wrong_size = 1; - if (wrong_type || wrong_size) - odp_buffer_print(buffer[buf_index]); + case ODP_BUFFER_TYPE_TIMEOUT: + /* Don't test timeout alloc until it's implemented */ + break; + default: + break; + } + } - /* Check that the pool had at least buf_num buffers */ - CU_ASSERT(buf_index == buf_num); - /* buf_index points out of buffer[] or it point to an invalid buffer */ - buf_index--; + /* Check that the pool had at least num items */ + CU_ASSERT(index == num); + /* index points out of buffer[] or it point to an invalid buffer */ + index--; /* Check that the pool had correct buffers */ CU_ASSERT(wrong_type == 0); CU_ASSERT(wrong_size == 0); - for (; buf_index >= 0; buf_index--) - odp_buffer_free(buffer[buf_index]); + switch (type) { + case ODP_BUFFER_TYPE_RAW: + for (; index >= 0; index--) + odp_buffer_free(buffer[index]); + break; + case ODP_BUFFER_TYPE_PACKET: + for (; index >= 0; index--) + odp_packet_free(packet[index]); + break; + case ODP_BUFFER_TYPE_TIMEOUT: + break; + default: + break; + } CU_ASSERT(odp_buffer_pool_destroy(pool) == 0); } static void pool_alloc_buffer_raw(void) { - pool_alloc_buffer_type(ODP_BUFFER_TYPE_RAW); + pool_alloc_type(ODP_BUFFER_TYPE_RAW); } static void pool_alloc_buffer_packet(void) { - pool_alloc_buffer_type(ODP_BUFFER_TYPE_PACKET); + pool_alloc_type(ODP_BUFFER_TYPE_PACKET); } static void pool_alloc_buffer_timeout(void) { - pool_alloc_buffer_type(ODP_BUFFER_TYPE_TIMEOUT); -} - -static void pool_alloc_buffer_any(void) -{ - pool_alloc_buffer_type(ODP_BUFFER_TYPE_ANY); + pool_alloc_type(ODP_BUFFER_TYPE_TIMEOUT); } static void pool_free_buffer(void) @@ -200,13 +228,11 @@ CU_TestInfo buffer_pool_tests[] = { _CU_TEST_INFO(pool_create_destroy_raw), _CU_TEST_INFO(pool_create_destroy_packet), _CU_TEST_INFO(pool_create_destroy_timeout), - _CU_TEST_INFO(pool_create_destroy_any), _CU_TEST_INFO(pool_create_destroy_raw_shm), _CU_TEST_INFO(pool_lookup_info_print), _CU_TEST_INFO(pool_alloc_buffer_raw), _CU_TEST_INFO(pool_alloc_buffer_packet), _CU_TEST_INFO(pool_alloc_buffer_timeout), - _CU_TEST_INFO(pool_alloc_buffer_any), _CU_TEST_INFO(pool_free_buffer), CU_TEST_INFO_NULL, }; diff --git a/test/validation/buffer/odp_buffer_test.c b/test/validation/buffer/odp_buffer_test.c index 219a9ef..9fd5bb8 100644 --- a/test/validation/buffer/odp_buffer_test.c +++ b/test/validation/buffer/odp_buffer_test.c @@ -38,9 +38,11 @@ int buffer_testsuite_finalize(void) static void buffer_management_basic(void) { + odp_event_t ev = odp_buffer_to_event(raw_buffer); + CU_ASSERT(odp_buffer_is_valid(raw_buffer) == 1); CU_ASSERT(odp_buffer_pool(raw_buffer) != ODP_BUFFER_POOL_INVALID); - CU_ASSERT(odp_buffer_type(raw_buffer) == ODP_BUFFER_TYPE_RAW); + CU_ASSERT(odp_event_type(ev) == ODP_EVENT_BUFFER); CU_ASSERT(odp_buffer_size(raw_buffer) >= raw_buffer_size); CU_ASSERT(odp_buffer_addr(raw_buffer) != NULL); odp_buffer_print(raw_buffer); diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index d073b49..63caec6 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -85,18 +85,17 @@ static void packet_alloc_segmented(void) odp_packet_free(pkt); } -static void packet_buffer_conversion(void) +static void packet_event_conversion(void) { odp_packet_t pkt = test_packet; odp_packet_t tmp_pkt; - odp_buffer_t buf; + odp_event_t ev; - buf = odp_packet_to_buffer(pkt); - CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); - CU_ASSERT(odp_buffer_type(buf) == ODP_BUFFER_TYPE_PACKET); - CU_ASSERT(odp_buffer_size(buf) == odp_packet_buf_len(pkt)); + ev = odp_packet_to_event(pkt); + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); + CU_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - tmp_pkt = odp_packet_from_buffer(buf); + tmp_pkt = odp_packet_from_event(ev); CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID); /** @todo: Need an API to compare packets */ } @@ -653,7 +652,7 @@ CU_TestInfo packet_tests[] = { _CU_TEST_INFO(packet_headroom), _CU_TEST_INFO(packet_tailroom), _CU_TEST_INFO(packet_context), - _CU_TEST_INFO(packet_buffer_conversion), + _CU_TEST_INFO(packet_event_conversion), _CU_TEST_INFO(packet_layer_offsets), _CU_TEST_INFO(packet_segments), _CU_TEST_INFO(packet_segment_last), diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index b1eb61e..2e7b50b 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -244,7 +244,7 @@ static int create_inq(odp_pktio_t pktio) return odp_pktio_inq_setdef(pktio, inq_def); } -static odp_buffer_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) +static odp_event_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) { uint64_t start, now, diff; odp_event_t ev; @@ -254,12 +254,12 @@ static odp_buffer_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) do { ev = odp_queue_deq(queue); if (ev != ODP_EVENT_INVALID) - return odp_buffer_from_event(ev); + return ev; now = odp_time_cycles(); diff = odp_time_diff_cycles(start, now); } while (odp_time_cycles_to_ns(diff) < ns); - return ODP_BUFFER_INVALID; + return ODP_EVENT_INVALID; } static odp_packet_t wait_for_packet(odp_queue_t queue, @@ -267,22 +267,20 @@ static odp_packet_t wait_for_packet(odp_queue_t queue, { 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) { - buf = queue_deq_wait_time(queue, ns); + ev = queue_deq_wait_time(queue, 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) { - pkt = odp_packet_from_buffer(buf); + if (ev != ODP_EVENT_INVALID && + odp_event_type(ev) == ODP_EVENT_PACKET) { + pkt = odp_packet_from_event(ev); if (pktio_pkt_seq(pkt) == seq) return pkt; } diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index eca7e7f..adc1554 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -49,7 +49,7 @@ static void handle_tmo(odp_buffer_t buf, bool stale, uint64_t prev_tick) { /* Use assert() for internal correctness checks of test program */ assert(buf != ODP_BUFFER_INVALID); - if (odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) { + if (odp_event_type(odp_buffer_to_event(buf)) != ODP_EVENT_TIMEOUT) { /* Not a timeout buffer */ CU_FAIL("Unexpected buffer type received"); return;