net/bnxt: handle pause storm event
authorSomnath Kotur <somnath.kotur@broadcom.com>
Mon, 12 Jul 2021 08:04:35 +0000 (13:34 +0530)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 14 Jul 2021 18:29:05 +0000 (20:29 +0200)
FW has been modified to send a new async event when it detects
a pause storm. Register for this new event and log it upon receipt.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_cpr.c
drivers/net/bnxt/bnxt_hwrm.c
drivers/net/bnxt/bnxt_hwrm.h

index 702ecac..494a1ef 100644 (file)
 #define        BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT              \
        HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
 
+#define BNXT_EVENT_ERROR_REPORT_TYPE(data1)                            \
+       (((data1) &                                                     \
+         HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_MASK)  >>\
+        HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_SFT)
+
 #define BNXT_HWRM_CMD_TO_FORWARD(cmd)  \
                (bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
 
index 02006f6..12230dc 100644 (file)
@@ -91,6 +91,22 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
        bnxt_rep_dev_start_op(eth_dev);
 }
 
+static void bnxt_handle_event_error_report(struct bnxt *bp,
+                                          uint32_t data1,
+                                          uint32_t data2)
+{
+       switch (BNXT_EVENT_ERROR_REPORT_TYPE(data1)) {
+       case HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_PAUSE_STORM:
+               PMD_DRV_LOG(WARNING, "Port:%d Pause Storm detected!\n",
+                           bp->eth_dev->data->port_id);
+               break;
+       default:
+               PMD_DRV_LOG(INFO, "FW reported unknown error type data1 %d"
+                           " data2: %d\n", data1, data2);
+               break;
+       }
+}
+
 /*
  * Async event handling
  */
@@ -215,6 +231,9 @@ void bnxt_handle_async_event(struct bnxt *bp,
                if (bp->recovery_info)
                        bnxt_hwrm_fw_echo_reply(bp, data1, data2);
                break;
+       case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT:
+               bnxt_handle_event_error_report(bp, data1, data2);
+               break;
        default:
                PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
                break;
index d583839..e6c46d4 100644 (file)
@@ -1085,7 +1085,8 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
                rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
        req.async_event_fwd[2] |=
-               rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST);
+               rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST |
+                                ASYNC_CMPL_EVENT_ID_ERROR_REPORT);
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
index 80e3128..b311ff5 100644 (file)
@@ -37,6 +37,8 @@ struct hwrm_func_qstats_output;
        (1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE - 32))
 #define        ASYNC_CMPL_EVENT_ID_ECHO_REQUEST        \
        (1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST - 64))
+#define        ASYNC_CMPL_EVENT_ID_ERROR_REPORT        \
+       (1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT - 64))
 
 #define HWRM_QUEUE_SERVICE_PROFILE_LOSSY \
        HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY