Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-10-05 Thread Nicolas Morey-Chaisemartin


On 09/30/2015 12:22 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>> Nicolas Morey-Chaisemartin
>> Sent: Tuesday, September 29, 2015 5:16 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to
>> alloc/free multiple packets at once
>>
>> Signed-off-by: Nicolas Morey-Chaisemartin 
>> ---
>>  include/odp/api/packet.h | 28 
>>  1 file changed, 28 insertions(+)
>>
>> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
>> index 5d46b7b..c220329 100644
>> --- a/include/odp/api/packet.h
>> +++ b/include/odp/api/packet.h
>> @@ -77,6 +77,23 @@ extern "C" {
>>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
>>
>>  /**
>> + * Allocate packets from a buffer pool
> Allocate multiple packets
>
> Otherwise like odp_packet_alloc(), but allocates multiple packets from a pool.
>
>> + *
>> + * @see odp_packet_alloc
>> + *
>> + * @param pool  Pool handle
>> + * @param len   Packet data length
>> + * @param pkt   Array of packet handles for output
>> + * @param num   Maximum number of packet to allocate
>  ^^
> packets
>
>> + *
>> + * @return Number of packet actually allocated (0 ... num)
> ^^
> packets
>
>> + * @retval <0 on failure
>> + *
>> + */
>> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
>> +   odp_packet_t pkt[], int num);
>> +
>> +/**
>>   * Free packet
>>   *
>>   * Frees the packet into the buffer pool it was allocated from.
>> @@ -86,6 +103,17 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t
>> len);
>>  void odp_packet_free(odp_packet_t pkt);
>>
>>  /**
>> + * Free packets
> Free multiple packets
>
> Otherwise like odp_packet_free(), but frees multiple packets to their 
> originating pools.
>
>> + *
>> + * Frees the packets into the buffer pools they were allocated from.
>> + * Packets may have been allocated from different pools.
>> + *
>> + * @param pkt   Packet handles
> Array of packet handles
>
>> + * @param len   Number of packet handles to free
> Should be 'num'. Did you test doxygen doc generation? It should have warned 
> you that "parameter 'num' is not documented", or something like that.
>
> Before sending v3, try
>
> make doxygen-html
>
>
> -Petri
>
Didn't know about this one thanks.
All doc updates fixed and ready for v3.

Thanks

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-10-05 Thread Nicolas Morey-Chaisemartin


On 09/29/2015 04:34 PM, Bill Fischofer wrote:
> On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin <
> nmo...@kalray.eu> wrote:
>
>
>> +
>> +/**
>>   * Free packet
>>   *
>>   * Frees the packet into the buffer pool it was allocated from.
>> @@ -86,6 +103,17 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool,
>> uint32_t len);
>>  void odp_packet_free(odp_packet_t pkt);
>>
>>  /**
>> + * Free packets
>> + *
>> + * Frees the packets into the buffer pools they were allocated from.
>> + * Packets may have been allocated from different pools.
>> + *
>> + * @param pkt   Packet handles
>> + * @param len   Number of packet handles to free
>> + */
>> +void odp_packet_free_multi(const odp_packet_t pkt[], int num);
>>
> Not clear why this needs to be const since the singleton free doesn't use
> this convention
>
>
>
Petri suggested it. It marks the array as const but as the result can't be 
really used afterward I'm not sure it's very useful.
But it doesn't hurt to add it.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-10-01 Thread Bill Fischofer
I agree if we're going to support multi calls then these are a reasonable
addition.  We'll also need an odp_tm_enq_multi() variant as well if we
don't have one already.

