21/05/2018 18:37, Ferruh Yigit: > On 5/19/2018 3:19 PM, Thomas Monjalon wrote: > > 18/05/2018 18:29, Ferruh Yigit: > >> On 5/18/2018 4:55 PM, Matan Azrad wrote: > >>> Hi all > >>> > >>> While this patch also applied I don't understand it. > >>> Is it mandatory for each PMD to free all its resources in dev_close()? > >>> Or it should be done by the rte_device remove function? > >>> > >>> If the resource cleanup should be done by the remove function I think it > >>> should be called for all the devices (pci, vdev, etc). > >>> > >>> Is there an exit function for EAL to clean rte_eal_init()? If no, looks > >>> like we need it... > >> > >> Hi Matan, > >> > >> I believe there is a gap in resource cleanup. > >> dev_close() it not for resource cleanup, it should be in PMD remove() > >> functions, > >> and PMDs have it. The problem is remove path is not called in application > >> exit. > >> > >> As far as I know there is no simple API to clean the resources, having it > >> may > >> help application to do the cleanup. > >> > >> I have seen the rte_eal_cleanup() API by Harry, that can be extended to > >> cover > >> PMD resource cleanup if there is enough motivation for it. > > > > Yes, EAL resources should be removed by the function rte_eal_cleanup(). > > And ethdev ports must be removed by rte_eth_dev_close(). > > There is probe() and remove() functions. > There is dev_close devops, called by rte_eth_dev_close(), but there is no > open() > or equivalent. > > For example an ethdev allocated its private data during probe(), if > rte_eth_dev_close() free it, how can a new ethdev can be allocated?
I don't understand the question. You say closing a port and opening a new one. So we allocate private data in the new probe.