Widen EPOCH(9) usage in network drivers.
Make sure network drivers enter and exit the EPOCH(9) before
forwarding network packets to the network stack. This is part of
widening the EPOCH(9) usage so that entering and exiting the EPOCH(9)
at every packet input to the network stack can be avoided.
This patch address the shortcomings of r357004, that many network
drivers have timers, taskqueues and even own threads that input IP
packets, and not only interrupt threads. Two convenience macros
NET_EPOCH_WRAP() and NET_EPOCH_WRAP_RET() have been added to minimize
the amount of patching needed in each network driver.
Each network driver is now responsible for entering and exiting the
EPOCH(9) before calling the if_input method of struct ifnet. The only
exception is when debugnet is activated. Then EPOCH(9) is not
required. Also netisr_queue(9) can be called outside an EPOCH(9)
section, which is used by sppp_input() for example.
Typically the coalesching parameters or interrupt moderation settings
in existing drivers now indirectly control how frequently the EPOCH(9)
is entered and exited. The more packets that are input at a time, the
more time the epoch_wait(9) function may need which can lead to
temporarily increased memory usage, because of structures waiting to
be freed by an epoch_call(9).
Sponsored by: Mellanox Technologies