From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8437927CB12; Wed, 23 Apr 2025 14:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745419853; cv=none; b=q6g1EnxzuNQsuWwAh51kmiTVWU2MF3WF8SFaq8D7ReiOEe87BgHyjBivu9VFDz550pW8eUu6HWLczJb+0gO69iLD9os5p22EWk6+UrMgEfwcUMJX7t8VCBrS9Pt7Bvc3mB72lbS61SETssdsvI5VqYM2jQIMwoqa0up/n+/zdBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745419853; c=relaxed/simple; bh=3Z9qNE1DOvmyTUFJAcoocuXHiqM5r5eqf3Z6muIQqiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NAB9XSj+jPKDdVjPfc3UeCfLYkNlx7/xU/5v21GY3he1F2fnkV2Il5kyU4YfR0uFE9TOQLw41zHQIYnUT9vl7k/UHIO9yHgXeWjbeKiO3kUm1r+8GnN1345Gc5jrOhJKt/focP0VsHsqUiO+IembredMII5Gwy+3yqMT07PUZxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XEtblz5F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XEtblz5F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A47CFC4CEE2; Wed, 23 Apr 2025 14:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745419853; bh=3Z9qNE1DOvmyTUFJAcoocuXHiqM5r5eqf3Z6muIQqiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XEtblz5Fl3ECDKHgfdURDZWvhOKjwaBZp70qAUNU4BTkIhXx3NHtaRaqbms49nhRZ n2DNjuIltMG6COjjaIQHNesL2dUkB+WJ/xv0LdAtZwiL+0UxnAU/r46qpN8QOS22gQ qDv7S9jNhZOZk9zkOpVwu70QLmGU6CWIJIbBDIi0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michal Swiatkowski , Mor Bar-Gabay , Avigail Dahan , Christopher S M Hall , Corinna Vinschen , Jacob Keller , Vinicius Costa Gomes , Tony Nguyen , Sasha Levin Subject: [PATCH 6.14 035/241] igc: move ktime snapshot into PTM retry loop Date: Wed, 23 Apr 2025 16:41:39 +0200 Message-ID: <20250423142621.950662564@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142620.525425242@linuxfoundation.org> References: <20250423142620.525425242@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christopher S M Hall [ Upstream commit cd7f7328d691937102732f39f97ead35b15bf803 ] Move ktime_get_snapshot() into the loop. If a retry does occur, a more recent snapshot will result in a more accurate cross-timestamp. Fixes: a90ec8483732 ("igc: Add support for PTP getcrosststamp()") Reviewed-by: Michal Swiatkowski Tested-by: Mor Bar-Gabay Tested-by: Avigail Dahan Signed-off-by: Christopher S M Hall Reviewed-by: Corinna Vinschen Signed-off-by: Jacob Keller Acked-by: Vinicius Costa Gomes Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igc/igc_ptp.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c index c640e346342be..516abe7405dee 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -1011,16 +1011,16 @@ static int igc_phc_get_syncdevicetime(ktime_t *device, int err, count = 100; ktime_t t1, t2_curr; - /* Get a snapshot of system clocks to use as historic value. */ - ktime_get_snapshot(&adapter->snapshot); - + /* Doing this in a loop because in the event of a + * badly timed (ha!) system clock adjustment, we may + * get PTM errors from the PCI root, but these errors + * are transitory. Repeating the process returns valid + * data eventually. + */ do { - /* Doing this in a loop because in the event of a - * badly timed (ha!) system clock adjustment, we may - * get PTM errors from the PCI root, but these errors - * are transitory. Repeating the process returns valid - * data eventually. - */ + /* Get a snapshot of system clocks to use as historic value. */ + ktime_get_snapshot(&adapter->snapshot); + igc_ptm_trigger(hw); err = readx_poll_timeout(rd32, IGC_PTM_STAT, stat, -- 2.39.5