From: Michael S. Tsirkin <[EMAIL PROTECTED]>

Avoid taking the CQ table lock in the fast path path by using
synchronize_irq() after removing a CQ from the table to make sure that
no completion events are still in progress.  This gets a nice speedup
(about 4%) in IP over IB on my hardware.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>


--- linux-export.orig/drivers/infiniband/hw/mthca/mthca_cq.c    2005-03-03 
14:12:51.832670421 -0800
+++ linux-export/drivers/infiniband/hw/mthca/mthca_cq.c 2005-03-03 
14:12:52.368554099 -0800
@@ -33,6 +33,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/hardirq.h>
 
 #include <ib_pack.h>
 
@@ -181,11 +182,7 @@
 {
        struct mthca_cq *cq;
 
-       spin_lock(&dev->cq_table.lock);
        cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 
1));
-       if (cq)
-               atomic_inc(&cq->refcount);
-       spin_unlock(&dev->cq_table.lock);
 
        if (!cq) {
                mthca_warn(dev, "Completion event for bogus CQ %08x\n", cqn);
@@ -193,9 +190,6 @@
        }
 
        cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
-
-       if (atomic_dec_and_test(&cq->refcount))
-               wake_up(&cq->wait);
 }
 
 void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn)
@@ -783,6 +777,11 @@
                          cq->cqn & (dev->limits.num_cqs - 1));
        spin_unlock_irq(&dev->cq_table.lock);
 
+       if (dev->mthca_flags & MTHCA_FLAG_MSI_X)
+               synchronize_irq(dev->eq_table.eq[MTHCA_EQ_COMP].msi_x_vector);
+       else
+               synchronize_irq(dev->pdev->irq);
+
        atomic_dec(&cq->refcount);
        wait_event(cq->wait, !atomic_read(&cq->refcount));
 

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to