FreeBSD/sys/dev/cxgbe/iw_cxgbe/qp.c
/* Assumes qhp lock is held. */
Assumes qhp lock is held.
Assumes qhp lock is held .
static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
		       struct c4iw_cq *schp)
{
	int count;
	int flushed;
	unsigned long flag;
	CTR4(KTR_IW_CXGBE, "%s qhp %p rchp %p schp %p", __func__, qhp, rchp,
	    schp);
	spin_lock_irqsave(&rchp->lock, flag);
	spin_lock(&qhp->lock);
	c4iw_flush_hw_cq(&rchp->cq);
	c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
	flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
	spin_unlock(&qhp->lock);
	spin_unlock_irqrestore(&rchp->lock, flag);
	if (flushed && rchp->ibcq.comp_handler) {
		spin_lock_irqsave(&rchp->comp_handler_lock, flag);
		(*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
		spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
	}
	spin_lock_irqsave(&schp->lock, flag);
	spin_lock(&qhp->lock);
	c4iw_flush_hw_cq(&schp->cq);
	c4iw_count_scqes(&schp->cq, &qhp->wq, &count);
	flushed = c4iw_flush_sq(&qhp->wq, &schp->cq, count);
	spin_unlock(&qhp->lock);
	spin_unlock_irqrestore(&schp->lock, flag);
	if (flushed && schp->ibcq.comp_handler) {
		spin_lock_irqsave(&schp->comp_handler_lock, flag);
		(*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);
		spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
	}
}
static void __flush_qp ( struct c4iw_qp * qhp , struct c4iw_cq * rchp , struct c4iw_cq * schp ) { int count ; int flushed ; unsigned long flag ; CTR4 ( KTR_IW_CXGBE , " " , __func__ , qhp , rchp , schp ) ; spin_lock_irqsave ( & rchp -> lock , flag ) ; spin_lock ( & qhp -> lock ) ; c4iw_flush_hw_cq ( & rchp -> cq ) ; c4iw_count_rcqes ( & rchp -> cq , & qhp -> wq , & count ) ; flushed = c4iw_flush_rq ( & qhp -> wq , & rchp -> cq , count ) ; spin_unlock ( & qhp -> lock ) ; spin_unlock_irqrestore ( & rchp -> lock , flag ) ; if ( flushed && rchp -> ibcq . comp_handler ) { spin_lock_irqsave ( & rchp -> comp_handler_lock , flag ) ; ( * rchp -> ibcq . comp_handler ) ( & rchp -> ibcq , rchp -> ibcq . cq_context ) ; spin_unlock_irqrestore ( & rchp -> comp_handler_lock , flag ) ; } spin_lock_irqsave ( & schp -> lock , flag ) ; spin_lock ( & qhp -> lock ) ; c4iw_flush_hw_cq ( & schp -> cq ) ; c4iw_count_scqes ( & schp -> cq , & qhp -> wq , & count ) ; flushed = c4iw_flush_sq ( & qhp -> wq , & schp -> cq , count ) ; spin_unlock ( & qhp -> lock ) ; spin_unlock_irqrestore ( & schp -> lock , flag ) ; if ( flushed && schp -> ibcq . comp_handler ) { spin_lock_irqsave ( & schp -> comp_handler_lock , flag ) ; ( * schp -> ibcq . comp_handler ) ( & schp -> ibcq , schp -> ibcq . cq_context ) ; spin_unlock_irqrestore ( & schp -> comp_handler_lock , flag ) ; } }
Assumes qhp lock is held.
Assumes qhp lock is held .
/* locking hierarchy: cq lock first, then qp lock. */ /* locking hierarchy: cq lock first, then qp lock. */