summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2017-12-14 00:45:17 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2017-12-14 00:45:17 +0000
commitd36f5e0cb6e59dcfaa2d5e5427a4f7785b4a2b99 (patch)
tree7bcf40f59bbc3fbcd32c03b3d1d27b580f93aa22 /sys/net
parent0c48b9faee2f1f1b74ab28baa5f5526d7fa9430d (diff)
replace the bare sleep state handling in barriers with wait cond code
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/ifq.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 4c6d89437a4..22eba971297 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifq.c,v 1.15 2017/11/14 08:44:11 dlg Exp $ */
+/* $OpenBSD: ifq.c,v 1.16 2017/12/14 00:45:16 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
@@ -133,9 +133,8 @@ ifq_restart_task(void *p)
void
ifq_barrier(struct ifqueue *ifq)
{
- struct sleep_state sls;
- unsigned int notdone = 1;
- struct task t = TASK_INITIALIZER(ifq_barrier_task, &notdone);
+ struct cond c = COND_INITIALIZER();
+ struct task t = TASK_INITIALIZER(ifq_barrier_task, &c);
/* this should only be called from converted drivers */
KASSERT(ISSET(ifq->ifq_if->if_xflags, IFXF_MPSAFE));
@@ -145,10 +144,7 @@ ifq_barrier(struct ifqueue *ifq)
ifq_serialize(ifq, &t);
- while (notdone) {
- sleep_setup(&sls, &notdone, PWAIT, "ifqbar");
- sleep_finish(&sls, notdone);
- }
+ cond_wait(&c, "ifqbar");
}
void