Commit 81d98fa4 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7dbfb4ef
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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;
		}
	}