From 0264539dce2d40d8abaed474d4b1b526ca3ed2e4 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Tue, 20 Mar 2018 15:01:24 +0800 Subject: [PATCH] net/i40e: fix intr callback unregister by adding retry The nic's interrupt source has some active callbacks, when the port hotplug. Add a retry to give more port's a chance to uninit before returning an error. Fixes: d42aaf30008b ("i40e: support port hotplug") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Reviewed-by: Kirill Rybalchenko Acked-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f9408b0e74..d0bf4e349d 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1505,6 +1505,7 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev) struct rte_flow *p_flow; int ret; uint8_t aq_fail = 0; + int retries = 0; PMD_INIT_FUNC_TRACE(); @@ -1546,9 +1547,20 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev) /* disable uio intr before callback unregister */ rte_intr_disable(intr_handle); - /* register callback func to eal lib */ - rte_intr_callback_unregister(intr_handle, - i40e_dev_interrupt_handler, dev); + /* unregister callback func to eal lib */ + do { + ret = rte_intr_callback_unregister(intr_handle, + i40e_dev_interrupt_handler, dev); + if (ret >= 0) { + break; + } else if (ret != -EAGAIN) { + PMD_INIT_LOG(ERR, + "intr callback unregister failed: %d", + ret); + return ret; + } + i40e_msec_delay(500); + } while (retries++ < 5); i40e_rm_ethtype_filter_list(pf); i40e_rm_tunnel_filter_list(pf); -- 2.20.1