Netdev List
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, andrew+netdev@lunn.ch,
	netdev@vger.kernel.org
Cc: Kurt Kanzenbach <kurt@linutronix.de>,
	anthony.l.nguyen@intel.com, richardcochran@gmail.com,
	vinicius.gomes@intel.com, jacob.e.keller@intel.com,
	aleksandr.loktionov@intel.com, przemyslaw.kitszel@intel.com,
	vadim.fedorenko@linux.dev, pmenzel@molgen.mpg.de,
	bigeasy@linutronix.de, Rinitha S <sx.rinitha@intel.com>
Subject: [PATCH net-next 06/15] igb: Retrieve Tx timestamp from BH workqueue
Date: Tue,  9 Jun 2026 14:35:47 -0700	[thread overview]
Message-ID: <20260609213559.178657-7-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20260609213559.178657-1-anthony.l.nguyen@intel.com>

From: Kurt Kanzenbach <kurt@linutronix.de>

Retrieve Tx timestamp from system BH instead of regular system workqueue.

The current implementation uses schedule_work() which is executed by the
system work queue and kworkers to retrieve Tx timestamps. This increases
latency and can lead to timeouts in case of heavy system load. i210 is
often used in industrial systems, where timestamp timeouts can be fatal.

Therefore, switch to the system BH workqueues which are executed in softirq
context shortly after the IRQ handler returns.

Tested between Intel i210 and i350 with ptp4l gPTP profile:

|ptp4l[30.405]: rms    4 max    7 freq +12825 +/-   3 delay   247 +/-   0
|ptp4l[31.406]: rms    2 max    3 freq +12829 +/-   3 delay   248 +/-   0
|ptp4l[32.406]: rms    3 max    3 freq +12827 +/-   3 delay   248 +/-   0
|ptp4l[33.406]: rms    2 max    3 freq +12827 +/-   3 delay   248 +/-   0
|ptp4l[34.407]: rms    3 max    6 freq +12825 +/-   4 delay   248 +/-   0
|ptp4l[35.407]: rms    3 max    6 freq +12822 +/-   4 delay   246 +/-   0
|ptp4l[36.407]: rms    7 max   10 freq +12812 +/-   5 delay   248 +/-   0
|ptp4l[37.408]: rms    5 max    8 freq +12808 +/-   3 delay   248 +/-   0

Furthermore, Miroslav Lichvar tested with ntpperf and chrony on Intel i350:

Without the patch:

|               |          responses            |        response time (ns)
|rate   clients |  lost invalid   basic  xleave |    min    mean     max stddev
|150000   15000   0.00%   0.00%   0.00% 100.00%    +4188  +36475 +193328  16179
|157500   15750   0.02%   0.00%   0.02%  99.96%    +6373  +42969 +683894  22682
|165375   16384   0.03%   0.00%   0.00%  99.97%    +7911  +43960 +692471  24454
|173643   16384   0.06%   0.00%   0.00%  99.94%    +8323  +45627 +707240  28452
|182325   16384   0.06%   0.00%   0.00%  99.94%    +8404  +47292 +722524  26936
|191441   16384   0.00%   0.00%   0.00% 100.00%    +8930  +51738 +223727  14272
|201013   16384   0.05%   0.00%   0.00%  99.95%    +9634  +53696 +776445  23783
|211063   16384   0.00%   0.00%   0.00% 100.00%   +14393  +54558 +329546  20473
|221616   16384   2.59%   0.00%   0.05%  97.36%   +23924 +321205 +518192  21838
|232696   16384   7.00%   0.00%   0.10%  92.90%   +33396 +337709 +575661  21017
|244330   16384  10.82%   0.00%   0.15%  89.03%   +34188 +340248 +556237  20880
|
|With the patch:
|150000   15000   5.11%   0.00%   0.00%  94.88%    +4426 +460642 +640884  83746
|157500   15750  11.54%   0.00%   0.26%  88.20%   +14434 +543656 +738355  30349
|165375   16384  15.61%   0.00%   0.31%  84.08%   +35822 +515304 +833859  25596
|173643   16384  19.58%   0.00%   0.37%  80.05%   +20762 +568962 +900100  28118
|182325   16384  23.46%   0.00%   0.42%  76.13%   +41829 +547974 +804170  27890
|191441   16384  27.23%   0.00%   0.46%  72.31%   +15182 +557920 +798212  28868
|201013   16384  30.51%   0.00%   0.49%  69.00%   +15980 +560764 +805576  29979
|211063   16384   0.06%   0.00%   0.00%  99.94%   +12668  +80487 +410555  62182
|221616   16384   2.94%   0.00%   0.05%  97.00%   +21587 +342769 +517566  23359
|232696   16384   6.94%   0.00%   0.10%  92.96%   +16581 +336068 +484574  18453
|244330   16384  11.45%   0.00%   0.14%  88.41%   +23608 +345023 +564130  19177

