Skip to contentSkip to conversation

e1000e: do not cache the hwtstamp config before it is applied

PATCH In review Linkui Xiao 4 participants 6 messages Oct 28 – Nov 3

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/5 e1000e: do not cache the hwtstamp config before it is applied

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

- e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

- e1000e_systim_reset() re-applies it after every reset, including the ones the watchdog triggers, and keeps failing;

- e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Fixes 62d7e3a2d006 ("e1000e: Validate hwtstamp_config completely before applying it")
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
index 35f5590228eb..7ae33273734f 100644
@@ -3715,8 +3715,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
 		return -ERANGE;
 	}
 
-	adapter->hwtstamp_config = *config;
-
 	/* enable/disable Tx h/w time stamping */
 	regval = er32(TSYNCTXCTL);
 	regval &= ~E1000_TSYNCTXCTL_ENABLED;
@@ -3763,6 +3761,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
 	er32(RXSTMPH);
 	er32(TXSTMPH);
 
+	adapter->hwtstamp_config = *config;
+
 	return 0;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 2/5
#1 lore raw
Quoted 76 lines

-----Original Message-----
From: Linkui Xiao <[email protected]>
Sent: Wednesday, October 28, 2026 10:05 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]; Linkui Xiao <[email protected]>; [email protected]
Subject: [PATCH net 2/5] e1000e: do not cache the hwtstamp config before it is applied

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

- e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

- e1000e_systim_reset() re-applies it after every reset, including the ones the watchdog triggers, and keeps failing;

- e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Fixes 62d7e3a2d006 ("e1000e: Validate hwtstamp_config completely before

applying it")

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +0 -2
index 35f5590228eb..7ae33273734f 100644
@@ -3715,8 +3715,6 @@ static int e1000e_config_hwtstamp(struct
 e1000_adapter *adapter,
 		return -ERANGE;
 	}
 
-	adapter->hwtstamp_config = *config;
-
 	/* enable/disable Tx h/w time stamping */
 	regval = er32(TSYNCTXCTL);
drivers/net/ethernet/intel/e1000e/netdev.c +2 -1
 	regval &= ~E1000_TSYNCTXCTL_ENABLED;
@@ -3763,6 +3761,8 @@ static int e1000e_config_hwtstamp(struct
 e1000_adapter *adapter,
 	er32(RXSTMPH);
 	er32(TXSTMPH);
 
+	adapter->hwtstamp_config = *config;
+
 	return 0;
 }
 
--
Quoted 1 line

2.25.1

Reviewed-by on v1 2/5
#2 lore raw
In reply to Linkui Xiao
Quoted 48 lines · Linkui Xiao

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

- e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

- e1000e_systim_reset() re-applies it after every reset, including

    the ones the watchdog triggers, and keeps failing;

- e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Fixes 62d7e3a2d006 ("e1000e: Validate hwtstamp_config completely before applying it")
---
  drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +0 -2
index 35f5590228eb..7ae33273734f 100644
@@ -3715,8 +3715,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
  		return -ERANGE;
  	}
 
-	adapter->hwtstamp_config = *config;
-
  	/* enable/disable Tx h/w time stamping */
  	regval = er32(TSYNCTXCTL);
  	regval &= ~E1000_TSYNCTXCTL_ENABLED;

drivers/net/ethernet/intel/e1000e/netdev.c static int e1000e_config_hwtstamp(struct e1000_adapter *adapter, · line 3768

Quoted 8 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2 -0
@@ -3763,6 +3761,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
  	er32(RXSTMPH);
  	er32(TXSTMPH);
 
+	adapter->hwtstamp_config = *config;
+
  	return 0;
  }
 
#3 lore raw
In reply to Linkui Xiao
Quoted 23 lines · Linkui Xiao

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

- e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

- e1000e_systim_reset() re-applies it after every reset, including the ones the watchdog triggers, and keeps failing;

- e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Quoted 4 lines

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Any idea why this got marked as patch 2 out of 5? This doesn't appear on either netdev or iwl with any other patches.

I'm going ahead and applying it to Intel Wired LAN regardless, since the fix looks good.

Thanks,
Jake

Quoted 29 lines
Fixes 62d7e3a2d006 ("e1000e: Validate hwtstamp_config completely before applying it")
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
index 35f5590228eb..7ae33273734f 100644
@@ -3715,8 +3715,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
 		return -ERANGE;
 	}
 
