diff options
author | 2016-03-16 12:08:09 +0000 | |
---|---|---|
committer | 2016-03-16 12:08:09 +0000 | |
commit | d0b51642ac65fc549021b57e7692e1b0513937af (patch) | |
tree | 56fc393a69c8b663424c1eddd52df7020190eb9a | |
parent | macros for the null, min, and max vlan ids. (diff) | |
download | wireguard-openbsd-d0b51642ac65fc549021b57e7692e1b0513937af.tar.xz wireguard-openbsd-d0b51642ac65fc549021b57e7692e1b0513937af.zip |
if ticks diverge from ifq_congestion too far the diff will go negative
detect this and bump ifq_congestion forward rather than claim the
system is congested for a long period of time.
ok mpi@ henning@ jmatthew@
-rw-r--r-- | sys/net/if.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 776f9abea14..fbe239d38a0 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.428 2016/03/07 18:44:00 naddy Exp $ */ +/* $OpenBSD: if.c,v 1.429 2016/03/16 12:08:09 dlg Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1130,8 +1130,15 @@ int if_congested(void) { extern int ticks; + int diff; - return (ticks - ifq_congestion <= (hz / 100)); + diff = ticks - ifq_congestion; + if (diff < 0) { + ifq_congestion = ticks - hz; + return (0); + } + + return (diff <= (hz / 100)); } #define equal(a1, a2) \ |