diff options
Diffstat (limited to 'platform/linux-dpdk/include')
-rw-r--r-- | platform/linux-dpdk/include/odp_config_internal.h | 10 | ||||
-rw-r--r-- | platform/linux-dpdk/include/odp_pool_internal.h | 19 |
2 files changed, 28 insertions, 1 deletions
diff --git a/platform/linux-dpdk/include/odp_config_internal.h b/platform/linux-dpdk/include/odp_config_internal.h index 0d2e6f478..0f86f4da5 100644 --- a/platform/linux-dpdk/include/odp_config_internal.h +++ b/platform/linux-dpdk/include/odp_config_internal.h @@ -54,6 +54,11 @@ extern "C" { #define CONFIG_QUEUE_MAX_ORD_LOCKS 2 /* + * Maximum number of stashes + */ +#define CONFIG_MAX_STASHES 128 + +/* * Maximum number of packet IO resources */ #define ODP_CONFIG_PKTIO_ENTRIES 64 @@ -126,8 +131,11 @@ extern "C" { /* * Number of shared memory blocks reserved for implementation internal use. + * + * Each stash and packet pool requires one SHM block, and 20 blocks are + * reserved for per ODP module global data. */ -#define CONFIG_INTERNAL_SHM_BLOCKS (ODP_CONFIG_POOLS + 20) +#define CONFIG_INTERNAL_SHM_BLOCKS (CONFIG_MAX_STASHES + ODP_CONFIG_POOLS + 20) /* * Maximum number of shared memory blocks. diff --git a/platform/linux-dpdk/include/odp_pool_internal.h b/platform/linux-dpdk/include/odp_pool_internal.h index 0b5df61af..39ca0f002 100644 --- a/platform/linux-dpdk/include/odp_pool_internal.h +++ b/platform/linux-dpdk/include/odp_pool_internal.h @@ -106,6 +106,25 @@ static inline pool_t *pool_entry_from_hdl(odp_pool_t pool_hdl) return &_odp_pool_glb->pool[_odp_typeval(pool_hdl) - 1]; } +static inline int _odp_buffer_alloc_multi(pool_t *pool, + odp_buffer_hdr_t *buf_hdr[], int num) +{ + int i; + struct rte_mempool *mp = pool->rte_mempool; + + for (i = 0; i < num; i++) { + struct rte_mbuf *mbuf; + + mbuf = rte_mbuf_raw_alloc(mp); + if (odp_unlikely(mbuf == NULL)) + return i; + + buf_hdr[i] = mbuf_to_buf_hdr(mbuf); + } + + return i; +} + static inline void _odp_buffer_free_multi(odp_buffer_hdr_t *buf_hdr[], int num) { int i; |