diff options
author | Jonathan Lemon <jlemon@FreeBSD.org> | 2003-03-04 23:19:55 +0000 |
---|---|---|
committer | Jonathan Lemon <jlemon@FreeBSD.org> | 2003-03-04 23:19:55 +0000 |
commit | 1cafed3941f1a4e9d2beb4fb126e91018505dfd4 (patch) | |
tree | f304f726e8973253d3e8a87e56119fec0276a61c /sys/net/if_tun.c | |
parent | c141c242ac0a55a34b58cf2b06d13964d00507a4 (diff) | |
download | src-1cafed3941f1a4e9d2beb4fb126e91018505dfd4.tar.gz src-1cafed3941f1a4e9d2beb4fb126e91018505dfd4.zip |
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
Notes
Notes:
svn path=/head/; revision=111888
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index e0b3c9795a01..85c4cd3ead66 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); } /* |