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 23601199B1 for ; Thu, 7 Sep 2017 09:59:12 +0200 (CEST) Received: from lfbn-1-18623-73.w90-103.abo.wanadoo.fr ([90.103.154.73] 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 1dprnq-0004G6-Hx; Thu, 07 Sep 2017 10:04:47 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Thu, 07 Sep 2017 09:59:04 +0200 Date: Thu, 7 Sep 2017 09:59:04 +0200 From: Olivier MATZ To: Santosh Shukla Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com Message-ID: <20170907075903.jyohovh3h3mabvnz@neon> References: <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> <20170906112834.32378-1-santosh.shukla@caviumnetworks.com> <20170906112834.32378-6-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170906112834.32378-6-santosh.shukla@caviumnetworks.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v5 5/8] mempool: get the mempool capability 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: Thu, 07 Sep 2017 07:59:12 -0000 On Wed, Sep 06, 2017 at 04:58:31PM +0530, Santosh Shukla wrote: > Allow mempool driver to advertise his pool capability. > For that pupose, an api(rte_mempool_ops_get_capabilities) typo: pupose -> purpose > ... > --- a/lib/librte_mempool/rte_mempool.c > +++ b/lib/librte_mempool/rte_mempool.c > @@ -528,6 +528,12 @@ rte_mempool_populate_default(struct rte_mempool *mp) > if (mp->nb_mem_chunks != 0) > return -EEXIST; > > + /* Get mempool capability */ capability -> capabilities > + ret = rte_mempool_ops_get_capabilities(mp, &mp->flags); > + if (ret < 0) > + RTE_LOG(DEBUG, MEMPOOL, "get_capability not supported for %s\n", > + mp->name); > + I think the error can be ignored only if it's -ENOTSUP. Else, the error should be propagated. > --- a/lib/librte_mempool/rte_mempool.h > +++ b/lib/librte_mempool/rte_mempool.h > @@ -389,6 +389,12 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool *mp, > */ > typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); > > +/** > + * Get the mempool capability. > + */ capability -> capabilities > +typedef int (*rte_mempool_get_capabilities_t)(const struct rte_mempool *mp, > + unsigned int *flags); > + > /** Structure defining mempool operations structure */ > struct rte_mempool_ops { > char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ > @@ -397,6 +403,10 @@ struct rte_mempool_ops { > rte_mempool_enqueue_t enqueue; /**< Enqueue an object. */ > rte_mempool_dequeue_t dequeue; /**< Dequeue an object. */ > rte_mempool_get_count get_count; /**< Get qty of available objs. */ > + /** > + * Get the pool capability > + */ > + rte_mempool_get_capabilities_t get_capabilities; capability -> capabilities > } __rte_cache_aligned; > > #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ > @@ -509,6 +519,22 @@ unsigned > rte_mempool_ops_get_count(const struct rte_mempool *mp); > > /** > + * @internal wrapper for mempool_ops get_capabilities callback. > + * > + * @param mp [in] > + * Pointer to the memory pool. > + * @param flags [out] > + * Pointer to the mempool flag. > + * @return > + * - 0: Success; mempool driver has advetised his pool capability by Oring to > + * flags param. > + * - <0: Error; code of capability function. > + */ > +int > +rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, > + unsigned int *flags); > + > +/** The API is correct, but the flags should simply be returned, not or-ed. I think it should be kept as simple as possible: a function called get_somthing() is expected to return it without doing anything else. Sorry if I wasn't clear in my previous message. If there is a need to do a OR with mp->flags, it has to be done in the caller, i.e. rte_mempool_populate_default().