int netpoll_parse_options(struct netpoll *np, char *opt);
int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp);
int netpoll_setup(struct netpoll *np);
-int netpoll_trap(void);
-void netpoll_set_trap(int trap);
void __netpoll_cleanup(struct netpoll *np);
void __netpoll_free_async(struct netpoll *np);
void netpoll_cleanup(struct netpoll *np);
}
#ifdef CONFIG_NETPOLL_TRAP
+int netpoll_trap(void);
+void netpoll_set_trap(int trap);
static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
{
return !list_empty(&npinfo->rx_np);
}
#else
+static inline int netpoll_trap(void)
+{
+ return 0;
+}
+static inline void netpoll_set_trap(int trap)
+{
+}
static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
{
return false;
static struct sk_buff_head skb_pool;
+#ifdef CONFIG_NETPOLL_TRAP
static atomic_t trapped;
+#endif
DEFINE_STATIC_SRCU(netpoll_srcu);
}
if (rx_processing)
- atomic_inc(&trapped);
+ netpoll_set_trap(1);
ops = dev->netdev_ops;
if (!ops->ndo_poll_controller) {
poll_napi(dev, budget);
if (rx_processing)
- atomic_dec(&trapped);
+ netpoll_set_trap(0);
up(&ni->dev_lock);
goto out;
/* check if netpoll clients need ARP */
- if (skb->protocol == htons(ETH_P_ARP) && atomic_read(&trapped)) {
+ if (skb->protocol == htons(ETH_P_ARP) && netpoll_trap()) {
skb_queue_tail(&npinfo->neigh_tx, skb);
return 1;
- } else if (pkt_is_ns(skb) && atomic_read(&trapped)) {
+ } else if (pkt_is_ns(skb) && netpoll_trap()) {
skb_queue_tail(&npinfo->neigh_tx, skb);
return 1;
}
return 1;
out:
- if (atomic_read(&trapped)) {
+ if (netpoll_trap()) {
kfree_skb(skb);
return 1;
}
}
EXPORT_SYMBOL(netpoll_cleanup);
+#ifdef CONFIG_NETPOLL_TRAP
int netpoll_trap(void)
{
return atomic_read(&trapped);
atomic_dec(&trapped);
}
EXPORT_SYMBOL(netpoll_set_trap);
+#endif /* CONFIG_NETPOLL_TRAP */