SOFTINTR(9)

NAME
softintr, softintr_establish, softintr_disestablish, softintr_schedule - machine-independent software interrupt framework

SYNOPSIS
#include <machine/intr.h>
void *
softintr_establish(int level, void (*fun)(void *), void *arg);
void
softintr_disestablish(void *cookie);
void
softintr_schedule(void *cookie);

DESCRIPTION
The NetBSD machine-independent software interrupt framework is designed to provide a generic software interrupt mechanism which can be used any time a low-priority callback is needed. It allows dynamic registration of software interrupts for loadable drivers and protocol stacks, prioritization and fair queueing of software interrupts, and allows machine-dependent optimizations to reduce cost and code complexity.

In order to provide this framework, the machine-dependent <machine/types.h> must define the __HAVE_GENERIC_SOFT_INTERRUPTS symbol (without a value), furthermore, the machine-dependent <machine/intr.h> include file must provide prototypes for the softintr functions and must provide definitions of several constants which define software interrupt priority levels (IPLs):

IPL_SOFTCLOCK
    The software IPL for software clock interrupts (i.e., softclock()).

IPL_SOFTNET
    The software IPL for network callbacks.

IPL_SOFTSERIAL
    The software IPL for serial driver callbacks.

Other constants of the form IPL_SOFT* are reserved for future use by this framework.

The following is a brief description of each function in the framework:

softintr_establish()
    Register a software interrupt at level level, which will call the function fun with one argument, arg. It may allocate a machine-specific data structure. If successful, softintr_establish() returns a non-NULL opaque cookie which can be used as an argument to softintr_schedule() or softintr_disestablish(). If for some reason it does not succeed, it returns NULL.

softintr_disestablish()
    Deallocate a software interrupt previously allocated by a call to softintr_establish().

softintr_schedule()
    Schedule a software interrupt previously allocated by a call to softintr_establish() to be executed as soon as that software interrupt is unblocked. This function may assume that the interrupt is currently blocked, so it need not check to see if the interrupt needs to be executed immediately. softintr_schedule() can safely be called multiple times before the callback routine is invoked.

SEE ALSO
spl(9)

HISTORY
The NetBSD machine-independent software interrupt framework was designed in 1997 and was implemented by one port in NetBSD 1.3. However, it did not gain wider implementation until NetBSD 1.5.

AUTHORS
The NetBSD machine-independent software interrupt framework was designed by Charles Hannum <mycroft@NetBSD.org>.