@@ -327,6 +327,29 @@ out:
*
* Return the memory region on success, otherwise return an errno.
*/
+struct ib_mr *qib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_entries,
+ u32 flags)
+{
+ struct qib_mr *mr;
+
+ if (mr_type != IB_MR_TYPE_FAST_REG || flags)
+ return ERR_PTR(-EINVAL);
+
+ mr = alloc_mr(max_entries, pd);
+ if (IS_ERR(mr))
+ return (struct ib_mr *)mr;
+
+ return &mr->ibmr;
+}
+
+/*
+ * Allocate a memory region usable with the
+ * IB_WR_FAST_REG_MR send work request.
+ *
+ * Return the memory region on success, otherwise return an errno.
+ */
struct ib_mr *qib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
{
struct qib_mr *mr;
@@ -2235,6 +2235,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
ibdev->reg_phys_mr = qib_reg_phys_mr;
ibdev->reg_user_mr = qib_reg_user_mr;
ibdev->dereg_mr = qib_dereg_mr;
+ ibdev->alloc_mr = qib_alloc_mr;
ibdev->alloc_fast_reg_mr = qib_alloc_fast_reg_mr;
ibdev->alloc_fast_reg_page_list = qib_alloc_fast_reg_page_list;
ibdev->free_fast_reg_page_list = qib_free_fast_reg_page_list;
@@ -1032,6 +1032,11 @@ struct ib_mr *qib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
int qib_dereg_mr(struct ib_mr *ibmr);
+struct ib_mr *qib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_entries,
+ u32 flags);
+
struct ib_mr *qib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len);
struct ib_fast_reg_page_list *qib_alloc_fast_reg_page_list(
Signed-off-by: Sagi Grimberg <sagig@mellanox.com> --- drivers/infiniband/hw/qib/qib_mr.c | 23 +++++++++++++++++++++++ drivers/infiniband/hw/qib/qib_verbs.c | 1 + drivers/infiniband/hw/qib/qib_verbs.h | 5 +++++ 3 files changed, 29 insertions(+)