There are some minor differences at lower rates, but no performance
regressions at higher ones.

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++--
 drivers/net/ethernet/intel/igb/igb_ptp.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 49d46670695f..17eff90af9e3 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6571,7 +6571,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
 			adapter->ptp_tx_skb = skb_get(skb);
 			adapter->ptp_tx_start = jiffies;
 			if (adapter->hw.mac.type == e1000_82576)
-				schedule_work(&adapter->ptp_tx_work);
+				queue_work(system_bh_wq, &adapter->ptp_tx_work);
 		} else {
 			adapter->tx_hwtstamp_skipped++;
 		}
@@ -7075,7 +7075,7 @@ static void igb_tsync_interrupt(struct igb_adapter *adapter)
 
 	if (tsicr & E1000_TSICR_TXTS) {
 		/* retrieve hardware timestamp */
-		schedule_work(&adapter->ptp_tx_work);
+		queue_work(system_bh_wq, &adapter->ptp_tx_work);
 	}
 
 	if (tsicr & TSINTR_TT0)
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index bd85d02ecadd..7b44f9090631 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -832,7 +832,7 @@ static void igb_ptp_tx_work(struct work_struct *work)
 		igb_ptp_tx_hwtstamp(adapter);
 	else
 		/* reschedule to check later */
-		schedule_work(&adapter->ptp_tx_work);
+		queue_work(system_bh_wq, &adapter->ptp_tx_work);
 }
 
 static void igb_ptp_overflow_check(struct work_struct *work)
-- 
2.47.1


  parent reply	other threads:[~2026-06-09 21:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 21:35 [PATCH net-next 00/15][pull request] Intel Wired LAN Driver Updates 2026-06-09 (idpf, ice, i40e, iavf, ixgbe, igc, igb, e1000e, e1000) Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 01/15] idpf: Replace use of system_unbound_wq with system_dfl_wq Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 02/15] ice: remove redundant checks from PTP init Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 03/15] iavf: iavf_virtchnl_completion: drop duplicate ether_addr_equal() test Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 04/15] net/intel: Replace manual array size calculation with ARRAY_SIZE Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 05/15] ixgbe: e610: remove redundant assignment Tony Nguyen
2026-06-09 21:35 ` Tony Nguyen [this message]
2026-06-12  9:57   ` [PATCH net-next 06/15] igb: Retrieve Tx timestamp from BH workqueue Simon Horman
2026-06-09 21:35 ` [PATCH net-next 07/15] igb: use ktime_get_real helpers in igb_ptp_reset() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 08/15] e1000e: use ktime_get_real_ns() in e1000e_systim_reset() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 09/15] igb: use napi_schedule_irqoff() instead of napi_schedule() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 10/15] igc: " Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 11/15] e1000e: Use __napi_schedule_irqoff() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 12/15] e1000: limit endianness conversion to boundary words Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 13/15] e1000e: " Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 14/15] igb: fix typos in comments Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 15/15] igc: " Tony Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609213559.178657-7-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=sx.rinitha@intel.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vinicius.gomes@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox