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 43F21A04C0; Tue, 29 Sep 2020 01:16:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 820251D902; Tue, 29 Sep 2020 01:15:18 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 4EE0C1D725 for ; Tue, 29 Sep 2020 01:15:03 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id DE0BB5C01A2; Mon, 28 Sep 2020 19:15:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:15: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; s=fm2; bh=J/a5+lLBDkAqa 4T4mk/W2s2wrEw2u4L3/IOHA1X26j4=; b=gzq/SETjkVvh1mLCKNNvVzR1uksP2 /dJfON2dP3YhjlaePEAaH9uIPN2UiUBmcJZWHYbq+eNXgMAvKkTGJrM6DqftAKQW 19Xs+CbIcDG/jrqobb7Uq01x+icDH6h3ASa21KTUHWewuZ91Eb7K40meGY2xoG58 bRaKkmzmKAGb9UyhRMPFjezTj3Op8RMKNnU5OFdX8Do6GzH6CxW8fGZNT4Uz+WhR IOOmNHrkREwPFQ2qJP+dvAMubWd1mH1YwlJkPDunT9TPldxq/CE7Z0QZQvoXNK3V gNy1x+qY/VQgAipvrzAvlvuWTaBr85QRm519ve4VWrKvqm/kNj0eETMig== 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=hOLYwu61 O6A8lod0sH201WEUU4GkcsGj1PVkBdgFhWTIgRANBx7bmbiR0Xzw2JcgOLO+INBx 4suwQ8K9MEJj6YQp23l6I/lwMmqoL6Fgv1UOA4GtUuYM3EDJpXDgRCeonko1qJCl W9KVO/eyUmMsIBQ5/0MQj9a/z5orlhQ2vvh3fFg6+5M3Hqc9hkbBvXXLIbumA2FC NM9Cpydb/hqjM8Cb6THqpBpRMnMBp8kSNwPdZO3gucB5x4XvUgB3myiXRc4/cRv0 xdgq1mkc9xjX2TyI7TOO0QaUdzKqV73ki75bPbhFxqgYcZF7QTbm8LKZxEDLRehS 0U1R86gZ4uzrhg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepheenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 A2082306467D; Mon, 28 Sep 2020 19:15:01 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Rasesh Mody , Shahed Shaikh , Anatoly Burakov Date: Tue, 29 Sep 2020 01:14:14 +0200 Message-Id: <20200928231437.414489-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928231437.414489-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200928231437.414489-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 06/29] 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