Deleted Added
full compact
ipoib_ib.c (276824) ipoib_ib.c (278886)
1/*
2 * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
4 * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU

--- 369 unchanged lines hidden (view full) ---

378}
379
380static void
381ipoib_poll(struct ipoib_dev_priv *priv)
382{
383 int n, i;
384
385poll_more:
1/*
2 * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
4 * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU

--- 369 unchanged lines hidden (view full) ---

378}
379
380static void
381ipoib_poll(struct ipoib_dev_priv *priv)
382{
383 int n, i;
384
385poll_more:
386 spin_lock(&priv->drain_lock);
386 for (;;) {
387 n = ib_poll_cq(priv->recv_cq, IPOIB_NUM_WC, priv->ibwc);
388
389 for (i = 0; i < n; i++) {
390 struct ib_wc *wc = priv->ibwc + i;
391
392 if ((wc->wr_id & IPOIB_OP_RECV) == 0)
393 panic("ipoib_poll: Bad wr_id 0x%jX\n",
394 (intmax_t)wc->wr_id);
395 if (wc->wr_id & IPOIB_OP_CM)
396 ipoib_cm_handle_rx_wc(priv, wc);
397 else
398 ipoib_ib_handle_rx_wc(priv, wc);
399 }
400
401 if (n != IPOIB_NUM_WC)
402 break;
403 }
387 for (;;) {
388 n = ib_poll_cq(priv->recv_cq, IPOIB_NUM_WC, priv->ibwc);
389
390 for (i = 0; i < n; i++) {
391 struct ib_wc *wc = priv->ibwc + i;
392
393 if ((wc->wr_id & IPOIB_OP_RECV) == 0)
394 panic("ipoib_poll: Bad wr_id 0x%jX\n",
395 (intmax_t)wc->wr_id);
396 if (wc->wr_id & IPOIB_OP_CM)
397 ipoib_cm_handle_rx_wc(priv, wc);
398 else
399 ipoib_ib_handle_rx_wc(priv, wc);
400 }
401
402 if (n != IPOIB_NUM_WC)
403 break;
404 }
405 spin_unlock(&priv->drain_lock);
404
405 if (ib_req_notify_cq(priv->recv_cq,
406 IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS))
407 goto poll_more;
408}
409
410void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
411{

--- 290 unchanged lines hidden (view full) ---

702
703 return pending;
704}
705
706void ipoib_drain_cq(struct ipoib_dev_priv *priv)
707{
708 int i, n;
709
406
407 if (ib_req_notify_cq(priv->recv_cq,
408 IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS))
409 goto poll_more;
410}
411
412void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
413{

--- 290 unchanged lines hidden (view full) ---

704
705 return pending;
706}
707
708void ipoib_drain_cq(struct ipoib_dev_priv *priv)
709{
710 int i, n;
711
712 spin_lock(&priv->drain_lock);
710 do {
711 n = ib_poll_cq(priv->recv_cq, IPOIB_NUM_WC, priv->ibwc);
712 for (i = 0; i < n; ++i) {
713 /*
714 * Convert any successful completions to flush
715 * errors to avoid passing packets up the
716 * stack after bringing the device down.
717 */

--- 4 unchanged lines hidden (view full) ---

722 panic("ipoib_drain_cq: Bad wrid 0x%jX\n",
723 (intmax_t)priv->ibwc[i].wr_id);
724 if (priv->ibwc[i].wr_id & IPOIB_OP_CM)
725 ipoib_cm_handle_rx_wc(priv, priv->ibwc + i);
726 else
727 ipoib_ib_handle_rx_wc(priv, priv->ibwc + i);
728 }
729 } while (n == IPOIB_NUM_WC);
713 do {
714 n = ib_poll_cq(priv->recv_cq, IPOIB_NUM_WC, priv->ibwc);
715 for (i = 0; i < n; ++i) {
716 /*
717 * Convert any successful completions to flush
718 * errors to avoid passing packets up the
719 * stack after bringing the device down.
720 */

--- 4 unchanged lines hidden (view full) ---

725 panic("ipoib_drain_cq: Bad wrid 0x%jX\n",
726 (intmax_t)priv->ibwc[i].wr_id);
727 if (priv->ibwc[i].wr_id & IPOIB_OP_CM)
728 ipoib_cm_handle_rx_wc(priv, priv->ibwc + i);
729 else
730 ipoib_ib_handle_rx_wc(priv, priv->ibwc + i);
731 }
732 } while (n == IPOIB_NUM_WC);
733 spin_unlock(&priv->drain_lock);
730
731 spin_lock(&priv->lock);
732 while (ipoib_poll_tx(priv))
733 ; /* nothing */
734
735 spin_unlock(&priv->lock);
736}
737

--- 258 unchanged lines hidden ---
734
735 spin_lock(&priv->lock);
736 while (ipoib_poll_tx(priv))
737 ; /* nothing */
738
739 spin_unlock(&priv->lock);
740}
741

--- 258 unchanged lines hidden ---