/* Remove the QP from the table so it can't be found asynchronously by the receive interrupt routine.  */
static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
/* Remove the QP from the table so it can't be found asynchronously by the receive interrupt routine.  */
static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
{
	struct ipath_qp *q, **qpp;
	unsigned long flags;
	spin_lock_irqsave(&qpt->lock, flags);
	qpp = &qpt->table[qp->ibqp.qp_num % qpt->max];
	for (; (q = *qpp) != NULL; qpp = &q->next) {
		if (q == qp) {
			*qpp = qp->next;
			qp->next = NULL;
			atomic_dec(&qp->refcount);
			break;
		}
	}
	spin_unlock_irqrestore(&qpt->lock, flags);
}