summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-05-20 01:28:59 +0000
committerdlg <dlg@openbsd.org>2020-05-20 01:28:59 +0000
commitc146b8ab63aee4a687bb7f04e04b186ce8254d60 (patch)
treef59506092595581693b845d886a8a240ea745b39
parentproperly pass the number of strings in an array to gtp_print_str. (diff)
downloadwireguard-openbsd-c146b8ab63aee4a687bb7f04e04b186ce8254d60.tar.xz
wireguard-openbsd-c146b8ab63aee4a687bb7f04e04b186ce8254d60.zip
defer calling !IFXF_MPSAFE driver start routines to the systq
this reuses the tx mitigation machinery, but instead of deferring some start calls to the nettq, it defers all calls to the systq. this is to avoid taking the KERNEL_LOCK while processing packets in the stack. i've been running this in production for 6 or so months, and the start of a release is a good time to get more people trying it too. ok jmatthew@
-rw-r--r--sys/net/ifq.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 1a1bfcd0773..64973cbe73c 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifq.c,v 1.37 2020/03/10 08:45:28 tobhe Exp $ */
+/* $OpenBSD: ifq.c,v 1.38 2020/05/20 01:28:59 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
@@ -122,7 +122,10 @@ ifq_is_serialized(struct ifqueue *ifq)
void
ifq_start(struct ifqueue *ifq)
{
- if (ifq_len(ifq) >= min(ifq->ifq_if->if_txmit, ifq->ifq_maxlen)) {
+ struct ifnet *ifp = ifq->ifq_if;
+
+ if (ISSET(ifp->if_xflags, IFXF_MPSAFE) &&
+ ifq_len(ifq) >= min(ifp->if_txmit, ifq->ifq_maxlen)) {
task_del(ifq->ifq_softnet, &ifq->ifq_bundle);
ifq_run_start(ifq);
} else
@@ -192,7 +195,8 @@ void
ifq_init(struct ifqueue *ifq, struct ifnet *ifp, unsigned int idx)
{
ifq->ifq_if = ifp;
- ifq->ifq_softnet = net_tq(ifp->if_index); /* + idx */
+ ifq->ifq_softnet = ISSET(ifp->if_xflags, IFXF_MPSAFE) ?
+ net_tq(ifp->if_index /* + idx */) : systq;
ifq->ifq_softc = NULL;
mtx_init(&ifq->ifq_mtx, IPL_NET);