From patchwork Mon Dec 15 17:09:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 42269 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 095ED26C6C for ; Mon, 15 Dec 2014 17:11:07 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf7503333wgh.10 for ; Mon, 15 Dec 2014 09:11:06 -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=C5nuh984G8fNWINLSavNND7tk+4CniRV0N9HzpHQ5dY=; b=WIdCENm71cPiSeE41eMyFJzQIPxvcoukDIb4I8sobfmGE+7ESe1QHcCgo2PslpR/Qv d8vpocMA2uvSfzgd0soYmZ/JMHNVzyN7KTeEnPSEaI2fwctS8KXNjpeCyItWeHqZSy3V R9o0mrWS+6W/3xov9mtgdETpt9/ztlEhFDurO5Du7GGrhoxK9clCafG/hEWTlff9MJMh WyEvLrBtYPQ4TNo0i3tfSCxwP4Ty3SwVuprNTuyZ9yU8EtYQbvZsA11Jom13FpRg/ouS ILLbCLPE0kbA5GQG1eHk4OApA83lzI48wDHoUUUxgHNa3u3oypqFfUGsQKO23It2R2k+ QGjA== X-Gm-Message-State: ALoCoQn78qrM2fSOXj5qPpdwmNZQ9Iyy7sqLO5ptc1Gi5MSZ24UmTmLlZa+GBxe7K5gAQVWm5LUE X-Received: by 10.112.55.10 with SMTP id n10mr498265lbp.14.1418663466303; Mon, 15 Dec 2014 09:11:06 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.99 with SMTP id s3ls427872lag.79.gmail; Mon, 15 Dec 2014 09:11:06 -0800 (PST) X-Received: by 10.152.18.166 with SMTP id x6mr3773419lad.18.1418663466022; Mon, 15 Dec 2014 09:11:06 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id p2si7825827lah.113.2014.12.15.09.11.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 09:11:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id z12so9518834lbi.18 for ; Mon, 15 Dec 2014 09:11:05 -0800 (PST) X-Received: by 10.152.27.8 with SMTP id p8mr14514680lag.69.1418663465735; Mon, 15 Dec 2014 09:11:05 -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.142.69 with SMTP id ru5csp782153lbb; Mon, 15 Dec 2014 09:11:04 -0800 (PST) X-Received: by 10.224.55.145 with SMTP id u17mr57656830qag.12.1418663461887; Mon, 15 Dec 2014 09:11:01 -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 g2si11222749qas.95.2014.12.15.09.11.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 09:11:01 -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 1Y0ZAh-0000ws-7J; Mon, 15 Dec 2014 17:10:59 +0000 Received: from mail-lb0-f178.google.com ([209.85.217.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y0ZA0-0000cu-6a for lng-odp@lists.linaro.org; Mon, 15 Dec 2014 17:10:16 +0000 Received: by mail-lb0-f178.google.com with SMTP id f15so10625109lbj.9 for ; Mon, 15 Dec 2014 09:10:10 -0800 (PST) X-Received: by 10.112.199.138 with SMTP id jk10mr31192887lbc.86.1418663410657; Mon, 15 Dec 2014 09:10:10 -0800 (PST) Received: from localhost.localdomain ([80.77.38.170]) by mx.google.com with ESMTPSA id l9sm1208585lae.0.2014.12.15.09.10.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Dec 2014 09:10:09 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 15 Dec 2014 19:09:51 +0200 Message-Id: <1418663392-28354-7-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418663392-28354-1-git-send-email-taras.kondratiuk@linaro.org> References: <1418663392-28354-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv6 6/7] api: buffer: add pool info query 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: taras.kondratiuk@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.173 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 From: Bill Fischofer Signed-off-by: Bill Fischofer Signed-off-by: Taras Kondratiuk --- .../linux-generic/include/api/odp_buffer_pool.h | 28 ++++++++++++++++++++++ platform/linux-generic/odp_buffer_pool.c | 20 ++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h index 312b5f6..e6bf5a7 100644 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ b/platform/linux-generic/include/api/odp_buffer_pool.h @@ -104,6 +104,34 @@ int odp_buffer_pool_destroy(odp_buffer_pool_t pool); */ 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_NULL 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 diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index e2511af..e947dde 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -390,6 +390,26 @@ odp_buffer_pool_t odp_buffer_pool_lookup(const char *name) return ODP_BUFFER_POOL_INVALID; } +int odp_buffer_pool_info(odp_buffer_pool_t pool_hdl, + odp_buffer_pool_info_t *info) +{ + uint32_t pool_id = pool_handle_to_index(pool_hdl); + pool_entry_t *pool = get_pool_entry(pool_id); + + if (pool == NULL || info == NULL) + return -1; + + info->name = pool->s.name; + info->shm = pool->s.flags.user_supplied_shm ? + pool->s.pool_shm : ODP_SHM_NULL; + info->params.buf_size = pool->s.params.buf_size; + info->params.buf_align = pool->s.params.buf_align; + info->params.num_bufs = pool->s.params.num_bufs; + info->params.buf_type = pool->s.params.buf_type; + + return 0; +} + int odp_buffer_pool_destroy(odp_buffer_pool_t pool_hdl) { uint32_t pool_id = pool_handle_to_index(pool_hdl);