[openib-general] [PATCH] mthca: check that QP is not already a member of a MCG before attach

Jack Morgenstein jackm at mellanox.co.il
Sun Oct 2 08:12:28 PDT 2005


The patch below avoids entering a QP as member of a multicast group multiple times.

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: linux-kernel/infiniband/hw/mthca/mthca_mcg.c
===================================================================
--- linux-kernel/infiniband/hw/mthca/mthca_mcg.c	(revision 3632)
+++ linux-kernel/infiniband/hw/mthca/mthca_mcg.c	(working copy)
@@ -189,7 +189,12 @@
 	}
 
 	for (i = 0; i < MTHCA_QP_PER_MGM; ++i)
-		if (!(mgm->qp[i] & cpu_to_be32(1 << 31))) {
+		if (mgm->qp[i] == cpu_to_be32(ibqp->qp_num | (1 << 31))) {
+			mthca_dbg(dev, "QP %06x already a member of MGM\n", 
+				  ibqp->qp_num);
+			err = 0;
+			goto out;
+		} else if (!(mgm->qp[i] & cpu_to_be32(1 << 31))) {
 			mgm->qp[i] = cpu_to_be32(ibqp->qp_num | (1 << 31));
 			break;
 		}



More information about the general mailing list