aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netpoll.h73
1 files changed, 40 insertions, 33 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index ab9aaaff8d04..a0632af88d8b 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,32 +24,38 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
29 27
30 union inet_addr local_ip, remote_ip; 28 union inet_addr local_ip, remote_ip;
31 bool ipv6; 29 bool ipv6;
32 u16 local_port, remote_port; 30 u16 local_port, remote_port;
33 u8 remote_mac[ETH_ALEN]; 31 u8 remote_mac[ETH_ALEN];
34 32
35 struct list_head rx; /* rx_np list element */
36 struct work_struct cleanup_work; 33 struct work_struct cleanup_work;
34
35#ifdef CONFIG_NETPOLL_TRAP
36 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
37 int offset, int len);
38 struct list_head rx; /* rx_np list element */
39#endif
37}; 40};
38 41
39struct netpoll_info { 42struct netpoll_info {
40 atomic_t refcnt; 43 atomic_t refcnt;
41 44
42 spinlock_t rx_lock;
43 struct semaphore dev_lock; 45 struct semaphore dev_lock;
44 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
45 46
46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
47 struct sk_buff_head txq; 47 struct sk_buff_head txq;
48 48
49 struct delayed_work tx_work; 49 struct delayed_work tx_work;
50 50
51 struct netpoll *netpoll; 51 struct netpoll *netpoll;
52 struct rcu_head rcu; 52 struct rcu_head rcu;
53
54#ifdef CONFIG_NETPOLL_TRAP
55 spinlock_t rx_lock;
56 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
57 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
58#endif
53}; 59};
54 60
55#ifdef CONFIG_NETPOLL 61#ifdef CONFIG_NETPOLL
@@ -68,7 +74,6 @@ int netpoll_setup(struct netpoll *np);
68void __netpoll_cleanup(struct netpoll *np); 74void __netpoll_cleanup(struct netpoll *np);
69void __netpoll_free_async(struct netpoll *np); 75void __netpoll_free_async(struct netpoll *np);
70void netpoll_cleanup(struct netpoll *np); 76void netpoll_cleanup(struct netpoll *np);
71int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
72void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 77void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
73 struct net_device *dev); 78 struct net_device *dev);
74static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 79static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
@@ -82,25 +87,12 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
82#ifdef CONFIG_NETPOLL_TRAP 87#ifdef CONFIG_NETPOLL_TRAP
83int netpoll_trap(void); 88int netpoll_trap(void);
84void netpoll_set_trap(int trap); 89void netpoll_set_trap(int trap);
90int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
85static inline bool netpoll_rx_processing(struct netpoll_info *npinfo) 91static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
86{ 92{
87 return !list_empty(&npinfo->rx_np); 93 return !list_empty(&npinfo->rx_np);
88} 94}
89#else
90static inline int netpoll_trap(void)
91{
92 return 0;
93}
94static inline void netpoll_set_trap(int trap)
95{
96}
97static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
98{
99 return false;
100}
101#endif
102 95
103#ifdef CONFIG_NETPOLL
104static inline bool netpoll_rx_on(struct sk_buff *skb) 96static inline bool netpoll_rx_on(struct sk_buff *skb)
105{ 97{
106 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); 98 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
@@ -138,6 +130,33 @@ static inline int netpoll_receive_skb(struct sk_buff *skb)
138 return 0; 130 return 0;
139} 131}
140 132
133#else
134static inline int netpoll_trap(void)
135{
136 return 0;
137}
138static inline void netpoll_set_trap(int trap)
139{
140}
141static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
142{
143 return false;
144}
145static inline bool netpoll_rx(struct sk_buff *skb)
146{
147 return false;
148}
149static inline bool netpoll_rx_on(struct sk_buff *skb)
150{
151 return false;
152}
153static inline int netpoll_receive_skb(struct sk_buff *skb)
154{
155 return 0;
156}
157#endif
158
159#ifdef CONFIG_NETPOLL
141static inline void *netpoll_poll_lock(struct napi_struct *napi) 160static inline void *netpoll_poll_lock(struct napi_struct *napi)
142{ 161{
143 struct net_device *dev = napi->dev; 162 struct net_device *dev = napi->dev;
@@ -166,18 +185,6 @@ static inline bool netpoll_tx_running(struct net_device *dev)
166} 185}
167 186
168#else 187#else
169static inline bool netpoll_rx(struct sk_buff *skb)
170{
171 return false;
172}
173static inline bool netpoll_rx_on(struct sk_buff *skb)
174{
175 return false;
176}
177static inline int netpoll_receive_skb(struct sk_buff *skb)
178{
179 return 0;
180}
181static inline void *netpoll_poll_lock(struct napi_struct *napi) 188static inline void *netpoll_poll_lock(struct napi_struct *napi)
182{ 189{
183 return NULL; 190 return NULL;