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 3478A45501; Wed, 26 Jun 2024 14:05:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D35314340E; Wed, 26 Jun 2024 13:57:07 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id C222442E95 for ; Wed, 26 Jun 2024 13:45:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719402333; x=1750938333; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m1QeEuCmuILWzuNNd6j/tja9HhrfBSaKQFWbvLP2I8A=; b=X174JRDlhsfvpooaLzQgqotIdo5YOf0g3cgfIq7LQKpyTFMgpi9uFN98 ibVnBu6/1/hXnyA9uMRdKCe1vku5clxpgxGtLDaf2aq9JAdqyeHJ1lgfu NtlEGA3sjvG3AJixNw+RuobIhihQYsg0w/8M2VWh/nSknXMyRz+eZtFSq 7qDOdPAJOIOcVgzHMg1MjXUhE8AiwfhaCMpP3+O9P56CddWAHoWlWBN+L 6atxnq6pQoGpyPRGUL8YbLiakPcK/Xy/1Mw3p2ndqQ4DP85mJlvldE+ZM 3Ze9CQU6aH/RvyizIW/X8YRPmrT8Gf13XJVMF2gfjFCC8C/CKWy2lctGp w==; X-CSE-ConnectionGUID: wSsC8ppqQ/ib3OTDzIv/iQ== X-CSE-MsgGUID: 4N/1GDJKT6S3jXWtc55BPg== X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="38979575" X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="38979575" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2024 04:45:32 -0700 X-CSE-ConnectionGUID: TJgyiyRlTGShvpVzCrbR5g== X-CSE-MsgGUID: l6eK69frRyyweLRK3QecVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="43874462" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa010.jf.intel.com with ESMTP; 26 Jun 2024 04:45:31 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Karol Kolacinski , ian.stokes@intel.com, bruce.richardson@intel.com Subject: [PATCH v4 089/103] net/ice/base: enable CGU error reporting Date: Wed, 26 Jun 2024 12:42:17 +0100 Message-ID: <6cb311127ec7b8a5989bf313bd7a3f6535e1b13c.1719401848.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 6929d72ccb..bf3c32ae64 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 * @@ -3054,6 +3096,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