From: Ben Shelton <benjamin.h.shel...@intel.com>

The AE driver will call this function to enable the SyncE error reporting
mechanism and enable event reporting when errors occur.

Signed-off-by: Ben Shelton <benjamin.h.shel...@intel.com>
Signed-off-by: Ian Stokes <ian.sto...@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h | 29 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_common.c     | 29 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_common.h     |  3 +++
 3 files changed, 61 insertions(+)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h 
b/drivers/net/ice/base/ice_adminq_cmd.h
index 7334addd09..936735022d 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -3014,6 +3014,29 @@ struct ice_aqc_get_pkg_info_resp {
        struct ice_aqc_get_pkg_info pkg_info[STRUCT_HACK_VAR_LEN];
 };
 
+/* Configure CGU Error Reporting (direct, 0x0C60) */
+struct ice_aqc_cfg_cgu_err {
+       u8 cmd;
+#define ICE_AQC_CFG_CGU_EVENT_SHIFT    0
+#define ICE_AQC_CFG_CGU_EVENT_MASK     BIT(ICE_AQC_CFG_CGU_EVENT_SHIFT)
+#define ICE_AQC_CFG_CGU_EVENT_EN       (0 << ICE_AQC_CFG_CGU_EVENT_SHIFT)
+#define ICE_AQC_CFG_CGU_EVENT_DIS      ICE_AQC_CFG_CGU_EVENT_MASK
+#define ICE_AQC_CFG_CGU_ERR_SHIFT      1
+#define ICE_AQC_CFG_CGU_ERR_MASK       BIT(ICE_AQC_CFG_CGU_ERR_SHIFT)
+#define ICE_AQC_CFG_CGU_ERR_EN         (0 << ICE_AQC_CFG_CGU_ERR_SHIFT)
+#define ICE_AQC_CFG_CGU_ERR_DIS                ICE_AQC_CFG_CGU_ERR_MASK
+       u8 rsvd[15];
+};
+
+/* CGU Error Event (direct, 0x0C60) */
+struct ice_aqc_event_cgu_err {
+       u8 err_type;
+#define ICE_AQC_CGU_ERR_SYNCE_LOCK_LOSS                BIT(0)
+#define ICE_AQC_CGU_ERR_HOLDOVER_CHNG          BIT(1)
+#define ICE_AQC_CGU_ERR_TIMESYNC_LOCK_LOSS     BIT(2)
+       u8 rsvd[15];
+};
+
 /* Driver Shared Parameters (direct, 0x0C90) */
 struct ice_aqc_driver_shared_params {
        u8 set_or_get_op;
@@ -3266,6 +3289,8 @@ struct ice_aq_desc {
                struct ice_aqc_get_vsi_resp get_vsi_resp;
                struct ice_aqc_download_pkg download_pkg;
                struct ice_aqc_get_pkg_info_list get_pkg_info_list;
+               struct ice_aqc_cfg_cgu_err config_cgu_err;
+               struct ice_aqc_event_cgu_err cgu_err;
                struct ice_aqc_driver_shared_params drv_shared_params;
                struct ice_aqc_debug_dump_internals debug_dump;
                struct ice_aqc_set_mac_lb set_mac_lb;
@@ -3539,6 +3564,10 @@ enum ice_adminq_opc {
        ice_aqc_opc_update_pkg                          = 0x0C42,
        ice_aqc_opc_get_pkg_info_list                   = 0x0C43,
 
+       /* 1588/SyncE commands/events */
+       ice_aqc_opc_cfg_cgu_err                         = 0x0C60,
+       ice_aqc_opc_event_cgu_err                       = 0x0C60,
+
        ice_aqc_opc_driver_shared_params                = 0x0C90,
 
        /* Standalone Commands/Events */
diff --git a/drivers/net/ice/base/ice_common.c 
b/drivers/net/ice/base/ice_common.c
index 9a9c8f86e5..9a61c1357d 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -5471,6 +5471,35 @@ ice_cfg_vsi_lan(struct ice_port_info *pi, u16 
vsi_handle, u16 tc_bitmap,
                              ICE_SCHED_NODE_OWNER_LAN);
 }
 
+/**
+ * ice_aq_cfg_cgu_err
+ * @hw: pointer to the HW struct
+ * @ena_event_report: enable or disable event reporting
+ * @ena_err_report: enable/re-enable or disable error reporting mechanism
+ * @cd: pointer to command details structure or NULL
+ *
+ * Configure CGU error reporting mechanism (0x0C60)
+ */
+int
+ice_aq_cfg_cgu_err(struct ice_hw *hw, bool ena_event_report,
+                  bool ena_err_report, struct ice_sq_cd *cd)
+{
+       struct ice_aqc_cfg_cgu_err *cmd;
+       struct ice_aq_desc desc;
+
+       cmd = &desc.params.config_cgu_err;
+
+       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_cfg_cgu_err);
+
+       if (!ena_event_report)
+               cmd->cmd |= ICE_AQC_CFG_CGU_EVENT_DIS;
+
+       if (!ena_err_report)
+               cmd->cmd |= ICE_AQC_CFG_CGU_ERR_DIS;
+
+       return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+}
+
 /**
  * ice_aq_get_sensor_reading
  * @hw: pointer to the HW struct
diff --git a/drivers/net/ice/base/ice_common.h 
b/drivers/net/ice/base/ice_common.h
index 894d650b1a..51710f9c8b 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -269,6 +269,9 @@ void ice_sbq_lock(struct ice_hw *hw);
 void ice_sbq_unlock(struct ice_hw *hw);
 int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in, u16 flag);
 int
+ice_aq_cfg_cgu_err(struct ice_hw *hw, bool ena_event_report, bool 
ena_err_report,
+                  struct ice_sq_cd *cd);
+int
 ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
                          struct ice_aqc_get_sensor_reading_resp *data,
                          struct ice_sq_cd *cd);
-- 
2.43.0

Reply via email to