summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
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/netinet6
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/netinet6')
-rw-r--r--sys/netinet6/in6.h4
-rw-r--r--sys/netinet6/ip6_divert.c12
-rw-r--r--sys/netinet6/ip6_input.c16
3 files changed, 9 insertions, 23 deletions
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 66559187492..33e2b633ed4 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.80 2015/02/09 12:23:22 claudio Exp $ */
+/* $OpenBSD: in6.h,v 1.81 2015/04/10 13:58:20 dlg Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -418,7 +418,7 @@ typedef __socklen_t socklen_t; /* length type for network syscalls */
#ifdef _KERNEL
extern u_char inet6ctlerrmap[];
-extern struct ifqueue ip6intrq; /* IP6 packet input queue */
+extern struct niqueue ip6intrq; /* IP6 packet input queue */
extern struct in6_addr zeroin6_addr;
struct mbuf;
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index b82e6c4e362..af13323d65e 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.32 2015/01/24 00:29:06 deraadt Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.33 2015/04/10 13:58:20 dlg Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -86,11 +86,10 @@ int
divert6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
struct mbuf *control)
{
- struct ifqueue *inq;
struct sockaddr_in6 *sin6;
struct socket *so;
struct ifaddr *ifa;
- int s, error = 0, min_hdrlen = 0, nxt = 0, off, dir;
+ int error = 0, min_hdrlen = 0, nxt = 0, off, dir;
struct ip6_hdr *ip6;
m->m_pkthdr.rcvif = NULL;
@@ -159,8 +158,6 @@ divert6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
}
m->m_pkthdr.rcvif = ifa->ifa_ifp;
- inq = &ip6intrq;
-
/*
* Recalculate the protocol checksum for the inbound packet
* since the userspace application may have modified the packet
@@ -168,10 +165,7 @@ divert6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
*/
in6_proto_cksum_out(m, NULL);
- s = splnet();
- IF_INPUT_ENQUEUE(inq, m);
- schednetisr(NETISR_IPV6);
- splx(s);
+ niq_enqueue(&ip6intrq, m); /* return error on q full? */
} else {
error = ip6_output(m, NULL, &inp->inp_route6,
IP_ALLOWBROADCAST | IP_RAWOUTPUT, NULL, NULL, NULL);
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index f4c9351a704..9643cdb61dd 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.140 2015/03/14 03:38:52 jsg Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.141 2015/04/10 13:58:20 dlg Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -113,7 +113,7 @@
#endif
struct in6_ifaddrhead in6_ifaddr;
-struct ifqueue ip6intrq;
+struct niqueue ip6intrq = NIQUEUE_INITIALIZER(IFQ_MAXLEN, NETISR_IPV6);
struct ip6stat ip6stat;
@@ -144,7 +144,6 @@ ip6_init(void)
pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW &&
pr->pr_protocol < IPPROTO_MAX)
ip6_protox[pr->pr_protocol] = pr - inet6sw;
- IFQ_SET_MAXLEN(&ip6intrq, IFQ_MAXLEN);
TAILQ_INIT(&in6_ifaddr);
ip6_randomid_init();
nd6_init();
@@ -168,17 +167,10 @@ ip6_init2(void *dummy)
void
ip6intr(void)
{
- int s;
struct mbuf *m;
- for (;;) {
- s = splnet();
- IF_DEQUEUE(&ip6intrq, m);
- splx(s);
- if (m == NULL)
- return;
+ while ((m = niq_dequeue(&ip6intrq)) != NULL)
ip6_input(m);
- }
}
extern struct route_in6 ip6_forward_rt;
@@ -1452,7 +1444,7 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
}
return (error);
case IPV6CTL_IFQUEUE:
- return (sysctl_ifq(name + 1, namelen - 1,
+ return (sysctl_niq(name + 1, namelen - 1,
oldp, oldlenp, newp, newlen, &ip6intrq));
default:
if (name[0] < IPV6CTL_MAXID)