From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id E161C1B3D2 for ; Fri, 22 Dec 2017 15:41:59 +0100 (CET) Received: from lfbn-lil-1-110-231.w90-45.abo.wanadoo.fr ([90.45.197.231] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eSOcW-0006ep-97; Fri, 22 Dec 2017 15:48:21 +0100 Received: by droids-corp.org (sSMTP sendmail emulation); Fri, 22 Dec 2017 15:41:51 +0100 Date: Fri, 22 Dec 2017 15:41:51 +0100 From: Olivier MATZ To: Hemant Agrawal Cc: santosh.shukla@caviumnetworks.com, dev@dpdk.org Message-ID: <20171222144150.aeotqeyprwgbdm4s@platinum> References: <1499170968-23016-1-git-send-email-hemant.agrawal@nxp.com> <1513333483-4372-1-git-send-email-hemant.agrawal@nxp.com> <1513333483-4372-2-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513333483-4372-2-git-send-email-hemant.agrawal@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Dec 2017 14:42:00 -0000 Hi, On Fri, Dec 15, 2017 at 03:54:42PM +0530, Hemant Agrawal wrote: > With this patch the specific HW mempool are no longer required to be > specified in the config file at compile. A default active hw mempool > can be detected dynamically and published to default mempools ops > config at run time. Only one type of HW mempool can be active default. > > Signed-off-by: Hemant Agrawal > --- > lib/librte_mbuf/rte_mbuf.c | 33 ++++++++++++++++++++++++++++++++- > lib/librte_mbuf/rte_mbuf.h | 13 +++++++++++++ > 2 files changed, 45 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c > index 7543662..e074afa 100644 > --- a/lib/librte_mbuf/rte_mbuf.c > +++ b/lib/librte_mbuf/rte_mbuf.c > @@ -148,6 +148,37 @@ rte_pktmbuf_init(struct rte_mempool *mp, > m->next = NULL; > } > > +static const char *active_mbuf_pool_ops_name; > + > +int > +rte_pktmbuf_reg_active_mempool_ops(const char *ops_name) I think active_mempool is not the best name: it is not always active if the user forces another one. Since there is only one pool like this, would "platform_mempool" be a better name? For naming, I suggest "pktmbuf" can be "mbuf", it's shorter and there is no need anymore to differentiate with ctrlmbuf, because ctrlmbuf will be removed soon. I also think "register" is clearer than "reg". So, what about rte_mbuf_register_platform_mempool_ops()? > +{ > + if (active_mbuf_pool_ops_name == NULL) { > + active_mbuf_pool_ops_name = ops_name; > + return 0; > + } > + RTE_LOG(ERR, MBUF, > + "%s is already registered as active pktmbuf pool ops\n", > + active_mbuf_pool_ops_name); > + return -EACCES; > +} > + > +/* Return mbuf pool ops name */ > +static const char * > +rte_pktmbuf_active_mempool_ops(void) > +{ > + const char *default_ops = rte_eal_mbuf_default_mempool_ops(); > + > + /* If mbuf default ops is same as compile time default > + * Just to be sure that no one has updated it by other means. > + */ > + if ((strcmp(default_ops, RTE_MBUF_DEFAULT_MEMPOOL_OPS) == 0) && > + (active_mbuf_pool_ops_name != NULL)) > + return active_mbuf_pool_ops_name; > + else > + return default_ops; > +} The name of this function is confusing because it does not really return the active mempool. If the user selected a pool with --mbuf-pool-ops-name, it is returned... ...except if --mbuf-pool-ops-name= was passed, which I think is also very confusing.