diff mbox

[PATCHv2] linux-generic: fix odp_pktio_inq_remdef

Message ID 1418834057-31954-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Dec. 17, 2014, 4:34 p.m. UTC
Correctly destroy queue and remove it from scheduler.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---

 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 mbox

Patch

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);
+	unlock_entry(pktio_entry);
+
+	return ret;
 }
 
 odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)