aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2016-05-26 19:03:30 +0100
committerZoltan Kiss <zoltan.kiss@linaro.org>2016-05-26 19:03:30 +0100
commitb97b756c4502acb632096dc0ea43a53e96de8dda (patch)
tree9239a276dc60a7b7921c2515eae1130819226ebe
parent5646d6e0504713328ad610dde751eaac074da353 (diff)
Port "api: pool: add pool capability" series
The following patches were ported: 9ca19730 api: config: replace pool config with pool capability 64f8fa21 api: queue: replaced config api with capability structure 7a56ae3e api: config: removed config.h Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
-rw-r--r--platform/linux-dpdk/Makefile.am2
-rw-r--r--platform/linux-dpdk/include/odp_buffer_internal.h2
-rw-r--r--platform/linux-dpdk/include/odp_config_internal.h (renamed from platform/linux-dpdk/include/odp/api/config.h)127
-rw-r--r--platform/linux-dpdk/include/odp_packet_io_internal.h2
-rw-r--r--platform/linux-dpdk/include/odp_pool_internal.h2
-rw-r--r--platform/linux-dpdk/odp_pool.c33
-rw-r--r--platform/linux-dpdk/odp_thread.c2
7 files changed, 59 insertions, 111 deletions
diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am
index 644beeca3..b2c29e8b8 100644
--- a/platform/linux-dpdk/Makefile.am
+++ b/platform/linux-dpdk/Makefile.am
@@ -37,7 +37,6 @@ odpapiinclude_HEADERS = \
$(srcdir)/include/odp/api/byteorder.h \
$(srcdir)/include/odp/api/classification.h \
$(srcdir)/include/odp/api/compiler.h \
- $(srcdir)/include/odp/api/config.h \
$(srcdir)/include/odp/api/cpu.h \
$(srcdir)/include/odp/api/cpumask.h \
$(srcdir)/include/odp/api/crypto.h \
@@ -106,6 +105,7 @@ odpapiplatinclude_HEADERS = \
noinst_HEADERS = \
$(srcdir)/include/odp_buffer_internal.h \
$(top_srcdir)/platform/linux-generic/include/odp_classification_internal.h \
+ ${srcdir}/include/odp_config_internal.h \
$(top_srcdir)/platform/linux-generic/include/odp_debug_internal.h \
$(srcdir)/include/odp_packet_dpdk.h \
$(srcdir)/include/odp_packet_internal.h \
diff --git a/platform/linux-dpdk/include/odp_buffer_internal.h b/platform/linux-dpdk/include/odp_buffer_internal.h
index d014f7802..b5a9b3267 100644
--- a/platform/linux-dpdk/include/odp_buffer_internal.h
+++ b/platform/linux-dpdk/include/odp_buffer_internal.h
@@ -25,7 +25,7 @@ extern "C" {
#include <odp/api/debug.h>
#include <odp/api/align.h>
#include <odp_align_internal.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp/api/byteorder.h>
#include <odp/api/thread.h>
#include <sys/types.h>
diff --git a/platform/linux-dpdk/include/odp/api/config.h b/platform/linux-dpdk/include/odp_config_internal.h
index 5b9c218a6..96c63af14 100644
--- a/platform/linux-dpdk/include/odp/api/config.h
+++ b/platform/linux-dpdk/include/odp_config_internal.h
@@ -1,106 +1,48 @@
-/* Copyright (c) 2015, Linaro Limited
+/* Copyright (c) 2016, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-/**
- * @file
- *
- * ODP configuration
- */
-
-#ifndef ODP_PLAT_CONFIG_H_
-#define ODP_PLAT_CONFIG_H_
+#ifndef ODP_CONFIG_INTERNAL_H_
+#define ODP_CONFIG_INTERNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
-/** @ingroup odp_config ODP CONFIG
- * Platform-specific configuration limits
- * @{
- */
-
-/**
+/*
* Maximum number of pools
*/
#define ODP_CONFIG_POOLS 16
-static inline int odp_config_pools(void)
-{
- return ODP_CONFIG_POOLS;
-}
-/**
+/*
* 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;
-}
-/**
+/*
* Maximum number of packet IO resources
*/
#define ODP_CONFIG_PKTIO_ENTRIES 64
-static inline int odp_config_pktio_entries(void)
-{
- return ODP_CONFIG_PKTIO_ENTRIES;
-}
-/**
+/*
* Minimum buffer alignment
*
* This defines the minimum supported buffer alignment. Requests for values
* below this will be rounded up to this value.
*/
#define ODP_CONFIG_BUFFER_ALIGN_MIN 16
-static inline int odp_config_buffer_align_min(void)
-{
- return ODP_CONFIG_BUFFER_ALIGN_MIN;
-}
-/**
+/*
* Maximum buffer alignment
*
* This defines the maximum supported buffer alignment. Requests for values
* above this will fail.
*/
#define ODP_CONFIG_BUFFER_ALIGN_MAX (4 * 1024)
-static inline int odp_config_buffer_align_max(void)
-{
- return ODP_CONFIG_BUFFER_ALIGN_MAX;
-}
-/**
+/*
* Default packet headroom
*
* This defines the minimum number of headroom bytes that newly created packets
@@ -112,13 +54,9 @@ static inline int odp_config_buffer_align_max(void)
* The default value (66) allows a 1500-byte packet to be received into a single
* segment with Ethernet offset alignment and room for some header expansion.
*/
-#define ODP_CONFIG_PACKET_HEADROOM 128
-static inline int odp_config_packet_headroom(void)
-{
- return ODP_CONFIG_PACKET_HEADROOM;
-}
+#define ODP_CONFIG_PACKET_HEADROOM 66
-/**
+/*
* Default packet tailroom
*
* This defines the minimum number of tailroom bytes that newly created packets
@@ -128,25 +66,22 @@ static inline int odp_config_packet_headroom(void)
* consider any unused portion of the last segment of a packet as tailroom
*/
#define ODP_CONFIG_PACKET_TAILROOM 0
-static inline int odp_config_packet_tailroom(void)
-{
- return ODP_CONFIG_PACKET_TAILROOM;
-}
-/**
+/*
+ * Maximum number of segments per packet
+ */
+#define ODP_CONFIG_PACKET_MAX_SEGS 6
+
+/*
* Minimum packet segment length
*
* This defines the minimum packet segment buffer length in bytes. The user
* defined segment length (seg_len in odp_pool_param_t) will be rounded up into
* this value.
*/
-#define ODP_CONFIG_PACKET_SEG_LEN_MIN 1024
-static inline int odp_config_packet_seg_len_min(void)
-{
- return ODP_CONFIG_PACKET_SEG_LEN_MIN;
-}
+#define ODP_CONFIG_PACKET_SEG_LEN_MIN 1598
-/**
+/*
* Maximum packet segment length
*
* This defines the maximum packet segment buffer length in bytes. The user
@@ -154,12 +89,8 @@ static inline int odp_config_packet_seg_len_min(void)
* this.
*/
#define ODP_CONFIG_PACKET_SEG_LEN_MAX (64 * 1024)
-static inline int odp_config_packet_seg_len_max(void)
-{
- return ODP_CONFIG_PACKET_SEG_LEN_MAX;
-}
-/**
+/*
* Maximum packet buffer length
*
* This defines the maximum number of bytes that can be stored into a packet
@@ -171,27 +102,13 @@ static inline int odp_config_packet_seg_len_max(void)
* - The value MUST be an integral number of segments
* - The value SHOULD be large enough to accommodate jumbo packets (9K)
*/
-#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN * 9)
-static inline int odp_config_packet_buf_len_max(void)
-{
- return ODP_CONFIG_PACKET_BUF_LEN_MAX;
-}
+#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN * 6)
-/** Maximum number of shared memory blocks.
+/* Maximum number of shared memory blocks.
*
* This the the number of separate SHM areas that can be reserved concurrently
*/
#define ODP_CONFIG_SHM_BLOCKS (ODP_CONFIG_POOLS + 48)
-static inline int odp_config_shm_blocks(void)
-{
- return ODP_CONFIG_SHM_BLOCKS;
-}
-
-#include <odp/api/spec/config.h>
-
-/**
- * @}
- */
#ifdef __cplusplus
}
diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h
index ab96b41a4..dea6935ab 100644
--- a/platform/linux-dpdk/include/odp_packet_io_internal.h
+++ b/platform/linux-dpdk/include/odp_packet_io_internal.h
@@ -25,7 +25,7 @@ extern "C" {
#include <odp_align_internal.h>
#include <odp_debug_internal.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp/api/hints.h>
#define PKTIO_MAX_QUEUES 64
diff --git a/platform/linux-dpdk/include/odp_pool_internal.h b/platform/linux-dpdk/include/odp_pool_internal.h
index dd8b72a96..81d0c1d0b 100644
--- a/platform/linux-dpdk/include/odp_pool_internal.h
+++ b/platform/linux-dpdk/include/odp_pool_internal.h
@@ -24,7 +24,7 @@ extern "C" {
#include <odp/api/packet_io.h>
#include <odp/api/align.h>
#include <odp/api/hints.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp/api/debug.h>
#include <odp_debug_internal.h>
#include <string.h>
diff --git a/platform/linux-dpdk/odp_pool.c b/platform/linux-dpdk/odp_pool.c
index 14ccada36..1f7704690 100644
--- a/platform/linux-dpdk/odp_pool.c
+++ b/platform/linux-dpdk/odp_pool.c
@@ -14,7 +14,7 @@
#include <odp/api/shared_memory.h>
#include <odp/api/align.h>
#include <odp_internal.h>
-#include <odp/api/config.h>
+#include <odp_config_internal.h>
#include <odp/api/hints.h>
#include <odp/api/debug.h>
#include <odp_debug_internal.h>
@@ -102,6 +102,37 @@ int odp_pool_term_local(void)
return 0;
}
+int odp_pool_capability(odp_pool_capability_t *capa)
+{
+ memset(capa, 0, sizeof(odp_pool_capability_t));
+
+ capa->max_pools = ODP_CONFIG_POOLS;
+
+ /* Buffer pools */
+ capa->buf.max_pools = ODP_CONFIG_POOLS;
+ capa->buf.max_align = ODP_CONFIG_BUFFER_ALIGN_MAX;
+ capa->buf.max_size = 0;
+ capa->buf.max_num = 0;
+
+ /* Packet pools */
+ capa->pkt.max_pools = ODP_CONFIG_POOLS;
+ capa->pkt.max_len = ODP_CONFIG_PACKET_MAX_SEGS *
+ ODP_CONFIG_PACKET_SEG_LEN_MIN;
+ capa->pkt.max_num = 0;
+ capa->pkt.min_headroom = ODP_CONFIG_PACKET_HEADROOM;
+ capa->pkt.min_tailroom = ODP_CONFIG_PACKET_TAILROOM;
+ capa->pkt.max_segs_per_pkt = ODP_CONFIG_PACKET_MAX_SEGS;
+ capa->pkt.min_seg_len = ODP_CONFIG_PACKET_SEG_LEN_MIN;
+ capa->pkt.max_seg_len = ODP_CONFIG_PACKET_SEG_LEN_MAX;
+ capa->pkt.max_uarea_size = 0;
+
+ /* Timeout pools */
+ capa->tmo.max_pools = ODP_CONFIG_POOLS;
+ capa->tmo.max_num = 0;
+
+ return 0;
+}
+
struct mbuf_ctor_arg {
uint16_t seg_buf_offset; /* To skip the ODP buf/pkt/tmo header */
uint16_t seg_buf_size; /* size of user data */
diff --git a/platform/linux-dpdk/odp_thread.c b/platform/linux-dpdk/odp_thread.c
index 76fed7de9..725ba3b54 100644
--- a/platform/linux-dpdk/odp_thread.c
+++ b/platform/linux-dpdk/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>