mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Moses <p@1g4.org>
To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, aleksandr.loktionov@intel.com,
	chwee.lin.choong@intel.com, faizal.abdul.rahim@linux.intel.com,
	horms@kernel.org, vinicius.gomes@intel.com,
	sasha.neftin@intel.com, matthew.vick@intel.com,
	aduyck@mirantis.com
Subject: [PATCH net 3/3] igb: prepare TSO and checksum offloads before TX timestamps
Date: Mon, 26 Oct 2026 09:16:19 +0000	[thread overview]
Message-ID: <20261026091549.605810-3-p@1g4.org> (raw)
In-Reply-To: <20261026091549.605810-1-p@1g4.org>

igb_xmit_frame_ring() takes an extra skb reference for TX timestamping
before transmit preparation. For GSO packets, igb_tso() calls
skb_cow_head(), which can reach pskb_expand_head() with a shared skb
when the header is cloned. Commit c7d8bc3dd511 ("net: skbuff: don't BUG()
on bad arguments to pskb_expand_head()") replaced the BUG_ON() with
-EINVAL, causing TSO preparation to fail and the packet to be dropped.

For non-GSO packets with CHECKSUM_PARTIAL, igb_tx_csum() falls back to
skb_checksum_help() for unsupported checksum offsets. This can also
reach pskb_expand_head() through skb_ensure_writable(). igb_tx_csum()
ignores the error, allowing transmission to continue without completing
the checksum.

Move TSO and checksum preparation before taking the timestamp reference.
Add the timestamp bit to first->tx_flags without overwriting the offload
flags.

Fixes: 1f6e8178d685 ("igb: Prevent dropped Tx timestamps via work items and interrupts.")
Fixes: 6e033700887b ("igb: Add support for generic Tx checksums")
Signed-off-by: Paul Moses <p@1g4.org>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 31 ++++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index d4a897a8c82c..04c0053dbaae 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6559,6 +6559,21 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
 	first->bytecount = skb->len;
 	first->gso_segs = 1;
 
+	if (skb_vlan_tag_present(skb)) {
+		tx_flags |= IGB_TX_FLAGS_VLAN;
+		tx_flags |= (skb_vlan_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
+	}
+
+	/* record initial flags and protocol */
+	first->tx_flags = tx_flags;
+	first->protocol = protocol;
+
+	tso = igb_tso(tx_ring, first, &hdr_len);
+	if (tso < 0)
+		goto out_drop;
+	else if (!tso)
+		igb_tx_csum(tx_ring, first);
+
 	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
 		struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
 
@@ -6567,6 +6582,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
 					   &adapter->state)) {
 			skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
 			tx_flags |= IGB_TX_FLAGS_TSTAMP;
+			first->tx_flags |= IGB_TX_FLAGS_TSTAMP;
 
 			adapter->ptp_tx_skb = skb_get(skb);
 			adapter->ptp_tx_start = jiffies;
@@ -6577,21 +6593,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
 		}
 	}
 
-	if (skb_vlan_tag_present(skb)) {
-		tx_flags |= IGB_TX_FLAGS_VLAN;
-		tx_flags |= (skb_vlan_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
-	}
-
-	/* record initial flags and protocol */
-	first->tx_flags = tx_flags;
-	first->protocol = protocol;
-
-	tso = igb_tso(tx_ring, first, &hdr_len);
-	if (tso < 0)
-		goto out_drop;
-	else if (!tso)
-		igb_tx_csum(tx_ring, first);
-
 	if (igb_tx_map(tx_ring, first, hdr_len))
 		goto cleanup_tx_tstamp;
 


  parent reply	other threads:[~2026-10-26  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  9:16 [PATCH net 1/3] igc: pad preemptible packets before reserving " Paul Moses
2026-10-26  9:16 ` [PATCH net 2/3] igc: prepare TSO and checksum offloads before " Paul Moses
2026-10-27  6:42   ` Eric Dumazet
2026-10-27 12:17   ` netdev-bot+sashiko
2026-10-26  9:16 ` Paul Moses [this message]
2026-10-27  6:43   ` [PATCH net 3/3] igb: " Eric Dumazet
2026-10-27 12:17   ` netdev-bot+sashiko
2026-10-27 16:04     ` Paul Moses
2026-10-26  9:20 ` [PATCH net 1/3] igc: pad preemptible packets before reserving " netdev-bot+sinfo
2026-10-26  9:40   ` Paul Moses
2026-10-27  6:41 ` Eric Dumazet
2026-10-27 12:17 ` netdev-bot+sashiko
2026-10-27 16:13   ` Paul Moses

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=20261026091549.605810-3-p@1g4.org \
    --to=p@1g4.org \
    --cc=aduyck@mirantis.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=chwee.lin.choong@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=faizal.abdul.rahim@linux.intel.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.vick@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sasha.neftin@intel.com \
    --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

all inboxes | Powered by JetHome®