DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support
@ 2017-07-04 12:22 Hemant Agrawal
  2017-07-04 12:22 ` [dpdk-dev] [PATCH 1/2] mempool: check the support for the given mempool Hemant Agrawal
                   ` (3 more replies)
  0 siblings, 4 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-07-04 12:22 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev, jerin.jacob

This patch is in addition to the patch series[1] submitted by
Santosh to allow application to set mempool handle. 

The existing pktmbuf pool create api only support the internal use
of "CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS", which assumes that the HW
can only support one type of mempool for packet mbuf. 

There are multiple additional requirements.

1. The platform independent image detects the underlying bus,
based on the bus and resource detected, it will dynamically select
the default mempool. This need not to have the application knowlege.
e.g. DPAA2 and DPAA are two different NXP platforms, based on the
underlying platform the default ops for mbuf can be dpaa or dpaa2.  
Application should work seemlessly whether it is running on dpaa or dpaa2. 

2.Platform support more than one type of mempool for pktmbuf,
depend on the availability of resource, the driver can decide one
of the mempool for the current packet mbuf request.

3. In case of where application is providing the mempool, as proposed
in [1], the check preference logic will be bypassed and application
config will take priority.

[1]Allow application set mempool handle 
http://dpdk.org/ml/archives/dev/2017-June/067022.html

Hemant Agrawal (2):
  mempool: check the support for the given mempool
  mbuf: add support for preferred mempool list

 config/common_base                   |  2 ++
 lib/librte_mbuf/rte_mbuf.c           | 28 +++++++++++++++++++++++-----
 lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
 lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+), 5 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH 1/2] mempool: check the support for the given mempool
  2017-07-04 12:22 [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
@ 2017-07-04 12:22 ` Hemant Agrawal
  2017-07-04 12:22 ` [dpdk-dev] [PATCH 2/2] mbuf: add support for preferred mempool list Hemant Agrawal
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-07-04 12:22 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev, jerin.jacob

External offloaded mempool may not be available always or compatible.
This check enables run time verification of the presence of external
mempool before the mempool ops are installed.

This patch introduces new optional "supported" mempool ops function
to check if a given mempool instance is available and compatible.

If this is not defined, the default will be that mempool is supported.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
 lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 76b5b3b..1ae2e70 100644
--- 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);
 
+/**
+ * Return if the given mempool is supported and compatible for this instance.
+ * it is optional to implement for mempools
+ */
+typedef int (*rte_mempool_supported)(const struct rte_mempool *mp);
+
 /** Structure defining mempool operations structure */
 struct rte_mempool_ops {
 	char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */
@@ -397,6 +403,8 @@ 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. */
+	rte_mempool_supported supported;
+	/**< Verify if mempool is supported for usages*/
 } __rte_cache_aligned;
 
 #define RTE_MEMPOOL_MAX_OPS_IDX 16  /**< Max registered ops structs */
@@ -518,6 +526,21 @@ void
 rte_mempool_ops_free(struct rte_mempool *mp);
 
 /**
+ * Check the given mempool availability and compatibility.
+ *
+ * @param mp
+ *   Pointer to the memory pool.
+ * @param name
+ *   Name of the ops structure to use for this mempool.
+ * @return
+ *   0: Success;  mempool instance is supported and compatible.
+ * - <0: Error; mempool instance is not supported or not compatible.
+ */
+int
+rte_mempool_ops_check_support(const struct rte_mempool *mp,
+				      const char *name);
+
+/**
  * Set the ops of a mempool.
  *
  * This can only be done on a mempool that is not populated, i.e. just after
@@ -533,6 +556,7 @@ rte_mempool_ops_free(struct rte_mempool *mp);
  *   - 0: Success; the mempool is now using the requested ops functions.
  *   - -EINVAL - Invalid ops struct name provided.
  *   - -EEXIST - mempool already has an ops struct assigned.
+ *   - -ENOTSUP  - mempool instance not supported.
  */
 int
 rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c
index 5f24de2..c426a9a 100644
--- a/lib/librte_mempool/rte_mempool_ops.c
+++ b/lib/librte_mempool/rte_mempool_ops.c
@@ -85,6 +85,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
 	ops->enqueue = h->enqueue;
 	ops->dequeue = h->dequeue;
 	ops->get_count = h->get_count;
+	ops->supported = h->supported;
 
 	rte_spinlock_unlock(&rte_mempool_ops_table.sl);
 
@@ -123,6 +124,31 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp)
 	return ops->get_count(mp);
 }
 
+/* check if given mempool is supported  and compatible for this instance. */
+int
+rte_mempool_ops_check_support(const struct rte_mempool *mp, const char *name)
+{
+	unsigned i;
+	struct rte_mempool_ops *ops = NULL;
+
+	for (i = 0; i < rte_mempool_ops_table.num_ops; i++) {
+		if (!strcmp(name, rte_mempool_ops_table.ops[i].name)) {
+			ops = &rte_mempool_ops_table.ops[i];
+			break;
+		}
+	}
+
+	if (ops == NULL)
+		return -EINVAL;
+
+	if (ops->supported) {
+		if (ops->supported(mp))
+			return -ENOTSUP;
+	}
+
+	return 0;
+}
+
 /* sets mempool ops previously registered by rte_mempool_register_ops. */
 int
 rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
@@ -146,6 +172,12 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
 	if (ops == NULL)
 		return -EINVAL;
 
+	/* verify if the given mempool is supported for this instance  */
+	if (ops->supported) {
+		if (ops->supported(mp))
+			return -ENOTSUP;
+	}
+
 	mp->ops_index = i;
 	mp->pool_config = pool_config;
 	return 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH 2/2] mbuf: add support for preferred mempool list
  2017-07-04 12:22 [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
  2017-07-04 12:22 ` [dpdk-dev] [PATCH 1/2] mempool: check the support for the given mempool Hemant Agrawal
@ 2017-07-04 12:22 ` Hemant Agrawal
  2017-09-22  7:13 ` [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
  2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
  3 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-07-04 12:22 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev, jerin.jacob

This patch extend the existing default mempool ops support.
There may be more than one type of mempool supported by the
given platform. This decision may be based on the resource
availability or required capabilities. The mempool list can be
a combination of external mempools and sw mempools.

This patch support configuring multiple backups for the default
mempool.

This patch also support to find out the most preferred support
for a given mempool ops from the configured mempool list (if available).

Current patch support only 3 mempool ops i.e. default + 2 backup.
However this can be extended in future if required.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/common_base         |  2 ++
 lib/librte_mbuf/rte_mbuf.c | 28 +++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/config/common_base b/config/common_base
index 660588a..3020b35 100644
--- a/config/common_base
+++ b/config/common_base
@@ -557,6 +557,8 @@ CONFIG_RTE_DRIVER_MEMPOOL_STACK=y
 CONFIG_RTE_LIBRTE_MBUF=y
 CONFIG_RTE_LIBRTE_MBUF_DEBUG=n
 CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="ring_mp_mc"
+CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_1=""
+CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_2=""
 CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index ab436b9..64519ef 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -159,6 +159,13 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	struct rte_pktmbuf_pool_private mbp_priv;
 	unsigned elt_size;
 	int ret;
+	const char *ops[] = {
+			RTE_MBUF_DEFAULT_MEMPOOL_OPS,
+			RTE_MBUF_BACKUP_MEMPOOL_OPS_1,
+			RTE_MBUF_BACKUP_MEMPOOL_OPS_2,
+			NULL,
+		};
+	const char **op;
 
 	if (RTE_ALIGN(priv_size, RTE_MBUF_PRIV_ALIGN) != priv_size) {
 		RTE_LOG(ERR, MBUF, "mbuf priv_size=%u is not aligned\n",
@@ -176,12 +183,23 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	ret = rte_mempool_set_ops_byname(mp,
-		RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
-	if (ret != 0) {
-		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
+	/*Check the perfered mempool ops based on config*/
+	for (op = &ops[0]; *op != NULL; op++) {
+		ret = rte_mempool_ops_check_support(mp, *op);
+		if (ret == 0)
+			break;
+	}
+	if (*op != NULL) {
+		ret = rte_mempool_set_ops_byname(mp, *op, NULL);
+		if (ret != 0) {
+			RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
+			rte_mempool_free(mp);
+			rte_errno = -ret;
+			return NULL;
+		}
+	} else {
 		rte_mempool_free(mp);
-		rte_errno = -ret;
+		rte_errno = ENOTSUP;
 		return NULL;
 	}
 	rte_pktmbuf_pool_init(mp, &mbp_priv);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support
  2017-07-04 12:22 [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
  2017-07-04 12:22 ` [dpdk-dev] [PATCH 1/2] mempool: check the support for the given mempool Hemant Agrawal
  2017-07-04 12:22 ` [dpdk-dev] [PATCH 2/2] mbuf: add support for preferred mempool list Hemant Agrawal
@ 2017-09-22  7:13 ` Hemant Agrawal
  2017-09-25 10:24   ` Olivier MATZ
  2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
  3 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2017-09-22  7:13 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev, jerin.jacob

Hi Olivier,
	Any opinion on this patchset?

Regards,
Hemant

On 7/4/2017 5:52 PM, Hemant Agrawal wrote:
> This patch is in addition to the patch series[1] submitted by
> Santosh to allow application to set mempool handle.
>
> The existing pktmbuf pool create api only support the internal use
> of "CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS", which assumes that the HW
> can only support one type of mempool for packet mbuf.
>
> There are multiple additional requirements.
>
> 1. The platform independent image detects the underlying bus,
> based on the bus and resource detected, it will dynamically select
> the default mempool. This need not to have the application knowlege.
> e.g. DPAA2 and DPAA are two different NXP platforms, based on the
> underlying platform the default ops for mbuf can be dpaa or dpaa2.
> Application should work seemlessly whether it is running on dpaa or dpaa2.
>
> 2.Platform support more than one type of mempool for pktmbuf,
> depend on the availability of resource, the driver can decide one
> of the mempool for the current packet mbuf request.
>
> 3. In case of where application is providing the mempool, as proposed
> in [1], the check preference logic will be bypassed and application
> config will take priority.
>
> [1]Allow application set mempool handle
> http://dpdk.org/ml/archives/dev/2017-June/067022.html
>
> Hemant Agrawal (2):
>   mempool: check the support for the given mempool
>   mbuf: add support for preferred mempool list
>
>  config/common_base                   |  2 ++
>  lib/librte_mbuf/rte_mbuf.c           | 28 +++++++++++++++++++++++-----
>  lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
>  lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
>  4 files changed, 81 insertions(+), 5 deletions(-)
>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support
  2017-09-22  7:13 ` [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
@ 2017-09-25 10:24   ` Olivier MATZ
  2017-10-10 14:15     ` Thomas Monjalon
  0 siblings, 1 reply; 112+ messages in thread
From: Olivier MATZ @ 2017-09-25 10:24 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: santosh.shukla, dev, jerin.jacob

Hi Hemant,

On Fri, Sep 22, 2017 at 12:43:36PM +0530, Hemant Agrawal wrote:
> On 7/4/2017 5:52 PM, Hemant Agrawal wrote:
> > This patch is in addition to the patch series[1] submitted by
> > Santosh to allow application to set mempool handle.
> > 
> > The existing pktmbuf pool create api only support the internal use
> > of "CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS", which assumes that the HW
> > can only support one type of mempool for packet mbuf.
> > 
> > There are multiple additional requirements.
> > 
> > 1. The platform independent image detects the underlying bus,
> > based on the bus and resource detected, it will dynamically select
> > the default mempool. This need not to have the application knowlege.
> > e.g. DPAA2 and DPAA are two different NXP platforms, based on the
> > underlying platform the default ops for mbuf can be dpaa or dpaa2.
> > Application should work seemlessly whether it is running on dpaa or dpaa2.
> > 
> > 2.Platform support more than one type of mempool for pktmbuf,
> > depend on the availability of resource, the driver can decide one
> > of the mempool for the current packet mbuf request.
> > 
> > 3. In case of where application is providing the mempool, as proposed
> > in [1], the check preference logic will be bypassed and application
> > config will take priority.
> > 
> > [1]Allow application set mempool handle
> > http://dpdk.org/ml/archives/dev/2017-June/067022.html
> > 
> > Hemant Agrawal (2):
> >   mempool: check the support for the given mempool
> >   mbuf: add support for preferred mempool list
> > 
> >  config/common_base                   |  2 ++
> >  lib/librte_mbuf/rte_mbuf.c           | 28 +++++++++++++++++++++++-----
> >  lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
> >  lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
> >  4 files changed, 81 insertions(+), 5 deletions(-)
> > 
> 
> Hi Olivier,
> 	Any opinion on this patchset?

Sorry for the lack of feedback, for some reason I missed the initial
mails.

I don't quite like the idea of having hardcoded config:
 CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_1=""
 CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_2=""

Also, I'm a bit reserved about rte_mempool_ops_check_support(): it can
return "supported" but the creation of the pool can still fail later due
to the creation parameters (element count/size, mempool flags, ...).

The ordering preference of these mempool ops may also depend on the
configuration (enabled ports for instance) or user choices.

Let me propose you another approach to (I hope) solve your issue, based
on Santosh's patches [1].

We can introduce a new helper that could be used by applications to
dynamically select the best mempool ops. It could be something similar
to the pseudo-code I've written in [3].

  // return an array pool ops name, ordered by preference
  pool_ops = get_ordered_pool_ops_list()

Then try to create the first pool, if it fails, try the next, until
it is succesful.

That said, it is difficult to take the good decision inside
rte_pktmbuf_pool_create() because we don't have all the information.
Sergio and Jerin suggested to introduce a new argument ops_name to
rte_pktmbuf_pool_create() [2]. From what I remember, this is also
something you were in favor of, right?

In that case, we can move the difficult task of choosing the
right mempool inside the application.

Comments?

Olivier



[1] http://dpdk.org/dev/patchwork/patch/28596/
[2] http://dpdk.org/ml/archives/dev/2017-September/074489.html
[3] http://dpdk.org/dev/patchwork/patch/27610/

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support
  2017-09-25 10:24   ` Olivier MATZ
@ 2017-10-10 14:15     ` Thomas Monjalon
  2017-10-10 14:21       ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Thomas Monjalon @ 2017-10-10 14:15 UTC (permalink / raw)
  To: Olivier MATZ, Hemant Agrawal; +Cc: dev, santosh.shukla, jerin.jacob

25/09/2017 12:24, Olivier MATZ:
> Hi Hemant,
> 
> On Fri, Sep 22, 2017 at 12:43:36PM +0530, Hemant Agrawal wrote:
> > On 7/4/2017 5:52 PM, Hemant Agrawal wrote:
> > > This patch is in addition to the patch series[1] submitted by
> > > Santosh to allow application to set mempool handle.
> > > 
> > > The existing pktmbuf pool create api only support the internal use
> > > of "CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS", which assumes that the HW
> > > can only support one type of mempool for packet mbuf.
> > > 
> > > There are multiple additional requirements.
> > > 
> > > 1. The platform independent image detects the underlying bus,
> > > based on the bus and resource detected, it will dynamically select
> > > the default mempool. This need not to have the application knowlege.
> > > e.g. DPAA2 and DPAA are two different NXP platforms, based on the
> > > underlying platform the default ops for mbuf can be dpaa or dpaa2.
> > > Application should work seemlessly whether it is running on dpaa or dpaa2.
> > > 
> > > 2.Platform support more than one type of mempool for pktmbuf,
> > > depend on the availability of resource, the driver can decide one
> > > of the mempool for the current packet mbuf request.
> > > 
> > > 3. In case of where application is providing the mempool, as proposed
> > > in [1], the check preference logic will be bypassed and application
> > > config will take priority.
> > > 
> > > [1]Allow application set mempool handle
> > > http://dpdk.org/ml/archives/dev/2017-June/067022.html
> > > 
> > > Hemant Agrawal (2):
> > >   mempool: check the support for the given mempool
> > >   mbuf: add support for preferred mempool list
> > > 
> > >  config/common_base                   |  2 ++
> > >  lib/librte_mbuf/rte_mbuf.c           | 28 +++++++++++++++++++++++-----
> > >  lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
> > >  lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
> > >  4 files changed, 81 insertions(+), 5 deletions(-)
> > > 
> > 
> > Hi Olivier,
> > 	Any opinion on this patchset?
> 
> Sorry for the lack of feedback, for some reason I missed the initial
> mails.
> 
> I don't quite like the idea of having hardcoded config:
>  CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_1=""
>  CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_2=""
> 
> Also, I'm a bit reserved about rte_mempool_ops_check_support(): it can
> return "supported" but the creation of the pool can still fail later due
> to the creation parameters (element count/size, mempool flags, ...).
> 
> The ordering preference of these mempool ops may also depend on the
> configuration (enabled ports for instance) or user choices.
> 
> Let me propose you another approach to (I hope) solve your issue, based
> on Santosh's patches [1].
> 
> We can introduce a new helper that could be used by applications to
> dynamically select the best mempool ops. It could be something similar
> to the pseudo-code I've written in [3].
> 
>   // return an array pool ops name, ordered by preference
>   pool_ops = get_ordered_pool_ops_list()
> 
> Then try to create the first pool, if it fails, try the next, until
> it is succesful.
> 
> That said, it is difficult to take the good decision inside
> rte_pktmbuf_pool_create() because we don't have all the information.
> Sergio and Jerin suggested to introduce a new argument ops_name to
> rte_pktmbuf_pool_create() [2]. From what I remember, this is also
> something you were in favor of, right?
> 
> In that case, we can move the difficult task of choosing the
> right mempool inside the application.
> 
> Comments?

I guess this discussion is obsolete since Santosh commit?
	http://dpdk.org/commit/a103a97e

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support
  2017-10-10 14:15     ` Thomas Monjalon
@ 2017-10-10 14:21       ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-10-10 14:21 UTC (permalink / raw)
  To: Thomas Monjalon, Olivier MATZ; +Cc: dev, santosh.shukla, jerin.jacob

On 10/10/2017 7:45 PM, Thomas Monjalon wrote:
> 25/09/2017 12:24, Olivier MATZ:
>> Hi Hemant,
>>
>> On Fri, Sep 22, 2017 at 12:43:36PM +0530, Hemant Agrawal wrote:
>>> On 7/4/2017 5:52 PM, Hemant Agrawal wrote:
>>>> This patch is in addition to the patch series[1] submitted by
>>>> Santosh to allow application to set mempool handle.
>>>>
>>>> The existing pktmbuf pool create api only support the internal use
>>>> of "CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS", which assumes that the HW
>>>> can only support one type of mempool for packet mbuf.
>>>>
>>>> There are multiple additional requirements.
>>>>
>>>> 1. The platform independent image detects the underlying bus,
>>>> based on the bus and resource detected, it will dynamically select
>>>> the default mempool. This need not to have the application knowlege.
>>>> e.g. DPAA2 and DPAA are two different NXP platforms, based on the
>>>> underlying platform the default ops for mbuf can be dpaa or dpaa2.
>>>> Application should work seemlessly whether it is running on dpaa or dpaa2.
>>>>
>>>> 2.Platform support more than one type of mempool for pktmbuf,
>>>> depend on the availability of resource, the driver can decide one
>>>> of the mempool for the current packet mbuf request.
>>>>
>>>> 3. In case of where application is providing the mempool, as proposed
>>>> in [1], the check preference logic will be bypassed and application
>>>> config will take priority.
>>>>
>>>> [1]Allow application set mempool handle
>>>> http://dpdk.org/ml/archives/dev/2017-June/067022.html
>>>>
>>>> Hemant Agrawal (2):
>>>>   mempool: check the support for the given mempool
>>>>   mbuf: add support for preferred mempool list
>>>>
>>>>  config/common_base                   |  2 ++
>>>>  lib/librte_mbuf/rte_mbuf.c           | 28 +++++++++++++++++++++++-----
>>>>  lib/librte_mempool/rte_mempool.h     | 24 ++++++++++++++++++++++++
>>>>  lib/librte_mempool/rte_mempool_ops.c | 32 ++++++++++++++++++++++++++++++++
>>>>  4 files changed, 81 insertions(+), 5 deletions(-)
>>>>
>>>
>>> Hi Olivier,
>>> 	Any opinion on this patchset?
>>
>> Sorry for the lack of feedback, for some reason I missed the initial
>> mails.
>>
>> I don't quite like the idea of having hardcoded config:
>>  CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_1=""
>>  CONFIG_RTE_MBUF_BACKUP_MEMPOOL_OPS_2=""
>>
>> Also, I'm a bit reserved about rte_mempool_ops_check_support(): it can
>> return "supported" but the creation of the pool can still fail later due
>> to the creation parameters (element count/size, mempool flags, ...).
>>
>> The ordering preference of these mempool ops may also depend on the
>> configuration (enabled ports for instance) or user choices.
>>
>> Let me propose you another approach to (I hope) solve your issue, based
>> on Santosh's patches [1].
>>
>> We can introduce a new helper that could be used by applications to
>> dynamically select the best mempool ops. It could be something similar
>> to the pseudo-code I've written in [3].
>>
>>   // return an array pool ops name, ordered by preference
>>   pool_ops = get_ordered_pool_ops_list()
>>
>> Then try to create the first pool, if it fails, try the next, until
>> it is succesful.
>>
>> That said, it is difficult to take the good decision inside
>> rte_pktmbuf_pool_create() because we don't have all the information.
>> Sergio and Jerin suggested to introduce a new argument ops_name to
>> rte_pktmbuf_pool_create() [2]. From what I remember, this is also
>> something you were in favor of, right?
>>
>> In that case, we can move the difficult task of choosing the
>> right mempool inside the application.
>>
>> Comments?
>
> I guess this discussion is obsolete since Santosh commit?
> 	http://dpdk.org/commit/a103a97e
>
>
Not yet.  On the basis of our discussion with Olivier and Santosh 
commit, we are working out a way, which solves our issue.

We will close on it in next few days.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support
  2017-07-04 12:22 [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
                   ` (2 preceding siblings ...)
  2017-09-22  7:13 ` [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
@ 2017-12-15 10:24 ` Hemant Agrawal
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
                     ` (2 more replies)
  3 siblings, 3 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-15 10:24 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1]

This patch set is another way to solve the issue.

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.

Note that in the current model, HW mempool based devices usages a compile
time flag to define the default MEMPOOL_OPS.
e.g. CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"

This requies that each type of device maintains it's own dpdk build
config file. Hence, these devices are generally omitted from the standard
build configs and distros.

After this change the platform independent image can detects the underlying
default active hw mempool, if available. This is application agnostic.
e.g. DPAA2 and DPAA are two different NXP platforms,
based on the underlying platform the default ops for mbuf can be dpaa or
dpaa2 or even ring_mp_mc(when dpaa/dpaa2 nics are not being used).

The aim is:
*The same image of an application should work seemlessly on any platform.*

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[4] http://dpdk.org/dev/patchwork/patch/28596/
[5] http://dpdk.org/ml/archives/dev/2017-September/074489.html
[6] http://dpdk.org/dev/patchwork/patch/27610/

Hemant Agrawal (2):
  mbuf: update default Mempool ops with HW active pool
  dpaa2: register dpaa2 mempool ops as active mempool

 config/defconfig_arm64-dpaa2-linuxapp-gcc |  1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  |  6 ++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |  2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  2 +-
 lib/librte_mbuf/rte_mbuf.c                | 33 ++++++++++++++++++++++++++++++-
 lib/librte_mbuf/rte_mbuf.h                | 13 ++++++++++++
 6 files changed, 54 insertions(+), 3 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2017-12-15 10:24   ` Hemant Agrawal
  2017-12-15 15:52     ` Stephen Hemminger
                       ` (2 more replies)
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool Hemant Agrawal
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
  2 siblings, 3 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-15 10:24 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev

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 <hemant.agrawal@nxp.com>
---
 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)
+{
+	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;
+}
+
 /* helper to create a mbuf pool */
 struct rte_mempool *
 rte_pktmbuf_pool_create(const char *name, unsigned n,
@@ -176,7 +207,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	mp_ops_name = rte_pktmbuf_active_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index ce8a05d..3140a0b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1081,6 +1081,19 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Register the active HW pkt mbuf pool
+ *
+ * Register the active pktmbuf HW pool to overwrite the default pool
+ *
+ * @param pool ops name
+ * @return
+ *   - 0: Success
+ *   - -EACCES: Active mempool is already registered.
+ */
+int
+rte_pktmbuf_reg_active_mempool_ops(const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool
  2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
@ 2017-12-15 10:24   ` Hemant Agrawal
  2017-12-18  8:57     ` Jerin Jacob
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
  2 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-15 10:24 UTC (permalink / raw)
  To: olivier.matz, santosh.shukla; +Cc: dev

Detect if the DPAA2 mempool objects are present and they can
serve as default mempool.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 6 ++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index 91f4993..703e8b3 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -53,7 +53,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index 334e1f5..5a6f292 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 {
 	struct dpaa2_dpbp_dev *dpbp_node;
 	int ret;
+	static int active_pool;
 
 	/* Allocate DPAA2 dpbp handle */
 	dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0);
@@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	if (!active_pool) {
+		rte_pktmbuf_reg_active_mempool_ops(DPAA2_MEMPOOL_OPS_NAME);
+		active_pool = 1;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index c1b842f..2b0e871 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -70,6 +70,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 8bcbaa8..17c7d62 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -380,7 +380,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
@ 2017-12-15 15:52     ` Stephen Hemminger
  2017-12-18  9:26       ` Hemant Agrawal
  2017-12-18  8:55     ` Jerin Jacob
  2017-12-22 14:41     ` Olivier MATZ
  2 siblings, 1 reply; 112+ messages in thread
From: Stephen Hemminger @ 2017-12-15 15:52 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: olivier.matz, santosh.shukla, dev

On Fri, 15 Dec 2017 15:54:42 +0530
Hemant Agrawal <hemant.agrawal@nxp.com> wrote:

> +	if ((strcmp(default_ops, RTE_MBUF_DEFAULT_MEMPOOL_OPS) == 0) &&
> +		(active_mbuf_pool_ops_name != NULL))

Why not have less parenthesis () in conditionals?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
  2017-12-15 15:52     ` Stephen Hemminger
@ 2017-12-18  8:55     ` Jerin Jacob
  2017-12-18  9:36       ` Hemant Agrawal
  2017-12-22 14:41     ` Olivier MATZ
  2 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2017-12-18  8:55 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: olivier.matz, santosh.shukla, dev

-----Original Message-----
> Date: Fri, 15 Dec 2017 15:54:42 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> CC: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW
>  active pool
> X-Mailer: git-send-email 2.7.4
> 
> 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.

For me, it looks very reasonable approach as it caters the basic use
case without any change in the application nor the additional(--mbuf-pool-ops-name)
EAL command line scheme to select different mempool ops.
Though, this option will not enough cater all the use case. I think, we can have
three options and the following order of precedence to select the mempool ops

1) This patch(update active mempool based on the device probe())
2) Selection of mempool ops though --mbuf-pool-ops-name= EAL commandline argument.
Which can overridden the scheme(1)
3) More sophisticated mempool section based on
a) The ethdev PMD capability exposed through existing rte_eth_dev_pool_ops_supported()
b) Add mempool ops option in rte_pktmbuf_pool_create()
http://dpdk.org/ml/archives/dev/2017-December/083985.html
c) Use (a) and (b) to select the update the mempool ops with
some "weight" based algorithm like
http://dpdk.org/dev/patchwork/patch/32245/

> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  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;

Global variable will create issue in multi process case.

> +
> +int
> +rte_pktmbuf_reg_active_mempool_ops(const char *ops_name)
> +{
> +	if (active_mbuf_pool_ops_name == NULL) {
> +		active_mbuf_pool_ops_name = ops_name;

I think, if we could update "internal_config.mbuf_pool_ops_name" value then
we don't need any extra global variable.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool Hemant Agrawal
@ 2017-12-18  8:57     ` Jerin Jacob
  2017-12-18  9:25       ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2017-12-18  8:57 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: olivier.matz, santosh.shukla, dev

-----Original Message-----
> Date: Fri, 15 Dec 2017 15:54:43 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> CC: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active
>  mempool
> X-Mailer: git-send-email 2.7.4
> 
> Detect if the DPAA2 mempool objects are present and they can
> serve as default mempool.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
>  drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 6 ++++++
>  drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
>  drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
>  4 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
> index 91f4993..703e8b3 100644
> --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
> +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
> @@ -53,7 +53,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
>  # Compile Support Libraries for DPAA2
>  #
>  CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
> -CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
>  CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
>  
>  #
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> index 334e1f5..5a6f292 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
> @@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
>  {
>  	struct dpaa2_dpbp_dev *dpbp_node;
>  	int ret;
> +	static int active_pool;
>  
>  	/* Allocate DPAA2 dpbp handle */
>  	dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0);
> @@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
>  
>  	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
>  
> +	if (!active_pool) {

I think, this global variable can be avoided. Why it needs to be under 
active_pool?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool
  2017-12-18  8:57     ` Jerin Jacob
@ 2017-12-18  9:25       ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-18  9:25 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: olivier.matz, santosh.shukla, dev

On 12/18/2017 2:27 PM, Jerin Jacob wrote:

...<snip>

>> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> index 334e1f5..5a6f292 100644
>> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> @@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
>>  {
>>  	struct dpaa2_dpbp_dev *dpbp_node;
>>  	int ret;
>> +	static int active_pool;
>>
>>  	/* Allocate DPAA2 dpbp handle */
>>  	dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0);
>> @@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
>>
>>  	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
>>
>> +	if (!active_pool) {
>
> I think, this global variable can be avoided. Why it needs to be under
> active_pool?
>
This code register the active pool when it physically detect a instance 
of hw mempool on bus. There can be more than one objects of dpaa2 
mempool. Yes! we can do avoid it as the current registration code 
proposal will not allow re-registration.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-15 15:52     ` Stephen Hemminger
@ 2017-12-18  9:26       ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-18  9:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: olivier.matz, santosh.shukla, dev

On 12/15/2017 9:22 PM, Stephen Hemminger wrote:
> On Fri, 15 Dec 2017 15:54:42 +0530
> Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
>> +	if ((strcmp(default_ops, RTE_MBUF_DEFAULT_MEMPOOL_OPS) == 0) &&
>> +		(active_mbuf_pool_ops_name != NULL))
>
> Why not have less parenthesis () in conditionals?
>
I will change it in next version.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-18  8:55     ` Jerin Jacob
@ 2017-12-18  9:36       ` Hemant Agrawal
  2017-12-22 14:59         ` Olivier MATZ
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-18  9:36 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: olivier.matz, santosh.shukla, dev

On 12/18/2017 2:25 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Fri, 15 Dec 2017 15:54:42 +0530
>> From: Hemant Agrawal <hemant.agrawal@nxp.com>
>> To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
>> CC: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW
>>  active pool
>> X-Mailer: git-send-email 2.7.4
>>
>> 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.
>
> For me, it looks very reasonable approach as it caters the basic use
> case without any change in the application nor the additional(--mbuf-pool-ops-name)
> EAL command line scheme to select different mempool ops.
> Though, this option will not enough cater all the use case. I think, we can have
> three options and the following order of precedence to select the mempool ops
>
> 1) This patch(update active mempool based on the device probe())
> 2) Selection of mempool ops though --mbuf-pool-ops-name= EAL commandline argument.
> Which can overridden the scheme(1)
> 3) More sophisticated mempool section based on
> a) The ethdev PMD capability exposed through existing rte_eth_dev_pool_ops_supported()
> b) Add mempool ops option in rte_pktmbuf_pool_create()
> http://dpdk.org/ml/archives/dev/2017-December/083985.html
> c) Use (a) and (b) to select the update the mempool ops with
> some "weight" based algorithm like
> http://dpdk.org/dev/patchwork/patch/32245/
>

Yes! We need more options to fine tune control over the mempool uses, 
specially when dealing with HW mempools.

Once the above mentioned mechanisms will be in place, it will be much 
easier and flexible.

>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>  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;
>
> Global variable will create issue in multi process case.
>
>> +
>> +int
>> +rte_pktmbuf_reg_active_mempool_ops(const char *ops_name)
>> +{
>> +	if (active_mbuf_pool_ops_name == NULL) {
>> +		active_mbuf_pool_ops_name = ops_name;
>
> I think, if we could update "internal_config.mbuf_pool_ops_name" value then
> we don't need any extra global variable.
>
>
That is a good suggestion.
Also, We may need additional variable in internal config to indicate 
that this is a application provided ops_name - so that it should not be 
overwritten.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
  2017-12-15 15:52     ` Stephen Hemminger
  2017-12-18  8:55     ` Jerin Jacob
@ 2017-12-22 14:41     ` Olivier MATZ
  2 siblings, 0 replies; 112+ messages in thread
From: Olivier MATZ @ 2017-12-22 14:41 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: santosh.shukla, dev

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 <hemant.agrawal@nxp.com>
> ---
>  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=<name of default ops> was passed,
which I think is also very confusing.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-18  9:36       ` Hemant Agrawal
@ 2017-12-22 14:59         ` Olivier MATZ
  2017-12-28 12:07           ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Olivier MATZ @ 2017-12-22 14:59 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: Jerin Jacob, santosh.shukla, dev

On Mon, Dec 18, 2017 at 03:06:21PM +0530, Hemant Agrawal wrote:
> On 12/18/2017 2:25 PM, Jerin Jacob wrote:
> > -----Original Message-----
> > > Date: Fri, 15 Dec 2017 15:54:42 +0530
> > > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> > > CC: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW
> > >  active pool
> > > X-Mailer: git-send-email 2.7.4
> > > 
> > > 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.
> > 
> > For me, it looks very reasonable approach as it caters the basic use
> > case without any change in the application nor the additional(--mbuf-pool-ops-name)
> > EAL command line scheme to select different mempool ops.
> > Though, this option will not enough cater all the use case. I think, we can have
> > three options and the following order of precedence to select the mempool ops
> > 
> > 1) This patch(update active mempool based on the device probe())
> > 2) Selection of mempool ops though --mbuf-pool-ops-name= EAL commandline argument.
> > Which can overridden the scheme(1)
> > 3) More sophisticated mempool section based on
> > a) The ethdev PMD capability exposed through existing rte_eth_dev_pool_ops_supported()
> > b) Add mempool ops option in rte_pktmbuf_pool_create()
> > http://dpdk.org/ml/archives/dev/2017-December/083985.html
> > c) Use (a) and (b) to select the update the mempool ops with
> > some "weight" based algorithm like
> > http://dpdk.org/dev/patchwork/patch/32245/
> > 
> 
> Yes! We need more options to fine tune control over the mempool uses,
> specially when dealing with HW mempools.
> 
> Once the above mentioned mechanisms will be in place, it will be much easier
> and flexible.

I'm inline with this description. It would be great if the same binary can work
on different platforms without configuration.

I just feel it's a bit messy to have:

- rte_eal_mbuf_default_mempool_ops() in eal API
  return user-selected ops if any, or compile-time default

- rte_pktmbuf_active_mempool_ops() in mbuf API
  return platform ops except if a selected user ops != compile default

Thomas suggested somewhere (but I don't remember in which thread) to have
rte_eal_mbuf_default_mempool_ops() in mbuf code, and I think he was right.

I think the whole mbuf pool ops selection mechanism should be at the
same place. I could be in a specific file of librte_mbuf.

The API could be:
- get compile time default ops
- get/set platform ops (NULL if none)
- get/set user ops (NULL if none)
- get preferred ops from currently configured PMD

- get best ops: return user, or pmd-prefered, or platform, or default.

rte_pktmbuf_pool_create() will use "get best ops" if no ops (NULL) is
passed as argument.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-22 14:59         ` Olivier MATZ
@ 2017-12-28 12:07           ` Hemant Agrawal
  2018-01-10 12:49             ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2017-12-28 12:07 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: Jerin Jacob, santosh.shukla, dev

Hi Olivier,

On 12/22/2017 8:29 PM, Olivier MATZ wrote:
> On Mon, Dec 18, 2017 at 03:06:21PM +0530, Hemant Agrawal wrote:
>> On 12/18/2017 2:25 PM, Jerin Jacob wrote:
>>> -----Original Message-----
>>>> Date: Fri, 15 Dec 2017 15:54:42 +0530
>>>> From: Hemant Agrawal <hemant.agrawal@nxp.com>
>>>> To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
>>>> CC: dev@dpdk.org
>>>> Subject: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW
>>>>  active pool
>>>> X-Mailer: git-send-email 2.7.4
>>>>
>>>> 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.
>>>
>>> For me, it looks very reasonable approach as it caters the basic use
>>> case without any change in the application nor the additional(--mbuf-pool-ops-name)
>>> EAL command line scheme to select different mempool ops.
>>> Though, this option will not enough cater all the use case. I think, we can have
>>> three options and the following order of precedence to select the mempool ops
>>>
>>> 1) This patch(update active mempool based on the device probe())
>>> 2) Selection of mempool ops though --mbuf-pool-ops-name= EAL commandline argument.
>>> Which can overridden the scheme(1)
>>> 3) More sophisticated mempool section based on
>>> a) The ethdev PMD capability exposed through existing rte_eth_dev_pool_ops_supported()
>>> b) Add mempool ops option in rte_pktmbuf_pool_create()
>>> http://dpdk.org/ml/archives/dev/2017-December/083985.html
>>> c) Use (a) and (b) to select the update the mempool ops with
>>> some "weight" based algorithm like
>>> http://dpdk.org/dev/patchwork/patch/32245/
>>>
>>
>> Yes! We need more options to fine tune control over the mempool uses,
>> specially when dealing with HW mempools.
>>
>> Once the above mentioned mechanisms will be in place, it will be much easier
>> and flexible.
>
> I'm inline with this description. It would be great if the same binary can work
> on different platforms without configuration.
>
> I just feel it's a bit messy to have:
>
> - rte_eal_mbuf_default_mempool_ops() in eal API
>   return user-selected ops if any, or compile-time default
>
> - rte_pktmbuf_active_mempool_ops() in mbuf API
>   return platform ops except if a selected user ops != compile default
>
> Thomas suggested somewhere (but I don't remember in which thread) to have
> rte_eal_mbuf_default_mempool_ops() in mbuf code, and I think he was right.
>

The idea is good. It will break ABI, but we can move around in 
systematic way.

> I think the whole mbuf pool ops selection mechanism should be at the
> same place. I could be in a specific file of librte_mbuf.
>
> The API could be:
> - get compile time default ops
We can get them from "RTE_MBUF_DEFAULT_MEMPOOL_OPS"
or "
const char *rte_get_mbuf_config_mempool_ops(void)

> - get/set platform ops (NULL if none)

const char *rte_get_mbuf_platform_mempool_ops(void);
int rte_set_mbuf_platform_mempool_ops(const char *ops_name);

> - get/set user ops (NULL if none)
internal_config will only store the command line argument or NULL.

rename : rte_eal_mbuf_default_mempool_ops(void)
to  const char *rte_get_mbuf_user_mempool_ops(void)

> - get preferred ops from currently configured PMD
>

The following proposal is updating the mempool_ops name in 
internal_config, I thing that is not the best solution. We shall not 
update the internal config.

eal: add API to set default mbuf mempool ops
http://dpdk.org/ml/archives/dev/2017-December/083849.html
rte_eth_dev_get_preferred_pool_name()

> - get best ops: return user, or pmd-prefered, or platform, or default.
>

pktmbuf_pool_create is currently calling, *rte_eal_mbuf_default_mempool_ops*

This should be changed to call *rte_get_mbuf_best_mempool_ops* in the 
following order
	1. rte_get_mbuf_user_mempool_ops
         2. rte_eth_dev_get_preferred_pool_name (whenever this API comes)
         3. rte_get_mbuf_platform_mempool_ops
         4. rte_get_mbuf_config_mempool_ops

> rte_pktmbuf_pool_create() will use "get best ops" if no ops (NULL) is
> passed as argument.
>

However, we shall still provide a additional API, 
*rte_pktmbuf_pool_create_specific* if user still wants fine control or 
don't want to use the default best logic.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool
  2017-12-28 12:07           ` Hemant Agrawal
@ 2018-01-10 12:49             ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-10 12:49 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: Jerin Jacob, santosh.shukla, dev

Hi Olivier,

>> I just feel it's a bit messy to have:
>>
>> - rte_eal_mbuf_default_mempool_ops() in eal API
>>   return user-selected ops if any, or compile-time default
>>
>> - rte_pktmbuf_active_mempool_ops() in mbuf API
>>   return platform ops except if a selected user ops != compile default
>>
>> Thomas suggested somewhere (but I don't remember in which thread) to have
>> rte_eal_mbuf_default_mempool_ops() in mbuf code, and I think he was
>> right.
>>
>
> The idea is good. It will break ABI, but we can move around in
> systematic way.
>
>> I think the whole mbuf pool ops selection mechanism should be at the
>> same place. I could be in a specific file of librte_mbuf.
>>
I have just tried to implement your suggestions.  I need one clarification.

Eal based internal config is being used to store the command line 
mempool_ops_name.

If we want it to be a mbuf based API (instead of eal_mbuf), we need to 
export internal_config via map file for shared build.
Are you fine with that?

If not, we have to live with eal_mbuf APIs only.

Regards,
Hemant

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 0/5]  Dynamic HW Mempool Detection Support
  2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
  2017-12-15 10:24   ` [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool Hemant Agrawal
@ 2018-01-15  6:11   ` Hemant Agrawal
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 1/5] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                       ` (6 more replies)
  2 siblings, 7 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way. 

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and 
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Limitations and open points*

It was suggested to add all APIs in librte_mbuf, currently internal_config
is storing the mempool_ops names. So internal_config is exported in this
patchset. An alternate would be to keep these APIs in eal only and access
them indirectly from librte_mbuf.

Moreover, this logic can be further extended with addition for following
patch, which is still under discussion:

The ethdev PMD capability exposed through existing
rte_eth_dev_pool_ops_supported() to select the update the mempool ops with
some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

-----
[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html 
------
Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf 
3. Added pktmbuf_create_pool_specific wrapper in this patch series.

Hemant Agrawal (5):
  eal: prefix mbuf pool ops name with user defined
  eal: add platform mempool ops name in internal config
  mbuf: support register mempool Hw ops name APIs
  mbuf: pktmbuf pool create helper for specific mempool ops
  mbuf: add user command line config mempools ops API

 doc/guides/rel_notes/deprecation.rst       |  7 +++
 lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
 lib/librte_eal/common/eal_common_options.c |  3 +-
 lib/librte_eal/common/eal_internal_cfg.h   |  5 ++-
 lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
 lib/librte_eal/rte_eal_version.map         |  1 +
 lib/librte_mbuf/Makefile                   |  1 +
 lib/librte_mbuf/rte_mbuf.c                 | 67 ++++++++++++++++++++++++---
 lib/librte_mbuf/rte_mbuf.h                 | 72 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       | 10 +++++
 10 files changed, 162 insertions(+), 12 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 1/5] eal: prefix mbuf pool ops name with user defined
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2018-01-15  6:11     ` Hemant Agrawal
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config Hemant Agrawal
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

This patch also change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c            | 4 ++--
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_eal/common/eal_internal_cfg.h   | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c          | 4 ++--
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 369a682..8261bb1 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 1/5] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-15  6:11     ` Hemant Agrawal
  2018-01-15 12:24       ` Jerin Jacob
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
                       ` (4 subsequent siblings)
  6 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/common/eal_common_options.c | 1 +
 lib/librte_eal/common/eal_internal_cfg.h   | 2 ++
 lib/librte_eal/rte_eal_version.map         | 1 +
 3 files changed, 4 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index b6d2762..1ed0ddb 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -219,6 +219,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
 	internal_cfg->user_mbuf_pool_ops_name = NULL;
+	internal_cfg->plat_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index 1169fcc..12c5b8a 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -54,6 +54,8 @@ struct internal_config {
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
 	const char *user_mbuf_pool_ops_name;
 			/**< user defined mbuf pool ops name */
+	const char *plat_mbuf_pool_ops_name;
+			/**< platform configured mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 3fa1e13..909691f 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -203,6 +203,7 @@ DPDK_17.11 {
 DPDK_18.02 {
 	global:
 
+	internal_config;
 	rte_hypervisor_get;
 	rte_hypervisor_get_name;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 1/5] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config Hemant Agrawal
@ 2018-01-15  6:11     ` Hemant Agrawal
  2018-01-15 11:41       ` Jerin Jacob
                         ` (2 more replies)
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                       ` (3 subsequent siblings)
  6 siblings, 3 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

With this patch the specific HW mempool are no longer required to be
specified in the config file at compile. A default platform hw mempool
can be detected dynamically and published to config at run time.
Only one type of HW mempool can be active default.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/Makefile             |  1 +
 lib/librte_mbuf/rte_mbuf.c           | 42 +++++++++++++++++++++++++++++++++---
 lib/librte_mbuf/rte_mbuf.h           | 20 +++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  8 +++++++
 4 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..85c4f9e 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_mbuf.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
 LDLIBS += -lrte_eal -lrte_mempool
 
 EXPORT_MAP := rte_mbuf_version.map
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..fd3b6f5 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -58,6 +58,7 @@
 #include <rte_hexdump.h>
 #include <rte_errno.h>
 #include <rte_memcpy.h>
+#include <eal_internal_cfg.h>
 
 /*
  * ctrlmbuf constructor, given as a callback function to
@@ -148,6 +149,43 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
+int
+rte_mbuf_register_platform_mempool_ops(const char *ops_name)
+{
+	if (internal_config.plat_mbuf_pool_ops_name == NULL) {
+		internal_config.plat_mbuf_pool_ops_name = ops_name;
+		return 0;
+	}
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		internal_config.plat_mbuf_pool_ops_name);
+	return -EACCES;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	return internal_config.plat_mbuf_pool_ops_name;
+}
+
+/* Return mbuf pool ops name */
+static const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
+
 /* helper to create a mbuf pool */
 struct rte_mempool *
 rte_pktmbuf_pool_create(const char *name, unsigned n,
@@ -176,9 +214,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index e4e3917..d26e8cd 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1081,6 +1081,26 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Register the platform supported pktmbuf HW pool
+ *
+ * @param pool ops name
+ * @return
+ *   - 0: Success
+ *   - -EACCES: platform mempool is already registered.
+ */
+int
+rte_mbuf_register_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Get registered platform supported pool ops name for mbuf
+ *
+ * @return
+ *   returns platform pool ops name.
+ */
+const char*
+rte_mbuf_platform_mempool_ops(void);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..b8e258f 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,11 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+DPDK_18.02 {
+	global:
+
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_register_platform_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
                       ` (2 preceding siblings ...)
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
@ 2018-01-15  6:11     ` Hemant Agrawal
  2018-01-15 12:31       ` Jerin Jacob
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API Hemant Agrawal
                       ` (2 subsequent siblings)
  6 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/rte_mbuf.c           | 23 ++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h           | 42 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  1 +
 3 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index fd3b6f5..482676c 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -186,15 +186,15 @@ rte_mbuf_best_mempool_ops(void)
 	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 }
 
-/* helper to create a mbuf pool */
+/* helper to create a mbuf pool with given mempool ops*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_specific(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -214,7 +214,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -236,6 +237,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_specific(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index d26e8cd..f958e3c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1081,6 +1081,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with specific mempool ops
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_specific(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Register the platform supported pktmbuf HW pool
  *
  * @param pool ops name
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index b8e258f..9b53502 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -41,5 +41,6 @@ DPDK_18.02 {
 
 	rte_mbuf_platform_mempool_ops;
 	rte_mbuf_register_platform_mempool_ops;
+	rte_pktmbuf_pool_create_specific;
 
 } DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
                       ` (3 preceding siblings ...)
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-15  6:11     ` Hemant Agrawal
  2018-01-15 12:29       ` Jerin Jacob
  2018-01-16 15:01     ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Olivier Matz
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
  6 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15  6:11 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add the user command line configured mempool ops name
