Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shiming Cheng <shiming.cheng@mediatek.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>, <matthias.bgg@gmail.com>,
	<angelogioacchino.delregno@collabora.com>, <willemb@google.com>,
	<daniel.zahka@gmail.com>, <alice@isovalent.com>,
	<sd@queasysnail.net>, <eilaimemedsnaimel@gmail.com>,
	<imv4bel@gmail.com>, <nbd@nbd.name>, <dsahern@kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>
Cc: <stable@vger.kernel.org>, <steffen.klassert@secunet.com>,
	<shiming.cheng@mediatek.com>
Subject: [PATCH] net: tcp: fix fraglist GRO flushing on alternating TCP PSH flag
Date: Fri, 9 Oct 2026 14:03:08 +0800	[thread overview]
Message-ID: <20261009060319.6229-1-shiming.cheng@mediatek.com> (raw)

In forwarding and tethering scenarios where fraglist GRO (is_flist) is
enabled, TCP packet aggregation frequently fails when packets arrive
with alternating PSH flags.

Specifically, when a sender alternates between [ACK] and [PSH, ACK]
segments, tcpdump reveals that no aggregation occurs:

  Before this patch:
  ... [ACK] Seq=10835225 Len=1348
  ... [PSH, ACK] Seq=10836573 Len=1348  <-- Triggers premature flush
  ... [ACK] Seq=10837921 Len=1348
  ... [PSH, ACK] Seq=10839269 Len=1348  <-- Triggers premature flush

The general GRO path allows the aggregation of packets with different
PSH/FIN flags by masking them out at the beginning of `tcp_gro_receive`.
However, the fraglist GRO path (is_flist) still enforces an unmasked
flags comparison: `flush |= (__force int)(flags ^ tcp_flag_word(th2))`.
This redundant check causes premature flushing on any incoming PSH packet,
shattering aggregation and increasing softirq overhead.

After this patch, the redundant flags check is removed from the `is_flist`
branch. The [ACK] and [PSH, ACK] packets are successfully aggregated into
a single fraglist, and are safely flushed together upon encountering the
PSH flag at `out_check_final`, preserving the required TCP push semantics.

Fixes: 8d95dc474f85 ("net: add code for TCP fraglist GRO")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shiming Cheng <shiming.cheng@mediatek.com>
---
 net/ipv4/tcp_offload.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index e74d99ca9fac..54b40ec95a08 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -328,7 +328,6 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb,
 	flush |= skb_cmp_decrypted(p, skb);
 
 	if (unlikely(NAPI_GRO_CB(p)->is_flist)) {
-		flush |= (__force int)(flags ^ tcp_flag_word(th2));
 		flush |= skb->ip_summed != p->ip_summed;
 		flush |= skb->csum_level != p->csum_level;
 		flush |= NAPI_GRO_CB(p)->count >= 64;
-- 
2.45.2



                 reply	other threads:[~2026-10-09  6:03 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=20261009060319.6229-1-shiming.cheng@mediatek.com \
    --to=shiming.cheng@mediatek.com \
    --cc=alice@isovalent.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel.zahka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eilaimemedsnaimel@gmail.com \
    --cc=horms@kernel.org \
    --cc=imv4bel@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=stable@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.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