diff options
author | mvs <mvs@cvs.openbsd.org> | 2020-08-09 14:33:50 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2020-08-09 14:33:50 +0000 |
commit | 2d0d2b4cc1e6edbaa4c6bf209a3b44a1b9df78e6 (patch) | |
tree | 19b070471375a892820a14d70b9f4d074d545d7d /sys | |
parent | 9603a881c379c0281968d81c107efe0599cd4b54 (diff) |
vether(4) is pretty dummy. It contains nothing requires to be protected.
So set `IFXF_MPSAFE' bit. This allows to discard outgoing packets without
kernel lock.
ok kn@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_vether.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c index bff5058c892..0364488b299 100644 --- a/sys/net/if_vether.c +++ b/sys/net/if_vether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vether.c,v 1.33 2020/07/28 09:52:32 mvs Exp $ */ +/* $OpenBSD: if_vether.c,v 1.34 2020/08/09 14:33:49 mvs Exp $ */ /* * Copyright (c) 2009 Theo de Raadt @@ -36,7 +36,7 @@ void vetherattach(int); int vetherioctl(struct ifnet *, u_long, caddr_t); -void vetherstart(struct ifnet *); +void vetherqstart(struct ifqueue *); int vether_clone_create(struct if_clone *, int); int vether_clone_destroy(struct ifnet *); int vether_media_change(struct ifnet *); @@ -83,12 +83,12 @@ vether_clone_create(struct if_clone *ifc, int unit) ifp->if_softc = sc; ifp->if_ioctl = vetherioctl; - ifp->if_start = vetherstart; + ifp->if_qstart = vetherqstart; ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); ifp->if_hardmtu = ETHER_MAX_HARDMTU_LEN; ifp->if_capabilities = IFCAP_VLAN_MTU; - ifp->if_xflags = IFXF_CLONED; + ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE; ifmedia_init(&sc->sc_media, 0, vether_media_change, vether_media_status); @@ -117,15 +117,12 @@ vether_clone_destroy(struct ifnet *ifp) * and we only need to discard the packets. */ void -vetherstart(struct ifnet *ifp) +vetherqstart(struct ifqueue *ifq) { + struct ifnet *ifp = ifq->ifq_if; struct mbuf *m; - for (;;) { - m = ifq_dequeue(&ifp->if_snd); - if (m == NULL) - return; - + while ((m = ifq_dequeue(ifq)) != NULL) { #if NBPFILTER > 0 if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); |