IB/hfi1: Mask upper 16Bits of Extended LID prior to rvt_cq_entry
authorDon Hiatt <don.hiatt@intel.com>
Mon, 6 Nov 2017 14:39:22 +0000 (06:39 -0800)
committerDoug Ledford <dledford@redhat.com>
Mon, 13 Nov 2017 20:53:57 +0000 (15:53 -0500)
Pass only the lower 16Bits of an Extended LIDs to rvt_cq_entry
to avoid triggering a WARN_ON_ONCE during conversion there.
These upper 16Bits are okay to drop as they are obtained elsewhere.

Fixes: 62ede7779904 ("Add OPA extended LID support")
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/rc.c
drivers/infiniband/hw/hfi1/ruc.c
drivers/infiniband/hw/hfi1/uc.c
drivers/infiniband/hw/hfi1/ud.c

index 3f21b05..fd01a76 100644 (file)
@@ -2219,7 +2219,7 @@ send_last:
                        wc.opcode = IB_WC_RECV;
                wc.qp = &qp->ibqp;
                wc.src_qp = qp->remote_qpn;
-               wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr);
+               wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr) & U16_MAX;
                /*
                 * It seems that IB mandates the presence of an SL in a
                 * work completion only for the UD transport (see section
index d450d4d..1a3ed6e 100644 (file)
@@ -560,7 +560,7 @@ do_write:
        wc.byte_len = wqe->length;
        wc.qp = &qp->ibqp;
        wc.src_qp = qp->remote_qpn;
-       wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr);
+       wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr) & U16_MAX;
        wc.sl = rdma_ah_get_sl(&qp->remote_ah_attr);
        wc.port_num = 1;
        /* Signal completion event if the solicited bit is set. */
index fcd8186..1ee80a5 100644 (file)
@@ -462,7 +462,7 @@ last_imm:
                wc.status = IB_WC_SUCCESS;
                wc.qp = &qp->ibqp;
                wc.src_qp = qp->remote_qpn;
-               wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr);
+               wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr) & U16_MAX;
                /*
                 * It seems that IB mandates the presence of an SL in a
                 * work completion only for the UD transport (see section
index 84c7dbe..5260b27 100644 (file)
@@ -265,8 +265,8 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
        } else {
                wc.pkey_index = 0;
        }
-       wc.slid = ppd->lid | (rdma_ah_get_path_bits(ah_attr) &
-                                  ((1 << ppd->lmc) - 1));
+       wc.slid = (ppd->lid | (rdma_ah_get_path_bits(ah_attr) &
+                                  ((1 << ppd->lmc) - 1))) & U16_MAX;
        /* Check for loopback when the port lid is not set */
        if (wc.slid == 0 && sqp->ibqp.qp_type == IB_QPT_GSI)
                wc.slid = be16_to_cpu(IB_LID_PERMISSIVE);
@@ -1037,7 +1037,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
        }
        if (slid_is_permissive)
                slid = be32_to_cpu(OPA_LID_PERMISSIVE);
-       wc.slid = slid;
+       wc.slid = slid & U16_MAX;
        wc.sl = sl_from_sc;
 
        /*