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 1A085A04C0; Mon, 28 Sep 2020 01:45:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9A3501D62F; Mon, 28 Sep 2020 01:43:34 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 519D81D618 for ; Mon, 28 Sep 2020 01:43:25 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E9A325C00DA; Sun, 27 Sep 2020 19:43:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 27 Sep 2020 19:43:23 -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; s=fm2; bh=J/a5+lLBDkAqa 4T4mk/W2s2wrEw2u4L3/IOHA1X26j4=; b=n6NsJpl+/QmQFk5ZY2+3aeZrDSbou xE2FE0dUqCmD3Nh3+iMrJXy/8FgHIkfR2WUVluFv2Gx420gtCZ8J0KvKALyV5wDo 19XcAi/u1ZN4OrvnkZYAnz3LHWSQLpa5dl7Uh2SBPnhumOhwMb1GKEZJmYhi0uu2 h/p3/ln4Dec8Gh8TCRPO/HMhWEO5AK8DAQ/nH6iEqC2dtYKTXKQbCGGd5p6gppTl 2jqwtHcFFvqiQoXy74dxUdhFtB8jxxndi9N49SRtc/7J0ccebKbR4P5MyPDQ0esh Qb7tQEIV3cm78iXHkoc4szSDQcKMd1Dt4hdHFop+Mz+TQYbEDWVOAabuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=J/a5+lLBDkAqa4T4mk/W2s2wrEw2u4L3/IOHA1X26j4=; b=RFtDVcBn i8Kmd9kcOyOsk2LyDMdGnnjH2I61eQr5kRepD1BYMdT6ZIoXPxTbD9MAAGJ2Lp4Z /FmOt0nMtRwuUJ/DUUJ3fbImzs2hfySjTLUUconYXEy5Zgw+YWVRmDRS9N9vBhey UGyp8bK1piso8MTGkrruXWVvbkBJ78Qm4GxSSNz+3jDRf9iPi4opNoC7VRqu1beB wtBo6KnnLKBJlvENkqCPgAu8ay7GB2lvdgIEbHhlrXY2Fs6D5CRoUuDEtddVuMkE dJJ/lZoEL6rG4fH9HSqzdMbESvtmXow9bbNRoAL6yOa3ki/6lp8LOgGa1CuBywtw ZwZ7lvtByghzMQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepjeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id F1751328005A; Sun, 27 Sep 2020 19:43:22 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Rasesh Mody , Shahed Shaikh , Anatoly Burakov Date: Mon, 28 Sep 2020 01:42:30 +0200 Message-Id: <20200927234249.3198780-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200927234249.3198780-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200927234249.3198780-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 06/25] net/bnx2x: 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" From: Rasesh Mody Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources for the port can be freed by rte_eth_dev_close(). With this change the private port resources are released in the .dev_close callback. Signed-off-by: Rasesh Mody --- drivers/net/bnx2x/bnx2x_ethdev.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 73217c2138..8dc46384af 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -287,6 +287,10 @@ bnx2x_dev_close(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(sc); + /* only close in case of the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + if (IS_VF(sc)) bnx2x_vf_close(sc); @@ -296,6 +300,9 @@ bnx2x_dev_close(struct rte_eth_dev *dev) /* free ilt */ bnx2x_free_ilt_mem(sc); + /* mac_addrs must not be freed alone because part of dev_private */ + dev->data->mac_addrs = NULL; + return 0; } @@ -728,6 +735,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) goto out; } + /* Pass the information to the rte_eth_dev_close() that it should also + * release the private port resources. + */ + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + return 0; out: @@ -755,8 +767,9 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev) static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev) { - /* mac_addrs must not be freed alone because part of dev_private */ - eth_dev->data->mac_addrs = NULL; + struct bnx2x_softc *sc = eth_dev->data->dev_private; + PMD_INIT_FUNC_TRACE(sc); + bnx2x_dev_close(eth_dev); return 0; } -- 2.28.0