On Wed, Sep 30, 2015 at 6:08 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
> Application may very well need to create multiple packets, fill those and
> send into different destinations ...
>
> packet_alloc_multi(pkt[], 2);
>
> fill_packet(pkt[0], "192.168.0.1");
> fill_packet(pkt[1], "192.168.0.2");
>
> tm_enq_multi(dest, pkt, 2);
>
>
> ... or free multiple packets after reassembly ...
>
> deq_multi(pkt[], 3);
>
> new_pkt = reassemble(pkt[], 3);
>
> packet_free_multi(pkt, 3);
>
> tm_enq(dest, new_pkt);
>
>
> ... or drop everything ...
>
>
> num = schedule_multi(pkt[], 10);
>
> packet_free_multi(pkt[], num);
>
>
> True, in the common case application would not allocate and store packets
> (like above - it does not store, just works in bursts). Some application
> could also store packets for later use, and it's OK - e.g.  packet input
> and output pools may be different.
>
>
> -Petri
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> > Bala Manoharan
> > Sent: Wednesday, September 30, 2015 8:41 AM
> > To: Nicolas Morey-Chaisemartin
> > Cc: LNG ODP Mailman List
> > Subject: Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to
> > alloc/free multiple packets at once
> >
> > Hi,
> >
> > I am not sure whether we need this call for alloc multiple packets at
> once.
> > The reason being in a high speed data plane system the packets which
> > are allocated and not processed will result in holding up of pool
> > space which will result in dropping of the incoming packets if the
> > pool space is depleted.
> >
> > So it will always be advisable to allocated the packets as soon as the
> > core is ready to process them rather than allocating an array of
> > packets in a single call and then processing them in a serial manner.
> > Maybe it would be better if you can define the use-case and advantages
> > of allocating the packets in a single API and then we can decide if
> > this API is needed.
> >
> > Regards,
> > Bala
> >
> > On 29 September 2015 at 22:34, Nicolas Morey-Chaisemartin
> >  wrote:
> > >
> > >
> > > On 09/29/2015 04:34 PM, Bill Fischofer wrote:
> > >
> > >
> > >
> > > On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin
> > >  wrote:
> > >>
> > >> Signed-off-by: Nicolas Morey-Chaisemartin 
> > >> ---
> > >>  include/odp/api/packet.h | 28 
> > >>  1 file changed, 28 insertions(+)
> > >>
> > >> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> > >> index 5d46b7b..c220329 100644
> > >> --- a/include/odp/api/packet.h
> > >> +++ b/include/odp/api/packet.h
> > >> @@ -77,6 +77,23 @@ extern "C" {
> > >>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
> > >>
> > >>  /**
> > >> + * Allocate packets from a buffer pool
> > >> + *
> > >> + * @see odp_packet_alloc
> > >> + *
> > >> + * @param pool  Pool handle
> > >> + * @param len   Packet data length
> > >> + * @param pkt   Array of packet handles for output
> > >> + * @param num   Maximum number of packet to allocate
> > >> + *
> > >> + * @return Number of packet actually allocated (0 ... num)
> > >> + * @retval <0 on failure
> > >> + *
> > >> + */
> > >> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
> > >> +  odp_packet_t pkt[], int num);
> > >
> > >
> > >
> > > 3rd parameter is an output array, so should be *odp_packet_t pkt[]
> > > Should 2nd parameter also be an array or is it sufficient to restrict
> > this
> > > to allocating all pkts of the same length?
> > >
> > >
> > > I am not sure there is a way to efficiently alloc multiple packets with
> > > different sizes at once. And making sure all len are the same will
> reduce
> > > the benefits of having a simple multi alloc.
> > > If someone has a use case where a multiple len multi alloc is useful,
> we
> > can
> > > either tweak this call or add another one.
> > >
> > > Nicolas
> > >
> > > ___
> > > lng-odp mailing list
> > > lng-odp@lists.linaro.org
> > > https://lists.linaro.org/mailman/listinfo/lng-odp
> > >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-30 Thread Savolainen, Petri (Nokia - FI/Espoo)

Application may very well need to create multiple packets, fill those and send 
into different destinations ...

packet_alloc_multi(pkt[], 2);

fill_packet(pkt[0], "192.168.0.1");
fill_packet(pkt[1], "192.168.0.2");

tm_enq_multi(dest, pkt, 2);


... or free multiple packets after reassembly ...

deq_multi(pkt[], 3);

