diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-07-30 10:32:46 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-08-30 18:08:48 -0400 |
commit | e02e4d554d2b0c20b1f191c5d98bbf5da500a285 (patch) | |
tree | 12647b4e837be3894f8e8bcea2b2d734981e2448 /drivers/infiniband/hw/nes | |
parent | f683d3bdbb37baa49510e32789164e5d33d76ba1 (diff) |
nes: Support ib_alloc_mr verb
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/nes')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index fbc43e5f717b..44cb513f9a87 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -375,9 +375,11 @@ static int alloc_fast_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, } /* - * nes_alloc_fast_reg_mr + * nes_alloc_mr */ -static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list_len) +static struct ib_mr *nes_alloc_mr(struct ib_pd *ibpd, + enum ib_mr_type mr_type, + u32 max_num_sg) { struct nes_pd *nespd = to_nespd(ibpd); struct nes_vnic *nesvnic = to_nesvnic(ibpd->device); @@ -393,11 +395,18 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list u32 stag; int ret; struct ib_mr *ibmr; + + if (mr_type != IB_MR_TYPE_MEM_REG) + return ERR_PTR(-EINVAL); + + if (max_num_sg > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64))) + return ERR_PTR(-E2BIG); + /* * Note: Set to always use a fixed length single page entry PBL. This is to allow * for the fast_reg_mr operation to always know the size of the PBL. */ - if (max_page_list_len > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64))) + if (max_num_sg > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64))) return ERR_PTR(-E2BIG); get_random_bytes(&next_stag_index, sizeof(next_stag_index)); @@ -424,7 +433,7 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list nes_debug(NES_DBG_MR, "Allocating STag 0x%08X index = 0x%08X\n", stag, stag_index); - ret = alloc_fast_reg_mr(nesdev, nespd, stag, max_page_list_len); + ret = alloc_fast_reg_mr(nesdev, nespd, stag, max_num_sg); if (ret == 0) { nesmr->ibmr.rkey = stag; @@ -3929,7 +3938,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.dealloc_mw = nes_dealloc_mw; nesibdev->ibdev.bind_mw = nes_bind_mw; - nesibdev->ibdev.alloc_fast_reg_mr = nes_alloc_fast_reg_mr; + nesibdev->ibdev.alloc_mr = nes_alloc_mr; nesibdev->ibdev.alloc_fast_reg_page_list = nes_alloc_fast_reg_page_list; nesibdev->ibdev.free_fast_reg_page_list = nes_free_fast_reg_page_list; |