Netdev List
 help / color / mirror / Atom feed
From: "Zhaoping Shu (舒召平)" <Zhaoping.Shu@mediatek.com>
To: "kuba@kernel.org" <kuba@kernel.org>,
	"willemb@google.com" <willemb@google.com>
Cc: "sd@queasysnail.net" <sd@queasysnail.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"imv4bel@gmail.com" <imv4bel@gmail.com>,
	"alice@isovalent.com" <alice@isovalent.com>,
	"eilaimemedsnaimel@gmail.com" <eilaimemedsnaimel@gmail.com>,
	"HW He (何伟)" <HW.He@mediatek.com>,
	"Haijun Liu (刘海军)" <haijun.liu@mediatek.com>,
	"horms@kernel.org" <horms@kernel.org>,
	"Xiayu Zhang (张夏宇)" <Xiayu.Zhang@mediatek.com>,
	"Iven Yang (阳光)" <Iven.Yang@mediatek.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"edumazet@google.com" <edumazet@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Lambert Wang (王伟)" <Lambert.Wang@mediatek.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"kuniyu@google.com" <kuniyu@google.com>,
	"ncardwell@google.com" <ncardwell@google.com>
Subject: Re: [PATCH net v2] net: gro: avoid nesting TCP GSO skbs in skb_gro_receive_list()
Date: Wed, 29 Jul 2026 07:39:31 +0000	[thread overview]
Message-ID: <0f5668da79eb9a13dfdb9c97c7d71c5153b3a48f.camel@mediatek.com> (raw)
In-Reply-To: <CA+FuTSfgBbPkdLanqEgbDq-jLVQJax4fUxQ-tuzTuFwQANwxBA@mail.gmail.com>

On Thu, 2026-07-23 at 16:02 +0200, Willem de Bruijn wrote:
> On Thu, Jul 23, 2026 at 3:39 PM Jakub Kicinski <kuba@kernel.org>
> wrote:
> > 
> > On Thu, 23 Jul 2026 17:16:01 +0800 zhaoping.shu@mediatek.com wrote:
> > > From: HW He <hw.he@mediatek.com>
> > > 
> > > On devices that support both NETIF_F_GRO_HW and
> > > NETIF_F_GRO_FRAGLIST,
> > 
> > "devices that support FRAGLIST"? Isn't it a software feature?

Sorry for not making it clear. The test environment is:
device supports GRO_HW, and enable NETIF_F_GRO_FRAGLIST in
driver.

> > 
> > > the hardware or driver may deliver packets that have already been
> > 
> > If you have a driver in mind please name it.
> > 
> > > aggregated into a TCP GSO skb with frags[]. GRO may then
> > > aggregate the skb again in skb_gro_receive_list().
> > > 
> > > This can create a nested GSO skb, which is not handled correctly
> > > by the
> > > later GSO segmentation paths. When the skb is segmented by
> > > skb_segment_list(), it not be fully restored to the original
> > > packets.
> > > 
> > > Avoid this by setting NAPI_GRO_CB(skb)->flush for GSO skbs before
> > > aggregation.
> > 
> > I don't think we can do this. For GRO_HW devices re-aggregating
> > in SW is quite helpful, HW often runs out of contexts or times
> > out too soon, generating skbs with 16kB..32kB of data, the SW
> > can help bring it up to full TSO.

I'll try to explain this issue below.

> 
> Also, after e751256486d0 ("net: gro: fix double aggregation of
> flush-marked skbs"), it's not clear an another bug remains.
> 
> If it is: as said "nested GRO" of hw + sw GRO is intentional, e.g.,
> for BIG-TCP.
> 
> But it may not be anticipated for skb_gro_receive_list. One option
> would be to skip the fraglist GSO optimization for such packets.
> 
> First I'd like to understand better what exact bug remains.

I agree that re-aggregation is useful for improving GRO efficiency.

However, as a general rule, a GSO skb must be segment back to the
exact original packets stream. In tethering test, skb_segment_list()
cannot correctly segment a nested GSO skb produced by this path.

This issue can reproduce in the following scenario:
1.Driver submits a single TCP packet, P1. P1 is kept in the
gro_list as the first packet.

2. The driver submits a TCP GSO skb, P2. P2 has already aggregated
multiple TCP packets by HW_GRO, and its non-linear data is stored in
frags[].

3. P1 and P2 match the GRO rules, and since there is no local socket,
they are aggregated by skb_gro_receive_list(). The resulting skb,
P3, has a frag_list entry that still contains frags[]:
P3: [ Linear Data ] -> frag_list -> [ Linear Data ]
                                    [ frag[1] ]
                                    [ frag[2] ]
                                    ...

4. Later, tcp4_gso_segment() or tcp6_gso_segment() calls
skb_segment_list() to segment P3. However, skb_segment_list() only
segments the entries in frag_list. It does not segment the frags[]
inside P2, so P3 is not restored to the original packets, which leads
to IP fragmentation or packet drop in the following path.

The patch only prevents that nested case before skb_gro_receive_list()
aggregation. It does not affect packets that are re-aggregated by
skb_gro_receive().


  reply	other threads:[~2026-07-29  7:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  9:16 [PATCH net v2] net: gro: avoid nesting TCP GSO skbs in skb_gro_receive_list() zhaoping.shu
2026-07-23 13:39 ` Jakub Kicinski
2026-07-23 14:02   ` Willem de Bruijn
2026-07-29  7:39     ` Zhaoping Shu (舒召平) [this message]
2026-07-29 18:57       ` Willem de Bruijn

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=0f5668da79eb9a13dfdb9c97c7d71c5153b3a48f.camel@mediatek.com \
    --to=zhaoping.shu@mediatek.com \
    --cc=HW.He@mediatek.com \
    --cc=Iven.Yang@mediatek.com \
    --cc=Lambert.Wang@mediatek.com \
    --cc=Xiayu.Zhang@mediatek.com \
    --cc=alice@isovalent.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eilaimemedsnaimel@gmail.com \
    --cc=haijun.liu@mediatek.com \
    --cc=horms@kernel.org \
    --cc=imv4bel@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --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=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --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