This looks good, however the documentation of what
ODP_[CONFIG]_SHM_NUM_BLOCKS means could use improvement.  This the the
number of separate SHM areas that can be reserved concurrently.  Referring
to this as "blocks" is somewhat confusing as that gives the impression it's
somehow referring to the size of these areas when it's their count.

Since each pool requires a corresponding SHM, this number always needs to
be >= ODP_CONFIG_NUM_POOLS.  I suspect the original value of 32 was sized
at ODP_CONFIG_NUM_POOLS*2 since that's set to 16.  Perhaps this should be a
derived value from ODP_CONFIG_NUM_POOLS?

Bill

On Mon, Feb 23, 2015 at 12:35 PM, Mike Holmes <[email protected]>
wrote:

> ODP_SHM_NUM_BLOCKS was defined down in the implementation, move it out
> to the config.h
>
> Signed-off-by: Mike Holmes <[email protected]>
> ---
>  include/odp/api/config.h                   | 6 ++++++
>  platform/linux-generic/odp_shared_memory.c | 5 +----
>  2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/include/odp/api/config.h b/include/odp/api/config.h
> index 8f1139d..f767021 100644
> --- a/include/odp/api/config.h
> +++ b/include/odp/api/config.h
> @@ -121,6 +121,12 @@ extern "C" {
>   */
>  #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
>
> +/** Maximum number of shared memory blocks.
> + *
> + * Limits how many blocks are available for calls to odp_shm_reserve()
> + */
> +#define ODP_SHM_NUM_BLOCKS 32
> +
>  /**
>   * @}
>   */
> diff --git a/platform/linux-generic/odp_shared_memory.c
> b/platform/linux-generic/odp_shared_memory.c
> index dbaec22..9b6e92b 100644
> --- a/platform/linux-generic/odp_shared_memory.c
> +++ b/platform/linux-generic/odp_shared_memory.c
> @@ -15,6 +15,7 @@
>  #include <odp/debug.h>
>  #include <odp_debug_internal.h>
>  #include <odp_align_internal.h>
> +#include <odp/config.h>
>
>  #include <unistd.h>
>  #include <sys/mman.h>
> @@ -26,10 +27,6 @@
>  #include <string.h>
>  #include <errno.h>
>
> -
> -#define ODP_SHM_NUM_BLOCKS 32
> -
> -
>  typedef struct {
>         char      name[ODP_SHM_NAME_LEN];
>         uint64_t  size;
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to