summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-04-10 13:58:21 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-04-10 13:58:21 +0000
commit250513adf3ae568c024bafdf3e845f1276740ad4 (patch)
tree77683efc78bd0dba266f3daef8e373a90f87e85d /sys/net/if_tun.c
parenteef7b0919e36bece6c9cf91b19a2f5062a1acaa2 (diff)
replace the use of ifqueues for most input queues serviced by netisr
with niqueues. this change is so big because there's a lot of code that takes pointers to different input queues (eg, ether_input picks between ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through to code to enqueue packets against the pointer. if i changed only one of the input queues id have to add sepearate code paths, one for ifqueues and one for niqueues in each of these places by flipping all these input queues at once i can keep the currently common code common. testing by mpi@ sthen@ and rafael zalamena ok mpi@ sthen@ claudio@ henning@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 6bea0923eac..542ba2d3883 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.135 2015/04/01 14:29:54 mpi Exp $ */
+/* $OpenBSD: if_tun.c,v 1.136 2015/04/10 13:58:20 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -780,10 +780,9 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
{
struct tun_softc *tp;
struct ifnet *ifp;
- struct ifqueue *ifq;
+ struct niqueue *ifq;
u_int32_t *th;
struct mbuf *top, **mp, *m;
- int isr;
int error=0, s, tlen, mlen;
if ((tp = tun_lookup(minor(dev))) == NULL)
@@ -887,12 +886,10 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
switch (ntohl(*th)) {
case AF_INET:
ifq = &ipintrq;
- isr = NETISR_IP;
break;
#ifdef INET6
case AF_INET6:
ifq = &ip6intrq;
- isr = NETISR_IPV6;
break;
#endif
default:
@@ -900,20 +897,14 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
return (EAFNOSUPPORT);
}
- s = splnet();
- if (IF_QFULL(ifq)) {
- IF_DROP(ifq);
- splx(s);
+ if (niq_enqueue(ifq, m) != 0) {
ifp->if_collisions++;
- m_freem(top);
- if_congestion();
return (ENOBUFS);
}
- IF_ENQUEUE(ifq, top);
- schednetisr(isr);
+
ifp->if_ipackets++;
ifp->if_ibytes += top->m_pkthdr.len;
- splx(s);
+
return (error);
}