new_pkt = reassemble(pkt[], 3);

packet_free_multi(pkt, 3);

tm_enq(dest, new_pkt);


... or drop everything ...


num = schedule_multi(pkt[], 10);

packet_free_multi(pkt[], num);


True, in the common case application would not allocate and store packets (like 
above - it does not store, just works in bursts). Some application could also 
store packets for later use, and it's OK - e.g.  packet input and output pools 
may be different.


-Petri


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Bala Manoharan
> Sent: Wednesday, September 30, 2015 8:41 AM
> To: Nicolas Morey-Chaisemartin
> Cc: LNG ODP Mailman List
> Subject: Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to
> alloc/free multiple packets at once
> 
> Hi,
> 
> I am not sure whether we need this call for alloc multiple packets at once.
> The reason being in a high speed data plane system the packets which
> are allocated and not processed will result in holding up of pool
> space which will result in dropping of the incoming packets if the
> pool space is depleted.
> 
> So it will always be advisable to allocated the packets as soon as the
> core is ready to process them rather than allocating an array of
> packets in a single call and then processing them in a serial manner.
> Maybe it would be better if you can define the use-case and advantages
> of allocating the packets in a single API and then we can decide if
> this API is needed.
> 
> Regards,
> Bala
> 
> On 29 September 2015 at 22:34, Nicolas Morey-Chaisemartin
>  wrote:
> >
> >
> > On 09/29/2015 04:34 PM, Bill Fischofer wrote:
> >
> >
> >
> > On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin
> >  wrote:
> >>
> >> Signed-off-by: Nicolas Morey-Chaisemartin 
> >> ---
> >>  include/odp/api/packet.h | 28 
> >>  1 file changed, 28 insertions(+)
> >>
> >> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> >> index 5d46b7b..c220329 100644
> >> --- a/include/odp/api/packet.h
> >> +++ b/include/odp/api/packet.h
> >> @@ -77,6 +77,23 @@ extern "C" {
> >>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
> >>
> >>  /**
> >> + * Allocate packets from a buffer pool
> >> + *
> >> + * @see odp_packet_alloc
> >> + *
> >> + * @param pool  Pool handle
> >> + * @param len   Packet data length
> >> + * @param pkt   Array of packet handles for output
> >> + * @param num   Maximum number of packet to allocate
> >> + *
> >> + * @return Number of packet actually allocated (0 ... num)
> >> + * @retval <0 on failure
> >> + *
> >> + */
> >> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
> >> +  odp_packet_t pkt[], int num);
> >
> >
> >
> > 3rd parameter is an output array, so should be *odp_packet_t pkt[]
> > Should 2nd parameter also be an array or is it sufficient to restrict
> this
> > to allocating all pkts of the same length?
> >
> >
> > I am not sure there is a way to efficiently alloc multiple packets with
> > different sizes at once. And making sure all len are the same will reduce
> > the benefits of having a simple multi alloc.
> > If someone has a use case where a multiple len multi alloc is useful, we
> can
> > either tweak this call or add another one.
> >
> > Nicolas
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-30 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Nicolas Morey-Chaisemartin
> Sent: Tuesday, September 29, 2015 5:16 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to
> alloc/free multiple packets at once
> 
> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
>  include/odp/api/packet.h | 28 
>  1 file changed, 28 insertions(+)
> 
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 5d46b7b..c220329 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -77,6 +77,23 @@ extern "C" {
>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
> 
>  /**
> + * Allocate packets from a buffer pool

Allocate multiple packets

Otherwise like odp_packet_alloc(), but allocates multiple packets from a pool.

> + *
> + * @see odp_packet_alloc
> + *
> + * @param pool  Pool handle
> + * @param len   Packet data length
> + * @param pkt   Array of packet handles for output
> + * @param num   Maximum number of packet to allocate
 ^^
packets

> + *
> + * @return Number of packet actually allocated (0 ... num)
^^
packets

> + * @retval <0 on failure
> + *
> + */
> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
> +odp_packet_t pkt[], int num);
> +
> +/**
>   * Free packet
>   *
>   * Frees the packet into the buffer pool it was allocated from.
> @@ -86,6 +103,17 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t
> len);
>  void odp_packet_free(odp_packet_t pkt);
> 
>  /**
> + * Free packets

Free multiple packets

Otherwise like odp_packet_free(), but frees multiple packets to their 
originating pools.

> + *
> + * Frees the packets into the buffer pools they were allocated from.
> + * Packets may have been allocated from different pools.
> + *
> + * @param pkt   Packet handles

Array of packet handles

> + * @param len   Number of packet handles to free

Should be 'num'. Did you test doxygen doc generation? It should have warned you 
that "parameter 'num' is not documented", or something like that.

Before sending v3, try

make doxygen-html


-Petri


> + */
> +void odp_packet_free_multi(const odp_packet_t pkt[], int num);
> +
> +/**
>   * Reset packet
>   *
>   * Resets all packet metadata to their default values. Packet length is
> used
> --
> 2.5.0.3.gba4f141
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-29 Thread Bala Manoharan
Hi,

I am not sure whether we need this call for alloc multiple packets at once.
The reason being in a high speed data plane system the packets which
are allocated and not processed will result in holding up of pool
space which will result in dropping of the incoming packets if the
pool space is depleted.

So it will always be advisable to allocated the packets as soon as the
core is ready to process them rather than allocating an array of
packets in a single call and then processing them in a serial manner.
Maybe it would be better if you can define the use-case and advantages
of allocating the packets in a single API and then we can decide if
this API is needed.

Regards,
Bala

On 29 September 2015 at 22:34, Nicolas Morey-Chaisemartin
 wrote:
>
>
> On 09/29/2015 04:34 PM, Bill Fischofer wrote:
>
>
>
> On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin
>  wrote:
>>
>> Signed-off-by: Nicolas Morey-Chaisemartin 
>> ---
>>  include/odp/api/packet.h | 28 
>>  1 file changed, 28 insertions(+)
>>
>> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
>> index 5d46b7b..c220329 100644
>> --- a/include/odp/api/packet.h
>> +++ b/include/odp/api/packet.h
>> @@ -77,6 +77,23 @@ extern "C" {
>>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
>>
>>  /**
>> + * Allocate packets from a buffer pool
>> + *
>> + * @see odp_packet_alloc
>> + *
>> + * @param pool  Pool handle
>> + * @param len   Packet data length
>> + * @param pkt   Array of packet handles for output
>> + * @param num   Maximum number of packet to allocate
>> + *
>> + * @return Number of packet actually allocated (0 ... num)
>> + * @retval <0 on failure
>> + *
>> + */
>> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
>> +  odp_packet_t pkt[], int num);
>
>
>
> 3rd parameter is an output array, so should be *odp_packet_t pkt[]
> Should 2nd parameter also be an array or is it sufficient to restrict this
> to allocating all pkts of the same length?
>
>
> I am not sure there is a way to efficiently alloc multiple packets with
> different sizes at once. And making sure all len are the same will reduce
> the benefits of having a simple multi alloc.
> If someone has a use case where a multiple len multi alloc is useful, we can
> either tweak this call or add another one.
>
> Nicolas
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-29 Thread Nicolas Morey-Chaisemartin


