Skip to contentSkip to conversation

idpf: do not linearize big TSO packets

PATCH Applied Eric Dumazet 5 participants 5 messages Aug 18, 2025 – Aug 22, 2025

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

PATCH 1/1 idpf: do not linearize big TSO packets

idpf has a limit on number of scatter-gather frags that can be used per segment.

Currently, idpf_tx_start() checks if the limit is hit and forces a linearization of the whole packet.

This requires high order allocations that can fail under memory pressure. A full size BIG-TCP packet would require order-7 alocation on x86_64 :/

We can move the check earlier from idpf_features_check() for TSO packets, to force GSO in this case, removing the cost of a big copy.

This means that a linearization will eventually happen with sizes smaller than one MSS.

__idpf_chk_linearize() is renamed to idpf_chk_tso_segment() and moved to idpf_lib.c

Cc Tony Nguyen <[email protected]>
Cc Przemek Kitszel <[email protected]>
Cc Jacob Keller <[email protected]>
Cc Madhu Chittim <[email protected]>
Cc Pavan Kumar Linga <[email protected]>
Cc Joshua Hay <[email protected]>
Cc Brian Vazquez <[email protected]>
Cc Willem de Bruijn <[email protected]>
Cc Andrew Lunn <[email protected]>
---
 drivers/net/ethernet/intel/idpf/idpf.h      |   2 +
 drivers/net/ethernet/intel/idpf/idpf_lib.c  | 102 +++++++++++++++-
 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 129 ++++----------------
 3 files changed, 120 insertions(+), 113 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +2 -0
index f4c0eaf9bde336ec77c9d61b5480f20fe7929e02..aafbb280c2e7387745bef10bd1fbfead07a3666b 100644
@@ -148,6 +148,7 @@ enum idpf_vport_state {
  * @link_speed_mbps: Link speed in mbps
  * @vport_idx: Relative vport index
  * @max_tx_hdr_size: Max header length hardware can support
+ * @tx_max_bufs: Max buffers that can be transmitted with scatter-gather
  * @state: See enum idpf_vport_state
  * @netstats: Packet and byte stats
  * @stats_lock: Lock to protect stats update
@@ -159,6 +160,7 @@ struct idpf_netdev_priv {
 	u32 link_speed_mbps;
 	u16 vport_idx;
 	u16 max_tx_hdr_size;
+	u16 tx_max_bufs;
 	enum idpf_vport_state state;
 	struct rtnl_link_stats64 netstats;
 	spinlock_t stats_lock;
drivers/net/ethernet/intel/idpf/idpf_lib.c +96 -6

120 lines not on this page · raw message

drivers/net/ethernet/intel/idpf/idpf_txrx.c +22 -107

141 lines not on this page · raw message

Signature · 1 line
2.51.0.rc1.167.g924127e9c0-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines

From: Eric Dumazet <[email protected]>

idpf has a limit on number of scatter-gather frags that can be used per segment.

Currently, idpf_tx_start() checks if the limit is hit and forces a linearization of the whole packet.

This requires high order allocations that can fail under memory pressure. A full size BIG-TCP packet would require order-7 alocation on x86_64 :/

We can move the check earlier from idpf_features_check() for TSO packets, to force GSO in this case, removing the cost of a big copy.

This means that a linearization will eventually happen with sizes smaller than one MSS.

__idpf_chk_linearize() is renamed to idpf_chk_tso_segment() and moved to idpf_lib.c

Cc Tony Nguyen <[email protected]>
Cc Przemek Kitszel <[email protected]>
Cc Jacob Keller <[email protected]>
Cc Madhu Chittim <[email protected]>
Cc Pavan Kumar Linga <[email protected]>
Cc Joshua Hay <[email protected]>
Cc Brian Vazquez <[email protected]>
Cc Willem de Bruijn <[email protected]>
Cc Andrew Lunn <[email protected]>
Quoted 1 line

---

Tested-by
#2 lore raw
Quoted 35 lines · Joshua A
Quoted 33 lines

From: Eric Dumazet <[email protected]>

idpf has a limit on number of scatter-gather frags that can be used per segment.

Currently, idpf_tx_start() checks if the limit is hit and forces a linearization of the whole packet.

This requires high order allocations that can fail under memory pressure. A full size BIG-TCP packet would require order-7 alocation on x86_64 :/

We can move the check earlier from idpf_features_check() for TSO packets, to force GSO in this case, removing the cost of a big copy.

This means that a linearization will eventually happen with sizes smaller than one MSS.

__idpf_chk_linearize() is renamed to idpf_chk_tso_segment() and moved to idpf_lib.c

Cc Tony Nguyen <[email protected]>
Cc Przemek Kitszel <[email protected]>
Cc Jacob Keller <[email protected]>
Cc Madhu Chittim <[email protected]>
Cc Pavan Kumar Linga <[email protected]>
Cc Joshua Hay <[email protected]>
Cc Brian Vazquez <[email protected]>
Cc Willem de Bruijn <[email protected]>
Cc Andrew Lunn <[email protected]>
Quoted 1 line

---

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Eric Dumazet
Quoted 14 lines · Eric Dumazet

idpf has a limit on number of scatter-gather frags that can be used per segment.

Currently, idpf_tx_start() checks if the limit is hit and forces a linearization of the whole packet.

This requires high order allocations that can fail under memory pressure. A full size BIG-TCP packet would require order-7 alocation on x86_64 :/

We can move the check earlier from idpf_features_check() for TSO packets, to force GSO in this case, removing the cost of a big copy.

Quoted 8 lines

This means that a linearization will eventually happen with sizes smaller than one MSS.

__idpf_chk_linearize() is renamed to idpf_chk_tso_segment() and moved to idpf_lib.c

Quoted 8 lines
Cc Przemek Kitszel <[email protected]>
Cc Jacob Keller <[email protected]>
Cc Madhu Chittim <[email protected]>
Cc Pavan Kumar Linga <[email protected]>
Cc Joshua Hay <[email protected]>
Cc Brian Vazquez <[email protected]>
Cc Willem de Bruijn <[email protected]>
Cc Andrew Lunn <[email protected]>
#4 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Mon, 18 Aug 2025 19:59:34 +0000 you wrote:

idpf has a limit on number of scatter-gather frags that can be used per segment.

Currently, idpf_tx_start() checks if the limit is hit and forces a linearization of the whole packet.

This requires high order allocations that can fail under memory pressure. A full size BIG-TCP packet would require order-7 alocation on x86_64 :/

[...]

Here is the summary with links:
- [net-next] idpf: do not linearize big TSO packets

    https://git.kernel.org/netdev/net-next/c/02614eee26fb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html