30/04/2019 14:45, Nithin Dabilpuram: > On Mon, Apr 29, 2019 at 10:30:00PM +0200, Thomas Monjalon wrote: > > 29/04/2019 18:51, Ferruh Yigit: > > > I would like to detail a little more what needs to be done, mainly for > > > the sake > > > of the discussion, please comment if something missing/wrong. > > > > > > There are two exit paths for driver: > > > 1) Hotplug remove the device > > > rte_dev_remove() OR rte_eal_hotplug_remove() > > > > > > 2) Application exit: > > > rte_eth_dev_close() > > > > > > > > > (1) can be called without ethdev stop and close functions called, so the > > > path > > > should cover those functions. > > > And in the PMD entry point in this path is .remove() function. In this > > > .remove() > > > function PMD should: > > > - stop forwarding > > > - clean PMD private resources (dev_close() ? ) > > > > yes > > > > > - clean ethdev generic resources (rte_eth_dev_release_port() ? ) > > > > already done in dev_close thanks to RTE_ETH_DEV_CLOSE_REMOVE > > > > > - remove device resources, which already done by remove APIs > > > > There can be some specific PMD private resources, > > not cleaned when closing a port, to clean in "remove". > > > > > (2) ethdev won't be usable after "rte_eth_dev_close()" and it should > > > clear PMD > > > private and ethdev generic resources. > > > With RTE_ETH_DEV_CLOSE_REMOVE flag 'rte_eth_dev_close()' will free generic > > > ethdev resources (rte_eth_dev_release_port()) so PMD specific > > > '.dev_close()' should: > > > - stop forwarding > > > - clean PMD private resources > > > > yes, but only port-related resources, > > not those common with other ports or features of the device. > I have a related query. Even after rte_eth_dev_close(), we have to call > rte_eal_hotplug_remove() to free up common resource if any > and remove the device from application ? > And rte_eal_hotplug_remove() would still call drivers .remove function for > this.
Yes if you really want to free the whole device, you should call the .remove op from rte_eal_hotplug_remove() or rte_dev_remove().