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