On 02/28/17 16:49, Maxim Uvarov wrote:
> On 02/28/17 16:22, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>>
>>
>> From: Bill Fischofer [mailto:bill.fischo...@linaro.org] 
>> Sent: Tuesday, February 28, 2017 2:58 PM
>> To: Savolainen, Petri (Nokia - FI/Espoo) 
>> <petri.savolai...@nokia-bell-labs.com>
>> Cc: Maxim Uvarov <maxim.uva...@linaro.org>; lng-odp@lists.linaro.org
>> Subject: Re: [lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle 
>> conversion function
>>
>> Your series also includes TM (good catch) so it seems this need extends 
>> beyond just IPC. 
>>
>>
>> TM does not do pkt_hdr->pkt_hdl conversion, but buf_hdl -> pkt_hdl 
>> conversion.
>>
>> -    odp_packet_t pkt = (odp_packet_t)buf_hdr->handle.handle;
>> +    odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);
>>
>>
>> Maybe IPC should not record pkt header pointers into the ring, but packet 
>> handles instead.
>>
>> -Petri
>>


One of first version worked with handles.

But after that it was needed to recalculate handle to block_offset for
each packet. And multiply was match slower then base_addr + offset.


        handle.handle = buf;
        index         = handle.index;
        block_offset  = index * pool->block_size;

        /* clang requires cast to uintptr_t */
        buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)&pool->base_addr[block_offset];




>>
> 
> We can do for now absolutely the same for IPC. That works:
> 
> 
>                         void *mbase = pktio_entry->s.ipc.pool_mdata_base;
> 
>                         phdr = (void *)((uint8_t *)mbase + offsets[i]);
> -                       pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
> +                       pkt =
> _odp_packet_from_buffer(phdr->buf_hdr.handle.handle);
>                         odp_packet_free(pkt);
> 

Reply via email to