API to librte_mbuf and sends a deprecation notice to remove the
similar API from eal.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/guides/rel_notes/deprecation.rst |  7 +++++++
 lib/librte_mbuf/rte_mbuf.c           |  8 +++++++-
 lib/librte_mbuf/rte_mbuf.h           | 10 ++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  1 +
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 13e8543..ec8018f 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,6 +8,13 @@ API and ABI deprecation notices are to be posted here.
 Deprecation Notices
 -------------------
 
+* eal: a mbuf specific API was part of eal APIs. This is now being
+  moved to librte_mbuf to be with other similar APIs.
+  The following API is target to be deprecated on 18.05.
+
+  - ``rte_eal_mbuf_default_mempool_ops`` replaced by
+	``rte_mbuf_user_mempool_ops''
+
 * eal: several API and ABI changes are planned for ``rte_devargs`` in v18.02.
   The format of device command line parameters will change. The bus will need
   to be explicitly stated in the device declaration. The enum ``rte_devtype``
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 482676c..c587d3a 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -168,12 +168,18 @@ rte_mbuf_platform_mempool_ops(void)
 	return internal_config.plat_mbuf_pool_ops_name;
 }
 
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	return internal_config.user_mbuf_pool_ops_name;
+}
+
 /* Return mbuf pool ops name */
 static const char *
 rte_mbuf_best_mempool_ops(void)
 {
 	/* User defined mempool ops takes the priority */
-	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
+	const char *best_ops = rte_mbuf_user_mempool_ops();
 	if (best_ops)
 		return best_ops;
 
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index f958e3c..7feacc0 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1143,6 +1143,16 @@ const char*
 rte_mbuf_platform_mempool_ops(void);
 
 /**
+ * Get user command line configured pool ops name for mbuf
+ *
+ * @return
+ *   returns user pool ops name.
+ */
+
+const char*
+rte_mbuf_user_mempool_ops(void);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 9b53502..d4af497 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -41,6 +41,7 @@ DPDK_18.02 {
 
 	rte_mbuf_platform_mempool_ops;
 	rte_mbuf_register_platform_mempool_ops;
+	rte_mbuf_user_mempool_ops;
 	rte_pktmbuf_pool_create_specific;
 
 } DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
@ 2018-01-15 11:41       ` Jerin Jacob
  2018-01-15 14:24         ` Hemant Agrawal
  2018-01-15 12:36       ` Jerin Jacob
  2018-01-16 15:09       ` Olivier Matz
  2 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 11:41 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 11:41:12 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, olivier.matz@6wind.com,
>  santosh.shukla@caviumnetworks.com
> Subject: [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
> X-Mailer: git-send-email 2.7.4
> 
> With this patch the specific HW mempool are no longer required to be
> specified in the config file at compile. A default platform hw mempool
> can be detected dynamically and published to config at run time.
> Only one type of HW mempool can be active default.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mbuf/Makefile             |  1 +
>  lib/librte_mbuf/rte_mbuf.c           | 42 +++++++++++++++++++++++++++++++++---
>  lib/librte_mbuf/rte_mbuf.h           | 20 +++++++++++++++++
>  lib/librte_mbuf/rte_mbuf_version.map |  8 +++++++
>  4 files changed, 68 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
> index 398f724..85c4f9e 100644
> --- a/lib/librte_mbuf/Makefile
> +++ b/lib/librte_mbuf/Makefile
> @@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  LIB = librte_mbuf.a
>  
>  CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
>  LDLIBS += -lrte_eal -lrte_mempool
>  
>  EXPORT_MAP := rte_mbuf_version.map
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index c085c37..fd3b6f5 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -58,6 +58,7 @@
>  #include <rte_hexdump.h>
>  #include <rte_errno.h>
>  #include <rte_memcpy.h>
> +#include <eal_internal_cfg.h>
>  
>  /*
>   * ctrlmbuf constructor, given as a callback function to
> @@ -148,6 +149,43 @@ rte_pktmbuf_init(struct rte_mempool *mp,
>  	m->next = NULL;
>  }
>  
> +int
> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> +{

Should we also check the following?

if (internal_config.plat_mbuf_pool_ops_name != NULL &&
strncmp(internal_config.plat_mbuf_pool_ops_name, ops_name, ..) == 0)
	return 0;

i.e avoid returning error if the same the driver but another
instance(different ethdev port) updates the same ops_name value.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config Hemant Agrawal
@ 2018-01-15 12:24       ` Jerin Jacob
  2018-01-15 14:31         ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 12:24 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 11:41:11 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, olivier.matz@6wind.com,
>  santosh.shukla@caviumnetworks.com
> Subject: [PATCH v2 2/5] eal: add platform mempool ops name in internal
>  config
> X-Mailer: git-send-email 2.7.4
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_eal/common/eal_common_options.c | 1 +
>  lib/librte_eal/common/eal_internal_cfg.h   | 2 ++
>  lib/librte_eal/rte_eal_version.map         | 1 +
>  3 files changed, 4 insertions(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index b6d2762..1ed0ddb 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -219,6 +219,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
>  	internal_cfg->vmware_tsc_map = 0;
>  	internal_cfg->create_uio_dev = 0;
>  	internal_cfg->user_mbuf_pool_ops_name = NULL;
> +	internal_cfg->plat_mbuf_pool_ops_name = NULL;
>  }
>  
>  static int
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> index 1169fcc..12c5b8a 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -54,6 +54,8 @@ struct internal_config {
>  	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
>  	const char *user_mbuf_pool_ops_name;
>  			/**< user defined mbuf pool ops name */
> +	const char *plat_mbuf_pool_ops_name;
> +			/**< platform configured mbuf pool ops name */
>  	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
>  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
>  };
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index 3fa1e13..909691f 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -203,6 +203,7 @@ DPDK_17.11 {
>  DPDK_18.02 {
>  	global:
>  
> +	internal_config;

I think, exposing the internal_config may not be a good idea. We may
need "plat_mbuf_pool_ops_name" value for multi process case too.
Considering the above points, How about adding it in
struct rte_config and then expose too rte_eal_get_configuration()
On the downside, it would be an ABI change.

>  	rte_hypervisor_get;
>  	rte_hypervisor_get_name;
>  
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API Hemant Agrawal
@ 2018-01-15 12:29       ` Jerin Jacob
  2018-01-15 14:35         ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 12:29 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 11:41:14 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, olivier.matz@6wind.com,
>  santosh.shukla@caviumnetworks.com
> Subject: [PATCH v2 5/5] mbuf: add user command line config mempools ops API
> X-Mailer: git-send-email 2.7.4
> 
> This patch add the user command line configured mempool ops name
> API to librte_mbuf and sends a deprecation notice to remove the
> similar API from eal.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  doc/guides/rel_notes/deprecation.rst |  7 +++++++
>  lib/librte_mbuf/rte_mbuf.c           |  8 +++++++-
>  lib/librte_mbuf/rte_mbuf.h           | 10 ++++++++++
>  lib/librte_mbuf/rte_mbuf_version.map |  1 +
>  4 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index 13e8543..ec8018f 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -8,6 +8,13 @@ API and ABI deprecation notices are to be posted here.
>  Deprecation Notices
>  -------------------
>  
> +* eal: a mbuf specific API was part of eal APIs. This is now being
> +  moved to librte_mbuf to be with other similar APIs.
> +  The following API is target to be deprecated on 18.05.
> +
> +  - ``rte_eal_mbuf_default_mempool_ops`` replaced by
> +	``rte_mbuf_user_mempool_ops''
> +

I think, deprecation notice need to be in a separate 'doc" patch.


>  * eal: several API and ABI changes are planned for ``rte_devargs`` in v18.02.
>    The format of device command line parameters will change. The bus will need
>    to be explicitly stated in the device declaration. The enum ``rte_devtype``
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index 482676c..c587d3a 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -168,12 +168,18 @@ rte_mbuf_platform_mempool_ops(void)
>  	return internal_config.plat_mbuf_pool_ops_name;
>  }
>  
> +const char *
> +rte_mbuf_user_mempool_ops(void)
> +{
> +	return internal_config.user_mbuf_pool_ops_name;
> +}
> +
>  /* Return mbuf pool ops name */
>  static const char *
>  rte_mbuf_best_mempool_ops(void)
>  {
>  	/* User defined mempool ops takes the priority */
> -	const char *best_ops = rte_eal_mbuf_default_mempool_ops();

I think, we may need to remove the stale rte_eal_mbuf_default_mempool_ops() once
it is replaced.

> +	const char *best_ops = rte_mbuf_user_mempool_ops();
>  	if (best_ops)
>  		return best_ops;
>  
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index f958e3c..7feacc0 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1143,6 +1143,16 @@ const char*
>  rte_mbuf_platform_mempool_ops(void);
>  
>  /**
> + * Get user command line configured pool ops name for mbuf
> + *
> + * @return
> + *   returns user pool ops name.
> + */
> +
> +const char*
> +rte_mbuf_user_mempool_ops(void);
> +
> +/**
>   * Get the data room size of mbufs stored in a pktmbuf_pool
>   *
>   * The data room size is the amount of data that can be stored in a
> diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
> index 9b53502..d4af497 100644
> --- a/lib/librte_mbuf/rte_mbuf_version.map
> +++ b/lib/librte_mbuf/rte_mbuf_version.map
> @@ -41,6 +41,7 @@ DPDK_18.02 {
>  
>  	rte_mbuf_platform_mempool_ops;
>  	rte_mbuf_register_platform_mempool_ops;
> +	rte_mbuf_user_mempool_ops;
>  	rte_pktmbuf_pool_create_specific;
>  
>  } DPDK_16.11;
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-15 12:31       ` Jerin Jacob
  2018-01-15 14:32         ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 12:31 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 11:41:13 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, olivier.matz@6wind.com,
>  santosh.shukla@caviumnetworks.com
> Subject: [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific
>  mempool ops
> X-Mailer: git-send-email 2.7.4
> 
> Introduce a new helper for pktmbuf pool, which will allow
> the application to optionally specify the mempool ops name
> as well.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mbuf/rte_mbuf.c           | 23 ++++++++++++++------
>  lib/librte_mbuf/rte_mbuf.h           | 42 ++++++++++++++++++++++++++++++++++++
>  lib/librte_mbuf/rte_mbuf_version.map |  1 +
>  3 files changed, 60 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index fd3b6f5..482676c 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -186,15 +186,15 @@ rte_mbuf_best_mempool_ops(void)
>  	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
>  }
>  
> -/* helper to create a mbuf pool */
> +/* helper to create a mbuf pool with given mempool ops*/
>  struct rte_mempool *
> -rte_pktmbuf_pool_create(const char *name, unsigned n,
> -	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
> -	int socket_id)
> +rte_pktmbuf_pool_create_specific(const char *name, unsigned int n,

No strong opinion on name. I think, rte_pktmbuf_pool_create_by_op() may be 
a better name than rte_pktmbuf_pool_create_specific()

> +	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
> +	int socket_id, const char *ops_name)

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
  2018-01-15 11:41       ` Jerin Jacob
@ 2018-01-15 12:36       ` Jerin Jacob
  2018-01-16 15:09       ` Olivier Matz
  2 siblings, 0 replies; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 12:36 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 11:41:12 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, olivier.matz@6wind.com,
>  santosh.shukla@caviumnetworks.com
> Subject: [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
> X-Mailer: git-send-email 2.7.4
> 
> With this patch the specific HW mempool are no longer required to be
> specified in the config file at compile. A default platform hw mempool
> can be detected dynamically and published to config at run time.
> Only one type of HW mempool can be active default.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mbuf/Makefile             |  1 +
>  lib/librte_mbuf/rte_mbuf.c           | 42 +++++++++++++++++++++++++++++++++---
>  lib/librte_mbuf/rte_mbuf.h           | 20 +++++++++++++++++
>  lib/librte_mbuf/rte_mbuf_version.map |  8 +++++++
>  4 files changed, 68 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
> index 398f724..85c4f9e 100644
> --- a/lib/librte_mbuf/Makefile
> +++ b/lib/librte_mbuf/Makefile
> @@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  LIB = librte_mbuf.a
>  
>  CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
>  LDLIBS += -lrte_eal -lrte_mempool
>  
>  EXPORT_MAP := rte_mbuf_version.map
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index c085c37..fd3b6f5 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -58,6 +58,7 @@
>  #include <rte_hexdump.h>
>  #include <rte_errno.h>
>  #include <rte_memcpy.h>
> +#include <eal_internal_cfg.h>
>  
>  /*
>   * ctrlmbuf constructor, given as a callback function to
> @@ -148,6 +149,43 @@ rte_pktmbuf_init(struct rte_mempool *mp,
>  	m->next = NULL;
>  }
>  
> +int
> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> +{
> +	if (internal_config.plat_mbuf_pool_ops_name == NULL) {
> +		internal_config.plat_mbuf_pool_ops_name = ops_name;
> +		return 0;
> +	}
> +	RTE_LOG(ERR, MBUF,
> +		"%s is already registered as platform mbuf pool ops\n",
> +		internal_config.plat_mbuf_pool_ops_name);
> +	return -EACCES;
> +}
> +
> +const char *
> +rte_mbuf_platform_mempool_ops(void)
> +{
> +	return internal_config.plat_mbuf_pool_ops_name;
> +}
> +
> +/* Return mbuf pool ops name */
> +static const char *
> +rte_mbuf_best_mempool_ops(void)
> +{
> +	/* User defined mempool ops takes the priority */
> +	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Next choice is platform configured mempool ops */
> +	best_ops = rte_mbuf_platform_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Last choice is to use the compile time config pool */
> +	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
> +}

The mempool ops selection makes sense to me.
We could add an "weight" based mempool ops selection in future here.
http://dpdk.org/dev/patchwork/patch/32245/

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15 11:41       ` Jerin Jacob
@ 2018-01-15 14:24         ` Hemant Agrawal
  2018-01-15 14:37           ` Jerin Jacob
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15 14:24 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, olivier.matz, santosh.shukla

On 1/15/2018 5:11 PM, Jerin Jacob wrote:
>>
>> +int
>> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
>> +{
>
> Should we also check the following?
>
> if (internal_config.plat_mbuf_pool_ops_name != NULL &&
> strncmp(internal_config.plat_mbuf_pool_ops_name, ops_name, ..) == 0)
> 	return 0;
>
> i.e avoid returning error if the same the driver but another
> instance(different ethdev port) updates the same ops_name value.
>

No, there shall be only one default platform hw pool name.
Any ethdev driven (may be weight based) replacement shall be dealt 
separately.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-15 12:24       ` Jerin Jacob
@ 2018-01-15 14:31         ` Hemant Agrawal
  2018-01-15 16:26           ` Jerin Jacob
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15 14:31 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, olivier.matz, santosh.shukla

On 1/15/2018 5:54 PM, Jerin Jacob wrote:
>>  static int
>> diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
>> index 1169fcc..12c5b8a 100644
>> --- a/lib/librte_eal/common/eal_internal_cfg.h
>> +++ b/lib/librte_eal/common/eal_internal_cfg.h
>> @@ -54,6 +54,8 @@ struct internal_config {
>>  	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
>>  	const char *user_mbuf_pool_ops_name;
>>  			/**< user defined mbuf pool ops name */
>> +	const char *plat_mbuf_pool_ops_name;
>> +			/**< platform configured mbuf pool ops name */
>>  	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
>>  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
>>  };
>> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
>> index 3fa1e13..909691f 100644
>> --- a/lib/librte_eal/rte_eal_version.map
>> +++ b/lib/librte_eal/rte_eal_version.map
>> @@ -203,6 +203,7 @@ DPDK_17.11 {
>>  DPDK_18.02 {
>>  	global:
>>
>> +	internal_config;
>
> I think, exposing the internal_config may not be a good idea. We may
> need "plat_mbuf_pool_ops_name" value for multi process case too.
> Considering the above points, How about adding it in
> struct rte_config and then expose too rte_eal_get_configuration()
> On the downside, it would be an ABI change.

Yes! I was also not sure about exposing internal_config.

rte_config is also a good option. If  we add these options in the end, 
it should not break ABI?


>
>>  	rte_hypervisor_get;
>>  	rte_hypervisor_get_name;
>>
>> --
>> 2.7.4
>>
>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-15 12:31       ` Jerin Jacob
@ 2018-01-15 14:32         ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15 14:32 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, olivier.matz, santosh.shukla

On 1/15/2018 6:01 PM, Jerin Jacob wrote:
>> Introduce a new helper for pktmbuf pool, which will allow
>> the application to optionally specify the mempool ops name
>> as well.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>  lib/librte_mbuf/rte_mbuf.c           | 23 ++++++++++++++------
>>  lib/librte_mbuf/rte_mbuf.h           | 42 ++++++++++++++++++++++++++++++++++++
>>  lib/librte_mbuf/rte_mbuf_version.map |  1 +
>>  3 files changed, 60 insertions(+), 6 deletions(-)
>>
<snip>...
>> +rte_pktmbuf_pool_create_specific(const char *name, unsigned int n,
>
> No strong opinion on name. I think, rte_pktmbuf_pool_create_by_op() may be
> a better name than rte_pktmbuf_pool_create_specific()

yes. looks better. I will change it in next rev.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API
  2018-01-15 12:29       ` Jerin Jacob
@ 2018-01-15 14:35         ` Hemant Agrawal
  2018-01-15 16:23           ` Jerin Jacob
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-15 14:35 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, olivier.matz, santosh.shukla

On 1/15/2018 5:59 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Mon, 15 Jan 2018 11:41:14 +0530
>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>> This patch add the user command line configured mempool ops name
>> API to librte_mbuf and sends a deprecation notice to remove the
>> similar API from eal.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>  doc/guides/rel_notes/deprecation.rst |  7 +++++++
>>  lib/librte_mbuf/rte_mbuf.c           |  8 +++++++-
>>  lib/librte_mbuf/rte_mbuf.h           | 10 ++++++++++
>>  lib/librte_mbuf/rte_mbuf_version.map |  1 +
>>  4 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
>> index 13e8543..ec8018f 100644
>> --- a/doc/guides/rel_notes/deprecation.rst
>> +++ b/doc/guides/rel_notes/deprecation.rst
>> @@ -8,6 +8,13 @@ API and ABI deprecation notices are to be posted here.
>>  Deprecation Notices
>>  -------------------
>>
>> +* eal: a mbuf specific API was part of eal APIs. This is now being
>> +  moved to librte_mbuf to be with other similar APIs.
>> +  The following API is target to be deprecated on 18.05.
>> +
>> +  - ``rte_eal_mbuf_default_mempool_ops`` replaced by
>> +	``rte_mbuf_user_mempool_ops''
>> +
>
> I think, deprecation notice need to be in a separate 'doc" patch.

Yes. you are right.

<snip>..

>> +const char *
>> +rte_mbuf_user_mempool_ops(void)
>> +{
>> +	return internal_config.user_mbuf_pool_ops_name;
>> +}
>> +
>>  /* Return mbuf pool ops name */
>>  static const char *
>>  rte_mbuf_best_mempool_ops(void)
>>  {
>>  	/* User defined mempool ops takes the priority */
>> -	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
>
> I think, we may need to remove the stale rte_eal_mbuf_default_mempool_ops() once
> it is replaced.

Do you mean that till the API is not deprecated, we shall keep the usage?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15 14:24         ` Hemant Agrawal
@ 2018-01-15 14:37           ` Jerin Jacob
  0 siblings, 0 replies; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 14:37 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 19:54:36 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: dev@dpdk.org, olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> Subject: Re: [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
>  Thunderbird/45.8.0
> 
> On 1/15/2018 5:11 PM, Jerin Jacob wrote:
> > > 
> > > +int
> > > +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> > > +{
> > 
> > Should we also check the following?
> > 
> > if (internal_config.plat_mbuf_pool_ops_name != NULL &&
> > strncmp(internal_config.plat_mbuf_pool_ops_name, ops_name, ..) == 0)
> > 	return 0;
> > 
> > i.e avoid returning error if the same the driver but another
> > instance(different ethdev port) updates the same ops_name value.
> > 
> 
> No, there shall be only one default platform hw pool name.
> Any ethdev driven (may be weight based) replacement shall be dealt
> separately.

OK. Who calls the rte_mbuf_register_platform_mempool_ops() and when?
mempool ops registration is using gcc construction scheme so it will 
be called all the time. I thought, ethdev drivers will call this API on
pci or any other bus probe() and if its in probe() then 
rte_mbuf_register_platform_mempool_ops() will be called multiple time.

What is your thought on this API usage?

> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API
  2018-01-15 14:35         ` Hemant Agrawal
@ 2018-01-15 16:23           ` Jerin Jacob
  0 siblings, 0 replies; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 16:23 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 20:05:16 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: dev@dpdk.org, olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> Subject: Re: [PATCH v2 5/5] mbuf: add user command line config mempools ops
>  API
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
>  Thunderbird/45.8.0
> 
> On 1/15/2018 5:59 PM, Jerin Jacob wrote:
> > -----Original Message-----
> > > Date: Mon, 15 Jan 2018 11:41:14 +0530
> > > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> > > This patch add the user command line configured mempool ops name
> > > API to librte_mbuf and sends a deprecation notice to remove the
> > > similar API from eal.
> > > 
> > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > ---
> > >  doc/guides/rel_notes/deprecation.rst |  7 +++++++
> > >  lib/librte_mbuf/rte_mbuf.c           |  8 +++++++-
> > >  lib/librte_mbuf/rte_mbuf.h           | 10 ++++++++++
> > >  lib/librte_mbuf/rte_mbuf_version.map |  1 +
> > >  4 files changed, 25 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> > > index 13e8543..ec8018f 100644
> > > --- a/doc/guides/rel_notes/deprecation.rst
> > > +++ b/doc/guides/rel_notes/deprecation.rst
> > > @@ -8,6 +8,13 @@ API and ABI deprecation notices are to be posted here.
> > >  Deprecation Notices
> > >  -------------------
> > > 
> > > +* eal: a mbuf specific API was part of eal APIs. This is now being
> > > +  moved to librte_mbuf to be with other similar APIs.
> > > +  The following API is target to be deprecated on 18.05.
> > > +
> > > +  - ``rte_eal_mbuf_default_mempool_ops`` replaced by
> > > +	``rte_mbuf_user_mempool_ops''
> > > +
> > 
> > I think, deprecation notice need to be in a separate 'doc" patch.
> 
> Yes. you are right.
> 
> <snip>..
> 
> > > +const char *
> > > +rte_mbuf_user_mempool_ops(void)
> > > +{
> > > +	return internal_config.user_mbuf_pool_ops_name;
> > > +}
> > > +
> > >  /* Return mbuf pool ops name */
> > >  static const char *
> > >  rte_mbuf_best_mempool_ops(void)
> > >  {
> > >  	/* User defined mempool ops takes the priority */
> > > -	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
> > 
> > I think, we may need to remove the stale rte_eal_mbuf_default_mempool_ops() once
> > it is replaced.
> 
> Do you mean that till the API is not deprecated, we shall keep the usage?

Yes

> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-15 14:31         ` Hemant Agrawal
@ 2018-01-15 16:26           ` Jerin Jacob
  2018-01-16 15:04             ` Olivier Matz
  0 siblings, 1 reply; 112+ messages in thread
From: Jerin Jacob @ 2018-01-15 16:26 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, santosh.shukla

-----Original Message-----
> Date: Mon, 15 Jan 2018 20:01:14 +0530
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: dev@dpdk.org, olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> Subject: Re: [PATCH v2 2/5] eal: add platform mempool ops name in internal
>  config
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
>  Thunderbird/45.8.0
> 
> On 1/15/2018 5:54 PM, Jerin Jacob wrote:
> > >  static int
> > > diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> > > index 1169fcc..12c5b8a 100644
> > > --- a/lib/librte_eal/common/eal_internal_cfg.h
> > > +++ b/lib/librte_eal/common/eal_internal_cfg.h
> > > @@ -54,6 +54,8 @@ struct internal_config {
> > >  	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
> > >  	const char *user_mbuf_pool_ops_name;
> > >  			/**< user defined mbuf pool ops name */
> > > +	const char *plat_mbuf_pool_ops_name;
> > > +			/**< platform configured mbuf pool ops name */
> > >  	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
> > >  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> > >  };
> > > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> > > index 3fa1e13..909691f 100644
> > > --- a/lib/librte_eal/rte_eal_version.map
> > > +++ b/lib/librte_eal/rte_eal_version.map
> > > @@ -203,6 +203,7 @@ DPDK_17.11 {
> > >  DPDK_18.02 {
> > >  	global:
> > > 
> > > +	internal_config;
> > 
> > I think, exposing the internal_config may not be a good idea. We may
> > need "plat_mbuf_pool_ops_name" value for multi process case too.
> > Considering the above points, How about adding it in
> > struct rte_config and then expose too rte_eal_get_configuration()
> > On the downside, it would be an ABI change.
> 
> Yes! I was also not sure about exposing internal_config.
> 
> rte_config is also a good option. If  we add these options in the end, it
> should not break ABI?

I think, it does break the ABI.

> 
> 
> > 
> > >  	rte_hypervisor_get;
> > >  	rte_hypervisor_get_name;
> > > 
> > > --
> > > 2.7.4
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
                       ` (4 preceding siblings ...)
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API Hemant Agrawal
@ 2018-01-16 15:01     ` Olivier Matz
  2018-01-18 11:47       ` Hemant Agrawal
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
  6 siblings, 1 reply; 112+ messages in thread
From: Olivier Matz @ 2018-01-16 15:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Mon, Jan 15, 2018 at 11:41:09AM +0530, Hemant Agrawal wrote:
> W.r.t the multiple discussions in the past about the ability to
> dynamically detect the HW mempool support. [1],[2] & [3]
> 
> This patchset helps in removing the current static mempool selection
> model and provides a flexible model to select the pktmbuf mempool
> in more dynamic way. 
> 
> 1) This patchset updates the hw mempool on the basis of device probe()),
>    thus avoiding the need to specify the hw mempool in config file and 
>    focing different binaries for diffirent config architectures.
> 2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
>    which can overridden the scheme(1)
> 3) A new best mempool ops selection logic.
> 4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
>    name as an argument as well.
> 
> *Limitations and open points*
> 
> It was suggested to add all APIs in librte_mbuf, currently internal_config
> is storing the mempool_ops names. So internal_config is exported in this
> patchset. An alternate would be to keep these APIs in eal only and access
> them indirectly from librte_mbuf.

Instead of storing the mempool_ops name in internal config, can't it be
stored inside librte_mbuf? The eal code can call
rte_mbuf_set_user_mempool_ops(name) while parsing the arguments.

It has to be done carefully so that it works with secondary processes.


> Moreover, this logic can be further extended with addition for following
> patch, which is still under discussion:
> 
> The ethdev PMD capability exposed through existing
> rte_eth_dev_pool_ops_supported() to select the update the mempool ops with
> some "weight" based algorithm like:
> http://dpdk.org/dev/patchwork/patch/32245/
> 
> -----
> [1]Multiple Pktmbuf mempool support
> http://dpdk.org/ml/archives/dev/2017-September/076531.html
> [2]Allow application set mempool handle
> http://dpdk.org/ml/archives/dev/2017-June/067022.html
> Other discussions
> [3] http://dpdk.org/ml/archives/dev/2017-December/084775.html 
> ------
> Changes in v2:
> 1. Changed the active mempool to platform mempool
> 2. Moved all the relavant APIs to librte_mbuf 
> 3. Added pktmbuf_create_pool_specific wrapper in this patch series.
> 
> Hemant Agrawal (5):
>   eal: prefix mbuf pool ops name with user defined
>   eal: add platform mempool ops name in internal config
>   mbuf: support register mempool Hw ops name APIs
>   mbuf: pktmbuf pool create helper for specific mempool ops
>   mbuf: add user command line config mempools ops API
> 
>  doc/guides/rel_notes/deprecation.rst       |  7 +++
>  lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
>  lib/librte_eal/common/eal_common_options.c |  3 +-
>  lib/librte_eal/common/eal_internal_cfg.h   |  5 ++-
>  lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
>  lib/librte_eal/rte_eal_version.map         |  1 +
>  lib/librte_mbuf/Makefile                   |  1 +
>  lib/librte_mbuf/rte_mbuf.c                 | 67 ++++++++++++++++++++++++---
>  lib/librte_mbuf/rte_mbuf.h                 | 72 ++++++++++++++++++++++++++++++

I think the code to manage the user/platform mempool ops could
go in a separate file. What about rte_mbuf_pool_ops.[ch] ?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-15 16:26           ` Jerin Jacob
@ 2018-01-16 15:04             ` Olivier Matz
  2018-01-16 15:08               ` Jerin Jacob
  0 siblings, 1 reply; 112+ messages in thread
From: Olivier Matz @ 2018-01-16 15:04 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Hemant Agrawal, dev, santosh.shukla

On Mon, Jan 15, 2018 at 09:56:36PM +0530, Jerin Jacob wrote:
> -----Original Message-----
> > Date: Mon, 15 Jan 2018 20:01:14 +0530
> > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > CC: dev@dpdk.org, olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> > Subject: Re: [PATCH v2 2/5] eal: add platform mempool ops name in internal
> >  config
> > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
> >  Thunderbird/45.8.0
> > 
> > On 1/15/2018 5:54 PM, Jerin Jacob wrote:
> > > >  static int
> > > > diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> > > > index 1169fcc..12c5b8a 100644
> > > > --- a/lib/librte_eal/common/eal_internal_cfg.h
> > > > +++ b/lib/librte_eal/common/eal_internal_cfg.h
> > > > @@ -54,6 +54,8 @@ struct internal_config {
> > > >  	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
> > > >  	const char *user_mbuf_pool_ops_name;
> > > >  			/**< user defined mbuf pool ops name */
> > > > +	const char *plat_mbuf_pool_ops_name;
> > > > +			/**< platform configured mbuf pool ops name */
> > > >  	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
> > > >  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> > > >  };
> > > > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> > > > index 3fa1e13..909691f 100644
> > > > --- a/lib/librte_eal/rte_eal_version.map
> > > > +++ b/lib/librte_eal/rte_eal_version.map
> > > > @@ -203,6 +203,7 @@ DPDK_17.11 {
> > > >  DPDK_18.02 {
> > > >  	global:
> > > > 
> > > > +	internal_config;
> > > 
> > > I think, exposing the internal_config may not be a good idea. We may
> > > need "plat_mbuf_pool_ops_name" value for multi process case too.
> > > Considering the above points, How about adding it in
> > > struct rte_config and then expose too rte_eal_get_configuration()
> > > On the downside, it would be an ABI change.
> > 
> > Yes! I was also not sure about exposing internal_config.
> > 
> > rte_config is also a good option. If  we add these options in the end, it
> > should not break ABI?
> 
> I think, it does break the ABI.

What about a new API in librte_mbuf as suggested as a reply to the cover
letter?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config
  2018-01-16 15:04             ` Olivier Matz
@ 2018-01-16 15:08               ` Jerin Jacob
  0 siblings, 0 replies; 112+ messages in thread
From: Jerin Jacob @ 2018-01-16 15:08 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Hemant Agrawal, dev, santosh.shukla

-----Original Message-----
> Date: Tue, 16 Jan 2018 16:04:20 +0100
> From: Olivier Matz <olivier.matz@6wind.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: Hemant Agrawal <hemant.agrawal@nxp.com>, dev@dpdk.org,
>  santosh.shukla@caviumnetworks.com
> Subject: Re: [PATCH v2 2/5] eal: add platform mempool ops name in internal
>  config
> User-Agent: NeoMutt/20170113 (1.7.2)
> 
> On Mon, Jan 15, 2018 at 09:56:36PM +0530, Jerin Jacob wrote:
> > -----Original Message-----
> > > Date: Mon, 15 Jan 2018 20:01:14 +0530
> > > From: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > CC: dev@dpdk.org, olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com
> > > Subject: Re: [PATCH v2 2/5] eal: add platform mempool ops name in internal
> > >  config
> > > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
> > >  Thunderbird/45.8.0
> > > 
> > > On 1/15/2018 5:54 PM, Jerin Jacob wrote:
> > > > >  static int
> > > > > diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> > > > > index 1169fcc..12c5b8a 100644
> > > > > --- a/lib/librte_eal/common/eal_internal_cfg.h
> > > > > +++ b/lib/librte_eal/common/eal_internal_cfg.h
> > > > > @@ -54,6 +54,8 @@ struct internal_config {
> > > > >  	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
> > > > >  	const char *user_mbuf_pool_ops_name;
> > > > >  			/**< user defined mbuf pool ops name */
> > > > > +	const char *plat_mbuf_pool_ops_name;
> > > > > +			/**< platform configured mbuf pool ops name */
> > > > >  	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
> > > > >  	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> > > > >  };
> > > > > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> > > > > index 3fa1e13..909691f 100644
> > > > > --- a/lib/librte_eal/rte_eal_version.map
> > > > > +++ b/lib/librte_eal/rte_eal_version.map
> > > > > @@ -203,6 +203,7 @@ DPDK_17.11 {
> > > > >  DPDK_18.02 {
> > > > >  	global:
> > > > > 
> > > > > +	internal_config;
> > > > 
> > > > I think, exposing the internal_config may not be a good idea. We may
> > > > need "plat_mbuf_pool_ops_name" value for multi process case too.
> > > > Considering the above points, How about adding it in
> > > > struct rte_config and then expose too rte_eal_get_configuration()
> > > > On the downside, it would be an ABI change.
> > > 
> > > Yes! I was also not sure about exposing internal_config.
> > > 
> > > rte_config is also a good option. If  we add these options in the end, it
> > > should not break ABI?
> > 
> > I think, it does break the ABI.
> 
> What about a new API in librte_mbuf as suggested as a reply to the cover
> letter?

Looks good to me.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs
  2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
  2018-01-15 11:41       ` Jerin Jacob
  2018-01-15 12:36       ` Jerin Jacob
@ 2018-01-16 15:09       ` Olivier Matz
  2 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-16 15:09 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Mon, Jan 15, 2018 at 11:41:12AM +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 platform hw mempool
> can be detected dynamically and published to config at run time.
> Only one type of HW mempool can be active default.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mbuf/Makefile             |  1 +
>  lib/librte_mbuf/rte_mbuf.c           | 42 +++++++++++++++++++++++++++++++++---
>  lib/librte_mbuf/rte_mbuf.h           | 20 +++++++++++++++++
>  lib/librte_mbuf/rte_mbuf_version.map |  8 +++++++
>  4 files changed, 68 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
> index 398f724..85c4f9e 100644
> --- a/lib/librte_mbuf/Makefile
> +++ b/lib/librte_mbuf/Makefile
> @@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  LIB = librte_mbuf.a
>  
>  CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
>  LDLIBS += -lrte_eal -lrte_mempool
>  
>  EXPORT_MAP := rte_mbuf_version.map
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index c085c37..fd3b6f5 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -58,6 +58,7 @@
>  #include <rte_hexdump.h>
>  #include <rte_errno.h>
>  #include <rte_memcpy.h>
> +#include <eal_internal_cfg.h>
>  
>  /*
>   * ctrlmbuf constructor, given as a callback function to
> @@ -148,6 +149,43 @@ rte_pktmbuf_init(struct rte_mempool *mp,
>  	m->next = NULL;
>  }
>  
> +int
> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> +{
> +	if (internal_config.plat_mbuf_pool_ops_name == NULL) {
> +		internal_config.plat_mbuf_pool_ops_name = ops_name;
> +		return 0;
> +	}
> +	RTE_LOG(ERR, MBUF,
> +		"%s is already registered as platform mbuf pool ops\n",
> +		internal_config.plat_mbuf_pool_ops_name);
> +	return -EACCES;
> +}
> +
> +const char *
> +rte_mbuf_platform_mempool_ops(void)
> +{
> +	return internal_config.plat_mbuf_pool_ops_name;
> +}
> +
> +/* Return mbuf pool ops name */
> +static const char *
> +rte_mbuf_best_mempool_ops(void)

Shall we export this function?


> +{
> +	/* User defined mempool ops takes the priority */
> +	const char *best_ops = rte_eal_mbuf_default_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Next choice is platform configured mempool ops */
> +	best_ops = rte_mbuf_platform_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Last choice is to use the compile time config pool */
> +	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
> +}
> +
>  /* helper to create a mbuf pool */
>  struct rte_mempool *
>  rte_pktmbuf_pool_create(const char *name, unsigned n,
> @@ -176,9 +214,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
>  	if (mp == NULL)
>  		return NULL;
>  
> -	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
> -	if (mp_ops_name == NULL)
> -		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
> +	mp_ops_name = rte_mbuf_best_mempool_ops();
>  	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
>  	if (ret != 0) {
>  		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index e4e3917..d26e8cd 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1081,6 +1081,26 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
>  	int socket_id);
>  
>  /**
> + * Register the platform supported pktmbuf HW pool
> + *
> + * @param pool ops name

description is missing here


> + * @return
> + *   - 0: Success
> + *   - -EACCES: platform mempool is already registered.

Maybe -EEXIST is more appropriate?


> + */
> +int
> +rte_mbuf_register_platform_mempool_ops(const char *ops_name);
> +
> +/**
> + * Get registered platform supported pool ops name for mbuf
> + *
> + * @return
> + *   returns platform pool ops name.
> + */
> +const char*

I'm surprised that checkpatch does not complain about the missing space :)


> +rte_mbuf_platform_mempool_ops(void);
> +
> +/**
>   * Get the data room size of mbufs stored in a pktmbuf_pool
>   *
>   * The data room size is the amount of data that can be stored in a
> diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
> index 6e2ea84..b8e258f 100644
> --- a/lib/librte_mbuf/rte_mbuf_version.map
> +++ b/lib/librte_mbuf/rte_mbuf_version.map
> @@ -35,3 +35,11 @@ DPDK_16.11 {
>  	rte_get_tx_ol_flag_list;
>  
>  } DPDK_2.1;
> +
> +DPDK_18.02 {
> +	global:
> +
> +	rte_mbuf_platform_mempool_ops;
> +	rte_mbuf_register_platform_mempool_ops;
> +
> +} DPDK_16.11;
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support
  2018-01-16 15:01     ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Olivier Matz
@ 2018-01-18 11:47       ` Hemant Agrawal
  2018-01-18 13:42         ` Olivier Matz
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 11:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, jerin.jacob, santosh.shukla

On 1/16/2018 8:31 PM, Olivier Matz wrote:
> On Mon, Jan 15, 2018 at 11:41:09AM +0530, Hemant Agrawal wrote:
>> W.r.t the multiple discussions in the past about the ability to
>> dynamically detect the HW mempool support. [1],[2] & [3]
>>
>> This patchset helps in removing the current static mempool selection
>> model and provides a flexible model to select the pktmbuf mempool
>> in more dynamic way.
>>
>> 1) This patchset updates the hw mempool on the basis of device probe()),
>>    thus avoiding the need to specify the hw mempool in config file and
>>    focing different binaries for diffirent config architectures.
>> 2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
>>    which can overridden the scheme(1)
>> 3) A new best mempool ops selection logic.
>> 4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
>>    name as an argument as well.
>>
>> *Limitations and open points*
>>
>> It was suggested to add all APIs in librte_mbuf, currently internal_config
>> is storing the mempool_ops names. So internal_config is exported in this
>> patchset. An alternate would be to keep these APIs in eal only and access
>> them indirectly from librte_mbuf.
>
> Instead of storing the mempool_ops name in internal config, can't it be
> stored inside librte_mbuf? The eal code can call
> rte_mbuf_set_user_mempool_ops(name) while parsing the arguments.

I doubt that eal can call mbuf APIs. It will be a issue in shared build?

>
> It has to be done carefully so that it works with secondary processes.
>
>
>> Moreover, this logic can be further extended with addition for following
>> patch, which is still under discussion:
>>
>> The ethdev PMD capability exposed through existing
>> rte_eth_dev_pool_ops_supported() to select the update the mempool ops with
>> some "weight" based algorithm like:
>> http://dpdk.org/dev/patchwork/patch/32245/
>>
>> -----
>> [1]Multiple Pktmbuf mempool support
>> http://dpdk.org/ml/archives/dev/2017-September/076531.html
>> [2]Allow application set mempool handle
>> http://dpdk.org/ml/archives/dev/2017-June/067022.html
>> Other discussions
>> [3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
>> ------
>> Changes in v2:
>> 1. Changed the active mempool to platform mempool
>> 2. Moved all the relavant APIs to librte_mbuf
>> 3. Added pktmbuf_create_pool_specific wrapper in this patch series.
>>
>> Hemant Agrawal (5):
>>   eal: prefix mbuf pool ops name with user defined
>>   eal: add platform mempool ops name in internal config
>>   mbuf: support register mempool Hw ops name APIs
>>   mbuf: pktmbuf pool create helper for specific mempool ops
>>   mbuf: add user command line config mempools ops API
>>
>>  doc/guides/rel_notes/deprecation.rst       |  7 +++
>>  lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
>>  lib/librte_eal/common/eal_common_options.c |  3 +-
>>  lib/librte_eal/common/eal_internal_cfg.h   |  5 ++-
>>  lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
>>  lib/librte_eal/rte_eal_version.map         |  1 +
>>  lib/librte_mbuf/Makefile                   |  1 +
>>  lib/librte_mbuf/rte_mbuf.c                 | 67 ++++++++++++++++++++++++---
>>  lib/librte_mbuf/rte_mbuf.h                 | 72 ++++++++++++++++++++++++++++++
>
> I think the code to manage the user/platform mempool ops could
> go in a separate file. What about rte_mbuf_pool_ops.[ch] ?
>

Good suggestion.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 0/7] Dynamic HW Mempool Detection Support
  2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
                       ` (5 preceding siblings ...)
  2018-01-16 15:01     ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Olivier Matz
@ 2018-01-18 13:26     ` Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                         ` (7 more replies)
  6 siblings, 8 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way.

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Discussion points*

1. The command line parsing is done in EAL. So it is better to keep
the user defined mempool in internal_config only. APIs are provided
to access them from EAL.

2. Platform OPS name is to be registered by the respentive HW. So it
is the responsibility of HW to take care of not registering it from
secondary process.

3. This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
------
Changes in v3:
1. Moving the new mbuf APIs to rte_mbuf_pool_ops.h
2. Taking care of comments from Jerin and Olivier
3. Adding memory for platform mempools ops in librte_mbuf

Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf
3. Added pktmbuf_create_pool_specific wrapper in this patch series.


Hemant Agrawal (6):
  eal: prefix mbuf pool ops name with user defined
  eal: add API to set user default mbuf mempool ops
  mbuf: add pool ops name selection API helpers
  mbuf: pktmbuf pool create helper for specific mempool ops
  dpaa2: register dpaa2 as platform HW mempool on runtime
  dpaa: register dpaa as platform HW mempool on runtime

Pavan Nikhilesh (1):
  app/testpmd: set preferred mempool as default pktpool

 app/test-pmd/testpmd.c                     |  3 ++
 config/defconfig_arm64-dpaa-linuxapp-gcc   |  1 -
 config/defconfig_arm64-dpaa2-linuxapp-gcc  |  1 -
 drivers/bus/dpaa/dpaa_bus.c                |  2 +
 drivers/bus/dpaa/rte_dpaa_bus.h            |  2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c   |  3 ++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h    |  2 +
 drivers/mempool/dpaa/dpaa_mempool.c        |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c   |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c            | 10 +++-
 lib/librte_eal/common/eal_common_options.c |  2 +-
 lib/librte_eal/common/eal_internal_cfg.h   |  3 +-
 lib/librte_eal/common/include/rte_eal.h    |  9 ++++
 lib/librte_eal/linuxapp/eal/eal.c          | 10 +++-
 lib/librte_eal/rte_eal_version.map         |  1 +
 lib/librte_mbuf/Makefile                   |  4 +-
 lib/librte_mbuf/rte_mbuf.c                 | 24 ++++++---
 lib/librte_mbuf/rte_mbuf.h                 | 42 +++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.c        | 68 +++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h        | 87 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       | 11 ++++
 21 files changed, 271 insertions(+), 18 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-19 10:01         ` Olivier Matz
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops Hemant Agrawal
                         ` (6 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

This patch also change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c            | 4 ++--
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_eal/common/eal_internal_cfg.h   | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c          | 4 ++--
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 04cbd81..c602d02 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-19 10:01         ` Olivier Matz
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
                         ` (5 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

Add new API to set the user defined mbuf mempool ops name
i.e. set the provided ops name to `internal_config.mbuf_pool_ops_name`.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c         | 6 ++++++
 lib/librte_eal/common/include/rte_eal.h | 9 +++++++++
 lib/librte_eal/linuxapp/eal/eal.c       | 6 ++++++
 lib/librte_eal/rte_eal_version.map      | 1 +
 4 files changed, 22 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index c602d02..64f010a 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -117,6 +117,12 @@ rte_eal_mbuf_default_mempool_ops(void)
 	return internal_config.user_mbuf_pool_ops_name;
 }
 
+void
+rte_eal_set_mbuf_user_mempool_ops(const char *ops_name)
+{
+	internal_config.user_mbuf_pool_ops_name = ops_name;
+}
+
 /* Return a pointer to the configuration structure */
 struct rte_config *
 rte_eal_get_configuration(void)
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 2aba2c8..7645b34 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -307,6 +307,15 @@ enum rte_iova_mode rte_eal_iova_mode(void);
 const char *
 rte_eal_mbuf_default_mempool_ops(void);
 
+/**
+ * Set user pool ops name for mbuf
+ *
+ * @param ops_name
+ *   mempool ops name that is to be set as user defined.
+ */
+void
+rte_eal_set_mbuf_user_mempool_ops(const char *ops_name);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e8c7100..46b2bb3 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -127,6 +127,12 @@ rte_eal_mbuf_default_mempool_ops(void)
 	return internal_config.user_mbuf_pool_ops_name;
 }
 
+void
+rte_eal_set_mbuf_user_mempool_ops(const char *ops_name)
+{
+	internal_config.user_mbuf_pool_ops_name = ops_name;
+}
+
 /* Return a pointer to the configuration structure */
 struct rte_config *
 rte_eal_get_configuration(void)
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 7088b72..3529885 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -203,6 +203,7 @@ DPDK_17.11 {
 DPDK_18.02 {
 	global:
 
+	rte_eal_set_mbuf_user_mempool_ops;
 	rte_hypervisor_get;
 	rte_hypervisor_get_name;
 	rte_vfio_clear_group;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-19 10:01         ` Olivier Matz
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                         ` (4 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add support for various mempool ops config helper APIs.

1.User defined mempool ops
2.Platform detected HW mempool ops (active).
3.Best selection of mempool ops by looking into user defined,
  platform registered and compile time configured.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/Makefile             |  4 +-
 lib/librte_mbuf/rte_mbuf.c           |  5 +--
 lib/librte_mbuf/rte_mbuf_pool_ops.c  | 68 ++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h  | 87 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map | 11 +++++
 5 files changed, 170 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..e2e3ec6 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -14,9 +14,9 @@ EXPORT_MAP := rte_mbuf_version.map
 LIBABIVER := 3
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h rte_mbuf_pool_ops.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..0c4d374 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -54,6 +54,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include <rte_errno.h>
@@ -176,9 +177,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c
new file mode 100644
index 0000000..8e3a053
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <string.h>
+#include <rte_eal.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+#include <rte_malloc.h>
+
+static char *plat_mbuf_pool_ops_name;
+
+int
+rte_mbuf_register_platform_mempool_ops(const char *ops_name)
+{
+	if (plat_mbuf_pool_ops_name == NULL) {
+		plat_mbuf_pool_ops_name =
+			rte_malloc(NULL, RTE_MEMPOOL_OPS_NAMESIZE, 0);
+		if (plat_mbuf_pool_ops_name == NULL)
+			return -ENOMEM;
+		strcpy((char *)plat_mbuf_pool_ops_name, ops_name);
+		return 0;
+	} else if (strcmp(plat_mbuf_pool_ops_name, ops_name) == 0) {
+		return 0;
+	}
+
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		plat_mbuf_pool_ops_name);
+	return -EEXIST;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	return (const char *)plat_mbuf_pool_ops_name;
+}
+
+void
+rte_mbuf_set_user_mempool_ops(const char *ops_name)
+{
+	rte_eal_set_mbuf_user_mempool_ops(ops_name);
+}
+
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	return rte_eal_mbuf_default_mempool_ops();
+}
+
+/* Return mbuf pool ops name */
+const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_mbuf_user_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
new file mode 100644
index 0000000..8f6db54
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _RTE_MBUF_POOL_OPS_H_
+#define _RTE_MBUF_POOL_OPS_H_
+
+/**
+ * @file
+ * RTE Mbuf Pool Ops
+ *
+ * These APIs are for configuring the mbuf pool ops names to be largely used by
+ * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
+ * the best mempool ops available.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Register the platform supported pktmbuf HW mempool ops name
+ *
+ * This function allow the HW to register the actively supported HW mempool
+ * ops_name. Only one HW mempool ops can be registered at any point of time.
+ *
+ * @param pool ops name
+ * @return
+ *   - 0: Success
+ *   - -EEXIST: platform mempool is already registered.
+ *   - -ENOMEM: no mempory to save ops name.
+ */
+int
+rte_mbuf_register_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Register the user preferred pktmbuf mempool ops name
+ *
+ * This function can be used by the user to configure user preferred
+ * mempool ops name.
+ *
+ * @param pool ops name
+ */
+void
+rte_mbuf_set_user_mempool_ops(const char *ops_name);
+
+/**
+ * Get the best mempool ops name for pktmbuf.
+ *
+ * This function is used to determine the best options for mempool ops for
+ * pktmbuf allocations. Following are the priority order:
+ * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
+ * This function is also used by the rte_pktmbuf_pool_create to get the best
+ * mempool ops name.
+ *
+ * @param pool ops name
+ */
+const char *
+rte_mbuf_best_mempool_ops(void);
+
+/**
+ * Get registered platform supported pool ops name for mbuf
+ *
+ * This function returns the platform supported mempool ops name.
+ *
+ * @return
+ *   returns platform pool ops name.
+ */
+const char *
+rte_mbuf_platform_mempool_ops(void);
+
+/**
+ * Get user preferred pool ops name for mbuf
+ *
+ * This function returns the user configured mempool ops name.
+ *
+ * @return
+ *   returns user pool ops name.
+ */
+const char *
+rte_mbuf_user_mempool_ops(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MBUF_POOL_OPS_H_ */
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..3d60046 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,14 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+DPDK_18.02 {
+	global:
+
+	rte_mbuf_best_mempool_ops;
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_register_platform_mempool_ops;
+	rte_mbuf_set_user_mempool_ops;
+	rte_mbuf_user_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
                         ` (2 preceding siblings ...)
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
                         ` (3 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/rte_mbuf.c | 23 +++++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0c4d374..a256b42 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
-/* helper to create a mbuf pool */
+/* Helper to create a mbuf pool with given mempool ops name*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -177,7 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -199,6 +200,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a827e6e..4fee7e9 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1089,6 +1089,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with a given mempool ops name
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
                         ` (3 preceding siblings ...)
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-19 10:01         ` Olivier Matz
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 6/7] dpaa2: register dpaa2 as platform HW mempool on runtime Hemant Agrawal
                         ` (2 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Set the mempool preferred by the ethernet devices as default mbuf
mempool before creating the pktpool.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..34e07c1 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -38,6 +38,7 @@
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
 #include <rte_ether.h>
@@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
 	} else {
 		/* wrapper to rte_mempool_create() */
+		RTE_LOG(INFO, USER1, "preferred mempool ops %s selected\n",
+				rte_mbuf_best_mempool_ops());
 		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
 			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 6/7] dpaa2: register dpaa2 as platform HW mempool on runtime
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
                         ` (4 preceding siblings ...)
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 7/7] dpaa: register dpaa " Hemant Agrawal
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Detect if the DPAA2 mempool objects are present and register
it as platform default hw mempool

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 3 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index cd3396b..c7d891c 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -26,7 +26,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index ffad0f5..70f8470 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -20,6 +20,7 @@
 #include <rte_kvargs.h>
 #include <rte_dev.h>
 #include <rte_ethdev.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
@@ -74,6 +75,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	rte_mbuf_register_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME);
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 2e79399..9b1afe8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -44,6 +44,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 51770d4..d15347b 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -354,7 +354,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v3 7/7] dpaa: register dpaa as platform HW mempool on runtime
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
                         ` (5 preceding siblings ...)
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 6/7] dpaa2: register dpaa2 as platform HW mempool on runtime Hemant Agrawal
@ 2018-01-18 13:26       ` Hemant Agrawal
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-18 13:26 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc | 1 -
 drivers/bus/dpaa/dpaa_bus.c              | 2 ++
 drivers/bus/dpaa/rte_dpaa_bus.h          | 2 ++
 drivers/mempool/dpaa/dpaa_mempool.c      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index 5f882ca..ba1a1bd 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -25,7 +25,6 @@ CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n
 
 # NXP DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa"
 
 # Compile software NXP DPAA PMD
 CONFIG_RTE_LIBRTE_DPAA_PMD=y
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 329a125..4cec726 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -31,6 +31,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_bus.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
@@ -467,6 +468,7 @@ rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+	rte_mbuf_register_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
 
 	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
 	if (svr_file) {
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index d9ade83..280443d 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -17,6 +17,8 @@
 
 #define FSL_DPAA_BUS_NAME	"FSL_DPAA_BUS"
 
+#define DPAA_MEMPOOL_OPS_NAME	"dpaa"
+
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index ffb81c2..0e8159a 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -247,7 +247,7 @@ dpaa_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
-	.name = "dpaa",
+	.name = DPAA_MEMPOOL_OPS_NAME,
 	.alloc = dpaa_mbuf_create_pool,
 	.free = dpaa_mbuf_free_pool,
 	.enqueue = dpaa_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support
  2018-01-18 11:47       ` Hemant Agrawal
@ 2018-01-18 13:42         ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-18 13:42 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

Hi Hemant,

On Thu, Jan 18, 2018 at 05:17:17PM +0530, Hemant Agrawal wrote:
> On 1/16/2018 8:31 PM, Olivier Matz wrote:
> > On Mon, Jan 15, 2018 at 11:41:09AM +0530, Hemant Agrawal wrote:
> > > W.r.t the multiple discussions in the past about the ability to
> > > dynamically detect the HW mempool support. [1],[2] & [3]
> > > 
> > > This patchset helps in removing the current static mempool selection
> > > model and provides a flexible model to select the pktmbuf mempool
> > > in more dynamic way.
> > > 
> > > 1) This patchset updates the hw mempool on the basis of device probe()),
> > >    thus avoiding the need to specify the hw mempool in config file and
> > >    focing different binaries for diffirent config architectures.
> > > 2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
> > >    which can overridden the scheme(1)
> > > 3) A new best mempool ops selection logic.
> > > 4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
> > >    name as an argument as well.
> > > 
> > > *Limitations and open points*
> > > 
> > > It was suggested to add all APIs in librte_mbuf, currently internal_config
> > > is storing the mempool_ops names. So internal_config is exported in this
> > > patchset. An alternate would be to keep these APIs in eal only and access
> > > them indirectly from librte_mbuf.
> > 
> > Instead of storing the mempool_ops name in internal config, can't it be
> > stored inside librte_mbuf? The eal code can call
> > rte_mbuf_set_user_mempool_ops(name) while parsing the arguments.
> 
> I doubt that eal can call mbuf APIs. It will be a issue in shared build?

You are right.

The proper way is maybe to keep the parsing in eal, and at librte_mbuf
initialization, query the eal library to get the user pool if any.
After that, all will be managed inside librte_mbuf. So the eal lib will
only do the argument parsing.

This is maybe what you already did in the v3 you just submitted, I'll
manage to have a look at it today.

Thanks,
Olivier

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-19 10:01         ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 10:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Thu, Jan 18, 2018 at 06:56:26PM +0530, Hemant Agrawal wrote:
> This patch prefix the mbuf pool ops name with "user" to indicate
> that it is user defined.
> 
> This patch also change the logic to maintain the value of
> user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.
> 
> The pktmbuf_create_pool is updated to reflect the same.

The patch itself looks good to me, but I think it deserves to be split
in 2 patches.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops Hemant Agrawal
@ 2018-01-19 10:01         ` Olivier Matz
  2018-01-19 12:31           ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 10:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla, Pavan Nikhilesh

On Thu, Jan 18, 2018 at 06:56:27PM +0530, Hemant Agrawal wrote:
> Add new API to set the user defined mbuf mempool ops name
> i.e. set the provided ops name to `internal_config.mbuf_pool_ops_name`.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal.c         | 6 ++++++
>  lib/librte_eal/common/include/rte_eal.h | 9 +++++++++
>  lib/librte_eal/linuxapp/eal/eal.c       | 6 ++++++
>  lib/librte_eal/rte_eal_version.map      | 1 +
>  4 files changed, 22 insertions(+)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index c602d02..64f010a 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -117,6 +117,12 @@ rte_eal_mbuf_default_mempool_ops(void)
>  	return internal_config.user_mbuf_pool_ops_name;
>  }
>  
> +void
> +rte_eal_set_mbuf_user_mempool_ops(const char *ops_name)
> +{
> +	internal_config.user_mbuf_pool_ops_name = ops_name;
> +}
> +

I think we should only have the "set" API in mbuf lib.

What do you think about what I suggested in
http://dpdk.org/ml/archives/dev/2018-January/087419.html ?

"""
The proper way is maybe to keep the parsing in eal, and at librte_mbuf
initialization, query the eal library to get the user pool if any.
After that, all will be managed inside librte_mbuf. So the eal lib will
only do the argument parsing.
"""

In that case, this patch could be dropped. Please refer to my comment
in patch 3 to see what other modifications would be needed.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-19 10:01         ` Olivier Matz
  2018-01-19 12:41           ` Hemant Agrawal
  0 siblings, 1 reply; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 10:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Thu, Jan 18, 2018 at 06:56:28PM +0530, Hemant Agrawal wrote:
> This patch add support for various mempool ops config helper APIs.
> 
> 1.User defined mempool ops
> 2.Platform detected HW mempool ops (active).
> 3.Best selection of mempool ops by looking into user defined,
>   platform registered and compile time configured.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---

...

> --- /dev/null
> +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
> @@ -0,0 +1,68 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2018 NXP
> + */
> +
> +#include <string.h>
> +#include <rte_eal.h>
> +#include <rte_mbuf.h>
> +#include <rte_errno.h>
> +#include <rte_mbuf_pool_ops.h>
> +#include <rte_malloc.h>
> +
> +static char *plat_mbuf_pool_ops_name;

I have some doubts about secondary processes.

Maybe it's ok if the loaded driver and eal arguments are exactly the
same in the secondary process. It would be safer to use a named memzone
for that.

It would be even safer to not use secondary processes ;)


> +
> +int
> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> +{

We have "register" for platform and "set" for user.
I think "set" should be used everywhere.

> +	if (plat_mbuf_pool_ops_name == NULL) {
> +		plat_mbuf_pool_ops_name =
> +			rte_malloc(NULL, RTE_MEMPOOL_OPS_NAMESIZE, 0);
> +		if (plat_mbuf_pool_ops_name == NULL)
> +			return -ENOMEM;
> +		strcpy((char *)plat_mbuf_pool_ops_name, ops_name);

If strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE, this may lead to
bad behavior.

I suggest to simply do a strdup() instead.


> +		return 0;
> +	} else if (strcmp(plat_mbuf_pool_ops_name, ops_name) == 0) {
> +		return 0;
> +	}
> +
> +	RTE_LOG(ERR, MBUF,
> +		"%s is already registered as platform mbuf pool ops\n",
> +		plat_mbuf_pool_ops_name);

So, this log means that a we should try to never have 2 drivers registering
different platform drivers on the same machine, right?

So this API is kind of reserved for network processors and should not be
used in usual PCI PMDs?


> +	return -EEXIST;
> +}
> +
> +const char *
> +rte_mbuf_platform_mempool_ops(void)
> +{
> +	return (const char *)plat_mbuf_pool_ops_name;

cast is not required

> +}
> +
> +void
> +rte_mbuf_set_user_mempool_ops(const char *ops_name)
> +{
> +	rte_eal_set_mbuf_user_mempool_ops(ops_name);
> +}

Instead of calling the EAL API, we can set a static variable as
for platform ops.

> +
> +const char *
> +rte_mbuf_user_mempool_ops(void)
> +{
> +	return rte_eal_mbuf_default_mempool_ops();
> +}

And here, I suggest instead:

	rte_mbuf_user_mempool_ops(void)
	{
		if (user_mbuf_pool_ops_name != NULL)
			return user_mbuf_pool_ops_name;
		return rte_eal_mbuf_default_mempool_ops();
	}

i.e. rte_eal_mbuf_default_mempool_ops() remains the ops passed as
command line arguments.


> +
> +/* Return mbuf pool ops name */
> +const char *
> +rte_mbuf_best_mempool_ops(void)
> +{
> +	/* User defined mempool ops takes the priority */
> +	const char *best_ops = rte_mbuf_user_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Next choice is platform configured mempool ops */
> +	best_ops = rte_mbuf_platform_mempool_ops();
> +	if (best_ops)
> +		return best_ops;
> +
> +	/* Last choice is to use the compile time config pool */
> +	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
> +}

I like this function, this is much clearer than what we have today :)

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-19 10:01         ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 10:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla, Pavan Nikhilesh

On Thu, Jan 18, 2018 at 06:56:30PM +0530, Hemant Agrawal wrote:
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 
> Set the mempool preferred by the ethernet devices as default mbuf
> mempool before creating the pktpool.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  app/test-pmd/testpmd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 5dc8cca..34e07c1 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -38,6 +38,7 @@
>  #include <rte_mempool.h>
>  #include <rte_malloc.h>
>  #include <rte_mbuf.h>
> +#include <rte_mbuf_pool_ops.h>
>  #include <rte_interrupts.h>
>  #include <rte_pci.h>
>  #include <rte_ether.h>
> @@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
>  		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
>  	} else {
>  		/* wrapper to rte_mempool_create() */
> +		RTE_LOG(INFO, USER1, "preferred mempool ops %s selected\n",
> +				rte_mbuf_best_mempool_ops());

Since 285fd1019333 ("app/testpmd: register a specific log type")
we don't use USER1 in testpmd.



>  		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
>  			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
>  	}
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops
  2018-01-19 10:01         ` Olivier Matz
@ 2018-01-19 12:31           ` Hemant Agrawal
  2018-01-19 12:43             ` Olivier Matz
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 12:31 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, jerin.jacob, santosh.shukla, Pavan Nikhilesh

Hi Olivier,

On 1/19/2018 3:31 PM, Olivier Matz wrote:
> On Thu, Jan 18, 2018 at 06:56:27PM +0530, Hemant Agrawal wrote:
>> Add new API to set the user defined mbuf mempool ops name
>> i.e. set the provided ops name to `internal_config.mbuf_pool_ops_name`.
>>
>> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>  lib/librte_eal/bsdapp/eal/eal.c         | 6 ++++++
>>  lib/librte_eal/common/include/rte_eal.h | 9 +++++++++
>>  lib/librte_eal/linuxapp/eal/eal.c       | 6 ++++++
>>  lib/librte_eal/rte_eal_version.map      | 1 +
>>  4 files changed, 22 insertions(+)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
>> index c602d02..64f010a 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal.c
>> @@ -117,6 +117,12 @@ rte_eal_mbuf_default_mempool_ops(void)
>>  	return internal_config.user_mbuf_pool_ops_name;
>>  }
>>
>> +void
>> +rte_eal_set_mbuf_user_mempool_ops(const char *ops_name)
>> +{
>> +	internal_config.user_mbuf_pool_ops_name = ops_name;
>> +}
>> +
>
> I think we should only have the "set" API in mbuf lib.
>
> What do you think about what I suggested in
> http://dpdk.org/ml/archives/dev/2018-January/087419.html ?
>
> """
> The proper way is maybe to keep the parsing in eal, and at librte_mbuf
> initialization, query the eal library to get the user pool if any.
> After that, all will be managed inside librte_mbuf. So the eal lib will
> only do the argument parsing.
> """
>

Will you please help me in understanding, how should I do it?

1. The is no standard librte_mbuf initialization routine. RTE_INIT will 
not work, as it will be executed before eal_init. dlopen is for shared 
lib only. Is there any other method?

2. If I call it on the very first call of rte_mbuf_user_mempool_ops_name 
or rte_mbuf_set_user_mempool_ops_name, I will be checking against NULL. 
It can be NULL always. So, no real meaning of maintaining it in 
librte_mbuf as well.
Yes, I can maintain a flag to know, If I have synced with eal parse 
before. But that is not sounding to me clean.


> In that case, this patch could be dropped. Please refer to my comment
> in patch 3 to see what other modifications would be needed.
>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers
  2018-01-19 10:01         ` Olivier Matz
@ 2018-01-19 12:41           ` Hemant Agrawal
  2018-01-19 13:10             ` Olivier Matz
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 12:41 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, jerin.jacob, santosh.shukla

Hi Olivier,

On 1/19/2018 3:31 PM, Olivier Matz wrote:
> On Thu, Jan 18, 2018 at 06:56:28PM +0530, Hemant Agrawal wrote:
>> This patch add support for various mempool ops config helper APIs.
>>
>> 1.User defined mempool ops
>> 2.Platform detected HW mempool ops (active).
>> 3.Best selection of mempool ops by looking into user defined,
>>   platform registered and compile time configured.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>
> ...
>
>> --- /dev/null
>> +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
>> @@ -0,0 +1,68 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright 2018 NXP
>> + */
>> +
>> +#include <string.h>
>> +#include <rte_eal.h>
>> +#include <rte_mbuf.h>
>> +#include <rte_errno.h>
>> +#include <rte_mbuf_pool_ops.h>
>> +#include <rte_malloc.h>
>> +
>> +static char *plat_mbuf_pool_ops_name;
>
> I have some doubts about secondary processes.
>
> Maybe it's ok if the loaded driver and eal arguments are exactly the
> same in the secondary process. It would be safer to use a named memzone
> for that.
>
Typically a secondary process should not set the platform mempool name.
I can also add a check to know if secondary process is trying to do it.

Yes. I can change it to a named memzone.


> It would be even safer to not use secondary processes ;)
>
>
>> +
>> +int
>> +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
>> +{
>
> We have "register" for platform and "set" for user.
> I think "set" should be used everywhere.
>
ok

>> +	if (plat_mbuf_pool_ops_name == NULL) {
>> +		plat_mbuf_pool_ops_name =
>> +			rte_malloc(NULL, RTE_MEMPOOL_OPS_NAMESIZE, 0);
>> +		if (plat_mbuf_pool_ops_name == NULL)
>> +			return -ENOMEM;
>> +		strcpy((char *)plat_mbuf_pool_ops_name, ops_name);
>
> If strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE, this may lead to
> bad behavior.
>
That should not happen, we can check that.

> I suggest to simply do a strdup() instead.

Well, strdup based string will not be readable/accessible from the 
secondary process?

>
>
>> +		return 0;
>> +	} else if (strcmp(plat_mbuf_pool_ops_name, ops_name) == 0) {
>> +		return 0;
>> +	}
>> +
>> +	RTE_LOG(ERR, MBUF,
>> +		"%s is already registered as platform mbuf pool ops\n",
>> +		plat_mbuf_pool_ops_name);
>
> So, this log means that a we should try to never have 2 drivers registering
> different platform drivers on the same machine, right?
>
> So this API is kind of reserved for network processors and should not be
> used in usual PCI PMDs?
>
No, PCI PMDs can also use it. But only one registration allowed for now.

As I mentioned in the cover letter:
~~~~~
This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/
~~~~~~

>
>> +	return -EEXIST;
>> +}
>> +
>> +const char *
>> +rte_mbuf_platform_mempool_ops(void)
>> +{
>> +	return (const char *)plat_mbuf_pool_ops_name;
>
> cast is not required
>
>> +}
>> +
>> +void
>> +rte_mbuf_set_user_mempool_ops(const char *ops_name)
>> +{
>> +	rte_eal_set_mbuf_user_mempool_ops(ops_name);
>> +}
>
> Instead of calling the EAL API, we can set a static variable as
> for platform ops.
>
>> +
>> +const char *
>> +rte_mbuf_user_mempool_ops(void)
>> +{
>> +	return rte_eal_mbuf_default_mempool_ops();
>> +}
>
> And here, I suggest instead:
>
> 	rte_mbuf_user_mempool_ops(void)
> 	{
> 		if (user_mbuf_pool_ops_name != NULL)
> 			return user_mbuf_pool_ops_name;
> 		return rte_eal_mbuf_default_mempool_ops();
> 	}
>
> i.e. rte_eal_mbuf_default_mempool_ops() remains the ops passed as
> command line arguments.
>
>
>> +
>> +/* Return mbuf pool ops name */
>> +const char *
>> +rte_mbuf_best_mempool_ops(void)
>> +{
>> +	/* User defined mempool ops takes the priority */
>> +	const char *best_ops = rte_mbuf_user_mempool_ops();
>> +	if (best_ops)
>> +		return best_ops;
>> +
>> +	/* Next choice is platform configured mempool ops */
>> +	best_ops = rte_mbuf_platform_mempool_ops();
>> +	if (best_ops)
>> +		return best_ops;
>> +
>> +	/* Last choice is to use the compile time config pool */
>> +	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
>> +}
>
> I like this function, this is much clearer than what we have today :)
>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops
  2018-01-19 12:31           ` Hemant Agrawal
@ 2018-01-19 12:43             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 12:43 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla, Pavan Nikhilesh

On Fri, Jan 19, 2018 at 06:01:55PM +0530, Hemant Agrawal wrote:
> Hi Olivier,
> 
> On 1/19/2018 3:31 PM, Olivier Matz wrote:
> > On Thu, Jan 18, 2018 at 06:56:27PM +0530, Hemant Agrawal wrote:
> > > Add new API to set the user defined mbuf mempool ops name
> > > i.e. set the provided ops name to `internal_config.mbuf_pool_ops_name`.
> > > 
> > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > ---
> > >  lib/librte_eal/bsdapp/eal/eal.c         | 6 ++++++
> > >  lib/librte_eal/common/include/rte_eal.h | 9 +++++++++
> > >  lib/librte_eal/linuxapp/eal/eal.c       | 6 ++++++
> > >  lib/librte_eal/rte_eal_version.map      | 1 +
> > >  4 files changed, 22 insertions(+)
> > > 
> > > diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> > > index c602d02..64f010a 100644
> > > --- a/lib/librte_eal/bsdapp/eal/eal.c
> > > +++ b/lib/librte_eal/bsdapp/eal/eal.c
> > > @@ -117,6 +117,12 @@ rte_eal_mbuf_default_mempool_ops(void)
> > >  	return internal_config.user_mbuf_pool_ops_name;
> > >  }
> > > 
> > > +void
> > > +rte_eal_set_mbuf_user_mempool_ops(const char *ops_name)
> > > +{
> > > +	internal_config.user_mbuf_pool_ops_name = ops_name;
> > > +}
> > > +
> > 
> > I think we should only have the "set" API in mbuf lib.
> > 
> > What do you think about what I suggested in
> > http://dpdk.org/ml/archives/dev/2018-January/087419.html ?
> > 
> > """
> > The proper way is maybe to keep the parsing in eal, and at librte_mbuf
> > initialization, query the eal library to get the user pool if any.
> > After that, all will be managed inside librte_mbuf. So the eal lib will
> > only do the argument parsing.
> > """
> > 
> 
> Will you please help me in understanding, how should I do it?
> 
> 1. The is no standard librte_mbuf initialization routine. RTE_INIT will not
> work, as it will be executed before eal_init. dlopen is for shared lib only.
> Is there any other method?
> 
> 2. If I call it on the very first call of rte_mbuf_user_mempool_ops_name or
> rte_mbuf_set_user_mempool_ops_name, I will be checking against NULL. It can
> be NULL always. So, no real meaning of maintaining it in librte_mbuf as
> well.
> Yes, I can maintain a flag to know, If I have synced with eal parse before.
> But that is not sounding to me clean.

My initial idea was to do it at init, but I came to the same conclusion
than yours, it is not possible.

Can you take a look to the comments of patch 3/7 and let me know if the
proposition fits your needs?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers
  2018-01-19 12:41           ` Hemant Agrawal
@ 2018-01-19 13:10             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-19 13:10 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

Hi Hemant,

On Fri, Jan 19, 2018 at 06:11:47PM +0530, Hemant Agrawal wrote:
> Hi Olivier,
> 
> On 1/19/2018 3:31 PM, Olivier Matz wrote:
> > On Thu, Jan 18, 2018 at 06:56:28PM +0530, Hemant Agrawal wrote:
> > > This patch add support for various mempool ops config helper APIs.
> > > 
> > > 1.User defined mempool ops
> > > 2.Platform detected HW mempool ops (active).
> > > 3.Best selection of mempool ops by looking into user defined,
> > >   platform registered and compile time configured.
> > > 
> > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > > ---
> > 
> > ...
> > 
> > > --- /dev/null
> > > +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
> > > @@ -0,0 +1,68 @@
> > > +/* SPDX-License-Identifier: BSD-3-Clause
> > > + * Copyright 2018 NXP
> > > + */
> > > +
> > > +#include <string.h>
> > > +#include <rte_eal.h>
> > > +#include <rte_mbuf.h>
> > > +#include <rte_errno.h>
> > > +#include <rte_mbuf_pool_ops.h>
> > > +#include <rte_malloc.h>
> > > +
> > > +static char *plat_mbuf_pool_ops_name;
> > 
> > I have some doubts about secondary processes.
> > 
> > Maybe it's ok if the loaded driver and eal arguments are exactly the
> > same in the secondary process. It would be safer to use a named memzone
> > for that.
> > 
> Typically a secondary process should not set the platform mempool name.
> I can also add a check to know if secondary process is trying to do it.
> 
> Yes. I can change it to a named memzone.

With a memzone, maybe there is even no need for a static variable.
Something like this?

set():
  mz = rte_memzone_lookup("mbuf_platform_pool_ops");
  if (mz == NULL) {
    mz = rte_memzone_reszerve("mbuf_platform_pool_ops", LEN);
    if (mz == NULL)
      return -rte_errno; /* << this even protects against a set() in a 2nd process */
  }
  if (strlen(name) >= LEN)
    return -ENAMETOOLONG;
  strncpy(mz->addr, name, LEN);


get():
  mz = rte_memzone_lookup("mbuf_platform_pool_ops");
  if (mz == NULL)
    return NULL;
  return mz->addr;


> 
> 
> > It would be even safer to not use secondary processes ;)
> > 
> > 
> > > +
> > > +int
> > > +rte_mbuf_register_platform_mempool_ops(const char *ops_name)
> > > +{
> > 
> > We have "register" for platform and "set" for user.
> > I think "set" should be used everywhere.
> > 
> ok
> 
> > > +	if (plat_mbuf_pool_ops_name == NULL) {
> > > +		plat_mbuf_pool_ops_name =
> > > +			rte_malloc(NULL, RTE_MEMPOOL_OPS_NAMESIZE, 0);
> > > +		if (plat_mbuf_pool_ops_name == NULL)
> > > +			return -ENOMEM;
> > > +		strcpy((char *)plat_mbuf_pool_ops_name, ops_name);
> > 
> > If strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE, this may lead to
> > bad behavior.
> > 
> That should not happen, we can check that.
> 
> > I suggest to simply do a strdup() instead.
> 
> Well, strdup based string will not be readable/accessible from the secondary
> process?

Correct.
something to check the length should be added though.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support
  2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
                         ` (6 preceding siblings ...)
  2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 7/7] dpaa: register dpaa " Hemant Agrawal
@ 2018-01-19 16:33       ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                           ` (7 more replies)
  7 siblings, 8 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way.

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Future Discussion points*

1. Platform OPS name is to be registered by the respentive HW. So it
is the responsibility of HW to take care of not registering it from
secondary process.

2. This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
------
Changes in v4:
1. Taking care of Olivier's comments
2. Changing the mempool ops name memory to named memzone 

Changes in v3:
1. Moving the new mbuf APIs to rte_mbuf_pool_ops.h
2. Taking care of comments from Jerin and Olivier
3. Adding memory for platform mempools ops in librte_mbuf

Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf
3. Added pktmbuf_create_pool_specific wrapper in this patch series.

Hemant Agrawal (6):
  eal: prefix mbuf pool ops name with user defined
  mbuf: maintain user and compile time mempool ops name
  mbuf: add pool ops name selection API helpers
  mbuf: pktmbuf pool create helper for specific mempool ops
  dpaa: register dpaa as platform HW mempool on runtime
  dpaa2: register dpaa2 as platform HW mempool on runtime

Pavan Nikhilesh (1):
  app/testpmd: set preferred mempool as default pktpool

 app/test-pmd/testpmd.c                     |   3 +
 config/defconfig_arm64-dpaa-linuxapp-gcc   |   1 -
 config/defconfig_arm64-dpaa2-linuxapp-gcc  |   1 -
 drivers/bus/dpaa/dpaa_bus.c                |   2 +
 drivers/bus/dpaa/rte_dpaa_bus.h            |   2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c   |   3 +
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h    |   2 +
 drivers/mempool/dpaa/dpaa_mempool.c        |   2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c   |   2 +-
 lib/librte_eal/bsdapp/eal/eal.c            |   4 +-
 lib/librte_eal/common/eal_common_options.c |   2 +-
 lib/librte_eal/common/eal_internal_cfg.h   |   3 +-
 lib/librte_eal/linuxapp/eal/eal.c          |   4 +-
 lib/librte_mbuf/Makefile                   |   4 +-
 lib/librte_mbuf/rte_mbuf.c                 |  24 +++++--
 lib/librte_mbuf/rte_mbuf.h                 |  42 ++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.c        | 100 +++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h        |  90 ++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       |  11 ++++
 19 files changed, 284 insertions(+), 18 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
                           ` (6 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c          | 4 ++--
 lib/librte_eal/common/eal_internal_cfg.h | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c        | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 04cbd81..c602d02 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
                           ` (5 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 3/7] mbuf: add pool ops name selection API helpers
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                           ` (4 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add support for various mempool ops config helper APIs.

1.User defined mempool ops
2.Platform detected HW mempool ops (active).
3.Best selection of mempool ops by looking into user defined,
  platform registered and compile time configured.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/Makefile             |   4 +-
 lib/librte_mbuf/rte_mbuf.c           |   5 +-
 lib/librte_mbuf/rte_mbuf_pool_ops.c  | 100 +++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h  |  90 +++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  11 ++++
 5 files changed, 205 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..e2e3ec6 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -14,9 +14,9 @@ EXPORT_MAP := rte_mbuf_version.map
 LIBABIVER := 3
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h rte_mbuf_pool_ops.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..0c4d374 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -54,6 +54,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include <rte_errno.h>
@@ -176,9 +177,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c
new file mode 100644
index 0000000..52c2a9c
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <string.h>
+#include <rte_eal.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+#include <rte_malloc.h>
+
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_platform_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+		memset(mz->addr, 0, mz->len);
+
+		strncpy(mz->addr, ops_name, strlen(ops_name));
+		return 0;
+	} else if (strcmp(mz->addr, ops_name) == 0) {
+		return 0;
+	}
+
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		(char *)mz->addr);
+	return -EEXIST;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL)
+		return NULL;
+	return mz->addr;
+}
+
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_user_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+		memset(mz->addr, 0, mz->len);
+	}
+
+	strncpy(mz->addr, ops_name, strlen(ops_name));
+	return 0;
+
+}
+
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL)
+		return rte_eal_mbuf_default_mempool_ops();
+	return mz->addr;
+}
+
+/* Return mbuf pool ops name */
+const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_mbuf_user_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
new file mode 100644
index 0000000..8559bed
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h
@@ -0,0 +1,90 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _RTE_MBUF_POOL_OPS_H_
+#define _RTE_MBUF_POOL_OPS_H_
+
+/**
+ * @file
+ * RTE Mbuf Pool Ops
+ *
+ * These APIs are for configuring the mbuf pool ops names to be largely used by
+ * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
+ * the best mempool ops available.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set the platform supported pktmbuf HW mempool ops name
+ *
+ * This function allow the HW to register the actively supported HW mempool
+ * ops_name. Only one HW mempool ops can be registered at any point of time.
+ *
+ * @param pool ops name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Get configured platform supported pktmbuf HW mempool ops name
+ *
+ * This function returns the platform supported mempool ops name.
+ *
+ * @return
+ *   returns platform pool ops name.
+ */
+const char *
+rte_mbuf_platform_mempool_ops(void);
+
+/**
+ * Set the user preferred pktmbuf mempool ops name
+ *
+ * This function can be used by the user to configure user preferred
+ * mempool ops name.
+ *
+ * @param pool ops name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name);
+
+/**
+ * Get user preferred pool ops name for mbuf
+ *
+ * This function returns the user configured mempool ops name.
+ *
+ * @return
+ *   returns user pool ops name.
+ */
+const char *
+rte_mbuf_user_mempool_ops(void);
+
+/**
+ * Get the best mempool ops name for pktmbuf.
+ *
+ * This function is used to determine the best options for mempool ops for
+ * pktmbuf allocations. Following are the priority order:
+ * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
+ * This function is also used by the rte_pktmbuf_pool_create to get the best
+ * mempool ops name.
+ *
+ * @param pool ops name
+ */
+const char *
+rte_mbuf_best_mempool_ops(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MBUF_POOL_OPS_H_ */
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..0028c08 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,14 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+DPDK_18.02 {
+	global:
+
+	rte_mbuf_best_mempool_ops;
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_set_platform_mempool_ops;
+	rte_mbuf_set_user_mempool_ops;
+	rte_mbuf_user_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                           ` (2 preceding siblings ...)
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
                           ` (3 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/rte_mbuf.c | 23 +++++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0c4d374..a256b42 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
-/* helper to create a mbuf pool */
+/* Helper to create a mbuf pool with given mempool ops name*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -177,7 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -199,6 +200,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a594e47..e25b030 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1103,6 +1103,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with a given mempool ops name
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                           ` (3 preceding siblings ...)
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
                           ` (2 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Set the mempool preferred by the ethernet devices as default mbuf
mempool before creating the pktpool.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..d8ac432 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -38,6 +38,7 @@
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
 #include <rte_ether.h>
@@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
 	} else {
 		/* wrapper to rte_mempool_create() */
+		TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
+				rte_mbuf_best_mempool_ops());
 		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
 			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 6/7] dpaa: register dpaa as platform HW mempool on runtime
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                           ` (4 preceding siblings ...)
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 7/7] dpaa2: register dpaa2 " Hemant Agrawal
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc | 1 -
 drivers/bus/dpaa/dpaa_bus.c              | 2 ++
 drivers/bus/dpaa/rte_dpaa_bus.h          | 2 ++
 drivers/mempool/dpaa/dpaa_mempool.c      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index 5f882ca..ba1a1bd 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -25,7 +25,6 @@ CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n
 
 # NXP DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa"
 
 # Compile software NXP DPAA PMD
 CONFIG_RTE_LIBRTE_DPAA_PMD=y
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 329a125..20e8af3 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -31,6 +31,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_bus.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
@@ -467,6 +468,7 @@ rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+	rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
 
 	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
 	if (svr_file) {
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index d9ade83..280443d 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -17,6 +17,8 @@
 
 #define FSL_DPAA_BUS_NAME	"FSL_DPAA_BUS"
 
+#define DPAA_MEMPOOL_OPS_NAME	"dpaa"
+
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index ddc4e47..dc4bcc9 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -290,7 +290,7 @@ dpaa_register_memory_area(const struct rte_mempool *mp,
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
-	.name = "dpaa",
+	.name = DPAA_MEMPOOL_OPS_NAME,
 	.alloc = dpaa_mbuf_create_pool,
 	.free = dpaa_mbuf_free_pool,
 	.enqueue = dpaa_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v4 7/7] dpaa2: register dpaa2 as platform HW mempool on runtime
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                           ` (5 preceding siblings ...)
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
@ 2018-01-19 16:33         ` Hemant Agrawal
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-19 16:33 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Detect if the DPAA2 mempool objects are present and register
it as platform default hw mempool

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 3 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index cd3396b..c7d891c 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -26,7 +26,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index ffad0f5..1dfee25 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -20,6 +20,7 @@
 #include <rte_kvargs.h>
 #include <rte_dev.h>
 #include <rte_ethdev.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
@@ -74,6 +75,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	rte_mbuf_set_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME);
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 2e79399..9b1afe8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -44,6 +44,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 51770d4..d15347b 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -354,7 +354,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support
  2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                           ` (6 preceding siblings ...)
  2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 7/7] dpaa2: register dpaa2 " Hemant Agrawal
@ 2018-01-20  6:15         ` Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                             ` (7 more replies)
  7 siblings, 8 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way.

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Future Discussion points*

1. Platform OPS name is to be registered by the respentive HW. So it
is the responsibility of HW to take care of not registering it from
secondary process.

2. This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
------
Changes in v5:
1. Fix the doxygen API issues
2. remove unnecessary memset.

Changes in v4:
1. Taking care of Olivier's comments
2. Changing the mempool ops name memory to named memzone 

Changes in v3:
1. Moving the new mbuf APIs to rte_mbuf_pool_ops.h
2. Taking care of comments from Jerin and Olivier
3. Adding memory for platform mempools ops in librte_mbuf

Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf
3. Added pktmbuf_create_pool_specific wrapper in this patch series.

Hemant Agrawal (6):
  eal: prefix mbuf pool ops name with user defined
  mbuf: maintain user and compile time mempool ops name
  mbuf: add pool ops name selection API helpers
  mbuf: pktmbuf pool create helper for specific mempool ops
  dpaa: register dpaa as platform HW mempool on runtime
  dpaa2: register dpaa2 as platform HW mempool on runtime

Pavan Nikhilesh (1):
  app/testpmd: set preferred mempool as default pktpool

 app/test-pmd/testpmd.c                     |  3 +
 config/defconfig_arm64-dpaa-linuxapp-gcc   |  1 -
 config/defconfig_arm64-dpaa2-linuxapp-gcc  |  1 -
 doc/api/doxy-api-index.md                  |  1 +
 drivers/bus/dpaa/dpaa_bus.c                |  2 +
 drivers/bus/dpaa/rte_dpaa_bus.h            |  2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c   |  3 +
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h    |  2 +
 drivers/mempool/dpaa/dpaa_mempool.c        |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c   |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
 lib/librte_eal/common/eal_common_options.c |  2 +-
 lib/librte_eal/common/eal_internal_cfg.h   |  3 +-
 lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
 lib/librte_mbuf/Makefile                   |  4 +-
 lib/librte_mbuf/rte_mbuf.c                 | 24 ++++++--
 lib/librte_mbuf/rte_mbuf.h                 | 42 +++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.c        | 96 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h        | 91 ++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       | 11 ++++
 20 files changed, 282 insertions(+), 18 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:23             ` Olivier Matz
  2018-01-22 13:24             ` Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
                             ` (6 subsequent siblings)
  7 siblings, 2 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c          | 4 ++--
 lib/librte_eal/common/eal_internal_cfg.h | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c        | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 04cbd81..c602d02 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:23             ` Olivier Matz
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
                             ` (5 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:23             ` Olivier Matz
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                             ` (4 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add support for various mempool ops config helper APIs.

1.User defined mempool ops
2.Platform detected HW mempool ops (active).
3.Best selection of mempool ops by looking into user defined,
  platform registered and compile time configured.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 doc/api/doxy-api-index.md            |  1 +
 lib/librte_mbuf/Makefile             |  4 +-
 lib/librte_mbuf/rte_mbuf.c           |  5 +-
 lib/librte_mbuf/rte_mbuf_pool_ops.c  | 96 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h  | 91 ++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map | 11 +++++
 6 files changed, 203 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 76d606f..8cbd92a 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -136,6 +136,7 @@ The public API headers are grouped by topics:
 
 - **containers**:
   [mbuf]               (@ref rte_mbuf.h),
+  [mbuf pool ops]      (@ref rte_mbuf_pool_ops.h)
   [ring]               (@ref rte_ring.h),
   [tailq]              (@ref rte_tailq.h),
   [bitmap]             (@ref rte_bitmap.h)
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..e2e3ec6 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -14,9 +14,9 @@ EXPORT_MAP := rte_mbuf_version.map
 LIBABIVER := 3
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h rte_mbuf_pool_ops.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..0c4d374 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -54,6 +54,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include <rte_errno.h>
@@ -176,9 +177,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c
new file mode 100644
index 0000000..9aa1541
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <string.h>
+#include <rte_eal.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_platform_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+		strncpy(mz->addr, ops_name, strlen(ops_name));
+		return 0;
+	} else if (strcmp(mz->addr, ops_name) == 0) {
+		return 0;
+	}
+
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		(char *)mz->addr);
+	return -EEXIST;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL)
+		return NULL;
+	return mz->addr;
+}
+
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_user_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+	}
+
+	strncpy(mz->addr, ops_name, strlen(ops_name));
+	return 0;
+
+}
+
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL)
+		return rte_eal_mbuf_default_mempool_ops();
+	return mz->addr;
+}
+
+/* Return mbuf pool ops name */
+const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_mbuf_user_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
new file mode 100644
index 0000000..b4a2d54
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h
@@ -0,0 +1,91 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _RTE_MBUF_POOL_OPS_H_
+#define _RTE_MBUF_POOL_OPS_H_
+
+/**
+ * @file
+ * RTE Mbuf Pool Ops
+ *
+ * These APIs are for configuring the mbuf pool ops names to be largely used by
+ * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
+ * the best mempool ops available.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set the platform supported pktmbuf HW mempool ops name
+ *
+ * This function allow the HW to register the actively supported HW mempool
+ * ops_name. Only one HW mempool ops can be registered at any point of time.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Get configured platform supported pktmbuf HW mempool ops name
+ *
+ * This function returns the platform supported mempool ops name.
+ *
+ * @return
+ *   returns platform pool ops name.
+ */
+const char *
+rte_mbuf_platform_mempool_ops(void);
+
+/**
+ * Set the user preferred pktmbuf mempool ops name
+ *
+ * This function can be used by the user to configure user preferred
+ * mempool ops name.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name);
+
+/**
+ * Get user preferred pool ops name for mbuf
+ *
+ * This function returns the user configured mempool ops name.
+ *
+ * @return
+ *   returns user pool ops name.
+ */
+const char *
+rte_mbuf_user_mempool_ops(void);
+
+/**
+ * Get the best mempool ops name for pktmbuf.
+ *
+ * This function is used to determine the best options for mempool ops for
+ * pktmbuf allocations. Following are the priority order:
+ * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
+ * This function is also used by the rte_pktmbuf_pool_create to get the best
+ * mempool ops name.
+ *
+ * @return
+ *   returns preferred mbuf pool ops name
+ */
+const char *
+rte_mbuf_best_mempool_ops(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MBUF_POOL_OPS_H_ */
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..0028c08 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,14 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+DPDK_18.02 {
+	global:
+
+	rte_mbuf_best_mempool_ops;
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_set_platform_mempool_ops;
+	rte_mbuf_set_user_mempool_ops;
+	rte_mbuf_user_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                             ` (2 preceding siblings ...)
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:24             ` Olivier Matz
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
                             ` (3 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mbuf/rte_mbuf.c | 23 +++++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0c4d374..a256b42 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
-/* helper to create a mbuf pool */
+/* Helper to create a mbuf pool with given mempool ops name*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -177,7 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -199,6 +200,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a594e47..e25b030 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1103,6 +1103,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with a given mempool ops name
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                             ` (3 preceding siblings ...)
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:25             ` Olivier Matz
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
                             ` (2 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Set the mempool preferred by the ethernet devices as default mbuf
mempool before creating the pktpool.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..d8ac432 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -38,6 +38,7 @@
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
 #include <rte_ether.h>
@@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
 	} else {
 		/* wrapper to rte_mempool_create() */
+		TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
+				rte_mbuf_best_mempool_ops());
 		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
 			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 6/7] dpaa: register dpaa as platform HW mempool on runtime
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                             ` (4 preceding siblings ...)
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 7/7] dpaa2: register dpaa2 " Hemant Agrawal
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc | 1 -
 drivers/bus/dpaa/dpaa_bus.c              | 2 ++
 drivers/bus/dpaa/rte_dpaa_bus.h          | 2 ++
 drivers/mempool/dpaa/dpaa_mempool.c      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index 5f882ca..ba1a1bd 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -25,7 +25,6 @@ CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n
 
 # NXP DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa"
 
 # Compile software NXP DPAA PMD
 CONFIG_RTE_LIBRTE_DPAA_PMD=y
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 329a125..20e8af3 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -31,6 +31,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_bus.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
@@ -467,6 +468,7 @@ rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+	rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
 
 	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
 	if (svr_file) {
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index d9ade83..280443d 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -17,6 +17,8 @@
 
 #define FSL_DPAA_BUS_NAME	"FSL_DPAA_BUS"
 
+#define DPAA_MEMPOOL_OPS_NAME	"dpaa"
+
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index ddc4e47..dc4bcc9 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -290,7 +290,7 @@ dpaa_register_memory_area(const struct rte_mempool *mp,
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
-	.name = "dpaa",
+	.name = DPAA_MEMPOOL_OPS_NAME,
 	.alloc = dpaa_mbuf_create_pool,
 	.free = dpaa_mbuf_free_pool,
 	.enqueue = dpaa_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v5 7/7] dpaa2: register dpaa2 as platform HW mempool on runtime
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                             ` (5 preceding siblings ...)
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
@ 2018-01-20  6:15           ` Hemant Agrawal
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-20  6:15 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Detect if the DPAA2 mempool objects are present and register
it as platform default hw mempool

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 3 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index cd3396b..c7d891c 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -26,7 +26,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index ffad0f5..1dfee25 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -20,6 +20,7 @@
 #include <rte_kvargs.h>
 #include <rte_dev.h>
 #include <rte_ethdev.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
@@ -74,6 +75,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	rte_mbuf_set_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME);
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 2e79399..9b1afe8 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -44,6 +44,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 51770d4..d15347b 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -354,7 +354,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-22 13:23             ` Olivier Matz
  2018-01-22 13:24             ` Hemant Agrawal
  1 sibling, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-22 13:23 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Sat, Jan 20, 2018 at 11:45:02AM +0530, Hemant Agrawal wrote:
> This patch prefix the mbuf pool ops name with "user" to indicate
> that it is user defined.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-22 13:23             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-22 13:23 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Sat, Jan 20, 2018 at 11:45:03AM +0530, Hemant Agrawal wrote:
> This patch change the logic to maintain the value of
> user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.
> 
> The pktmbuf_create_pool is updated to reflect the same.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-22 13:23             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-22 13:23 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Sat, Jan 20, 2018 at 11:45:04AM +0530, Hemant Agrawal wrote:
> This patch add support for various mempool ops config helper APIs.
> 
> 1.User defined mempool ops
> 2.Platform detected HW mempool ops (active).
> 3.Best selection of mempool ops by looking into user defined,
>   platform registered and compile time configured.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-22 13:23             ` Olivier Matz
@ 2018-01-22 13:24             ` Hemant Agrawal
  1 sibling, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:24 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

On 1/20/2018 11:45 AM, Hemant Agrawal wrote:
> This patch prefix the mbuf pool ops name with "user" to indicate
> that it is user defined.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>   lib/librte_eal/bsdapp/eal/eal.c          | 4 ++--
>   lib/librte_eal/common/eal_internal_cfg.h | 3 ++-
>   lib/librte_eal/linuxapp/eal/eal.c        | 4 ++--
>   3 files changed, 6 insertions(+), 5 deletions(-)
> 

There is a compilation issue with this patch.  I will send a v6. Just 
waiting comments if any?

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-22 13:24             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-22 13:24 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla

On Sat, Jan 20, 2018 at 11:45:05AM +0530, Hemant Agrawal wrote:
> Introduce a new helper for pktmbuf pool, which will allow
> the application to optionally specify the mempool ops name
> as well.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-22 13:25             ` Olivier Matz
  0 siblings, 0 replies; 112+ messages in thread
