bnxt_en: Log if an invalid signal detected on TSIO pin
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Wed, 28 Jul 2021 18:11:45 +0000 (14:11 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Jul 2021 19:23:33 +0000 (20:23 +0100)
FW can report to driver via ASYNC event if it encountered an
invalid signal on any TSIO PIN. Driver will log this event
for the user to take corrective action.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Arvind Susarla <arvind.susarla@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index b2da2a3358660a4f9e6ed773fd3b028088b50759..4a92ea7fa7d2658be63d3ca1ae55a2ea8473187f 100644 (file)
@@ -278,6 +278,7 @@ static const u16 bnxt_async_events_arr[] = {
        ASYNC_EVENT_CMPL_EVENT_ID_RING_MONITOR_MSG,
        ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST,
        ASYNC_EVENT_CMPL_EVENT_ID_PPS_TIMESTAMP,
+       ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT,
 };
 
 static struct workqueue_struct *bnxt_pf_wq;
@@ -2043,6 +2044,19 @@ static u16 bnxt_agg_ring_id_to_grp_idx(struct bnxt *bp, u16 ring_id)
        return INVALID_HW_RING_ID;
 }
 
+static void bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2)
+{
+       switch (BNXT_EVENT_ERROR_REPORT_TYPE(data1)) {
+       case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_INVALID_SIGNAL:
+               netdev_err(bp->dev, "1PPS: Received invalid signal on pin%lu from the external source. Please fix the signal and reconfigure the pin\n",
+                          BNXT_EVENT_INVALID_SIGNAL_DATA(data2));
+               break;
+       default:
+               netdev_err(bp->dev, "FW reported unknown error type\n");
+               break;
+       }
+}
+
 #define BNXT_GET_EVENT_PORT(data)      \
        ((data) &                       \
         ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_PORT_ID_MASK)
@@ -2207,6 +2221,10 @@ static int bnxt_async_event_process(struct bnxt *bp,
                bnxt_ptp_pps_event(bp, data1, data2);
                goto async_event_process_exit;
        }
+       case ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT: {
+               bnxt_event_error_report(bp, data1, data2);
+               goto async_event_process_exit;
+       }
        default:
                goto async_event_process_exit;
        }
index aa733f1b235ac7aca5d01374ae34728074725aad..e379c48c1df9ea786e8859d12afca639f899d0b3 100644 (file)
@@ -496,6 +496,16 @@ struct rx_tpa_end_cmp_ext {
        !!((data1) &                                                    \
           ASYNC_EVENT_CMPL_ERROR_RECOVERY_EVENT_DATA1_FLAGS_RECOVERY_ENABLED)
 
+#define BNXT_EVENT_ERROR_REPORT_TYPE(data1)                            \
+       (((data1) &                                                     \
+         ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_MASK) >>\
+        ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_SFT)
+
+#define BNXT_EVENT_INVALID_SIGNAL_DATA(data2)                          \
+       (((data2) &                                                     \
+         ASYNC_EVENT_CMPL_ERROR_REPORT_INVALID_SIGNAL_EVENT_DATA2_PIN_ID_MASK) >>\
+        ASYNC_EVENT_CMPL_ERROR_REPORT_INVALID_SIGNAL_EVENT_DATA2_PIN_ID_SFT)
+
 struct nqe_cn {
        __le16  type;
        #define NQ_CN_TYPE_MASK           0x3fUL