summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2020-05-20 01:29:00 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2020-05-20 01:29:00 +0000
commitfe37da7ca4b355d71dd8351a4cc552ae33596997 (patch)
treef2bb849d1692e1188296ca1b674a2b208745c636 /sys/net
parentc44776863d9060ff6adfe76c5dabbd4316b38673 (diff)
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@
Diffstat (limited to 'sys/net')
-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);