FreeBSD/sys/net/netisr.c
/*
 * SWI handler for netisr -- processes packets in a set of workstreams that
 * it owns, woken up by calls to NWS_SIGNAL().  If this workstream is already
 * being direct dispatched, go back to sleep and wait for the dispatching
 * thread to wake us up again.
 */
SWI handler for netisr -- processes packets in a set of workstreams that
it owns, woken up by calls to NWS_SIGNAL().  If this workstream is already
being direct dispatched, go back to sleep and wait for the dispatching
thread to wake us up again.
SWI handler for netisr -- processes packets in a set of workstreams that it owns woken up by calls to NWS_SIGNAL () . If this workstream is already being direct dispatched go back to sleep and wait for the dispatching thread to wake us up again .
static void
swi_net(void *arg)
{
#ifdef NETISR_LOCKING
	struct rm_priotracker tracker;
#endif
	struct netisr_workstream *nwsp;
	u_int bits, prot;
	nwsp = arg;
#ifdef DEVICE_POLLING
	KASSERT(nws_count == 1,
	    ("%s: device_polling but nws_count != 1", __func__));
	netisr_poll();
#endif
#ifdef NETISR_LOCKING
	NETISR_RLOCK(&tracker);
#endif
	NWS_LOCK(nwsp);
	KASSERT(!(nwsp->nws_flags & NWS_RUNNING), ("swi_net: running"));
	if (nwsp->nws_flags & NWS_DISPATCHING)
		goto out;
	nwsp->nws_flags |= NWS_RUNNING;
	nwsp->nws_flags &= ~NWS_SCHEDULED;
	while ((bits = nwsp->nws_pendingbits) != 0) {
		while ((prot = ffs(bits)) != 0) {
			prot--;
			bits &= ~(1 << prot);
			(void)netisr_process_workstream_proto(nwsp, prot);
		}
	}
	nwsp->nws_flags &= ~NWS_RUNNING;
out:
	NWS_UNLOCK(nwsp);
#ifdef NETISR_LOCKING
	NETISR_RUNLOCK(&tracker);
#endif
#ifdef DEVICE_POLLING
	netisr_pollmore();
#endif
}
static void swi_net ( void * arg ) { #ifdef NETISR_LOCKING struct rm_priotracker tracker ; #endif struct netisr_workstream * nwsp ; u_int bits , prot ; nwsp = arg ; #ifdef DEVICE_POLLING KASSERT ( nws_count == 1 , ( " " , __func__ ) ) ; netisr_poll ( ) ; #endif #ifdef NETISR_LOCKING NETISR_RLOCK ( & tracker ) ; #endif NWS_LOCK ( nwsp ) ; KASSERT ( ! ( nwsp -> nws_flags & NWS_RUNNING ) , ( " " ) ) ; if ( nwsp -> nws_flags & NWS_DISPATCHING ) goto out ; nwsp -> nws_flags |= NWS_RUNNING ; nwsp -> nws_flags &= ~ NWS_SCHEDULED ; while ( ( bits = nwsp -> nws_pendingbits ) != 0 ) { while ( ( prot = ffs ( bits ) ) != 0 ) { prot -- ; bits &= ~ ( 1 << prot ) ; ( void ) netisr_process_workstream_proto ( nwsp , prot ) ; } } nwsp -> nws_flags &= ~ NWS_RUNNING ; out : NWS_UNLOCK ( nwsp ) ; #ifdef NETISR_LOCKING NETISR_RUNLOCK ( & tracker ) ; #endif #ifdef DEVICE_POLLING netisr_pollmore ( ) ; #endif }
SWI handler for netisr -- processes packets in a set of workstreams that
 it owns, woken up by calls to NWS_SIGNAL().
SWI handler for netisr -- processes packets in a set of workstreams that it owns woken up by calls to NWS_SIGNAL () .