From: Olivier Matz @ 2018-01-22 13:25 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, santosh.shukla, Pavan Nikhilesh

On Sat, Jan 20, 2018 at 11:45:06AM +0530, Hemant Agrawal wrote:
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 
> Set the mempool preferred by the ethernet devices as default mbuf
> mempool before creating the pktpool.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support
  2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                             ` (6 preceding siblings ...)
  2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 7/7] dpaa2: register dpaa2 " Hemant Agrawal
@ 2018-01-22 13:51           ` Hemant Agrawal
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                               ` (7 more replies)
  7 siblings, 8 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way.

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Future Discussion points*

1. Platform OPS name is to be registered by the respentive HW. So it
is the responsibility of HW to take care of not registering it from
secondary process.

2. This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
------
Changes in v6:
1. Fix compilation issue for patch 1/7
2. Fix return value comment for patch 3/7

Changes in v5:
1. Fix the doxygen API issues
2. remove unnecessary memset.

Changes in v4:
1. Taking care of Olivier's comments
2. Changing the mempool ops name memory to named memzone 

Changes in v3:
1. Moving the new mbuf APIs to rte_mbuf_pool_ops.h
2. Taking care of comments from Jerin and Olivier
3. Adding memory for platform mempools ops in librte_mbuf

Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf
3. Added pktmbuf_create_pool_specific wrapper in this patch series.

Hemant Agrawal (6):
  eal: prefix mbuf pool ops name with user defined
  mbuf: maintain user and compile time mempool ops name
  mbuf: add pool ops name selection API helpers
  mbuf: pktmbuf pool create helper for specific mempool ops
  dpaa: register dpaa as platform HW mempool on runtime
  dpaa2: register dpaa2 as platform HW mempool on runtime

Pavan Nikhilesh (1):
  app/testpmd: set preferred mempool as default pktpool

 app/test-pmd/testpmd.c                     |  3 +
 config/defconfig_arm64-dpaa-linuxapp-gcc   |  1 -
 config/defconfig_arm64-dpaa2-linuxapp-gcc  |  1 -
 doc/api/doxy-api-index.md                  |  1 +
 drivers/bus/dpaa/dpaa_bus.c                |  2 +
 drivers/bus/dpaa/rte_dpaa_bus.h            |  2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c   |  3 +
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h    |  2 +
 drivers/mempool/dpaa/dpaa_mempool.c        |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c   |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
 lib/librte_eal/common/eal_common_options.c |  2 +-
 lib/librte_eal/common/eal_internal_cfg.h   |  3 +-
 lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
 lib/librte_mbuf/Makefile                   |  4 +-
 lib/librte_mbuf/rte_mbuf.c                 | 24 ++++++--
 lib/librte_mbuf/rte_mbuf.h                 | 42 +++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.c        | 96 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h        | 93 +++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       | 11 ++++
 20 files changed, 284 insertions(+), 18 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 14:43               ` santosh
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
                               ` (6 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_eal/bsdapp/eal/eal.c            | 4 ++--
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_eal/common/eal_internal_cfg.h   | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c          | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 04cbd81..c602d02 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..7a40414 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 14:47               ` santosh
  2018-01-25 22:02               ` Thomas Monjalon
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
                               ` (5 subsequent siblings)
  7 siblings, 2 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 7a40414..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->user_mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 14:49               ` santosh
  2018-01-25 22:01               ` Thomas Monjalon
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                               ` (4 subsequent siblings)
  7 siblings, 2 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add support for various mempool ops config helper APIs.

1.User defined mempool ops
2.Platform detected HW mempool ops (active).
3.Best selection of mempool ops by looking into user defined,
  platform registered and compile time configured.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 doc/api/doxy-api-index.md            |  1 +
 lib/librte_mbuf/Makefile             |  4 +-
 lib/librte_mbuf/rte_mbuf.c           |  5 +-
 lib/librte_mbuf/rte_mbuf_pool_ops.c  | 96 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h  | 93 ++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map | 11 +++++
 6 files changed, 205 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 76d606f..8cbd92a 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -136,6 +136,7 @@ The public API headers are grouped by topics:
 
 - **containers**:
   [mbuf]               (@ref rte_mbuf.h),
+  [mbuf pool ops]      (@ref rte_mbuf_pool_ops.h)
   [ring]               (@ref rte_ring.h),
   [tailq]              (@ref rte_tailq.h),
   [bitmap]             (@ref rte_bitmap.h)
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..e2e3ec6 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -14,9 +14,9 @@ EXPORT_MAP := rte_mbuf_version.map
 LIBABIVER := 3
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h rte_mbuf_pool_ops.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..0c4d374 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -54,6 +54,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include <rte_errno.h>
@@ -176,9 +177,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c
new file mode 100644
index 0000000..9aa1541
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <string.h>
+#include <rte_eal.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_platform_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+		strncpy(mz->addr, ops_name, strlen(ops_name));
+		return 0;
+	} else if (strcmp(mz->addr, ops_name) == 0) {
+		return 0;
+	}
+
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		(char *)mz->addr);
+	return -EEXIST;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL)
+		return NULL;
+	return mz->addr;
+}
+
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_user_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+	}
+
+	strncpy(mz->addr, ops_name, strlen(ops_name));
+	return 0;
+
+}
+
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL)
+		return rte_eal_mbuf_default_mempool_ops();
+	return mz->addr;
+}
+
+/* Return mbuf pool ops name */
+const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_mbuf_user_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
new file mode 100644
index 0000000..7fa1870
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _RTE_MBUF_POOL_OPS_H_
+#define _RTE_MBUF_POOL_OPS_H_
+
+/**
+ * @file
+ * RTE Mbuf Pool Ops
+ *
+ * These APIs are for configuring the mbuf pool ops names to be largely used by
+ * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
+ * the best mempool ops available.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set the platform supported pktmbuf HW mempool ops name
+ *
+ * This function allow the HW to register the actively supported HW mempool
+ * ops_name. Only one HW mempool ops can be registered at any point of time.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Get configured platform supported pktmbuf HW mempool ops name
+ *
+ * This function returns the platform supported mempool ops name.
+ *
+ * @return
+ *   - On success, platform pool ops name.
+ *   - On failure, NULL.
+ */
+const char *
+rte_mbuf_platform_mempool_ops(void);
+
+/**
+ * Set the user preferred pktmbuf mempool ops name
+ *
+ * This function can be used by the user to configure user preferred
+ * mempool ops name.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name);
+
+/**
+ * Get user preferred pool ops name for mbuf
+ *
+ * This function returns the user configured mempool ops name.
+ *
+ * @return
+ *   - On success, user pool ops name..
+ *   - On failure, NULL.
+ */
+const char *
+rte_mbuf_user_mempool_ops(void);
+
+/**
+ * Get the best mempool ops name for pktmbuf.
+ *
+ * This function is used to determine the best options for mempool ops for
+ * pktmbuf allocations. Following are the priority order:
+ * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
+ * This function is also used by the rte_pktmbuf_pool_create to get the best
+ * mempool ops name.
+ *
+ * @return
+ *   returns preferred mbuf pool ops name
+ */
+const char *
+rte_mbuf_best_mempool_ops(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MBUF_POOL_OPS_H_ */
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..0028c08 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,14 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+DPDK_18.02 {
+	global:
+
+	rte_mbuf_best_mempool_ops;
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_set_platform_mempool_ops;
+	rte_mbuf_set_user_mempool_ops;
+	rte_mbuf_user_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                               ` (2 preceding siblings ...)
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 14:51               ` santosh
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
                               ` (3 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_mbuf/rte_mbuf.c | 23 +++++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0c4d374..a256b42 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
-/* helper to create a mbuf pool */
+/* Helper to create a mbuf pool with given mempool ops name*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -177,7 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -199,6 +200,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a594e47..e25b030 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1103,6 +1103,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with a given mempool ops name
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                               ` (3 preceding siblings ...)
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 14:52               ` santosh
  2018-01-25 22:04               ` Thomas Monjalon
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
                               ` (2 subsequent siblings)
  7 siblings, 2 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Set the mempool preferred by the ethernet devices as default mbuf
mempool before creating the pktpool.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..d8ac432 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -38,6 +38,7 @@
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
 #include <rte_ether.h>
@@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
 	} else {
 		/* wrapper to rte_mempool_create() */
+		TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
+				rte_mbuf_best_mempool_ops());
 		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
 			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 6/7] dpaa: register dpaa as platform HW mempool on runtime
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                               ` (4 preceding siblings ...)
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 7/7] dpaa2: register dpaa2 " Hemant Agrawal
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc | 1 -
 drivers/bus/dpaa/dpaa_bus.c              | 2 ++
 drivers/bus/dpaa/rte_dpaa_bus.h          | 2 ++
 drivers/mempool/dpaa/dpaa_mempool.c      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index c2ca16a..ab9e67d 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -25,7 +25,6 @@ CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n
 
 # NXP DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa"
 
 # Compile software NXP DPAA PMD
 CONFIG_RTE_LIBRTE_DPAA_PMD=y
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ba33566..f5840de 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -31,6 +31,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_bus.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
@@ -469,6 +470,7 @@ rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+	rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
 
 	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
 	if (svr_file) {
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 6fa0c3d..d613660 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -17,6 +17,8 @@
 
 #define FSL_DPAA_BUS_NAME	"FSL_DPAA_BUS"
 
+#define DPAA_MEMPOOL_OPS_NAME	"dpaa"
+
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index ddc4e47..dc4bcc9 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -290,7 +290,7 @@ dpaa_register_memory_area(const struct rte_mempool *mp,
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
-	.name = "dpaa",
+	.name = DPAA_MEMPOOL_OPS_NAME,
 	.alloc = dpaa_mbuf_create_pool,
 	.free = dpaa_mbuf_free_pool,
 	.enqueue = dpaa_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v6 7/7] dpaa2: register dpaa2 as platform HW mempool on runtime
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                               ` (5 preceding siblings ...)
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
@ 2018-01-22 13:51             ` Hemant Agrawal
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-22 13:51 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Detect if the DPAA2 mempool objects are present and register
it as platform default hw mempool

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 3 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index d38d696..5d4437c 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -26,7 +26,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index 139249c..9081625 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -20,6 +20,7 @@
 #include <rte_kvargs.h>
 #include <rte_dev.h>
 #include <rte_ethdev_driver.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
@@ -74,6 +75,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	rte_mbuf_set_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME);
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 9436d37..d421dbf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -44,6 +44,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index afda2c2..2bd62e8 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -354,7 +354,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-22 14:43               ` santosh
  0 siblings, 0 replies; 112+ messages in thread
