Article View: linux.kernel.netdev
Article #6208[PATCH net v5 06/13] ice: E822: keep Tx timestamps disabled during offset calibration
From: Jacob Keller
Date: Wed, 21 Oct 2026 22:12
Date: Wed, 21 Oct 2026 22:12
165 lines
17457 bytes
17457 bytes
From: Karol Kolacinski <karol.kolacinski@intel.com>
Do not clear the tx.calibrating flag immediately after starting the PHY
timer in ice_ptp_port_phy_restart(). Instead, keep Tx timestamps
disabled until the offset verification work (ice_ptp_wait_for_offsets)
has confirmed that the Tx PHY offset is properly configured.
Previously, tx.calibrating was set to true, then immediately back to
false right after ice_start_phy_timer_e82x() returned. This allowed Tx
timestamp requests to be served during the window where offset
verification was still pending. Timestamps produced during this window
should have their valid bit cleared, but it is better to prevent requests
until the driver has confirmed calibration is complete.
Rename the tx.calibrating field to tx.disabled, and change where it is
cleared. Only clear it in ice_ptp_wait_for_offsets(), and only after Tx
offset configuration has completed successfully. This ensures that new Tx
timestamp requests are only accepted after the PHY has properly calibrated
the Tx offset.
If ice_start_phy_timer_e82x() fails, do not restore disabled to false.
The device is in a state where timestamps cannot succeed properly anyways.
A dev_err message is already logged on failure to start the timer at the
end of the function.
Renaming the field improves clarity and will better reflect the nature of
the flag in a future change that also applies disabling Tx timestamps in
software in a following commit.
Log a debug message while offset calibration is still pending, including
the specific Tx/Rx error codes to aid debugging stalled calibration.
This path is expected on every routine link-up: ov_work is first queued
with no delay and the vernier offset cannot be computed until at least
one packet has been transmitted, so the first several invocations
normally land here. Use dev_dbg() rather than a rate-limited warning to
avoid emitting KERN_WARNING on every link-up during normal operation.
Log a debug message when calibration completes successfully.
Note that sashiko review has previously complained that leaving the
disabled flag set "permanently" disables Tx timestamps if vernier
calibration never completes. This is true, but its important to realize
that timestamps would still fail regardless of whether the flag is set.
Until vernier calibration completes the device will not report valid
timestamps regardless. Thus, keeping the calibrating flag set simply
prevents new timestamp requests from software while it is known that the
hardware will not complete them.
Fixes: 3a7496234d17 ("ice: implement basic E822 PTP support")
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.h | 6 +++---
drivers/net/ethernet/intel/ice/ice_ptp.c | 37 ++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
index 27ea502b7576..d70f022c850b 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
@@ -106,8 +106,8 @@ enum ice_tx_tstamp_work {
* @offset: offset into timestamp block to get the real index
* @len: length of the tstamps and in_use fields.
* @init: if true, the tracker is initialized;
- * @calibrating: if true, the PHY is calibrating the Tx offset. During this
- * window, timestamps are temporarily disabled.
+ * @disabled: set to true when new Tx timestamp requests are disabled, such as
+ * while the PHY Tx offset configuration has not yet completed.
* @has_ready_bitmap: if true, the hardware has a valid Tx timestamp ready
* bitmap register. If false, fall back to verifying new
* timestamp values against previously cached copy.
@@ -122,7 +122,7 @@ struct ice_ptp_tx {
u8 offset;
u8 len;
u8 init : 1;
- u8 calibrating : 1;
+ u8 disabled : 1;
u8 has_ready_bitmap : 1;
s8 last_ll_ts_idx_read;
};
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index f43918f334e8..57e2606655c4 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -367,7 +367,7 @@ ice_ptp_is_tx_tracker_up(struct ice_ptp_tx *tx)
{
lockdep_assert_held(&tx->lock);
- return tx->init && !tx->calibrating;
+ return tx->init && !tx->disabled;
}
/**
@@ -1168,6 +1168,7 @@ static int ice_ptp_check_tx_fifo(struct ice_ptp_port *port)
static void ice_ptp_wait_for_offsets(struct kthread_work *work)
{
struct ice_ptp_port *port;
+ unsigned long flags;
struct ice_pf *pf;
struct ice_hw *hw;
int tx_err;
@@ -1188,9 +1189,26 @@ static void ice_ptp_wait_for_offsets(struct kthread_work *work)
tx_err = ice_ptp_check_tx_fifo(port);
if (!tx_err)
tx_err = ice_phy_cfg_tx_offset_e82x(hw, port->port_num);
+ if (!tx_err) {
+ /* Tx offset has been configured, re-enable Tx timestamps */
+ spin_lock_irqsave(&port->tx.lock, flags);
+ if (port->tx.disabled) {
+ port->tx.disabled = false;
+ dev_dbg(ice_pf_to_dev(pf), "PTP Tx offset valid for port %u, Tx timestamps enabled\n",
+ port->port_num);
+ }
+ spin_unlock_irqrestore(&port->tx.lock, flags);
+ }
+
rx_err = ice_phy_cfg_rx_offset_e82x(hw, port->port_num);
if (tx_err || rx_err) {
- /* Tx and/or Rx offset not yet configured, try again later */
+ /* Tx and/or Rx offset not yet configured, try again later.
+ * This is expected during normal link-up: the vernier offset
+ * calibration cannot complete until at least one packet has
+ * been transmitted, so the first retries routinely land here.
+ */
+ dev_dbg(ice_pf_to_dev(pf), "PTP offset not yet valid for port %u (tx_err=%d rx_err=%d)\n",
+ port->port_num, tx_err, rx_err);
kthread_queue_delayed_work(pf->ptp.kworker,
&port->ov_work,
msecs_to_jiffies(100));
@@ -1270,11 +1288,9 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)
/* Start the PHY timer in Vernier mode */
kthread_cancel_delayed_work_sync(&ptp_port->ov_work);
- /* temporarily disable Tx timestamps while calibrating
- * PHY offset
- */
+ /* Disable Tx timestamps until PHY calibration completes */
spin_lock_irqsave(&ptp_port->tx.lock, flags);
- ptp_port->tx.calibrating = true;
+ ptp_port->tx.disabled = true;
spin_unlock_irqrestore(&ptp_port->tx.lock, flags);
ptp_port->tx_fifo_busy_cnt = 0;
@@ -1283,11 +1299,10 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)
if (err)
break;
- /* Enable Tx timestamps right away */
- spin_lock_irqsave(&ptp_port->tx.lock, flags);
- ptp_port->tx.calibrating = false;
- spin_unlock_irqrestore(&ptp_port->tx.lock, flags);
-
+ /* Do not clear disabled flag here. Tx timestamp requests
+ * remain disabled until ice_ptp_wait_for_offsets() has
+ * verified that the Tx offset calibration has completed.
+ */
kthread_queue_delayed_work(pf->ptp.kworker, &ptp_port->ov_work,
0);
break;
--
2.56.0.212.g129ede20d986
Technical Details
Message-ID:
<20261021-jk-e825c-timestamp-processing-logic-fixes-srcu-v5-6-72289a4ac8eb@intel.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350273-linux-kernel-netdev=dewy.ruReferences:
<20261021-jk-e825c-timestamp-processing-logic-fixes-srcu-v5-0-72289a4ac8eb@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350273-linux-kernel-netdev=dewy.ru From: jacob.e.keller@intel.com (Jacob Keller) Newsgroups: linux.kernel.netdev Subject: [PATCH net v5 06/13] ice: E822: keep Tx timestamps disabled during offset calibration Date: Wed, 21 Oct 2026 15:12:51 -0700 Organization: Usenet Network Message-ID: <20261021-jk-e825c-timestamp-processing-logic-fixes-srcu-v5-6-72289a4ac8eb@intel.com> References: <20261021-jk-e825c-timestamp-processing-logic-fixes-srcu-v5-0-72289a4ac8eb@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="75857"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:qouyr9UOu8MtXp09Y4NE9cf55Lo= sha256:uHPLmtx5NiiOya8cxcPd6EWtH4oJkYoPo7UXDxDZeGM= sha1:kUyYsr3vIiDE/bEVVEHh8fxZqpI= sha256:gOAvvte6mRfHDIO01b2vP0/p0XRT/ir//XacUQAH0Go= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E5FDF111140; Thu, 22 Oct 2026 01:17:12 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YZtz2qvey0Gu; Thu, 22 Oct 2026 01:17:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350273-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id CA6D3111135; Thu, 22 Oct 2026 01:17:01 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 29E30412B5; Wed, 21 Oct 2026 22:13:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792620810; b=HuLqV520WkNhIgSbTQiVcfaBQKEfewRFc9HCAhynnkDi0WbNLqg99n1Aslrsz3kd1+oi gAZ5fJK1VH/vibc+CB2KmW+Ho6tkvLntIPRyDKpzowxsxi4PZJnrN5k06PqzjmaMvVgRp ZLEC9DQ6wYQIXOLC1oxQdkZldTsDyo4PCaY2KgJSiPU4yy5J9n8YckdriMM4BaBBEtm7i afFU0GVucsyY6pHoipIMF/gXCR3oBG7oTGXJchuFYZDjSZr1VtHcbhfiHzpX6q9w1Et7c zC6x/Mm6NVMRWVPUF+cncP/Pj8uxV2evgE53cDiNJZZSADk3oYXVDaBLU0kT4KgJNww== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792620810; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: Received:From:Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key; bh=IX7RgdK/u+jEM7Oddr/DxLx4dPDvY88uypHFy7NlwuY=; b=Y3LtaamTeOxFkKWNdp/9Jp24y9hz87j2jXMX8oTv1Jebx4R74It0KxUBwMhU7MSExxxl oLTd4d59PqbJqEDl4i8RqparDB4x+7Y9rAZwuZV3v9FVSmsM0ogXYhKmWU0lcMDx4sJSm LnwglD+Ths7GXpNlGHHZPGlrFgdA7XUU7s1pC13kLI9rjgNObF28Se2PTPESgLoPTbMih xDQBLk5M1XqTT1kWk7JDnybw67y973J5UwT1TdUArMPk5PzWdjeTPKzl032mwOjfyxw4J X3WJXapjqUomp9fazeEDKfSWCjkr27l6Jik+IVuAH4KEDbrPye5hn8aw5XZ5c74UCmA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="QSa/FQ/c"; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 010BC606A32C; Wed, 21 Oct 2026 22:13:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QSa/FQ/c X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.15 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792620809; b=eZDzemSSp07TRggMEmefpgXDH4tccNQHzp2sjx4MXCuVDpEbBZGdfmb1lXcM4kfm5r6O IF5yW+jNSCjhcrLUU5uk/R7zWltGt2m+Gf4fKW0TagB1+lSr/5lp4N0Ltcjm5WGhSpS9y pTUi7hJYdiFjWE0yWOQ+7yr+psE+5syt7fhWQQWgI6gcNxv3pUBeEW0FIvV9Isjs9TW37 ne6D9nP46FABHQIot5z0yOllHmG+DCRm4slebHnW0rjKAb5KLR9GhoGw4PnvGb8WDmCQO VIhnXSlxj3Q4zGiJ4x5xqKDkz8ABh55KDJQSzOQIuFl2PcbOgMnzHIZGKgxhbPjirqQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792620809; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature: X-Developer-Key; bh=IX7RgdK/u+jEM7Oddr/DxLx4dPDvY88uypHFy7NlwuY=; b=DlzMMoaWJvj2qSMfm9ZipZdED/9cBPclk3+gxVfGg0cQWTKl4gXzdZNcQb1RzORn+KFi FbW0uhMEWUlE4QOolqq8mxlfbUo0mg1fSjl7W0f0+8rRMvRtmX3SQ9NFAefGJmCQ6/r/H F8j3kqtbi3+xyxm9hYgCRMBWCCq6KRh875vqWRBqGX6QPV7AVIy/Bur/1kwOA+6wj7+f4 ORZytf2d6gCASaMyPL+AVjcojtnrX3/+crWg1EVldnaxo6sZwp0kelQiuedI61tGCzr0w SHhbzZHtq7Q4qXGORy7KgPVxCPubS7vG+0sqH0egq4OX4KhQszWeZY5djZ6a/5bJjQw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="QSa/FQ/c"; arc=none smtp.remote-ip=198.175.65.15 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23C1A606A329 for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 22:13:28 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 23C1A606A329 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1792620808; x=1824156808; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=6U1HEFTHek9tvTfbHxxbTFLySiT0aWBNEPp6y27n+lA=; b=QSa/FQ/cmBwdHjLTe3xPkSO2gxgX3IcUtZfsVEp05wskp6qnz+MuTV0p TkOpgpP8Uj8LXAArhEX/wkV2MLyIjbYNFm7FO/OyzSo8aoUd7Y2l9lXzE BzUCfEhfLLeRyccl8PHOOSWp+LARgK2CUggHOOoroKg3JSgpP0Dsav01m 2i7HLUTKsUbcNnZAktjRXF8JPJpSCWtr7GgLOiwYOu6KYC5Munreu9SoG 4gQPUSJDBw1hOmrdwWj3/Fr2xYx3uS5z3e8MaqZidllpXxEoVpGn0DWmK SjCp2L8OfCJGWR3TNuNOHZc0P0GT8yKhKyHUn81oB3Yj+fJnAqOEF/k8D w==; X-CSE-ConnectionGUID: rkqTJL+9RN6yhZQrGramzw== X-CSE-MsgGUID: iLZcleb7RROfiPCQoyDobg== X-IronPort-AV: E=McAfee;i="6800,10657,11942"; a="1363193" X-IronPort-AV: E=Sophos;i="6.27,171,1787036400"; d="scan'208";a="1363193" X-Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2026 15:13:12 -0700 X-CSE-ConnectionGUID: 4O5fLO1WQMWAOgi4flSBMg== X-CSE-MsgGUID: PfPqpB6IRVeasav5vfCj2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,171,1787036400"; d="scan'208";a="3275474" X-Received: from orcnseosdtnuc.amr.corp.intel.com ([10.166.241.20]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2026 15:13:10 -0700 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261021-jk-e825c-timestamp-processing-logic-fixes-srcu-v5-0-72289a4ac8eb@intel.com> X-Cc: Grzegorz Nitka <grzegorz.nitka@intel.com>, Aleksandr Loktionov <aleksandr.loktionov@intel.com>, Alexander Nowlin <alexander.nowlin@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, jacob.e.keller@intel.com, maciej.machnikowski@intel.com, przemyslaw.korba@intel.com, sergey.temerkhanov@intel.com, arkadiusz.kubalewski@intel.com, richardcochran@gmail.com, horms@kernel.org X-Mailer: b4 0.17-dev-67df5 X-Developer-Signature: v=1; a=openpgp-sha256; l=7370; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=YY+XtsRk0vaKSnYEY0nLGZmbANoVHlP3zuzXjfhlbRg=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhqybFu8dfvBFPVE3PihWX2lZFal2T/RbUV7kdvfEOI6HG 38c2vS1o5SFQYyLQVZMkUXBIWTldeMJYVpvnOVg5rAygQxh4OIUgIlctmL4H/ZM9dUP1jvLlD+5 aq90fPJz3xvBN6rxlz7Vd/tITNgfZc/wP4zn1eMP2mv2B3ntd5tfcuX3Tq/84vzZ5aJtC0r9fRs zmQE= X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8