[ofa-general] [PATCH] libmlx4: modify a QP to reset before destroying it

Eli Cohen eli at mellanox.co.il
Mon Jun 16 07:51:42 PDT 2008


Roland,
this is just a resend since I did not CC the mailing list.

>From 1705a59b2199e93bfcf73d03717f6431c471bfd0 Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli at mellanox.co.il>
Date: Sun, 15 Jun 2008 15:40:52 +0300
Subject: [PATCH] libmlx4: modify a QP to reset before destroying it

This is required to be done  before cleaning the CQ from CQEs belonging to
this QP. If we fail to do this, we might get failures when subsequently
polling the CQ.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 src/verbs.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/verbs.c b/src/verbs.c
index bb904e2..693ed68 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -557,6 +557,15 @@ int mlx4_destroy_qp(struct ibv_qp *ibqp)
 {
 	struct mlx4_qp *qp = to_mqp(ibqp);
 	int ret;
+	struct ibv_qp_attr attr = {
+		.qp_state = IBV_QPS_RESET,
+	};
+
+	if (ibqp->state != IBV_QPS_RESET) {
+		ret = mlx4_modify_qp(ibqp, &attr, IBV_QP_STATE);
+		if (ret)
+			return ret;
+	}
 
 	mlx4_cq_clean(to_mcq(ibqp->recv_cq), ibqp->qp_num,
 		       ibqp->srq ? to_msrq(ibqp->srq) : NULL);
-- 
1.5.5.4





--
Eli Cohen
Mellanox Technologies LTD.
SW- Linux
Phone: +972 (4) 909 7200 (ext 276)
Mobile: +972 (54) 650 1206
E-mail: eli at mellanox.co.il

----------------------------------------------------------------------
Emails belong on computers, trees belong in forests; if you must print
this, do it on recycled paper.
http://www.greenpeace.org/international/
----------------------------------------------------------------------


Disclaimer added by CodeTwo Exchange Rules
http://www.codetwo.com



More information about the general mailing list