IB: Modify ib_create_mr API
Use ib_alloc_mr with specific parameters. Change the existing callers. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:

committed by
Doug Ledford

parent
8b91ffc1cf
commit
9bee178b4f
@@ -1235,15 +1235,32 @@ int ib_dereg_mr(struct ib_mr *mr)
|
||||
}
|
||||
EXPORT_SYMBOL(ib_dereg_mr);
|
||||
|
||||
struct ib_mr *ib_create_mr(struct ib_pd *pd,
|
||||
struct ib_mr_init_attr *mr_init_attr)
|
||||
/**
|
||||
* ib_alloc_mr() - Allocates a memory region
|
||||
* @pd: protection domain associated with the region
|
||||
* @mr_type: memory region type
|
||||
* @max_num_sg: maximum sg entries available for registration.
|
||||
*
|
||||
* Notes:
|
||||
* Memory registeration page/sg lists must not exceed max_num_sg.
|
||||
* For mr_type IB_MR_TYPE_MEM_REG, the total length cannot exceed
|
||||
* max_num_sg * used_page_size.
|
||||
*
|
||||
*/
|
||||
struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
|
||||
enum ib_mr_type mr_type,
|
||||
u32 max_num_sg)
|
||||
{
|
||||
struct ib_mr *mr;
|
||||
|
||||
if (!pd->device->create_mr)
|
||||
return ERR_PTR(-ENOSYS);
|
||||
|
||||
mr = pd->device->create_mr(pd, mr_init_attr);
|
||||
if (pd->device->alloc_mr) {
|
||||
mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
|
||||
} else {
|
||||
if (mr_type != IB_MR_TYPE_MEM_REG ||
|
||||
!pd->device->alloc_fast_reg_mr)
|
||||
return ERR_PTR(-ENOSYS);
|
||||
mr = pd->device->alloc_fast_reg_mr(pd, max_num_sg);
|
||||
}
|
||||
|
||||
if (!IS_ERR(mr)) {
|
||||
mr->device = pd->device;
|
||||
@@ -1255,7 +1272,7 @@ struct ib_mr *ib_create_mr(struct ib_pd *pd,
|
||||
|
||||
return mr;
|
||||
}
|
||||
EXPORT_SYMBOL(ib_create_mr);
|
||||
EXPORT_SYMBOL(ib_alloc_mr);
|
||||
|
||||
struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
|
||||
{
|
||||
|
Reference in New Issue
Block a user