On Wed, Dec 17, 2014 at 10:41:50PM +0000, Maxim Uvarov wrote:
> Correctly remove queue from packet i/o and remove it from scheduler.
> 
> Signed-off-by: Maxim Uvarov <[email protected]>
> ---
>  platform/linux-generic/odp_packet_io.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index 3ca8100..1b3ab24 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -391,7 +391,31 @@ int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t 
> queue)
>  
>  int odp_pktio_inq_remdef(odp_pktio_t id)
>  {
> -     return odp_pktio_inq_setdef(id, ODP_QUEUE_INVALID);
> +     pktio_entry_t *pktio_entry = get_pktio_entry(id);
> +     odp_queue_t queue;
> +     queue_entry_t *qentry;
> +
> +     if (pktio_entry == NULL)
> +             return -1;
> +
> +     lock_entry(pktio_entry);
> +     queue = pktio_entry->s.inq_default;
> +     qentry = queue_to_qentry(queue);
> +
> +     queue_lock(qentry);
> +     if (qentry->s.status == QUEUE_STATUS_FREE) {
> +             queue_unlock(qentry);
> +             unlock_entry(pktio_entry);
> +             return -1; /* Queue is already free or not empty */

or not empty?.. you haven't checked if it's empty.

> +     }
> +
> +     qentry->s.enqueue = queue_enq_dummy;
> +     qentry->s.enqueue_multi = queue_enq_multi_dummy;
> +     qentry->s.status = QUEUE_STATUS_FREE;

Setting the status to FREE means it can be allocated again on the next
odp_queue_create() call, which isn't what you want.

Still not clearing pktio->s.inq_default

Also I think you should be clearing queue->s.pktin 

> +     queue_unlock(qentry);
> +     unlock_entry(pktio_entry);
> +
> +     return 0;
>  }
>  
>  odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)
> -- 
> 1.8.5.1.163.gd7aced9
> 

-- 
Stuart.


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

Reply via email to