On 1 August 2017 at 06:57, Bill Fischofer <bill.fischo...@linaro.org> wrote:
> ODP pools are objects of type odp_pool_t that store objects that can be
> allocated and freed via their own alloc/free calls. Pools come in three
> types determined at odp_pool_create() time:
>
> - ODP_POOL_BUFFER for odp_buffer_t objects
> - ODP_POOL_PACKET for odp_packet_t objects
> - ODP_POOL_TIMEOUT for odp_timeout_t objects
>
> The only commonality in these types is that they are types of odp_event_t
> and are aggregated through pools. They cannot be converted to each other via
> any ODP API.
>
I see event types of ODP_EVENT_CRYPTO_COMPL and
ODP_EVENT_IPSEC_STATUS. I do not see the corresponding pool types and
they are not event subtypes as well.

>From the APIs I understand that the buffer (odp_buffer_t) is expected
to have meta data, it is not just a plain memory pointer. What are the
use cases for the buffers?

> Beyond this, implementations are free to implement them however they wish.
> In the case of odp-linux, we've chosen to consider buffers to be a base type
> and derive packets and timeouts from them. So in odp-linux these share
> certain internal structures that are common to pools. In odp-linux a packet
> is a buffer with additional metadata and a timeout is a buffer with
> additional metadata. But again, there is no architectural requirement here
> since there are no ODP APIs that expose this relationship, so
> implementations may organize these differently if they choose.
>
> Contrast this with the newly defined event subtypes. Here an
> ODP_EVENT_PACKET_IPSEC or an ODP_EVENT_PACKET_CRYPTO are both
> ODP_EVENT_PACKETs and the object is an odp_packet_t even though you cannot
> convert from one subtype to another. So here the relationship between
> subtypes is architecturally defined and subtypes exist to formalize the
> notion that these subtypes share common metadata and differ in optional
> metadata between themselves.
>
> On Tue, Aug 1, 2017 at 4:24 AM, Maxim Uvarov <maxim.uva...@linaro.org>
> wrote:
>>
>> They are not linked. Packet might be different than buffers.
>>
>> Conversion with event is not really clear in implementation and has to
>> check event type match. I.e. only ODP_EVENT_BUFFER type event can be
>> created from buffer. If you need create packet, then alloc it and copy
>> data
>> to it with odp_packet_copy_data() for example.
>>
>> typedef enum odp_event_type_t {
>>         ODP_EVENT_BUFFER       = 1,
>>         ODP_EVENT_PACKET       = 2,
>>         ODP_EVENT_TIMEOUT      = 3,
>>         ODP_EVENT_CRYPTO_COMPL = 4
>> } odp_event_type_t;
>>
>> odp_buffer_t odp_buffer_from_event(odp_event_t ev)
>> {
>> <--- here we need check that it's ODP_EVENT_BUFFER
>>
>>         return (odp_buffer_t)ev;
>> }
>>
>> odp_packet_t odp_packet_from_event(odp_event_t ev)
>> {
>>         if (odp_unlikely(ev == ODP_EVENT_INVALID))
>>                 return ODP_PACKET_INVALID;
>> <--- here we need check that it's ODP_EVENT_PACKET
>>
>>         return (odp_packet_t)buf_to_packet_hdr((odp_buffer_t)ev);
>> }
>>
>> Best regards,
>> Maxim.
>>
>>
>>
>> On 1 August 2017 at 07:04, Honnappa Nagarahalli <
>> honnappa.nagaraha...@linaro.org> wrote:
>>
>> > Hi,
>> >    I do not see anything in the API spec that mentions that
>> > odp_packet_t has to be derived from odp_buffer_t. I am asking the
>> > question because, in Linux-generic, odp_packet_t is derived from
>> > odp_buffer_t.
>> >
>> > Thank you,
>> > Honnappa
>> >
>
>

Reply via email to