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 4AF034404F; Wed, 12 Jun 2024 17:27:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A35164332A; Wed, 12 Jun 2024 17:07:23 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id EF19542F21 for ; Wed, 12 Jun 2024 17:07:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204831; x=1749740831; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5R2jr1pbvUxnjKF/vowviErkmxRR5YMaVgL1IzRKxOs=; b=UjVaF8KSnAw+GfWO7vXKfBPeh7Ez7vD91+te0jJ+oborbGd4zkhIPgPh xEJTe2+YNZvCM5wpzF3fM+emIIzlaq86EQtx6e+JypV4MjI2sxQ2MtoIL nu8ea9XzRm3XJ8cazZXlC8QrWeu6VcMICTz5WcKAn99YX2c6WCHtFL74E vBqNrWeEF9w/KhnPlo2yvedO6KXQqkuM8K2/18ApMhEe9cVbGI4upnkDD Y4HKm0q1GAM5nSH7IkKae3I3Uma1q6jXFt84H41G0Wf+2QbBa5RN6Zp+j TxhEsAxZAX6qFu6O6bgWc2ViRQs0jXL3CiCW0KO7/sMcEMyoTxLbsYUiH g==; X-CSE-ConnectionGUID: bne+TY97Ql2o0sYvhLiamA== X-CSE-MsgGUID: Lhx4Q+4KSka3NC5D6+Taqg== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32460169" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32460169" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:07:11 -0700 X-CSE-ConnectionGUID: sTrI7WlsT/2d12z6NMlpkg== X-CSE-MsgGUID: RGXzx+jXQC2DqQqZuRkMFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39926067" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:07:10 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Karol Kolacinski Subject: [PATCH v2 140/148] net/ice/base: enable CGU error reporting Date: Wed, 12 Jun 2024 16:02:14 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> 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: Ian Stokes 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 bca9e75744..cfcbdddee8 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