[ofw] [PATCH 8/?] Don't check QP state when posting, it's silly

Fab Tillier ftillier at microsoft.com
Mon Jun 18 19:29:31 PDT 2012


The current QP state check for posting sends is completely wrong.  It checks that the QP is not in the RESET state, but really should check for RTS to be correct.  Checking for RTS however is quite difficult, as the QP state is driven by QP modify IOCTLs and their completion, which can race with receive completions.  A receive completion implies that the QP is in RTS, so making a robust check here requires the CQ polling routine to drive the QP state variable if it isn't proper, which requires proper serialization.  The complexity and perf regression isn't worth the effort, so just yank the QP state checks and assume that folks writing to verbs have a bit of a clue.

Singed-off-by: Fab Tillier <ftillier at microsoft.com>

Index: hw/mlx4/user/hca/qp.c
===================================================================
--- hw/mlx4/user/hca/qp.c	(revision 3414)
+++ hw/mlx4/user/hca/qp.c	(working copy)
@@ -230,14 +230,6 @@
 
 	pthread_spin_lock(&qp->sq.lock);
 
-	/* XXX check that state is OK to post send */
-	if(ibqp->state == IBV_QPS_RESET) {
-		status = IB_INVALID_QP_STATE;
-		if (bad_wr)
-			*bad_wr = wr;
-		goto err_state;
-	}
-
 	ind = qp->sq.head;
 
 	for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
@@ -478,7 +470,6 @@
 		stamp_send_wqe(qp, (ind + qp->sq_spare_wqes - 1) &
 			       (qp->sq.wqe_cnt - 1));
 
-err_state:
 	pthread_spin_unlock(&qp->sq.lock);
 
 	return status;
@@ -501,14 +492,6 @@
 
 	pthread_spin_lock(&qp->rq.lock);
 
-	/* XXX check that state is OK to post receive */
-	if(qp->ibv_qp.state == IBV_QPS_RESET) {
-		status = IB_INVALID_QP_STATE;
-		if (bad_wr)
-			*bad_wr = wr;
-		goto err_state;
-	}
-
 	ind = qp->rq.head & (qp->rq.wqe_cnt - 1);
 
 	for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
@@ -558,7 +541,6 @@
 		*qp->db = htonl(qp->rq.head & 0xffff);
 	}
 
-err_state:
 	pthread_spin_unlock(&qp->rq.lock);
 
 	return status;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8.qp_state.patch
Type: application/octet-stream
Size: 1189 bytes
Desc: 8.qp_state.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20120619/8b833c5c/attachment.obj>


More information about the ofw mailing list