From: santosh @ 2018-01-22 14:43 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: jerin.jacob, olivier.matz


On Monday 22 January 2018 07:21 PM, Hemant Agrawal wrote:
> This patch prefix the mbuf pool ops name with "user" to indicate
> that it is user defined.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-22 14:47               ` santosh
  2018-01-25 22:02               ` Thomas Monjalon
  1 sibling, 0 replies; 112+ messages in thread
From: santosh @ 2018-01-22 14:47 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: jerin.jacob, olivier.matz


On Monday 22 January 2018 07:21 PM, Hemant Agrawal wrote:
> This patch change the logic to maintain the value of
> user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.
>
> The pktmbuf_create_pool is updated to reflect the same.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-22 14:49               ` santosh
  2018-01-25 22:01               ` Thomas Monjalon
  1 sibling, 0 replies; 112+ messages in thread
From: santosh @ 2018-01-22 14:49 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: jerin.jacob, olivier.matz


On Monday 22 January 2018 07:21 PM, Hemant Agrawal wrote:
> This patch add support for various mempool ops config helper APIs.
>
> 1.User defined mempool ops
> 2.Platform detected HW mempool ops (active).
> 3.Best selection of mempool ops by looking into user defined,
>   platform registered and compile time configured.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-22 14:51               ` santosh
  0 siblings, 0 replies; 112+ messages in thread
From: santosh @ 2018-01-22 14:51 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: jerin.jacob, olivier.matz


On Monday 22 January 2018 07:21 PM, Hemant Agrawal wrote:
> Introduce a new helper for pktmbuf pool, which will allow
> the application to optionally specify the mempool ops name
> as well.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
@ 2018-01-22 14:52               ` santosh
  2018-01-25 22:04               ` Thomas Monjalon
  1 sibling, 0 replies; 112+ messages in thread
From: santosh @ 2018-01-22 14:52 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: jerin.jacob, olivier.matz, Pavan Nikhilesh


On Monday 22 January 2018 07:21 PM, Hemant Agrawal wrote:
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>
> Set the mempool preferred by the ethernet devices as default mbuf
> mempool before creating the pktpool.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
  2018-01-22 14:49               ` santosh
