RDMA/core: Add an integrity MR pool support
authorIsrael Rukshin <israelr@mellanox.com>
Tue, 11 Jun 2019 15:52:49 +0000 (18:52 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 24 Jun 2019 14:49:27 +0000 (11:49 -0300)
This is a preparation for adding new signature API to the rw-API.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/mr_pool.c
drivers/infiniband/core/rw.c
drivers/nvme/host/rdma.c
include/rdma/mr_pool.h

index 49d478b2ea94bfddbe2bfaa730d1ff69b774061d..132ff92626e14bd7cb0a20bd702f84e6784f9542 100644 (file)
@@ -42,14 +42,18 @@ void ib_mr_pool_put(struct ib_qp *qp, struct list_head *list, struct ib_mr *mr)
 EXPORT_SYMBOL(ib_mr_pool_put);
 
 int ib_mr_pool_init(struct ib_qp *qp, struct list_head *list, int nr,
-               enum ib_mr_type type, u32 max_num_sg)
+               enum ib_mr_type type, u32 max_num_sg, u32 max_num_meta_sg)
 {
        struct ib_mr *mr;
        unsigned long flags;
        int ret, i;
 
        for (i = 0; i < nr; i++) {
-               mr = ib_alloc_mr(qp->pd, type, max_num_sg);
+               if (type == IB_MR_TYPE_INTEGRITY)
+                       mr = ib_alloc_mr_integrity(qp->pd, max_num_sg,
+                                                  max_num_meta_sg);
+               else
+                       mr = ib_alloc_mr(qp->pd, type, max_num_sg);
                if (IS_ERR(mr)) {
                        ret = PTR_ERR(mr);
                        goto out;
index acf9ea625811589c015fd9fc74b77d926ddd8097..f825990bacfa2e96374b8221414afabb53c3ad7d 100644 (file)
@@ -719,7 +719,7 @@ int rdma_rw_init_mrs(struct ib_qp *qp, struct ib_qp_init_attr *attr)
        if (nr_mrs) {
                ret = ib_mr_pool_init(qp, &qp->rdma_mrs, nr_mrs,
                                IB_MR_TYPE_MEM_REG,
-                               rdma_rw_fr_page_list_len(dev));
+                               rdma_rw_fr_page_list_len(dev), 0);
                if (ret) {
                        pr_err("%s: failed to allocated %d MRs\n",
                                __func__, nr_mrs);
@@ -729,7 +729,7 @@ int rdma_rw_init_mrs(struct ib_qp *qp, struct ib_qp_init_attr *attr)
 
        if (nr_sig_mrs) {
                ret = ib_mr_pool_init(qp, &qp->sig_mrs, nr_sig_mrs,
-                               IB_MR_TYPE_SIGNATURE, 2);
+                               IB_MR_TYPE_SIGNATURE, 2, 0);
                if (ret) {
                        pr_err("%s: failed to allocated %d SIG MRs\n",
                                __func__, nr_sig_mrs);
index f383146e7d0fdfa40edb4e3671f1c208c082223c..0e033b621daf24cbf95c8b885558abebd54e19f7 100644 (file)
@@ -486,7 +486,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue)
        ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs,
                              queue->queue_size,
                              IB_MR_TYPE_MEM_REG,
-                             nvme_rdma_get_max_fr_pages(ibdev));
+                             nvme_rdma_get_max_fr_pages(ibdev), 0);
        if (ret) {
                dev_err(queue->ctrl->ctrl.device,
                        "failed to initialize MR pool sized %d for QID %d\n",
index 986010b812eb07b048cefb49d1157b947fd72ce2..2c042e6046d17429d80ba210c60a5bffedbe8efb 100644 (file)
@@ -19,7 +19,7 @@ struct ib_mr *ib_mr_pool_get(struct ib_qp *qp, struct list_head *list);
 void ib_mr_pool_put(struct ib_qp *qp, struct list_head *list, struct ib_mr *mr);
 
 int ib_mr_pool_init(struct ib_qp *qp, struct list_head *list, int nr,
-               enum ib_mr_type type, u32 max_num_sg);
+               enum ib_mr_type type, u32 max_num_sg, u32 max_num_meta_sg);
 void ib_mr_pool_destroy(struct ib_qp *qp, struct list_head *list);
 
 #endif /* _RDMA_MR_POOL_H */