From: "Zhaoping Shu (舒召平)" <Zhaoping.Shu@mediatek.com>
To: "AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"sd@queasysnail.net" <sd@queasysnail.net>,
"imv4bel@gmail.com" <imv4bel@gmail.com>,
"alice@isovalent.com" <alice@isovalent.com>,
"eilaimemedsnaimel@gmail.com" <eilaimemedsnaimel@gmail.com>,
"HW He (何伟)" <HW.He@mediatek.com>,
"horms@kernel.org" <horms@kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"edumazet@google.com" <edumazet@google.com>,
"willemdebruijn.kernel@gmail.com"
<willemdebruijn.kernel@gmail.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>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuniyu@google.com" <kuniyu@google.com>,
"ncardwell@google.com" <ncardwell@google.com>
Cc: "Haijun Liu (刘海军)" <haijun.liu@mediatek.com>,
"Xiayu Zhang (张夏宇)" <Xiayu.Zhang@mediatek.com>,
"Lambert Wang (王伟)" <Lambert.Wang@mediatek.com>,
"Iven Yang (阳光)" <Iven.Yang@mediatek.com>
Subject: Re: [PATCH net v3] net: gro: Fix nesting of TCP GSO SKBs in skb_gro_receive_list()
Date: Thu, 13 Aug 2026 08:39:50 +0000 [thread overview]
Message-ID: <0e1f71c4417099399eda78fd2a082b2444e42af9.camel@mediatek.com> (raw)
In-Reply-To: <willemdebruijn.kernel.1372b82f50882@gmail.com>
On Wed, 2026-08-12 at 22:29 -0400, Willem de Bruijn wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> zhaoping.shu@ wrote:
> > From: HW He <hw.he@mediatek.com>
> >
> > A device supports GRO_HW, and the device driver enables the
> > NETIF_F_GRO_FRAGLIST feature. During a tethering test,
> > skb_gro_receive_list() reaggregates the GSO packet. However,
> > skb_segment_list() cannot segment this packet back into
> > the original packets, which leads to IP fragmentation or packet
> > drop.
> >
> > Scenario (Tethering/Forwarding):
> > 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.
> >
> > When NETIF_F_GRO_HW is enabled, do not set NAPI_GRO_CB(skb)-
> > >is_flist.
> > Fall through to the regular skb_gro_receive() path instead of
> > skb_gro_receive_list().
> >
> > Fixes: 8d95dc474f85 ("net: add code for TCP fraglist GRO")
> > Signed-off-by: HW He <hw.he@mediatek.com>
> > Signed-off-by: Zhaoping Shu <zhaoping.shu@mediatek.com>
> > ---
> > [2]:
> > https://urldefense.com/v3/__https://patchwork.kernel.org/patch/14706032__;!!CTRNKA9wMg0ARbw!kigb147-G9EgNqdWMhaQ43udYOvN90SG6bVjeM-GxTsPo3E07_tbysuoEieszr5CbCqT94AYpt1b_M7VsgNaZcjtBS_AnYo$
> > [1]:
> > https://urldefense.com/v3/__https://patchwork.kernel.org/patch/14702209__;!!CTRNKA9wMg0ARbw!kigb147-G9EgNqdWMhaQ43udYOvN90SG6bVjeM-GxTsPo3E07_tbysuoEieszr5CbCqT94AYpt1b_M7VsgNaZcjtu0bQPNI$
> > ---
> > net/ipv4/tcp_offload.c | 7 +++----
> > net/ipv6/tcpv6_offload.c | 3 ++-
> > 2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
> > index 3b1fdcd3cb29..641c47fb1ea2 100644
> > --- a/net/ipv4/tcp_offload.c
> > +++ b/net/ipv4/tcp_offload.c
> > @@ -395,9 +395,6 @@ static void tcp4_check_fraglist_gro(struct
> > list_head *head, struct sk_buff *skb,
> > struct net *net;
> > int iif, sdif;
> >
> > - if (likely(!(skb->dev->features & NETIF_F_GRO_FRAGLIST)))
> > - return;
> > -
>
> Interesting that ipv4 and ipv6 diverge here. Nice to try to make them
> more alike.
>
> > p = tcp_gro_lookup(head, th);
> > if (p) {
> > NAPI_GRO_CB(skb)->is_flist = NAPI_GRO_CB(p)-
> > >is_flist;
> > @@ -430,7 +427,9 @@ struct sk_buff *tcp4_gro_receive(struct
> > list_head *head, struct sk_buff *skb)
> > if (!th)
> > goto flush;
> >
> > - tcp4_check_fraglist_gro(head, skb, th);
> > + if (unlikely((skb->dev->features & NETIF_F_GRO_FRAGLIST) &&
> > + !(skb->dev->features & NETIF_F_GRO_HW)))
>
> 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.
>
> 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.
next prev parent reply other threads:[~2026-08-13 8:40 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 (舒召平) [this message]
2026-08-13 16:15 ` Willem de Bruijn
2026-08-14 2:29 ` Zhaoping Shu (舒召平)
2026-08-14 14:11 ` 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=0e1f71c4417099399eda78fd2a082b2444e42af9.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 \
--cc=willemdebruijn.kernel@gmail.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