[v1,1/2] dmadev: offload to free source buffer

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Amit Prakash Shukla Sept. 7, 2023, 8:10 a.m. UTC
  This changeset adds support in DMA library to free source DMA buffer by
hardware. On a supported hardware, application can pass on the mempool
information as part of vchan config when the DMA transfer direction is
configured as RTE_DMA_DIR_MEM_TO_DEV.

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

Comments

Amit Prakash Shukla Sept. 7, 2023, 9 a.m. UTC | #1
Driver implementation of the spec: http://patches.dpdk.org/project/dpdk/patch/20230907082443.1002665-1-amitprakashs@marvell.com/


> -----Original Message-----
> From: Amit Prakash Shukla <amitprakashs@marvell.com>
> Sent: Thursday, September 7, 2023 1:41 PM
> To: Chengwen Feng <fengchengwen@huawei.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>; Amit
> Prakash Shukla <amitprakashs@marvell.com>; Morten Brørup
> <mb@smartsharesystems.com>
> Subject: [PATCH v1 1/2] dmadev: offload to free source buffer
> 
> This changeset adds support in DMA library to free source DMA buffer by
> hardware. On a supported hardware, application can pass on the mempool
> information as part of vchan config when the DMA transfer direction is
> configured as RTE_DMA_DIR_MEM_TO_DEV.
> 
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  lib/dmadev/rte_dmadev.h | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index
> b157ab7600..d6a685907f 100644
> --- a/lib/dmadev/rte_dmadev.h
> +++ b/lib/dmadev/rte_dmadev.h
> @@ -278,6 +278,13 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);
>  #define RTE_DMA_CAPA_OPS_COPY_SG	RTE_BIT64(33)
>  /** Support fill operation. */
>  #define RTE_DMA_CAPA_OPS_FILL		RTE_BIT64(34)
> +/** Support for source buffer free for mem to dev transfer.
> + *
> + * @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_MEM_TO_DEV_SOURCE_BUFFER_FREE
> 	RTE_BIT64(35)
>  /**@}*/
> 
>  /**
> @@ -581,6 +588,19 @@ struct rte_dma_vchan_conf {
>  	 * @see struct rte_dma_port_param
>  	 */
>  	struct rte_dma_port_param dst_port;
> +	/** mempool from which source buffer is allocated. mempool info is
> used
> +	 * for freeing source buffer by hardware when configured direction is
> +	 * RTE_DMA_DIR_MEM_TO_DEV. To free the source buffer by
> hardware,
> +	 * RTE_DMA_OP_FLAG_FREE_SBUF must be set while calling
> rte_dma_copy and
> +	 * rte_dma_copy_sg().
> +	 *
> +	 * @note If the mempool is not supported by the DMA driver,
> +	 * rte_dma_vchan_setup() will fail.
> +	 *
> +	 * @see RTE_DMA_OP_FLAG_FREE_SBUF
> +	 */
> +	struct rte_mempool *mem_to_dev_src_buf_pool;
> +
>  };
> 
>  /**
> @@ -818,6 +838,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)
> +/** Mem to dev source buffer free flag.
> + * Used for freeing source DMA buffer by hardware when the transfer
> +direction is
> + * configured as RTE_DMA_DIR_MEM_TO_DEV.
> + *
> + * @see struct rte_dma_vchan_conf::mem_to_dev_src_buf_pool
> + */
> +#define RTE_DMA_OP_FLAG_FREE_SBUF	RTE_BIT64(3)
>  /**@}*/
> 
>  /**
> --
> 2.25.1
  
Anoob Joseph Sept. 18, 2023, 11:12 a.m. UTC | #2
Hi Amit,

Thanks for adding the feature. Please see inline.

With the mentioned fixes,

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

Thanks,
Anoob

> -----Original Message-----
> From: Amit Prakash Shukla <amitprakashs@marvell.com>
> Sent: Thursday, September 7, 2023 1:41 PM
> To: Chengwen Feng <fengchengwen@huawei.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>; Amit
> Prakash Shukla <amitprakashs@marvell.com>; Morten Brørup
> <mb@smartsharesystems.com>
> Subject: [PATCH v1 1/2] dmadev: offload to free source buffer
> 
> This changeset adds support in DMA library to free source DMA buffer by
> hardware. On a supported hardware, application can pass on the mempool
> information as part of vchan config when the DMA transfer direction is
> configured as RTE_DMA_DIR_MEM_TO_DEV.
> 
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  lib/dmadev/rte_dmadev.h | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index
> b157ab7600..d6a685907f 100644
> --- a/lib/dmadev/rte_dmadev.h
> +++ b/lib/dmadev/rte_dmadev.h
> @@ -278,6 +278,13 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);
>  #define RTE_DMA_CAPA_OPS_COPY_SG	RTE_BIT64(33)
>  /** Support fill operation. */
>  #define RTE_DMA_CAPA_OPS_FILL		RTE_BIT64(34)
> +/** Support for source buffer free for mem to dev transfer.
> + *
> + * @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.
> + **/

