FreeBSD/contrib/ofed/libcxgb4/src/qp.c
/*
 * Assumes qhp lock is held.
 */
Assumes qhp lock is held.
Assumes qhp lock is held .
void c4iw_flush_qp(struct c4iw_qp *qhp)
{
	struct c4iw_cq *rchp, *schp;
	int count;
	if (qhp->wq.flushed)
		return;
	update_qp_state(qhp);
	rchp = to_c4iw_cq(qhp->ibv_qp.recv_cq);
	schp = to_c4iw_cq(qhp->ibv_qp.send_cq);
	PDBG("%s qhp %p rchp %p schp %p\n", __func__, qhp, rchp, schp);
	qhp->wq.flushed = 1;
	pthread_spin_unlock(&qhp->lock);
	pthread_spin_lock(&rchp->lock);
	pthread_spin_lock(&qhp->lock);
	c4iw_flush_hw_cq(rchp);
	c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
	c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
	pthread_spin_unlock(&qhp->lock);
	pthread_spin_unlock(&rchp->lock);
	pthread_spin_lock(&schp->lock);
	pthread_spin_lock(&qhp->lock);
	if (schp != rchp)
		c4iw_flush_hw_cq(schp);
	c4iw_flush_sq(qhp);
	pthread_spin_unlock(&qhp->lock);
	pthread_spin_unlock(&schp->lock);
	pthread_spin_lock(&qhp->lock);
}
void c4iw_flush_qp ( struct c4iw_qp * qhp ) { struct c4iw_cq * rchp , * schp ; int count ; if ( qhp -> wq . flushed ) return ; update_qp_state ( qhp ) ; rchp = to_c4iw_cq ( qhp -> ibv_qp . recv_cq ) ; schp = to_c4iw_cq ( qhp -> ibv_qp . send_cq ) ; PDBG ( " \n " , __func__ , qhp , rchp , schp ) ; qhp -> wq . flushed = 1 ; pthread_spin_unlock ( & qhp -> lock ) ; pthread_spin_lock ( & rchp -> lock ) ; pthread_spin_lock ( & qhp -> lock ) ; c4iw_flush_hw_cq ( rchp ) ; c4iw_count_rcqes ( & rchp -> cq , & qhp -> wq , & count ) ; c4iw_flush_rq ( & qhp -> wq , & rchp -> cq , count ) ; pthread_spin_unlock ( & qhp -> lock ) ; pthread_spin_unlock ( & rchp -> lock ) ; pthread_spin_lock ( & schp -> lock ) ; pthread_spin_lock ( & qhp -> lock ) ; if ( schp != rchp ) c4iw_flush_hw_cq ( schp ) ; c4iw_flush_sq ( qhp ) ; pthread_spin_unlock ( & qhp -> lock ) ; pthread_spin_unlock ( & schp -> lock ) ; pthread_spin_lock ( & qhp -> lock ) ; }
Assumes qhp lock is held.
Assumes qhp lock is held .
/* locking heirarchy: cq lock first, then qp lock. */ /* locking heirarchy: cq lock first, then qp lock. */