IB/qib: Fix QP check when looping back to/from QP1
authorIra Weiny <ira.weiny@intel.com>
Wed, 18 Dec 2013 16:41:37 +0000 (08:41 -0800)
committerRoland Dreier <roland@purestorage.com>
Thu, 23 Jan 2014 07:16:47 +0000 (23:16 -0800)
The GSI QP type is compatible with and should be allowed to send data
to/from any UD QP.  This was found when testing ibacm on the same node
as an SA.

Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_ud.c

index d6c7fe7f88d5ecd8b133e892e2f31e7f87bc74fb..3ad651c3356ca39aaa8d662a576b94be2848a9ff 100644 (file)
@@ -57,13 +57,20 @@ static void qib_ud_loopback(struct qib_qp *sqp, struct qib_swqe *swqe)
        struct qib_sge *sge;
        struct ib_wc wc;
        u32 length;
+       enum ib_qp_type sqptype, dqptype;
 
        qp = qib_lookup_qpn(ibp, swqe->wr.wr.ud.remote_qpn);
        if (!qp) {
                ibp->n_pkt_drops++;
                return;
        }
-       if (qp->ibqp.qp_type != sqp->ibqp.qp_type ||
+
+       sqptype = sqp->ibqp.qp_type == IB_QPT_GSI ?
+                       IB_QPT_UD : sqp->ibqp.qp_type;
+       dqptype = qp->ibqp.qp_type == IB_QPT_GSI ?
+                       IB_QPT_UD : qp->ibqp.qp_type;
+
+       if (dqptype != sqptype ||
            !(ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK)) {
                ibp->n_pkt_drops++;
                goto drop;