Netdev List
 help / color / mirror / Atom feed
From: Pascal Kneuper <PKneuper@dspace.de>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Daniel Baldin <dbaldin@dspace.de>,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Pascal Kneuper <PKneuper@dspace.de>
Subject: [PATCH net 2/2] igb: Quiesce the receive path before enabling i210 Rx timestamping
Date: Thu, 10 Sep 2026 13:38:54 +0200 (CEST)	[thread overview]
Message-ID: <20260910113854.13279-3-PKneuper@dspace.de> (raw)
In-Reply-To: <20260910113854.13279-1-PKneuper@dspace.de>

Commit e57b8bdb4833 ("igb: Add 1588 support to I210/I211.") enables
per-packet Rx timestamping by setting RXPBS.CFG_TS_EN with Rx queues
running. On i210/i211, CFG_TS_EN makes the DMA engine prepend a 16-byte
timestamp header to every Rx packet buffer and sets RXDADV_STAT_TSIP in the
Rx descriptor so igb_clean_rx_irq() strips it.

Setting CFG_TS_EN changes the buffer layout of already-armed descriptors.
Without a pipeline handshake, descriptor status and packet buffer layout
disagree for in-flight packets:

  header inserted, no TSIP -> unstripped, frame shifted 16 bytes right
  TSIP set, no header      -> 16 bytes stripped, buffer tail appended

In both cases the Ethernet header is corrupted, causing protocol demux to
drop the frame silently. Because igb_alloc_mapped_page() allocates pages
without __GFP_ZERO, the second case appends uninitialized memory.

This occurs reliably on i210/i211 under traffic when requesting hardware
timestamps at runtime, yielding corrupt frames on off-to-on transitions.

Fix by bracketing the CFG_TS_EN transition with igb_down() and igb_up()
when the interface is running, ensuring the bit is only toggled with Rx
queues stopped.

Fixes: e57b8bdb4833 ("igb: Add 1588 support to I210/I211.")
Signed-off-by: Pascal Kneuper <PKneuper@dspace.de>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 638d8242b66bb..4da26e997f92c 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -1283,9 +1283,26 @@ int igb_ptp_hwtstamp_set(struct net_device *netdev,
 			 struct netlink_ext_ack *extack)
 {
 	struct igb_adapter *adapter = netdev_priv(netdev);
+	struct e1000_hw *hw = &adapter->hw;
+	bool quiesce = false;
 	int err;
 
+	/* CFG_TS_EN changes the Rx buffer layout, so flipping it on a live
+	 * queue leaves the descriptor and the data disagreeing about the
+	 * 16 byte timestamp header for one window, mangling a frame.
+	 */
+	if ((hw->mac.type == e1000_i210 || hw->mac.type == e1000_i211) &&
+	    netif_running(netdev) &&
+	    !(rd32(E1000_RXPBS) & E1000_RXPBS_CFG_TS_EN)) {
+		quiesce = true;
+		igb_down(adapter);
+	}
+
 	err = igb_ptp_set_timestamp_mode(adapter, config);
+
+	if (quiesce)
+		igb_up(adapter);
+
 	if (err)
 		return err;
 
-- 
2.47.3


      parent reply	other threads:[~2026-09-10 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 11:38 [PATCH net 0/2] igb: Fix i210/i211 Rx timestamping loss and packet corruption Pascal Kneuper
2026-09-10 11:38 ` [PATCH net 1/2] igb: Preserve RXPBS.CFG_TS_EN in igb_setup_tx_mode Pascal Kneuper
2026-09-11 20:58   ` Loktionov, Aleksandr
2026-09-10 11:38 ` Pascal Kneuper [this message]

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=20260910113854.13279-3-PKneuper@dspace.de \
    --to=pkneuper@dspace.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=dbaldin@dspace.de \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@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