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 6ADED243964; Tue, 29 Apr 2025 17:47:42 +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=1745948862; cv=none; b=Ht1sNGv81OF5jMZ+Z8tx0XNkx57g5DFHEOhR+ucUo2sNhgP8qYhfnyfBvJyXV+/8cFBujK1Fjexe3QX5AdYhwmoVca2mXgH+QGhpSX1q4AVYxYYeSaVCdPHoQWNmHJv/EPf4S1lDZYYExO5BaVJGbKlA2+LMggqbd5YW8OtdKPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948862; c=relaxed/simple; bh=aFgmYx5/Vng4HAhShl7TjYqNtffjoTTBk2NyrT5QCIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LkvbRNeLeKUzzkuQIqoYdbbjM37XUBwnjzLtLihwUSnHMFBVaWwUZB+WhHhE4SCNGY3Iro6kVdArb0bRS5xj2TJt24DSRmDC5IVIelSOYN9KHgd0/7Hiq8cE0SrGdHK1Bz/qHCHaj+CKVAawv0t/ICTqboW6KJbvgOzqC862a1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bMAGFqr2; 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="bMAGFqr2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFCA0C4CEE3; Tue, 29 Apr 2025 17:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745948862; bh=aFgmYx5/Vng4HAhShl7TjYqNtffjoTTBk2NyrT5QCIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMAGFqr2Kf4y1V835d04rSVOCa6jlgcBpEAx+Ekl0Tiyl5ILCOZ18kvgJGkuIrHag DIh6GRsh3bjMh1bZP/2iYa6UkHDo7fGODBFeUYvEvQGie6Lw+PdaTbARh5epH4sbak nnHr6ggqE1Mfp0MNosLmKPB1ImZq9VtDBFxBXPr0= 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 5.15 141/373] igc: move ktime snapshot into PTM retry loop Date: Tue, 29 Apr 2025 18:40:18 +0200 Message-ID: <20250429161128.969009475@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161123.119104857@linuxfoundation.org> References: <20250429161123.119104857@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 5.15-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 d0363bd68e5ed..863669192301e 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -886,16 +886,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