diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 563bb95b5024..abe8fc840591 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -533,10 +533,14 @@ void napi_disable(struct napi_struct *n); */ static inline void napi_enable(struct napi_struct *n) { - BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); - smp_mb__before_atomic(); - clear_bit(NAPI_STATE_SCHED, &n->state); - clear_bit(NAPI_STATE_NPSVC, &n->state); + unsigned long val, new; + + do { + val = READ_ONCE(n->state); + BUG_ON(!test_bit(NAPI_STATE_SCHED, &val)); + + new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC); + } while (cmpxchg(&n->state, val, new) != val); } /**