On 05/10/2017 08:14 PM, Dmitry Eremin-Solenikov wrote:
On 10.05.2017 20:13, Savolainen, Petri (Nokia - FI/Espoo) wrote:

-----Original Message-----
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
Dmitry Eremin-Solenikov
Sent: Wednesday, May 10, 2017 8:00 PM
To: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: [lng-odp] odp_packet_free_multi with invalid packets

Hello,

I was looking onto a shortcut code to free packets results from IPsec
call. Initially I wanted to just call odp_packet_free_multi() on top of
that array. However I noticed that the function segfaults if called with
an array containing ODP_PACKET_INVALID. Is it correct to call
odp_packet_free_multi() on top of such arrays, or I'd better handcode
such function checking and freeing packets one by one.
By default, results are undefined (may crash) if you pass bad handle (such as 
XXX_INVALID) to any ODP API. That's for performance, so that implementation 
does not validate always all handles from application.
Yes, I remember. Basically, I wonder if odp_packet_free_multi warrants a
lift of this rule or not, because freeing an array of packets, some of
which might be invalid might be a useful application optimizations.
Maybe we can define additional API like odp_packet_free_multi_safe() ?

what is you use case?  usually it's

odp_packet_t  pks[num];

sent = odp_packet_send(pks, num)

odp_packet_free(&pkts[num], num - sent)

I.e. there is invalid packets  in the middle of array.

Maxim.





Reply via email to