[ofa-general] [PATCH] IB/mlx4_ib initialize work - resending fix description

Eli Cohen eli at mellanox.co.il
Thu May 24 06:05:01 PDT 2007


Initialize send work queue when modified from reset to init

Need to initilaize owner bit of the send queue to hardware ownership
whenever the QP is modified from reset to init. This is required for
the cases that the QP is moved to reset but not destroyed and then
modified to init again.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

---

Index: connectx_kernel/drivers/infiniband/hw/mlx4/qp.c
===================================================================
--- connectx_kernel.orig/drivers/infiniband/hw/mlx4/qp.c	2007-05-21 09:40:41.000000000 +0300
+++ connectx_kernel/drivers/infiniband/hw/mlx4/qp.c	2007-05-24 15:14:22.000000000 +0300
@@ -253,9 +253,7 @@ static int create_qp_common(struct mlx4_
 			    struct ib_qp_init_attr *init_attr,
 			    struct ib_udata *udata, int sqpn, struct mlx4_ib_qp *qp)
 {
-	struct mlx4_wqe_ctrl_seg *ctrl;
 	int err;
-	int i;
 
 	mutex_init(&qp->mutex);
 	spin_lock_init(&qp->sq.lock);
@@ -323,11 +321,6 @@ static int create_qp_common(struct mlx4_
 		if (err)
 			goto err_mtt;
 
-		for (i = 0; i < qp->sq.max; ++i) {
-			ctrl = get_send_wqe(qp, i);
-			ctrl->owner_opcode = cpu_to_be32(1 << 31);
-		}
-
 		qp->sq.wrid  = kmalloc(qp->sq.max * sizeof (u64), GFP_KERNEL);
 		qp->rq.wrid  = kmalloc(qp->rq.max * sizeof (u64), GFP_KERNEL);
 
@@ -670,8 +663,10 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp
 	struct mlx4_qp_context *context;
 	enum mlx4_qp_optpar optpar = 0;
 	enum ib_qp_state cur_state, new_state;
+	struct mlx4_wqe_ctrl_seg *ctrl;
 	int sqd_event;
 	int err = -EINVAL;
+	int i;
 
 	context = kzalloc(sizeof *context, GFP_KERNEL);
 	if (!context)
@@ -856,8 +851,13 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp
 	if (ibqp->srq)
 		context->srqn = cpu_to_be32(1 << 24 | to_msrq(ibqp->srq)->msrq.srqn);
 
-	if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT)
+	if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
 		context->db_rec_addr = cpu_to_be64(qp->db.dma);
+		for (i = 0; i < qp->sq.max; ++i) {
+			ctrl = get_send_wqe(qp, i);
+			ctrl->owner_opcode = cpu_to_be32(1 << 31);
+		}
+	}
 
 	if (cur_state == IB_QPS_INIT &&
 	    new_state == IB_QPS_RTR  &&




More information about the general mailing list