summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2003-03-04 23:19:55 +0000
committerjlemon <jlemon@FreeBSD.org>2003-03-04 23:19:55 +0000
commit04e28d5a816573d1300b4591306a8785d3ace29c (patch)
treef304f726e8973253d3e8a87e56119fec0276a61c /sys/net/if_tun.c
parent45fcac94f475f1d18d50dde4f72eb51ee4abddcc (diff)
downloadFreeBSD-src-04e28d5a816573d1300b4591306a8785d3ace29c.zip
FreeBSD-src-04e28d5a816573d1300b4591306a8785d3ace29c.tar.gz
Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index e0b3c97..85c4cd3 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -39,12 +39,13 @@
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <machine/bus.h> /* XXX Shouldn't really be required ! */
+#include <sys/random.h>
#include <sys/rman.h>
#include <net/if.h>
#include <net/if_types.h>
+#include <net/netisr.h>
#include <net/route.h>
-#include <net/intrq.h>
#ifdef INET
#include <netinet/in.h>
#endif
@@ -693,6 +694,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag)
struct mbuf *top, **mp, *m;
int error=0, tlen, mlen;
uint32_t family;
+ int isr;
TUNDEBUG("%s%d: tunwrite\n", ifp->if_name, ifp->if_unit);
@@ -787,10 +789,53 @@ tunwrite(dev_t dev, struct uio *uio, int flag)
} else
family = AF_INET;
+ switch (family) {
+#ifdef INET
+ case AF_INET:
+ isr = NETISR_IP;
+ break;
+#endif
+#ifdef INET6
+ case AF_INET6:
+ isr = NETISR_IPV6;
+ break;
+#endif
+#ifdef IPX
+ case AF_IPX:
+ isr = NETISR_IPX;
+ break;
+#endif
+#ifdef NS
+ case AF_NS:
+ isr = NETISR_NS;
+ break;
+#endif
+#ifdef NETATALK
+ case AF_APPLETALK:
+ isr = NETISR_ATALK2;
+ break;
+#endif
+#ifdef NATM
+ case AF_NATM:
+ isr = NETISR_NATM;
+ break;
+#endif
+#ifdef ATM_CORE
+ case AF_ATM:
+ isr = NETISR_ATM;
+ break;
+#endif
+ default:
+ m_freem(m);
+ return (EAFNOSUPPORT);
+ }
+ /* First chunk of an mbuf contains good junk */
+ if (harvest.point_to_point)
+ random_harvest(m, 16, 3, 0, RANDOM_NET);
ifp->if_ibytes += top->m_pkthdr.len;
ifp->if_ipackets++;
-
- return (family_enqueue(family, top));
+ netisr_dispatch(isr, top);
+ return (0);
}
/*
OpenPOWER on IntegriCloud