struct netpoll_info {
atomic_t refcnt;
- unsigned long rx_flags;
spinlock_t rx_lock;
struct semaphore dev_lock;
struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
{
struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
- return npinfo && (netpoll_rx_processing(npinfo) || npinfo->rx_flags);
+ return npinfo && netpoll_rx_processing(npinfo);
}
static inline bool netpoll_rx(struct sk_buff *skb)
DEFINE_STATIC_SRCU(netpoll_srcu);
#define USEC_PER_POLL 50
-#define NETPOLL_RX_ENABLED 1
-#define NETPOLL_RX_DROP 2
#define MAX_SKB_SIZE \
(sizeof(struct ethhdr) + \
{
const struct net_device_ops *ops;
struct netpoll_info *ni = rcu_dereference_bh(dev->npinfo);
- int budget = 16;
+ bool rx_processing = netpoll_rx_processing(ni);
+ int budget = rx_processing? 16 : 0;
/* Don't do any rx activity if the dev_lock mutex is held
* the dev_open/close paths use this to block netpoll activity
return;
}
- ni->rx_flags |= NETPOLL_RX_DROP;
- atomic_inc(&trapped);
+ if (rx_processing)
+ atomic_inc(&trapped);
ops = dev->netdev_ops;
if (!ops->ndo_poll_controller) {
poll_napi(dev, budget);
- atomic_dec(&trapped);
- ni->rx_flags &= ~NETPOLL_RX_DROP;
+ if (rx_processing)
+ atomic_dec(&trapped);
up(&ni->dev_lock);
goto out;
}
- npinfo->rx_flags = 0;
INIT_LIST_HEAD(&npinfo->rx_np);
spin_lock_init(&npinfo->rx_lock);
if (np->rx_skb_hook) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
- npinfo->rx_flags |= NETPOLL_RX_ENABLED;
list_add_tail(&np->rx, &npinfo->rx_np);
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
}
if (!list_empty(&npinfo->rx_np)) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
list_del(&np->rx);
- if (list_empty(&npinfo->rx_np))
- npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
}