-	adapter->hwtstamp_config = *config;
-
 	/* enable/disable Tx h/w time stamping */
 	regval = er32(TSYNCTXCTL);
 	regval &= ~E1000_TSYNCTXCTL_ENABLED;
@@ -3763,6 +3761,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
 	er32(RXSTMPH);
 	er32(TXSTMPH);
 
+	adapter->hwtstamp_config = *config;
+
 	return 0;
 }
 
#4 lore raw

Hi Jake,

Thank you for applying the patch and for the review.

Quoted 24 lines · Jacob Keller
Quoted 23 lines · Linkui Xiao

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

- e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

- e1000e_systim_reset() re-applies it after every reset, including

    the ones the watchdog triggers, and keeps failing;

- e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Quoted 7 lines
Quoted 4 lines

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Any idea why this got marked as patch 2 out of 5? This doesn't appear on either netdev or iwl with any other patches.

Regarding your question about the "2/5" marking: it was an oversight on my end. I generated this fix from a local branch that contained other commits, and git format-patch automatically added the series numbering. The patch is indeed a standalone fix and was not intended to be part of a series posted elsewhere.

I'll make sure to use a proper invocation for single patches going forward.

Thanks again for your time and for taking this fix into the Intel Wired LAN tree.

Best regards,
Linkui

Quoted 36 lines

I'm going ahead and applying it to Intel Wired LAN regardless, since the fix looks good.

Thanks,
Jake

Quoted 29 lines
Fixes 62d7e3a2d006 ("e1000e: Validate hwtstamp_config completely before applying it")
---
  drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
index 35f5590228eb..7ae33273734f 100644
@@ -3715,8 +3715,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
  		return -ERANGE;
  	}
 
-	adapter->hwtstamp_config = *config;
-
  	/* enable/disable Tx h/w time stamping */
  	regval = er32(TSYNCTXCTL);
  	regval &= ~E1000_TSYNCTXCTL_ENABLED;
@@ -3763,6 +3761,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
  	er32(RXSTMPH);
  	er32(TXSTMPH);
 
+	adapter->hwtstamp_config = *config;
+
  	return 0;
  }
 
#5 lore raw
Quoted 42 lines · Linkui Xiao

Hi Jake,

Thank you for applying the patch and for the review.

Quoted 24 lines · Jacob Keller
Quoted 23 lines · Linkui Xiao

From: Linkui Xiao <[email protected]>

e1000e_config_hwtstamp() stores the requested configuration in adapter->hwtstamp_config right after the rx filter has been translated, but the two register writes that follow are verified by reading the registers back and each of them can fail with -EAGAIN.

When one of them does, the driver is left holding a configuration the hardware never accepted:

  - e1000e_hwtstamp_get() hands it back to user space, so an application that reads the configuration back is told that hardware time stamping is in effect while it is not;

  - e1000e_systim_reset() re-applies it after every reset, including the ones the watchdog triggers, and keeps failing;

  - e1000_watchdog() starts polling TSYNCRXCTL_VALID for the cached rx filter, and e1000_xmit_frame() still parks skbs that ask for a Tx time stamp because it only looks at FLAG_HAS_HW_TIMESTAMP, so they are eventually dropped by e1000e_tx_hwtstamp_work() with a "clearing Tx timestamp hang" warning.

Quoted 7 lines
Quoted 4 lines

Cache the configuration only once both registers have been verified, so that adapter->hwtstamp_config always describes what the hardware is programmed with.

Any idea why this got marked as patch 2 out of 5? This doesn't appear on either netdev or iwl with any other patches.

Regarding your question about the "2/5" marking: it was an oversight on my end. I generated this fix from a local branch that contained other commits, and git format-patch automatically added the series numbering. The patch is indeed a standalone fix and was not intended to be part of a series posted elsewhere.

Quoted 7 lines

I'll make sure to use a proper invocation for single patches going forward.

Thanks again for your time and for taking this fix into the Intel Wired LAN tree.

Best regards,
Linkui

Thanks for clarifying! I mostly wanted to make sure it wasn't some issue with mails not hitting the list (spam or other issues), and potential fixes being missed.

The numbering will get fixed and merged with other patches once our review process completes and Tony finds space for submission to netdev. That may take a bit.

Thanks,
Jake