From mboxrd@z Thu Jan 1 00:00:00 1970 From: santosh Subject: Re: [PATCH v4 2/7] mempool: add mempool arg in xmem size and usage Date: Mon, 4 Sep 2017 20:03:53 +0530 Message-ID: References: <20170720134759.4680-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-3-santosh.shukla@caviumnetworks.com> <20170904142232.jri222kqnvc5sorv@neon> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com To: Olivier MATZ Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0047.outbound.protection.outlook.com [104.47.37.47]) by dpdk.org (Postfix) with ESMTP id 789F158F6 for ; Mon, 4 Sep 2017 16:34:21 +0200 (CEST) In-Reply-To: <20170904142232.jri222kqnvc5sorv@neon> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Monday 04 September 2017 07:52 PM, Olivier MATZ wrote: > On Tue, Aug 15, 2017 at 11:37:38AM +0530, Santosh Shukla wrote: >> xmem_size and xmem_usage need to know the status of mp->flag. >> Following patch will make use of that. >> >> Signed-off-by: Santosh Shukla >> --- >> drivers/net/xenvirt/rte_mempool_gntalloc.c | 5 +++-- >> lib/librte_mempool/rte_mempool.c | 10 ++++++---- >> lib/librte_mempool/rte_mempool.h | 8 ++++++-- >> test/test/test_mempool.c | 4 ++-- >> 4 files changed, 17 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/net/xenvirt/rte_mempool_gntalloc.c b/drivers/net/xenvirt/rte_mempool_gntalloc.c >> index 73e82f808..ee0bda459 100644 >> --- a/drivers/net/xenvirt/rte_mempool_gntalloc.c >> +++ b/drivers/net/xenvirt/rte_mempool_gntalloc.c >> @@ -114,7 +114,7 @@ _create_mempool(const char *name, unsigned elt_num, unsigned elt_size, >> pg_shift = rte_bsf32(pg_sz); >> >> rte_mempool_calc_obj_size(elt_size, flags, &objsz); >> - sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift); >> + sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift, NULL); >> pg_num = sz >> pg_shift; >> >> pa_arr = calloc(pg_num, sizeof(pa_arr[0])); > What is the meaning of passing NULL to rte_mempool_xmem_size()? > Does it mean that flags are ignored? Yes that mean flags are ignored. > Wouldn't it be better to pass the mempool flags instead of the mempool > pointer? Keeping mempool as param rather flag useful in case user want to do/refer more thing in future for xmem_size/usage() api. Otherwise he has append one more param to api and send out deprecation notice.. Btw, its const param so won;t hurt right? However if you still want to restrict param to mp->flags then pl. suggest. Thanks.