On 10/14/2015 08:48 AM, Maxim Uvarov wrote:
> On 10/13/2015 20:05, Nicolas Morey-Chaisemartin wrote:
>> Right now, pktio_term calls term on all pktio type but
>> some pktio might still be be opened. Although the user should
>> probably close its pktio before termintating the application,
>> it is safer to iterate on all pktio and close them in the
>> pktio_term function.
>>
>> Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
>> ---
>>   platform/linux-generic/odp_packet_io.c | 11 ++++++-----
>>   1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/platform/linux-generic/odp_packet_io.c 
>> b/platform/linux-generic/odp_packet_io.c
>> index fa0817a..f262cb6 100644
>> --- a/platform/linux-generic/odp_packet_io.c
>> +++ b/platform/linux-generic/odp_packet_io.c
>> @@ -91,6 +91,12 @@ int odp_pktio_term_global(void)
>>       int id;
>>       int pktio_if;
>>   +    for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) {
>> +        pktio_entry = &pktio_tbl->entries[id - 1];
>> +        odp_pktio_close(pktio_entry->s.handle);
>> +        odp_queue_destroy(pktio_entry->s.outq_default);
>> +    }
> Why we have here and bellow id = 1, then subtract 1 to get entry?
> Wouldn't it better:
> for (id = 0; id < ODP_CONFIG_PKTIO_ENTRIES; ++id) {
>     pktio_entry = &pktio_tbl->entries[id];
>
> ?
I'm not really sure why.
I didn't want to update the code in the same patch so I kept it as it was.
Maybe it's a remain from some time where id 0 was ODP_PKTIO_INVALID or 
something?

Nicolas

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to