From 336f20bc5ee26efa6495f697b743f1bba8778afc Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 24 Oct 2018 15:12:32 +0200 Subject: [PATCH] ethdev: filter destroy event before probed If a port is being created and rollbacked because of an error, the event RTE_ETH_EVENT_DESTROY should not be sent. It makes no sense to receive a destroy event for a port which was not yet announced via RTE_ETH_EVENT_NEW. Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- lib/librte_ethdev/rte_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 767fd8df9e..53d1a436f1 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -513,7 +513,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) rte_eth_dev_shared_data_prepare(); - _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL); + if (eth_dev->state != RTE_ETH_DEV_UNUSED) + _rte_eth_dev_callback_process(eth_dev, + RTE_ETH_EVENT_DESTROY, NULL); rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); -- 2.20.1