[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250520110823.1937981-10-karol.kolacinski@intel.com>
Date: Tue, 20 May 2025 13:06:29 +0200
From: Karol Kolacinski <karol.kolacinski@...el.com>
To: intel-wired-lan@...ts.osuosl.org
Cc: netdev@...r.kernel.org,
anthony.l.nguyen@...el.com,
przemyslaw.kitszel@...el.com,
richardcochran@...il.com,
Karol Kolacinski <karol.kolacinski@...el.com>,
Milena Olech <milena.olech@...el.com>
Subject: [PATCH iwl-next 4/4] ice: read Tx timestamps in the IRQ top half
With sideband queue using delays and spin locks, it is possible to
read timestamps from the PHY in the top half of the interrupt.
This removes bottom half scheduling delays and improves timestamping
read times significantly, from >2 ms to <50 us.
Reviewed-by: Milena Olech <milena.olech@...el.com>
Signed-off-by: Karol Kolacinski <karol.kolacinski@...el.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.c | 46 ++++++++++++------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index b8e55931fc52..e1068489fde5 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2694,39 +2694,37 @@ irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
switch (hw->mac_type) {
case ICE_MAC_E810:
+ {
+ struct ice_ptp_tx *tx = &pf->ptp.port.tx;
+ u8 idx;
+
+ if (!ice_pf_state_is_nominal(pf))
+ return IRQ_HANDLED;
+
/* E810 capable of low latency timestamping with interrupt can
* request a single timestamp in the top half and wait for
* a second LL TS interrupt from the FW when it's ready.
*/
- if (hw->dev_caps.ts_dev_info.ts_ll_int_read) {
- struct ice_ptp_tx *tx = &pf->ptp.port.tx;
- u8 idx;
-
- if (!ice_pf_state_is_nominal(pf))
+ if (!hw->dev_caps.ts_dev_info.ts_ll_int_read) {
+ if (!ice_ptp_pf_handles_tx_interrupt(pf))
return IRQ_HANDLED;
- spin_lock(&tx->lock);
- idx = find_next_bit_wrap(tx->in_use, tx->len,
- tx->last_ll_ts_idx_read + 1);
- if (idx != tx->len)
- ice_ptp_req_tx_single_tstamp(tx, idx);
- spin_unlock(&tx->lock);
-
- return IRQ_HANDLED;
+ set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
+ return IRQ_WAKE_THREAD;
}
- fallthrough; /* non-LL_TS E810 */
- case ICE_MAC_GENERIC:
- case ICE_MAC_GENERIC_3K_E825:
- /* All other devices process timestamps in the bottom half due
- * to sleeping or polling.
- */
- if (!ice_ptp_pf_handles_tx_interrupt(pf))
- return IRQ_HANDLED;
- set_bit(ICE_MISC_THREAD_TX_TSTAMP, pf->misc_thread);
- return IRQ_WAKE_THREAD;
+ spin_lock(&tx->lock);
+ idx = find_next_bit_wrap(tx->in_use, tx->len,
+ tx->last_ll_ts_idx_read + 1);
+ if (idx != tx->len)
+ ice_ptp_req_tx_single_tstamp(tx, idx);
+ spin_unlock(&tx->lock);
+
+ return IRQ_HANDLED;
+ }
case ICE_MAC_E830:
- /* E830 can read timestamps in the top half using rd32() */
+ case ICE_MAC_GENERIC:
+ case ICE_MAC_GENERIC_3K_E825:
if (ice_ptp_process_ts(pf) == ICE_TX_TSTAMP_WORK_PENDING) {
/* Process outstanding Tx timestamps. If there
* is more work, re-arm the interrupt to trigger again.
--
2.49.0
Powered by blists - more mailing lists