From patchwork Sat Nov 22 22:04:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 41374 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5646825AEA for ; Sat, 22 Nov 2014 22:04:49 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf4153492eek.8 for ; Sat, 22 Nov 2014 14:04:48 -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=9cWuOud3Iueqzp3W+5n0VQEmiJp4UQhu8V6b8tld6V4=; b=BumHH6HreAQwWmjE07MI+wlPxmkrFhFQyQD1tJ3feBszxZcfswreJpYdIl2CEjdvFl r/89qYRyWwqVg6CiaWpowJXPxPIDzENX312Plwf7Qix3Z0QX8iRckCgFOlGmEAlAQdUG enX0h7urRjTFGlfF892N1zd4yB0oDfnFaj+oPpOYLmFqX22nHRsdKIydn1GPwifFvN98 zAF/wWQ3ZnO+UYhakuJNVy1J1YqtL3V/MfFgWjNJCKgab6lS+rbCgT4ZR8yccKowBPSZ OfjV/ZKDe4BycqCuSjv4CLsXVHMQWhJVAoZ9ipHFMQQaDY1zPJyrkyOEB4vWyih+qG/Q 1YgQ== X-Gm-Message-State: ALoCoQnV5MbT3vjwYWm3tkouqb/Bd0loPejNtt+eNabxq2uj2vS8L6OX03TQnfc5nwjdhH/f51sQ X-Received: by 10.194.178.163 with SMTP id cz3mr3905438wjc.1.1416693888268; Sat, 22 Nov 2014 14:04:48 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.200 with SMTP id x8ls289020lae.76.gmail; Sat, 22 Nov 2014 14:04:47 -0800 (PST) X-Received: by 10.152.120.167 with SMTP id ld7mr12243194lab.77.1416693887866; Sat, 22 Nov 2014 14:04:47 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id da5si10264830lac.76.2014.11.22.14.04.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Nov 2014 14:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gf13so5820776lab.41 for ; Sat, 22 Nov 2014 14:04:47 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr12390181lbo.32.1416693887732; Sat, 22 Nov 2014 14:04:47 -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.184.201 with SMTP id ew9csp65520lbc; Sat, 22 Nov 2014 14:04:47 -0800 (PST) X-Received: by 10.224.40.202 with SMTP id l10mr17327844qae.7.1416693886507; Sat, 22 Nov 2014 14:04:46 -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 w9si11364364qaj.7.2014.11.22.14.04.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 22 Nov 2014 14:04:46 -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 1XsInM-0006Db-C6; Sat, 22 Nov 2014 22:04:44 +0000 Received: from mail-ob0-f182.google.com ([209.85.214.182]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XsIn9-0006Ck-1Q for lng-odp@lists.linaro.org; Sat, 22 Nov 2014 22:04:31 +0000 Received: by mail-ob0-f182.google.com with SMTP id m8so5675926obr.27 for ; Sat, 22 Nov 2014 14:04:25 -0800 (PST) X-Received: by 10.182.68.14 with SMTP id r14mr7727033obt.32.1416693865776; Sat, 22 Nov 2014 14:04:25 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id wk3sm3842495obc.3.2014.11.22.14.04.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Nov 2014 14:04:25 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 22 Nov 2014 16:04:14 -0600 Message-Id: <1416693854-29711-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416693854-29711-1-git-send-email-bill.fischofer@linaro.org> References: <1416693854-29711-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 3/3] Buffer pool API Part 3 of 3: External API for Review/Approval 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: bill.fischofer@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.54 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 Signed-off-by: Bill Fischofer --- Merge parts 1, 2, and 3 of this patch after review. .../linux-generic/include/api/odp_buffer_pool.h | 105 ++++++++++++++++++--- 1 file changed, 94 insertions(+), 11 deletions(-) diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h index 30b83e0..d5f138e 100644 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ b/platform/linux-generic/include/api/odp_buffer_pool.h @@ -36,32 +36,115 @@ extern "C" { #define ODP_BUFFER_POOL_INVALID 0 /** + * Buffer pool parameters + * + * @param[in] buf_size Buffer size in bytes. The maximum number + * of bytes application will store in each + * buffer. + * + * @param[in] buf_align Minimum buffer alignment in bytes. Valid values + * are powers of two. Use 0 for the default + * alignment. Default alignment is a multiple + * of 8. + * + * @param[in] num_bufs Number of buffers in the pool. + * + * @param[in] buf_type Buffer type + */ +typedef struct odp_buffer_pool_param_t { + size_t buf_size; + size_t buf_align; + uint32_t num_bufs; + int buf_type; +} odp_buffer_pool_param_t; + +/** * 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) - * @param base_addr Pool base address - * @param size Pool size in bytes - * @param buf_size Buffer size in bytes - * @param buf_align Minimum buffer alignment - * @param buf_type Buffer type + * @param[in] name Name of the pool, max ODP_BUFFER_POOL_NAME_LEN-1 chars. + * May be specified as NULL for anonymous pools. * - * @return Buffer pool handle + * @param[in] 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[in] params Buffer pool parameters. + * + * @return Buffer pool handle or ODP_BUFFER_POOL_INVALID if call failed. */ + odp_buffer_pool_t odp_buffer_pool_create(const char *name, - void *base_addr, uint64_t size, - size_t buf_size, size_t buf_align, - int buf_type); + odp_shm_t shm, + odp_buffer_pool_param_t *params); +/** + * Destroy a buffer pool previously created by odp_buffer_pool_create() + * + * @param[in] pool Handle of the buffer pool to be destroyed + * + * @return 0 on Success, -1 on 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 + * @param[in] name Name of the pool * * @return Buffer pool handle, or ODP_BUFFER_POOL_INVALID if not 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); +/** + * @param[out] name Pointer to the name of the buffer pool. NULL if this + * pool is anonymous. + * + * @param[out] shm Handle of the shared memory object containing this pool, + * if pool was created from an application supplied shared + * memory area. Otherwise ODP_SHM_NULL. + * + * @param[out] params Copy of the odp_buffer_pool_param_t used to create this + * pool. + */ +typedef struct odp_buffer_pool_info_t { + const char *name; + odp_buffer_pool_param_t params; +} odp_buffer_pool_info_t; + +/** + * Retrieve information about a buffer pool + * + * @param[in] pool Buffer pool handle + * + * @param[out] shm Recieves odp_shm_t supplied by caller at + * pool creation, or ODP_SHM_NULL if the + * pool is managed internally. + * + * @param[out] info Receives an odp_buffer_pool_info_t object + * that describes the pool. + * + * @return 0 on success, -1 if info could not be retrieved. + */ + +int odp_buffer_pool_info(odp_buffer_pool_t pool, odp_shm_t *shm, + odp_buffer_pool_info_t *info); /** * Print buffer pool info