diff options
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_ib.c')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 10944888cffd..481e4b6bd949 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -281,63 +281,58 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc) | |||
281 | wc->status, wr_id, wc->vendor_err); | 281 | wc->status, wr_id, wc->vendor_err); |
282 | } | 282 | } |
283 | 283 | ||
284 | int ipoib_poll(struct net_device *dev, int *budget) | 284 | int ipoib_poll(struct napi_struct *napi, int budget) |
285 | { | 285 | { |
286 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 286 | struct ipoib_dev_priv *priv = container_of(napi, struct ipoib_dev_priv, napi); |
287 | int max = min(*budget, dev->quota); | 287 | struct net_device *dev = priv->dev; |
288 | int done; | 288 | int done; |
289 | int t; | 289 | int t; |
290 | int empty; | ||
291 | int n, i; | 290 | int n, i; |
292 | 291 | ||
293 | done = 0; | 292 | done = 0; |
294 | empty = 0; | ||
295 | 293 | ||
296 | while (max) { | 294 | poll_more: |
295 | while (done < budget) { | ||
296 | int max = (budget - done); | ||
297 | |||
297 | t = min(IPOIB_NUM_WC, max); | 298 | t = min(IPOIB_NUM_WC, max); |
298 | n = ib_poll_cq(priv->cq, t, priv->ibwc); | 299 | n = ib_poll_cq(priv->cq, t, priv->ibwc); |
299 | 300 | ||
300 | for (i = 0; i < n; ++i) { | 301 | for (i = 0; i < n; i++) { |
301 | struct ib_wc *wc = priv->ibwc + i; | 302 | struct ib_wc *wc = priv->ibwc + i; |
302 | 303 | ||
303 | if (wc->wr_id & IPOIB_CM_OP_SRQ) { | 304 | if (wc->wr_id & IPOIB_CM_OP_SRQ) { |
304 | ++done; | 305 | ++done; |
305 | --max; | ||
306 | ipoib_cm_handle_rx_wc(dev, wc); | 306 | ipoib_cm_handle_rx_wc(dev, wc); |
307 | } else if (wc->wr_id & IPOIB_OP_RECV) { | 307 | } else if (wc->wr_id & IPOIB_OP_RECV) { |
308 | ++done; | 308 | ++done; |
309 | --max; | ||
310 | ipoib_ib_handle_rx_wc(dev, wc); | 309 | ipoib_ib_handle_rx_wc(dev, wc); |
311 | } else | 310 | } else |
312 | ipoib_ib_handle_tx_wc(dev, wc); | 311 | ipoib_ib_handle_tx_wc(dev, wc); |
313 | } | 312 | } |
314 | 313 | ||
315 | if (n != t) { | 314 | if (n != t) |
316 | empty = 1; | ||
317 | break; | 315 | break; |
318 | } | ||
319 | } | 316 | } |
320 | 317 | ||
321 | dev->quota -= done; | 318 | if (done < budget) { |
322 | *budget -= done; | 319 | netif_rx_complete(dev, napi); |
323 | |||
324 | if (empty) { | ||
325 | netif_rx_complete(dev); | ||
326 | if (unlikely(ib_req_notify_cq(priv->cq, | 320 | if (unlikely(ib_req_notify_cq(priv->cq, |
327 | IB_CQ_NEXT_COMP | | 321 | IB_CQ_NEXT_COMP | |
328 | IB_CQ_REPORT_MISSED_EVENTS)) && | 322 | IB_CQ_REPORT_MISSED_EVENTS)) && |
329 | netif_rx_reschedule(dev, 0)) | 323 | netif_rx_reschedule(dev, napi)) |
330 | return 1; | 324 | goto poll_more; |
331 | |||
332 | return 0; | ||
333 | } | 325 | } |
334 | 326 | ||
335 | return 1; | 327 | return done; |
336 | } | 328 | } |
337 | 329 | ||
338 | void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr) | 330 | void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr) |
339 | { | 331 | { |
340 | netif_rx_schedule(dev_ptr); | 332 | struct net_device *dev = dev_ptr; |
333 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
334 | |||
335 | netif_rx_schedule(dev, &priv->napi); | ||
341 | } | 336 | } |
342 | 337 | ||
343 | static inline int post_send(struct ipoib_dev_priv *priv, | 338 | static inline int post_send(struct ipoib_dev_priv *priv, |
@@ -577,7 +572,6 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush) | |||
577 | int i; | 572 | int i; |
578 | 573 | ||
579 | clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); | 574 | clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
580 | netif_poll_disable(dev); | ||
581 | 575 | ||
582 | ipoib_cm_dev_stop(dev); | 576 | ipoib_cm_dev_stop(dev); |
583 | 577 | ||
@@ -660,7 +654,6 @@ timeout: | |||
660 | msleep(1); | 654 | msleep(1); |
661 | } | 655 | } |
662 | 656 | ||
663 | netif_poll_enable(dev); | ||
664 | ib_req_notify_cq(priv->cq, IB_CQ_NEXT_COMP); | 657 | ib_req_notify_cq(priv->cq, IB_CQ_NEXT_COMP); |
665 | 658 | ||
666 | return 0; | 659 | return 0; |