aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2016-04-26 13:40:44 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-27 09:24:42 +0300
commit64f8fa212ef3008c66a37938faf011f67fb2cb0d (patch)
tree4ab5a0783723a57f3dfe6f1a47186fae955a6e0e /platform
parent0151a42009aea4d749cf22caf08b2448ba123c00 (diff)
api: queue: replaced config api with capability structure
Added queue capability structure and replaced the config API definitions with it. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/odp/api/config.h36
-rw-r--r--platform/linux-generic/include/odp/api/plat/schedule_types.h4
-rw-r--r--platform/linux-generic/include/odp_config_internal.h20
-rw-r--r--platform/linux-generic/odp_queue.c12
-rw-r--r--platform/linux-generic/odp_schedule.c9
-rw-r--r--platform/linux-generic/odp_thread.c2
6 files changed, 43 insertions, 40 deletions
diff --git a/platform/linux-generic/include/odp/api/config.h b/platform/linux-generic/include/odp/api/config.h
index 2fba933da..1f16438df 100644
--- a/platform/linux-generic/include/odp/api/config.h
+++ b/platform/linux-generic/include/odp/api/config.h
@@ -22,42 +22,6 @@ extern "C" {
* @{
*/
-/**
- * Maximum number of queues
- */
-#define ODP_CONFIG_QUEUES 1024
-static inline int odp_config_queues(void)
-{
- return ODP_CONFIG_QUEUES;
-}
-
-/**
- * Number of ordered locks per queue
- */
-#define ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE 2
-static inline int odp_config_max_ordered_locks_per_queue(void)
-{
- return ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE;
-}
-
-/**
- * Number of scheduling priorities
- */
-#define ODP_CONFIG_SCHED_PRIOS 8
-static inline int odp_config_sched_prios(void)
-{
- return ODP_CONFIG_SCHED_PRIOS;
-}
-
-/**
- * Number of scheduling groups
- */
-#define ODP_CONFIG_SCHED_GRPS 256
-static inline int odp_config_sched_grps(void)
-{
- return ODP_CONFIG_SCHED_GRPS;
-}
-
#include <odp/api/spec/config.h>
/**
diff --git a/platform/linux-generic/include/odp/api/plat/schedule_types.h b/platform/linux-generic/include/odp/api/plat/schedule_types.h
index a4a352c04..535fd6d05 100644
--- a/platform/linux-generic/include/odp/api/plat/schedule_types.h
+++ b/platform/linux-generic/include/odp/api/plat/schedule_types.h
@@ -29,9 +29,9 @@ typedef int odp_schedule_prio_t;
#define ODP_SCHED_PRIO_HIGHEST 0
-#define ODP_SCHED_PRIO_NORMAL (ODP_CONFIG_SCHED_PRIOS / 2)
+#define ODP_SCHED_PRIO_NORMAL 4
-#define ODP_SCHED_PRIO_LOWEST (ODP_CONFIG_SCHED_PRIOS - 1)
+#define ODP_SCHED_PRIO_LOWEST 7
#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL
diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h
index fecfbec81..b2c00ddcb 100644
--- a/platform/linux-generic/include/odp_config_internal.h
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -130,6 +130,26 @@ extern "C" {
*/
#define ODP_CONFIG_PKTIO_ENTRIES 64
+/*
+ * Maximum number of queues
+ */
+#define ODP_CONFIG_QUEUES 1024
+
+/*
+ * Number of ordered locks per queue
+ */
+#define ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE 2
+
+/*
+ * Number of scheduling priorities
+ */
+#define ODP_CONFIG_SCHED_PRIOS 8
+
+/*
+ * Number of scheduling groups
+ */
+#define ODP_CONFIG_SCHED_GRPS 256
+
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 95382402d..d4043f078 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -188,6 +188,18 @@ int odp_queue_term_global(void)
return rc;
}
+int odp_queue_capability(odp_queue_capability_t *capa)
+{
+ memset(capa, 0, sizeof(odp_queue_capability_t));
+
+ capa->max_queues = ODP_CONFIG_QUEUES;
+ capa->max_ordered_locks = ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE;
+ capa->max_sched_groups = ODP_CONFIG_SCHED_GRPS;
+ capa->sched_prios = ODP_CONFIG_SCHED_PRIOS;
+
+ return 0;
+}
+
odp_queue_type_t odp_queue_type(odp_queue_t handle)
{
queue_entry_t *queue;
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 0595e7056..1aaab9398 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -13,7 +13,7 @@
#include <odp/api/buffer.h>
#include <odp/api/pool.h>
#include <odp_internal.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp_debug_internal.h>
#include <odp/api/thread.h>
#include <odp/api/time.h>
@@ -26,6 +26,13 @@
odp_thrmask_t sched_mask_all;
+ODP_STATIC_ASSERT(ODP_SCHED_PRIO_LOWEST == (ODP_CONFIG_SCHED_PRIOS - 1),
+ "lowest_prio_does_not_match_with_num_prios");
+
+ODP_STATIC_ASSERT((ODP_SCHED_PRIO_NORMAL > 0) &&
+ (ODP_SCHED_PRIO_NORMAL < (ODP_CONFIG_SCHED_PRIOS - 1)),
+ "normal_prio_is_not_between_highest_and_lowest");
+
/* Number of schedule commands.
* One per scheduled queue and packet interface */
#define NUM_SCHED_CMD (ODP_CONFIG_QUEUES + ODP_CONFIG_PKTIO_ENTRIES)
diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c
index 420e4eb2f..866d58f25 100644
--- a/platform/linux-generic/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
@@ -11,7 +11,7 @@
#include <odp/api/thrmask.h>
#include <odp_internal.h>
#include <odp/api/spinlock.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp_debug_internal.h>
#include <odp/api/shared_memory.h>
#include <odp/api/align.h>