summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-03-16 12:08:10 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-03-16 12:08:10 +0000
commitde1ede601490815cf542bb3e7a9ed3a6cc3b5dc5 (patch)
treebefcf379d86732758203b1e724e23e309a9dcdf7 /sys/net
parent07de2e4ea3ed2dee63273380ac432f0d61e473a1 (diff)
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@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c11
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) \