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 79AB9A04C9; Mon, 14 Sep 2020 00:08:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4EF21C116; Mon, 14 Sep 2020 00:08:09 +0200 (CEST) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id AB5BB1C11D for ; Mon, 14 Sep 2020 00:08:07 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 9D6185D2; Sun, 13 Sep 2020 18:08:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 18:08:07 -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=ngOvjHWl0cH2V l3dYbPTd3FqULeOyMbziGqJ6T5/fww=; b=JI4/GVkjkI6RmHJ2P4GhH9YJ3zH2/ u3VPhpnnXL5y/+Jx257O+adJVCX+x8InQjEwzHpsz6zQm/4Xv7cWb9JTYQjAscn6 pRrYtQUmS56YiZGXhr1rFMOD56qcJ5d+K093MGLg6H7ChSGgbjbhu9VmarsXMMk0 HLd/HG14AcsTamKaAzuRrMNjuGiuUYHLlj7hq+YeTtwQatPRfQ7haS0YqRSXGVGN 2OHZeh60I8ofkCaZsrJx+3ZSXyjwELRsWSRaIBFghLV/lQCXmJiQm51gS4S4Ap9P RJ+uNdoklc9dWRuFfdv4/JBz/bMAjkIacMAyvaGVHemhmL2oz4a1G0shA== 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=ngOvjHWl0cH2Vl3dYbPTd3FqULeOyMbziGqJ6T5/fww=; b=OQpneZp3 QIuQeerBcFQRqUv5HiWUfZIAzgWVrTaaPwcpmAXpzJNUDod8rGv7fp273D0jFXZi C38m1jha6VXWPvynloeGkHRON/WC6QS2+/oFrirOkXA3QN3TVp0CYYlNF5nKFFuj u9UXQMD04uQzkxFbdUDF9hZ1sG7s2Heuq8t7kzbKYSmIVLS3E6/ruU/6m+PlrzJE 8Vn0HUdCzeMf2hJd+SijIPwZ6dqkH4PH15DO3FiAFXFj4CztDvp+IHP3pCRXW0hN hiKH3Ib9vP/VamTfbda5c1ol0XnS18HGSpsynLDtWkgl+exDAIb4JzxBXYPRHDHV XdvT22osbaAu1g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedutdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 6940E306467D; Sun, 13 Sep 2020 18:08:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Tetsuya Mukawa , Anatoly Burakov Date: Mon, 14 Sep 2020 00:07:01 +0200 Message-Id: <20200913220711.3768597-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200913220711.3768597-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 10/20] net/null: 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" The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources can be freed by rte_eth_dev_close(). Signed-off-by: Thomas Monjalon --- drivers/net/null/rte_eth_null.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 0ce073fa4b..33997013e4 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -458,7 +458,20 @@ eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, return 0; } +static int +eth_dev_close(struct rte_eth_dev *dev) +{ + PMD_LOG(INFO, "Closing null ethdev on NUMA socket %u", + rte_socket_id()); + + /* mac_addrs must not be freed alone because part of dev_private */ + dev->data->mac_addrs = NULL; + + return 0; +} + static const struct eth_dev_ops ops = { + .dev_close = eth_dev_close, .dev_start = eth_dev_start, .dev_stop = eth_dev_stop, .dev_configure = eth_dev_configure, @@ -532,6 +545,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, struct pmd_options *args) data->mac_addrs = &internals->eth_addr; data->promiscuous = 1; data->all_multicast = 1; + data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; eth_dev->dev_ops = &ops; @@ -701,18 +715,12 @@ rte_pmd_null_remove(struct rte_vdev_device *dev) if (!dev) return -EINVAL; - PMD_LOG(INFO, "Closing null ethdev on numa socket %u", - rte_socket_id()); - /* find the ethdev entry */ eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev)); if (eth_dev == NULL) - return -1; - - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - /* mac_addrs must not be freed alone because part of dev_private */ - eth_dev->data->mac_addrs = NULL; + return 0; /* port already released */ + eth_dev_close(eth_dev); rte_eth_dev_release_port(eth_dev); return 0; -- 2.28.0