aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netpoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r--net/core/netpoll.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index bf8d18f1b013..c499b5c69bed 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -116,6 +116,29 @@ static __sum16 checksum_udp(struct sk_buff *skb, struct udphdr *uh,
116 * network adapter, forcing superfluous retries and possibly timeouts. 116 * network adapter, forcing superfluous retries and possibly timeouts.
117 * Thus, we set our budget to greater than 1. 117 * Thus, we set our budget to greater than 1.
118 */ 118 */
119static int poll_one_napi(struct netpoll_info *npinfo,
120 struct napi_struct *napi, int budget)
121{
122 int work;
123
124 /* net_rx_action's ->poll() invocations and our's are
125 * synchronized by this test which is only made while
126 * holding the napi->poll_lock.
127 */
128 if (!test_bit(NAPI_STATE_SCHED, &napi->state))
129 return budget;
130
131 npinfo->rx_flags |= NETPOLL_RX_DROP;
132 atomic_inc(&trapped);
133
134 work = napi->poll(napi, budget);
135
136 atomic_dec(&trapped);
137 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
138
139 return budget - work;
140}
141
119static void poll_napi(struct netpoll *np) 142static void poll_napi(struct netpoll *np)
120{ 143{
121 struct netpoll_info *npinfo = np->dev->npinfo; 144 struct netpoll_info *npinfo = np->dev->npinfo;
@@ -123,17 +146,13 @@ static void poll_napi(struct netpoll *np)
123 int budget = 16; 146 int budget = 16;
124 147
125 list_for_each_entry(napi, &np->dev->napi_list, dev_list) { 148 list_for_each_entry(napi, &np->dev->napi_list, dev_list) {
126 if (test_bit(NAPI_STATE_SCHED, &napi->state) && 149 if (napi->poll_owner != smp_processor_id() &&
127 napi->poll_owner != smp_processor_id() &&
128 spin_trylock(&napi->poll_lock)) { 150 spin_trylock(&napi->poll_lock)) {
129 npinfo->rx_flags |= NETPOLL_RX_DROP; 151 budget = poll_one_napi(npinfo, napi, budget);
130 atomic_inc(&trapped);
131
132 napi->poll(napi, budget);
133
134 atomic_dec(&trapped);
135 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
136 spin_unlock(&napi->poll_lock); 152 spin_unlock(&napi->poll_lock);
153
154 if (!budget)
155 break;
137 } 156 }
138 } 157 }
139} 158}