From 95de0faf12d4a226d77ce9fbc52df83e63904c3b Mon Sep 17 00:00:00 2001 From: Somnath Kotur Date: Mon, 12 Jul 2021 13:34:35 +0530 Subject: [PATCH] net/bnxt: handle pause storm event 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 Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 5 +++++ drivers/net/bnxt/bnxt_cpr.c | 19 +++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.c | 3 ++- drivers/net/bnxt/bnxt_hwrm.h | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 702ecac629..494a1eff37 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -157,6 +157,11 @@ #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))) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 02006f6671..12230dcea4 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -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; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index d583839cb0..e6c46d46de 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -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); diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 80e3128140..b311ff59c0 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -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 -- 2.20.1