Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rdma / ipath / ipath_verbs.c
index 40f7f059f6b2efb6a3f040237da772e3490cf9e5..1778dee13f99269c51cc90f6c4d09a6f46a13a21 100644 (file)
@@ -374,7 +374,7 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
                    wr->opcode != IB_WR_SEND_WITH_IMM)
                        goto bail_inval;
                /* Check UD destination address PD */
-               if (qp->ibqp.pd != wr->wr.ud.ah->pd)
+               if (qp->ibqp.pd != ud_wr(wr)->ah->pd)
                        goto bail_inval;
        } else if ((unsigned) wr->opcode > IB_WR_ATOMIC_FETCH_AND_ADD)
                goto bail_inval;
@@ -395,7 +395,20 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
        }
 
        wqe = get_swqe_ptr(qp, qp->s_head);
-       wqe->wr = *wr;
+
+       if (qp->ibqp.qp_type != IB_QPT_UC &&
+           qp->ibqp.qp_type != IB_QPT_RC)
+               memcpy(&wqe->ud_wr, ud_wr(wr), sizeof(wqe->ud_wr));
+       else if (wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
+                wr->opcode == IB_WR_RDMA_WRITE ||
+                wr->opcode == IB_WR_RDMA_READ)
+               memcpy(&wqe->rdma_wr, rdma_wr(wr), sizeof(wqe->rdma_wr));
+       else if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP ||
+                wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD)
+               memcpy(&wqe->atomic_wr, atomic_wr(wr), sizeof(wqe->atomic_wr));
+       else
+               memcpy(&wqe->wr, wr, sizeof(wqe->wr));
+
        wqe->length = 0;
        if (wr->num_sge) {
                acc = wr->opcode >= IB_WR_RDMA_READ ?
@@ -1956,9 +1969,8 @@ static int enable_timer(struct ipath_devdata *dd)
                                 dd->ipath_gpio_mask);
        }
 
-       init_timer(&dd->verbs_timer);
-       dd->verbs_timer.function = __verbs_timer;
-       dd->verbs_timer.data = (unsigned long)dd;
+       setup_timer(&dd->verbs_timer, __verbs_timer, (unsigned long)dd);
+
        dd->verbs_timer.expires = jiffies + 1;
        add_timer(&dd->verbs_timer);
 
@@ -2025,8 +2037,8 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
        dev = &idev->ibdev;
 
        if (dd->ipath_sdma_descq_cnt) {
-               tx = kmalloc(dd->ipath_sdma_descq_cnt * sizeof *tx,
-                            GFP_KERNEL);
+               tx = kmalloc_array(dd->ipath_sdma_descq_cnt, sizeof *tx,
+                                  GFP_KERNEL);
                if (tx == NULL) {
                        ret = -ENOMEM;
                        goto err_tx;