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 <[email protected]>

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;

Attachment: 8.qp_state.patch
Description: 8.qp_state.patch

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to