[dpdk-dev] [PATCH 20.05] ethdev: clear struct on releasing port
thomas at monjalon.net
Thu Feb 13 16:27:53 CET 2020
13/02/2020 16:16, Ferruh Yigit:
> On 2/13/2020 2:33 PM, Thomas Monjalon wrote:
> > The function rte_eth_dev_release_port() is called by drivers
> > when closing or removing a device.
> > Its main usage should be via rte_eth_dev_close() by up-to-date
> > drivers which are compliant with RTE_ETH_DEV_CLOSE_REMOVE flag.
> > When a port is released, the data (rte_eth_dev_data) are cleared,
> > but the pointers in rte_eth_dev were not cleared.
> > It may cause issues with code paths trying to use dangling pointers
> > (e.g. the .device pointer which may reference a removed rte_device).
> > Everything is now cleared to 0 when releasing.
> > The state is explicitly set to RTE_ETH_DEV_UNUSED which is 0 anyway.
> > Using this patch may reveal bugs in some code paths:
> > - device pointer must be saved before closing a port if needed
> Is this saving should be done in application code or will be done by ethdev?
by the application
>From ethdev point of view, when a port is closed, there is nothing more to do next.
More information about the dev