From: Kalesh AP Date: Fri, 28 Feb 2020 10:21:31 +0000 (+0530) Subject: net/bnxt: fix recovery alarm race condition in port close X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=10d698200824060dbe6171c94a7b20380b624f1a net/bnxt: fix recovery alarm race condition in port close There is a race condition when port is closed while error recovery is happening in driver. Fixed this by canceling the recovery threads during port close. Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Santoshkumar Karanappa Rastapur --- diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 18aa313fd8..b8b30ed3ff 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -133,6 +133,7 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev); static int bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev); static void bnxt_cancel_fw_health_check(struct bnxt *bp); static int bnxt_restore_vlan_filters(struct bnxt *bp); +static void bnxt_dev_recover(void *arg); int is_bnxt_in_error(struct bnxt *bp) { @@ -980,6 +981,10 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; + /* cancel the recovery handler before remove dev */ + rte_eal_alarm_cancel(bnxt_dev_reset_and_resume, (void *)bp); + rte_eal_alarm_cancel(bnxt_dev_recover, (void *)bp); + if (eth_dev->data->dev_started) bnxt_dev_stop_op(eth_dev);