Skip to content

Commit 7d606a1

Browse files
jacob-kellerPaolo Abeni
authored andcommitted
ice: unify logic for programming PFINT_TSYN_MSK
Commit d938a8c ("ice: Auxbus devices & driver for E822 TS") modified how Tx timestamps are handled for E822 devices. On these devices, only the clock owner handles reading the Tx timestamp data from firmware. To do this, the PFINT_TSYN_MSK register is modified from the default value to one which enables reacting to a Tx timestamp on all PHY ports. The driver currently programs PFINT_TSYN_MSK in different places depending on whether the port is the clock owner or not. For the clock owner, the PFINT_TSYN_MSK value is programmed during ice_ptp_init_owner just before calling ice_ptp_tx_ena_intr to program the PHY ports. For the non-clock owner ports, the PFINT_TSYN_MSK is programmed during ice_ptp_init_port. If a large enough device reset occurs, the PFINT_TSYN_MSK register will be reset to the default value in which only the PHY associated directly with the PF will cause the Tx timestamp interrupt to trigger. The driver lacks logic to reprogram the PFINT_TSYN_MSK register after a device reset. For the E822 device, this results in the PF no longer responding to interrupts for other ports. This results in failure to deliver Tx timestamps to user space applications. Rename ice_ptp_configure_tx_tstamp to ice_ptp_cfg_tx_interrupt, and unify the logic for programming PFINT_TSYN_MSK and PFINT_OICR_ENA into one place. This function will program both registers according to the combination of user configuration and device requirements. This ensures that PFINT_TSYN_MSK is always restored when we configure the Tx timestamp interrupt. Fixes: d938a8c ("ice: Auxbus devices & driver for E822 TS") Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 0ffb08b commit 7d606a1

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

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

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,42 @@ ice_verify_pin_e810t(struct ptp_clock_info *info, unsigned int pin,
256256
}
257257

258258
/**
259-
* ice_ptp_configure_tx_tstamp - Enable or disable Tx timestamp interrupt
260-
* @pf: The PF pointer to search in
261-
* @on: bool value for whether timestamp interrupt is enabled or disabled
259+
* ice_ptp_cfg_tx_interrupt - Configure Tx timestamp interrupt for the device
260+
* @pf: Board private structure
261+
*
262+
* Program the device to respond appropriately to the Tx timestamp interrupt
263+
* cause.
262264
*/
263-
static void ice_ptp_configure_tx_tstamp(struct ice_pf *pf, bool on)
265+
static void ice_ptp_cfg_tx_interrupt(struct ice_pf *pf)
264266
{
267+
struct ice_hw *hw = &pf->hw;
268+
bool enable;
265269
u32 val;
266270

271+
switch (pf->ptp.tx_interrupt_mode) {
272+
case ICE_PTP_TX_INTERRUPT_ALL:
273+
/* React to interrupts across all quads. */
274+
wr32(hw, PFINT_TSYN_MSK + (0x4 * hw->pf_id), (u32)0x1f);
275+
enable = true;
276+
break;
277+
case ICE_PTP_TX_INTERRUPT_NONE:
278+
/* Do not react to interrupts on any quad. */
279+
wr32(hw, PFINT_TSYN_MSK + (0x4 * hw->pf_id), (u32)0x0);
280+
enable = false;
281+
break;
282+
case ICE_PTP_TX_INTERRUPT_SELF:
283+
default:
284+
enable = pf->ptp.tstamp_config.tx_type == HWTSTAMP_TX_ON;
285+
break;
286+
}
287+
267288
/* Configure the Tx timestamp interrupt */
268-
val = rd32(&pf->hw, PFINT_OICR_ENA);
269-
if (on)
289+
val = rd32(hw, PFINT_OICR_ENA);
290+
if (enable)
270291
val |= PFINT_OICR_TSYN_TX_M;
271292
else
272293
val &= ~PFINT_OICR_TSYN_TX_M;
273-
wr32(&pf->hw, PFINT_OICR_ENA, val);
294+
wr32(hw, PFINT_OICR_ENA, val);
274295
}
275296

276297
/**
@@ -280,10 +301,9 @@ static void ice_ptp_configure_tx_tstamp(struct ice_pf *pf, bool on)
280301
*/
281302
static void ice_set_tx_tstamp(struct ice_pf *pf, bool on)
282303
{
283-
if (pf->ptp.tx_interrupt_mode == ICE_PTP_TX_INTERRUPT_SELF)
284-
ice_ptp_configure_tx_tstamp(pf, on);
285-
286304
pf->ptp.tstamp_config.tx_type = on ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
305+
306+
ice_ptp_cfg_tx_interrupt(pf);
287307
}
288308

289309
/**
@@ -2789,15 +2809,7 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
27892809
/* Release the global hardware lock */
27902810
ice_ptp_unlock(hw);
27912811

2792-
if (pf->ptp.tx_interrupt_mode == ICE_PTP_TX_INTERRUPT_ALL) {
2793-
/* The clock owner for this device type handles the timestamp
2794-
* interrupt for all ports.
2795-
*/
2796-
ice_ptp_configure_tx_tstamp(pf, true);
2797-
2798-
/* React on all quads interrupts for E82x */
2799-
wr32(hw, PFINT_TSYN_MSK + (0x4 * hw->pf_id), (u32)0x1f);
2800-
2812+
if (!ice_is_e810(hw)) {
28012813
/* Enable quad interrupts */
28022814
err = ice_ptp_tx_ena_intr(pf, true, itr);
28032815
if (err)
@@ -2867,13 +2879,6 @@ static int ice_ptp_init_port(struct ice_pf *pf, struct ice_ptp_port *ptp_port)
28672879
case ICE_PHY_E810:
28682880
return ice_ptp_init_tx_e810(pf, &ptp_port->tx);
28692881
case ICE_PHY_E822:
2870-
/* Non-owner PFs don't react to any interrupts on E82x,
2871-
* neither on own quad nor on others
2872-
*/
2873-
if (!ice_ptp_pf_handles_tx_interrupt(pf)) {
2874-
ice_ptp_configure_tx_tstamp(pf, false);
2875-
wr32(hw, PFINT_TSYN_MSK + (0x4 * hw->pf_id), (u32)0x0);
2876-
}
28772882
kthread_init_delayed_work(&ptp_port->ov_work,
28782883
ice_ptp_wait_for_offsets);
28792884

@@ -3018,6 +3023,9 @@ void ice_ptp_init(struct ice_pf *pf)
30183023
/* Start the PHY timestamping block */
30193024
ice_ptp_reset_phy_timestamping(pf);
30203025

3026+
/* Configure initial Tx interrupt settings */
3027+
ice_ptp_cfg_tx_interrupt(pf);
3028+
30213029
set_bit(ICE_FLAG_PTP, pf->flags);
30223030
err = ice_ptp_init_work(pf, ptp);
30233031
if (err)

0 commit comments

Comments
 (0)