From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13666A04C9; Sun, 13 Sep 2020 10:53:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF8901DB9; Sun, 13 Sep 2020 10:53:20 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id BF3C9E07 for ; Sun, 13 Sep 2020 10:53:19 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0B92C5C013A; Sun, 13 Sep 2020 04:53:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 04:53:19 -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= RMWhf0wMCbJSILs7GaRZXQccKnXhZzdu5RiejOx6C54=; b=LuC3K2Nts3WgJNRj 4Kyymj6PSLquKvLXdzVe/BjE9WQ1QRUo5y30Qo/DfDkv9WsEWmCTojda4pLoVNQK Z5UOKbhFm5X6hkBBJF6fHqbQeAFGfyoMXsG1CEZV1nxh2JgIXyYiWPHU0eOm5CF/ R+7q4dZbU0HzYPd98fo5mxb6/zUzVmaHX2PmTFgKVoPO8UA06rn52lLiqVbKbUh5 v9NZT/XW/aRMTT2RBE8yQwObDt32p8kYpWSNfXxCXcBeewynWI9tse+FJDdSlRx7 5NVVP1EFnKU5dCY1npe7W4eOTGwwOKqJBGGP758/OlxVHNAxE1fmNa+jaZb9rqoF 771pvg== 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=fm3; bh=RMWhf0wMCbJSILs7GaRZXQccKnXhZzdu5RiejOx6C 54=; b=BnlUTdGXWYseygw6pmr7dXN3NjOhrcdHtPJNEnCD/w7nZ2itasCNtqK8r JGucPotAiOsIrU7h7ZvRfB6SnMcwLHIjTHs9cGORVKk1/z+0hUbtwoX6mcgAgWvr lhGmiHOTN8ctaATnHCaKxMGZfSEHIy7gdO7EiijYI15YAyWmLVhol6I8X/xADKrA 3lBSTdlwJCA3W4umLYNPSu/AwlgN0TV5msiHhkup7+2QlexceviLWDsZlIf2Ccva AEz0ti9G20PDR5UVqhUWLs/G90midON/mrhBl8uggEXjmDvco9OpsjXuvpdA3U0m PSXkPfiq52UDS8FlCnAM8aGqUGhSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeifedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 96670328005E; Sun, 13 Sep 2020 04:53:17 -0400 (EDT) From: Thomas Monjalon To: SteveX Yang Cc: qiming.yang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com, dev@dpdk.org, Qi Zhang , ferruh.yigit@intel.com Date: Sun, 13 Sep 2020 10:53:15 +0200 Message-ID: <2832850.hRueZzFlNT@thomas> In-Reply-To: <20200811072752.20813-1-stevex.yang@intel.com> References: <20200811072752.20813-1-stevex.yang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] net/iavf: release port upon close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi, SteveX Yang wrote: > Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources > for the port can be freed by rte_eth_dev_close(). > > Signed-off-by: SteveX Yang I guess the X is not part of your name. [...] > -static int > -iavf_dev_uninit(struct rte_eth_dev *dev) > -{ > - struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); > - > - if (rte_eal_process_type() != RTE_PROC_PRIMARY) > - return -EPERM; All the code below is moved from iavf_dev_uninit() where it was restricted to the primary process, to iavf_dev_close() which can be called from the primary process. It looks inconsistent. > > dev->dev_ops = NULL; > dev->rx_pkt_burst = NULL; > dev->tx_pkt_burst = NULL; > > - iavf_dev_close(dev); > + > + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) { > + if (vf->rss_lut) { > + rte_free(vf->rss_lut); > + vf->rss_lut = NULL; > + } > + if (vf->rss_key) { > + rte_free(vf->rss_key); > + vf->rss_key = NULL; > + } > + } > > rte_free(vf->vf_res); > vf->vsi_res = NULL; > > @@ -1449,15 +1456,15 @@ iavf_dev_uninit(struct rte_eth_dev *dev) > > rte_free(vf->aq_resp); > vf->aq_resp = NULL; > > +} > > - if (vf->rss_lut) { > - rte_free(vf->rss_lut); > - vf->rss_lut = NULL; > - } > - if (vf->rss_key) { > - rte_free(vf->rss_key); > - vf->rss_key = NULL; > - } > +static int > +iavf_dev_uninit(struct rte_eth_dev *dev) > +{ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return -EPERM; > + > + iavf_dev_close(dev); Are you sure about what should be freed in the secondary process? If iavf_dev_close() should not be called by the secondary process, you should move the check inside the function, because iavf_dev_close() is also called by rte_eth_dev_close(). > > return 0; > > }