diff options
Diffstat (limited to 'include/linux/netpoll.h')
-rw-r--r-- | include/linux/netpoll.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 449a4fde6587..388cd91bc7a6 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -16,14 +16,18 @@ struct netpoll; | |||
16 | struct netpoll { | 16 | struct netpoll { |
17 | struct net_device *dev; | 17 | struct net_device *dev; |
18 | char dev_name[16], *name; | 18 | char dev_name[16], *name; |
19 | int rx_flags; | ||
20 | void (*rx_hook)(struct netpoll *, int, char *, int); | 19 | void (*rx_hook)(struct netpoll *, int, char *, int); |
21 | void (*drop)(struct sk_buff *skb); | 20 | void (*drop)(struct sk_buff *skb); |
22 | u32 local_ip, remote_ip; | 21 | u32 local_ip, remote_ip; |
23 | u16 local_port, remote_port; | 22 | u16 local_port, remote_port; |
24 | unsigned char local_mac[6], remote_mac[6]; | 23 | unsigned char local_mac[6], remote_mac[6]; |
24 | }; | ||
25 | |||
26 | struct netpoll_info { | ||
25 | spinlock_t poll_lock; | 27 | spinlock_t poll_lock; |
26 | int poll_owner; | 28 | int poll_owner; |
29 | int rx_flags; | ||
30 | struct netpoll *np; | ||
27 | }; | 31 | }; |
28 | 32 | ||
29 | void netpoll_poll(struct netpoll *np); | 33 | void netpoll_poll(struct netpoll *np); |
@@ -39,22 +43,27 @@ void netpoll_queue(struct sk_buff *skb); | |||
39 | #ifdef CONFIG_NETPOLL | 43 | #ifdef CONFIG_NETPOLL |
40 | static inline int netpoll_rx(struct sk_buff *skb) | 44 | static inline int netpoll_rx(struct sk_buff *skb) |
41 | { | 45 | { |
42 | return skb->dev->np && skb->dev->np->rx_flags && __netpoll_rx(skb); | 46 | struct netpoll_info *npinfo = skb->dev->npinfo; |
47 | |||
48 | if (!npinfo || !npinfo->rx_flags) | ||
49 | return 0; | ||
50 | |||
51 | return npinfo->np && __netpoll_rx(skb); | ||
43 | } | 52 | } |
44 | 53 | ||
45 | static inline void netpoll_poll_lock(struct net_device *dev) | 54 | static inline void netpoll_poll_lock(struct net_device *dev) |
46 | { | 55 | { |
47 | if (dev->np) { | 56 | if (dev->npinfo) { |
48 | spin_lock(&dev->np->poll_lock); | 57 | spin_lock(&dev->npinfo->poll_lock); |
49 | dev->np->poll_owner = smp_processor_id(); | 58 | dev->npinfo->poll_owner = smp_processor_id(); |
50 | } | 59 | } |
51 | } | 60 | } |
52 | 61 | ||
53 | static inline void netpoll_poll_unlock(struct net_device *dev) | 62 | static inline void netpoll_poll_unlock(struct net_device *dev) |
54 | { | 63 | { |
55 | if (dev->np) { | 64 | if (dev->npinfo) { |
56 | dev->np->poll_owner = -1; | 65 | dev->npinfo->poll_owner = -1; |
57 | spin_unlock(&dev->np->poll_lock); | 66 | spin_unlock(&dev->npinfo->poll_lock); |
58 | } | 67 | } |
59 | } | 68 | } |
60 | 69 | ||