Skip to content

Commit

Permalink
ice: Re-enable timestamping correctly after reset
Browse files Browse the repository at this point in the history
During reset, TX_TSYN interrupt should be processed as it may process
timestamps in brief moments before and after reset.
Timestamping should be enabled on VSIs at the end of reset procedure.
On ice_get_phy_tx_tstamp_ready error, interrupt should not be rearmed
because error only happens on resets.

Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Karol Kolacinski authored and Paolo Abeni committed Dec 5, 2023
1 parent e9fd08a commit 1cc5b6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)

if (oicr & PFINT_OICR_TSYN_TX_M) {
ena_mask &= ~PFINT_OICR_TSYN_TX_M;
if (!hw->reset_ongoing && ice_ptp_pf_handles_tx_interrupt(pf))
if (ice_ptp_pf_handles_tx_interrupt(pf))
set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
}

Expand Down
19 changes: 10 additions & 9 deletions drivers/net/ethernet/intel/ice/ice_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,9 @@ static enum ice_tx_tstamp_work ice_ptp_tx_tstamp_owner(struct ice_pf *pf)

/* Read the Tx ready status first */
err = ice_get_phy_tx_tstamp_ready(&pf->hw, i, &tstamp_ready);
if (err || tstamp_ready)
if (err)
break;
else if (tstamp_ready)
return ICE_TX_TSTAMP_WORK_PENDING;
}

Expand Down Expand Up @@ -2468,12 +2470,10 @@ void ice_ptp_reset(struct ice_pf *pf)
int err, itr = 1;
u64 time_diff;

if (test_bit(ICE_PFR_REQ, pf->state))
if (test_bit(ICE_PFR_REQ, pf->state) ||
!ice_pf_src_tmr_owned(pf))
goto pfr;

if (!ice_pf_src_tmr_owned(pf))
goto reset_ts;

err = ice_ptp_init_phc(hw);
if (err)
goto err;
Expand Down Expand Up @@ -2517,10 +2517,6 @@ void ice_ptp_reset(struct ice_pf *pf)
goto err;
}

reset_ts:
/* Restart the PHY timestamping block */
ice_ptp_reset_phy_timestamping(pf);

pfr:
/* Init Tx structures */
if (ice_is_e810(&pf->hw)) {
Expand All @@ -2536,6 +2532,11 @@ void ice_ptp_reset(struct ice_pf *pf)

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);

/* Start periodic work going */
kthread_queue_delayed_work(ptp->kworker, &ptp->work, 0);

Expand Down

0 comments on commit 1cc5b6e

Please sign in to comment.