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

Previous thread: [ofa-general] OFED meeting agenda for today (June 16, 2008) by Tziporet Koren on Monday, June 16, 2008 - 6:59 am. (4 messages)

Next thread: [ofa-general] [RFC] Receive Core Afinnity (aka RSS) support by Eli Cohen on Monday, June 16, 2008 - 7:58 am. (10 messages)
From: Eli Cohen
Date: Monday, June 16, 2008 - 7:51 am

Roland,
From: Eli Cohen <eli@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@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@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
_______________________________________________
general mailing list
general@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
Previous thread: [ofa-general] OFED meeting agenda for today (June 16, 2008) by Tziporet Koren on Monday, June 16, 2008 - 6:59 am. (4 messages)

Next thread: [ofa-general] [RFC] Receive Core Afinnity (aka RSS) support by Eli Cohen on Monday, June 16, 2008 - 7:58 am. (10 messages)