diff options
Diffstat (limited to 'include/linux/netpoll.h')
-rw-r--r-- | include/linux/netpoll.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index bcd0ac33f592..5ade54a78dbb 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/rcupdate.h> | ||
12 | #include <linux/list.h> | 13 | #include <linux/list.h> |
13 | 14 | ||
14 | struct netpoll; | 15 | struct netpoll; |
@@ -26,6 +27,7 @@ struct netpoll { | |||
26 | struct netpoll_info { | 27 | struct netpoll_info { |
27 | spinlock_t poll_lock; | 28 | spinlock_t poll_lock; |
28 | int poll_owner; | 29 | int poll_owner; |
30 | int tries; | ||
29 | int rx_flags; | 31 | int rx_flags; |
30 | spinlock_t rx_lock; | 32 | spinlock_t rx_lock; |
31 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 33 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ |
@@ -60,25 +62,31 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
60 | return ret; | 62 | return ret; |
61 | } | 63 | } |
62 | 64 | ||
63 | static inline void netpoll_poll_lock(struct net_device *dev) | 65 | static inline void *netpoll_poll_lock(struct net_device *dev) |
64 | { | 66 | { |
67 | rcu_read_lock(); /* deal with race on ->npinfo */ | ||
65 | if (dev->npinfo) { | 68 | if (dev->npinfo) { |
66 | spin_lock(&dev->npinfo->poll_lock); | 69 | spin_lock(&dev->npinfo->poll_lock); |
67 | dev->npinfo->poll_owner = smp_processor_id(); | 70 | dev->npinfo->poll_owner = smp_processor_id(); |
71 | return dev->npinfo; | ||
68 | } | 72 | } |
73 | return NULL; | ||
69 | } | 74 | } |
70 | 75 | ||
71 | static inline void netpoll_poll_unlock(struct net_device *dev) | 76 | static inline void netpoll_poll_unlock(void *have) |
72 | { | 77 | { |
73 | if (dev->npinfo) { | 78 | struct netpoll_info *npi = have; |
74 | dev->npinfo->poll_owner = -1; | 79 | |
75 | spin_unlock(&dev->npinfo->poll_lock); | 80 | if (npi) { |
81 | npi->poll_owner = -1; | ||
82 | spin_unlock(&npi->poll_lock); | ||
76 | } | 83 | } |
84 | rcu_read_unlock(); | ||
77 | } | 85 | } |
78 | 86 | ||
79 | #else | 87 | #else |
80 | #define netpoll_rx(a) 0 | 88 | #define netpoll_rx(a) 0 |
81 | #define netpoll_poll_lock(a) | 89 | #define netpoll_poll_lock(a) 0 |
82 | #define netpoll_poll_unlock(a) | 90 | #define netpoll_poll_unlock(a) |
83 | #endif | 91 | #endif |
84 | 92 | ||