[v2,2/4] mempool: add non-IO flag

Message ID 20210929145249.2176811-3-dkozlyuk@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/4] mempool: add event callbacks |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dmitry Kozlyuk Sept. 29, 2021, 2:52 p.m. UTC
  From: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>

Mempool is a generic allocator that is not necessarily used for device
IO operations and its memory for DMA. Add MEMPOOL_F_NON_IO flag to mark
such mempools.

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 doc/guides/rel_notes/release_21_11.rst | 3 +++
 lib/mempool/rte_mempool.h              | 4 ++++
 2 files changed, 7 insertions(+)
  

Comments

Thomas Monjalon Oct. 5, 2021, 4:39 p.m. UTC | #1
29/09/2021 16:52, dkozlyuk@oss.nvidia.com:
> From: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
> 
> Mempool is a generic allocator that is not necessarily used for device
> IO operations and its memory for DMA. Add MEMPOOL_F_NON_IO flag to mark
> such mempools.
> 
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  doc/guides/rel_notes/release_21_11.rst | 3 +++
>  lib/mempool/rte_mempool.h              | 4 ++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
> index f85dc99c8b..873beda633 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -155,6 +155,9 @@ API Changes
> +* mempool: Added ``MEMPOOL_F_NON_IO`` flag to give a hint to DPDK components
> +  that objects from this pool will not be used for device IO (e.g. DMA).

This is not a breaking change, but I am OK to add this note.
Any other opinion?

> +#define MEMPOOL_F_NON_IO         0x0040 /**< Not used for device IO (DMA). */

> + *   - MEMPOOL_F_NO_IO: If set, the mempool is considered to be
> + *     never used for device IO, i.e. DMA operations,
> + *     which may affect some PMD behavior.

Not limited to PMD, it may affect some libs.
I would reword the last line like this:
"No impact on mempool behaviour, but it is a hint for other components."
  
Andrew Rybchenko Oct. 12, 2021, 6:06 a.m. UTC | #2
On 10/5/21 7:39 PM, Thomas Monjalon wrote:
> 29/09/2021 16:52, dkozlyuk@oss.nvidia.com:
>> From: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
>>
>> Mempool is a generic allocator that is not necessarily used for device
>> IO operations and its memory for DMA. Add MEMPOOL_F_NON_IO flag to mark
>> such mempools.
>>
>> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
>> Acked-by: Matan Azrad <matan@nvidia.com>
>> ---
>>  doc/guides/rel_notes/release_21_11.rst | 3 +++
>>  lib/mempool/rte_mempool.h              | 4 ++++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
>> index f85dc99c8b..873beda633 100644
>> --- a/doc/guides/rel_notes/release_21_11.rst
>> +++ b/doc/guides/rel_notes/release_21_11.rst
>> @@ -155,6 +155,9 @@ API Changes
>> +* mempool: Added ``MEMPOOL_F_NON_IO`` flag to give a hint to DPDK components
>> +  that objects from this pool will not be used for device IO (e.g. DMA).
> 
> This is not a breaking change, but I am OK to add this note.
> Any other opinion?

Why is it in API changes section? Shouldn't it be in
"New Features"?
  

Patch

diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index f85dc99c8b..873beda633 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -155,6 +155,9 @@  API Changes
   the crypto/security operation. This field will be used to communicate
   events such as soft expiry with IPsec in lookaside mode.
 
+* mempool: Added ``MEMPOOL_F_NON_IO`` flag to give a hint to DPDK components
+  that objects from this pool will not be used for device IO (e.g. DMA).
+
 
 ABI Changes
 -----------
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index c81e488851..4d18957d6d 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -263,6 +263,7 @@  struct rte_mempool {
 #define MEMPOOL_F_SC_GET         0x0008 /**< Default get is "single-consumer".*/
 #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
 #define MEMPOOL_F_NO_IOVA_CONTIG 0x0020 /**< Don't need IOVA contiguous objs. */
+#define MEMPOOL_F_NON_IO         0x0040 /**< Not used for device IO (DMA). */
 
 /**
  * @internal When debug is enabled, store some statistics.
@@ -992,6 +993,9 @@  typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
  *     "single-consumer". Otherwise, it is "multi-consumers".
  *   - MEMPOOL_F_NO_IOVA_CONTIG: If set, allocated objects won't
  *     necessarily be contiguous in IO memory.
+ *   - MEMPOOL_F_NO_IO: If set, the mempool is considered to be
+ *     never used for device IO, i.e. DMA operations,
+ *     which may affect some PMD behavior.
  * @return
  *   The pointer to the new allocated mempool, on success. NULL on error
  *   with rte_errno set appropriately. Possible rte_errno values include: