Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c264c3dee9f20bad1f42ef5821300791291d0f77
Commit:     c264c3dee9f20bad1f42ef5821300791291d0f77
Parent:     a7475906bc496456ded9e4b062f94067fb93057a
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 17 13:26:41 2007 -0700
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 20:17:34 2007 -0400

    napi_synchronize: waiting for NAPI
    
    Some drivers with shared NAPI need a synchronization barrier.
    Also suggested by Benjamin Herrenschmidt for EMAC.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 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 39dd83b..a5e2dc1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n)
        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.
  *     Actually, this whole structure is a big mistake.  It mixes I/O
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to