diff mbox

[PATCHv2] linux-generic: pktio: abort on enq to pktin or deq from pktout

Message ID 1422377056-13294-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 059b8c97fcd896c82070460037f0f3cc6d88fec9
Headers show

Commit Message

Maxim Uvarov Jan. 27, 2015, 4:44 p.m. UTC
From: Stuart Haslam <stuart.haslam@arm.com>

Attempts to enq to a pktin queue or deq from a pktout queue are
programming errors, so abort.

Signed-off-by: Stuart Haslam <stuart.haslam@arm.com>
Reviewed-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: use ODP_UNUSED

 platform/linux-generic/odp_packet_io.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index f69d6b1..52125fc 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -535,9 +535,9 @@  int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)
 	return (nbr == len ? 0 : -1);
 }
 
-odp_buffer_hdr_t *pktout_dequeue(queue_entry_t *qentry)
+odp_buffer_hdr_t *pktout_dequeue(queue_entry_t *qentry ODP_UNUSED)
 {
-	(void)qentry;
+	ODP_ABORT("attempted dequeue from a pktout queue");
 	return NULL;
 }
 
@@ -555,20 +555,19 @@  int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],
 	return (nbr == num ? 0 : -1);
 }
 
-int pktout_deq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],
-		     int num)
+int pktout_deq_multi(queue_entry_t *qentry ODP_UNUSED,
+		     odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
+		     int num ODP_UNUSED)
 {
-	(void)qentry;
-	(void)buf_hdr;
-	(void)num;
-
+	ODP_ABORT("attempted dequeue from a pktout queue");
 	return 0;
 }
 
-int pktin_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)
+int pktin_enqueue(queue_entry_t *qentry ODP_UNUSED,
+		  odp_buffer_hdr_t *buf_hdr ODP_UNUSED)
 {
-	/* Use default action */
-	return queue_enq(qentry, buf_hdr);
+	ODP_ABORT("attempted enqueue to a pktin queue");
+	return -1;
 }
 
 odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry)
@@ -603,10 +602,12 @@  odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry)
 	return buf_hdr;
 }
 
-int pktin_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], int num)
+int pktin_enq_multi(queue_entry_t *qentry ODP_UNUSED,
+		    odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
+		    int num ODP_UNUSED)
 {
-	/* Use default action */
-	return queue_enq_multi(qentry, buf_hdr, num);
+	ODP_ABORT("attempted enqueue to a pktin queue");
+	return 0;
 }
 
 int pktin_deq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], int num)