tun: avoid extra timer schedule in tun_flow_cleanup()

If tun_flow_cleanup() deleted all flows, no need to
arm the timer again. It will be armed next time
tun_flow_update() is called.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2017-10-20 11:29:56 -07:00 committed by David S. Miller
parent 7dbfb4ef77
commit 81d98fa4df
1 changed files with 6 additions and 3 deletions

View File

@ -461,11 +461,14 @@ static void tun_flow_cleanup(unsigned long data)
hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) {
unsigned long this_timer;
count++;
this_timer = e->updated + delay;
if (time_before_eq(this_timer, jiffies))
if (time_before_eq(this_timer, jiffies)) {
tun_flow_delete(tun, e);
else if (time_before(this_timer, next_timer))
continue;
}
count++;
if (time_before(this_timer, next_timer))
next_timer = this_timer;
}
}