diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-03 17:31:04 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-03 17:31:04 +0000 |
commit | 345ff4291de442808bed4716126c2cc44658f071 (patch) | |
tree | febbdd0d517144d7569af872a105b80bd2ce3cd0 /sys/net/if.c | |
parent | 4c9ea497195f100b5d500cad731b83a0851c27dd (diff) |
do not use one struct timeout for the if congestion stuff, but embed
a struct timeout to struct ifqueue so that each one has its own - it
is a per-queue thing. from chris pascoe
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index cae31adb420..df9540b7c0a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.93 2004/10/14 21:28:15 mickey Exp $ */ +/* $OpenBSD: if.c,v 1.94 2004/12/03 17:31:03 henning Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -807,21 +807,28 @@ if_clone_list(ifcr) void if_congestion(struct ifqueue *ifq) { - static struct timeout to; + // Not currently needed, all callers check this + if (ifq->ifq_congestion) + return; - ifq->ifq_congestion = 1; - bzero(&to, sizeof(to)); - timeout_set(&to, if_congestion_clear, ifq); - timeout_add(&to, hz / 100); + ifq->ifq_congestion = malloc(sizeof(struct timeout), M_TEMP, M_NOWAIT); + if (ifq->ifq_congestion == NULL) + return; + timeout_set(ifq->ifq_congestion, if_congestion_clear, ifq); + timeout_add(ifq->ifq_congestion, hz / 100); } /* * clear the congestion flag */ void -if_congestion_clear(void *ifq) +if_congestion_clear(void *arg) { - ((struct ifqueue *)ifq)->ifq_congestion = 0; + struct ifqueue *ifq = arg; + struct timeout *to = ifq->ifq_congestion; + + ifq->ifq_congestion = NULL; + free(to, M_TEMP); } /* |