Merge branch 'hid-suspend' into picolcd
[pandora-kernel.git] / drivers / infiniband / hw / mlx4 / cq.c
index 1830849..cc2ddd2 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <linux/mlx4/cq.h>
 #include <linux/mlx4/qp.h>
+#include <linux/slab.h>
 
 #include "mlx4_ib.h"
 #include "user.h"
@@ -222,7 +223,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector
        }
 
        err = mlx4_cq_alloc(dev->dev, entries, &cq->buf.mtt, uar,
-                           cq->db.dma, &cq->mcq, 0);
+                           cq->db.dma, &cq->mcq, vector, 0);
        if (err)
                goto err_dbmap;
 
@@ -325,15 +326,17 @@ static int mlx4_ib_get_outstanding_cqes(struct mlx4_ib_cq *cq)
 
 static void mlx4_ib_cq_resize_copy_cqes(struct mlx4_ib_cq *cq)
 {
-       struct mlx4_cqe *cqe;
+       struct mlx4_cqe *cqe, *new_cqe;
        int i;
 
        i = cq->mcq.cons_index;
        cqe = get_cqe(cq, i & cq->ibcq.cqe);
        while ((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) != MLX4_CQE_OPCODE_RESIZE) {
-               memcpy(get_cqe_from_buf(&cq->resize_buf->buf,
-                                       (i + 1) & cq->resize_buf->cqe),
-                       get_cqe(cq, i & cq->ibcq.cqe), sizeof(struct mlx4_cqe));
+               new_cqe = get_cqe_from_buf(&cq->resize_buf->buf,
+                                          (i + 1) & cq->resize_buf->cqe);
+               memcpy(new_cqe, get_cqe(cq, i & cq->ibcq.cqe), sizeof(struct mlx4_cqe));
+               new_cqe->owner_sr_opcode = (cqe->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK) |
+                       (((i + 1) & (cq->resize_buf->cqe + 1)) ? MLX4_CQE_OWNER_MASK : 0);
                cqe = get_cqe(cq, ++i & cq->ibcq.cqe);
        }
        ++cq->mcq.cons_index;
@@ -365,7 +368,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
                if (err)
                        goto out;
        } else {
-               /* Can't be smaller then the number of outstanding CQEs */
+               /* Can't be smaller than the number of outstanding CQEs */
                outst_cqe = mlx4_ib_get_outstanding_cqes(cq);
                if (entries < outst_cqe + 1) {
                        err = 0;
@@ -697,7 +700,7 @@ repoll:
                }
 
                wc->slid           = be16_to_cpu(cqe->rlid);
-               wc->sl             = be16_to_cpu(cqe->sl_vid >> 12);
+               wc->sl             = be16_to_cpu(cqe->sl_vid) >> 12;
                g_mlpath_rqpn      = be32_to_cpu(cqe->g_mlpath_rqpn);
                wc->src_qp         = g_mlpath_rqpn & 0xffffff;
                wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;