From: Jacob Keller <jacob.e.keller@intel.com>
To: Jakub Kicinski <kuba@kernel.org>, <anthony.l.nguyen@intel.com>
Cc: <davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>,
<andrew+netdev@lunn.ch>, <netdev@vger.kernel.org>,
<maciej.machnikowski@intel.com>, <przemyslaw.korba@intel.com>,
<grzegorz.nitka@intel.com>, <sergey.temerkhanov@intel.com>,
<arkadiusz.kubalewski@intel.com>, <poros@redhat.com>,
<richardcochran@gmail.com>, <horms@kernel.org>,
<pmenzel@molgen.mpg.de>, <aleksandr.loktionov@intel.com>,
<alexander.nowlin@intel.com>
Subject: Re: [PATCH net 10/15] ice: wait for in-flight Tx timestamps before flushing the tracker
Date: Thu, 17 Sep 2026 10:00:17 -0700 [thread overview]
Message-ID: <b172f10a-837c-4adc-b7d5-dd34ed544fb5@intel.com> (raw)
In-Reply-To: <20260916011223.1632696-1-kuba@kernel.org>
On 9/15/2026 6:12 PM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> Here is the report:
>
> commit fea79aeeb67734d73dbd19b0b88b152cd016c86e
> Author: Petr Oros <poros@redhat.com>
>
> ice: wait for in-flight Tx timestamps before flushing the tracker
>
> This adds ice_ptp_wait_for_tracker_drain(), called from
> ice_ptp_flush_tx_tracker(), which polls the PHY Tx timestamp ready bitmap
> for up to 10 ms so that in-flight captures publish their ready bits before
> the tracker entries are freed and the ready bits are cleared.
>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
>> index 4dec728e219d8..b142b779dc105 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
>> @@ -740,6 +740,37 @@ ice_ptp_alloc_tx_tracker(struct ice_ptp_tx *tx)
>> return 0;
>> }
>>
>> +static void
>> +ice_ptp_wait_for_tracker_drain(struct ice_pf *pf, struct ice_ptp_tx *tx)
>> +{
>> + unsigned long deadline = jiffies + msecs_to_jiffies(10);
>
> [Severity: Low]
> Is the 10 ms budget the commit message describes actually available at every
> HZ setting? With CONFIG_HZ=100, msecs_to_jiffies(10) is 1, so the deadline
> is a single tick ahead and the remaining fraction of the current tick is
> arbitrary.
>
> Since the loop body only sleeps 500-1000 us before re-testing
> time_before(jiffies, deadline), can the whole wait end after one poll of
> roughly 500 us?
>
> Would a microsecond-resolution deadline (ktime_get() plus ktime_add_us(), or
> read_poll_timeout()) match the documented budget better here?
>
I'll see about switching to read_poll_timeout().
>> + struct ice_hw *hw = &pf->hw;
>> + u64 tstamp_ready;
>> + bool pending;
>> + u8 idx;
>> +
>> + if (hw->reset_ongoing)
>> + return;
>> +
>> + do {
>> + if (ice_get_phy_tx_tstamp_ready(hw, tx->block, &tstamp_ready))
>> + return;
>> +
>> + pending = false;
>> + for_each_set_bit(idx, tx->in_use, tx->len) {
>> + if (!(tstamp_ready & BIT_ULL(idx + tx->offset)))
>> + pending = true;
>> + }
>> + if (!pending)
>> + return;
>
> [Severity: High]
> Should this read of the ready bitmap be gated on tx->has_ready_bitmap?
>
> On ICE_MAC_E810 the flag is cleared in ice_ptp_init_tx():
>
> /* The E810 PHY does not provide a timestamp ready bitmap. Instead,
> * verify new timestamps against cached copy of the last read
> * timestamp.
> */
> tx->has_ready_bitmap = pf->hw.mac_type != ICE_MAC_E810;
>
> and the backing helper in ice_ptp_hw.c is a stub:
>
> static int
> ice_get_phy_tx_tstamp_ready_e810(struct ice_hw *hw, u8 port, u64 *tstamp_ready)
> {
> *tstamp_ready = 0xFFFFFFFFFFFFFFFF;
> return 0;
> }
>
> With every bit set, doesn't the for_each_set_bit() loop above leave pending
> false on the first iteration, so the helper returns immediately without ever
> sleeping? That would make the wait dead code on E810, which is the device
> named by the Fixes tag ea9b847cda64 ("ice: enable transmit timestamps for
> E810 devices").
>
> The other consumer of the same register in ice_ptp_process_tx_tstamp() does
> gate both the read and the per-index test:
>
> if (tx->has_ready_bitmap) {
> err = ice_get_phy_tx_tstamp_ready(hw, tx->block, &tstamp_ready);
> if (err)
> return;
> }
> ...
> if (tx->has_ready_bitmap &&
> !(tstamp_ready & BIT_ULL(phy_idx))) {
>
> and the kernel-doc in ice_ptp.h states the register is only valid when the
> flag is set:
>
> * @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.
>
> Would it make sense to either skip the wait when
> !tx->has_ready_bitmap and use the cached-timestamp fallback on E810, or
> adjust the Fixes tag and commit message to describe which devices are
> actually covered?
>
> Also, a device with has_ready_bitmap == 0 whose stub returned zeros instead
> of all-ones would make this loop burn the entire budget on every flush,
> wouldn't it?
>
Yes, this really shouldn't be done on E810 device without the ready
bitmap. Will fix.
>> +
>> + usleep_range(500, 1000);
>> + } while (time_before(jiffies, deadline));
>> +
>> + dev_dbg(ice_pf_to_dev(pf), "Timed out waiting for in-flight Tx timestamps on block %u\n",
>> + tx->block);
>> +}
>> +
>
> [ ... ]
next prev parent reply other threads:[~2026-09-17 17:00 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 0:34 [PATCH net 00/15][pull request] ice: E82x: timestamp processing logic fixes Tony Nguyen
2026-09-11 0:34 ` [PATCH net 01/15] ice: use reference counting and RCU for PTP port access Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:13 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 02/15] ice: fix removal of PTP timestamp tracker during reset Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:19 ` Jacob Keller
2026-09-18 0:22 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 03/15] ice: set in_use only after preparing Tx timestamp index Tony Nguyen
2026-09-11 0:34 ` [PATCH net 04/15] ice: E822: keep Tx timestamps disabled during offset calibration Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:25 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 05/15] ice: E822: cancel offset verification work during reset preparation Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:31 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 06/15] ice: call PTP link change only from link events Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:37 ` Jacob Keller
2026-09-18 1:31 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 07/15] ice: E825: stop clearing PHY_REG_TX_OFFSET_READY Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:41 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 08/15] ice: E825: clear PHY_REG_TX_MEMORY_STATUS prior to soft reset Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:46 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 09/15] ice: E825: perform a soft reset when starting the PHY timer Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 16:58 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 10/15] ice: wait for in-flight Tx timestamps before flushing the tracker Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 17:00 ` Jacob Keller [this message]
2026-09-11 0:34 ` [PATCH net 11/15] ice: keep Tx timestamp slots tracked until completion or timeout Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 17:47 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 12/15] ice: remove unnecessary discarding of timestamps after clock adjust Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 17:53 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 13/15] ice: skip reading Tx ready bitmap on ports with no timestamps Tony Nguyen
2026-09-11 0:34 ` [PATCH net 14/15] ice: don't clear in_use until HW clears ready bitmap Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 17:56 ` Jacob Keller
2026-09-11 0:34 ` [PATCH net 15/15] ice: Recalibrate PHY after settime64 on E825-C Tony Nguyen
2026-09-16 1:12 ` Jakub Kicinski
2026-09-17 18:02 ` Jacob Keller
2026-09-16 21:46 ` [PATCH net 00/15][pull request] ice: E82x: timestamp processing logic fixes Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b172f10a-837c-4adc-b7d5-dd34ed544fb5@intel.com \
--to=jacob.e.keller@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=alexander.nowlin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=grzegorz.nitka@intel.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=maciej.machnikowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=poros@redhat.com \
--cc=przemyslaw.korba@intel.com \
--cc=richardcochran@gmail.com \
--cc=sergey.temerkhanov@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox