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 248D7A0C4B; Fri, 15 Oct 2021 10:29:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1401740692; Fri, 15 Oct 2021 10:29:30 +0200 (CEST) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by mails.dpdk.org (Postfix) with ESMTP id 1B4C440041 for ; Fri, 15 Oct 2021 10:29:29 +0200 (CEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A010C580EF5; Fri, 15 Oct 2021 04:29:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 15 Oct 2021 04:29:28 -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= 7WzL93ZrLCU8jOUsntESKUy9sFReOssg90pyGQmVwlE=; b=LNjZoDmW/qtdHMJh s+FVTbzEiXzUDPb1rXz6Ak7YLQCz5tBZ1toIZ+VVeeIF/jwgERd5FEwHfAE7G/Oy GTwjOxkZc1ni6RlJiN5vrKwhRX5MN56rQ5umrMdZ2WtBchIbux0qlgN7G5Ew9YZw /u8+vTYnW6ZexIp6WN7/p2QqGTga2+UHl5L8AkGV1rKES+KGuRSjcfydxWy9uN1T GgnOrfxSfheje2gwCynUYzvk/ytFiy9db6l3hwtYIevl0beFEAVCwl3zFmdsp/k9 EW6c5SuPj6IZCQLW8aKx7Qq5XSLTqIUFnRu0hMYaidnLrWxg+j9jzx0Dhj3snpXN IYVabw== 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=7WzL93ZrLCU8jOUsntESKUy9sFReOssg90pyGQmVw lE=; b=kIJq+h/Ygl0wcftU7+SqM+FZC9ELTPPH5uzEZ0LQipZ6nZrWIvOiM/unx SfK884Ad6iWJ8t/fRZljffNBGI9dLRGBfay4SzwG17Rseb0hD/LPJMOhITEBLtCO UJ37TOzHxt02O1ZLZEWu4mIFDSdoK+zwqMvi5dMi8bojrly9IBGDERL4x4/+avo9 gerewBdkfYiybOfd5G+Q31HJ9cRpXScUtySuubdWtdKqPzVdDP3LFrXESa99sqBj zouUkUFynZ82sPma1E9ZZu3aRVu15joZ1rNYjic3M/CJiZiVL7sPmdoceXKCLJg5 KFxxKhBDlauXuczjpvAWvzL59sa/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddugedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkjghfggfgtgesthfure dttddtvdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedugefgvdefudfftdefge elgffhueekgfffhfeujedtteeutdejueeiiedvffegheenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrd hnvght X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Oct 2021 04:29:23 -0400 (EDT) From: Thomas Monjalon To: fengchengwen Cc: dev@dpdk.org, 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: Fri, 15 Oct 2021 10:29:21 +0200 Message-ID: <2810284.T8RqjUy1RU@thomas> In-Reply-To: <1801913.4R2s7ZJTnX@thomas> References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <0e44a184-3540-bb2e-28c7-ba4b0fc4df98@huawei.com> <1801913.4R2s7ZJTnX@thomas> 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 09:41, Thomas Monjalon: > 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. Ping for reply please.