From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3988942E31; Sun, 9 Jul 2023 21:46:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2792E410FB; Sun, 9 Jul 2023 21:46:07 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 47156410FA for ; Sun, 9 Jul 2023 21:46:06 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-676f16e0bc4so1658656b3a.0 for ; Sun, 09 Jul 2023 12:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688931965; x=1691523965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=7loZYaNsQT//xdhh7ZAlt1sH4jVe89zozZUg7fz1K+E=; b=Nq3/j8QddJridCa7Q73J0NUFrbPHY7fzeigOlimCK7HZdKdME0Km+6Paotu3DGPgk4 GuOljayHmhyjP5ODP26HKeCc6tJ6jiyOsKz2XG4gSaTcPM4/fKWKTAKBrY2Z/X4UxFA5 xzhoy9/q5NHBZLEZSeO8+INbQZjHA2Ec74EtRFShjNu7Ip5ndErHqpiXowAoKWszSArq E1uE8uZUBViTx7nvVsB/ch90CEdDS04GW6jjBvYgcTwCgntQvJjBLISpTqxa69wF9z7h bmszGoD+dMvnkzyszdv5zcd6uiSa4KqrvZCV4UH03l8xLXMLzvTl8kA0MdDzxCBF+nB+ P9Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688931965; x=1691523965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7loZYaNsQT//xdhh7ZAlt1sH4jVe89zozZUg7fz1K+E=; b=aBrMpH1fb49Wj8dgyBbFsnksNRI+odFgnZOm0QTeCaJAKbudfYZaKgWWig3kDa/R+6 pnuyU7BeAvWYZYnVNT57RJQQ5RgxXiMGeefuasJFMP6DgYOlj0lei2Bs2Kxn/L452psW Bxe4UIlk/PbGJ7HMUsBCne41h1e70Xm1hFnXF+bSSkEZDyETX25OS9l9F57rnyJcD5kc iFivrh/9SNBAkDQYexThnODwqKVAsnj8ElZ47ZINn0jtbDnkOARGUws1ARLtXZOxZTJe L50FXXeWQKmD1UBKTwttoLy2+qCfZIPFXJb1VKmu9biujGOQAledKeok+gwqOs3gh4mF 4q3w== X-Gm-Message-State: ABy/qLYQ9pFxF5H2hhdbC9w1zKtgUuT29PQU3oNtnGcv6iaWNCXnFs+v 7lHZnYbWV0kvzoCpjhjROLq0cQ== X-Google-Smtp-Source: APBJJlGs35MvmO/wzgDRsEf/atZr3SeMBfzmxl1E32gr2a6dqfszT0U052C7KfMOsChaghLp4PlnUg== X-Received: by 2002:a05:6a20:9694:b0:130:d5a:e40e with SMTP id hp20-20020a056a20969400b001300d5ae40emr8687363pzc.7.1688931965141; Sun, 09 Jul 2023 12:46:05 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id p10-20020a62ab0a000000b00666add7f047sm5745215pff.207.2023.07.09.12.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 12:46:04 -0700 (PDT) Date: Sun, 9 Jul 2023 12:46:02 -0700 From: Stephen Hemminger To: Chengwen Feng Cc: , , , , , , , Subject: Re: [PATCH v15 1/6] memarea: introduce memarea library Message-ID: <20230709124602.434f6443@hermes.local> In-Reply-To: <20230709130041.8736-2-fengchengwen@huawei.com> References: <20220721044648.6817-1-fengchengwen@huawei.com> <20230709130041.8736-1-fengchengwen@huawei.com> <20230709130041.8736-2-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sun, 9 Jul 2023 13:00:36 +0000 Chengwen Feng 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.