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 B6611A04B1; Wed, 23 Sep 2020 23:24:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6BE551DB48; Wed, 23 Sep 2020 23:24:13 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 104B91DB47 for ; Wed, 23 Sep 2020 23:24:12 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A4BAB5C007F; Wed, 23 Sep 2020 17:24:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 23 Sep 2020 17:24:11 -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= Lg+ZvEOJRfEFs0JIX+i3GGYwY95XDJ99ooYwueUcHFo=; b=lqT6k/5kMcZ/aLIq F9UBAnHO8HH7d4x2VBkOQFeMAKaC/RSElVPQytirWdSkX4eoS6r8mPGV8cDzG5qR sKfVJz8meoFr7+BT7qy+AGx/s7F09qV1eWzHTzcf0aqIs7SNJOcmuqmaSFIl0+Ax z3vO0EZROB4sOhBlpcz1Ty3kKnN2jshuPRMvE0dg6ISTuWjM80l5ioBMs3UQBoAL /wkoubghsYPU18BxHCThT/4NMZN7+LvXl1dlVGESTlzIYNNm6k4f32wA9lMHg1X5 9SaOxHcbtee9esI2W7t4C6zIRwdkqHE3W5+/jn0BVmawW1dSysVxg0/5/39Bmkhi 42j2mA== 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=Lg+ZvEOJRfEFs0JIX+i3GGYwY95XDJ99ooYwueUcH Fo=; b=TBALQtQPQx/WFOsOP3S2f2LGJ7KvxQdGgmUXyjNMB76Etxbx3P9bU36DS yKwOSRlZRYsgcKnDYVNZ7YF07w0DOlZGs7WfDI0FsSexK6cEBz56Bv3+eHYvRFwz xiFUhcguOmSgsGKUQGcDz88l7NIIDeawaNru5tUmkSH0yZI80JaLHM2vEjLt8kfc B9SDJXA3gjkY3HV7xbnRqMztu2kuN3IuR+hLzqbnDG9Jhqj/0rYPrt1CmAatknAx jj+Y4bLl9LHbzLGGOnQnxe+OfabGAMXEE2FmmvujBvc7bncCUXZE9kzONY3wfF4T 5CkGiWpDMHffQzrSyYzAS9rBhzJqQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeigdduiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goteeftdduqddtudculdduhedmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddt tddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmoh hnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefg hfeukefgfffhueejtdetuedtjeeuieeivdffgeehnecukfhppeejjedrudefgedrvddtfe drudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 7203A328005E; Wed, 23 Sep 2020 17:24:09 -0400 (EDT) From: Thomas Monjalon To: Thomas Monjalon Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com, Gaetan Rivet , Wael Abualrub Date: Wed, 23 Sep 2020 23:24:08 +0200 Message-ID: <7660527.JGBu4Pnyz3@thomas> In-Reply-To: <20200913220711.3768597-8-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200913220711.3768597-8-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 07/20] net/failsafe: 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" > +int > +failsafe_eth_dev_close(struct rte_eth_dev *dev) > +{ > + struct sub_device *sdev; > + uint8_t i; > + int ret; > + > + fs_lock(dev, 0); > + failsafe_hotplug_alarm_cancel(dev); > + if (PRIV(dev)->state == DEV_STARTED) > + dev->dev_ops->dev_stop(dev); > + PRIV(dev)->state = DEV_ACTIVE - 1; > + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { > + DEBUG("Closing sub_device %d", i); > + failsafe_eth_dev_unregister_callbacks(sdev); > + rte_eth_dev_close(PORT_ID(sdev)); > + sdev->state = DEV_ACTIVE - 1; > + } > + fs_dev_free_queues(dev); > + rte_eth_dev_callback_unregister(RTE_ETH_ALL, RTE_ETH_EVENT_NEW, > + failsafe_eth_new_event_callback, > dev); + ret = failsafe_eal_uninit(dev); > + if (ret) > + ERROR("Error while uninitializing sub-EAL"); > + failsafe_args_free(dev); > + rte_free(PRIV(dev)->subs); > + ret = pthread_mutex_destroy(&PRIV(dev)->hotplug_mutex); > + if (ret) > + ERROR("Error while destroying hotplug mutex"); Note to self: The mutex must be destroyed after it is unlocked below in fs_unlock(). Thanks Wael for the report. > + rte_free(PRIV(dev)->mcast_addrs); > + /* mac_addrs must not be freed alone because part of dev_private */ > + dev->data->mac_addrs = NULL; > + fs_unlock(dev, 0); > + return 0; > +}