From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64DA242534; Thu, 7 Sep 2023 10:11:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60E36402DA; Thu, 7 Sep 2023 10:11:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E084C402D9 for ; Thu, 7 Sep 2023 10:10:58 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3876uQ7I002406; Thu, 7 Sep 2023 01:10:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0220; bh=MOEgQgWwGhbYkpCIEEhxyB/A9+dwwt4yQigBwFhoQg8=; b=USjlK+QtyCARpFl8FornYrOE/IwpVt+xG2Ygs3hwPfor0mUBbv5H2/CyIpwMcmUK0y0L S7U0YkZ+LIFcp7lweDci6lwgtV9SUZcG9G4qi/TrMem2uQ0b3dK19nq4bLnnWEZEOoZS JvdhkJY1R0ngxi/jiQxiKyT8qMnc9U23BYu6BlhwopEcPzMnZiKd9B0ZpLcVk/H+Http MTNQd/2ycjJYE9JvJ0Y5Fq2SsqfoHIRugiyYw80WQ5XIPbAOgvAiU0VTJ7r8N6sYW0r0 2Z9ny0dDVIF6HltqjQ+00BpZI4jboq3hiijHalSYQP0ft6fh+B9TKtllutTU1rA7QrBQ ww== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3sv4jkjcr7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Sep 2023 01:10:58 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 7 Sep 2023 01:10:56 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 7 Sep 2023 01:10:56 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id E27025B6963; Thu, 7 Sep 2023 01:10:51 -0700 (PDT) From: Amit Prakash Shukla To: Chengwen Feng , Kevin Laatz , Bruce Richardson CC: , , , , , , , , , , Amit Prakash Shukla , =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH v1 1/2] dmadev: offload to free source buffer Date: Thu, 7 Sep 2023 13:40:39 +0530 Message-ID: <20230907081040.1002478-2-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230907081040.1002478-1-amitprakashs@marvell.com> References: <20230907081040.1002478-1-amitprakashs@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: rG3tCUdkisQoZ9VuICPVv6FVM56TIua8 X-Proofpoint-ORIG-GUID: rG3tCUdkisQoZ9VuICPVv6FVM56TIua8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-06_12,2023-09-05_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Morten Brørup --- 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