Merge branch 'ice-fix-timestamping-in-reset-process'
Tony Nguyen says: ==================== ice: fix timestamping in reset process Karol Kolacinski says: PTP reset process has multiple places where timestamping can end up in an incorrect state. This series introduces a proper state machine for PTP and refactors a large part of the code to ensure that timestamping does not break. The following are changes since commit 91374ba537bd60caa9ae052c9f1c0fe055b39149: net: dsa: mt7530: support OF-based registration of switch MDIO bus and are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 100GbE ==================== Link: https://lore.kernel.org/r/20240125215757.2601799-1-anthony.l.nguyen@intel.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
e8166eb246
@ -493,7 +493,6 @@ enum ice_pf_flags {
|
||||
ICE_FLAG_DCB_ENA,
|
||||
ICE_FLAG_FD_ENA,
|
||||
ICE_FLAG_PTP_SUPPORTED, /* PTP is supported by NVM */
|
||||
ICE_FLAG_PTP, /* PTP is enabled by software */
|
||||
ICE_FLAG_ADV_FEATURES,
|
||||
ICE_FLAG_TC_MQPRIO, /* support for Multi queue TC */
|
||||
ICE_FLAG_CLS_FLOWER,
|
||||
|
@ -3360,7 +3360,7 @@ ice_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
|
||||
struct ice_pf *pf = ice_netdev_to_pf(dev);
|
||||
|
||||
/* only report timestamping if PTP is enabled */
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return ethtool_op_get_ts_info(dev, info);
|
||||
|
||||
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
|
||||
|
@ -613,7 +613,7 @@ skip:
|
||||
ice_pf_dis_all_vsi(pf, false);
|
||||
|
||||
if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))
|
||||
ice_ptp_prepare_for_reset(pf);
|
||||
ice_ptp_prepare_for_reset(pf, reset_type);
|
||||
|
||||
if (ice_is_feature_supported(pf, ICE_F_GNSS))
|
||||
ice_gnss_exit(pf);
|
||||
@ -7548,7 +7548,7 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
* fail.
|
||||
*/
|
||||
if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))
|
||||
ice_ptp_reset(pf);
|
||||
ice_ptp_rebuild(pf, reset_type);
|
||||
|
||||
if (ice_is_feature_supported(pf, ICE_F_GNSS))
|
||||
ice_gnss_init(pf);
|
||||
|
@ -601,17 +601,13 @@ void ice_ptp_complete_tx_single_tstamp(struct ice_ptp_tx *tx)
|
||||
/* Read the low 32 bit value */
|
||||
raw_tstamp |= (u64)rd32(&pf->hw, PF_SB_ATQBAH);
|
||||
|
||||
/* For PHYs which don't implement a proper timestamp ready bitmap,
|
||||
* verify that the timestamp value is different from the last cached
|
||||
* timestamp. If it is not, skip this for now assuming it hasn't yet
|
||||
* been captured by hardware.
|
||||
/* Devices using this interface always verify the timestamp differs
|
||||
* relative to the last cached timestamp value.
|
||||
*/
|
||||
if (!drop_ts && tx->verify_cached &&
|
||||
raw_tstamp == tx->tstamps[idx].cached_tstamp)
|
||||
if (raw_tstamp == tx->tstamps[idx].cached_tstamp)
|
||||
return;
|
||||
|
||||
if (tx->verify_cached && raw_tstamp)
|
||||
tx->tstamps[idx].cached_tstamp = raw_tstamp;
|
||||
tx->tstamps[idx].cached_tstamp = raw_tstamp;
|
||||
clear_bit(idx, tx->in_use);
|
||||
skb = tx->tstamps[idx].skb;
|
||||
tx->tstamps[idx].skb = NULL;
|
||||
@ -701,9 +697,11 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
|
||||
hw = &pf->hw;
|
||||
|
||||
/* Read the Tx ready status first */
|
||||
err = ice_get_phy_tx_tstamp_ready(hw, tx->block, &tstamp_ready);
|
||||
if (err)
|
||||
return;
|
||||
if (tx->has_ready_bitmap) {
|
||||
err = ice_get_phy_tx_tstamp_ready(hw, tx->block, &tstamp_ready);
|
||||
if (err)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Drop packets if the link went down */
|
||||
link_up = ptp_port->link_up;
|
||||
@ -731,7 +729,8 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
|
||||
* If we do not, the hardware logic for generating a new
|
||||
* interrupt can get stuck on some devices.
|
||||
*/
|
||||
if (!(tstamp_ready & BIT_ULL(phy_idx))) {
|
||||
if (tx->has_ready_bitmap &&
|
||||
!(tstamp_ready & BIT_ULL(phy_idx))) {
|
||||
if (drop_ts)
|
||||
goto skip_ts_read;
|
||||
|
||||
@ -751,7 +750,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
|
||||
* from the last cached timestamp. If it is not, skip this for
|
||||
* now assuming it hasn't yet been captured by hardware.
|
||||
*/
|
||||
if (!drop_ts && tx->verify_cached &&
|
||||
if (!drop_ts && !tx->has_ready_bitmap &&
|
||||
raw_tstamp == tx->tstamps[idx].cached_tstamp)
|
||||
continue;
|
||||
|
||||
@ -761,7 +760,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
|
||||
|
||||
skip_ts_read:
|
||||
spin_lock_irqsave(&tx->lock, flags);
|
||||
if (tx->verify_cached && raw_tstamp)
|
||||
if (!tx->has_ready_bitmap && raw_tstamp)
|
||||
tx->tstamps[idx].cached_tstamp = raw_tstamp;
|
||||
clear_bit(idx, tx->in_use);
|
||||
skb = tx->tstamps[idx].skb;
|
||||
@ -964,6 +963,22 @@ ice_ptp_mark_tx_tracker_stale(struct ice_ptp_tx *tx)
|
||||
spin_unlock_irqrestore(&tx->lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_flush_all_tx_tracker - Flush all timestamp trackers on this clock
|
||||
* @pf: Board private structure
|
||||
*
|
||||
* Called by the clock owner to flush all the Tx timestamp trackers associated
|
||||
* with the clock.
|
||||
*/
|
||||
static void
|
||||
ice_ptp_flush_all_tx_tracker(struct ice_pf *pf)
|
||||
{
|
||||
struct ice_ptp_port *port;
|
||||
|
||||
list_for_each_entry(port, &pf->ptp.ports_owner.ports, list_member)
|
||||
ice_ptp_flush_tx_tracker(ptp_port_to_pf(port), &port->tx);
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_release_tx_tracker - Release allocated memory for Tx tracker
|
||||
* @pf: Board private structure
|
||||
@ -1014,7 +1029,7 @@ ice_ptp_init_tx_e82x(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
|
||||
tx->block = port / ICE_PORTS_PER_QUAD;
|
||||
tx->offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT_E82X;
|
||||
tx->len = INDEX_PER_PORT_E82X;
|
||||
tx->verify_cached = 0;
|
||||
tx->has_ready_bitmap = 1;
|
||||
|
||||
return ice_ptp_alloc_tx_tracker(tx);
|
||||
}
|
||||
@ -1037,7 +1052,7 @@ ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx)
|
||||
* verify new timestamps against cached copy of the last read
|
||||
* timestamp.
|
||||
*/
|
||||
tx->verify_cached = 1;
|
||||
tx->has_ready_bitmap = 0;
|
||||
|
||||
return ice_ptp_alloc_tx_tracker(tx);
|
||||
}
|
||||
@ -1430,7 +1445,7 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
|
||||
struct ice_ptp_port *ptp_port;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return;
|
||||
|
||||
if (WARN_ON_ONCE(port >= ICE_NUM_EXTERNAL_PORTS))
|
||||
@ -1456,14 +1471,14 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_tx_ena_intr - Enable or disable the Tx timestamp interrupt
|
||||
* ice_ptp_cfg_phy_interrupt - Configure PHY interrupt settings
|
||||
* @pf: PF private structure
|
||||
* @ena: bool value to enable or disable interrupt
|
||||
* @threshold: Minimum number of packets at which intr is triggered
|
||||
*
|
||||
* Utility function to enable or disable Tx timestamp interrupt and threshold
|
||||
*/
|
||||
static int ice_ptp_tx_ena_intr(struct ice_pf *pf, bool ena, u32 threshold)
|
||||
static int ice_ptp_cfg_phy_interrupt(struct ice_pf *pf, bool ena, u32 threshold)
|
||||
{
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
int err = 0;
|
||||
@ -2162,7 +2177,7 @@ int ice_ptp_get_ts_config(struct ice_pf *pf, struct ifreq *ifr)
|
||||
{
|
||||
struct hwtstamp_config *config;
|
||||
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return -EIO;
|
||||
|
||||
config = &pf->ptp.tstamp_config;
|
||||
@ -2232,7 +2247,7 @@ int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr)
|
||||
struct hwtstamp_config config;
|
||||
int err;
|
||||
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return -EAGAIN;
|
||||
|
||||
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
|
||||
@ -2616,7 +2631,7 @@ static void ice_ptp_periodic_work(struct kthread_work *work)
|
||||
struct ice_pf *pf = container_of(ptp, struct ice_pf, ptp);
|
||||
int err;
|
||||
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return;
|
||||
|
||||
err = ice_ptp_update_cached_phctime(pf);
|
||||
@ -2629,36 +2644,72 @@ static void ice_ptp_periodic_work(struct kthread_work *work)
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_reset - Initialize PTP hardware clock support after reset
|
||||
* ice_ptp_prepare_for_reset - Prepare PTP for reset
|
||||
* @pf: Board private structure
|
||||
* @reset_type: the reset type being performed
|
||||
*/
|
||||
void ice_ptp_reset(struct ice_pf *pf)
|
||||
void ice_ptp_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
{
|
||||
struct ice_ptp *ptp = &pf->ptp;
|
||||
u8 src_tmr;
|
||||
|
||||
if (ptp->state != ICE_PTP_READY)
|
||||
return;
|
||||
|
||||
ptp->state = ICE_PTP_RESETTING;
|
||||
|
||||
/* Disable timestamping for both Tx and Rx */
|
||||
ice_ptp_disable_timestamp_mode(pf);
|
||||
|
||||
kthread_cancel_delayed_work_sync(&ptp->work);
|
||||
|
||||
if (reset_type == ICE_RESET_PFR)
|
||||
return;
|
||||
|
||||
ice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx);
|
||||
|
||||
/* Disable periodic outputs */
|
||||
ice_ptp_disable_all_clkout(pf);
|
||||
|
||||
src_tmr = ice_get_ptp_src_clock_index(&pf->hw);
|
||||
|
||||
/* Disable source clock */
|
||||
wr32(&pf->hw, GLTSYN_ENA(src_tmr), (u32)~GLTSYN_ENA_TSYN_ENA_M);
|
||||
|
||||
/* Acquire PHC and system timer to restore after reset */
|
||||
ptp->reset_time = ktime_get_real_ns();
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_rebuild_owner - Initialize PTP clock owner after reset
|
||||
* @pf: Board private structure
|
||||
*
|
||||
* Companion function for ice_ptp_rebuild() which handles tasks that only the
|
||||
* PTP clock owner instance should perform.
|
||||
*/
|
||||
static int ice_ptp_rebuild_owner(struct ice_pf *pf)
|
||||
{
|
||||
struct ice_ptp *ptp = &pf->ptp;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct timespec64 ts;
|
||||
int err, itr = 1;
|
||||
u64 time_diff;
|
||||
|
||||
if (test_bit(ICE_PFR_REQ, pf->state) ||
|
||||
!ice_pf_src_tmr_owned(pf))
|
||||
goto pfr;
|
||||
int err;
|
||||
|
||||
err = ice_ptp_init_phc(hw);
|
||||
if (err)
|
||||
goto err;
|
||||
return err;
|
||||
|
||||
/* Acquire the global hardware lock */
|
||||
if (!ice_ptp_lock(hw)) {
|
||||
err = -EBUSY;
|
||||
goto err;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Write the increment time value to PHY and LAN */
|
||||
err = ice_ptp_write_incval(hw, ice_base_incval(pf));
|
||||
if (err) {
|
||||
ice_ptp_unlock(hw);
|
||||
goto err;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Write the initial Time value to PHY and LAN using the cached PHC
|
||||
@ -2674,38 +2725,54 @@ void ice_ptp_reset(struct ice_pf *pf)
|
||||
err = ice_ptp_write_init(pf, &ts);
|
||||
if (err) {
|
||||
ice_ptp_unlock(hw);
|
||||
goto err;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Release the global hardware lock */
|
||||
ice_ptp_unlock(hw);
|
||||
|
||||
/* Flush software tracking of any outstanding timestamps since we're
|
||||
* about to flush the PHY timestamp block.
|
||||
*/
|
||||
ice_ptp_flush_all_tx_tracker(pf);
|
||||
|
||||
if (!ice_is_e810(hw)) {
|
||||
/* Enable quad interrupts */
|
||||
err = ice_ptp_tx_ena_intr(pf, true, itr);
|
||||
err = ice_ptp_cfg_phy_interrupt(pf, true, 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ice_ptp_restart_all_phy(pf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_rebuild - Initialize PTP hardware clock support after reset
|
||||
* @pf: Board private structure
|
||||
* @reset_type: the reset type being performed
|
||||
*/
|
||||
void ice_ptp_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
{
|
||||
struct ice_ptp *ptp = &pf->ptp;
|
||||
int err;
|
||||
|
||||
if (ptp->state == ICE_PTP_READY) {
|
||||
ice_ptp_prepare_for_reset(pf, reset_type);
|
||||
} else if (ptp->state != ICE_PTP_RESETTING) {
|
||||
err = -EINVAL;
|
||||
dev_err(ice_pf_to_dev(pf), "PTP was not initialized\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (ice_pf_src_tmr_owned(pf) && reset_type != ICE_RESET_PFR) {
|
||||
err = ice_ptp_rebuild_owner(pf);
|
||||
if (err)
|
||||
goto err;
|
||||
}
|
||||
|
||||
pfr:
|
||||
/* Init Tx structures */
|
||||
if (ice_is_e810(&pf->hw)) {
|
||||
err = ice_ptp_init_tx_e810(pf, &ptp->port.tx);
|
||||
} else {
|
||||
kthread_init_delayed_work(&ptp->port.ov_work,
|
||||
ice_ptp_wait_for_offsets);
|
||||
err = ice_ptp_init_tx_e82x(pf, &ptp->port.tx,
|
||||
ptp->port.port_num);
|
||||
}
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
set_bit(ICE_FLAG_PTP, pf->flags);
|
||||
|
||||
/* Restart the PHY timestamping block */
|
||||
if (!test_bit(ICE_PFR_REQ, pf->state) &&
|
||||
ice_pf_src_tmr_owned(pf))
|
||||
ice_ptp_restart_all_phy(pf);
|
||||
ptp->state = ICE_PTP_READY;
|
||||
|
||||
/* Start periodic work going */
|
||||
kthread_queue_delayed_work(ptp->kworker, &ptp->work, 0);
|
||||
@ -2714,6 +2781,7 @@ pfr:
|
||||
return;
|
||||
|
||||
err:
|
||||
ptp->state = ICE_PTP_ERROR;
|
||||
dev_err(ice_pf_to_dev(pf), "PTP reset failed %d\n", err);
|
||||
}
|
||||
|
||||
@ -2922,39 +2990,6 @@ int ice_ptp_clock_index(struct ice_pf *pf)
|
||||
return clock ? ptp_clock_index(clock) : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_prepare_for_reset - Prepare PTP for reset
|
||||
* @pf: Board private structure
|
||||
*/
|
||||
void ice_ptp_prepare_for_reset(struct ice_pf *pf)
|
||||
{
|
||||
struct ice_ptp *ptp = &pf->ptp;
|
||||
u8 src_tmr;
|
||||
|
||||
clear_bit(ICE_FLAG_PTP, pf->flags);
|
||||
|
||||
/* Disable timestamping for both Tx and Rx */
|
||||
ice_ptp_disable_timestamp_mode(pf);
|
||||
|
||||
kthread_cancel_delayed_work_sync(&ptp->work);
|
||||
|
||||
if (test_bit(ICE_PFR_REQ, pf->state))
|
||||
return;
|
||||
|
||||
ice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx);
|
||||
|
||||
/* Disable periodic outputs */
|
||||
ice_ptp_disable_all_clkout(pf);
|
||||
|
||||
src_tmr = ice_get_ptp_src_clock_index(&pf->hw);
|
||||
|
||||
/* Disable source clock */
|
||||
wr32(&pf->hw, GLTSYN_ENA(src_tmr), (u32)~GLTSYN_ENA_TSYN_ENA_M);
|
||||
|
||||
/* Acquire PHC and system timer to restore after reset */
|
||||
ptp->reset_time = ktime_get_real_ns();
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_ptp_init_owner - Initialize PTP_1588_CLOCK device
|
||||
* @pf: Board private structure
|
||||
@ -2967,7 +3002,7 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
|
||||
{
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
struct timespec64 ts;
|
||||
int err, itr = 1;
|
||||
int err;
|
||||
|
||||
err = ice_ptp_init_phc(hw);
|
||||
if (err) {
|
||||
@ -3002,7 +3037,7 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
|
||||
|
||||
if (!ice_is_e810(hw)) {
|
||||
/* Enable quad interrupts */
|
||||
err = ice_ptp_tx_ena_intr(pf, true, itr);
|
||||
err = ice_ptp_cfg_phy_interrupt(pf, true, 1);
|
||||
if (err)
|
||||
goto err_exit;
|
||||
}
|
||||
@ -3195,6 +3230,8 @@ void ice_ptp_init(struct ice_pf *pf)
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
int err;
|
||||
|
||||
ptp->state = ICE_PTP_INITIALIZING;
|
||||
|
||||
ice_ptp_init_phy_model(hw);
|
||||
|
||||
ice_ptp_init_tx_interrupt_mode(pf);
|
||||
@ -3219,12 +3256,13 @@ void ice_ptp_init(struct ice_pf *pf)
|
||||
/* Configure initial Tx interrupt settings */
|
||||
ice_ptp_cfg_tx_interrupt(pf);
|
||||
|
||||
set_bit(ICE_FLAG_PTP, pf->flags);
|
||||
err = ice_ptp_init_work(pf, ptp);
|
||||
err = ice_ptp_create_auxbus_device(pf);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
err = ice_ptp_create_auxbus_device(pf);
|
||||
ptp->state = ICE_PTP_READY;
|
||||
|
||||
err = ice_ptp_init_work(pf, ptp);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
@ -3237,7 +3275,7 @@ err:
|
||||
ptp_clock_unregister(ptp->clock);
|
||||
pf->ptp.clock = NULL;
|
||||
}
|
||||
clear_bit(ICE_FLAG_PTP, pf->flags);
|
||||
ptp->state = ICE_PTP_ERROR;
|
||||
dev_err(ice_pf_to_dev(pf), "PTP failed %d\n", err);
|
||||
}
|
||||
|
||||
@ -3250,9 +3288,11 @@ err:
|
||||
*/
|
||||
void ice_ptp_release(struct ice_pf *pf)
|
||||
{
|
||||
if (!test_bit(ICE_FLAG_PTP, pf->flags))
|
||||
if (pf->ptp.state != ICE_PTP_READY)
|
||||
return;
|
||||
|
||||
pf->ptp.state = ICE_PTP_UNINIT;
|
||||
|
||||
/* Disable timestamping for both Tx and Rx */
|
||||
ice_ptp_disable_timestamp_mode(pf);
|
||||
|
||||
@ -3260,8 +3300,6 @@ void ice_ptp_release(struct ice_pf *pf)
|
||||
|
||||
ice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx);
|
||||
|
||||
clear_bit(ICE_FLAG_PTP, pf->flags);
|
||||
|
||||
kthread_cancel_delayed_work_sync(&pf->ptp.work);
|
||||
|
||||
ice_ptp_port_phy_stop(&pf->ptp.port);
|
||||
@ -3271,6 +3309,9 @@ void ice_ptp_release(struct ice_pf *pf)
|
||||
pf->ptp.kworker = NULL;
|
||||
}
|
||||
|
||||
if (ice_pf_src_tmr_owned(pf))
|
||||
ice_ptp_unregister_auxbus_driver(pf);
|
||||
|
||||
if (!pf->ptp.clock)
|
||||
return;
|
||||
|
||||
@ -3280,7 +3321,5 @@ void ice_ptp_release(struct ice_pf *pf)
|
||||
ptp_clock_unregister(pf->ptp.clock);
|
||||
pf->ptp.clock = NULL;
|
||||
|
||||
ice_ptp_unregister_auxbus_driver(pf);
|
||||
|
||||
dev_info(ice_pf_to_dev(pf), "Removed PTP clock\n");
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ struct ice_perout_channel {
|
||||
* the last timestamp we read for a given index. If the current timestamp
|
||||
* value is the same as the cached value, we assume a new timestamp hasn't
|
||||
* been captured. This avoids reporting stale timestamps to the stack. This is
|
||||
* only done if the verify_cached flag is set in ice_ptp_tx structure.
|
||||
* only done if the has_ready_bitmap flag is not set in ice_ptp_tx structure.
|
||||
*/
|
||||
struct ice_tx_tstamp {
|
||||
struct sk_buff *skb;
|
||||
@ -130,7 +130,9 @@ enum ice_tx_tstamp_work {
|
||||
* @init: if true, the tracker is initialized;
|
||||
* @calibrating: if true, the PHY is calibrating the Tx offset. During this
|
||||
* window, timestamps are temporarily disabled.
|
||||
* @verify_cached: if true, verify new timestamp differs from last read value
|
||||
* @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.
|
||||
* @last_ll_ts_idx_read: index of the last LL TS read by the FW
|
||||
*/
|
||||
struct ice_ptp_tx {
|
||||
@ -143,7 +145,7 @@ struct ice_ptp_tx {
|
||||
u8 len;
|
||||
u8 init : 1;
|
||||
u8 calibrating : 1;
|
||||
u8 verify_cached : 1;
|
||||
u8 has_ready_bitmap : 1;
|
||||
s8 last_ll_ts_idx_read;
|
||||
};
|
||||
|
||||
@ -203,8 +205,17 @@ struct ice_ptp_port_owner {
|
||||
|
||||
#define GLTSYN_TGT_H_IDX_MAX 4
|
||||
|
||||
enum ice_ptp_state {
|
||||
ICE_PTP_UNINIT = 0,
|
||||
ICE_PTP_INITIALIZING,
|
||||
ICE_PTP_READY,
|
||||
ICE_PTP_RESETTING,
|
||||
ICE_PTP_ERROR,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ice_ptp - data used for integrating with CONFIG_PTP_1588_CLOCK
|
||||
* @state: current state of PTP state machine
|
||||
* @tx_interrupt_mode: the TX interrupt mode for the PTP clock
|
||||
* @port: data for the PHY port initialization procedure
|
||||
* @ports_owner: data for the auxiliary driver owner
|
||||
@ -227,6 +238,7 @@ struct ice_ptp_port_owner {
|
||||
* @late_cached_phc_updates: number of times cached PHC update is late
|
||||
*/
|
||||
struct ice_ptp {
|
||||
enum ice_ptp_state state;
|
||||
enum ice_ptp_tx_interrupt tx_interrupt_mode;
|
||||
struct ice_ptp_port port;
|
||||
struct ice_ptp_port_owner ports_owner;
|
||||
@ -304,8 +316,9 @@ enum ice_tx_tstamp_work ice_ptp_process_ts(struct ice_pf *pf);
|
||||
|
||||
u64 ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc,
|
||||
const struct ice_pkt_ctx *pkt_ctx);
|
||||
void ice_ptp_reset(struct ice_pf *pf);
|
||||
void ice_ptp_prepare_for_reset(struct ice_pf *pf);
|
||||
void ice_ptp_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);
|
||||
void ice_ptp_prepare_for_reset(struct ice_pf *pf,
|
||||
enum ice_reset_req reset_type);
|
||||
void ice_ptp_init(struct ice_pf *pf);
|
||||
void ice_ptp_release(struct ice_pf *pf);
|
||||
void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup);
|
||||
@ -345,8 +358,15 @@ ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void ice_ptp_reset(struct ice_pf *pf) { }
|
||||
static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf) { }
|
||||
static inline void ice_ptp_rebuild(struct ice_pf *pf,
|
||||
enum ice_reset_req reset_type)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf,
|
||||
enum ice_reset_req reset_type)
|
||||
{
|
||||
}
|
||||
static inline void ice_ptp_init(struct ice_pf *pf) { }
|
||||
static inline void ice_ptp_release(struct ice_pf *pf) { }
|
||||
static inline void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
|
||||
|
Loading…
x
Reference in New Issue
Block a user