PERFORCE change 39844 for review
Sam Leffler
sam at FreeBSD.org
Fri Oct 17 11:04:48 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=39844
Change 39844 by sam at sam_ebb on 2003/10/17 11:04:37
permit multiple instances of the network stack to operate
concurrently; this does not handle packet ordering issues
yet (I think) but lets us look for synchronization problems
Affected files ...
.. //depot/projects/netperf/sys/net/netisr.c#5 edit
Differences ...
==== //depot/projects/netperf/sys/net/netisr.c#5 (text+ko) ====
@@ -60,7 +60,6 @@
struct ifqueue *ni_queue;
} netisrs[32];
-static struct mtx netisr_mtx;
static void *net_ih;
void
@@ -83,17 +82,13 @@
netisr_unregister(int num)
{
struct netisr *ni;
- int s;
KASSERT(!(num < 0 || num >= (sizeof(netisrs)/sizeof(*netisrs))),
("bad isr %d", num));
ni = &netisrs[num];
ni->ni_handler = NULL;
- if (ni->ni_queue != NULL) {
- s = splimp();
+ if (ni->ni_queue != NULL)
IF_DRAIN(ni->ni_queue);
- splx(s);
- }
}
struct isrstat {
@@ -143,15 +138,6 @@
/*
* Call the netisr directly instead of queueing the packet, if possible.
- *
- * Ideally, the permissibility of calling the routine would be determined
- * by checking if splnet() was asserted at the time the device interrupt
- * occurred; if so, this indicates that someone is in the network stack.
- *
- * However, bus_setup_intr uses INTR_TYPE_NET, which sets splnet before
- * calling the interrupt handler, so the previous mask is unavailable.
- * Approximate this by checking intr_nesting_level instead; if any SWI
- * handlers are running, the packet is queued instead.
*/
void
netisr_dispatch(int num, struct mbuf *m)
@@ -166,7 +152,7 @@
m_freem(m);
return;
}
- if (netisr_enable && mtx_trylock(&netisr_mtx)) {
+ if (netisr_enable) {
isrstat.isrs_directed++;
/*
* One slight problem here is that packets might bypass
@@ -182,7 +168,6 @@
*/
netisr_processqueue(ni);
ni->ni_handler(m);
- mtx_unlock(&netisr_mtx);
} else {
isrstat.isrs_deferred++;
if (IF_HANDOFF(ni->ni_queue, m, NULL))
@@ -226,7 +211,6 @@
const int polling = 0;
#endif
- mtx_lock(&netisr_mtx);
do {
bits = atomic_readandclear_int(&netisr);
if (bits == 0)
@@ -246,14 +230,12 @@
netisr_processqueue(ni);
}
} while (polling);
- mtx_unlock(&netisr_mtx);
}
static void
start_netisr(void *dummy)
{
- mtx_init(&netisr_mtx, "netisr lock", NULL, MTX_DEF);
if (swi_add(NULL, "net", swi_net, NULL, SWI_NET, INTR_MPSAFE, &net_ih))
panic("start_netisr");
}
More information about the p4-projects
mailing list