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 35BB7298CB0; Wed, 23 Apr 2025 15:23:30 +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=1745421810; cv=none; b=HInn06dyt1Id8ado0NYJ7Z+ij3/sTEC5unfUJsccPgxXDfjcz9HjsxJdmYDvr91SXIEBwJLeg+/6/+wsYnsZOtmS2zaRNF/Z8I8AWumh7ZNIm8LlTnQ3TS3BS2dk3jdetabS4Q4uHPbLWr2liLT7BTDz7ig+2TNTzUzQj4Dkd+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745421810; c=relaxed/simple; bh=blQHXIY7UzT4KNPJwPNYuMD5vUBQ5A1tTjBjqUrZdbU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dLb2p7ZApv0SfIZ29fSZoQX4E3Vwr7I7MVhaKdlIOFH+dYUKAERAboQB6HCfWcYGhwr8dpWcLZaZS2Zw2c5ys2W5uQNNpvc2K5BFrPngdZD1fRlV1bzv97O9A9a6J8xWpHA6pe++lhNqsTIUlIX5Eup52BsrwpiYNq+cHZvOwP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=efBN8mDK; 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="efBN8mDK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A056CC4CEE2; Wed, 23 Apr 2025 15:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745421810; bh=blQHXIY7UzT4KNPJwPNYuMD5vUBQ5A1tTjBjqUrZdbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efBN8mDKH1qyTumaXD8hwJcnRldpCJJUx3tXlZKlKrdgOTga4lu5EuStKu2xnUYwD fQ4z35BUaKtPvM9JnYEjsnypn7XgRio/3WCZIAtIExTebvqWTOpRRLBeZIErn967D8 WqJVGFRvIc8o9FCpfML79VoGxvyXjNSs030iB1yo= 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.1 181/291] igc: move ktime snapshot into PTM retry loop Date: Wed, 23 Apr 2025 16:42:50 +0200 Message-ID: <20250423142631.776254558@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142624.409452181@linuxfoundation.org> References: <20250423142624.409452181@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.1-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 b4720545191ff..5616b7f4e504f 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -881,16 +881,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