[v4,1/2] dmadev: offload to auto free DMA buffer

Message ID 20231009120236.1641008-2-amitprakashs@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series offload support to auto free dma buffer |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Amit Prakash Shukla Oct. 9, 2023, 12:02 p.m. UTC
  This changeset adds support in DMA library to auto free DMA buffer by
hardware. On a supported hardware, application can pass on the mempool
information as part of vchan config.

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 lib/dmadev/rte_dmadev.h | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
  

Comments

fengchengwen Oct. 10, 2023, 1:40 a.m. UTC | #1
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2023/10/9 20:02, Amit Prakash Shukla wrote:
> This changeset adds support in DMA library to auto free DMA buffer by
> hardware. On a supported hardware, application can pass on the mempool
> information as part of vchan config.
>
> Signed-off-by: Amit Prakash Shukla<amitprakashs@marvell.com>
> Acked-by: Morten Brørup<mb@smartsharesystems.com>
> Acked-by: Anoob Joseph<anoobj@marvell.com>
> ---
>   lib/dmadev/rte_dmadev.h | 43 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 43 insertions(+)
> ...
  
Amit Prakash Shukla Oct. 16, 2023, 11:28 a.m. UTC | #2
Hi Thomas,

Gentle ping.


Could you please consider merging this series in RC1.

Thanks,
Amit Shukla

From: fengchengwen <fengchengwen@huawei.com>
Sent: Tuesday, October 10, 2023 7:10 AM
To: Amit Prakash Shukla <amitprakashs@marvell.com>; Kevin Laatz <kevin.laatz@intel.com>; Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; conor.walsh@intel.com; Vamsi Krishna Attunuru <vattunuru@marvell.com>; g.singh@nxp.com; sachin.saxena@oss.nxp.com; hemant.agrawal@nxp.com; cheng1.jiang@intel.com; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Anoob Joseph <anoobj@marvell.com>; mb@smartsharesystems.com
Subject: [EXT] Re: [PATCH v4 1/2] dmadev: offload to auto free DMA buffer

External Email
________________________________

Acked-by: Chengwen Feng <fengchengwen@huawei.com><mailto:fengchengwen@huawei.com>


On 2023/10/9 20:02, Amit Prakash Shukla wrote:

This changeset adds support in DMA library to auto free DMA buffer by

hardware. On a supported hardware, application can pass on the mempool

information as part of vchan config.



Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com><mailto:amitprakashs@marvell.com>

Acked-by: Morten Brørup <mb@smartsharesystems.com><mailto:mb@smartsharesystems.com>

Acked-by: Anoob Joseph <anoobj@marvell.com><mailto:anoobj@marvell.com>

---

 lib/dmadev/rte_dmadev.h | 43 +++++++++++++++++++++++++++++++++++++++++

 1 file changed, 43 insertions(+)

...
  

Patch

diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index b157ab7600..493263a5d6 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -269,6 +269,14 @@  int16_t rte_dma_next_dev(int16_t start_dev_id);
  * must ensure that all memory addresses are valid and accessible by HW.
  */
 #define RTE_DMA_CAPA_HANDLES_ERRORS	RTE_BIT64(6)
+/** Support auto free for source buffer once mem to dev transfer is completed.
+ *
+ * @note Even though the DMA driver has this capability, it may not support all
+ * mempool drivers. If the mempool is not supported by the DMA driver,
+ * rte_dma_vchan_setup() will fail.
+ */
+#define RTE_DMA_CAPA_M2D_AUTO_FREE      RTE_BIT64(7)
+
 /** Support copy operation.
  * This capability start with index of 32, so that it could leave gap between
  * normal capability and ops capability.
@@ -552,6 +560,26 @@  struct rte_dma_port_param {
 	uint64_t reserved[2]; /**< Reserved for future fields. */
 };
 
+/**
+ * A structure used for offload auto free params.
+ */
+struct rte_dma_auto_free_param {
+	union {
+		struct {
+			/**
+			 * Mempool from which buffer is allocated. Mempool info
+			 * is used for freeing buffer by hardware.
+			 *
+			 * @note If the mempool is not supported by the DMA device,
+			 * rte_dma_vchan_setup() will fail.
+			 */
+			struct rte_mempool *pool;
+		} m2d;
+	};
+	/** Reserved for future fields. */
+	uint64_t reserved[2];
+};
+
 /**
  * A structure used to configure a virtual DMA channel.
  *
@@ -581,6 +609,14 @@  struct rte_dma_vchan_conf {
 	 * @see struct rte_dma_port_param
 	 */
 	struct rte_dma_port_param dst_port;
+	/** Buffer params to auto free buffer by hardware. To free the buffer
+	 * by hardware, RTE_DMA_OP_FLAG_AUTO_FREE must be set while calling
+	 * rte_dma_copy and rte_dma_copy_sg().
+	 *
+	 * @see RTE_DMA_OP_FLAG_AUTO_FREE
+	 * @see struct rte_dma_auto_free_param
+	 */
+	struct rte_dma_auto_free_param auto_free;
 };
 
 /**
@@ -818,6 +854,13 @@  struct rte_dma_sge {
  * capability bit for this, driver should not return error if this flag was set.
  */
 #define RTE_DMA_OP_FLAG_LLC     RTE_BIT64(2)
+/** Auto free buffer flag.
+ * Operation with this flag must issue command to hardware to free the DMA
+ * buffer after DMA transfer is completed.
+ *
+ * @see struct rte_dma_vchan_conf::auto_free
+ */
+#define RTE_DMA_OP_FLAG_AUTO_FREE	RTE_BIT64(3)
 /**@}*/
 
 /**