Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 856b5925 authored by Steve Wise's avatar Steve Wise Committed by Roland Dreier
Browse files

RDMA/cxgb3: Flush the receive queue when closing



- for kernel mode cqs, call event notification handler when flushing.
- flush QP when moving from RTS -> CLOSING.
- fix logic to identify a kernel mode qp.

Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 4e1e93a4
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -642,6 +642,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag)
	cxio_flush_rq(&qhp->wq, &rchp->cq, count);
	cxio_flush_rq(&qhp->wq, &rchp->cq, count);
	spin_unlock(&qhp->lock);
	spin_unlock(&qhp->lock);
	spin_unlock_irqrestore(&rchp->lock, *flag);
	spin_unlock_irqrestore(&rchp->lock, *flag);
	(*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);


	/* locking heirarchy: cq lock first, then qp lock. */
	/* locking heirarchy: cq lock first, then qp lock. */
	spin_lock_irqsave(&schp->lock, *flag);
	spin_lock_irqsave(&schp->lock, *flag);
@@ -651,6 +652,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag)
	cxio_flush_sq(&qhp->wq, &schp->cq, count);
	cxio_flush_sq(&qhp->wq, &schp->cq, count);
	spin_unlock(&qhp->lock);
	spin_unlock(&qhp->lock);
	spin_unlock_irqrestore(&schp->lock, *flag);
	spin_unlock_irqrestore(&schp->lock, *flag);
	(*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);


	/* deref */
	/* deref */
	if (atomic_dec_and_test(&qhp->refcnt))
	if (atomic_dec_and_test(&qhp->refcnt))
@@ -661,7 +663,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag)


static void flush_qp(struct iwch_qp *qhp, unsigned long *flag)
static void flush_qp(struct iwch_qp *qhp, unsigned long *flag)
{
{
	if (t3b_device(qhp->rhp))
	if (qhp->ibqp.uobject)
		cxio_set_wq_in_error(&qhp->wq);
		cxio_set_wq_in_error(&qhp->wq);
	else
	else
		__flush_qp(qhp, flag);
		__flush_qp(qhp, flag);
@@ -830,10 +832,11 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp,
				disconnect = 1;
				disconnect = 1;
				ep = qhp->ep;
				ep = qhp->ep;
			}
			}
			flush_qp(qhp, &flag);
			break;
			break;
		case IWCH_QP_STATE_TERMINATE:
		case IWCH_QP_STATE_TERMINATE:
			qhp->attr.state = IWCH_QP_STATE_TERMINATE;
			qhp->attr.state = IWCH_QP_STATE_TERMINATE;
			if (t3b_device(qhp->rhp))
			if (qhp->ibqp.uobject)
				cxio_set_wq_in_error(&qhp->wq);
				cxio_set_wq_in_error(&qhp->wq);
			if (!internal)
			if (!internal)
				terminate = 1;
				terminate = 1;