On Wed, Nov 30, 2016 at 8:09 AM, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> On 11/30/16 03:48, Bill Fischofer wrote:
>>
>> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2622 by
>> re-initializing origin_qe to NULL when a buffer is allocated. This step
>> was omitted in the switch to ring pool allocation introduced in
>> commit ID c8cf1d87783d4b4c628f219803b78731b8d4ade4
>>
>> Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
>> ---
>>   platform/linux-generic/odp_pool.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/platform/linux-generic/odp_pool.c
>> b/platform/linux-generic/odp_pool.c
>> index 4be3827..0b3d694 100644
>> --- a/platform/linux-generic/odp_pool.c
>> +++ b/platform/linux-generic/odp_pool.c
>> @@ -648,9 +648,12 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t
>> buf[],
>>                 cache->num = cache_num - num_ch;
>>         }
>>   -     if (buf_hdr) {
>> -               for (i = 0; i < num_ch; i++)
>> -                       buf_hdr[i] = buf_hdl_to_hdr(buf[i]);
>> +       for (i = 0; i < num_ch; i++) {
>> +               odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf[i]);
>> +
>> +               hdr->origin_qe = NULL;
>> +               if (buf_hdr)
>> +                       buf_hdr[i] = hdr;
>>         }
>>
>
>
> isn't it better unset orig_qe in loop in line 611? In that case you need to
> walk loop 2 times.

This seemed the cleanest place to put this. The issue is that the
rings contain buffer handles, not headers addresses, so I want to
minimize the number of times buf_hdl_to_hdr() is called. For Line 611,
that's only satisfying from the local cache, so you'd need to do a
similar operation on the global cache repopulation code that follows.
Having this here keeps it all in one place and is consistent with the
existing code to return buf_hdrs if requested.

>
> Maxim.
>
>>         return num_ch + num_deq;
>
>

Reply via email to