diff mbox series

[API-NEXT,v2,3/6] linux-gen: pktio: convert queue handle only once

Message ID 20170704095343.4266-4-petri.savolainen@linaro.org
State Accepted
Commit 08863bb877feb8643d1583e29912cc08f2ca8105
Headers show
Series Queue interface clean up | expand

Commit Message

Petri Savolainen July 4, 2017, 9:53 a.m. UTC
Avoid queue handle conversion on fast path. Convert once after
queue create and save value.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 platform/linux-generic/include/odp_packet_io_internal.h |  2 ++
 platform/linux-generic/odp_packet_io.c                  | 13 ++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

-- 
2.13.0
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 89bb6f3a..93040681 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -24,6 +24,7 @@  extern "C" {
 #include <odp_align_internal.h>
 #include <odp_debug_internal.h>
 #include <odp_packet_io_ring_internal.h>
+#include <odp_queue_if.h>
 
 #include <odp_config_internal.h>
 #include <odp/api/hints.h>
@@ -165,6 +166,7 @@  struct pktio_entry {
 
 	struct {
 		odp_queue_t        queue;
+		queue_t            queue_int;
 		odp_pktin_queue_t  pktin;
 	} in_queue[PKTIO_MAX_QUEUES];
 
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index af1307c0..3ed51ac9 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -128,6 +128,7 @@  static void init_in_queues(pktio_entry_t *entry)
 
 	for (i = 0; i < PKTIO_MAX_QUEUES; i++) {
 		entry->s.in_queue[i].queue = ODP_QUEUE_INVALID;
+		entry->s.in_queue[i].queue_int = QUEUE_NULL;
 		entry->s.in_queue[i].pktin = PKTIN_INVALID;
 	}
 }
@@ -305,6 +306,7 @@  static void destroy_in_queues(pktio_entry_t *entry, int num)
 		if (entry->s.in_queue[i].queue != ODP_QUEUE_INVALID) {
 			odp_queue_destroy(entry->s.in_queue[i].queue);
 			entry->s.in_queue[i].queue = ODP_QUEUE_INVALID;
+			entry->s.in_queue[i].queue_int = QUEUE_NULL;
 		}
 	}
 }
@@ -708,8 +710,7 @@  int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[])
 	}
 
 	for (idx = 0; idx < num_queue; idx++) {
-		queue_t qentry;
-		odp_queue_t queue;
+		queue_t q_int;
 		odp_pktin_queue_t pktin = entry->s.in_queue[index[idx]].pktin;
 
 		num = pktin_recv_buf(pktin, hdr_tbl, QUEUE_MULTI_MAX);
@@ -722,9 +723,8 @@  int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[])
 			return -1;
 		}
 
-		queue = entry->s.in_queue[index[idx]].queue;
-		qentry = queue_fn->from_ext(queue);
-		queue_fn->enq_multi(qentry, hdr_tbl, num);
+		q_int = entry->s.in_queue[index[idx]].queue_int;
+		queue_fn->enq_multi(q_int, hdr_tbl, num);
 	}
 
 	return 0;
@@ -1281,8 +1281,11 @@  int odp_pktin_queue_config(odp_pktio_t pktio,
 			}
 
 			entry->s.in_queue[i].queue = queue;
+			entry->s.in_queue[i].queue_int = q_int;
+
 		} else {
 			entry->s.in_queue[i].queue = ODP_QUEUE_INVALID;
+			entry->s.in_queue[i].queue_int = QUEUE_NULL;
 		}
 
 		entry->s.in_queue[i].pktin.index = i;