summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2023-05-30 23:55:43 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2023-05-30 23:55:43 +0000
commit321e9c09713ca00c4f399586753a4a67afd9b4c4 (patch)
tree6cb8ecce5790273c8931fecf1bd5c5514a794276 /sys/net
parent24bf252a186a52ba22389cd480306efb8eb94ac4 (diff)
add net_tq_barriers
this waits once for something to end in all the net tqs. ok claudio@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c18
-rw-r--r--sys/net/if.h3
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ae1069b405a..36c52330e35 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.697 2023/05/16 14:32:54 jan Exp $ */
+/* $OpenBSD: if.c,v 1.698 2023/05/30 23:55:42 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -3476,3 +3476,19 @@ net_tq(unsigned int ifindex)
return (sn->sn_taskq);
}
+
+void
+net_tq_barriers(const char *wmesg)
+{
+ struct task barriers[NET_TASKQ];
+ struct refcnt r = REFCNT_INITIALIZER();
+ int i;
+
+ for (i = 0; i < nitems(barriers); i++) {
+ task_set(&barriers[i], (void (*)(void *))refcnt_rele_wake, &r);
+ refcnt_take(&r);
+ task_add(softnets[i].sn_taskq, &barriers[i]);
+ }
+
+ refcnt_finalize(&r, wmesg);
+}
diff --git a/sys/net/if.h b/sys/net/if.h
index 189ce873c12..fdf04c50715 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.213 2023/05/16 14:32:54 jan Exp $ */
+/* $OpenBSD: if.h,v 1.214 2023/05/30 23:55:42 dlg Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -560,6 +560,7 @@ int if_congested(void);
__dead void unhandled_af(int);
int if_setlladdr(struct ifnet *, const uint8_t *);
struct taskq * net_tq(unsigned int);
+void net_tq_barriers(const char *);
#endif /* _KERNEL */