Skip to content

Commit

Permalink
linux-gen: pool: add constant for internal pool count
Browse files Browse the repository at this point in the history
Add a new `CONFIG_INTERNAL_POOLS` constant for tracking pools reserved
for implementation internal use, such as the pool for IPsec status
events. Utilize the new constant when implementation capabilities are
queried.

Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
  • Loading branch information
TuomasTaipale committed Oct 31, 2023
1 parent 3180dc0 commit 21ea709
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
18 changes: 12 additions & 6 deletions platform/linux-generic/include/odp_config_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,21 @@ extern "C" {
*/
#define CONFIG_NUM_CPU_IDS 256

/*
* Maximum number of packet IO resources
*/
#define CONFIG_PKTIO_ENTRIES 64

/*
* Pools reserved for internal usage, 1 for IPsec status events and one per packet
* I/O for TX completion
*/
#define CONFIG_INTERNAL_POOLS (1 + CONFIG_PKTIO_ENTRIES)

/*
* Maximum number of pools.
*/
#define CONFIG_POOLS 32
#define CONFIG_POOLS 128

/*
* Queues reserved for ODP internal use
Expand Down Expand Up @@ -68,11 +79,6 @@ extern "C" {
*/
#define CONFIG_MAX_STASHES 2048

/*
* Maximum number of packet IO resources
*/
#define CONFIG_PKTIO_ENTRIES 64

/*
* Maximum buffer alignment
*
Expand Down
3 changes: 2 additions & 1 deletion platform/linux-generic/odp_fdserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/

#include <odp_posix_extensions.h>
#include <odp_config_internal.h>
#include <odp_global_data.h>
#include <odp_init_internal.h>
#include <odp_debug_internal.h>
Expand Down Expand Up @@ -72,7 +73,7 @@
#define FD_DBG 3

/* define the tables of file descriptors handled by this server: */
#define FDSERVER_MAX_ENTRIES 256
#define FDSERVER_MAX_ENTRIES (CONFIG_SHM_BLOCKS + CONFIG_INTERNAL_SHM_BLOCKS)
typedef struct fdentry_s {
fd_server_context_e context;
uint64_t key;
Expand Down
9 changes: 6 additions & 3 deletions platform/linux-generic/odp_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ ODP_STATIC_ASSERT(CONFIG_PACKET_SEG_LEN_MIN >= 256,
ODP_STATIC_ASSERT(CONFIG_PACKET_SEG_SIZE < 0xffff,
"Segment size must be less than 64k (16 bit offsets)");

ODP_STATIC_ASSERT(CONFIG_INTERNAL_POOLS < CONFIG_POOLS,
"Internal pool count needs to be less than total configured pool count");

/* Thread local variables */
typedef struct pool_local_t {
pool_cache_t *cache[CONFIG_POOLS];
Expand Down Expand Up @@ -1463,8 +1466,8 @@ int odp_pool_capability(odp_pool_capability_t *capa)
{
odp_pool_stats_opt_t supported_stats;
uint32_t max_seg_len = CONFIG_PACKET_MAX_SEG_LEN;
/* Reserve one for internal usage */
int max_pools = CONFIG_POOLS - 1;
/* Reserve pools for internal usage */
unsigned int max_pools = CONFIG_POOLS - CONFIG_INTERNAL_POOLS;

memset(capa, 0, sizeof(odp_pool_capability_t));

Expand Down Expand Up @@ -1877,7 +1880,7 @@ int odp_pool_ext_capability(odp_pool_type_t type, odp_pool_ext_capability_t *cap
memset(capa, 0, sizeof(odp_pool_ext_capability_t));

capa->type = type;
capa->max_pools = CONFIG_POOLS - 1;
capa->max_pools = CONFIG_POOLS - CONFIG_INTERNAL_POOLS;
capa->min_cache_size = 0;
capa->max_cache_size = CONFIG_POOL_CACHE_MAX_SIZE;
capa->stats.all = supported_stats.all;
Expand Down
1 change: 1 addition & 0 deletions platform/linux-generic/odp_system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ void odp_sys_config_print(void)
_ODP_PRINT("CONFIG_INTERNAL_SHM_BLOCKS: %i\n", CONFIG_INTERNAL_SHM_BLOCKS);
_ODP_PRINT("CONFIG_SHM_BLOCKS: %i\n", CONFIG_SHM_BLOCKS);
_ODP_PRINT("CONFIG_BURST_SIZE: %i\n", CONFIG_BURST_SIZE);
_ODP_PRINT("CONFIG_INTERNAL_POOLS: %i\n", CONFIG_INTERNAL_POOLS);
_ODP_PRINT("CONFIG_POOLS: %i\n", CONFIG_POOLS);
_ODP_PRINT("CONFIG_POOL_MAX_NUM: %i\n", CONFIG_POOL_MAX_NUM);
_ODP_PRINT("CONFIG_POOL_CACHE_MAX_SIZE: %i\n", CONFIG_POOL_CACHE_MAX_SIZE);
Expand Down

0 comments on commit 21ea709

Please sign in to comment.