[openib-general] [PATCH] mthca: fixes pkey_ix processing in mthca_modify_qp

Jack Morgenstein jackm at mellanox.co.il
Sun Oct 2 07:10:44 PDT 2005


Problem:  When pkey-index provided > pkey_table_size, the pkey index used
	in sending packets is pkey_index % pkey_table_size (64 for Mellanox HCAs).

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

Index: linux-kernel/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- linux-kernel/infiniband/hw/mthca/mthca_qp.c	(revision 3632)
+++ linux-kernel/infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -585,6 +585,13 @@
 						 IB_QP_STATE));
 		return -EINVAL;
 	}
+
+	if ((attr_mask & IB_QP_PKEY_INDEX) && 
+	     attr->pkey_index >= dev->limits.pkey_table_len) {
+		mthca_dbg(dev, "PKey index (%u) too large. max is %d\n",
+			  attr->pkey_index,dev->limits.pkey_table_len-1); 
+		return -EINVAL;
+	}
 
 	mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
 	if (IS_ERR(mailbox))



More information about the general mailing list