IB/qib, IB/hfi1: Fix grh creation in ud loopback
authorDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Mon, 25 Jul 2016 20:40:40 +0000 (13:40 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 2 Aug 2016 20:00:58 +0000 (16:00 -0400)
Instead of copying the actual GRH of type struct ib_grh, existing code
copies the struct ib_global_route into the sge. This patch fixes that
and constructs the actual GRH from ib_global_route and copies the GRH
into the sge.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@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/ud.c
drivers/infiniband/hw/qib/qib_ud.c

index 852c20f5498c6851a28da574ee49f0e97de02a72..f01e8e1d62d3d14d6c6d543630da9e9128695738 100644 (file)
@@ -184,8 +184,12 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
        }
 
        if (ah_attr->ah_flags & IB_AH_GRH) {
-               hfi1_copy_sge(&qp->r_sge, &ah_attr->grh,
-                             sizeof(struct ib_grh), 1, 0);
+               struct ib_grh grh;
+               struct ib_global_route grd = ah_attr->grh;
+
+               hfi1_make_grh(ibp, &grh, &grd, 0, 0);
+               hfi1_copy_sge(&qp->r_sge, &grh,
+                             sizeof(grh), 1, 0);
                wc.wc_flags |= IB_WC_GRH;
        } else {
                hfi1_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1);
index 846e6c726df7c67204f1dc1d5f1bfb066c36e149..10d062561bd96f49617a754d26873353b39d78a4 100644 (file)
@@ -169,8 +169,12 @@ static void qib_ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
        }
 
        if (ah_attr->ah_flags & IB_AH_GRH) {
-               qib_copy_sge(&qp->r_sge, &ah_attr->grh,
-                            sizeof(struct ib_grh), 1);
+               struct ib_grh grh;
+               struct ib_global_route grd = ah_attr->grh;
+
+               qib_make_grh(ibp, &grh, &grd, 0, 0);
+               qib_copy_sge(&qp->r_sge, &grh,
+                            sizeof(grh), 1);
                wc.wc_flags |= IB_WC_GRH;
        } else
                qib_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1);