On 09/29/2015 04:34 PM, Bill Fischofer wrote:
>
>
> On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin  > wrote:
>
> Signed-off-by: Nicolas Morey-Chaisemartin  >
> ---
>  include/odp/api/packet.h | 28 
>  1 file changed, 28 insertions(+)
>
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 5d46b7b..c220329 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -77,6 +77,23 @@ extern "C" {
>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
>
>  /**
> + * Allocate packets from a buffer pool
> + *
> + * @see odp_packet_alloc
> + *
> + * @param pool  Pool handle
> + * @param len   Packet data length
> + * @param pkt   Array of packet handles for output
> + * @param num   Maximum number of packet to allocate
> + *
> + * @return Number of packet actually allocated (0 ... num)
> + * @retval <0 on failure
> + *
> + */
> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
> +  odp_packet_t pkt[], int num);
>
>
>
> 3rd parameter is an output array, so should be *odp_packet_t pkt[]
> Should 2nd parameter also be an array or is it sufficient to restrict this to 
> allocating all pkts of the same length?

I am not sure there is a way to efficiently alloc multiple packets with 
different sizes at once. And making sure all len are the same will reduce the 
benefits of having a simple multi alloc.
If someone has a use case where a multiple len multi alloc is useful, we can 
either tweak this call or add another one.

