Netdev List
 help / color / mirror / Atom feed
From: Cyriel Ladriere <cyriel.ladriere@gmail.com>
To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, kurt@linutronix.de, hawk@kernel.org,
	richardcochran@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, Cyriel Ladriere <cyriel.ladriere@gmail.com>
Subject: [PATCH iwl-net] igb: only pull the Rx timestamp header from the first buffer of a frame
Date: Fri, 27 Nov 2026 14:28:05 +0100	[thread overview]
Message-ID: <20261127132804.975014-2-cyriel.ladriere@gmail.com> (raw)

When Rx hardware timestamping is enabled on 82580 and later parts, the
NIC timestamps every received packet in-band: it writes a 16 byte
timestamp header in front of the frame and sets E1000_RXDADV_STAT_TSIP
in the Rx descriptor.

Since commit 5379260852b0 ("igb: Fix XDP with PTP enabled"),
igb_clean_rx_irq() checks TSIP and calls igb_ptp_rx_pktstamp() for every
Rx buffer, including the continuation buffers of a frame that spans
several descriptors (jumbo frames, e.g. MTU 9000 with 3072 byte
buffers). igb_ptp_rx_pktstamp() is meant for the first buffer only; its
only validity check is that the first 8 bytes are zero. When a
continuation buffer happens to start with 8 zero bytes, 16 bytes of
packet data are treated as a timestamp header and removed from the
frame. ip_rcv_core() then drops the packet because skb->len is smaller
than the IP total length (IpExtInTruncatedPkts).

The drop depends on the payload, so retransmissions of the same data are
dropped as well. We hit this with GigE Vision cameras streaming 9000 byte
UDP packets to an I210 with ptp4l running: about one 4K frame in 700 lost
one packet; every original and every resend counted in
IpExtInTruncatedPkts, and a capture on the interface showed those
packets exactly 16 bytes short (8994 instead of 9010 bytes). With Rx
hardware timestamping disabled, or with packets small enough to fit one
Rx buffer, no packet was lost.

Only pull the timestamp header while no skb has been started for the
frame, i.e. from its first buffer, as before the commit above.

Fixes: 5379260852b0 ("igb: Fix XDP with PTP enabled")
Signed-off-by: Cyriel Ladriere <cyriel.ladriere@gmail.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 131df3e09ba1..24be1f37cc6a 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -9068,8 +9068,12 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
 		rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt);
 		pktbuf = page_address(rx_buffer->page) + rx_buffer->page_offset;
 
-		/* pull rx packet timestamp if available and valid */
-		if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
+		/* pull rx packet timestamp if available and valid; the
+		 * timestamp header is only present in the first buffer of a
+		 * frame, a continuation buffer (skb already started) holds
+		 * packet data that must not be stripped
+		 */
+		if (!skb && igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
 			int ts_hdr_len;
 
 			ts_hdr_len = igb_ptp_rx_pktstamp(rx_ring->q_vector,
-- 
2.53.0


                 reply	other threads:[~2026-11-27 13:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261127132804.975014-2-cyriel.ladriere@gmail.com \
    --to=cyriel.ladriere@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.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