On E82x devices, the interrupt for Tx timestamps are handled by the clock owner. When an interrupt with the Tx timestamp cause is fired, the clock owner PF iterates the list of ports and checks for timestamps across all ports. The existing logic reads the PHY timestamp ready bitmap before iterating the list of in-use timestamp indexes, even for ports which have no timestamps waiting in the software timestamp tracker. This has a significant and measurable latency impact on reporting Tx timestamps. Check the bitmap and exit early in the event that there are no timestamps waiting on a port. Observant reviewers may notice that the check is done without acquiring the lock. This is fine, as the only thread that can clear in_use bits is the miscellaneous interrupt handler. Whether the thread sees or fails to see a new outstanding timestamp does not affect correctness, only determining whether or not it should do extra work. Using the ice Tx timestamp traces, with a simple ptp4l setup the average latency appears to be around 175 to 200 microseconds with a few outliers taking hundreds of microseconds to be reported. With the check to skip empty bitmaps (and thus skip reading the ready bitmap for inactive ports), the average latency drops ~50 microseconds. Fixes: d938a8cca88a ("ice: Auxbus devices & driver for E822 TS") Tested-by: Alexander Nowlin Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 8500e9a5b047..96e96ba1731d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -573,7 +573,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx) pf = ptp_port_to_pf(ptp_port); hw = &pf->hw; - if (!tx->init) + if (!tx->init || bitmap_empty(tx->in_use, tx->len)) return; /* Read the Tx ready status first */ -- 2.55.0.814.gc42f45431d0f