Roland> Hmm, I guess that wasn't the problem (or I didn't fix it
    Roland> properly).

The latter (fix was bogus, I made a cut-and-paste error).  Here's a
better version:

Index: infiniband/hw/mthca/mthca_eq.c
===================================================================
--- infiniband/hw/mthca/mthca_eq.c      (revision 1310)
+++ infiniband/hw/mthca/mthca_eq.c      (working copy)
@@ -219,11 +219,14 @@
        struct mthca_eqe *eqe;
        int disarm_cqn;
        int work = 0;
+       int set_ci = 0;
 
        while (1) {
                if (!next_eqe_sw(eq))
                        break;
 
+               set_ci = 0;
+
                eqe = get_eqe(eq, eq->cons_index);
                work = 1;
 
@@ -274,6 +277,13 @@
                                        be16_to_cpu(eqe->event.cmd.token),
                                        eqe->event.cmd.status,
                                        be64_to_cpu(eqe->event.cmd.out_param));
+                       /*
+                        * Need to set the CI inside the loop for
+                        * command completion events, because this
+                        * event allows another command to be posted
+                        * and we may overflow the EQ.
+                        */
+                       set_ci = 1;
                        break;
 
                case MTHCA_EVENT_TYPE_PORT_CHANGE:
@@ -296,9 +306,14 @@
 
                set_eqe_hw(eq, eq->cons_index);
                eq->cons_index = (eq->cons_index + 1) & (eq->nent - 1);
+
+               if (set_ci) {
+                       wmb();
+                       set_eq_ci(dev, eq->eqn, eq->cons_index);
+               }
        }
 
-       if (work) {
+       if (work && !set_ci) {
                wmb();
                set_eq_ci(dev, eq->eqn, eq->cons_index);
        }
_______________________________________________
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