Discussion:
[ofw] [Patch 4/62] Reference implementation of NDv2
Fab Tillier
2013-02-20 23:37:27 UTC
Permalink
QP state checks when posting aren't really accomplishing anything. The SQ check especially only checks against the QP being in RST, while a proper check would be to prevent posting until in RTS. However, the QP state is decoupled between the hardware and the software, so a QP can move to RTS before user-mode detects it, and a receive completion can imply RTS. Fixing the state checks to be useful is *really hard*, so this patch just removes them (fewer branches in post path).

Signed-off-by: Fab Tillier <***@microsoft.com>

diff -dwup3 -x *svn* -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\user\hca\qp.c .\hw\mlx4\user\hca\qp.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\user\hca\qp.c Thu Mar 29 00:15:30 2012
+++ .\hw\mlx4\user\hca\qp.c Wed May 23 18:40:41 2012
@@ -230,14 +230,6 @@ mlx4_post_send(

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 @@ out:
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 @@ mlx4_post_recv(

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 @@ out:
*qp->db = htonl(qp->rq.head & 0xffff);
}

-err_state:
pthread_spin_unlock(&qp->rq.lock);

return status;

Loading...