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 3DCEEA0C4D; Wed, 13 Oct 2021 09:42:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC32E41166; Wed, 13 Oct 2021 09:42:03 +0200 (CEST) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by mails.dpdk.org (Postfix) with ESMTP id 8EF3341162 for ; Wed, 13 Oct 2021 09:42:02 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 34CD65802AA; Wed, 13 Oct 2021 03:42:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 13 Oct 2021 03:42:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= pdOVz7MH7WVORdMzA83PX3SBvuRith/JyBkjOWAUVrk=; b=UoXWZwWKsMQmKu8z XK//Do+iu555E+8QLlEfFD5YIKpmo0Tm/HdbVdJP+E8siDkPyWIEpTFZ6ZxD+BCX siBIzg2INRyK7h5d1bg9AABOCMnyBDp6RjcEoT7ULJ6SqPOQEF64xAkA0CmBtuQK /dUDRReZTiht6E80k7MIIxpUqguR2+033MEVJS9a966vm7phgEjRRiOwKyfy6Ysu nJ8mbjbSdoeCJJV6LGGx54y7GJUMMraJWkxahfhN9TUGfb8ocJS28MAuBwpi60NX GmqnBGO+j8qkx5JSL6bYB5PxeRXB8jigBwHi99CkNokN9Dfj6cyK8P9JCDW38AVE xLFqWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=pdOVz7MH7WVORdMzA83PX3SBvuRith/JyBkjOWAUV rk=; b=bkG5zqnLpifLU6ez3gDJRDQX3Ts4QnK+KBiMpoMRo4tUNB8ar+aVHVVqY 9Zvs5SZsi0kE8kS6NQ/j28dn9XY8kqMbRTbTOd4CsWSpWjUu8cwLZAohzXiB8lMO YqrYZj+bg9eN1NJypZPSP/H6DS9IfTSjVI5tkT+6Y8438Dzy0n8llMm6ABgm8qea 4RwaVN1G+T2H3I/D9gVLDSYBoDup47mT05yRTtkPrd35UD5KXiSr6igAmpm9XoAR CoIxtgbhP7GvJbeZcCk4e4nyRHu6dVqBdsdc2BXZhVYquP7pZ1L57HVWimN2JqL4 H+QQ7mCBoTIyc3pOI5tBUNEVdKAPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtledguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgjfhgggfgtsehtuf ertddttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghs sehmohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepudeggfdvfeduffdtfe eglefghfeukefgfffhueejtdetuedtjeeuieeivdffgeehnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonh drnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Oct 2021 03:41:57 -0400 (EDT) From: Thomas Monjalon To: fengchengwen Cc: ferruh.yigit@intel.com, bruce.richardson@intel.com, jerinj@marvell.com, jerinjacobk@gmail.com, andrew.rybchenko@oktetlabs.ru, dev@dpdk.org, mb@smartsharesystems.com, nipun.gupta@nxp.com, hemant.agrawal@nxp.com, maxime.coquelin@redhat.com, honnappa.nagarahalli@arm.com, david.marchand@redhat.com, sburla@marvell.com, pkapoor@marvell.com, konstantin.ananyev@intel.com, conor.walsh@intel.com, kevin.laatz@intel.com Date: Wed, 13 Oct 2021 09:41:54 +0200 Message-ID: <1801913.4R2s7ZJTnX@thomas> In-Reply-To: <0e44a184-3540-bb2e-28c7-ba4b0fc4df98@huawei.com> References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <5838181.K3ZB3fOEaN@thomas> <0e44a184-3540-bb2e-28c7-ba4b0fc4df98@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v25 1/6] dmadev: introduce DMA device library 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 Sender: "dev" 13/10/2021 02:21, fengchengwen: > On 2021/10/13 3:09, Thomas Monjalon wrote: > > 11/10/2021 09:33, Chengwen Feng: > >> +static void > >> +dma_release(struct rte_dma_dev *dev) > >> +{ > >> + rte_free(dev->dev_private); > >> + memset(dev, 0, sizeof(struct rte_dma_dev)); > >> +} [...] > >> +int > >> +rte_dma_pmd_release(const char *name) > >> +{ > >> + struct rte_dma_dev *dev; > >> + > >> + if (dma_check_name(name) != 0) > >> + return -EINVAL; > >> + > >> + dev = dma_find_by_name(name); > >> + if (dev == NULL) > >> + return -EINVAL; > >> + > >> + dma_release(dev); > >> + return 0; > >> +} > > > > Trying to understand the logic of creation/destroy. > > skeldma_probe > > \-> skeldma_create > > \-> rte_dma_pmd_allocate > > \-> dma_allocate > > \-> dma_data_prepare > > \-> dma_dev_data_prepare > > skeldma_remove > > \-> skeldma_destroy > > \-> rte_dma_pmd_release > > \-> dma_release > > This patch only provide device allocate function, the 2st patch provide extra logic: > > diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c > index 42a4693bd9..a6a5680d2b 100644 > --- a/lib/dmadev/rte_dmadev.c > +++ b/lib/dmadev/rte_dmadev.c > @@ -201,6 +201,9 @@ rte_dma_pmd_release(const char *name) > if (dev == NULL) > return -EINVAL; > > + if (dev->state == RTE_DMA_DEV_READY) > + return rte_dma_close(dev->dev_id); > + > dma_release(dev); > return 0; > } > > So the skeldma remove will be: > > skeldma_remove > \-> skeldma_destroy > \-> rte_dma_pmd_release > \-> rte_dma_close > \-> dma_release OK, in this case, no need to dma_release from rte_dma_pmd_release, because it is already called from rte_dma_close.