RDMA/qedr: Don't reset QP when queues aren't flushed
authorRam Amrani <Ram.Amrani@Cavium.com>
Tue, 24 Jan 2017 11:50:38 +0000 (13:50 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 24 Jan 2017 20:34:55 +0000 (15:34 -0500)
Fail QP state transition from error to reset if SQ/RQ are not empty
and still in the process of flushing out the queued work entries.

Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/qedr/verbs.c

index 0688dce54f925e797f5758ecd38cfb94fcd9a264..3dae9641f8210188b218bf2fc3390b526fe389f4 100644 (file)
@@ -1733,6 +1733,14 @@ static int qedr_update_qp_state(struct qedr_dev *dev,
                /* ERR->XXX */
                switch (new_state) {
                case QED_ROCE_QP_STATE_RESET:
+                       if ((qp->rq.prod != qp->rq.cons) ||
+                           (qp->sq.prod != qp->sq.cons)) {
+                               DP_NOTICE(dev,
+                                         "Error->Reset with rq/sq not empty rq.prod=%x rq.cons=%x sq.prod=%x sq.cons=%x\n",
+                                         qp->rq.prod, qp->rq.cons, qp->sq.prod,
+                                         qp->sq.cons);
+                               status = -EINVAL;
+                       }
                        break;
                default:
                        status = -EINVAL;