This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via 0275cc02d5cdb54b955cfce1988f5ee158ad0423 (commit) via d30dc0774647b3f635afea67e56147b8e6e3f24e (commit) via bf5d48ee13aa4fb737ee430038d5f2b865f45d47 (commit) via 1ba2bcd7b9ebfa1a5d8dda257c7b309d3553fa03 (commit) via 8869e18f490d0ffc35e0359a92ef96eacbf5b0b7 (commit) via 91c4f94f1ed01ed22b7cd489016016b0599f4065 (commit) via 1cb0a8863eb8309c3e532a168fed34d6e3257218 (commit) via faf97a341df8e92fd692029fe2c6c353f043950b (commit) from c7718962c6633c80eb71a0400d89c31f11f88045 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 0275cc02d5cdb54b955cfce1988f5ee158ad0423 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:43 2017 +0300
linux-gen: queue: remove type set from interface
TM should not modify queue type. Remove type_set queue interface function.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_queue_if.h b/platform/linux-generic/include/odp_queue_if.h index 7ba5c3c5..410c6b79 100644 --- a/platform/linux-generic/include/odp_queue_if.h +++ b/platform/linux-generic/include/odp_queue_if.h @@ -71,7 +71,6 @@ typedef void (*queue_set_enq_deq_fn_t)(queue_t q_int, queue_enq_multi_fn_t enq_multi, queue_deq_fn_t deq, queue_deq_multi_fn_t deq_multi); -typedef void (*queue_set_type_fn_t)(queue_t q_int, odp_queue_type_t type);
/* Queue functions towards other internal components */ typedef struct { @@ -90,7 +89,6 @@ typedef struct { queue_get_pktin_fn_t get_pktin; queue_set_pktin_fn_t set_pktin; queue_set_enq_deq_fn_t set_enq_deq_fn; - queue_set_type_fn_t set_type; } queue_fn_t;
extern const queue_fn_t *queue_fn; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index ec225d00..d52814b2 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -769,11 +769,6 @@ static void queue_set_enq_deq_func(queue_t q_int, qentry->s.dequeue_multi = deq_multi; }
-static void queue_set_type(queue_t q_int, odp_queue_type_t type) -{ - qentry_from_int(q_int)->s.type = type; -} - static queue_t queue_from_ext(odp_queue_t handle) { return qentry_to_int(handle_to_qentry(handle)); @@ -822,6 +817,5 @@ queue_fn_t queue_default_fn = { .set_pktout = queue_set_pktout, .get_pktin = queue_get_pktin, .set_pktin = queue_set_pktin, - .set_enq_deq_fn = queue_set_enq_deq_func, - .set_type = queue_set_type + .set_enq_deq_fn = queue_set_enq_deq_func }; diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 14fa1833..52f3915f 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -956,11 +956,6 @@ static void queue_set_enq_deq_func(queue_t handle, qentry_from_int(handle)->s.dequeue_multi = deq_multi; }
-static void queue_set_type(queue_t handle, odp_queue_type_t type) -{ - qentry_from_int(handle)->s.type = type; -} - static queue_t queue_from_ext(odp_queue_t handle) { uint32_t queue_id; @@ -1012,6 +1007,5 @@ queue_fn_t queue_scalable_fn = { .set_pktout = queue_set_pktout, .get_pktin = queue_get_pktin, .set_pktin = queue_set_pktin, - .set_enq_deq_fn = queue_set_enq_deq_func, - .set_type = queue_set_type + .set_enq_deq_fn = queue_set_enq_deq_func }; diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 1f254d75..ec2d331f 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -37,9 +37,6 @@ static const pkt_desc_t EMPTY_PKT_DESC = { .word = 0 }; #define MAX_PRIORITIES ODP_TM_MAX_PRIORITIES #define NUM_SHAPER_COLORS ODP_NUM_SHAPER_COLORS
-/* Traffic manager queue */ -#define QUEUE_TYPE_TM 4 - static tm_prop_t basic_prop_tbl[MAX_PRIORITIES][NUM_SHAPER_COLORS] = { [0] = { [ODP_TM_SHAPER_GREEN] = { 0, DECR_BOTH }, @@ -3926,7 +3923,6 @@ odp_tm_queue_t odp_tm_queue_create(odp_tm_t odp_tm, return ODP_TM_INVALID; } tm_queue_obj->tm_qentry = queue_fn->from_ext(queue); - queue_fn->set_type(tm_queue_obj->tm_qentry, QUEUE_TYPE_TM); queue_fn->set_enq_deq_fn(tm_queue_obj->tm_qentry, queue_tm_reenq, queue_tm_reenq_multi, NULL, NULL);
commit d30dc0774647b3f635afea67e56147b8e6e3f24e Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:42 2017 +0300
linux-gen: queue: combine queue interface set functions
Decrease queue interface size by combining four queue operation set functions into a single function.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_queue_if.h b/platform/linux-generic/include/odp_queue_if.h index b5cbd515..7ba5c3c5 100644 --- a/platform/linux-generic/include/odp_queue_if.h +++ b/platform/linux-generic/include/odp_queue_if.h @@ -66,12 +66,11 @@ typedef void (*queue_set_pktout_fn_t)(queue_t q_int, odp_pktio_t pktio, typedef odp_pktin_queue_t (*queue_get_pktin_fn_t)(queue_t q_int); typedef void (*queue_set_pktin_fn_t)(queue_t q_int, odp_pktio_t pktio, int index); -typedef void (*queue_set_enq_fn_t)(queue_t q_int, queue_enq_fn_t func); -typedef void (*queue_set_enq_multi_fn_t)(queue_t q_int, - queue_enq_multi_fn_t func); -typedef void (*queue_set_deq_fn_t)(queue_t q_int, queue_deq_fn_t func); -typedef void (*queue_set_deq_multi_fn_t)(queue_t q_int, - queue_deq_multi_fn_t func); +typedef void (*queue_set_enq_deq_fn_t)(queue_t q_int, + queue_enq_fn_t enq, + queue_enq_multi_fn_t enq_multi, + queue_deq_fn_t deq, + queue_deq_multi_fn_t deq_multi); typedef void (*queue_set_type_fn_t)(queue_t q_int, odp_queue_type_t type);
/* Queue functions towards other internal components */ @@ -90,10 +89,7 @@ typedef struct { queue_set_pktout_fn_t set_pktout; queue_get_pktin_fn_t get_pktin; queue_set_pktin_fn_t set_pktin; - queue_set_enq_fn_t set_enq_fn; - queue_set_enq_multi_fn_t set_enq_multi_fn; - queue_set_deq_fn_t set_deq_fn; - queue_set_deq_multi_fn_t set_deq_multi_fn; + queue_set_enq_deq_fn_t set_enq_deq_fn; queue_set_type_fn_t set_type; } queue_fn_t;
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 0d825f91..6a181f53 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1154,30 +1154,30 @@ int odp_pktio_stats_reset(odp_pktio_t pktio) return ret; }
-static int pktin_enqueue(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr ODP_UNUSED) +static int abort_pktin_enqueue(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr ODP_UNUSED) { ODP_ABORT("attempted enqueue to a pktin queue"); return -1; }
-static int pktin_enq_multi(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, - int num ODP_UNUSED) +static int abort_pktin_enq_multi(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, + int num ODP_UNUSED) { ODP_ABORT("attempted enqueue to a pktin queue"); return 0; }
-static odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED) +static odp_buffer_hdr_t *abort_pktout_dequeue(queue_t q_int ODP_UNUSED) { ODP_ABORT("attempted dequeue from a pktout queue"); return NULL; }
-static int pktout_deq_multi(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, - int num ODP_UNUSED) +static int abort_pktout_deq_multi(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, + int num ODP_UNUSED) { ODP_ABORT("attempted dequeue from a pktout queue"); return 0; @@ -1272,12 +1272,11 @@ int odp_pktin_queue_config(odp_pktio_t pktio,
if (mode == ODP_PKTIN_MODE_QUEUE) { queue_fn->set_pktin(q_int, pktio, i); - queue_fn->set_enq_fn(q_int, pktin_enqueue); - queue_fn->set_deq_fn(q_int, pktin_dequeue); - queue_fn->set_enq_multi_fn(q_int, - pktin_enq_multi); - queue_fn->set_deq_multi_fn(q_int, - pktin_deq_multi); + queue_fn->set_enq_deq_fn(q_int, + abort_pktin_enqueue, + abort_pktin_enq_multi, + pktin_dequeue, + pktin_deq_multi); }
entry->s.in_queue[i].queue = queue; @@ -1401,10 +1400,11 @@ int odp_pktout_queue_config(odp_pktio_t pktio, queue_fn->set_pktout(q_int, pktio, i);
/* Override default enqueue / dequeue functions */ - queue_fn->set_enq_fn(q_int, pktout_enqueue); - queue_fn->set_deq_fn(q_int, pktout_dequeue); - queue_fn->set_enq_multi_fn(q_int, pktout_enq_multi); - queue_fn->set_deq_multi_fn(q_int, pktout_deq_multi); + queue_fn->set_enq_deq_fn(q_int, + pktout_enqueue, + pktout_enq_multi, + abort_pktout_dequeue, + abort_pktout_deq_multi);
entry->s.out_queue[i].queue = queue; } diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 60f88f09..ec225d00 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -748,24 +748,25 @@ static void queue_set_pktin(queue_t q_int, odp_pktio_t pktio, int index) qentry->s.pktin.index = index; }
-static void queue_set_enq_func(queue_t q_int, queue_enq_fn_t func) +static void queue_set_enq_deq_func(queue_t q_int, + queue_enq_fn_t enq, + queue_enq_multi_fn_t enq_multi, + queue_deq_fn_t deq, + queue_deq_multi_fn_t deq_multi) { - qentry_from_int(q_int)->s.enqueue = func; -} + queue_entry_t *qentry = qentry_from_int(q_int);
-static void queue_set_enq_multi_func(queue_t q_int, queue_enq_multi_fn_t func) -{ - qentry_from_int(q_int)->s.enqueue_multi = func; -} + if (enq) + qentry->s.enqueue = enq;
-static void queue_set_deq_func(queue_t q_int, queue_deq_fn_t func) -{ - qentry_from_int(q_int)->s.dequeue = func; -} + if (enq_multi) + qentry->s.enqueue_multi = enq_multi;
-static void queue_set_deq_multi_func(queue_t q_int, queue_deq_multi_fn_t func) -{ - qentry_from_int(q_int)->s.dequeue_multi = func; + if (deq) + qentry->s.dequeue = deq; + + if (deq_multi) + qentry->s.dequeue_multi = deq_multi; }
static void queue_set_type(queue_t q_int, odp_queue_type_t type) @@ -821,9 +822,6 @@ queue_fn_t queue_default_fn = { .set_pktout = queue_set_pktout, .get_pktin = queue_get_pktin, .set_pktin = queue_set_pktin, - .set_enq_fn = queue_set_enq_func, - .set_enq_multi_fn = queue_set_enq_multi_func, - .set_deq_fn = queue_set_deq_func, - .set_deq_multi_fn = queue_set_deq_multi_func, + .set_enq_deq_fn = queue_set_enq_deq_func, .set_type = queue_set_type }; diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 7441a2a9..14fa1833 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -937,24 +937,23 @@ static void queue_set_pktin(queue_t handle, odp_pktio_t pktio, int index) qentry_from_int(handle)->s.pktin.index = index; }
-static void queue_set_enq_func(queue_t handle, queue_enq_fn_t func) +static void queue_set_enq_deq_func(queue_t handle, + queue_enq_fn_t enq, + queue_enq_multi_fn_t enq_multi, + queue_deq_fn_t deq, + queue_deq_multi_fn_t deq_multi) { - qentry_from_int(handle)->s.enqueue = func; -} + if (enq) + qentry_from_int(handle)->s.enqueue = enq;
-static void queue_set_enq_multi_func(queue_t handle, queue_enq_multi_fn_t func) -{ - qentry_from_int(handle)->s.enqueue_multi = func; -} + if (enq_multi) + qentry_from_int(handle)->s.enqueue_multi = enq_multi;
-static void queue_set_deq_func(queue_t handle, queue_deq_fn_t func) -{ - qentry_from_int(handle)->s.dequeue = func; -} + if (deq) + qentry_from_int(handle)->s.dequeue = deq;
-static void queue_set_deq_multi_func(queue_t handle, queue_deq_multi_fn_t func) -{ - qentry_from_int(handle)->s.dequeue_multi = func; + if (deq_multi) + qentry_from_int(handle)->s.dequeue_multi = deq_multi; }
static void queue_set_type(queue_t handle, odp_queue_type_t type) @@ -1013,9 +1012,6 @@ queue_fn_t queue_scalable_fn = { .set_pktout = queue_set_pktout, .get_pktin = queue_get_pktin, .set_pktin = queue_set_pktin, - .set_enq_fn = queue_set_enq_func, - .set_enq_multi_fn = queue_set_enq_multi_func, - .set_deq_fn = queue_set_deq_func, - .set_deq_multi_fn = queue_set_deq_multi_func, + .set_enq_deq_fn = queue_set_enq_deq_func, .set_type = queue_set_type }; diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 8b5f3187..1f254d75 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -3927,9 +3927,9 @@ odp_tm_queue_t odp_tm_queue_create(odp_tm_t odp_tm, } tm_queue_obj->tm_qentry = queue_fn->from_ext(queue); queue_fn->set_type(tm_queue_obj->tm_qentry, QUEUE_TYPE_TM); - queue_fn->set_enq_fn(tm_queue_obj->tm_qentry, queue_tm_reenq); - queue_fn->set_enq_multi_fn(tm_queue_obj->tm_qentry, - queue_tm_reenq_multi); + queue_fn->set_enq_deq_fn(tm_queue_obj->tm_qentry, + queue_tm_reenq, queue_tm_reenq_multi, + NULL, NULL);
tm_system->queue_num_tbl[tm_queue_obj->queue_num - 1] = tm_queue_obj; odp_ticketlock_lock(&tm_system->tm_system_lock);
commit bf5d48ee13aa4fb737ee430038d5f2b865f45d47 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:41 2017 +0300
linux-gen: pktio: remove unused header file
odp_packet_io_queue.h is not needed anymore as the queue interface has replaced it.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 82ab4642..b46c6501 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -175,7 +175,6 @@ noinst_HEADERS = \ ${srcdir}/include/odp_packet_internal.h \ ${srcdir}/include/odp_packet_io_internal.h \ ${srcdir}/include/odp_packet_io_ipc_internal.h \ - ${srcdir}/include/odp_packet_io_queue.h \ ${srcdir}/include/odp_packet_io_ring_internal.h \ ${srcdir}/include/odp_packet_netmap.h \ ${srcdir}/include/odp_packet_dpdk.h \ diff --git a/platform/linux-generic/include/odp_packet_io_queue.h b/platform/linux-generic/include/odp_packet_io_queue.h deleted file mode 100644 index 71333ddc..00000000 --- a/platform/linux-generic/include/odp_packet_io_queue.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP packet IO - implementation internal - */ - -#ifndef ODP_PACKET_IO_QUEUE_H_ -#define ODP_PACKET_IO_QUEUE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_queue_if.h> -#include <odp_buffer_internal.h> -#include <odp_config_internal.h> - -/** Max nbr of pkts to receive in one burst (keep same as QUEUE_MULTI_MAX) */ -#define ODP_PKTIN_QUEUE_MAX_BURST CONFIG_BURST_SIZE -/* pktin_deq_multi() depends on the condition: */ -ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, - "ODP_PKTIN_DEQ_MULTI_MAX_ERROR"); - -int pktin_enqueue(queue_t queue, odp_buffer_hdr_t *buf_hdr); -odp_buffer_hdr_t *pktin_dequeue(queue_t queue); - -int pktin_enq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num); -int pktin_deq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num); - - -int pktout_enqueue(queue_t queue, odp_buffer_hdr_t *buf_hdr); -odp_buffer_hdr_t *pktout_dequeue(queue_t queue); - -int pktout_enq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num); -int pktout_deq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 3ed51ac9..0d825f91 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -7,7 +7,6 @@
#include <odp/api/packet_io.h> #include <odp_packet_io_internal.h> -#include <odp_packet_io_queue.h> #include <odp/api/packet.h> #include <odp_packet_internal.h> #include <odp_internal.h> @@ -580,7 +579,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, return num_rx; }
-int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr) +static int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr) { odp_packet_t pkt = packet_from_buf_hdr(buf_hdr); int len = 1; @@ -593,13 +592,7 @@ int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr) return (nbr == len ? 0 : -1); }
-odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED) -{ - ODP_ABORT("attempted dequeue from a pktout queue"); - return NULL; -} - -int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) +static int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) { odp_packet_t pkt_tbl[QUEUE_MULTI_MAX]; int nbr; @@ -615,22 +608,7 @@ int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) return nbr; }
-int pktout_deq_multi(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, - int num ODP_UNUSED) -{ - ODP_ABORT("attempted dequeue from a pktout queue"); - return 0; -} - -int pktin_enqueue(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr ODP_UNUSED) -{ - ODP_ABORT("attempted enqueue to a pktin queue"); - return -1; -} - -odp_buffer_hdr_t *pktin_dequeue(queue_t q_int) +static odp_buffer_hdr_t *pktin_dequeue(queue_t q_int) { odp_buffer_hdr_t *buf_hdr; odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; @@ -652,14 +630,7 @@ odp_buffer_hdr_t *pktin_dequeue(queue_t q_int) return buf_hdr; }
-int pktin_enq_multi(queue_t q_int ODP_UNUSED, - odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, int num ODP_UNUSED) -{ - ODP_ABORT("attempted enqueue to a pktin queue"); - return 0; -} - -int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) +static int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) { int nbr; odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; @@ -1183,6 +1154,35 @@ int odp_pktio_stats_reset(odp_pktio_t pktio) return ret; }
+static int pktin_enqueue(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr ODP_UNUSED) +{ + ODP_ABORT("attempted enqueue to a pktin queue"); + return -1; +} + +static int pktin_enq_multi(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, + int num ODP_UNUSED) +{ + ODP_ABORT("attempted enqueue to a pktin queue"); + return 0; +} + +static odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED) +{ + ODP_ABORT("attempted dequeue from a pktout queue"); + return NULL; +} + +static int pktout_deq_multi(queue_t q_int ODP_UNUSED, + odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, + int num ODP_UNUSED) +{ + ODP_ABORT("attempted dequeue from a pktout queue"); + return 0; +} + int odp_pktin_queue_config(odp_pktio_t pktio, const odp_pktin_queue_param_t *param) { diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 4c85027b..60f88f09 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -19,7 +19,6 @@ #include <odp_schedule_if.h> #include <odp_config_internal.h> #include <odp_packet_io_internal.h> -#include <odp_packet_io_queue.h> #include <odp_debug_internal.h> #include <odp/api/hints.h> #include <odp/api/sync.h> diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index f95f5f93..7441a2a9 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -20,7 +20,6 @@
#include <odp_buffer_inlines.h> #include <odp_packet_io_internal.h> -#include <odp_packet_io_queue.h> #include <odp_pool_internal.h> #include <odp_queue_scalable_internal.h> #include <odp_schedule_if.h>
commit 1ba2bcd7b9ebfa1a5d8dda257c7b309d3553fa03 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:40 2017 +0300
linux-gen: pktio: convert queue handle only once
Avoid queue handle conversion on fast path. Convert once after queue create and save value.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
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;
commit 8869e18f490d0ffc35e0359a92ef96eacbf5b0b7 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:39 2017 +0300
linux-gen: pktio: dont use qentry for queue_t
These are not any more queue_entry_t* but queue_t. Align variable names with the new type.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 6ff35046..af1307c0 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -578,42 +578,42 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, return num_rx; }
-int pktout_enqueue(queue_t qentry, odp_buffer_hdr_t *buf_hdr) +int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr) { odp_packet_t pkt = packet_from_buf_hdr(buf_hdr); int len = 1; int nbr;
- if (sched_fn->ord_enq_multi(qentry, (void **)buf_hdr, len, &nbr)) + if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, len, &nbr)) return (nbr == len ? 0 : -1);
- nbr = odp_pktout_send(queue_fn->get_pktout(qentry), &pkt, len); + nbr = odp_pktout_send(queue_fn->get_pktout(q_int), &pkt, len); return (nbr == len ? 0 : -1); }
-odp_buffer_hdr_t *pktout_dequeue(queue_t qentry ODP_UNUSED) +odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED) { ODP_ABORT("attempted dequeue from a pktout queue"); return NULL; }
-int pktout_enq_multi(queue_t qentry, odp_buffer_hdr_t *buf_hdr[], int num) +int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) { odp_packet_t pkt_tbl[QUEUE_MULTI_MAX]; int nbr; int i;
- if (sched_fn->ord_enq_multi(qentry, (void **)buf_hdr, num, &nbr)) + if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, num, &nbr)) return nbr;
for (i = 0; i < num; ++i) pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);
- nbr = odp_pktout_send(queue_fn->get_pktout(qentry), pkt_tbl, num); + nbr = odp_pktout_send(queue_fn->get_pktout(q_int), pkt_tbl, num); return nbr; }
-int pktout_deq_multi(queue_t qentry ODP_UNUSED, +int pktout_deq_multi(queue_t q_int ODP_UNUSED, odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, int num ODP_UNUSED) { @@ -621,49 +621,49 @@ int pktout_deq_multi(queue_t qentry ODP_UNUSED, return 0; }
-int pktin_enqueue(queue_t qentry ODP_UNUSED, +int pktin_enqueue(queue_t q_int ODP_UNUSED, odp_buffer_hdr_t *buf_hdr ODP_UNUSED) { ODP_ABORT("attempted enqueue to a pktin queue"); return -1; }
-odp_buffer_hdr_t *pktin_dequeue(queue_t qentry) +odp_buffer_hdr_t *pktin_dequeue(queue_t q_int) { odp_buffer_hdr_t *buf_hdr; odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; int pkts;
- buf_hdr = queue_fn->deq(qentry); + buf_hdr = queue_fn->deq(q_int); if (buf_hdr != NULL) return buf_hdr;
- pkts = pktin_recv_buf(queue_fn->get_pktin(qentry), + pkts = pktin_recv_buf(queue_fn->get_pktin(q_int), hdr_tbl, QUEUE_MULTI_MAX);
if (pkts <= 0) return NULL;
if (pkts > 1) - queue_fn->enq_multi(qentry, &hdr_tbl[1], pkts - 1); + queue_fn->enq_multi(q_int, &hdr_tbl[1], pkts - 1); buf_hdr = hdr_tbl[0]; return buf_hdr; }
-int pktin_enq_multi(queue_t qentry ODP_UNUSED, +int pktin_enq_multi(queue_t q_int ODP_UNUSED, odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, int num ODP_UNUSED) { ODP_ABORT("attempted enqueue to a pktin queue"); return 0; }
-int pktin_deq_multi(queue_t qentry, odp_buffer_hdr_t *buf_hdr[], int num) +int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) { int nbr; odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; int pkts, i, j;
- nbr = queue_fn->deq_multi(qentry, buf_hdr, num); + nbr = queue_fn->deq_multi(q_int, buf_hdr, num); if (odp_unlikely(nbr > num)) ODP_ABORT("queue_deq_multi req: %d, returned %d\n", num, nbr);
@@ -673,7 +673,7 @@ int pktin_deq_multi(queue_t qentry, odp_buffer_hdr_t *buf_hdr[], int num) if (nbr == num) return nbr;
- pkts = pktin_recv_buf(queue_fn->get_pktin(qentry), + pkts = pktin_recv_buf(queue_fn->get_pktin(q_int), hdr_tbl, QUEUE_MULTI_MAX); if (pkts <= 0) return nbr; @@ -686,7 +686,7 @@ int pktin_deq_multi(queue_t qentry, odp_buffer_hdr_t *buf_hdr[], int num) hdr_tbl[j] = hdr_tbl[i];
if (j) - queue_fn->enq_multi(qentry, hdr_tbl, j); + queue_fn->enq_multi(q_int, hdr_tbl, j); return nbr; }
@@ -1193,6 +1193,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, unsigned i; int rc; odp_queue_t queue; + queue_t q_int; odp_pktin_queue_param_t default_param;
if (param == NULL) { @@ -1267,16 +1268,15 @@ int odp_pktin_queue_config(odp_pktio_t pktio, return -1; }
- if (mode == ODP_PKTIN_MODE_QUEUE) { - queue_t qentry; + q_int = queue_fn->from_ext(queue);
- qentry = queue_fn->from_ext(queue); - queue_fn->set_pktin(qentry, pktio, i); - queue_fn->set_enq_fn(qentry, pktin_enqueue); - queue_fn->set_deq_fn(qentry, pktin_dequeue); - queue_fn->set_enq_multi_fn(qentry, + if (mode == ODP_PKTIN_MODE_QUEUE) { + queue_fn->set_pktin(q_int, pktio, i); + queue_fn->set_enq_fn(q_int, pktin_enqueue); + queue_fn->set_deq_fn(q_int, pktin_dequeue); + queue_fn->set_enq_multi_fn(q_int, pktin_enq_multi); - queue_fn->set_deq_multi_fn(qentry, + queue_fn->set_deq_multi_fn(q_int, pktin_deq_multi); }
@@ -1374,7 +1374,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, for (i = 0; i < num_queues; i++) { odp_queue_t queue; odp_queue_param_t queue_param; - queue_t qentry; + queue_t q_int; char name[ODP_QUEUE_NAME_LEN]; int pktio_id = pktio_to_id(pktio);
@@ -1394,14 +1394,14 @@ int odp_pktout_queue_config(odp_pktio_t pktio, return -1; }
- qentry = queue_fn->from_ext(queue); - queue_fn->set_pktout(qentry, pktio, i); + q_int = queue_fn->from_ext(queue); + queue_fn->set_pktout(q_int, pktio, i);
/* Override default enqueue / dequeue functions */ - queue_fn->set_enq_fn(qentry, pktout_enqueue); - queue_fn->set_deq_fn(qentry, pktout_dequeue); - queue_fn->set_enq_multi_fn(qentry, pktout_enq_multi); - queue_fn->set_deq_multi_fn(qentry, pktout_deq_multi); + queue_fn->set_enq_fn(q_int, pktout_enqueue); + queue_fn->set_deq_fn(q_int, pktout_dequeue); + queue_fn->set_enq_multi_fn(q_int, pktout_enq_multi); + queue_fn->set_deq_multi_fn(q_int, pktout_deq_multi);
entry->s.out_queue[i].queue = queue; }
commit 91c4f94f1ed01ed22b7cd489016016b0599f4065 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Jul 4 12:53:38 2017 +0300
linux-gen: cls: avoid queue conversions
Use internal queue type instead of API handle. This way per packet queue conversions are avoided.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index cdd139bb..d513f05e 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -27,6 +27,7 @@ extern "C" { #include <odp/api/crypto.h> #include <odp_crypto_internal.h> #include <odp/api/plat/packet_types.h> +#include <odp_queue_if.h>
/** Minimum segment length expected by packet_parse_common() */ #define PACKET_PARSE_SEG_LEN 96 @@ -126,7 +127,7 @@ typedef struct { odp_time_t timestamp;
/* Classifier destination queue */ - odp_queue_t dst_queue; + queue_t dst_queue;
/* Result for crypto */ odp_crypto_generic_op_result_t op_result; diff --git a/platform/linux-generic/include/odp_queue_if.h b/platform/linux-generic/include/odp_queue_if.h index 168d0e9e..b5cbd515 100644 --- a/platform/linux-generic/include/odp_queue_if.h +++ b/platform/linux-generic/include/odp_queue_if.h @@ -48,6 +48,8 @@ typedef struct { typedef struct { char dummy; } _queue_t; typedef _queue_t *queue_t;
+#define QUEUE_NULL ((queue_t)NULL) + typedef int (*queue_init_global_fn_t)(void); typedef int (*queue_term_global_fn_t)(void); typedef int (*queue_init_local_fn_t)(void); diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 5f153e73..cc08b9f4 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -162,7 +162,7 @@ odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param)
/* Packets are dropped if Queue or Pool is invalid*/ if (param->queue == ODP_QUEUE_INVALID) - queue = NULL; + queue = QUEUE_NULL; else queue = queue_fn->from_ext(param->queue);
@@ -264,7 +264,7 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) /* Locking is not required as intermittent stale data during CoS modification is acceptable*/ if (queue_id == ODP_QUEUE_INVALID) - cos->s.queue = NULL; + cos->s.queue = QUEUE_NULL; else cos->s.queue = queue_fn->from_ext(queue_id); return 0; @@ -279,7 +279,7 @@ odp_queue_t odp_cos_queue(odp_cos_t cos_id) return ODP_QUEUE_INVALID; }
- if (!cos->s.queue) + if (cos->s.queue == QUEUE_NULL) return ODP_QUEUE_INVALID;
return queue_fn->to_ext(cos->s.queue); @@ -841,12 +841,12 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base, if (cos == NULL) return -EINVAL;
- if (cos->s.queue == NULL || cos->s.pool == ODP_POOL_INVALID) + if (cos->s.queue == QUEUE_NULL || cos->s.pool == ODP_POOL_INVALID) return -EFAULT;
*pool = cos->s.pool; pkt_hdr->p.input_flags.dst_queue = 1; - pkt_hdr->dst_queue = queue_fn->to_ext(cos->s.queue); + pkt_hdr->dst_queue = cos->s.queue;
return 0; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 4dd28549..6ff35046 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -566,11 +566,9 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, buf_hdr = packet_to_buf_hdr(pkt);
if (pkt_hdr->p.input_flags.dst_queue) { - queue_t dst_queue; int ret;
- dst_queue = queue_fn->from_ext(pkt_hdr->dst_queue); - ret = queue_fn->enq(dst_queue, buf_hdr); + ret = queue_fn->enq(pkt_hdr->dst_queue, buf_hdr); if (ret < 0) odp_packet_free(pkt); continue;
commit 1cb0a8863eb8309c3e532a168fed34d6e3257218 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Jul 4 15:54:03 2017 +0300
validation: test correctness of events subtype implementation
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/common_plat/validation/api/buffer/buffer.c b/test/common_plat/validation/api/buffer/buffer.c index 7c723d4f..66d00ab7 100644 --- a/test/common_plat/validation/api/buffer/buffer.c +++ b/test/common_plat/validation/api/buffer/buffer.c @@ -48,7 +48,8 @@ void buffer_test_pool_alloc(void) odp_buffer_t buffer[num]; odp_event_t ev; int index; - char wrong_type = 0, wrong_size = 0, wrong_align = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; + odp_bool_t wrong_size = false, wrong_align = false; odp_pool_param_t params;
odp_pool_param_init(¶ms); @@ -63,6 +64,7 @@ void buffer_test_pool_alloc(void) /* Try to allocate num items from the pool */ for (index = 0; index < num; index++) { uintptr_t addr; + odp_event_subtype_t subtype;
buffer[index] = odp_buffer_alloc(pool);
@@ -71,14 +73,20 @@ void buffer_test_pool_alloc(void)
ev = odp_buffer_to_event(buffer[index]); if (odp_event_type(ev) != ODP_EVENT_BUFFER) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; + if (odp_event_types(ev, &subtype) != ODP_EVENT_BUFFER) + wrong_type = true; + if (subtype != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; if (odp_buffer_size(buffer[index]) < BUF_SIZE) - wrong_size = 1; + wrong_size = true;
addr = (uintptr_t)odp_buffer_addr(buffer[index]);
if ((addr % BUF_ALIGN) != 0) - wrong_align = 1; + wrong_align = true;
if (wrong_type || wrong_size || wrong_align) odp_buffer_print(buffer[index]); @@ -90,9 +98,10 @@ void buffer_test_pool_alloc(void) index--;
/* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); - CU_ASSERT(wrong_size == 0); - CU_ASSERT(wrong_align == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype); + CU_ASSERT(!wrong_size); + CU_ASSERT(!wrong_align);
for (; index >= 0; index--) odp_buffer_free(buffer[index]); @@ -123,7 +132,8 @@ void buffer_test_pool_alloc_multi(void) odp_buffer_t buffer[num + 1]; odp_event_t ev; int index; - char wrong_type = 0, wrong_size = 0, wrong_align = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; + odp_bool_t wrong_size = false, wrong_align = false; odp_pool_param_t params;
odp_pool_param_init(¶ms); @@ -140,20 +150,27 @@ void buffer_test_pool_alloc_multi(void)
for (index = 0; index < num; index++) { uintptr_t addr; + odp_event_subtype_t subtype;
if (buffer[index] == ODP_BUFFER_INVALID) break;
ev = odp_buffer_to_event(buffer[index]); if (odp_event_type(ev) != ODP_EVENT_BUFFER) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; + if (odp_event_types(ev, &subtype) != ODP_EVENT_BUFFER) + wrong_type = true; + if (subtype != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; if (odp_buffer_size(buffer[index]) < BUF_SIZE) - wrong_size = 1; + wrong_size = true;
addr = (uintptr_t)odp_buffer_addr(buffer[index]);
if ((addr % BUF_ALIGN) != 0) - wrong_align = 1; + wrong_align = true;
if (wrong_type || wrong_size || wrong_align) odp_buffer_print(buffer[index]); @@ -163,9 +180,10 @@ void buffer_test_pool_alloc_multi(void) CU_ASSERT(index == num);
/* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); - CU_ASSERT(wrong_size == 0); - CU_ASSERT(wrong_align == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype); + CU_ASSERT(!wrong_size); + CU_ASSERT(!wrong_align);
odp_buffer_free_multi(buffer, num);
@@ -244,10 +262,14 @@ void buffer_test_pool_free_multi(void) void buffer_test_management_basic(void) { odp_event_t ev = odp_buffer_to_event(raw_buffer); + odp_event_subtype_t subtype;
CU_ASSERT(odp_buffer_is_valid(raw_buffer) == 1); CU_ASSERT(odp_buffer_pool(raw_buffer) != ODP_POOL_INVALID); CU_ASSERT(odp_event_type(ev) == ODP_EVENT_BUFFER); + CU_ASSERT(odp_event_subtype(ev) == ODP_EVENT_NO_SUBTYPE); + CU_ASSERT(odp_event_types(ev, &subtype) == ODP_EVENT_BUFFER); + CU_ASSERT(subtype == ODP_EVENT_NO_SUBTYPE); CU_ASSERT(odp_buffer_size(raw_buffer) >= BUF_SIZE); CU_ASSERT(odp_buffer_addr(raw_buffer) != NULL); odp_buffer_print(raw_buffer); diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c index ae600e23..1d7d49a2 100644 --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c @@ -103,6 +103,7 @@ static void alg_test(odp_crypto_op_t op, odp_crypto_auth_capability_t auth_capa[MAX_ALG_CAPA]; int num, i; int found; + odp_event_subtype_t subtype;
rc = odp_crypto_capability(&capa); CU_ASSERT(!rc); @@ -263,6 +264,12 @@ static void alg_test(odp_crypto_op_t op, event = odp_queue_deq(suite_context.queue); } while (event == ODP_EVENT_INVALID);
+ CU_ASSERT(ODP_EVENT_CRYPTO_COMPL == odp_event_type(event)); + CU_ASSERT(ODP_EVENT_NO_SUBTYPE == odp_event_subtype(event)); + CU_ASSERT(ODP_EVENT_CRYPTO_COMPL == + odp_event_types(event, &subtype)); + CU_ASSERT(ODP_EVENT_NO_SUBTYPE == subtype); + compl_event = odp_crypto_compl_from_event(event); CU_ASSERT(odp_crypto_compl_to_u64(compl_event) == odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event))); @@ -272,6 +279,13 @@ static void alg_test(odp_crypto_op_t op,
CU_ASSERT(result.pkt == pkt); CU_ASSERT(result.ctx == (void *)0xdeadbeef); + CU_ASSERT(ODP_EVENT_PACKET == + odp_event_type(odp_packet_to_event(result.pkt))); + CU_ASSERT(ODP_EVENT_PACKET_BASIC == + odp_event_subtype(odp_packet_to_event(result.pkt))); + CU_ASSERT(ODP_EVENT_PACKET == + odp_event_types(odp_packet_to_event(result.pkt), &subtype)); + CU_ASSERT(ODP_EVENT_PACKET_BASIC == subtype);
if (should_fail) { CU_ASSERT(!result.ok); diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index 284aaeb5..fa6f4afd 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -241,6 +241,7 @@ void packet_test_alloc_free(void) odp_packet_t packet; odp_pool_param_t params; odp_pool_capability_t capa; + odp_event_subtype_t subtype;
CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);
@@ -259,7 +260,12 @@ void packet_test_alloc_free(void) CU_ASSERT_FATAL(packet != ODP_PACKET_INVALID); CU_ASSERT(odp_packet_len(packet) == packet_len); CU_ASSERT(odp_event_type(odp_packet_to_event(packet)) == - ODP_EVENT_PACKET); + ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_event_types(odp_packet_to_event(packet), &subtype) == + ODP_EVENT_PACKET); + CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID));
@@ -329,9 +335,17 @@ void packet_test_alloc_free_multi(void) CU_ASSERT_FATAL(ret == num_pkt);
for (i = 0; i < 2 * num_pkt; ++i) { + odp_event_subtype_t subtype; + CU_ASSERT(odp_packet_len(packet[i]) == packet_len); CU_ASSERT(odp_event_type(odp_packet_to_event(packet[i])) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(odp_packet_to_event(packet[i])) == + ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_event_types(odp_packet_to_event(packet[i]), + &subtype) == + ODP_EVENT_PACKET); + CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID)); } @@ -449,10 +463,15 @@ void packet_test_event_conversion(void) odp_packet_t pkt = test_packet; odp_packet_t tmp_pkt; odp_event_t ev; + odp_event_subtype_t subtype;
ev = odp_packet_to_event(pkt); CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); CU_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_event_types(ev, &subtype) == + ODP_EVENT_PACKET); + CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC);
tmp_pkt = odp_packet_from_event(ev); CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID); diff --git a/test/common_plat/validation/api/timer/timer.c b/test/common_plat/validation/api/timer/timer.c index b7d84c64..88135160 100644 --- a/test/common_plat/validation/api/timer/timer.c +++ b/test/common_plat/validation/api/timer/timer.c @@ -59,7 +59,7 @@ void timer_test_timeout_pool_alloc(void) odp_timeout_t tmo[num]; odp_event_t ev; int index; - char wrong_type = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; odp_pool_param_t params;
odp_pool_param_init(¶ms); @@ -73,6 +73,8 @@ void timer_test_timeout_pool_alloc(void)
/* Try to allocate num items from the pool */ for (index = 0; index < num; index++) { + odp_event_subtype_t subtype; + tmo[index] = odp_timeout_alloc(pool);
if (tmo[index] == ODP_TIMEOUT_INVALID) @@ -80,7 +82,13 @@ void timer_test_timeout_pool_alloc(void)
ev = odp_timeout_to_event(tmo[index]); if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; + if (odp_event_types(ev, &subtype) != ODP_EVENT_TIMEOUT) + wrong_type = true; + if (subtype != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; }
/* Check that the pool had at least num items */ @@ -89,7 +97,8 @@ void timer_test_timeout_pool_alloc(void) index--;
/* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype);
for (; index >= 0; index--) odp_timeout_free(tmo[index]); @@ -219,12 +228,29 @@ void timer_test_odp_timer_cancel(void) /* @private Handle a received (timeout) event */ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) { + odp_event_subtype_t subtype; + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); /* Internal error */ if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { /* Not a timeout event */ CU_FAIL("Unexpected event type received"); return; } + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) { + /* Not a timeout event */ + CU_FAIL("Unexpected event subtype received"); + return; + } + if (odp_event_types(ev, &subtype) != ODP_EVENT_TIMEOUT) { + /* Not a timeout event */ + CU_FAIL("Unexpected event type received"); + return; + } + if (subtype != ODP_EVENT_NO_SUBTYPE) { + /* Not a timeout event */ + CU_FAIL("Unexpected event subtype received"); + return; + } /* Read the metadata from the timeout */ odp_timeout_t tmo = odp_timeout_from_event(ev); odp_timer_t tim = odp_timeout_timer(tmo);
commit faf97a341df8e92fd692029fe2c6c353f043950b Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Jul 4 15:54:02 2017 +0300
linux-generic: events subtype implementation
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h index cf817d90..4c0e7339 100644 --- a/platform/linux-generic/include/odp_buffer_inlines.h +++ b/platform/linux-generic/include/odp_buffer_inlines.h @@ -21,6 +21,8 @@ extern "C" {
odp_event_type_t _odp_buffer_event_type(odp_buffer_t buf); void _odp_buffer_event_type_set(odp_buffer_t buf, int ev); +odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf); +void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev); int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf);
static inline odp_buffer_t odp_hdr_to_buf(odp_buffer_hdr_t *hdr) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 076abe96..dadf285e 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -96,6 +96,9 @@ struct odp_buffer_hdr_t { /* Event type. Maybe different than pool type (crypto compl event) */ int8_t event_type;
+ /* Event subtype. Should be ODP_EVENT_NO_SUBTYPE except packets. */ + int8_t event_subtype; + /* Burst table */ struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 68fc5658..0e2adad1 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -907,12 +907,13 @@ odp_crypto_operation(odp_crypto_op_param_t *param, if (ODP_QUEUE_INVALID != session->p.compl_queue) { odp_event_t completion_event; odp_crypto_generic_op_result_t *op_result; + odp_buffer_t buf;
/* Linux generic will always use packet for completion event */ completion_event = odp_packet_to_event(param->out_pkt); - _odp_buffer_event_type_set( - odp_buffer_from_event(completion_event), - ODP_EVENT_CRYPTO_COMPL); + buf = odp_buffer_from_event(completion_event); + _odp_buffer_event_type_set(buf, ODP_EVENT_CRYPTO_COMPL); + _odp_buffer_event_subtype_set(buf, ODP_EVENT_NO_SUBTYPE); /* Asynchronous, build result (no HW so no errors) and send it*/ op_result = get_op_result_from_event(completion_event); op_result->magic = OP_RESULT_MAGIC; @@ -1106,9 +1107,11 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, void odp_crypto_compl_free(odp_crypto_compl_t completion_event) { - _odp_buffer_event_type_set( - odp_buffer_from_event((odp_event_t)completion_event), - ODP_EVENT_PACKET); + odp_buffer_t buf = + odp_buffer_from_event((odp_event_t)completion_event); + + _odp_buffer_event_type_set(buf, ODP_EVENT_PACKET); + _odp_buffer_event_subtype_set(buf, ODP_EVENT_PACKET_BASIC); }
void odp_crypto_session_param_init(odp_crypto_session_param_t *param) diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index d71f4464..23b410d8 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -19,6 +19,21 @@ odp_event_type_t odp_event_type(odp_event_t event) return _odp_buffer_event_type(odp_buffer_from_event(event)); }
+odp_event_subtype_t odp_event_subtype(odp_event_t event) +{ + return _odp_buffer_event_subtype(odp_buffer_from_event(event)); +} + +odp_event_type_t odp_event_types(odp_event_t event, + odp_event_subtype_t *subtype) +{ + odp_buffer_t buf = odp_buffer_from_event(event); + + *subtype = _odp_buffer_event_subtype(buf); + + return _odp_buffer_event_type(buf); +} + void odp_event_free(odp_event_t event) { switch (odp_event_type(event)) { diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index eb66af2d..3789feca 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -268,6 +268,7 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) CONFIG_PACKET_TAILROOM;
pkt_hdr->input = ODP_PKTIO_INVALID; + pkt_hdr->buf_hdr.event_subtype = ODP_EVENT_PACKET_BASIC; }
static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 9dba7341..23b80698 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -259,6 +259,7 @@ static void init_buffers(pool_t *pool) buf_hdr->size = seg_size; buf_hdr->type = type; buf_hdr->event_type = type; + buf_hdr->event_subtype = ODP_EVENT_NO_SUBTYPE; buf_hdr->pool_hdl = pool->pool_hdl; buf_hdr->uarea_addr = uarea; /* Show user requested size through API */ @@ -566,6 +567,16 @@ void _odp_buffer_event_type_set(odp_buffer_t buf, int ev) buf_hdl_to_hdr(buf)->event_type = ev; }
+odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf) +{ + return buf_hdl_to_hdr(buf)->event_subtype; +} + +void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev) +{ + buf_hdl_to_hdr(buf)->event_subtype = ev; +} + odp_pool_t odp_pool_lookup(const char *name) { uint32_t i;
-----------------------------------------------------------------------
Summary of changes: platform/linux-generic/Makefile.am | 1 - .../linux-generic/include/odp_buffer_inlines.h | 2 + .../linux-generic/include/odp_buffer_internal.h | 3 + .../linux-generic/include/odp_packet_internal.h | 3 +- .../linux-generic/include/odp_packet_io_internal.h | 2 + .../linux-generic/include/odp_packet_io_queue.h | 48 -------- platform/linux-generic/include/odp_queue_if.h | 20 ++- platform/linux-generic/odp_classification.c | 10 +- platform/linux-generic/odp_crypto.c | 15 ++- platform/linux-generic/odp_event.c | 15 +++ platform/linux-generic/odp_packet.c | 1 + platform/linux-generic/odp_packet_io.c | 137 +++++++++++---------- platform/linux-generic/odp_pool.c | 11 ++ platform/linux-generic/odp_queue.c | 39 +++--- platform/linux-generic/odp_queue_scalable.c | 39 +++--- platform/linux-generic/odp_traffic_mngr.c | 10 +- test/common_plat/validation/api/buffer/buffer.c | 50 +++++--- .../validation/api/crypto/odp_crypto_test_inp.c | 14 +++ test/common_plat/validation/api/packet/packet.c | 21 +++- test/common_plat/validation/api/timer/timer.c | 32 ++++- 20 files changed, 258 insertions(+), 215 deletions(-) delete mode 100644 platform/linux-generic/include/odp_packet_io_queue.h
hooks/post-receive