diff options
Diffstat (limited to 'platform/linux-generic/odp_stash.c')
-rw-r--r-- | platform/linux-generic/odp_stash.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/platform/linux-generic/odp_stash.c b/platform/linux-generic/odp_stash.c index d2062379b..a1bf5b63d 100644 --- a/platform/linux-generic/odp_stash.c +++ b/platform/linux-generic/odp_stash.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2020, Nokia +/* Copyright (c) 2020-2021, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -13,6 +13,7 @@ #include <odp/api/plat/strong_types.h> #include <odp_debug_internal.h> +#include <odp_global_data.h> #include <odp_init_internal.h> #include <odp_ring_ptr_internal.h> #include <odp_ring_u32_internal.h> @@ -57,7 +58,12 @@ int _odp_stash_init_global(void) { odp_shm_t shm; - shm = odp_shm_reserve("_odp_stash_table", sizeof(stash_global_t), + if (odp_global_ro.disable.stash) { + ODP_PRINT("Stash is DISABLED\n"); + return 0; + } + + shm = odp_shm_reserve("_odp_stash_global", sizeof(stash_global_t), ODP_CACHE_LINE_SIZE, 0); stash_global = odp_shm_addr(shm); @@ -76,6 +82,9 @@ int _odp_stash_init_global(void) int _odp_stash_term_global(void) { + if (odp_global_ro.disable.stash) + return 0; + if (stash_global == NULL) return 0; @@ -89,6 +98,11 @@ int _odp_stash_term_global(void) int odp_stash_capability(odp_stash_capability_t *capa, odp_stash_type_t type) { + if (odp_global_ro.disable.stash) { + ODP_ERR("Stash is disabled\n"); + return -1; + } + (void)type; memset(capa, 0, sizeof(odp_stash_capability_t)); @@ -146,6 +160,11 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param) int ring_ptr, index; char shm_name[ODP_STASH_NAME_LEN + 8]; + if (odp_global_ro.disable.stash) { + ODP_ERR("Stash is disabled\n"); + return ODP_STASH_INVALID; + } + if (param->obj_size > sizeof(uintptr_t)) { ODP_ERR("Too large object handle.\n"); return ODP_STASH_INVALID; |