diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netpoll.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 5d881c388273..2d178baa49df 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
| @@ -63,6 +63,13 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) | |||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | #ifdef CONFIG_NETPOLL | 65 | #ifdef CONFIG_NETPOLL |
| 66 | static inline int netpoll_rx_on(struct sk_buff *skb) | ||
| 67 | { | ||
| 68 | struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); | ||
| 69 | |||
| 70 | return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); | ||
| 71 | } | ||
| 72 | |||
| 66 | static inline bool netpoll_rx(struct sk_buff *skb) | 73 | static inline bool netpoll_rx(struct sk_buff *skb) |
| 67 | { | 74 | { |
| 68 | struct netpoll_info *npinfo; | 75 | struct netpoll_info *npinfo; |
| @@ -70,11 +77,11 @@ static inline bool netpoll_rx(struct sk_buff *skb) | |||
| 70 | bool ret = false; | 77 | bool ret = false; |
| 71 | 78 | ||
| 72 | local_irq_save(flags); | 79 | local_irq_save(flags); |
| 73 | npinfo = rcu_dereference_bh(skb->dev->npinfo); | ||
| 74 | 80 | ||
| 75 | if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) | 81 | if (!netpoll_rx_on(skb)) |
| 76 | goto out; | 82 | goto out; |
| 77 | 83 | ||
| 84 | npinfo = rcu_dereference_bh(skb->dev->npinfo); | ||
| 78 | spin_lock(&npinfo->rx_lock); | 85 | spin_lock(&npinfo->rx_lock); |
| 79 | /* check rx_flags again with the lock held */ | 86 | /* check rx_flags again with the lock held */ |
| 80 | if (npinfo->rx_flags && __netpoll_rx(skb, npinfo)) | 87 | if (npinfo->rx_flags && __netpoll_rx(skb, npinfo)) |
| @@ -86,13 +93,6 @@ out: | |||
| 86 | return ret; | 93 | return ret; |
| 87 | } | 94 | } |
| 88 | 95 | ||
| 89 | static inline int netpoll_rx_on(struct sk_buff *skb) | ||
| 90 | { | ||
| 91 | struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); | ||
| 92 | |||
| 93 | return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline int netpoll_receive_skb(struct sk_buff *skb) | 96 | static inline int netpoll_receive_skb(struct sk_buff *skb) |
| 97 | { | 97 | { |
| 98 | if (!list_empty(&skb->dev->napi_list)) | 98 | if (!list_empty(&skb->dev->napi_list)) |
