My understanding of the pktio global termination is that it is
simply cleaning up queues that it created internally in order 
to prevent termination issues for the other sub systems (like
odp_queue.c) in linux generic.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Maxim Uvarov
Sent: Tuesday, February 24, 2015 8:46 AM
To: [email protected]
Subject: Re: [lng-odp] [PATCHv3 03/10] linux-generic: packet_io: add term_global

On 02/23/2015 11:36 PM, Robbie King wrote:
> From: Yan Sonming <[email protected]>
>
> Signed-off-by: Yan Songming <[email protected]>
> Signed-off-by: Mike Holmes <[email protected]>
> Signed-off-by: Robbie King <[email protected]>
> ---
>   platform/linux-generic/include/odp_internal.h |  1 +
>   platform/linux-generic/odp_init.c             |  5 +++++
>   platform/linux-generic/odp_packet_io.c        | 18 ++++++++++++++++++
>   3 files changed, 24 insertions(+)
>
> diff --git a/platform/linux-generic/include/odp_internal.h 
> b/platform/linux-generic/include/odp_internal.h
> index 9ae8530..e43608d 100644
> --- a/platform/linux-generic/include/odp_internal.h
> +++ b/platform/linux-generic/include/odp_internal.h
> @@ -41,6 +41,7 @@ int odp_shm_init_local(void);
>   int odp_pool_init_global(void);
>   
>   int odp_pktio_init_global(void);
> +int odp_pktio_term_global(void);
>   int odp_pktio_init_local(void);
>   
>   int odp_classification_init_global(void);
> diff --git a/platform/linux-generic/odp_init.c 
> b/platform/linux-generic/odp_init.c
> index 645ac10..48bc9a2 100644
> --- a/platform/linux-generic/odp_init.c
> +++ b/platform/linux-generic/odp_init.c
> @@ -88,6 +88,11 @@ int odp_term_global(void)
>               rc = -1;
>       }
>   
> +     if (odp_pktio_term_global()) {
> +             ODP_ERR("ODP pktio term failed.\n");
> +             rc = -1;
> +     }
> +
>       return rc;
>   }
>   
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index c5d0569..a405bd7 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -79,6 +79,24 @@ int odp_pktio_init_global(void)
>       return 0;
>   }
>   
> +int odp_pktio_term_global(void)
> +{
> +     pktio_entry_t *pktio_entry;
> +     int ret = 0;
> +     int id;
> +
> +     for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) {
> +             pktio_entry = &pktio_tbl->entries[id - 1];
Missing:

if (!pktio_entry)
lock_entry(pktio_entry);
free_pktio_entry();
close_pkt_sock_mmap();

> +             odp_queue_destroy(pktio_entry->s.outq_default);
you need to check return code here. 99% that Coverity will warn about that.
> +     }
> +
> +     ret = odp_shm_free(odp_shm_lookup("odp_pktio_entries"));
> +     if (ret < 0)
> +             ODP_ERR("shm free failed for odp_pktio_entries");
> +
> +     return ret;
> +}
> +
>   int odp_pktio_init_local(void)
>   {
>       return 0;


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to