IB/mthca: Always fill MTTs from CPU
[linux-drm-fsl-dcu.git] / drivers / infiniband / hw / mthca / mthca_provider.c
index 265b1d1c4a62dde6a09ce185a2fb2910c101f254..0725ad7ad9bf7ca43b31f96609311bb2defbfea9 100644 (file)
@@ -124,7 +124,7 @@ static int mthca_query_device(struct ib_device *ibdev,
                props->max_map_per_fmr = 255;
        else
                props->max_map_per_fmr =
-                       (1 << (32 - long_log2(mdev->limits.num_mpts))) - 1;
+                       (1 << (32 - ilog2(mdev->limits.num_mpts))) - 1;
 
        err = 0;
  out:
@@ -179,6 +179,8 @@ static int mthca_query_port(struct ib_device *ibdev,
        props->max_mtu           = out_mad->data[41] & 0xf;
        props->active_mtu        = out_mad->data[36] >> 4;
        props->subnet_timeout    = out_mad->data[51] & 0x1f;
+       props->max_vl_num        = out_mad->data[37] >> 4;
+       props->init_type_reply   = out_mad->data[41] >> 4;
 
  out:
        kfree(in_mad);
@@ -814,7 +816,7 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
                lkey = ucmd.lkey;
        }
 
-       ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, long_log2(entries), &status);
+       ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, ilog2(entries), &status);
        if (status)
                ret = -EINVAL;
 
@@ -1013,6 +1015,7 @@ static struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
        int shift, n, len;
        int i, j, k;
        int err = 0;
+       int write_mtt_size;
 
        shift = ffs(region->page_size) - 1;
 
@@ -1038,6 +1041,8 @@ static struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
 
        i = n = 0;
 
+       write_mtt_size = min(mthca_write_mtt_size(dev), (int) (PAGE_SIZE / sizeof *pages));
+
        list_for_each_entry(chunk, &region->chunk_list, list)
                for (j = 0; j < chunk->nmap; ++j) {
                        len = sg_dma_len(&chunk->page_list[j]) >> shift;
@@ -1045,14 +1050,11 @@ static struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
                                pages[i++] = sg_dma_address(&chunk->page_list[j]) +
                                        region->page_size * k;
                                /*
-                                * Be friendly to WRITE_MTT command
-                                * and leave two empty slots for the
-                                * index and reserved fields of the
-                                * mailbox.
+                                * Be friendly to write_mtt and pass it chunks
+                                * of appropriate size.
                                 */
-                               if (i == PAGE_SIZE / sizeof (u64) - 2) {
-                                       err = mthca_write_mtt(dev, mr->mtt,
-                                                             n, pages, i);
+                               if (i == write_mtt_size) {
+                                       err = mthca_write_mtt(dev, mr->mtt, n, pages, i);
                                        if (err)
                                                goto mtt_done;
                                        n += i;
@@ -1288,7 +1290,7 @@ int mthca_register_device(struct mthca_dev *dev)
                (1ull << IB_USER_VERBS_CMD_DESTROY_QP)          |
                (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)        |
                (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
-       dev->ib_dev.node_type            = IB_NODE_CA;
+       dev->ib_dev.node_type            = RDMA_NODE_IB_CA;
        dev->ib_dev.phys_port_cnt        = dev->limits.num_ports;
        dev->ib_dev.dma_device           = &dev->pdev->dev;
        dev->ib_dev.class_dev.dev        = &dev->pdev->dev;