From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Rybchenko Subject: Re: [PATCH v6 6/6] ethdev: complete closing of port Date: Fri, 19 Oct 2018 13:13:06 +0300 Message-ID: References: <20180907233929.21950-1-thomas@monjalon.net> <20181019020757.27698-1-thomas@monjalon.net> <20181019020757.27698-7-thomas@monjalon.net> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , To: Thomas Monjalon , Return-path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 581851B4EA for ; Fri, 19 Oct 2018 12:13:54 +0200 (CEST) In-Reply-To: <20181019020757.27698-7-thomas@monjalon.net> Content-Language: en-GB List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/19/18 5:07 AM, Thomas Monjalon wrote: > After closing a port, it cannot be restarted. > So there is no reason to not free all associated resources. > > The last step was done with rte_eth_dev_detach() which is deprecated. > Instead of blindly removing the associated rte_device, the driver should > check if no more port (ethdev, cryptodev, etc) is open for the device. > > The last ethdev freeing which were done by rte_eth_dev_detach(), > are now done at the end of rte_eth_dev_close() if the driver supports > the flag RTE_ETH_DEV_CLOSE_REMOVE. > There will be a transition period for PMDs to enable this new flag > and migrate to the new behaviour. > When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all its > private resources for the port, in its dev_close function. > It is advised to call the dev_close function in the remove function > in order to support removing a device without closing its ports. > > Some drivers does not allocate MAC addresses dynamically or separately. > In those cases, the pointer is set to NULL, in order to avoid wrongly > freeing them in rte_eth_dev_release_port(). > > A closed port will have the state RTE_ETH_DEV_UNUSED which is > considered as invalid by rte_eth_dev_is_valid_port(). > So validity is not checked anymore for closed ports in testpmd. > > Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko I really like the idea with RTE_ETH_DEV_CLOSE_REMOVE. As I understand it should applied to dpdk-next-net, but right now there are conflicts in net/tap (patch 4).