net/bnxt: fix race between start and interrupt handler
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Thu, 24 Oct 2019 07:44:23 +0000 (13:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 25 Oct 2019 17:23:22 +0000 (19:23 +0200)
During port start, driver enables interrupts. At the end of port start
driver schedules the alarm for fw health check. This can cause race
between interrupt handler and schedule fw health check alarm thread
which falsely detects FW error.

Fixes: 9d0cbaecc91a ("net/bnxt: support periodic FW health monitoring")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 820005c..e24fd41 100644 (file)
@@ -869,7 +869,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
        bp->flags |= BNXT_FLAG_INIT_DONE;
        eth_dev->data->dev_started = 1;
        bp->dev_stopped = 0;
+       pthread_mutex_lock(&bp->def_cp_lock);
        bnxt_schedule_fw_health_check(bp);
+       pthread_mutex_unlock(&bp->def_cp_lock);
        return 0;
 
 error: