From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: "Zhaoping Shu (舒召平)" <Zhaoping.Shu@mediatek.com>,
"willemdebruijn.kernel@gmail.com"
<willemdebruijn.kernel@gmail.com>
Cc: "kuniyu@google.com" <kuniyu@google.com>,
"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>,
"eilaimemedsnaimel@gmail.com" <eilaimemedsnaimel@gmail.com>,
"alice@isovalent.com" <alice@isovalent.com>,
"HW He (何伟)" <HW.He@mediatek.com>,
"Haijun Liu (刘海军)" <haijun.liu@mediatek.com>,
"Iven Yang (阳光)" <Iven.Yang@mediatek.com>,
"horms@kernel.org" <horms@kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"Xiayu Zhang (张夏宇)" <Xiayu.Zhang@mediatek.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"edumazet@google.com" <edumazet@google.com>,
"willemb@google.com" <willemb@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>,
"sd@queasysnail.net" <sd@queasysnail.net>,
"ncardwell@google.com" <ncardwell@google.com>
Subject: Re: [PATCH net v3] net: gro: Fix nesting of TCP GSO SKBs in skb_gro_receive_list()
Date: Fri, 14 Aug 2026 10:11:19 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.82fd3c4505e2@gmail.com> (raw)
In-Reply-To: <ddb39bf238a544cb5c8a178dd0fc6e5cb682bbb1.camel@mediatek.com>
> > > > Would it be better to test skb_is_gso(skb) and only skip fraglist
> > > > GRO
> > > > for HW-GRO skbs, rather than disabling it for all skbs?
> > >
> > > Yes, for tethering packets, HW-GRO skbs are aggregated by
> > > skb_gro_receive(), while others go through fraglist GRO. However,
> > > care
> > > must be taken to avoid packets arriving out of order. I will work
> > > on
> > > it and submit V4.
> >
> > Oh right.
> >
> > As long as the choice is only between fraglist GRO or not fraglist
> > (rather than GRO or bypass GRO), it should not introduce any new
> > reordering concerns.
> >
> > But the decision cannot be made based on skb_is_gso(skb) of an
> > arriving skb. Because when such a HW-GRO skb arrives a SW GRO context
> > in fraglist mode may already have been opened, and it is too late to
> > convert that to non-fraglist.
> >
> > So essentially HW-GRO and fraglist are mutually exclusive.
> >
> > > >
> > > > If treating the features as mutually exclusive, another option
> > > > would
> > > > be to replace these datapath checks with disabling one at
> > > > configuration
> > > > time, in netdev_fix_features.
> > > >
> > >
> > > If V4 work well, there will be no need to check netdev->features.
> > > Linux kernel GRO will be more robust and able to handle scenarios
> > > where both NETIF_F_GRO_HW and NETIF_F_GRO_FRAGLIST are enabled.
> >
> > What is your plan for v4?
> Based on kernel 7.2.0.rc7 code:
> Add logic in tcp4/6_check_fraglist_gro() as follow:
> if an arriving skb is the first packet in the GRO list.
> NAPI_GRO_CB(skb)->is_flist = !sk && !skb_is_gso(skb);
>
> /*
> * Otherwise, the arriving skb is not the first packet, which means
> * that struct sk_buff *p exists.
> */
> if (!skb_is_gso(skb) || !NAPI_GRO_CB(p)->is_flist) {
> /* Aggregate the skb using p's GRO method. */
> NAPI_GRO_CB(skb)->is_flist = NAPI_GRO_CB(p)->is_flist;
> } else {
> NAPI_GRO_CB(skb)->is_flist = 0;
> /* Flush p and start a new GRO list using the non-fraglist
> method. */
> }
>
> Another code change in
> tcp_gro_receive() {
> ...
> if (unlikely(NAPI_GRO_CB(p)->is_flist)) {
> ...
> /* if aggregate method changed, flush current gro list
> */
> flush |= NAPI_GRO_CB(skb)->is_flist != NAPI_GRO_CB(p)-
> >is_flist;
> if (flush || skb_gro_receive_list())
> ...
> }
> }
>
> After this change:
> - NETIF_F_GRO_HW and NETIF_F_GRO_FRAGLIST are no longer mutually
> exclusive.
> - In tethering scenarios, TCP fraglist GRO applies only to consecutive
> non-GSO skbs(!skb_is_gso(skb)).
> others will adopt skb_gro_receive() path.
>
> Please provide some suggestions on the changes above. Should I prepare
> V4 patch based on these changes?
Thanks. This sounds good to me.
The risk is that GRO might be less effective at coalescing, if HW-GRO
and non HW-GRO packets alternate regularly.
The alternative to make HW-GRO and fraglist GRO mutually exclusive
does not have that problem, but on the flipside cannot use the fraglist
optimization (esp for forwarding path).
So no free lunch. Either works.
prev parent reply other threads:[~2026-08-14 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 1:40 [PATCH net v3] net: gro: Fix nesting of TCP GSO SKBs in skb_gro_receive_list() zhaoping.shu
2026-08-13 2:29 ` Willem de Bruijn
2026-08-13 8:39 ` Zhaoping Shu (舒召平)
2026-08-13 16:15 ` Willem de Bruijn
2026-08-14 2:29 ` Zhaoping Shu (舒召平)
2026-08-14 14:11 ` Willem de Bruijn [this message]
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=willemdebruijn.kernel.82fd3c4505e2@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=HW.He@mediatek.com \
--cc=Iven.Yang@mediatek.com \
--cc=Lambert.Wang@mediatek.com \
--cc=Xiayu.Zhang@mediatek.com \
--cc=Zhaoping.Shu@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