From patchwork Thu Jan 15 15:40: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: 43207 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAB4E240BA for ; Thu, 15 Jan 2015 15:41:34 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id hi2sf4675664wib.3 for ; Thu, 15 Jan 2015 07:41: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=apwNx3XmMoeD5VDkTcNkNTlV4AjU0Zqp0C3W9Y0ClLs=; b=OBc1LAEftd45Yoxz4F83Tff0BlAACXOjPCPN6snwh0SiK7oHir5PtuOxwmUTKZ6HgH GJUxoJ5csRt17D+8W+PQCBckQm8UDWsrKVrDePchp5+YIdelI12xqJFHf1KWWGs+eRWa 0Wke4Z52j0QceKo+/l2mSrmaxezq08gHS99/btXn445geavsZS1jXqRwQEG+7MUGroiz 4lBiviM+lhehoVU9j9zTj6GhwBoeUfN5VNkEclb1Sx/dv2VsUgWubc/IEm8W1t6noNWF evP/zmvC8w7WuHqTC8qpE9cwEHtlONlbRsvCHPgfgcpmSyizNNHw5GiFEyauqNeCrmq7 7vRg== X-Gm-Message-State: ALoCoQlz5dfEbGo3InTBKEVWYbZuNES9OoqgOVwMW8NtvyyGRD01d3dWV4AQzs6FX97lgf/j21bO X-Received: by 10.112.171.74 with SMTP id as10mr404334lbc.8.1421336494016; Thu, 15 Jan 2015 07:41:34 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.9 with SMTP id t9ls84479laz.107.gmail; Thu, 15 Jan 2015 07:41:33 -0800 (PST) X-Received: by 10.152.219.3 with SMTP id pk3mr2981488lac.19.1421336493839; Thu, 15 Jan 2015 07:41:33 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id kl8si351981lbc.86.2015.01.15.07.41.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so13933475lbv.7 for ; Thu, 15 Jan 2015 07:41:33 -0800 (PST) X-Received: by 10.112.30.71 with SMTP id q7mr10541617lbh.41.1421336493611; Thu, 15 Jan 2015 07:41: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 c8csp21924lbb; Thu, 15 Jan 2015 07:41:32 -0800 (PST) X-Received: by 10.229.79.69 with SMTP id o5mr14405495qck.13.1421336490628; Thu, 15 Jan 2015 07:41:30 -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 k1si2366346qce.32.2015.01.15.07.41.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:30 -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 1YBmY4-0007QR-7U; Thu, 15 Jan 2015 15:41:28 +0000 Received: from mail-qa0-f50.google.com ([209.85.216.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBmXr-0007Lk-Na for lng-odp@lists.linaro.org; Thu, 15 Jan 2015 15:41:15 +0000 Received: by mail-qa0-f50.google.com with SMTP id k15so11605287qaq.9 for ; Thu, 15 Jan 2015 07:41:10 -0800 (PST) X-Received: by 10.140.32.166 with SMTP id h35mr16018754qgh.22.1421336470600; Thu, 15 Jan 2015 07:41:10 -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 g12sm1563340qay.44.2015.01.15.07.41.08 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 07:41:09 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 15 Jan 2015 17:40:14 +0200 Message-Id: <1421336423-19382-7-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1421336423-19382-1-git-send-email-petri.savolainen@linaro.org> References: <1421336423-19382-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 06/15] 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.176 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 | 16 ---------------- platform/linux-generic/include/api/odp_buffer_pool.h | 4 ++++ platform/linux-generic/include/odp_buffer_internal.h | 16 ++++++++++++++++ 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 ++-- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/platform/linux-generic/include/api/odp_buffer.h b/platform/linux-generic/include/api/odp_buffer.h index 5f825a2..69d5779 100644 --- a/platform/linux-generic/include/api/odp_buffer.h +++ b/platform/linux-generic/include/api/odp_buffer.h @@ -69,22 +69,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 (-1) /**< Buffer type invalid */ -#define ODP_BUFFER_TYPE_ANY 0 /**< Buffer that can hold any other - buffer type */ -#define ODP_BUFFER_TYPE_RAW 1 /**< Raw buffer, no additional metadata */ -#define ODP_BUFFER_TYPE_PACKET 2 /**< Packet buffer */ -#define ODP_BUFFER_TYPE_TIMEOUT 3 /**< Timeout buffer */ - -/** * 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..68fa69e 100644 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ b/platform/linux-generic/include/api/odp_buffer_pool.h @@ -51,6 +51,10 @@ typedef struct odp_buffer_pool_param_t { int buf_type; /**< Buffer type */ } odp_buffer_pool_param_t; +#define ODP_BUFFER_TYPE_RAW 1 /**< Raw buffer, no additional metadata */ +#define ODP_BUFFER_TYPE_PACKET 2 /**< Packet buffer */ +#define ODP_BUFFER_TYPE_TIMEOUT 3 /**< Timeout buffer */ + /** * 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..0d09531 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -153,6 +153,22 @@ 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_INVALID (-1) /**< Buffer type invalid */ +#define _ODP_BUFFER_TYPE_ANY 0 /**< Buffer that can hold any other + buffer type */ + + + #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 3bb7770..dd4cc72 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); @@ -798,7 +798,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); }