[ofa-general] [PATCH V2] mlx4: check for FW version which properly supports resize_cq

Jack Morgenstein jackm at dev.mellanox.co.il
Wed Jul 8 03:50:12 PDT 2009


If a ConnectX card has a FW version installed which does not
support resize cq, the resize_cq command will return -ENOSYS.

Fixes Bugzilla 1415.

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

---
Roland,

I submitted this on 2008-12-03, and somehow it fell through the cracks.
I've regenerated it for your for-next branch for kernel 2.6.31.

We already do something similar for qp's (NoErrorCompletionBit).

(V2 -- put the #define MLX4_FW_VER_RESIZE_CQ in file cq.h, not in cq.c).

-Jack

diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index de5263b..660c99a 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -349,6 +349,9 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
 	int outst_cqe;
 	int err;
 
+	if (dev->dev->caps.fw_ver < MLX4_FW_VER_RESIZE_CQ)
+		return -ENOSYS;
+
 	mutex_lock(&cq->resize_mutex);
 
 	if (entries < 1 || entries > dev->dev->caps.max_cqes) {
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h
index 6f65b2c..af6740d 100644
--- a/include/linux/mlx4/cq.h
+++ b/include/linux/mlx4/cq.h
@@ -64,6 +64,9 @@ struct mlx4_err_cqe {
 	u8			owner_sr_opcode;
 };
 
+/* Which firmware version adds support for Resize CQ */
+#define MLX4_FW_VER_RESIZE_CQ  mlx4_fw_ver(2, 5, 0)
+
 enum {
 	MLX4_CQE_VLAN_PRESENT_MASK	= 1 << 29,
 	MLX4_CQE_QPN_MASK		= 0xffffff,



More information about the general mailing list