On Wed, Dec 17, 2014 at 04:34:17PM +0000, Maxim Uvarov wrote: > Correctly destroy queue and remove it from scheduler. > > Signed-off-by: Maxim Uvarov <[email protected]> > --- > > v2: > I reused Tarases implementation for destroy queue, > which also removes this queue from scheduling. > > Maxim. > > platform/linux-generic/odp_packet_io.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/platform/linux-generic/odp_packet_io.c > b/platform/linux-generic/odp_packet_io.c > index 3ca8100..089feae 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -391,7 +391,19 @@ 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; > + int ret; > + > + if (pktio_entry == NULL) > + return -1; > + > + lock_entry(pktio_entry); > + queue = pktio_entry->s.inq_default; > + ret = odp_queue_destroy(queue);
As I said in an earlier mail I don't think remdef should be destroying the queue, it's not symmetrical with setdef and is not intuitive. inq = odp_queue_create(); odp_pktio_inq_setdef(pktio, inq); odp_pktio_inq_remdef(pktio); Now inq has been destroyed?!.. This would make more sense; inq = odp_queue_create(); odp_pktio_inq_setdef(pktio, inq); odp_pktio_inq_remdef(pktio); odp_queue_destroy(inq); Or rather than destroy it, the application could reuse that queue for a different pktio. Besides that, inq_default isn't being updated so getdef will still return the (now destroyed) queue. > + unlock_entry(pktio_entry); > + > + return ret; > } > > 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
