nes: Support ib_alloc_mr verb
Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
f683d3bdbb
commit
e02e4d554d
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user