From: dlg Date: Tue, 30 May 2023 23:55:42 +0000 (+0000) Subject: add net_tq_barriers X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c5f976950fe893e18da75600b18e616fb29f0d4c;p=openbsd add net_tq_barriers this waits once for something to end in all the net tqs. ok claudio@ --- 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 */