net/mvpp2: apply flow control after port init
[dpdk.git] / drivers / net / bnxt / bnxt_cpr.c
index 91d1ffe..b7be3e8 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2018 Broadcom
+ * Copyright(c) 2014-2021 Broadcom
  * All rights reserved.
  */
 
@@ -121,12 +121,19 @@ void bnxt_handle_async_event(struct bnxt *bp,
                PMD_DRV_LOG(INFO, "Port conn async event\n");
                break;
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY:
+               /*
+                * Avoid any rx/tx packet processing during firmware reset
+                * operation.
+                */
+               bnxt_stop_rxtx(bp);
+
                /* Ignore reset notify async events when stopping the port */
                if (!bp->eth_dev->data->dev_started) {
                        bp->flags |= BNXT_FLAG_FATAL_ERROR;
                        return;
                }
 
+               pthread_mutex_lock(&bp->err_recovery_lock);
                event_data = rte_le_to_cpu_32(async_cmp->event_data1);
                /* timestamp_lo/hi values are in units of 100ms */
                bp->fw_reset_max_msecs = async_cmp->timestamp_hi ?
@@ -146,6 +153,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
                }
 
                bp->flags |= BNXT_FLAG_FW_RESET;
+               pthread_mutex_unlock(&bp->err_recovery_lock);
                rte_eal_alarm_set(US_PER_MS, bnxt_dev_reset_and_resume,
                                  (void *)bp);
                break;
@@ -337,3 +345,9 @@ bool bnxt_is_recovery_enabled(struct bnxt *bp)
 
        return false;
 }
+
+void bnxt_stop_rxtx(struct bnxt *bp)
+{
+       bp->eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
+       bp->eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts;
+}