kernel: fix mtk_eth_soc throughput regressions on gigabit PHY ports
[openwrt/openwrt.git] / target / linux / generic / pending-5.15 / 750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch
1 From: Alexander Duyck <alexanderduyck@fb.com>
2 Date: Thu, 26 Jan 2023 11:06:59 -0800
3 Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO
4
5 GSO should not merge page pool recycled frames with standard reference
6 counted frames. Traditionally this didn't occur, at least not often.
7 However as we start looking at adding support for wireless adapters there
8 becomes the potential to mix the two due to A-MSDU repartitioning frames in
9 the receive path. There are possibly other places where this may have
10 occurred however I suspect they must be few and far between as we have not
11 seen this issue until now.
12
13 Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool")
14 Reported-by: Felix Fietkau <nbd@nbd.name>
15 Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
16 ---
17
18 --- a/net/core/skbuff.c
19 +++ b/net/core/skbuff.c
20 @@ -4347,6 +4347,15 @@ int skb_gro_receive(struct sk_buff *p, s
21 if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
22 return -E2BIG;
23
24 + /* Do not splice page pool based packets w/ non-page pool
25 + * packets. This can result in reference count issues as page
26 + * pool pages will not decrement the reference count and will
27 + * instead be immediately returned to the pool or have frag
28 + * count decremented.
29 + */
30 + if (p->pp_recycle != skb->pp_recycle)
31 + return -ETOOMANYREFS;
32 +
33 lp = NAPI_GRO_CB(p)->last;
34 pinfo = skb_shinfo(lp);
35