Skip to content

Commit a11b6c1

Browse files
mmichaliINTCanguy11
authored andcommitted
ice: fix PTP stale Tx timestamps cleanup
Read stale PTP Tx timestamps from PHY on cleanup. After running out of Tx timestamps request handlers, hardware (HW) stops reporting finished requests. Function ice_ptp_tx_tstamp_cleanup() used to only clean up stale handlers in driver and was leaving the hardware registers not read. Not reading stale PTP Tx timestamps prevents next interrupts from arriving and makes timestamping unusable. Fixes: ea9b847 ("ice: enable transmit timestamps for E810 devices") Signed-off-by: Michal Michalik <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Paul Menzel <[email protected]> Tested-by: Gurucharan <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 6096dae commit a11b6c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,7 @@ ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx)
22872287

22882288
/**
22892289
* ice_ptp_tx_tstamp_cleanup - Cleanup old timestamp requests that got dropped
2290+
* @hw: pointer to the hw struct
22902291
* @tx: PTP Tx tracker to clean up
22912292
*
22922293
* Loop through the Tx timestamp requests and see if any of them have been
@@ -2295,7 +2296,7 @@ ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx)
22952296
* timestamp will never be captured. This might happen if the packet gets
22962297
* discarded before it reaches the PHY timestamping block.
22972298
*/
2298-
static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx)
2299+
static void ice_ptp_tx_tstamp_cleanup(struct ice_hw *hw, struct ice_ptp_tx *tx)
22992300
{
23002301
u8 idx;
23012302

@@ -2304,11 +2305,16 @@ static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx)
23042305

23052306
for_each_set_bit(idx, tx->in_use, tx->len) {
23062307
struct sk_buff *skb;
2308+
u64 raw_tstamp;
23072309

23082310
/* Check if this SKB has been waiting for too long */
23092311
if (time_is_after_jiffies(tx->tstamps[idx].start + 2 * HZ))
23102312
continue;
23112313

2314+
/* Read tstamp to be able to use this register again */
2315+
ice_read_phy_tstamp(hw, tx->quad, idx + tx->quad_offset,
2316+
&raw_tstamp);
2317+
23122318
spin_lock(&tx->lock);
23132319
skb = tx->tstamps[idx].skb;
23142320
tx->tstamps[idx].skb = NULL;
@@ -2330,7 +2336,7 @@ static void ice_ptp_periodic_work(struct kthread_work *work)
23302336

23312337
ice_ptp_update_cached_phctime(pf);
23322338

2333-
ice_ptp_tx_tstamp_cleanup(&pf->ptp.port.tx);
2339+
ice_ptp_tx_tstamp_cleanup(&pf->hw, &pf->ptp.port.tx);
23342340

23352341
/* Run twice a second */
23362342
kthread_queue_delayed_work(ptp->kworker, &ptp->work,

0 commit comments

Comments
 (0)