diff options
author | jlemon <jlemon@FreeBSD.org> | 2003-03-04 23:19:55 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2003-03-04 23:19:55 +0000 |
commit | 04e28d5a816573d1300b4591306a8785d3ace29c (patch) | |
tree | f304f726e8973253d3e8a87e56119fec0276a61c /sys/netgraph | |
parent | 45fcac94f475f1d18d50dde4f72eb51ee4abddcc (diff) | |
download | FreeBSD-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/netgraph')
-rw-r--r-- | sys/netgraph/ng_base.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_iface.c | 51 | ||||
-rw-r--r-- | sys/netgraph/ng_ip_input.c | 3 |
3 files changed, 50 insertions, 6 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 4c8dde3..efa0e03 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -2987,7 +2987,7 @@ ngb_mod_event(module_t mod, int event, void *data) mtx_init(&ng_idhash_mtx, "netgraph idhash mutex", NULL, 0); mtx_init(&ngq_mtx, "netgraph netisr mutex", NULL, 0); s = splimp(); - error = register_netisr(NETISR_NETGRAPH, ngintr); + netisr_register(NETISR_NETGRAPH, (netisr_t *)ngintr, NULL); splx(s); break; case MOD_UNLOAD: diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 4068f25..efaee7f 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -1,4 +1,3 @@ - /* * ng_iface.c * @@ -58,6 +57,7 @@ #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/errno.h> +#include <sys/random.h> #include <sys/sockio.h> #include <sys/socket.h> #include <sys/syslog.h> @@ -65,8 +65,8 @@ #include <net/if.h> #include <net/if_types.h> -#include <net/intrq.h> #include <net/bpf.h> +#include <net/netisr.h> #include <netinet/in.h> @@ -729,6 +729,7 @@ ng_iface_rcvdata(hook_p hook, item_p item) const iffam_p iffam = get_iffam_from_hook(priv, hook); struct ifnet *const ifp = priv->ifp; struct mbuf *m; + int isr; NGI_GET_M(item, m); NG_FREE_ITEM(item); @@ -753,7 +754,51 @@ ng_iface_rcvdata(hook_p hook, item_p item) ng_iface_bpftap(ifp, m, iffam->family); /* Send packet */ - return family_enqueue(iffam->family, m); + switch (iffam->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); + netisr_dispatch(isr, m); + return (0); } /* diff --git a/sys/netgraph/ng_ip_input.c b/sys/netgraph/ng_ip_input.c index eb8a74d..bb24c64 100644 --- a/sys/netgraph/ng_ip_input.c +++ b/sys/netgraph/ng_ip_input.c @@ -125,8 +125,7 @@ ngipi_rcvdata(hook_p hook, item_p item) NGI_GET_M(item, m); NG_FREE_ITEM(item); - schednetisr(NETISR_IP); - (void) IF_HANDOFF(&ipintrq, m, NULL); + netisr_dispatch(NETISR_IP, m); return 0; } |