summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authormvs <mvs@cvs.openbsd.org>2020-08-10 10:55:44 +0000
committermvs <mvs@cvs.openbsd.org>2020-08-10 10:55:44 +0000
commit1291224871d37d171af9d3e70d256136696f8916 (patch)
tree31e44b5ddf89643318585e6d46ba95c381c32f7c /sys
parenta32d9013267b4059ee4a723406842b4739ac3432 (diff)
Set `IFXF_MPSAFE' bit to pppac(4) related `ifnet'. This moves pppac(4)
packets output out of KERNEL_LOCK. pppac(4) and pipex(4) are ready to this. ok yasuoka@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pppx.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 62b85bc34af..1b922e68c20 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.98 2020/07/28 09:53:36 mvs Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.99 2020/08/10 10:55:43 mvs Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -1058,7 +1058,7 @@ static int pppac_ioctl(struct ifnet *, u_long, caddr_t);
static int pppac_output(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
-static void pppac_start(struct ifnet *);
+static void pppac_qstart(struct ifqueue *);
static inline struct pppac_softc *
pppac_lookup(dev_t dev)
@@ -1107,13 +1107,11 @@ pppacopen(dev_t dev, int flags, int mode, struct proc *p)
ifp->if_hdrlen = sizeof(uint32_t); /* for BPF */;
ifp->if_mtu = MAXMCLBYTES - sizeof(uint32_t);
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST;
- ifp->if_xflags = IFXF_CLONED;
+ ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE;
ifp->if_rtrequest = p2p_rtrequest; /* XXX */
ifp->if_output = pppac_output;
- ifp->if_start = pppac_start;
+ ifp->if_qstart = pppac_qstart;
ifp->if_ioctl = pppac_ioctl;
- /* XXXSMP: be sure pppac_start() called under NET_LOCK() */
- ifq_set_maxlen(&ifp->if_snd, 1);
if_counters_alloc(ifp);
if_attach(ifp);
@@ -1382,10 +1380,10 @@ pppacclose(dev_t dev, int flags, int mode, struct proc *p)
klist_invalidate(&sc->sc_wsel.si_note);
splx(s);
- pipex_iface_fini(&sc->sc_pipex_iface);
-
if_detach(ifp);
+ pipex_iface_fini(&sc->sc_pipex_iface);
+
LIST_REMOVE(sc, sc_entry);
free(sc, M_DEVBUF, sizeof(*sc));
@@ -1459,15 +1457,14 @@ drop:
}
static void
-pppac_start(struct ifnet *ifp)
+pppac_qstart(struct ifqueue *ifq)
{
+ struct ifnet *ifp = ifq->ifq_if;
struct pppac_softc *sc = ifp->if_softc;
struct mbuf *m;
- if (!ISSET(ifp->if_flags, IFF_RUNNING))
- return;
-
- while ((m = ifq_dequeue(&ifp->if_snd)) != NULL) {
+ NET_LOCK();
+ while ((m = ifq_dequeue(ifq)) != NULL) {
#if NBPFILTER > 0
if (ifp->if_bpf) {
bpf_mtap_af(ifp->if_bpf, m->m_pkthdr.ph_family, m,
@@ -1489,9 +1486,9 @@ pppac_start(struct ifnet *ifp)
mq_enqueue(&sc->sc_mq, m); /* qdrop */
}
+ NET_UNLOCK();
if (!mq_empty(&sc->sc_mq)) {
- KERNEL_ASSERT_LOCKED();
wakeup(sc);
selwakeup(&sc->sc_rsel);
}