Nicolas
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-29 Thread Bill Fischofer
On Tue, Sep 29, 2015 at 9:15 AM, Nicolas Morey-Chaisemartin <
nmo...@kalray.eu> wrote:

> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
>  include/odp/api/packet.h | 28 
>  1 file changed, 28 insertions(+)
>
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 5d46b7b..c220329 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -77,6 +77,23 @@ extern "C" {
>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
>
>  /**
> + * Allocate packets from a buffer pool
> + *
> + * @see odp_packet_alloc
> + *
> + * @param pool  Pool handle
> + * @param len   Packet data length
> + * @param pkt   Array of packet handles for output
> + * @param num   Maximum number of packet to allocate
> + *
> + * @return Number of packet actually allocated (0 ... num)
> + * @retval <0 on failure
> + *
> + */
> +int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
> +  odp_packet_t pkt[], int num);
>


3rd parameter is an output array, so should be *odp_packet_t pkt[]
Should 2nd parameter also be an array or is it sufficient to restrict this
to allocating all pkts of the same length?


> +
> +/**
>   * Free packet
>   *
>   * Frees the packet into the buffer pool it was allocated from.
> @@ -86,6 +103,17 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool,
> uint32_t len);
>  void odp_packet_free(odp_packet_t pkt);
>
>  /**
> + * Free packets
> + *
> + * Frees the packets into the buffer pools they were allocated from.
> + * Packets may have been allocated from different pools.
> + *
> + * @param pkt   Packet handles
> + * @param len   Number of packet handles to free
> + */
> +void odp_packet_free_multi(const odp_packet_t pkt[], int num);
>

Not clear why this needs to be const since the singleton free doesn't use
this convention


> +
> +/**
>   * Reset packet
>   *
>   * Resets all packet metadata to their default values. Packet length is
> used
> --
> 2.5.0.3.gba4f141
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXTv2 2/7] api: packet: add functions to alloc/free multiple packets at once

2015-09-29 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin 
---
 include/odp/api/packet.h | 28 
 1 file changed, 28 insertions(+)

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 5d46b7b..c220329 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -77,6 +77,23 @@ extern "C" {
 odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
 
 /**
+ * Allocate packets from a buffer pool
+ *
+ * @see odp_packet_alloc
+ *
+ * @param pool  Pool handle
+ * @param len   Packet data length
+ * @param pkt   Array of packet handles for output
+ * @param num   Maximum number of packet to allocate
+ *
+ * @return Number of packet actually allocated (0 ... num)
+ * @retval <0 on failure
+ *
+ */
+int odp_packet_alloc_multi(odp_pool_t pool, uint32_t len,
+  odp_packet_t pkt[], int num);
+
+/**
  * Free packet
  *
  * Frees the packet into the buffer pool it was allocated from.
@@ -86,6 +103,17 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t 
len);
 void odp_packet_free(odp_packet_t pkt);
 
 /**
+ * Free packets
+ *
+ * Frees the packets into the buffer pools they were allocated from.
+ * Packets may have been allocated from different pools.
+ *
+ * @param pkt   Packet handles
+ * @param len   Number of packet handles to free
+ */
+void odp_packet_free_multi(const odp_packet_t pkt[], int num);
+
+/**
  * Reset packet
  *
  * Resets all packet metadata to their default values. Packet length is used
-- 
2.5.0.3.gba4f141


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp