netpoll: Don't drop all received packets.
[firefly-linux-kernel-4.4.55.git] / include / linux / netpoll.h
index fbfdb9d8d3a7f59b4788bdfd1cdb26c86f0a81ca..154f9776056ca0971e6dfd75f2b2f61fc87c2c2f 100644 (file)
@@ -39,7 +39,6 @@ struct netpoll {
 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 */
@@ -82,14 +81,24 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
        local_irq_restore(flags);
 }
 
-
+#ifdef CONFIG_NETPOLL_TRAP
+static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
+{
+       return !list_empty(&npinfo->rx_np);
+}
+#else
+static inline bool netpoll_rx_processing(struct netpoll_info *npinfo)
+{
+       return false;
+}
+#endif
 
 #ifdef CONFIG_NETPOLL
 static inline bool netpoll_rx_on(struct sk_buff *skb)
 {
        struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
 
-       return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
+       return npinfo && netpoll_rx_processing(npinfo);
 }
 
 static inline bool netpoll_rx(struct sk_buff *skb)
@@ -105,8 +114,8 @@ static inline bool netpoll_rx(struct sk_buff *skb)
 
        npinfo = rcu_dereference_bh(skb->dev->npinfo);
        spin_lock(&npinfo->rx_lock);
-       /* check rx_flags again with the lock held */
-       if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
+       /* check rx_processing again with the lock held */
+       if (netpoll_rx_processing(npinfo) && __netpoll_rx(skb, npinfo))
                ret = true;
        spin_unlock(&npinfo->rx_lock);