On Wed, Jul 12, 2017 at 11:16 AM, shally verma
<shallyvermacav...@gmail.com> wrote:
> On Wed, Jul 12, 2017 at 8:50 PM, Bill Fischofer
> <bill.fischo...@linaro.org> wrote:
>> On Wed, Jul 12, 2017 at 7:35 AM, shally verma
>> <shallyvermacav...@gmail.com> wrote:
>>> I have a question on odp_pktin_recv(odp_pktin_queue_t, odp_packet_t [], 
>>> int).
>>>
>>> Once app receives packets associated to the queue, what happens to
>>> packets buffers passed to application? Does implementation always
>>> assume that packets will be freed by caller and re-allocates fresh
>>> packets to queue?
>>
>> Once an application receives a packet via this or any other call, e.g,
>> odp_queue_deq(), odp_schedule(), etc., the application owns the packet
>> and must dispose of it either by passing it on to some other entity,
>> e.g., via odp_queue_enq(), or else freeing it via odp_packet_free().
>> Packet lifecycle management is always explicit so there is no garbage
>> collection for "abandoned" packets--those would be memory leaks.
>>
>>>
>>> I referred to packet_io.h spec to understand more on this after
>>> pktin_rcv() but didn't get clear information as there seem no
>>> handshake mechanism between caller and implementation to indicate that
>>> packet buffers are free and can be re-used. So looks like there is
>>> implicit assumption that packets are not re-usable after
>>> odp_pktin_rcv() call.
>>
>> A packet is "reused" by either passing it along to some other
>> processing element, or else by freeing it back to its pool, from where
>> it may be reallocated by someone else.
>>Some APIs may consume packets
>> and return new versions of them, in which case the free/alloc is done
>> by the called API.
>>
> what do we mean by newer version here? You mean new versions are
> returned to pktin? if so, how which API do that?
> As for our purpose, we want to avoid free/alloc and rather reuse once
> application has used them. Seems no option available for same.
> Similar question is on pktout_send(), once implementation send the
> packets out to interface, who keeps responsibility to free them?

Certain APIs, e.g., the APIs for extending / truncating packet head /
tail, add_data, rem_data, align, etc. may return the same packet
handle or a replacement packet handle. This is to allow
implementations flexibility in how the internals of packets are
managed. Applications need to use the handles returned from these APIs
rather than trying to cache copies of them across these calls. APIs
that behave this was state so in their documentation.

>
> Thanks
> Shally
>
>>>
>>> Could anyone please confirm.
>>>
>>> Thanks
>>> Shally

Reply via email to