Index: net/if.h =================================================================== RCS file: /cvs/src/sys/net/if.h,v retrieving revision 1.175 diff -u -p -r1.175 if.h --- net/if.h 5 Dec 2015 19:04:37 -0000 1.175 +++ net/if.h 6 Dec 2015 08:30:20 -0000 @@ -450,6 +450,10 @@ struct if_afreq { struct socket; struct ifnet; +struct ifref { + struct srp *p; +}; + void if_alloc_sadl(struct ifnet *); void if_free_sadl(struct ifnet *); void if_attach(struct ifnet *); @@ -471,6 +475,8 @@ int if_addgroup(struct ifnet *, const ch int if_delgroup(struct ifnet *, const char *); void if_group_routechange(struct sockaddr *, struct sockaddr *); struct ifnet *ifunit(const char *); +struct ifnet *if_enter(struct ifref *, unsigned int); +void if_leave(struct ifref *, struct ifnet *); struct ifnet *if_get(unsigned int); void if_put(struct ifnet *); void ifnewlladdr(struct ifnet *); Index: net/netisr.c =================================================================== RCS file: /cvs/src/sys/net/netisr.c,v retrieving revision 1.9 diff -u -p -r1.9 netisr.c --- net/netisr.c 5 Dec 2015 10:07:55 -0000 1.9 +++ net/netisr.c 6 Dec 2015 08:30:20 -0000 @@ -15,11 +15,11 @@ */ #include #include +#include +#include #include -#include - #include "ether.h" #include "ppp.h" #include "bridge.h" @@ -28,13 +28,15 @@ void netintr(void *); -int netisr; -void *netisr_intr; +unsigned int netisr; void netintr(void *unused) { int n, t = 0; + int s; + + s = splsoftnet(); while ((n = netisr) != 0) { atomic_clearbits_int(&netisr, n); @@ -68,12 +70,19 @@ netintr(void *unused) if (t & (1 << NETISR_PFSYNC)) pfsyncintr(); #endif + splx(s); } +struct task nettask = TASK_INITIALIZER(netintr, NULL); + void netisr_init(void) { - netisr_intr = softintr_establish(IPL_SOFTNET, netintr, NULL); - if (netisr_intr == NULL) - panic("can't establish softnet handler"); +} + +void +schednetisr(unsigned int isr) +{ + atomic_setbits_int(&netisr, (1 << (isr))); + task_add(systq, &nettask); } Index: net/netisr.h =================================================================== RCS file: /cvs/src/sys/net/netisr.h,v retrieving revision 1.43 diff -u -p -r1.43 netisr.h --- net/netisr.h 3 Dec 2015 12:27:33 -0000 1.43 +++ net/netisr.h 6 Dec 2015 08:30:20 -0000 @@ -62,8 +62,6 @@ #ifndef _LOCORE #ifdef _KERNEL -extern int netisr; /* scheduling bits for network */ - void arpintr(void); void ipintr(void); void ip6intr(void); @@ -72,16 +70,8 @@ void bridgeintr(void); void pppoeintr(void); void pfsyncintr(void); -#include - -extern void *netisr_intr; -#define schednetisr(anisr) \ -do { \ - atomic_setbits_int(&netisr, (1 << (anisr))); \ - softintr_schedule(netisr_intr); \ -} while (/* CONSTCOND */0) - void netisr_init(void); +void schednetisr(unsigned int); #endif /* _KERNEL */ #endif /*_LOCORE */ Index: netinet/ip_input.c =================================================================== RCS file: /cvs/src/sys/netinet/ip_input.c,v retrieving revision 1.265 diff -u -p -r1.265 ip_input.c --- netinet/ip_input.c 3 Dec 2015 21:11:53 -0000 1.265 +++ netinet/ip_input.c 6 Dec 2015 08:30:20 -0000 @@ -202,13 +202,11 @@ struct route ipforward_rt; void ipintr(void) { + struct mbuf_list ml; struct mbuf *m; - /* - * Get next datagram off input queue and get IP header - * in first mbuf. - */ - while ((m = niq_dequeue(&ipintrq)) != NULL) { + niq_delist(&ipintrq, &ml); + while ((m = ml_dequeue(&ml)) != NULL) { #ifdef DIAGNOSTIC if ((m->m_flags & M_PKTHDR) == 0) panic("ipintr no HDR");