From patchwork Wed Sep 24 20:12:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 37867 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4869C204FF for ; Wed, 24 Sep 2014 20:13:07 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id w62sf3205047wes.11 for ; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) 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:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=L7dQEJMcbGK2geYHIGEQkMn0en8evdYfIMpXUsa2auw=; b=aqSyP/26Ms1z5QuaLZT83N8PCRWaVkZai763yKwffz+HP/frFiS+2s+xeUvu/ukH+C nSBJO5CbIXojk2fsBYAemMZXrnNPoFdJKiMrTWLo6WL1dcxazR0dh1IvXJ177mvnwJFb qvzWrnEnZFEyVDI8pgUKu54b4hxKEPC9QVfEF508fAgsXLpf1n/GmI6o9o7Ci52SMpHY JzvQKouWKwZf55LavrFx4I1TPnmAtyszbDkOB9Zd6Wyh7xTnkSJctbXw6GuHQ3hUSUXE 9m0LGBzE7VBqEoj4vhIfLh4Imvtxa01McmNzfzJxHmC4k8DpqVjAR/0WzNrOQgvBK1FG tLVQ== X-Gm-Message-State: ALoCoQl9mkgovfSts24rsq1CVbeaWtaMtd5OZJgYuHgur+Ac+jaz2q/OHaQosNHfoqR8cKQpa6Ga X-Received: by 10.112.146.2 with SMTP id sy2mr796384lbb.14.1411589586469; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.99 with SMTP id x3ls199943laj.90.gmail; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) X-Received: by 10.112.235.70 with SMTP id uk6mr3551424lbc.89.1411589586194; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx.google.com with ESMTPS id lj3si240306lab.102.2014.09.24.13.13.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 13:13:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id s18so11432542lam.14 for ; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) X-Received: by 10.152.179.226 with SMTP id dj2mr8822992lac.40.1411589586010; Wed, 24 Sep 2014 13:13:06 -0700 (PDT) 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.130.169 with SMTP id of9csp647187lbb; Wed, 24 Sep 2014 13:13:05 -0700 (PDT) X-Received: by 10.140.81.42 with SMTP id e39mr13626679qgd.60.1411589584665; Wed, 24 Sep 2014 13:13:04 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id a5si364113qak.11.2014.09.24.13.13.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 13:13:04 -0700 (PDT) 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 1XWsvu-0005rj-MI; Wed, 24 Sep 2014 20:13:02 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XWsvl-0005rI-Sa for lng-odp@lists.linaro.org; Wed, 24 Sep 2014 20:12:54 +0000 Received: by mail-lb0-f173.google.com with SMTP id 10so9575429lbg.4 for ; Wed, 24 Sep 2014 13:12:48 -0700 (PDT) X-Received: by 10.112.210.197 with SMTP id mw5mr8440916lbc.20.1411589567984; Wed, 24 Sep 2014 13:12:47 -0700 (PDT) Received: from localhost (c-853670d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.54.133]) by mx.google.com with ESMTPSA id o4sm92753lao.32.2014.09.24.13.12.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 13:12:47 -0700 (PDT) From: Anders Roxell To: lng-odp@lists.linaro.org Date: Wed, 24 Sep 2014 22:12:39 +0200 Message-Id: <1411589561-20050-2-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411589561-20050-1-git-send-email-anders.roxell@linaro.org> References: <1411589561-20050-1-git-send-email-anders.roxell@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH] Add API odp_buffer_pool_delete 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: anders.roxell@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.41 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: Anders Roxell --- .../linux-generic/include/api/odp_buffer_pool.h | 9 ++++++++ platform/linux-generic/odp_buffer_pool.c | 25 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h b/platform/linux-generic/include/api/odp_buffer_pool.h index fe88898..fca2c62 100644 --- a/platform/linux-generic/include/api/odp_buffer_pool.h +++ b/platform/linux-generic/include/api/odp_buffer_pool.h @@ -34,6 +34,15 @@ typedef uint32_t odp_buffer_pool_t; /** + * Delete a buffer pool + * + * @param pool_hdl Buffer pool handle + * + * @return 0 if successful else -1 + */ +int odp_buffer_pool_delete(odp_buffer_pool_t pool_hdl); + +/** * Create a buffer pool * * @param name Name of the pool (max ODP_BUFFER_POOL_NAME_LEN - 1 chars) diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index 4d9ff45..7ba793d 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -375,6 +375,31 @@ static void link_bufs(pool_entry_t *pool) } } +int odp_buffer_pool_delete(odp_buffer_pool_t pool_hdl) +{ + pool_entry_t *pool; + if (odp_unlikely(ODP_CONFIG_BUFFER_POOLS <= pool_hdl)) + ODP_ERR("set_handle: Bad pool handle %u\n", pool_hdl); + + pool = get_pool_entry(pool_hdl); + pool->s.free_bufs = 0; + strcpy(pool->s.name, ""); + /* Need to restore this because this is setup in + * odp_buffer_pool_init_global + * */ + pool->s.pool_hdl = pool_hdl; + pool->s.buf_base = 0; + pool->s.buf_size = 0; + pool->s.buf_offset = 0; + pool->s.num_bufs = 0; + pool->s.pool_base_addr = NULL; + pool->s.pool_size = 0; + pool->s.user_size = 0; + pool->s.user_align = 0; + pool->s.buf_type = ODP_BUFFER_POOL_INVALID; + pool->s.hdr_size = 0; + return 0; +} odp_buffer_pool_t odp_buffer_pool_create(const char *name, void *base_addr, uint64_t size,