[openib-general] HP ZX1 and HP IB cards...

Roland Dreier roland at topspin.com
Fri Dec 3 15:22:25 PST 2004


OK, I may have figured out the problem.  How does this patch work?

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 (work && !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);
 	}



More information about the general mailing list