From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com
 [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 5A68C8E01
 for <dev@dpdk.org>; Thu,  4 Jan 2018 17:01:40 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 0750220C82;
 Thu,  4 Jan 2018 11:01:40 -0500 (EST)
Received: from frontend1 ([10.202.2.160])
 by compute1.internal (MEProxy); Thu, 04 Jan 2018 11:01:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:date:from:in-reply-to:message-id:references:subject:to
 :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=VCwP/x9uYXkxsv
 jGUG1EZGY7iK431zuFHAkq8NhacnE=; b=KaW/74hfeFxvnrsuDwmoMvZWLpNi3v
 G5lYsyAYQsojTs610uD8O60S/OSh02XsLQS0tMk1K/Ev3q/kzgmwCktIEYlx1MTy
 6UbosYoo1ngLnWaXD+gjK91nPfC1OjfmOAXl//tH80al/xzH/M8j/Tk2IwxkIuPE
 qGHFEm5H8hdTo=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:date:from:in-reply-to:message-id
 :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm1; bh=VCwP/x9uYXkxsvjGUG1EZGY7iK431zuFHAkq8NhacnE=; b=AjqNQcbf
 VZThOqw13R9iVdSIcoXZBublA4ZyEjf/GmL8kC41CojRj7TnPUdWES66K08eJ7vf
 UjtKJB1rse6bIpbk6n4GH35BBeDJ6miBvTjhDUeYcbGmBDUneZ53mjrD44zB9lRm
 BHAGmdzI59b5AD1f5AkWIr9lUKJfB3XexYmkaKPN4FK6wMDYz2+Pc5riYudEN1rn
 xir09AC+YigcpRFiMGGutRgJe1VqQ1DGTSGmYo3W77U8yaWL/c8bRL0wpjaJchAC
 p0GpbMAp0hY5zY/9zo25zOUX3geOKkh7GoE/xeWPth5FvD7nqbzskfVKH+FHF7KM
 YfiduTuxkxlHqA==
X-ME-Sender: <xms:409OWvrPY8sWk4WdkMt0TCUZwDkcWjNxGtZYu9-t8HJRZr9YWYj4IQ>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 419757E17D;
 Thu,  4 Jan 2018 11:01:39 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Matan Azrad <matan@mellanox.com>
Date: Thu,  4 Jan 2018 17:01:10 +0100
Message-Id: <20180104160112.28651-4-thomas@monjalon.net>
X-Mailer: git-send-email 2.15.1
In-Reply-To: <20180104160112.28651-1-thomas@monjalon.net>
References: <20171128221302.15400-1-thomas@monjalon.net>
 <20180104160112.28651-1-thomas@monjalon.net>
Subject: [dpdk-dev] [PATCH v4 3/5] ethdev: free detached port by the
	dedicated function
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Jan 2018 16:01:40 -0000

From: Matan Azrad <matan@mellanox.com>

In the port detach function, use the function to free an ethdev port
instead of changing its state directly.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: no change
v3: no change
v4: no change
---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 7b440fc6b..8700f6f43 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -436,7 +436,7 @@ rte_eth_dev_detach(uint16_t port_id, char *name)
 	if (ret < 0)
 		goto err;
 
-	rte_eth_devices[port_id].state = RTE_ETH_DEV_UNUSED;
+	rte_eth_dev_release_port(&rte_eth_devices[port_id]);
 	return 0;
 
 err:
-- 
2.15.1