kernel: backport GRO improvements
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 701-v5.5-net-core-use-listified-Rx-for-GRO_NORMAL-in-napi_gro.patch
1 From: Alexander Lobakin <alobakin@dlink.ru>
2 Date: Mon, 14 Oct 2019 11:00:33 +0300
3 Subject: [PATCH] net: core: use listified Rx for GRO_NORMAL in
4 napi_gro_receive()
5
6 Commit 323ebb61e32b4 ("net: use listified RX for handling GRO_NORMAL
7 skbs") made use of listified skb processing for the users of
8 napi_gro_frags().
9 The same technique can be used in a way more common napi_gro_receive()
10 to speed up non-merged (GRO_NORMAL) skbs for a wide range of drivers
11 including gro_cells and mac80211 users.
12 This slightly changes the return value in cases where skb is being
13 dropped by the core stack, but it seems to have no impact on related
14 drivers' functionality.
15 gro_normal_batch is left untouched as it's very individual for every
16 single system configuration and might be tuned in manual order to
17 achieve an optimal performance.
18
19 Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
20 Acked-by: Edward Cree <ecree@solarflare.com>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 ---
23
24 --- a/net/core/dev.c
25 +++ b/net/core/dev.c
26 @@ -5601,12 +5601,13 @@ static void napi_skb_free_stolen_head(st
27 kmem_cache_free(skbuff_head_cache, skb);
28 }
29
30 -static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
31 +static gro_result_t napi_skb_finish(struct napi_struct *napi,
32 + struct sk_buff *skb,
33 + gro_result_t ret)
34 {
35 switch (ret) {
36 case GRO_NORMAL:
37 - if (netif_receive_skb_internal(skb))
38 - ret = GRO_DROP;
39 + gro_normal_one(napi, skb);
40 break;
41
42 case GRO_DROP:
43 @@ -5638,7 +5639,7 @@ gro_result_t napi_gro_receive(struct nap
44
45 skb_gro_reset_offset(skb);
46
47 - ret = napi_skb_finish(dev_gro_receive(napi, skb), skb);
48 + ret = napi_skb_finish(napi, skb, dev_gro_receive(napi, skb));
49 trace_napi_gro_receive_exit(ret);
50
51 return ret;