Skip to content

Commit d938a8c

Browse files
mmichaliINTCanguy11
authored andcommitted
ice: Auxbus devices & driver for E822 TS
There is a problem in HW in E822-based devices leading to race condition. It might happen that, in order: - PF0 (which owns the PHC) requests few timestamps, - PF1 requests a timestamp, - interrupt is being triggered and both PF0 and PF1 threads are woken up, - PF0 got one timestamp, still waiting for others so not going to sleep, - PF1 gets it's timestamp, process it and go to sleep, - PF1 requests a timestamp again, - just before PF0 goes to sleep timestamp of PF1 appear, - PF0 finishes all it's timestamps and go to sleep (PF1 also sleeping). That leaves PF1 timestamp memory not read, which lead to blocking the next interrupt from arriving. Fix it by adding auxiliary devices and only one driver to handle all the timestamps for all PF's by PHC owner. In the past each PF requested it's own timestamps and process it from the start till the end which causes problem described above. Currently each PF requests the timestamps as before, but the actual reading of the completed timestamps is being done by the PTP auxiliary driver, which is registered by the PF which owns PHC. Additionally, the newly introduced auxiliary driver/devices for PTP clock owner will be used for other features in all products (including E810). Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Karol Kolacinski <[email protected]> Signed-off-by: Michal Michalik <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent b3af9c0 commit d938a8c

File tree

5 files changed

+430
-17
lines changed

5 files changed

+430
-17
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,18 @@ static inline bool ice_vector_ch_enabled(struct ice_q_vector *qv)
673673
return !!qv->ch; /* Enable it to run with TC */
674674
}
675675

676+
/**
677+
* ice_ptp_pf_handles_tx_interrupt - Check if PF handles Tx interrupt
678+
* @pf: Board private structure
679+
*
680+
* Return true if this PF should respond to the Tx timestamp interrupt
681+
* indication in the miscellaneous OICR interrupt handler.
682+
*/
683+
static inline bool ice_ptp_pf_handles_tx_interrupt(struct ice_pf *pf)
684+
{
685+
return pf->ptp.tx_interrupt_mode != ICE_PTP_TX_INTERRUPT_NONE;
686+
}
687+
676688
/**
677689
* ice_irq_dynamic_ena - Enable default interrupt generation settings
678690
* @hw: pointer to HW struct

drivers/net/ethernet/intel/ice/ice_hw_autogen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@
231231
#define PFINT_SB_CTL 0x0016B600
232232
#define PFINT_SB_CTL_MSIX_INDX_M ICE_M(0x7FF, 0)
233233
#define PFINT_SB_CTL_CAUSE_ENA_M BIT(30)
234+
#define PFINT_TSYN_MSK 0x0016C980
234235
#define QINT_RQCTL(_QRX) (0x00150000 + ((_QRX) * 4))
235236
#define QINT_RQCTL_MSIX_INDX_S 0
236237
#define QINT_RQCTL_MSIX_INDX_M ICE_M(0x7FF, 0)

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
31493149

31503150
if (oicr & PFINT_OICR_TSYN_TX_M) {
31513151
ena_mask &= ~PFINT_OICR_TSYN_TX_M;
3152-
if (!hw->reset_ongoing)
3152+
if (!hw->reset_ongoing && ice_ptp_pf_handles_tx_interrupt(pf))
31533153
set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
31543154
}
31553155

@@ -7375,8 +7375,13 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
73757375
}
73767376

73777377
/* configure PTP timestamping after VSI rebuild */
7378-
if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))
7379-
ice_ptp_cfg_timestamp(pf, false);
7378+
if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) {
7379+
if (pf->ptp.tx_interrupt_mode == ICE_PTP_TX_INTERRUPT_SELF)
7380+
ice_ptp_cfg_timestamp(pf, false);
7381+
else if (pf->ptp.tx_interrupt_mode == ICE_PTP_TX_INTERRUPT_ALL)
7382+
/* for E82x PHC owner always need to have interrupts */
7383+
ice_ptp_cfg_timestamp(pf, true);
7384+
}
73807385

73817386
err = ice_vsi_rebuild_by_type(pf, ICE_VSI_SWITCHDEV_CTRL);
73827387
if (err) {

0 commit comments

Comments
 (0)