From patchwork Wed Feb 19 09:00:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 24934 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD928201EE for ; Wed, 19 Feb 2014 09:00:33 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf384280oah.6 for ; Wed, 19 Feb 2014 01:00:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-type; bh=oFHkWM575Fy5N4EAbJ/7xCqgf/9ZPSwr/5jNur1Fe/0=; b=hNm8P9dmbqX3Nj3xcKvNRjSxsgdGcxEROJgFrWqAHHWRvU8Kw8ndZdJzfeCAC+lxI5 AmEPKhtIQ8s6foB9h+tiHnZ0Le8qSZWgYiivk7a5a+pNrx09fmrIQF2kR05ZS1Epg+D8 ORYmlbF0UulR+/11qCpisNPQG1fy8NpI68s/RQ3mbFFRTnQb7YTHXrq0NbcZnogFVsiG e/66LeAhZIz9ecqkVXCG6VKMh0izWf8MrCSAjMZntnUT3n/8WrAftPZtgJVMh1wij4cz oiyee/RCDJ0mj0d9/bSOaXwBdDeegO8hnGi6sw2YBv/DnRHu3a+O47kHdile5s+saKyf SejA== X-Gm-Message-State: ALoCoQlFjlDZT64hLJF+/y5bjmDuP+LWWEibwBtI6wJlorHkeef+fFE6mfdLAe+fLwY9vbZXYGFO X-Received: by 10.182.74.226 with SMTP id x2mr14571275obv.1.1392800433231; Wed, 19 Feb 2014 01:00:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: lng-odp@linaro.org Received: by 10.140.102.49 with SMTP id v46ls31298qge.6.gmail; Wed, 19 Feb 2014 01:00:33 -0800 (PST) X-Received: by 10.236.92.137 with SMTP id j9mr10352138yhf.126.1392800433047; Wed, 19 Feb 2014 01:00:33 -0800 (PST) Received: from mail-qc0-f174.google.com (mail-qc0-f174.google.com [209.85.216.174]) by mx.google.com with ESMTPS id v46si28551588yhn.14.2014.02.19.01.00.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 01:00:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.174 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) client-ip=209.85.216.174; Received: by mail-qc0-f174.google.com with SMTP id x13so97217qcv.33 for ; Wed, 19 Feb 2014 01:00:32 -0800 (PST) X-Received: by 10.229.213.194 with SMTP id gx2mr195375qcb.16.1392800432865; Wed, 19 Feb 2014 01:00:32 -0800 (PST) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id y71sm31371614qgd.3.2014.02.19.01.00.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 01:00:31 -0800 (PST) From: Petri Savolainen To: lng-odp@linaro.org Cc: Petri Savolainen Subject: [lng-odp] [PATCH] Buffer type added Date: Wed, 19 Feb 2014 11:00:51 +0200 Message-Id: <1392800451-3359-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 1.8.5.3 X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.174 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) smtp.mail=petri.savolainen@linaro.org Precedence: list Mailing-list: list lng-odp@linaro.org; contact lng-odp+owners@linaro.org List-ID: X-Google-Group-Id: 474323889996 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Petri Savolainen --- include/odp_buffer.h | 15 ++++++++++++++- include/odp_buffer_pool.h | 2 -- platform/linux-generic/source/odp_buffer.c | 8 ++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/odp_buffer.h b/include/odp_buffer.h index 9f0811a..d8e4779 100644 --- a/include/odp_buffer.h +++ b/include/odp_buffer.h @@ -53,6 +53,20 @@ void *odp_buffer_addr(odp_buffer_t buf); size_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_RAW 0 /**< Raw buffer */ +#define ODP_BUFFER_TYPE_PACKET 1 /**< Packet buffer */ +#define ODP_BUFFER_TYPE_TIMER 2 /**< Timer buffer */ + +/** * Tests if buffer is part of a scatter/gather list * * @param buf Buffer handle @@ -70,7 +84,6 @@ int odp_buffer_is_scatter(odp_buffer_t buf); */ int odp_buffer_is_valid(odp_buffer_t buf); - /** * Print buffer metadata to STDOUT * diff --git a/include/odp_buffer_pool.h b/include/odp_buffer_pool.h index 20fbf04..15f0be4 100644 --- a/include/odp_buffer_pool.h +++ b/include/odp_buffer_pool.h @@ -26,8 +26,6 @@ extern "C" { #define ODP_BUFFER_POOL_NAME_LEN 32 #define ODP_BUFFER_POOL_INVALID (0xffffffff) -#define ODP_BUFFER_TYPE_RAW 0 -#define ODP_BUFFER_TYPE_PACKET 1 typedef uint32_t odp_buffer_pool_t; diff --git a/platform/linux-generic/source/odp_buffer.c b/platform/linux-generic/source/odp_buffer.c index 9d5997a..f5b02fd 100644 --- a/platform/linux-generic/source/odp_buffer.c +++ b/platform/linux-generic/source/odp_buffer.c @@ -33,6 +33,14 @@ size_t odp_buffer_size(odp_buffer_t buf) } +int odp_buffer_type(odp_buffer_t buf) +{ + odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); + + return hdr->type; +} + + int odp_buffer_is_scatter(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);