From: bluhm Date: Sat, 30 Apr 2022 21:13:57 +0000 (+0000) Subject: Run IP input and forwarding with shared netlock. Also distribute X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9ff729d5d6759ab82e3ea9f9db11d2b5467e386d;p=openbsd Run IP input and forwarding with shared netlock. Also distribute packets from the interface receive rings into multiple net task queues. Note that we still have only one softnet task. So there will be no concurrency yet, but we can notice wrong exclusive lock assertions. Soon the final step will be to increase the NET_TASKQ define. lots of testing Hrvoje Popovski; OK sashan@ --- diff --git a/sys/net/if.c b/sys/net/if.c index d9891117f40..3bd5eab2c9f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.650 2022/04/28 16:56:39 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.651 2022/04/30 21:13:57 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -834,15 +834,10 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml) * lists and the socket layer. */ - /* - * XXXSMP IPsec data structures are not ready to be accessed - * by multiple network threads in parallel. In this case - * use an exclusive lock. - */ - NET_LOCK(); + NET_RLOCK_IN_SOFTNET(); while ((m = ml_dequeue(ml)) != NULL) (*ifp->if_input)(ifp, m); - NET_UNLOCK(); + NET_RUNLOCK_IN_SOFTNET(); } void diff --git a/sys/net/ifq.c b/sys/net/ifq.c index cf3685a3811..26ac1701b9d 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.45 2022/01/18 10:54:05 dlg Exp $ */ +/* $OpenBSD: ifq.c,v 1.46 2022/04/30 21:13:57 bluhm Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -243,7 +243,7 @@ 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 = net_tq(ifp->if_index + idx); ifq->ifq_softc = NULL; mtx_init(&ifq->ifq_mtx, IPL_NET); @@ -620,7 +620,7 @@ void ifiq_init(struct ifiqueue *ifiq, struct ifnet *ifp, unsigned int idx) { ifiq->ifiq_if = ifp; - ifiq->ifiq_softnet = net_tq(ifp->if_index); /* + idx */ + ifiq->ifiq_softnet = net_tq(ifp->if_index + idx); ifiq->ifiq_softc = NULL; mtx_init(&ifiq->ifiq_mtx, IPL_NET);