From patchwork Thu Nov 20 23:27:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 41264 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 72B3523C27 for ; Thu, 20 Nov 2014 23:27:39 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf2640201wiw.0 for ; Thu, 20 Nov 2014 15:27:38 -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=3fjwnJ0zNEKf6S65Sq7ViVJ5iqCn7kwulZgfYhVURwI=; b=f8MJEAC3aNL0RMczFbJMZamNm0iqV7ZZr3l5qUtaRaPaqvWnaCoioNJQPiLvB8iGbl 0VdmWMBPUjAk9LWt6OKsoPXI4ZNmsqKxKVhzTxhTbNwy3FB2ixjxaDmzqmg1PW1tuhNE aSdj9DfLhEIzXMU3byuHbfkQqJiVFBVzlKtMEUi4a6PF1yviYaDZ4qexPc/Mstou2lQd hx6LtH2feI7SZ/p6bVlD6YBZ5l+DyLHsgV7Ly1v4lNz7e0hSygC1B8X8qn8Hy7Sbl9QW KCFElPbhni4HdasRF5u1mYkin2u4cgjTtEIYEX784NGHa9n0jRT1G7L0bfO5hjm0tWPb NCJg== X-Gm-Message-State: ALoCoQkwCYvH55CEQKiXa8x9r6MTIXSq+LAwdGO9G3rTD+T0OK6/LbV/uQm+VUwRQV5MuPsf9XbM X-Received: by 10.112.188.199 with SMTP id gc7mr354248lbc.6.1416526058653; Thu, 20 Nov 2014 15:27:38 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.176 with SMTP id az16ls100797lab.87.gmail; Thu, 20 Nov 2014 15:27:38 -0800 (PST) X-Received: by 10.112.136.37 with SMTP id px5mr971924lbb.36.1416526058420; Thu, 20 Nov 2014 15:27:38 -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 kw6si3419847lac.24.2014.11.20.15.27.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 15:27:38 -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 z11so3068718lbi.25 for ; Thu, 20 Nov 2014 15:27:38 -0800 (PST) X-Received: by 10.112.147.225 with SMTP id tn1mr850188lbb.37.1416526058333; Thu, 20 Nov 2014 15:27:38 -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 ew9csp358246lbc; Thu, 20 Nov 2014 15:27:37 -0800 (PST) X-Received: by 10.220.142.132 with SMTP id q4mr1313204vcu.36.1416526057034; Thu, 20 Nov 2014 15:27:37 -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 ey8si1593852vdb.66.2014.11.20.15.27.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Nov 2014 15:27:37 -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 1Xrb8Q-0000z2-DJ; Thu, 20 Nov 2014 23:27:34 +0000 Received: from mail-oi0-f54.google.com ([209.85.218.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xrb8C-0000yC-Q8 for lng-odp@lists.linaro.org; Thu, 20 Nov 2014 23:27:20 +0000 Received: by mail-oi0-f54.google.com with SMTP id u20so2841942oif.13 for ; Thu, 20 Nov 2014 15:27:15 -0800 (PST) X-Received: by 10.182.28.40 with SMTP id y8mr83352obg.57.1416526035548; Thu, 20 Nov 2014 15:27:15 -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 e5sm1462015oic.16.2014.11.20.15.27.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 15:27:15 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 20 Nov 2014 17:27:04 -0600 Message-Id: <1416526024-26384-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416526024-26384-1-git-send-email-bill.fischofer@linaro.org> References: <1416526024-26384-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 3/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.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 Signed-off-by: Bill Fischofer --- .../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