DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops
@ 2017-12-22 11:30 Hemant Agrawal
  2017-12-22 13:53 ` Wiles, Keith
  2018-01-16 14:52 ` Olivier Matz
  0 siblings, 2 replies; 5+ messages in thread
From: Hemant Agrawal @ 2017-12-22 11:30 UTC (permalink / raw)
  To: dev, olivier.matz; +Cc: jerin.jacob, keith.wiles, Hemant Agrawal

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>
---
This change was discussed in the 
"doc: announce ABI change for pktmbuf pool create API"
http://dpdk.org/dev/patchwork/patch/32306/

 lib/librte_mbuf/rte_mbuf.c | 24 ++++++++++++++++++------
 lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 7543662..9cc861b 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -148,15 +148,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*/
 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;
 
@@ -176,7 +176,9 @@ 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)
+		mp_ops_name = rte_eal_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");
@@ -198,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_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 ce8a05d..d4681fd 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);
+
+/**
  * 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] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops
  2017-12-22 11:30 [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
@ 2017-12-22 13:53 ` Wiles, Keith
  2018-01-16 14:52 ` Olivier Matz
  1 sibling, 0 replies; 5+ messages in thread
From: Wiles, Keith @ 2017-12-22 13:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, jerin.jacob



> On Dec 22, 2017, at 5:30 AM, Hemant Agrawal <hemant.agrawal@nxp.com> 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>
> ---
> This change was discussed in the 
> "doc: announce ABI change for pktmbuf pool create API"
> http://dpdk.org/dev/patchwork/patch/32306/
> 
> lib/librte_mbuf/rte_mbuf.c | 24 ++++++++++++++++++------
> lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 60 insertions(+), 6 deletions(-)
> 

This patch looks good to me, but you forgot the MAP file patch to add the new API.

Regards,
Keith

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

* Re: [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops
  2017-12-22 11:30 [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
  2017-12-22 13:53 ` Wiles, Keith
@ 2018-01-16 14:52 ` Olivier Matz
  2018-01-16 14:59   ` Wiles, Keith
  2018-01-17  5:29   ` Hemant Agrawal
  1 sibling, 2 replies; 5+ messages in thread
From: Olivier Matz @ 2018-01-16 14:52 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, jerin.jacob, keith.wiles

On Fri, Dec 22, 2017 at 05:00:11PM +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>
> ---

Hi Hemant,

It looks this patch is now in another patchset:
http://dpdk.org/dev/patchwork/patch/33719/

Can it be marked as superseeded in patchwork?

Thanks

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

* Re: [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-16 14:52 ` Olivier Matz
@ 2018-01-16 14:59   ` Wiles, Keith
  2018-01-17  5:29   ` Hemant Agrawal
  1 sibling, 0 replies; 5+ messages in thread
From: Wiles, Keith @ 2018-01-16 14:59 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Hemant Agrawal, dev, jerin.jacob



> On Jan 16, 2018, at 8:52 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
> 
> On Fri, Dec 22, 2017 at 05:00:11PM +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>
>> ---
> 
> Hi Hemant,
> 
> It looks this patch is now in another patchset:
> http://dpdk.org/dev/patchwork/patch/33719/
> 
> Can it be marked as superseeded in patchwork?

I can mark my patch.
> 
> Thanks

Regards,
Keith

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

* Re: [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops
  2018-01-16 14:52 ` Olivier Matz
  2018-01-16 14:59   ` Wiles, Keith
@ 2018-01-17  5:29   ` Hemant Agrawal
  1 sibling, 0 replies; 5+ messages in thread
From: Hemant Agrawal @ 2018-01-17  5:29 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, jerin.jacob, keith.wiles

On 1/16/2018 8:22 PM, Olivier Matz wrote:
> On Fri, Dec 22, 2017 at 05:00:11PM +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>
>> ---
>
> Hi Hemant,
>
> It looks this patch is now in another patchset:
> http://dpdk.org/dev/patchwork/patch/33719/
>
> Can it be marked as superseeded in patchwork?

done.

>
> Thanks
>

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 11:30 [dpdk-dev] [PATCH] mbuf: pktmbuf pool create helper for specific mempool ops Hemant Agrawal
2017-12-22 13:53 ` Wiles, Keith
2018-01-16 14:52 ` Olivier Matz
2018-01-16 14:59   ` Wiles, Keith
2018-01-17  5:29   ` Hemant Agrawal

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).