@@ -613,7 +613,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->calibrating && !tx->link_down;
}
/**
@@ -806,6 +806,8 @@ ice_ptp_alloc_tx_tracker(struct ice_ptp_tx *tx)
}
tx->init = 1;
+ tx->link_down = 0;
+ tx->calibrating = 0;
spin_lock_init(&tx->lock);
@@ -1396,6 +1398,13 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
/* Update cached link status for this port immediately */
ptp_port->link_up = linkup;
+ /* Set the link status of the Tx tracker. While link is down, all Tx
+ * timestamp requests will be ignored.
+ */
+ spin_lock(&ptp_port->tx.lock);
+ ptp_port->tx.link_down = !linkup;
+ spin_unlock(&ptp_port->tx.lock);
+
/* E810 devices do not need to reconfigure the PHY */
if (ice_is_e810(&pf->hw))
return;
@@ -119,6 +119,7 @@ struct ice_tx_tstamp {
* @init: if true, the tracker is initialized;
* @calibrating: if true, the PHY is calibrating the Tx offset. During this
* window, timestamps are temporarily disabled.
+ * @link_down: if true, the link is down and timestamp requests are disabled
* @verify_cached: if true, verify new timestamp differs from last read value
*/
struct ice_ptp_tx {
@@ -130,6 +131,7 @@ struct ice_ptp_tx {
u8 len;
u8 init : 1;
u8 calibrating : 1;
+ u8 link_down : 1;
u8 verify_cached : 1;
};