@ 2018-01-25 22:01               ` Thomas Monjalon
  2018-01-26  5:10                 ` Hemant Agrawal
  1 sibling, 1 reply; 112+ messages in thread
From: Thomas Monjalon @ 2018-01-25 22:01 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, olivier.matz, santosh.shukla

22/01/2018 14:51, Hemant Agrawal:
> This patch add support for various mempool ops config helper APIs.
> 
> 1.User defined mempool ops
> 2.Platform detected HW mempool ops (active).
> 3.Best selection of mempool ops by looking into user defined,
>   platform registered and compile time configured.

The new API should be experimental.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
  2018-01-22 14:47               ` santosh
@ 2018-01-25 22:02               ` Thomas Monjalon
  2018-01-26  5:10                 ` Hemant Agrawal
  1 sibling, 1 reply; 112+ messages in thread
From: Thomas Monjalon @ 2018-01-25 22:02 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, olivier.matz, santosh.shukla

22/01/2018 14:51, Hemant Agrawal:
> This patch change the logic to maintain the value of
> user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.
> 
> The pktmbuf_create_pool is updated to reflect the same.

I cannot understand this text.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
  2018-01-22 14:52               ` santosh
@ 2018-01-25 22:04               ` Thomas Monjalon
  2018-01-26  5:11                 ` Hemant Agrawal
  1 sibling, 1 reply; 112+ messages in thread
