summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2015-04-10 13:58:20 +0000
committerdlg <dlg@openbsd.org>2015-04-10 13:58:20 +0000
commit98a920fd7faa5ee5def7da7914ae31dfc8ff4d40 (patch)
treece5a3ec8e7f71d587da0ec2afed163fd21e99a54 /sys/net/if_tun.c
parentFull-speed isochronous transfers support with opportunistic micro-frames (diff)
downloadwireguard-openbsd-98a920fd7faa5ee5def7da7914ae31dfc8ff4d40.tar.xz
wireguard-openbsd-98a920fd7faa5ee5def7da7914ae31dfc8ff4d40.zip
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);
}