diff options
-rw-r--r-- | include/linux/netdevice.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 39dd83b183a9..a5e2dc1f0d98 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n) | |||
407 | clear_bit(NAPI_STATE_SCHED, &n->state); | 407 | clear_bit(NAPI_STATE_SCHED, &n->state); |
408 | } | 408 | } |
409 | 409 | ||
410 | #ifdef CONFIG_SMP | ||
411 | /** | ||
412 | * napi_synchronize - wait until NAPI is not running | ||
413 | * @n: napi context | ||
414 | * | ||
415 | * Wait until NAPI is done being scheduled on this context. | ||
416 | * Waits till any outstanding processing completes but | ||
417 | * does not disable future activations. | ||
418 | */ | ||
419 | static inline void napi_synchronize(const struct napi_struct *n) | ||
420 | { | ||
421 | while (test_bit(NAPI_STATE_SCHED, &n->state)) | ||
422 | msleep(1); | ||
423 | } | ||
424 | #else | ||
425 | # define napi_synchronize(n) barrier() | ||
426 | #endif | ||
427 | |||
410 | /* | 428 | /* |
411 | * The DEVICE structure. | 429 | * The DEVICE structure. |
412 | * Actually, this whole structure is a big mistake. It mixes I/O | 430 | * Actually, this whole structure is a big mistake. It mixes I/O |