From: Thomas Monjalon @ 2018-01-25 22:04 UTC (permalink / raw)
  To: Hemant Agrawal
  Cc: dev, jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

22/01/2018 14:51, Hemant Agrawal:
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 
> Set the mempool preferred by the ethernet devices as default mbuf
> mempool before creating the pktpool.

The patch is just adding a log.
Something is not consistent.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-25 22:02               ` Thomas Monjalon
@ 2018-01-26  5:10                 ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-26  5:10 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, jerin.jacob, olivier.matz, santosh.shukla

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> 
> 22/01/2018 14:51, Hemant Agrawal:
> > This patch change the logic to maintain the value of user defined and
> > compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.
> >
> > The pktmbuf_create_pool is updated to reflect the same.
> 
> I cannot understand this text.

[Hemant] I will rephrase it
Internel_config based mempool ops name is initialized with compile time default mempool ops. 
 In Original code the user configured command line mempool ops name overwrite it.

This patch avoid the overwriting and make changes in pktmbuf_create_pool to choose compile time, if user has not defined one.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers
  2018-01-25 22:01               ` Thomas Monjalon
@ 2018-01-26  5:10                 ` Hemant Agrawal
  0 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-26  5:10 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, jerin.jacob, olivier.matz, santosh.shukla



Hi Thomas,
> 
> 22/01/2018 14:51, Hemant Agrawal:
> > This patch add support for various mempool ops config helper APIs.
> >
> > 1.User defined mempool ops
> > 2.Platform detected HW mempool ops (active).
> > 3.Best selection of mempool ops by looking into user defined,
> >   platform registered and compile time configured.
> 
> The new API should be experimental.
[Hemant] 
OK

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-25 22:04               ` Thomas Monjalon
@ 2018-01-26  5:11                 ` Hemant Agrawal
  2018-01-26  7:43                   ` Thomas Monjalon
  0 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-26  5:11 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> 
> 22/01/2018 14:51, Hemant Agrawal:
> > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> >
> > Set the mempool preferred by the ethernet devices as default mbuf
> > mempool before creating the pktpool.
> 
> The patch is just adding a log.
> Something is not consistent.

[Hemant] 
Yes, this is intentional to know the chosen buffer pool name in testpmd logs.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool
  2018-01-26  5:11                 ` Hemant Agrawal
@ 2018-01-26  7:43                   ` Thomas Monjalon
  0 siblings, 0 replies; 112+ messages in thread
From: Thomas Monjalon @ 2018-01-26  7:43 UTC (permalink / raw)
  To: Hemant Agrawal
  Cc: dev, jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

26/01/2018 06:11, Hemant Agrawal:
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 
> > 22/01/2018 14:51, Hemant Agrawal:
> > > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > >
> > > Set the mempool preferred by the ethernet devices as default mbuf
> > > mempool before creating the pktpool.
> > 
> > The patch is just adding a log.
> > Something is not consistent.
> 
> [Hemant] 
> Yes, this is intentional to know the chosen buffer pool name in testpmd logs.

The title and the commit log suggest something else.
Please adjust them to the patch content.

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support
  2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                               ` (6 preceding siblings ...)
  2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 7/7] dpaa2: register dpaa2 " Hemant Agrawal
@ 2018-01-29  8:10             ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
                                 ` (7 more replies)
  7 siblings, 8 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

W.r.t the multiple discussions in the past about the ability to
dynamically detect the HW mempool support. [1],[2] & [3]

This patchset helps in removing the current static mempool selection
model and provides a flexible model to select the pktmbuf mempool
in more dynamic way.

1) This patchset updates the hw mempool on the basis of device probe()),
   thus avoiding the need to specify the hw mempool in config file and
   focing different binaries for diffirent config architectures.
2) Selection of mempool ops though --mbuf-pool-ops-name (cmd line arg)
   which can overridden the scheme(1)
3) A new best mempool ops selection logic.
4) A new wrapper for the pktmbuf_pool_create helper to take mempool ops
   name as an argument as well.

*Future Discussion points*

1. Platform OPS name is to be registered by the respentive HW. So it
is the responsibility of HW to take care of not registering it from
secondary process.

2. This logic can be further extended with addition for following
patch, which is still under discussion. The ethdev PMD capability exposed
through existing rte_eth_dev_pool_ops_supported() to select the update
the mempool ops with some "weight" based algorithm like:
http://dpdk.org/dev/patchwork/patch/32245/

[1]Multiple Pktmbuf mempool support
http://dpdk.org/ml/archives/dev/2017-September/076531.html
[2]Allow application set mempool handle
http://dpdk.org/ml/archives/dev/2017-June/067022.html
Other discussions
[3] http://dpdk.org/ml/archives/dev/2017-December/084775.html
------
Changes in v7:
1. new APIs as experimental as suggested by Thomas
2. fix patch commit messages. 

Changes in v6:
1. Fix compilation issue for patch 1/7
2. Fix return value comment for patch 3/7

Changes in v5:
1. Fix the doxygen API issues
2. remove unnecessary memset.

Changes in v4:
1. Taking care of Olivier's comments
2. Changing the mempool ops name memory to named memzone 

Changes in v3:
1. Moving the new mbuf APIs to rte_mbuf_pool_ops.h
2. Taking care of comments from Jerin and Olivier
3. Adding memory for platform mempools ops in librte_mbuf

Changes in v2:
1. Changed the active mempool to platform mempool
2. Moved all the relavant APIs to librte_mbuf
3. Added pktmbuf_create_pool_specific wrapper in this patch series.
Hemant Agrawal (6):
  eal: prefix mbuf pool ops name with user defined
  mbuf: maintain user and compile time mempool ops name
  mbuf: add pool ops name selection API helpers
  mbuf: pktmbuf pool create helper for specific mempool ops
  dpaa: register dpaa as platform HW mempool on runtime
  dpaa2: register dpaa2 as platform HW mempool on runtime

