From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D6D01454EF; Tue, 25 Jun 2024 13:30:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77815432AC; Tue, 25 Jun 2024 13:20:51 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 794EC42F77 for ; Tue, 25 Jun 2024 13:18:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314293; x=1750850293; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w9dwPdx+wRO4bmFaIOqLfa1vvRszWy8rs3qiyXKq5oc=; b=hU45dA0cuLWbXVoqe0BeO5Q0q1xN3Bp3qpQTTkUkgxtylXJOcuXTsuSl H2c0/9aM8tOGtyfub5i4H3UFEFkFifWLG4mcC1ZbiH3M9i9r6RZ99eIiS Akj/RSqZghfwZ0R9Jjg9gIrqP/jQvu1yOzWW0CB8AvFd8tPpYIp5lp8EM mNxQ+6+nbonUTqUPhUkym8Z5LOmHQEJ22XiJH6hhbUAqgRG7GO/LQONwb Yw1rToN+YFapL6PFDAvg3sHqAFgJAgOLXde0BMgtCyCZe0ZrOsVbBQ78R bw0uQxsq0SlKzyDVicq9gL8iIbOalXnPO2hLOq9T4+/70JMa6KdcvXexc g==; X-CSE-ConnectionGUID: xvQgjIIWQqu0QzuGhtraaw== X-CSE-MsgGUID: PsNsl6WlTVGhwGwNzWAz9w== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080652" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080652" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:18:13 -0700 X-CSE-ConnectionGUID: vUzWfbvRSTexeKWAcNG4tQ== X-CSE-MsgGUID: nvknRk0oRma9p2s5UaXaEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719777" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:18:12 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Karol Kolacinski , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 120/129] net/ice/base: enable CGU error reporting Date: Tue, 25 Jun 2024 12:14:05 +0100 Message-ID: <7b62190de50734591006ea8b41cc7fcb782e8f1a.1719313664.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Karol Kolacinski Enable CGU error reporting for SyncE and TimeSync issues. Process TimeSync loss of lock event by trying to acquire lock with the default config. Signed-off-by: Karol Kolacinski Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_ptp_hw.c | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index 495bcd62f6..9913cb76fe 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -787,7 +787,49 @@ static int ice_init_cgu_e82x(struct ice_hw *hw) } /** - * @ice_ptp_tmr_cmd_to_src_reg - Convert to source timer command value + * ice_ptp_cgu_err_reporting - Enable/disable error reporting for CGU + * @hw: pointer to HW struct + * @enable: true if reporting should be enabled + * + * Enable or disable error events to be reported through Admin Queue. + * + * Return: 0 on success, error code otherwise + */ +static int ice_ptp_cgu_err_reporting(struct ice_hw *hw, bool enable) +{ + int err; + + err = ice_aq_cfg_cgu_err(hw, enable, enable, NULL); + if (err) { + ice_debug(hw, ICE_DBG_PTP, + "Failed to %s CGU error reporting, err %d\n", + enable ? "enable" : "disable", err); + return err; + } + + return 0; +} + +/** + * ice_ptp_process_cgu_err - Handle reported CGU error + * @hw: pointer to HW struct + * @event: reported CGU error descriptor + */ +void ice_ptp_process_cgu_err(struct ice_hw *hw, struct ice_rq_event_info *event) +{ + u8 err_type = event->desc.params.cgu_err.err_type; + + if (err_type & ICE_AQC_CGU_ERR_TIMESYNC_LOCK_LOSS) { + ice_warn(hw, "TimeSync PLL lock lost. Retrying to acquire lock with default PLL configuration.\n"); + ice_init_cgu_e82x(hw); + } + + /* Reenable CGU error reporting */ + ice_ptp_cgu_err_reporting(hw, true); +} + +/** + * ice_ptp_tmr_cmd_to_src_reg - Convert to source timer command value * @hw: pointer to HW struct * @cmd: Timer command * @@ -3014,6 +3056,11 @@ static int ice_ptp_init_phc_e822(struct ice_hw *hw) if (err) return err; + /* Enable CGU error reporting */ + err = ice_ptp_cgu_err_reporting(hw, true); + if (err) + return err; + /* Set window length for all the ports */ return ice_ptp_set_vernier_wl(hw); } -- 2.43.0