On 1/14/2020 5:14 AM, Ajit Khaparde wrote: > From: Somnath Kotur <somnath.ko...@broadcom.com> > > Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources > for the port can be freed by rte_eth_dev_close(). > > Signed-off-by: Somnath Kotur <somnath.ko...@broadcom.com> > Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.pura...@broadcom.com> > Reviewed-by: Ajit Khaparde <ajit.khapa...@broadcom.com> > --- > drivers/net/bnxt/bnxt_ethdev.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index ba3f0a7d9..8acfade5f 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -4856,6 +4856,11 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) > if (rc) > goto error_free; > > + /* Pass the information to the rte_eth_dev_close() that it should also > + * release the private port resources. > + */ > + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; > +
When you give this flag, 'rte_eth_dev_close()' will release port resources, it will memset the 'eth_dev->data'. In case user first closed the port, later removed it, remove path should be safe for it. I can see 'bnxt_dev_uninit()' operates on the values of 'eth_dev->data' which should crash in this case. Can you please double check the return path, all following should be safe: - close the port - remove the port - close and remove the port