Pavan Nikhilesh (1):
  app/testpmd: add debug to print preferred mempool ops

 app/test-pmd/testpmd.c                     |  3 +
 config/defconfig_arm64-dpaa-linuxapp-gcc   |  1 -
 config/defconfig_arm64-dpaa2-linuxapp-gcc  |  1 -
 doc/api/doxy-api-index.md                  |  1 +
 drivers/bus/dpaa/dpaa_bus.c                |  2 +
 drivers/bus/dpaa/rte_dpaa_bus.h            |  2 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c   |  7 +++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h    |  2 +
 drivers/mempool/dpaa/dpaa_mempool.c        |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c   |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c            |  4 +-
 lib/librte_eal/common/eal_common_options.c |  2 +-
 lib/librte_eal/common/eal_internal_cfg.h   |  3 +-
 lib/librte_eal/linuxapp/eal/eal.c          |  4 +-
 lib/librte_mbuf/Makefile                   |  4 +-
 lib/librte_mbuf/rte_mbuf.c                 | 24 ++++++--
 lib/librte_mbuf/rte_mbuf.h                 | 42 +++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.c        | 96 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h        | 96 ++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map       | 12 ++++
 20 files changed, 292 insertions(+), 18 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 1/7] eal: prefix mbuf pool ops name with user defined
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
                                 ` (6 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 lib/librte_eal/bsdapp/eal/eal.c            | 4 ++--
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_eal/common/eal_internal_cfg.h   | 3 ++-
 lib/librte_eal/linuxapp/eal/eal.c          | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 04cbd81..c602d02 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
 
 		switch (opt) {
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 		case 'h':
 			eal_usage(prgname);
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..7a40414 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 }
 
 static int
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index c67685c..1169fcc 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -52,7 +52,8 @@ struct internal_config {
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
-	const char *mbuf_pool_ops_name;   /**< mbuf pool ops name */
+	const char *user_mbuf_pool_ops_name;
+			/**< user defined mbuf pool ops name */
 	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
 	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9..e8c7100 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
-	return internal_config.mbuf_pool_ops_name;
+	return internal_config.user_mbuf_pool_ops_name;
 }
 
 /* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_MBUF_POOL_OPS_NAME_NUM:
-			internal_config.mbuf_pool_ops_name = optarg;
+			internal_config.user_mbuf_pool_ops_name = optarg;
 			break;
 
 		default:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 2/7] mbuf: maintain user and compile time mempool ops name
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
                                 ` (5 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

At present the userdefined mempool ops name overwrites
the default mempool ops name variable in internal_config.

This patch change the logic to maintain the value of
user defined only in the internal config.

The pktmbuf_create_pool is updated to reflect the same ie.
use user defined. If not present than use the default.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 7a40414..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->user_mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:44                 ` Andrew Rybchenko
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
                                 ` (4 subsequent siblings)
  7 siblings, 1 reply; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

This patch add support for various mempool ops config helper APIs.

1.User defined mempool ops
2.Platform detected HW mempool ops (active).
3.Best selection of mempool ops by looking into user defined,
  platform registered and compile time configured.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 doc/api/doxy-api-index.md            |  1 +
 lib/librte_mbuf/Makefile             |  4 +-
 lib/librte_mbuf/rte_mbuf.c           |  5 +-
 lib/librte_mbuf/rte_mbuf_pool_ops.c  | 96 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_pool_ops.h  | 96 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map | 11 +++++
 6 files changed, 208 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
 create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 76d606f..8cbd92a 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -136,6 +136,7 @@ The public API headers are grouped by topics:
 
 - **containers**:
   [mbuf]               (@ref rte_mbuf.h),
+  [mbuf pool ops]      (@ref rte_mbuf_pool_ops.h)
   [ring]               (@ref rte_ring.h),
   [tailq]              (@ref rte_tailq.h),
   [bitmap]             (@ref rte_bitmap.h)
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 398f724..e2e3ec6 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -14,9 +14,9 @@ EXPORT_MAP := rte_mbuf_version.map
 LIBABIVER := 3
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h rte_mbuf_pool_ops.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c085c37..0c4d374 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -54,6 +54,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include <rte_errno.h>
@@ -176,9 +177,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
-	if (mp_ops_name == NULL)
-		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c
new file mode 100644
index 0000000..9aa1541
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <string.h>
+#include <rte_eal.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+#include <rte_mbuf_pool_ops.h>
+
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_platform_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+		strncpy(mz->addr, ops_name, strlen(ops_name));
+		return 0;
+	} else if (strcmp(mz->addr, ops_name) == 0) {
+		return 0;
+	}
+
+	RTE_LOG(ERR, MBUF,
+		"%s is already registered as platform mbuf pool ops\n",
+		(char *)mz->addr);
+	return -EEXIST;
+}
+
+const char *
+rte_mbuf_platform_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_platform_pool_ops");
+	if (mz == NULL)
+		return NULL;
+	return mz->addr;
+}
+
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name)
+{
+	const struct rte_memzone *mz;
+
+	if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+		return -ENAMETOOLONG;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL) {
+		mz = rte_memzone_reserve("mbuf_user_pool_ops",
+			RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
+		if (mz == NULL)
+			return -rte_errno;
+	}
+
+	strncpy(mz->addr, ops_name, strlen(ops_name));
+	return 0;
+
+}
+
+const char *
+rte_mbuf_user_mempool_ops(void)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup("mbuf_user_pool_ops");
+	if (mz == NULL)
+		return rte_eal_mbuf_default_mempool_ops();
+	return mz->addr;
+}
+
+/* Return mbuf pool ops name */
+const char *
+rte_mbuf_best_mempool_ops(void)
+{
+	/* User defined mempool ops takes the priority */
+	const char *best_ops = rte_mbuf_user_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Next choice is platform configured mempool ops */
+	best_ops = rte_mbuf_platform_mempool_ops();
+	if (best_ops)
+		return best_ops;
+
+	/* Last choice is to use the compile time config pool */
+	return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+}
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
new file mode 100644
index 0000000..e8ee20f
--- /dev/null
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _RTE_MBUF_POOL_OPS_H_
+#define _RTE_MBUF_POOL_OPS_H_
+
+/**
+ * @file
+ * RTE Mbuf Pool Ops
+ *
+ * These APIs are for configuring the mbuf pool ops names to be largely used by
+ * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
+ * the best mempool ops available.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set the platform supported pktmbuf HW mempool ops name
+ *
+ * This function allow the HW to register the actively supported HW mempool
+ * ops_name. Only one HW mempool ops can be registered at any point of time.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_platform_mempool_ops(const char *ops_name);
+
+/**
+ * Get configured platform supported pktmbuf HW mempool ops name
+ *
+ * This function returns the platform supported mempool ops name.
+ *
+ * @return
+ *   - On success, platform pool ops name.
+ *   - On failure, NULL.
+ */
+const char *
+rte_mbuf_platform_mempool_ops(void);
+
+/**
+ * Set the user preferred pktmbuf mempool ops name
+ *
+ * This function can be used by the user to configure user preferred
+ * mempool ops name.
+ *
+ * @param ops_name
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_mbuf_set_user_mempool_ops(const char *ops_name);
+
+/**
+ * Get user preferred pool ops name for mbuf
+ *
+ * This function returns the user configured mempool ops name.
+ *
+ * @return
+ *   - On success, user pool ops name..
+ *   - On failure, NULL.
+ */
+const char *
+rte_mbuf_user_mempool_ops(void);
+
+/**
+ * Get the best mempool ops name for pktmbuf.
+ *
+ * This function is used to determine the best options for mempool ops for
+ * pktmbuf allocations. Following are the priority order:
+ * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
+ * This function is also used by the rte_pktmbuf_pool_create to get the best
+ * mempool ops name.
+ *
+ * @return
+ *   returns preferred mbuf pool ops name
+ */
+const char *
+rte_mbuf_best_mempool_ops(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MBUF_POOL_OPS_H_ */
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index 6e2ea84..db87819 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -35,3 +35,14 @@ DPDK_16.11 {
 	rte_get_tx_ol_flag_list;
 
 } DPDK_2.1;
+
+EXPERIMENTAL {
+	global:
+
+	rte_mbuf_best_mempool_ops;
+	rte_mbuf_platform_mempool_ops;
+	rte_mbuf_set_platform_mempool_ops;
+	rte_mbuf_set_user_mempool_ops;
+	rte_mbuf_user_mempool_ops;
+
+} DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 4/7] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                                 ` (2 preceding siblings ...)
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 5/7] app/testpmd: add debug to print preferred " Hemant Agrawal
                                 ` (3 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Introduce a new helper for pktmbuf pool, which will allow
the application to optionally specify the mempool ops name
as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 lib/librte_mbuf/rte_mbuf.c           | 23 ++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h           | 42 ++++++++++++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  1 +
 3 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 0c4d374..a256b42 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	m->next = NULL;
 }
 
-/* helper to create a mbuf pool */
+/* Helper to create a mbuf pool with given mempool ops name*/
 struct rte_mempool *
-rte_pktmbuf_pool_create(const char *name, unsigned n,
-	unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
-	int socket_id)
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name)
 {
 	struct rte_mempool *mp;
 	struct rte_pktmbuf_pool_private mbp_priv;
-	const char *mp_ops_name;
+	const char *mp_ops_name = ops_name;
 	unsigned elt_size;
 	int ret;
 
@@ -177,7 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	if (mp == NULL)
 		return NULL;
 
-	mp_ops_name = rte_mbuf_best_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
@@ -199,6 +200,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	return mp;
 }
 
+/* helper to create a mbuf pool */
+struct rte_mempool *
+rte_pktmbuf_pool_create(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id)
+{
+	return rte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size,
+			data_room_size, socket_id, NULL);
+}
+
 /* do some sanity checks on a mbuf: panic if it fails */
 void
 rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 2fd4f5e..fb367f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1101,6 +1101,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
 	int socket_id);
 
 /**
+ * Create a mbuf pool with a given mempool ops name
+ *
+ * This function creates and initializes a packet mbuf pool. It is
+ * a wrapper to rte_mempool functions.
+ *
+ * @param name
+ *   The name of the mbuf pool.
+ * @param n
+ *   The number of elements in the mbuf pool. The optimum size (in terms
+ *   of memory usage) for a mempool is when n is a power of two minus one:
+ *   n = (2^q - 1).
+ * @param cache_size
+ *   Size of the per-core object cache. See rte_mempool_create() for
+ *   details.
+ * @param priv_size
+ *   Size of application private are between the rte_mbuf structure
+ *   and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN.
+ * @param data_room_size
+ *   Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM.
+ * @param socket_id
+ *   The socket identifier where the memory should be allocated. The
+ *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
+ *   reserved zone.
+ * @param ops_name
+ *   The mempool ops name to be used for this mempool instead of
+ *   default mempool. The value can be *NULL* to use default mempool.
+ * @return
+ *   The pointer to the new allocated mempool, on success. NULL on error
+ *   with rte_errno set appropriately. Possible rte_errno values include:
+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ *    - E_RTE_SECONDARY - function was called from a secondary process instance
+ *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
+ *    - ENOSPC - the maximum number of memzones has already been allocated
+ *    - EEXIST - a memzone with the same name already exists
+ *    - ENOMEM - no appropriate memory area found in which to create memzone
+ */
+struct rte_mempool *
+rte_pktmbuf_pool_create_by_ops(const char *name, unsigned int n,
+	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
+	int socket_id, const char *ops_name);
+
+/**
  * Get the data room size of mbufs stored in a pktmbuf_pool
  *
  * The data room size is the amount of data that can be stored in a
diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map
index db87819..d418dcb 100644
--- a/lib/librte_mbuf/rte_mbuf_version.map
+++ b/lib/librte_mbuf/rte_mbuf_version.map
@@ -44,5 +44,6 @@ EXPERIMENTAL {
 	rte_mbuf_set_platform_mempool_ops;
 	rte_mbuf_set_user_mempool_ops;
 	rte_mbuf_user_mempool_ops;
+	rte_pktmbuf_pool_create_by_ops;
 
 } DPDK_16.11;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 5/7] app/testpmd: add debug to print preferred mempool ops
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                                 ` (3 preceding siblings ...)
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
                                 ` (2 subsequent siblings)
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

This patch adds the debug message to print the best selected
pktmbuf mempool ops name.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..d8ac432 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -38,6 +38,7 @@
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
 #include <rte_ether.h>
@@ -499,6 +500,8 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
 	} else {
 		/* wrapper to rte_mempool_create() */
+		TESTPMD_LOG(INFO, "preferred mempool ops selected: %s\n",
+				rte_mbuf_best_mempool_ops());
 		rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf,
 			mb_mempool_cache, 0, mbuf_seg_size, socket_id);
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 6/7] dpaa: register dpaa as platform HW mempool on runtime
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                                 ` (4 preceding siblings ...)
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 5/7] app/testpmd: add debug to print preferred " Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 7/7] dpaa2: register dpaa2 " Hemant Agrawal
  2018-01-29 18:03               ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Thomas Monjalon
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa-linuxapp-gcc | 1 -
 drivers/bus/dpaa/dpaa_bus.c              | 2 ++
 drivers/bus/dpaa/rte_dpaa_bus.h          | 2 ++
 drivers/mempool/dpaa/dpaa_mempool.c      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc
index c2ca16a..ab9e67d 100644
--- a/config/defconfig_arm64-dpaa-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa-linuxapp-gcc
@@ -25,7 +25,6 @@ CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n
 
 # NXP DPAA Mempool
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa"
 
 # Compile software NXP DPAA PMD
 CONFIG_RTE_LIBRTE_DPAA_PMD=y
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ba33566..f5840de 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -31,6 +31,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_bus.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
@@ -469,6 +470,7 @@ rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+	rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
 
 	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
 	if (svr_file) {
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 6fa0c3d..d613660 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -17,6 +17,8 @@
 
 #define FSL_DPAA_BUS_NAME	"FSL_DPAA_BUS"
 
+#define DPAA_MEMPOOL_OPS_NAME	"dpaa"
+
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index ddc4e47..dc4bcc9 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -290,7 +290,7 @@ dpaa_register_memory_area(const struct rte_mempool *mp,
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
-	.name = "dpaa",
+	.name = DPAA_MEMPOOL_OPS_NAME,
 	.alloc = dpaa_mbuf_create_pool,
 	.free = dpaa_mbuf_free_pool,
 	.enqueue = dpaa_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* [dpdk-dev] [PATCH v7 7/7] dpaa2: register dpaa2 as platform HW mempool on runtime
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                                 ` (5 preceding siblings ...)
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
@ 2018-01-29  8:10               ` Hemant Agrawal
  2018-01-29 18:03               ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Thomas Monjalon
  7 siblings, 0 replies; 112+ messages in thread
From: Hemant Agrawal @ 2018-01-29  8:10 UTC (permalink / raw)
  To: thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

Detect if the DPAA2 mempool objects are present and register
it as platform default hw mempool

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c  | 7 +++++++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   | 2 ++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
index d38d696..5d4437c 100644
--- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
+++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
@@ -26,7 +26,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 # Compile Support Libraries for DPAA2
 #
 CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y
-CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
 CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n
 
 #
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index 139249c..1539739 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -20,6 +20,7 @@
 #include <rte_kvargs.h>
 #include <rte_dev.h>
 #include <rte_ethdev_driver.h>
+#include <rte_mbuf_pool_ops.h>
 
 #include <fslmc_logs.h>
 #include <rte_fslmc.h>
@@ -38,6 +39,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 {
 	struct dpaa2_dpbp_dev *dpbp_node;
 	int ret;
+	static int register_once;
 
 	/* Allocate DPAA2 dpbp handle */
 	dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0);
@@ -74,6 +76,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
 
 	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id);
 
+	if (!register_once) {
+		if (rte_mbuf_set_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME))
+			register_once = 1;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 9436d37..d421dbf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -44,6 +44,8 @@
 /* Maximum release/acquire from QBMAN */
 #define DPAA2_MBUF_MAX_ACQ_REL	7
 
+#define DPAA2_MEMPOOL_OPS_NAME		"dpaa2"
+
 #define MAX_BPID 256
 #define DPAA2_MBUF_HW_ANNOTATION	64
 #define DPAA2_FD_PTA_SIZE		0
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index afda2c2..2bd62e8 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -354,7 +354,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 struct rte_mempool_ops dpaa2_mpool_ops = {
-	.name = "dpaa2",
+	.name = DPAA2_MEMPOOL_OPS_NAME,
 	.alloc = rte_hw_mbuf_create_pool,
 	.free = rte_hw_mbuf_free_pool,
 	.enqueue = rte_hw_mbuf_free_bulk,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
@ 2018-01-29  8:44                 ` Andrew Rybchenko
  0 siblings, 0 replies; 112+ messages in thread
From: Andrew Rybchenko @ 2018-01-29  8:44 UTC (permalink / raw)
  To: Hemant Agrawal, thomas, dev; +Cc: jerin.jacob, olivier.matz, santosh.shukla

On 01/29/2018 11:10 AM, Hemant Agrawal wrote:
> This patch add support for various mempool ops config helper APIs.
>
> 1.User defined mempool ops
> 2.Platform detected HW mempool ops (active).
> 3.Best selection of mempool ops by looking into user defined,
>    platform registered and compile time configured.
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> ---
>   doc/api/doxy-api-index.md            |  1 +
>   lib/librte_mbuf/Makefile             |  4 +-
>   lib/librte_mbuf/rte_mbuf.c           |  5 +-
>   lib/librte_mbuf/rte_mbuf_pool_ops.c  | 96 ++++++++++++++++++++++++++++++++++++
>   lib/librte_mbuf/rte_mbuf_pool_ops.h  | 96 ++++++++++++++++++++++++++++++++++++
>   lib/librte_mbuf/rte_mbuf_version.map | 11 +++++
>   6 files changed, 208 insertions(+), 5 deletions(-)
>   create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.c
>   create mode 100644 lib/librte_mbuf/rte_mbuf_pool_ops.h

<...>

> diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.h b/lib/librte_mbuf/rte_mbuf_pool_ops.h
> new file mode 100644
> index 0000000..e8ee20f
> --- /dev/null
> +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.h

<...>

> +
> +/**
> + * Set the platform supported pktmbuf HW mempool ops name
> + *
> + * This function allow the HW to register the actively supported HW mempool
> + * ops_name. Only one HW mempool ops can be registered at any point of time.
> + *
> + * @param ops_name
> + * @return
> + *   - On success, zero.
> + *   - On failure, a negative value.
> + */
> +int
> +rte_mbuf_set_platform_mempool_ops(const char *ops_name);

Just one minor note:
As far as I can see it is not strictly followed in DPDK headers, but coding
standard [1] says that "Short function prototypes should be contained
on a single line." and all examples in coding style follow it. There is 
a known
practical reason behind it: grep -r ^function_name  will find single place
where the function is implemented.

<...>

[1] http://dpdk.org/doc/guides/contributing/coding_style.html#prototypes

^ permalink raw reply	[flat|nested] 112+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support
  2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
                                 ` (6 preceding siblings ...)
  2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 7/7] dpaa2: register dpaa2 " Hemant Agrawal
@ 2018-01-29 18:03               ` Thomas Monjalon
  7 siblings, 0 replies; 112+ messages in thread
From: Thomas Monjalon @ 2018-01-29 18:03 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, olivier.matz, santosh.shukla

29/01/2018 09:10, Hemant Agrawal:
> Hemant Agrawal (6):
>   eal: prefix mbuf pool ops name with user defined
>   mbuf: maintain user and compile time mempool ops name
>   mbuf: add pool ops name selection API helpers
>   mbuf: pktmbuf pool create helper for specific mempool ops
>   dpaa: register dpaa as platform HW mempool on runtime
>   dpaa2: register dpaa2 as platform HW mempool on runtime
> 
> Pavan Nikhilesh (1):
>   app/testpmd: add debug to print preferred mempool ops

Applied, thanks

^ permalink raw reply	[flat|nested] 112+ messages in thread

end of thread, other threads:[~2018-01-29 18:03 UTC | newest]

Thread overview: 112+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04 12:22 [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
2017-07-04 12:22 ` [dpdk-dev] [PATCH 1/2] mempool: check the support for the given mempool Hemant Agrawal
2017-07-04 12:22 ` [dpdk-dev] [PATCH 2/2] mbuf: add support for preferred mempool list Hemant Agrawal
2017-09-22  7:13 ` [dpdk-dev] [PATCH 0/2] Multiple Pktmbuf mempool support Hemant Agrawal
2017-09-25 10:24   ` Olivier MATZ
2017-10-10 14:15     ` Thomas Monjalon
2017-10-10 14:21       ` Hemant Agrawal
2017-12-15 10:24 ` [dpdk-dev] [PATCH 0/2] Dynamic HW Mempool Detection Support Hemant Agrawal
2017-12-15 10:24   ` [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool Hemant Agrawal
2017-12-15 15:52     ` Stephen Hemminger
2017-12-18  9:26       ` Hemant Agrawal
2017-12-18  8:55     ` Jerin Jacob
2017-12-18  9:36       ` Hemant Agrawal
2017-12-22 14:59         ` Olivier MATZ
2017-12-28 12:07           ` Hemant Agrawal
2018-01-10 12:49             ` Hemant Agrawal
2017-12-22 14:41     ` Olivier MATZ
2017-12-15 10:24   ` [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active mempool Hemant Agrawal
2017-12-18  8:57     ` Jerin Jacob
2017-12-18  9:25       ` Hemant Agrawal
2018-01-15  6:11   ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Hemant Agrawal
2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 1/5] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 2/5] eal: add platform mempool ops name in internal config Hemant Agrawal
2018-01-15 12:24       ` Jerin Jacob
2018-01-15 14:31         ` Hemant Agrawal
2018-01-15 16:26           ` Jerin Jacob
2018-01-16 15:04             ` Olivier Matz
2018-01-16 15:08               ` Jerin Jacob
2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs Hemant Agrawal
2018-01-15 11:41       ` Jerin Jacob
2018-01-15 14:24         ` Hemant Agrawal
2018-01-15 14:37           ` Jerin Jacob
2018-01-15 12:36       ` Jerin Jacob
2018-01-16 15:09       ` Olivier Matz
2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-15 12:31       ` Jerin Jacob
2018-01-15 14:32         ` Hemant Agrawal
2018-01-15  6:11     ` [dpdk-dev] [PATCH v2 5/5] mbuf: add user command line config mempools ops API Hemant Agrawal
2018-01-15 12:29       ` Jerin Jacob
2018-01-15 14:35         ` Hemant Agrawal
2018-01-15 16:23           ` Jerin Jacob
2018-01-16 15:01     ` [dpdk-dev] [PATCH v2 0/5] Dynamic HW Mempool Detection Support Olivier Matz
2018-01-18 11:47       ` Hemant Agrawal
2018-01-18 13:42         ` Olivier Matz
2018-01-18 13:26     ` [dpdk-dev] [PATCH v3 0/7] " Hemant Agrawal
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-19 10:01         ` Olivier Matz
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 2/7] eal: add API to set user default mbuf mempool ops Hemant Agrawal
2018-01-19 10:01         ` Olivier Matz
2018-01-19 12:31           ` Hemant Agrawal
2018-01-19 12:43             ` Olivier Matz
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
2018-01-19 10:01         ` Olivier Matz
2018-01-19 12:41           ` Hemant Agrawal
2018-01-19 13:10             ` Olivier Matz
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
2018-01-19 10:01         ` Olivier Matz
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 6/7] dpaa2: register dpaa2 as platform HW mempool on runtime Hemant Agrawal
2018-01-18 13:26       ` [dpdk-dev] [PATCH v3 7/7] dpaa: register dpaa " Hemant Agrawal
2018-01-19 16:33       ` [dpdk-dev] [PATCH v4 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
2018-01-19 16:33         ` [dpdk-dev] [PATCH v4 7/7] dpaa2: register dpaa2 " Hemant Agrawal
2018-01-20  6:15         ` [dpdk-dev] [PATCH v5 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-22 13:23             ` Olivier Matz
2018-01-22 13:24             ` Hemant Agrawal
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
2018-01-22 13:23             ` Olivier Matz
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
2018-01-22 13:23             ` Olivier Matz
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-22 13:24             ` Olivier Matz
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
2018-01-22 13:25             ` Olivier Matz
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
2018-01-20  6:15           ` [dpdk-dev] [PATCH v5 7/7] dpaa2: register dpaa2 " Hemant Agrawal
2018-01-22 13:51           ` [dpdk-dev] [PATCH v6 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-22 14:43               ` santosh
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
2018-01-22 14:47               ` santosh
2018-01-25 22:02               ` Thomas Monjalon
2018-01-26  5:10                 ` Hemant Agrawal
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
2018-01-22 14:49               ` santosh
2018-01-25 22:01               ` Thomas Monjalon
2018-01-26  5:10                 ` Hemant Agrawal
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-22 14:51               ` santosh
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 5/7] app/testpmd: set preferred mempool as default pktpool Hemant Agrawal
2018-01-22 14:52               ` santosh
2018-01-25 22:04               ` Thomas Monjalon
2018-01-26  5:11                 ` Hemant Agrawal
2018-01-26  7:43                   ` Thomas Monjalon
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
2018-01-22 13:51             ` [dpdk-dev] [PATCH v6 7/7] dpaa2: register dpaa2 " Hemant Agrawal
2018-01-29  8:10             ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 1/7] eal: prefix mbuf pool ops name with user defined Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 2/7] mbuf: maintain user and compile time mempool ops name Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 3/7] mbuf: add pool ops name selection API helpers Hemant Agrawal
2018-01-29  8:44                 ` Andrew Rybchenko
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 4/7] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 5/7] app/testpmd: add debug to print preferred " Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 6/7] dpaa: register dpaa as platform HW mempool on runtime Hemant Agrawal
2018-01-29  8:10               ` [dpdk-dev] [PATCH v7 7/7] dpaa2: register dpaa2 " Hemant Agrawal
2018-01-29 18:03               ` [dpdk-dev] [PATCH v7 0/7] Dynamic HW Mempool Detection Support Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).