[Anoob] I think you can remove the note. It is mentioned below also, right? That should be sufficient I guess. Not a strong comment. You can decide.

> +#define RTE_DMA_CAPA_MEM_TO_DEV_SOURCE_BUFFER_FREE
> 	RTE_BIT64(35)
>  /**@}*/
> 
>  /**
> @@ -581,6 +588,19 @@ struct rte_dma_vchan_conf {
>  	 * @see struct rte_dma_port_param
>  	 */
>  	struct rte_dma_port_param dst_port;
> +	/** mempool from which source buffer is allocated. mempool info is

[Anoob] Mempool -> Mempool (in both places)

> used
> +	 * for freeing source buffer by hardware when configured direction is
> +	 * RTE_DMA_DIR_MEM_TO_DEV. To free the source buffer by
> hardware,
> +	 * RTE_DMA_OP_FLAG_FREE_SBUF must be set while calling
> rte_dma_copy and
> +	 * rte_dma_copy_sg().
> +	 *
> +	 * @note If the mempool is not supported by the DMA driver,
> +	 * rte_dma_vchan_setup() will fail.

[Anoob] "If the mempool is not supported by the DMA device, ..."

driver -> device.

> +	 *
> +	 * @see RTE_DMA_OP_FLAG_FREE_SBUF
> +	 */
> +	struct rte_mempool *mem_to_dev_src_buf_pool;
> +
>  };
> 
>  /**
> @@ -818,6 +838,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)
> +/** Mem to dev source buffer free flag.
> + * Used for freeing source DMA buffer by hardware when the transfer
> +direction is
> + * configured as RTE_DMA_DIR_MEM_TO_DEV.
> + *
> + * @see struct rte_dma_vchan_conf::mem_to_dev_src_buf_pool
> + */
> +#define RTE_DMA_OP_FLAG_FREE_SBUF	RTE_BIT64(3)
>  /**@}*/
> 
>  /**
> --
> 2.25.1
  

Patch

diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index b157ab7600..d6a685907f 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -278,6 +278,13 @@  int16_t rte_dma_next_dev(int16_t start_dev_id);
 #define RTE_DMA_CAPA_OPS_COPY_SG	RTE_BIT64(33)
 /** Support fill operation. */
 #define RTE_DMA_CAPA_OPS_FILL		RTE_BIT64(34)
+/** Support for source buffer free for mem to dev transfer.
+ *
+ * @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_MEM_TO_DEV_SOURCE_BUFFER_FREE	RTE_BIT64(35)
 /**@}*/
 
 /**
@@ -581,6 +588,19 @@  struct rte_dma_vchan_conf {
 	 * @see struct rte_dma_port_param
 	 */
 	struct rte_dma_port_param dst_port;
+	/** mempool from which source buffer is allocated. mempool info is used
+	 * for freeing source buffer by hardware when configured direction is
+	 * RTE_DMA_DIR_MEM_TO_DEV. To free the source buffer by hardware,
+	 * RTE_DMA_OP_FLAG_FREE_SBUF must be set while calling rte_dma_copy and
+	 * rte_dma_copy_sg().
+	 *
+	 * @note If the mempool is not supported by the DMA driver,
+	 * rte_dma_vchan_setup() will fail.
+	 *
+	 * @see RTE_DMA_OP_FLAG_FREE_SBUF
+	 */
+	struct rte_mempool *mem_to_dev_src_buf_pool;
+
 };
 
 /**
@@ -818,6 +838,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)
+/** Mem to dev source buffer free flag.
+ * Used for freeing source DMA buffer by hardware when the transfer direction is
+ * configured as RTE_DMA_DIR_MEM_TO_DEV.
+ *
+ * @see struct rte_dma_vchan_conf::mem_to_dev_src_buf_pool
+ */
+#define RTE_DMA_OP_FLAG_FREE_SBUF	RTE_BIT64(3)
 /**@}*/
 
 /**