]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/infiniband/hw/mthca/mthca_provider.c
IB: Add CQ comp_vector support
[mirror_ubuntu-jammy-kernel.git] / drivers / infiniband / hw / mthca / mthca_provider.c
index 7b96751695eac20deb60c8c60e13eb2032a0763f..1c05486c3c68b6171077b9f57fb345c2717403b5 100644 (file)
@@ -663,6 +663,7 @@ static int mthca_destroy_qp(struct ib_qp *qp)
 }
 
 static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
+                                    int comp_vector,
                                     struct ib_ucontext *context,
                                     struct ib_udata *udata)
 {
@@ -1015,6 +1016,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;
 
@@ -1040,6 +1042,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;
@@ -1047,14 +1051,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;
@@ -1292,8 +1293,8 @@ int mthca_register_device(struct mthca_dev *dev)
                (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
        dev->ib_dev.node_type            = RDMA_NODE_IB_CA;
        dev->ib_dev.phys_port_cnt        = dev->limits.num_ports;
+       dev->ib_dev.num_comp_vectors     = 1;
        dev->ib_dev.dma_device           = &dev->pdev->dev;
-       dev->ib_dev.class_dev.dev        = &dev->pdev->dev;
        dev->ib_dev.query_device         = mthca_query_device;
        dev->ib_dev.query_port           = mthca_query_port;
        dev->ib_dev.modify_device        = mthca_modify_device;