This looks good.  As a practice, for patch revisions post-merge I think
these should be tracked as bugs that are being fixed, and the patch
comments should note what bug it's addressing.

On Thu, Dec 18, 2014 at 4:27 AM, Taras Kondratiuk <
[email protected]> wrote:
>
> PKTIN queue was not handled correctly. Check queue status instead of
> queue type.
>
> Reported-by: Stuart Haslam <[email protected]>
> Signed-off-by: Taras Kondratiuk <[email protected]>
> ---
>  platform/linux-generic/odp_queue.c | 39
> ++++++++++++++++++++------------------
>  1 file changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/platform/linux-generic/odp_queue.c
> b/platform/linux-generic/odp_queue.c
> index 1462b41..c128aa0 100644
> --- a/platform/linux-generic/odp_queue.c
> +++ b/platform/linux-generic/odp_queue.c
> @@ -207,27 +207,30 @@ int odp_queue_destroy(odp_queue_t handle)
>         queue->s.enqueue = queue_enq_dummy;
>         queue->s.enqueue_multi = queue_enq_multi_dummy;
>
> -       if (queue->s.type == ODP_QUEUE_TYPE_POLL ||
> -           queue->s.type == ODP_QUEUE_TYPE_PKTOUT) {
> +       switch (queue->s.status) {
> +       case QUEUE_STATUS_READY:
>                 queue->s.status = QUEUE_STATUS_FREE;
>                 queue->s.head = NULL;
>                 queue->s.tail = NULL;
> -       } else if (queue->s.type == ODP_QUEUE_TYPE_SCHED) {
> -               if (queue->s.status == QUEUE_STATUS_SCHED)  {
> -                       /*
> -                        * Override dequeue_multi to destroy queue when it
> will
> -                        * be scheduled next time.
> -                        */
> -                       queue->s.status = QUEUE_STATUS_DESTROYED;
> -                       queue->s.dequeue_multi = queue_deq_multi_destroy;
> -               } else {
> -                       /* Queue won't be scheduled anymore */
> -                       odp_buffer_free(queue->s.sched_buf);
> -                       queue->s.sched_buf = ODP_BUFFER_INVALID;
> -                       queue->s.status = QUEUE_STATUS_FREE;
> -                       queue->s.head = NULL;
> -                       queue->s.tail = NULL;
> -               }
> +               break;
> +       case QUEUE_STATUS_SCHED:
> +               /*
> +                * Override dequeue_multi to destroy queue when it will
> +                * be scheduled next time.
> +                */
> +               queue->s.status = QUEUE_STATUS_DESTROYED;
> +               queue->s.dequeue_multi = queue_deq_multi_destroy;
> +               break;
> +       case QUEUE_STATUS_NOTSCHED:
> +               /* Queue won't be scheduled anymore */
> +               odp_buffer_free(queue->s.sched_buf);
> +               queue->s.sched_buf = ODP_BUFFER_INVALID;
> +               queue->s.status = QUEUE_STATUS_FREE;
> +               queue->s.head = NULL;
> +               queue->s.tail = NULL;
> +               break;
> +       default:
> +               ODP_ABORT("Unexpected queue status\n");
>         }
>         UNLOCK(&queue->s.lock);
>
> --
> 1.9.1
>
>
> _______________________________________________
> 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