Add API odp_buffer_pool_delete

Message ID 1411589561-20050-2-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Sept. 24, 2014, 8:12 p.m.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 .../linux-generic/include/api/odp_buffer_pool.h    |  9 ++++++++
 platform/linux-generic/odp_buffer_pool.c           | 25 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

Comments

Anders Roxell Sept. 25, 2014, 12:48 p.m. | #1
On 24 September 2014 22:12, Anders Roxell <anders.roxell@linaro.org> wrote:

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  .../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,
> --
> 2.1.0
>
>

Hi all,

I had a chat with Ola and he proposed destroy instead of delete

I think I like odp_buffer_pool_destroy more than what I've done in the
patch odp_buffer_pool_delete... =)

Comments?

Cheers,
Anders
Balasubramanian Manoharan Sept. 25, 2014, 2:27 p.m. | #2
Hi,

IMO, both are fine also  I would like to see some guideline as to when to
use destroy and delete accordingly.

So if you create() an entity then its corresponding should be destroy() (ie
in case of BUFFER_POOL)
 and if you alloc() an entity then its corresponding should be free() (i.e
in case of BUFFER ).

Maybe something like,
create <--> destroy
alloc <----> free
new <---> delete

Regards,
Bala

On 25 September 2014 18:18, Anders Roxell <anders.roxell@linaro.org> wrote:

>
>
> On 24 September 2014 22:12, Anders Roxell <anders.roxell@linaro.org>
> wrote:
>
>> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>> ---
>>  .../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,
>> --
>> 2.1.0
>>
>>
>
> Hi all,
>
> I had a chat with Ola and he proposed destroy instead of delete
>
> I think I like odp_buffer_pool_destroy more than what I've done in the
> patch odp_buffer_pool_delete... =)
>
> Comments?
>
> Cheers,
> Anders
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Bill Fischofer Sept. 25, 2014, 2:56 p.m. | #3
Agree we should be consistent across the APIs.  Bala's proposed convention
seems reasonable.  I'll update the doc to reflect that if there are no
objections.

On Thu, Sep 25, 2014 at 9:27 AM, Bala Manoharan <bala.manoharan@linaro.org>
wrote:

> Hi,
>
> IMO, both are fine also  I would like to see some guideline as to when to
> use destroy and delete accordingly.
>
> So if you create() an entity then its corresponding should be destroy()
> (ie in case of BUFFER_POOL)
>  and if you alloc() an entity then its corresponding should be free() (i.e
> in case of BUFFER ).
>
> Maybe something like,
> create <--> destroy
> alloc <----> free
> new <---> delete
>
> Regards,
> Bala
>
> On 25 September 2014 18:18, Anders Roxell <anders.roxell@linaro.org>
> wrote:
>
>>
>>
>> On 24 September 2014 22:12, Anders Roxell <anders.roxell@linaro.org>
>> wrote:
>>
>>> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>>> ---
>>>  .../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,
>>> --
>>> 2.1.0
>>>
>>>
>>
>> Hi all,
>>
>> I had a chat with Ola and he proposed destroy instead of delete
>>
>> I think I like odp_buffer_pool_destroy more than what I've done in the
>> patch odp_buffer_pool_delete... =)
>>
>> Comments?
>>
>> Cheers,
>> Anders
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Mike Holmes Sept. 25, 2014, 3:02 p.m. | #4
I like it but what is the difference between them in more detail ?

create <--> destroy
these operate on something that still has some sense of existence after
destroy such as returning something to a buffer pool so that it still
exists as a space in a carved out region of memory.

alloc <----> free
new <---> delete
These are the same? They refer to completely erasing something so that
there absolutely no trace ? Should we pick one set of names ?

what about odp_x_init  what is the opposite of init ?

