Commit c264c3de authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

napi_synchronize: waiting for NAPI

Some drivers with shared NAPI need a synchronization barrier.
Also suggested by Benjamin Herrenschmidt for EMAC.
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent a7475906
...@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n) ...@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n)
clear_bit(NAPI_STATE_SCHED, &n->state); clear_bit(NAPI_STATE_SCHED, &n->state);
} }
#ifdef CONFIG_SMP
/**
* napi_synchronize - wait until NAPI is not running
* @n: napi context
*
* Wait until NAPI is done being scheduled on this context.
* Waits till any outstanding processing completes but
* does not disable future activations.
*/
static inline void napi_synchronize(const struct napi_struct *n)
{
while (test_bit(NAPI_STATE_SCHED, &n->state))
msleep(1);
}
#else
# define napi_synchronize(n) barrier()
#endif
/* /*
* The DEVICE structure. * The DEVICE structure.
* Actually, this whole structure is a big mistake. It mixes I/O * Actually, this whole structure is a big mistake. It mixes I/O
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment