Skip to content

Commit f9472aa

Browse files
kolacinskikarolanguy11
authored andcommitted
ice: Process TSYN IRQ in a separate function
Simplify TSYN IRQ processing by moving it to a separate function and having appropriate behavior per PHY model, instead of multiple conditions not related to HW, but to specific timestamping modes. When PTP is not enabled in the kernel, don't process timestamps and return IRQ_HANDLED. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Karol Kolacinski <karol.kolacinski@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>
1 parent ea7029f commit f9472aa

File tree

3 files changed

+57
-16
lines changed

3 files changed

+57
-16
lines changed

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,22 +3304,8 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
33043304

33053305
if (oicr & PFINT_OICR_TSYN_TX_M) {
33063306
ena_mask &= ~PFINT_OICR_TSYN_TX_M;
3307-
if (ice_pf_state_is_nominal(pf) &&
3308-
pf->hw.dev_caps.ts_dev_info.ts_ll_int_read) {
3309-
struct ice_ptp_tx *tx = &pf->ptp.port.tx;
3310-
unsigned long flags;
3311-
u8 idx;
3312-
3313-
spin_lock_irqsave(&tx->lock, flags);
3314-
idx = find_next_bit_wrap(tx->in_use, tx->len,
3315-
tx->last_ll_ts_idx_read + 1);
3316-
if (idx != tx->len)
3317-
ice_ptp_req_tx_single_tstamp(tx, idx);
3318-
spin_unlock_irqrestore(&tx->lock, flags);
3319-
} else if (ice_ptp_pf_handles_tx_interrupt(pf)) {
3320-
set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
3321-
ret = IRQ_WAKE_THREAD;
3322-
}
3307+
3308+
ret = ice_ptp_ts_irq(pf);
33233309
}
33243310

33253311
if (oicr & PFINT_OICR_TSYN_EVNT_M) {

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,6 +2763,55 @@ enum ice_tx_tstamp_work ice_ptp_process_ts(struct ice_pf *pf)
27632763
}
27642764
}
27652765

2766+
/**
2767+
* ice_ptp_ts_irq - Process the PTP Tx timestamps in IRQ context
2768+
* @pf: Board private structure
2769+
*
2770+
* Return: IRQ_WAKE_THREAD if Tx timestamp read has to be handled in the bottom
2771+
* half of the interrupt and IRQ_HANDLED otherwise.
2772+
*/
2773+
irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
2774+
{
2775+
struct ice_hw *hw = &pf->hw;
2776+
2777+
switch (hw->mac_type) {
2778+
case ICE_MAC_E810:
2779+
/* E810 capable of low latency timestamping with interrupt can
2780+
* request a single timestamp in the top half and wait for
2781+
* a second LL TS interrupt from the FW when it's ready.
2782+
*/
2783+
if (hw->dev_caps.ts_dev_info.ts_ll_int_read) {
2784+
struct ice_ptp_tx *tx = &pf->ptp.port.tx;
2785+
u8 idx;
2786+
2787+
if (!ice_pf_state_is_nominal(pf))
2788+
return IRQ_HANDLED;
2789+
2790+
spin_lock(&tx->lock);
2791+
idx = find_next_bit_wrap(tx->in_use, tx->len,
2792+
tx->last_ll_ts_idx_read + 1);
2793+
if (idx != tx->len)
2794+
ice_ptp_req_tx_single_tstamp(tx, idx);
2795+
spin_unlock(&tx->lock);
2796+
2797+
return IRQ_HANDLED;
2798+
}
2799+
fallthrough; /* non-LL_TS E810 */
2800+
case ICE_MAC_GENERIC:
2801+
case ICE_MAC_GENERIC_3K_E825:
2802+
/* All other devices process timestamps in the bottom half due
2803+
* to sleeping or polling.
2804+
*/
2805+
if (!ice_ptp_pf_handles_tx_interrupt(pf))
2806+
return IRQ_HANDLED;
2807+
2808+
set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
2809+
return IRQ_WAKE_THREAD;
2810+
default:
2811+
return IRQ_HANDLED;
2812+
}
2813+
}
2814+
27662815
/**
27672816
* ice_ptp_maybe_trigger_tx_interrupt - Trigger Tx timstamp interrupt
27682817
* @pf: Board private structure

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ s8 ice_ptp_request_ts(struct ice_ptp_tx *tx, struct sk_buff *skb);
304304
void ice_ptp_req_tx_single_tstamp(struct ice_ptp_tx *tx, u8 idx);
305305
void ice_ptp_complete_tx_single_tstamp(struct ice_ptp_tx *tx);
306306
enum ice_tx_tstamp_work ice_ptp_process_ts(struct ice_pf *pf);
307+
irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf);
307308

308309
u64 ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc,
309310
const struct ice_pkt_ctx *pkt_ctx);
@@ -342,6 +343,11 @@ static inline bool ice_ptp_process_ts(struct ice_pf *pf)
342343
return true;
343344
}
344345

346+
static inline irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
347+
{
348+
return IRQ_HANDLED;
349+
}
350+
345351
static inline u64
346352
ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc,
347353
const struct ice_pkt_ctx *pkt_ctx)

0 commit comments

Comments
 (0)