/* The caller is responsible for decrementing the QP reference count when done.  */
struct ipath_qp* ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn)
/* The caller is responsible for decrementing the QP reference count when done.  */
struct ipath_qp* ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn)
{
	unsigned long flags;
	struct ipath_qp *qp;
	spin_lock_irqsave(&qpt->lock, flags);
	for (qp = qpt->table[qpn % qpt->max]; qp; qp = qp->next) {
		if (qp->ibqp.qp_num == qpn) {
			atomic_inc(&qp->refcount);
			break;
		}
	}
	spin_unlock_irqrestore(&qpt->lock, flags);
	return qp;
}