[dpdk-dev] [PATCH v3 1/7] malloc: introduce malloc is ready API
Thomas Monjalon
thomas at monjalon.net
Tue Oct 19 17:53:08 CEST 2021
18/10/2021 21:37, Harman Kalra:
> @@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void)
> {
> struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
> unsigned int i;
> + int ret;
> const struct internal_config *internal_conf =
> eal_get_internal_configuration();
>
> @@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)
> return 0;
>
> /* add all IOVA-contiguous areas to the heap */
> - return rte_memseg_contig_walk(malloc_add_seg, NULL);
> + ret = rte_memseg_contig_walk(malloc_add_seg, NULL);
> +
> + if (!ret)
Style: It should be "if (ret == 0)" because ret is not a bool.
> + malloc_ready = true;
> +
> + return ret;
> +}
> +
> +bool
> +rte_malloc_is_ready(void)
> +{
> + return malloc_ready == true;
> }
> --- a/lib/eal/common/malloc_heap.h
> +++ b/lib/eal/common/malloc_heap.h
> @@ -96,4 +96,7 @@ malloc_socket_to_heap_id(unsigned int socket_id);
> int
> rte_eal_malloc_heap_init(void);
>
Please insert a comment here to document what we can expect.
> +bool
> +rte_malloc_is_ready(void);
More information about the dev
mailing list