diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2014-03-14 23:47:49 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-03-17 15:47:22 -0400 |
| commit | ff6076314339e079806d9d2f3de9c9b768e94db1 (patch) | |
| tree | 1bb96205d18e5b400d342b8acf67386814835a00 /include/linux | |
| parent | e97dc3fcf98a32a5eda1e942a36044b95bc58099 (diff) | |
netpoll: Add netpoll_rx_processing
Add a helper netpoll_rx_processing that reports when netpoll has
receive side processing to perform.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netpoll.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index fbfdb9d8d3a7..479d15c97770 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
| @@ -82,14 +82,24 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) | |||
| 82 | local_irq_restore(flags); | 82 | local_irq_restore(flags); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | 85 | #ifdef CONFIG_NETPOLL_TRAP | |
| 86 | static inline bool netpoll_rx_processing(struct netpoll_info *npinfo) | ||
| 87 | { | ||
| 88 | return !list_empty(&npinfo->rx_np); | ||
| 89 | } | ||
| 90 | #else | ||
| 91 | static inline bool netpoll_rx_processing(struct netpoll_info *npinfo) | ||
| 92 | { | ||
| 93 | return false; | ||
| 94 | } | ||
| 95 | #endif | ||
| 86 | 96 | ||
| 87 | #ifdef CONFIG_NETPOLL | 97 | #ifdef CONFIG_NETPOLL |
| 88 | static inline bool netpoll_rx_on(struct sk_buff *skb) | 98 | static inline bool netpoll_rx_on(struct sk_buff *skb) |
| 89 | { | 99 | { |
| 90 | struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); | 100 | struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo); |
| 91 | 101 | ||
| 92 | return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); | 102 | return npinfo && (netpoll_rx_processing(npinfo) || npinfo->rx_flags); |
| 93 | } | 103 | } |
| 94 | 104 | ||
| 95 | static inline bool netpoll_rx(struct sk_buff *skb) | 105 | static inline bool netpoll_rx(struct sk_buff *skb) |
| @@ -105,8 +115,8 @@ static inline bool netpoll_rx(struct sk_buff *skb) | |||
| 105 | 115 | ||
| 106 | npinfo = rcu_dereference_bh(skb->dev->npinfo); | 116 | npinfo = rcu_dereference_bh(skb->dev->npinfo); |
| 107 | spin_lock(&npinfo->rx_lock); | 117 | spin_lock(&npinfo->rx_lock); |
| 108 | /* check rx_flags again with the lock held */ | 118 | /* check rx_processing again with the lock held */ |
| 109 | if (npinfo->rx_flags && __netpoll_rx(skb, npinfo)) | 119 | if (netpoll_rx_processing(npinfo) && __netpoll_rx(skb, npinfo)) |
| 110 | ret = true; | 120 | ret = true; |
| 111 | spin_unlock(&npinfo->rx_lock); | 121 | spin_unlock(&npinfo->rx_lock); |
| 112 | 122 | ||
