From 04e28d5a816573d1300b4591306a8785d3ace29c Mon Sep 17 00:00:00 2001 From: jlemon Date: Tue, 4 Mar 2003 23:19:55 +0000 Subject: 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 --- sys/netnatm/natm.c | 28 +++------------------------- sys/netnatm/natm.h | 3 +-- sys/netnatm/natm_proto.c | 6 +++--- 3 files changed, 7 insertions(+), 30 deletions(-) (limited to 'sys/netnatm') diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index e0535b6..2df3c22 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -698,21 +698,12 @@ done: */ void -natmintr() - +natmintr(struct mbuf *m) { int s; - struct mbuf *m; struct socket *so; struct natmpcb *npcb; -next: - s = splimp(); - IF_DEQUEUE(&natmintrq, m); - splx(s); - if (m == NULL) - return; - #ifdef DIAGNOSTIC if ((m->m_flags & M_PKTHDR) == 0) panic("natmintr no HDR"); @@ -729,12 +720,12 @@ next: m_freem(m); if (npcb->npcb_inq == 0) FREE(npcb, M_PCB); /* done! */ - goto next; + return; } if (npcb->npcb_flags & NPCB_FREE) { m_freem(m); /* drop */ - goto next; + return; } #ifdef NEED_TO_RESTORE_IFP @@ -760,21 +751,8 @@ m->m_pkthdr.rcvif = NULL; /* null it out to be safe */ #endif m_freem(m); } - - goto next; } -#if defined(__FreeBSD__) -static void -netisr_natm_setup(void *dummy __unused) -{ - - register_netisr(NETISR_NATM, natmintr); -} -SYSINIT(natm_setup, SI_SUB_CPU, SI_ORDER_ANY, netisr_natm_setup, NULL); -#endif - - /* * natm0_sysctl: not used, but here in case we want to add something * later... diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h index b695006..aa4cf3c 100644 --- a/sys/netnatm/natm.h +++ b/sys/netnatm/natm.h @@ -111,7 +111,6 @@ LIST_HEAD(npcblist, natmpcb); /* global data structures */ extern struct npcblist natm_pcbs; /* global list of pcbs */ -extern struct ifqueue natmintrq; /* natm packet input queue */ #define NATM_STAT #ifdef NATM_STAT extern u_int natm_sodropcnt, @@ -153,6 +152,6 @@ int natm_usrreq(struct socket *, int, struct mbuf *, #endif int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t); int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t); -void natmintr(void); +void natmintr(struct mbuf *); #endif diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c index 6106026..10b78bb 100644 --- a/sys/netnatm/natm_proto.c +++ b/sys/netnatm/natm_proto.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include @@ -107,6 +107,7 @@ static struct domain natmdomain = 0, 0, 0}; static int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */ +static struct ifqueue natmintrq; #ifdef NATM_STAT u_int natm_sodropcnt = 0; /* # mbufs dropped due to full sb */ u_int natm_sodropbytes = 0; /* # of bytes dropped */ @@ -122,8 +123,7 @@ static void natm_init() bzero(&natmintrq, sizeof(natmintrq)); natmintrq.ifq_maxlen = natmqmaxlen; mtx_init(&natmintrq.ifq_mtx, "natm_inq", NULL, MTX_DEF); - natmintrq_present = 1; - + netisr_register(NETISR_NATM, natmintr, &natmintrq); } #if defined(__FreeBSD__) -- cgit v1.1