[openib-general] [PATCH 8 of 53] ipath - cap number of CQEs

Bryan O'Sullivan bos at pathscale.com
Fri May 12 16:42:53 PDT 2006


Cap the number of CQEs.  Not a real limitation for us, but expected by
the verbs code.

Signed-off-by: Bryan O'Sullivan <bos at pathscale.com>

diff -r e823378bd19c -r 1d3e85454b53 drivers/infiniband/hw/ipath/ipath_cq.c
--- a/drivers/infiniband/hw/ipath/ipath_cq.c	Fri May 12 15:55:27 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c	Fri May 12 15:55:27 2006 -0700
@@ -161,6 +161,11 @@ struct ib_cq *ipath_create_cq(struct ib_
 	struct ib_wc *wc;
 	struct ib_cq *ret;
 
+	if (entries > ib_ipath_max_cqe) {
+		ret = ERR_PTR(-EINVAL);
+		goto bail;
+	}
+
 	/*
 	 * Need to use vmalloc() if we want to support large #s of
 	 * entries.
diff -r e823378bd19c -r 1d3e85454b53 drivers/infiniband/hw/ipath/ipath_verbs.c
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:27 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:27 2006 -0700
@@ -64,6 +64,11 @@ module_param_named(max_ahs, ib_ipath_max
 module_param_named(max_ahs, ib_ipath_max_ahs, uint, S_IWUSR | S_IRUGO);
 MODULE_PARM_DESC(max_ahs,
 		 "Maximum number of address handles to support");
+
+unsigned int ib_ipath_max_cqe = 0xFFFF;
+module_param_named(max_cqe, ib_ipath_max_cqe, uint, S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_cqe,
+		 "Maximum number of completion queue entries to support");
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("PathScale <support at pathscale.com>");
@@ -598,7 +603,7 @@ static int ipath_query_device(struct ib_
 	props->max_sge = 255;
 	props->max_cq = 0xffff;
 	props->max_ah = ib_ipath_max_ahs;
-	props->max_cqe = 0xffff;
+	props->max_cqe = ib_ipath_max_cqe;
 	props->max_mr = dev->lk_table.max;
 	props->max_pd = ib_ipath_max_pds;
 	props->max_qp_rd_atom = 1;
diff -r e823378bd19c -r 1d3e85454b53 drivers/infiniband/hw/ipath/ipath_verbs.h
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:27 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:27 2006 -0700
@@ -690,6 +690,8 @@ extern const int ib_ipath_state_ops[];
 
 extern unsigned int ib_ipath_lkey_table_size;
 
+extern unsigned int ib_ipath_max_cqe;
+
 extern const u32 ib_ipath_rnr_table[];
 
 #endif				/* IPATH_VERBS_H */



More information about the general mailing list