Same here, just pointing out to the application that it has left
queues in an undefined state.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Maxim Uvarov
Sent: Tuesday, February 24, 2015 8:36 AM
To: [email protected]
Subject: Re: [lng-odp] [PATCHv3 05/10] linux-generic: queue: 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_queue.c            | 38 
> +++++++++++++++++++++++++--
>   3 files changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_internal.h 
> b/platform/linux-generic/include/odp_internal.h
> index 83b0beb..c6da30b 100644
> --- a/platform/linux-generic/include/odp_internal.h
> +++ b/platform/linux-generic/include/odp_internal.h
> @@ -48,6 +48,7 @@ int odp_classification_init_global(void);
>   int odp_classification_term_global(void);
>   
>   int odp_queue_init_global(void);
> +int odp_queue_term_global(void);
>   
>   int odp_crypto_init_global(void);
>   int odp_crypto_term_global(void);
> diff --git a/platform/linux-generic/odp_init.c 
> b/platform/linux-generic/odp_init.c
> index 4f6eeb9..f5e0f25 100644
> --- a/platform/linux-generic/odp_init.c
> +++ b/platform/linux-generic/odp_init.c
> @@ -98,6 +98,11 @@ int odp_term_global(void)
>               rc = -1;
>       }
>   
> +     if (odp_queue_term_global()) {
> +             ODP_ERR("ODP queue term failed.\n");
> +             rc = -1;
> +     }
> +
>       return rc;
>   }
>   
> diff --git a/platform/linux-generic/odp_queue.c 
> b/platform/linux-generic/odp_queue.c
> index 6806a95..b945e03 100644
> --- a/platform/linux-generic/odp_queue.c
> +++ b/platform/linux-generic/odp_queue.c
> @@ -128,6 +128,32 @@ int odp_queue_init_global(void)
>       return 0;
>   }
>   
> +int odp_queue_term_global(void)
> +{
> +     int ret = 0;
> +     int rc = 0;
> +     queue_entry_t *queue;
> +     int i;
> +
> +     for (i = 0; i < ODP_CONFIG_QUEUES; i++) {
> +             queue = &queue_tbl->queue[i];
> +             LOCK(&queue->s.lock);
> +             if (queue->s.status != QUEUE_STATUS_FREE) {
> +                     ODP_ERR("Not destroyed queue: %s\n", queue->s.name);
> +                     rc = -1;
> +             }
> +             UNLOCK(&queue->s.lock);
> +     }
> +
> +     ret = odp_shm_free(odp_shm_lookup("odp_queues"));
> +     if (ret < 0) {
> +             ODP_ERR("shm free failed for odp_queues");
> +             rc = -1;
> +     }
> +z
> +     return rc;
> +}
> +
>   odp_queue_type_t odp_queue_type(odp_queue_t handle)
>   {
>       queue_entry_t *queue;
> @@ -217,9 +243,17 @@ int odp_queue_destroy(odp_queue_t handle)
>       queue = queue_to_qentry(handle);
>   
>       LOCK(&queue->s.lock);
> -     if (queue->s.status == QUEUE_STATUS_FREE || queue->s.head != NULL) {
> +     if (queue->s.status == QUEUE_STATUS_FREE) {
>               UNLOCK(&queue->s.lock);
> -             return -1; /* Queue is already free or not empty */
> +             ODP_ERR("queue_destroy: queue \"%s\" already free\n",
> +                     queue->s.name);
> +             return -1;
> +     }
I think you need to set up dummy functions before you quit. Overwize 
linux-generic
will always add packets to queue.

I.e. move lines bellow up:

         queue->s.enqueue = queue_enq_dummy;
         queue->s.enqueue_multi = queue_enq_multi_dummy;

> +     if (queue->s.head != NULL) {
> +             UNLOCK(&queue->s.lock);
> +             ODP_ERR("queue_destroy: queue \"%s\" not empty\n",
> +                     queue->s.name);
> +             return -1;
>       }
>   
>       queue->s.enqueue = queue_enq_dummy;


_______________________________________________
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