806 atomic_inc(&qhp->refcnt);
807 spin_unlock_irqrestore(&qhp->lock, *flag);
808
809
810 spin_lock_irqsave(&rchp->lock, *flag);
811 spin_lock(&qhp->lock);
812 cxio_flush_hw_cq(&rchp->cq);
813 cxio_count_rcqes(&rchp->cq, &qhp->wq, &count);
814 flushed = cxio_flush_rq(&qhp->wq, &rchp->cq, count);
815 spin_unlock(&qhp->lock);
816 spin_unlock_irqrestore(&rchp->lock, *flag);
817 if (flushed)
818 (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
819
820
821 spin_lock_irqsave(&schp->lock, *flag);
822 spin_lock(&qhp->lock);
823 cxio_flush_hw_cq(&schp->cq);
824 cxio_count_scqes(&schp->cq, &qhp->wq, &count);
825 flushed = cxio_flush_sq(&qhp->wq, &schp->cq, count);
826 spin_unlock(&qhp->lock);
827 spin_unlock_irqrestore(&schp->lock, *flag);
828 if (flushed)
829 (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);
830
831
832 if (atomic_dec_and_test(&qhp->refcnt))
833 wake_up(&qhp->wait);
834
835 spin_lock_irqsave(&qhp->lock, *flag);
836}
837
838static void flush_qp(struct iwch_qp *qhp, unsigned long *flag)
839{
840 if (qhp->ibqp.uobject)
841 cxio_set_wq_in_error(&qhp->wq);
842 else
843 __flush_qp(qhp, flag);
844}
845
846