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 5E98D296146; Wed, 23 Apr 2025 15:26:45 +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=1745422005; cv=none; b=PTrqjjeltnufbhM3iWc1yaDaCETrOFyVs2MBnNbTStMd/agpWpA4nGsK9EshNXA5iKNHVbEvUj111U87LQQsq2djBVvWvGv0v1mV5OxkQ7Pdsuky5MmvbwGtxh2jczWZavtGK+SVuK2eBQxmK9STEtjmVaH305v/gtH4awiXCvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745422005; c=relaxed/simple; bh=7/XGCyip29YnzNqFeznBpzrvmG/lo2X/dnDDZ5vAw10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSssdVSDyF28xLK6wYjMRcw0q/8D5jxUXnwT98GHctTGPXlcJnQOv7BxkRjbIfwVtDVHXa4hRtkKWv8KLNmRpP1i8sLRsjFORncIHms9Q59yl4oPwiszHdWFMlvjJJSEkByixgGnJmFCPP9I3h8wkg6pAsdWcIUDJmIqIm6CILA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nbHo6G1Z; 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="nbHo6G1Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C640CC4CEE2; Wed, 23 Apr 2025 15:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745422005; bh=7/XGCyip29YnzNqFeznBpzrvmG/lo2X/dnDDZ5vAw10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbHo6G1Z5q4U0zFwuXfD0Uhnx89wMHJOR16qlsuevAR1LZNlj9EhwbNkIvUQ0AVw7 6CYp5SZCNsCN+aAbO5sUg5eAb1smLGrVw+lSwcT+ky0LCpCm/Cc4OSTdON18tIJO7M J5QEb/FEF4uJEfZMYPAOoiGXg199WQGOAuZ1jUko= 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.6 261/393] igc: move ktime snapshot into PTM retry loop Date: Wed, 23 Apr 2025 16:42:37 +0200 Message-ID: <20250423142654.151692089@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142643.246005366@linuxfoundation.org> References: <20250423142643.246005366@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.6-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 097a481e6b73d..adb31cccaf9a5 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -980,16 +980,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