Skip to content

Commit b24a813

Browse files
Paolo Abenigregkh
authored andcommitted
net: don't keep lonely packets forever in the gro hash
[ Upstream commit 605108a ] Eric noted that with UDP GRO and NAPI timeout, we could keep a single UDP packet inside the GRO hash forever, if the related NAPI instance calls napi_gro_complete() at an higher frequency than the NAPI timeout. Willem noted that even TCP packets could be trapped there, till the next retransmission. This patch tries to address the issue, flushing the old packets - those with a NAPI_GRO_CB age before the current jiffy - before scheduling the NAPI timeout. The rationale is that such a timeout should be well below a jiffy and we are not flushing packets eligible for sane GRO. v1 -> v2: - clarified the commit message and comment RFC -> v1: - added 'Fixes tags', cleaned-up the wording. Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Fixes: 3b47d30 ("net: gro: add a per device gro flush timer") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Willem de Bruijn <willemb@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 18dd9bf commit b24a813

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎net/core/dev.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5945,11 +5945,14 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
59455945
if (work_done)
59465946
timeout = n->dev->gro_flush_timeout;
59475947

5948+
/* When the NAPI instance uses a timeout and keeps postponing
5949+
* it, we need to bound somehow the time packets are kept in
5950+
* the GRO layer
5951+
*/
5952+
napi_gro_flush(n, !!timeout);
59485953
if (timeout)
59495954
hrtimer_start(&n->timer, ns_to_ktime(timeout),
59505955
HRTIMER_MODE_REL_PINNED);
5951-
else
5952-
napi_gro_flush(n, false);
59535956
}
59545957
if (unlikely(!list_empty(&n->poll_list))) {
59555958
/* If n->poll_list is not empty, we need to mask irqs */

0 commit comments

Comments
 (0)