From patchwork Tue Jan 20 11:18:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 43356 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B7B7C2034D for ; Tue, 20 Jan 2015 11:20:15 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id pn19sf7362025lab.2 for ; Tue, 20 Jan 2015 03:20:14 -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=ceS9Wop/MnAWZa3bqzFohV1gqXRQXeu+dUZdm2k6kSk=; b=iQ01c2BMuVx+t9zMcSVV9l80vuKNQBPDrAECH7FaknEJh1uls1WDt48hYUkH3S636d 2J4OJaVa2iZeyZxDOhGU191c9wy7zXhSepqUiCt9v65vpThEL74FXcOC9s2XQ21T+s6u 2VmclB4Ffc49w6OkvMRcrujFDfiPZopLc8UpYzEsFdDFlfEgp1P6p0cqCNm5XwdzA7Wc gPy4MI20GmC3/7HEEwWtNBXgvaG8COUgn11Yx2F59aWTkNGDj4ybycEaBNyqxabGWD+7 EbK5s1Nw4MWvROlZyhnuTdp8BUPtm+F10sOh8xaBhq0kp/qdStgbKbNpL+vKyExHeFaj X2nw== X-Gm-Message-State: ALoCoQnje6Fse7pPlzAwFFw8qGOU5i9KeOT4RrXbbM8tHAgbp6F4MpDrT6qMVy+z2rZEDmEsKEsB X-Received: by 10.152.182.204 with SMTP id eg12mr11660lac.10.1421752814690; Tue, 20 Jan 2015 03:20:14 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.228 with SMTP id uh4ls706559lac.108.gmail; Tue, 20 Jan 2015 03:20:14 -0800 (PST) X-Received: by 10.112.30.71 with SMTP id q7mr37505856lbh.41.1421752814416; Tue, 20 Jan 2015 03:20:14 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id ap1si16273283lac.117.2015.01.20.03.20.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:20:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id w7so32876778lbi.2 for ; Tue, 20 Jan 2015 03:20:14 -0800 (PST) X-Received: by 10.152.182.235 with SMTP id eh11mr19923382lac.9.1421752814257; Tue, 20 Jan 2015 03:20:14 -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 c8csp1380960lbb; Tue, 20 Jan 2015 03:20:13 -0800 (PST) X-Received: by 10.224.4.133 with SMTP id 5mr47526800qar.37.1421752806696; Tue, 20 Jan 2015 03:20:06 -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 hs1si5281925qcb.47.2015.01.20.03.20.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:20:06 -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 1YDWqn-0006NN-RJ; Tue, 20 Jan 2015 11:20:01 +0000 Received: from mail-qc0-f175.google.com ([209.85.216.175]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDWqI-0006Fb-A2 for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 11:19:30 +0000 Received: by mail-qc0-f175.google.com with SMTP id c9so7682029qcz.6 for ; Tue, 20 Jan 2015 03:19:25 -0800 (PST) X-Received: by 10.140.23.84 with SMTP id 78mr42988810qgo.93.1421752765156; Tue, 20 Jan 2015 03:19:25 -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.23 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 03:19:24 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 13:18:08 +0200 Message-Id: <1421752692-24439-13-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 12/16] api: buffer_pool: Rename odp_buffer_pool.h to odp_pool.h 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.171 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 Renamed pool API header file. Signed-off-by: Petri Savolainen --- platform/linux-generic/Makefile.am | 2 +- platform/linux-generic/include/api/odp.h | 2 +- .../linux-generic/include/api/odp_buffer_pool.h | 181 --------------------- .../linux-generic/include/api/odp_classification.h | 2 +- platform/linux-generic/include/api/odp_crypto.h | 2 +- platform/linux-generic/include/api/odp_packet_io.h | 2 +- platform/linux-generic/include/api/odp_pool.h | 181 +++++++++++++++++++++ .../linux-generic/include/odp_buffer_internal.h | 2 +- .../include/odp_buffer_pool_internal.h | 2 +- platform/linux-generic/include/odp_packet_socket.h | 2 +- platform/linux-generic/odp_buffer_pool.c | 2 +- platform/linux-generic/odp_event.c | 2 +- platform/linux-generic/odp_schedule.c | 2 +- platform/linux-generic/odp_timer.c | 2 +- 14 files changed, 193 insertions(+), 193 deletions(-) delete mode 100644 platform/linux-generic/include/api/odp_buffer_pool.h create mode 100644 platform/linux-generic/include/api/odp_pool.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 712d75c..6bf940c 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -11,7 +11,7 @@ include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp_atomic.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_barrier.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_buffer.h \ - $(top_srcdir)/platform/linux-generic/include/api/odp_buffer_pool.h \ + $(top_srcdir)/platform/linux-generic/include/api/odp_pool.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_byteorder.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_classification.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_compiler.h \ diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-generic/include/api/odp.h index 49357b0..2a4075f 100644 --- a/platform/linux-generic/include/api/odp.h +++ b/platform/linux-generic/include/api/odp.h @@ -36,7 +36,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h deleted file mode 100644 index 68fa69e..0000000 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP buffer pool - */ - -#ifndef ODP_BUFFER_POOL_H_ -#define ODP_BUFFER_POOL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include -#include -#include - -/** @addtogroup odp_buffer - * Operations on a buffer pool. - * @{ - */ - -/** Maximum queue name lenght in chars */ -#define ODP_BUFFER_POOL_NAME_LEN 32 - -/** - * Buffer pool parameters - * Used to communicate buffer pool creation options. - */ -typedef struct odp_buffer_pool_param_t { - uint32_t buf_size; /**< Buffer size in bytes. The maximum - number of bytes application will - store in each buffer. For packets, this - is the maximum packet data length, and - configured headroom and tailroom will be - added to this number */ - uint32_t buf_align; /**< Minimum buffer alignment in bytes. - Valid values are powers of two. Use 0 - for default alignment. Default will - always be a multiple of 8. */ - uint32_t num_bufs; /**< Number of buffers in the pool */ - 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 - * arguments: the optional name of the pool to be created, an optional shared - * memory handle, and a parameter struct that describes the pool to be - * created. If a name is not specified the result is an anonymous pool that - * cannot be referenced by odp_buffer_pool_lookup(). - * - * @param name Name of the pool, max ODP_BUFFER_POOL_NAME_LEN-1 chars. - * May be specified as NULL for anonymous pools. - * - * @param shm The shared memory object in which to create the pool. - * Use ODP_SHM_NULL to reserve default memory type - * for the buffer type. - * - * @param params Buffer pool parameters. - * - * @return Handle of the created buffer pool - * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be created - */ - -odp_buffer_pool_t odp_buffer_pool_create(const char *name, - odp_shm_t shm, - odp_buffer_pool_param_t *params); - -/** - * Destroy a buffer pool previously created by odp_buffer_pool_create() - * - * @param pool Handle of the buffer pool to be destroyed - * - * @retval 0 Success - * @retval -1 Failure - * - * @note This routine destroys a previously created buffer pool. This call - * does not destroy any shared memory object passed to - * odp_buffer_pool_create() used to store the buffer pool contents. The caller - * takes responsibility for that. If no shared memory object was passed as - * part of the create call, then this routine will destroy any internal shared - * memory objects associated with the buffer pool. Results are undefined if - * an attempt is made to destroy a buffer pool that contains allocated or - * otherwise active buffers. - */ -int odp_buffer_pool_destroy(odp_buffer_pool_t pool); - -/** - * Find a buffer pool by name - * - * @param name Name of the pool - * - * @return Handle of found buffer pool - * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be found - * - * @note This routine cannot be used to look up an anonymous pool (one created - * with no name). - */ -odp_buffer_pool_t odp_buffer_pool_lookup(const char *name); - -/** - * Buffer pool information struct - * Used to get information about a buffer pool. - */ -typedef struct odp_buffer_pool_info_t { - const char *name; /**< pool name */ - odp_shm_t shm; /**< handle of shared memory area - supplied by application to - contain buffer pool, or - ODP_SHM_INVALID if this pool is - managed by ODP */ - odp_buffer_pool_param_t params; /**< pool parameters */ -} odp_buffer_pool_info_t; - -/** - * Retrieve information about a buffer pool - * - * @param pool Buffer pool handle - * - * @param[out] info Receives an odp_buffer_pool_info_t object - * that describes the pool. - * - * @retval 0 Success - * @retval -1 Failure. Info could not be retrieved. - */ - -int odp_buffer_pool_info(odp_buffer_pool_t pool, - odp_buffer_pool_info_t *info); - -/** - * Print buffer pool info - * - * @param pool Pool handle - * - * @note This routine writes implementation-defined information about the - * specified buffer pool to the ODP log. The intended use is for debugging. - */ -void odp_buffer_pool_print(odp_buffer_pool_t pool); - -/** - * Buffer alloc - * - * The validity of a buffer can be cheked at any time with odp_buffer_is_valid() - * @param pool Pool handle - * - * @return Handle of allocated buffer - * @retval ODP_BUFFER_INVALID Buffer could not be allocated - */ -odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool); - -/** - * Buffer free - * - * @param buf Buffer handle - * - */ -void odp_buffer_free(odp_buffer_t buf); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/api/odp_classification.h b/platform/linux-generic/include/api/odp_classification.h index 4c9674b..9785348 100644 --- a/platform/linux-generic/include/api/odp_classification.h +++ b/platform/linux-generic/include/api/odp_classification.h @@ -20,7 +20,7 @@ extern "C" { #include -#include +#include #include #include #include diff --git a/platform/linux-generic/include/api/odp_crypto.h b/platform/linux-generic/include/api/odp_crypto.h index 00a0090..4183442 100644 --- a/platform/linux-generic/include/api/odp_crypto.h +++ b/platform/linux-generic/include/api/odp_crypto.h @@ -20,7 +20,7 @@ extern "C" { #include #include -#include +#include #include #include diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index 0c34f29..94d79d4 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -20,7 +20,7 @@ extern "C" { #include #include -#include +#include #include #include diff --git a/platform/linux-generic/include/api/odp_pool.h b/platform/linux-generic/include/api/odp_pool.h new file mode 100644 index 0000000..30a805f --- /dev/null +++ b/platform/linux-generic/include/api/odp_pool.h @@ -0,0 +1,181 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP pool + */ + +#ifndef ODP_POOL_H_ +#define ODP_POOL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#include +#include +#include + +/** @addtogroup odp_buffer + * Operations on a buffer pool. + * @{ + */ + +/** Maximum queue name lenght in chars */ +#define ODP_BUFFER_POOL_NAME_LEN 32 + +/** + * Buffer pool parameters + * Used to communicate buffer pool creation options. + */ +typedef struct odp_buffer_pool_param_t { + uint32_t buf_size; /**< Buffer size in bytes. The maximum + number of bytes application will + store in each buffer. For packets, this + is the maximum packet data length, and + configured headroom and tailroom will be + added to this number */ + uint32_t buf_align; /**< Minimum buffer alignment in bytes. + Valid values are powers of two. Use 0 + for default alignment. Default will + always be a multiple of 8. */ + uint32_t num_bufs; /**< Number of buffers in the pool */ + 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 + * arguments: the optional name of the pool to be created, an optional shared + * memory handle, and a parameter struct that describes the pool to be + * created. If a name is not specified the result is an anonymous pool that + * cannot be referenced by odp_buffer_pool_lookup(). + * + * @param name Name of the pool, max ODP_BUFFER_POOL_NAME_LEN-1 chars. + * May be specified as NULL for anonymous pools. + * + * @param shm The shared memory object in which to create the pool. + * Use ODP_SHM_NULL to reserve default memory type + * for the buffer type. + * + * @param params Buffer pool parameters. + * + * @return Handle of the created buffer pool + * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be created + */ + +odp_buffer_pool_t odp_buffer_pool_create(const char *name, + odp_shm_t shm, + odp_buffer_pool_param_t *params); + +/** + * Destroy a buffer pool previously created by odp_buffer_pool_create() + * + * @param pool Handle of the buffer pool to be destroyed + * + * @retval 0 Success + * @retval -1 Failure + * + * @note This routine destroys a previously created buffer pool. This call + * does not destroy any shared memory object passed to + * odp_buffer_pool_create() used to store the buffer pool contents. The caller + * takes responsibility for that. If no shared memory object was passed as + * part of the create call, then this routine will destroy any internal shared + * memory objects associated with the buffer pool. Results are undefined if + * an attempt is made to destroy a buffer pool that contains allocated or + * otherwise active buffers. + */ +int odp_buffer_pool_destroy(odp_buffer_pool_t pool); + +/** + * Find a buffer pool by name + * + * @param name Name of the pool + * + * @return Handle of found buffer pool + * @retval ODP_BUFFER_POOL_INVALID Buffer pool could not be found + * + * @note This routine cannot be used to look up an anonymous pool (one created + * with no name). + */ +odp_buffer_pool_t odp_buffer_pool_lookup(const char *name); + +/** + * Buffer pool information struct + * Used to get information about a buffer pool. + */ +typedef struct odp_buffer_pool_info_t { + const char *name; /**< pool name */ + odp_shm_t shm; /**< handle of shared memory area + supplied by application to + contain buffer pool, or + ODP_SHM_INVALID if this pool is + managed by ODP */ + odp_buffer_pool_param_t params; /**< pool parameters */ +} odp_buffer_pool_info_t; + +/** + * Retrieve information about a buffer pool + * + * @param pool Buffer pool handle + * + * @param[out] info Receives an odp_buffer_pool_info_t object + * that describes the pool. + * + * @retval 0 Success + * @retval -1 Failure. Info could not be retrieved. + */ + +int odp_buffer_pool_info(odp_buffer_pool_t pool, + odp_buffer_pool_info_t *info); + +/** + * Print buffer pool info + * + * @param pool Pool handle + * + * @note This routine writes implementation-defined information about the + * specified buffer pool to the ODP log. The intended use is for debugging. + */ +void odp_buffer_pool_print(odp_buffer_pool_t pool); + +/** + * Buffer alloc + * + * The validity of a buffer can be cheked at any time with odp_buffer_is_valid() + * @param pool Pool handle + * + * @return Handle of allocated buffer + * @retval ODP_BUFFER_INVALID Buffer could not be allocated + */ +odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool); + +/** + * Buffer free + * + * @param buf Buffer handle + * + */ +void odp_buffer_free(odp_buffer_t buf); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 0d09531..c3784ba 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -20,7 +20,7 @@ extern "C" { #include #include -#include +#include #include #include #include diff --git a/platform/linux-generic/include/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h index 2e48ac3..b0e696e 100644 --- a/platform/linux-generic/include/odp_buffer_pool_internal.h +++ b/platform/linux-generic/include/odp_buffer_pool_internal.h @@ -21,7 +21,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index c4f8af1..0c4ad0b 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index 202d1c7..d243045 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index 285a19b..f3e70b9 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include int odp_event_type(odp_event_t event) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 423aa1e..9ca08b7 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index a32e240..29027e6 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include