From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <xiaolong.ye@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id C556523D
 for <dev@dpdk.org>; Sun, 24 Mar 2019 10:12:49 +0100 (CET)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 24 Mar 2019 02:12:48 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="331496798"
Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206])
 by fmsmga005.fm.intel.com with ESMTP; 24 Mar 2019 02:12:47 -0700
Date: Sun, 24 Mar 2019 17:08:35 +0800
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
 Karlsson Magnus <magnus.karlsson@intel.com>,
 Topel Bjorn <bjorn.topel@intel.com>
Message-ID: <20190324090835.GB22909@intel.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190322130129.109964-1-xiaolong.ye@intel.com>
 <20190322130129.109964-3-xiaolong.ye@intel.com>
 <4118b1b6-7c9b-fc7d-f74e-03c066cb5513@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4118b1b6-7c9b-fc7d-f74e-03c066cb5513@redhat.com>
User-Agent: Mutt/1.9.4 (2018-02-28)
Subject: Re: [dpdk-dev] [PATCH v4 2/5] lib/mbuf: introduce helper to create
 mempool with flags
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Mar 2019 09:12:50 -0000

On 03/22, Maxime Coquelin wrote:
>
>
>On 3/22/19 2:01 PM, Xiaolong Ye wrote:
>> This allows applications to create mbuf mempool with specific flags
>> such as MEMPOOL_F_NO_SPREAD if they want fixed size memory objects.
>> 
>> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
>> ---
>>   lib/librte_mbuf/rte_mbuf.c | 29 +++++++++++++++++++-----
>>   lib/librte_mbuf/rte_mbuf.h | 45 ++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 69 insertions(+), 5 deletions(-)
>> 
>
>> +/**
>> + * Create a mbuf pool with flags.
>> + *
>> + * This function creates and initializes a packet mbuf pool. It is
>> + * a wrapper to rte_mempool functions.
>> + *
>> + * @warning
>> + * @b EXPERIMENTAL: This API may change without prior notice.
>> + *
>> + * @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 flags
>> + *   Flags controlling the behavior of the mempool. See
>> + *   rte_mempool_create() for details.
>> + * @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.
>> + * @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_experimental
>> +rte_pktmbuf_pool_create_with_flags(const char *name, unsigned int n,
>> +	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
>> +	unsigned int flags, int socket_id);
>> +
>>   /**
>>    * Create a mbuf pool with a given mempool ops name
>>    *
>> 
>
>You need to add it to rte_mbuf_version.map too.

Got it, will add in next version.

Thanks,
Xiaolong

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id D4E0EA05D3
	for <public@inbox.dpdk.org>; Sun, 24 Mar 2019 10:12:50 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9F35B56A1;
	Sun, 24 Mar 2019 10:12:50 +0100 (CET)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id C556523D
 for <dev@dpdk.org>; Sun, 24 Mar 2019 10:12:49 +0100 (CET)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 24 Mar 2019 02:12:48 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="331496798"
Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206])
 by fmsmga005.fm.intel.com with ESMTP; 24 Mar 2019 02:12:47 -0700
Date: Sun, 24 Mar 2019 17:08:35 +0800
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
 Karlsson Magnus <magnus.karlsson@intel.com>,
 Topel Bjorn <bjorn.topel@intel.com>
Message-ID: <20190324090835.GB22909@intel.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190322130129.109964-1-xiaolong.ye@intel.com>
 <20190322130129.109964-3-xiaolong.ye@intel.com>
 <4118b1b6-7c9b-fc7d-f74e-03c066cb5513@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <4118b1b6-7c9b-fc7d-f74e-03c066cb5513@redhat.com>
User-Agent: Mutt/1.9.4 (2018-02-28)
Subject: Re: [dpdk-dev] [PATCH v4 2/5] lib/mbuf: introduce helper to create
 mempool with flags
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190324090835.Do9ejEjz6Sgygj1xbzIxv_G1FTXHkFtRM5tYep7wleM@z>

On 03/22, Maxime Coquelin wrote:
>
>
>On 3/22/19 2:01 PM, Xiaolong Ye wrote:
>> This allows applications to create mbuf mempool with specific flags
>> such as MEMPOOL_F_NO_SPREAD if they want fixed size memory objects.
>> 
>> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
>> ---
>>   lib/librte_mbuf/rte_mbuf.c | 29 +++++++++++++++++++-----
>>   lib/librte_mbuf/rte_mbuf.h | 45 ++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 69 insertions(+), 5 deletions(-)
>> 
>
>> +/**
>> + * Create a mbuf pool with flags.
>> + *
>> + * This function creates and initializes a packet mbuf pool. It is
>> + * a wrapper to rte_mempool functions.
>> + *
>> + * @warning
>> + * @b EXPERIMENTAL: This API may change without prior notice.
>> + *
>> + * @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 flags
>> + *   Flags controlling the behavior of the mempool. See
>> + *   rte_mempool_create() for details.
>> + * @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.
>> + * @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_experimental
>> +rte_pktmbuf_pool_create_with_flags(const char *name, unsigned int n,
>> +	unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size,
>> +	unsigned int flags, int socket_id);
>> +
>>   /**
>>    * Create a mbuf pool with a given mempool ops name
>>    *
>> 
>
>You need to add it to rte_mbuf_version.map too.

Got it, will add in next version.

Thanks,
Xiaolong