On 25 September 2014 10:56, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> Agree we should be consistent across the APIs.  Bala's proposed convention
> seems reasonable.  I'll update the doc to reflect that if there are no
> objections.
>
> On Thu, Sep 25, 2014 at 9:27 AM, Bala Manoharan <bala.manoharan@linaro.org
> > wrote:
>
>> Hi,
>>
>> IMO, both are fine also  I would like to see some guideline as to when to
>> use destroy and delete accordingly.
>>
>> So if you create() an entity then its corresponding should be destroy()
>> (ie in case of BUFFER_POOL)
>>  and if you alloc() an entity then its corresponding should be free()
>> (i.e in case of BUFFER ).
>>
>> Maybe something like,
>> create <--> destroy
>> alloc <----> free
>> new <---> delete
>>
>> Regards,
>> Bala
>>
>> On 25 September 2014 18:18, Anders Roxell <anders.roxell@linaro.org>
>> wrote:
>>
>>>
>>>
>>> On 24 September 2014 22:12, Anders Roxell <anders.roxell@linaro.org>
>>> wrote:
>>>
>>>> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>>>> ---
>>>>  .../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,
>>>> --
>>>> 2.1.0
>>>>
>>>>
>>>
>>> Hi all,
>>>
>>> I had a chat with Ola and he proposed destroy instead of delete
>>>
>>> I think I like odp_buffer_pool_destroy more than what I've done in the
>>> patch odp_buffer_pool_delete... =)
>>>
>>> Comments?
>>>
>>> Cheers,
>>> Anders
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Bill Fischofer Sept. 25, 2014, 3:05 p.m. | #5
The usual counterpart to init is term (for initialize/terminate).

Bill

On Thu, Sep 25, 2014 at 10:02 AM, Mike Holmes <mike.holmes@linaro.org>
wrote:

> I like it but what is the difference between them in more detail ?
>
> create <--> destroy
> these operate on something that still has some sense of existence after
> destroy such as returning something to a buffer pool so that it still
> exists as a space in a carved out region of memory.
>
> alloc <----> free
> new <---> delete
> These are the same? They refer to completely erasing something so that
> there absolutely no trace ? Should we pick one set of names ?
>
> what about odp_x_init  what is the opposite of init ?
>
> On 25 September 2014 10:56, Bill Fischofer <bill.fischofer@linaro.org>
> wrote:
>
>> Agree we should be consistent across the APIs.  Bala's proposed
>> convention seems reasonable.  I'll update the doc to reflect that if there
>> are no objections.
>>
>> On Thu, Sep 25, 2014 at 9:27 AM, Bala Manoharan <
>> bala.manoharan@linaro.org> wrote:
>>
>>> Hi,
>>>
>>> IMO, both are fine also  I would like to see some guideline as to when
>>> to use destroy and delete accordingly.
>>>
>>> So if you create() an entity then its corresponding should be destroy()
>>> (ie in case of BUFFER_POOL)
>>>  and if you alloc() an entity then its corresponding should be free()
>>> (i.e in case of BUFFER ).
>>>
>>> Maybe something like,
>>> create <--> destroy
>>> alloc <----> free
>>> new <---> delete
>>>
>>> Regards,
>>> Bala
>>>
>>> On 25 September 2014 18:18, Anders Roxell <anders.roxell@linaro.org>
>>> wrote:
>>>
>>>>
>>>>
>>>> On 24 September 2014 22:12, Anders Roxell <anders.roxell@linaro.org>
>>>> wrote:
>>>>
>>>>> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>>>>> ---
>>>>>  .../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,
>>>>> --
>>>>> 2.1.0
>>>>>
>>>>>
>>>>
>>>> Hi all,
>>>>
>>>> I had a chat with Ola and he proposed destroy instead of delete
>>>>
>>>> I think I like odp_buffer_pool_destroy more than what I've done in the
>>>> patch odp_buffer_pool_delete... =)
>>>>
>>>> Comments?
>>>>
>>>> Cheers,
>>>> Anders
>>>>
>>>> _______________________________________________
>>>> lng-odp mailing list
>>>> lng-odp@lists.linaro.org
>>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>>>
>>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
>
> --
> *Mike Holmes*
> Linaro Technical Manager / Lead
> LNG - ODP
>

Patch

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,