]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/net-don-t-keep-lonely-packets-forever-in-the-gro-has.patch
autosel fixes for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / net-don-t-keep-lonely-packets-forever-in-the-gro-has.patch
1 From 8ab29ebcaeacb849fef8b2fc4ac9b048af1e6cfc Mon Sep 17 00:00:00 2001
2 From: Paolo Abeni <pabeni@redhat.com>
3 Date: Wed, 21 Nov 2018 18:21:35 +0100
4 Subject: net: don't keep lonely packets forever in the gro hash
5
6 [ Upstream commit 605108acfe6233b72e2f803aa1cb59a2af3001ca ]
7
8 Eric noted that with UDP GRO and NAPI timeout, we could keep a single
9 UDP packet inside the GRO hash forever, if the related NAPI instance
10 calls napi_gro_complete() at an higher frequency than the NAPI timeout.
11 Willem noted that even TCP packets could be trapped there, till the
12 next retransmission.
13 This patch tries to address the issue, flushing the old packets -
14 those with a NAPI_GRO_CB age before the current jiffy - before scheduling
15 the NAPI timeout. The rationale is that such a timeout should be
16 well below a jiffy and we are not flushing packets eligible for sane GRO.
17
18 v1 -> v2:
19 - clarified the commit message and comment
20
21 RFC -> v1:
22 - added 'Fixes tags', cleaned-up the wording.
23
24 Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
25 Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer")
26 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
27 Acked-by: Willem de Bruijn <willemb@google.com>
28 Acked-by: Eric Dumazet <edumazet@google.com>
29 Signed-off-by: David S. Miller <davem@davemloft.net>
30 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
31 ---
32 net/core/dev.c | 7 +++++--
33 1 file changed, 5 insertions(+), 2 deletions(-)
34
35 diff --git a/net/core/dev.c b/net/core/dev.c
36 index 93a1b07990b8d..90ec30d5b8514 100644
37 --- a/net/core/dev.c
38 +++ b/net/core/dev.c
39 @@ -5308,11 +5308,14 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
40 if (work_done)
41 timeout = n->dev->gro_flush_timeout;
42
43 + /* When the NAPI instance uses a timeout and keeps postponing
44 + * it, we need to bound somehow the time packets are kept in
45 + * the GRO layer
46 + */
47 + napi_gro_flush(n, !!timeout);
48 if (timeout)
49 hrtimer_start(&n->timer, ns_to_ktime(timeout),
50 HRTIMER_MODE_REL_PINNED);
51 - else
52 - napi_gro_flush(n, false);
53 }
54 if (unlikely(!list_empty(&n->poll_list))) {
55 /* If n->poll_list is not empty, we need to mask irqs */
56 --
57 2.20.1
58