On Sun, 9 Jul 2023 13:00:36 +0000 Chengwen Feng <fengcheng...@huawei.com> wrote:
> +struct rte_memarea_param { > + char name[RTE_MEMAREA_NAMESIZE]; /**< Name of memarea. */ > + enum rte_memarea_source source; /**< Memory source of memarea. */ > + enum rte_memarea_algorithm alg; /**< Memory management algorithm. */ > + /** Total size (bytes) of memarea, it should not be less be 1024. */ > + size_t total_sz; > + /** Indicates whether the memarea API should be MT-safe. */ > + uint32_t mt_safe : 1; > + union { > + /** The initialization parameters if the source is set to be > + * RTE_MEMAREA_SOURCE_HEAP. > + */ > + struct { > + /** Socket from which to apply for memarea's memory. */ > + int socket_id; > + } heap; > + /** The initialization parameters if the source is set to be > + * RTE_MEMAREA_SOURCE_MEMAREA. > + */ > + struct { > + /** Source memarea which to apply for this memarea's > + * memory from. > + */ > + struct rte_memarea *src; > + } ma; > + }; > +}; FYI - since this data structure has holes in it. Given the current API you can not assume that those holes are zero and try to reuse them later. One alternative would to put in explicit reserved fields and check for zero if you want to add more bits later.