net/bnxt: cleanup comments
[dpdk.git] / drivers / net / bnxt / bnxt_cpr.c
index 3893179..e6f30fe 100644 (file)
@@ -5,13 +5,47 @@
 
 #include <rte_malloc.h>
 #include <rte_alarm.h>
+#include <rte_cycles.h>
 
 #include "bnxt.h"
-#include "bnxt_cpr.h"
 #include "bnxt_hwrm.h"
 #include "bnxt_ring.h"
 #include "hsi_struct_def_dpdk.h"
 
+void bnxt_wait_for_device_shutdown(struct bnxt *bp)
+{
+       uint32_t val, timeout;
+
+       /* if HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD is set
+        * in HWRM_FUNC_QCAPS command, wait for FW_STATUS to set
+        * the SHUTDOWN bit in health register
+        */
+       if (!(bp->recovery_info &&
+             (bp->flags & BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD)))
+               return;
+
+       /* Driver has to wait for fw_reset_max_msecs or shutdown bit which comes
+        * first for FW to collect crash dump.
+        */
+       timeout = bp->fw_reset_max_msecs;
+
+       /* Driver has to poll for shutdown bit in fw_status register
+        *
+        * 1. in case of hot fw upgrade, this bit will be set after all
+        *    function drivers unregistered with fw.
+        * 2. in case of fw initiated error recovery, this bit will be
+        *    set after fw has collected the core dump
+        */
+       do {
+               val = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG);
+               if (val & BNXT_FW_STATUS_SHUTDOWN)
+                       return;
+
+               rte_delay_ms(100);
+               timeout -= 100;
+       } while (timeout);
+}
+
 /*
  * Async event handling
  */
@@ -24,14 +58,12 @@ void bnxt_handle_async_event(struct bnxt *bp,
        struct bnxt_error_recovery_info *info;
        uint32_t event_data;
 
-       /* TODO: HWRM async events are not defined yet */
-       /* Needs to handle: link events, error events, etc. */
        switch (event_id) {
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
                /* FALLTHROUGH */
-               bnxt_link_update_op(bp->eth_dev, 1);
+               bnxt_link_update_op(bp->eth_dev, 0);
                break;
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
                PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
@@ -102,7 +134,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
                bnxt_schedule_fw_health_check(bp);
                break;
        default:
-               PMD_DRV_LOG(INFO, "handle_async_event id = 0x%x\n", event_id);
+               PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
                break;
        }
 }
@@ -219,7 +251,7 @@ int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
                break;
        default:
                /* Ignore any other events */
-               PMD_DRV_LOG(INFO, "Ignoring %02x completion\n", CMP_TYPE(cmp));
+               PMD_DRV_LOG(DEBUG, "Ignoring %02x completion\n", CMP_TYPE(cmp));
                break;
        }