svn commit: r331009 - projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Mar 15 17:10:57 UTC 2018
Author: hselasky
Date: Thu Mar 15 17:10:56 2018
New Revision: 331009
URL: https://svnweb.freebsd.org/changeset/base/331009
Log:
Implement support for ib_reg_phys_mr() in ibcore.
Sponsored by: Mellanox Technologies
Modified:
projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs.h
projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs_compat.h
Modified: projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs.h
==============================================================================
--- projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs.h Thu Mar 15 16:37:43 2018 (r331008)
+++ projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs.h Thu Mar 15 17:10:56 2018 (r331009)
@@ -1317,6 +1317,11 @@ enum ib_access_flags {
IB_ACCESS_ON_DEMAND = (1<<6),
};
+struct ib_phys_buf {
+ u64 addr;
+ u64 size;
+};
+
/*
* XXX: these are apparently used for ->rereg_user_mr, no idea why they
* are hidden here instead of a uapi header!
@@ -1988,6 +1993,11 @@ struct ib_device {
int wc_cnt);
struct ib_mr * (*get_dma_mr)(struct ib_pd *pd,
int mr_access_flags);
+ struct ib_mr * (*reg_phys_mr)(struct ib_pd *pd,
+ struct ib_phys_buf *phys_buf_array,
+ int num_phys_buf,
+ int mr_access_flags,
+ u64 *iova_start);
struct ib_mr * (*reg_user_mr)(struct ib_pd *pd,
u64 start, u64 length,
u64 virt_addr,
Modified: projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs_compat.h
==============================================================================
--- projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs_compat.h Thu Mar 15 16:37:43 2018 (r331008)
+++ projects/bsd_rdma_4_9_stable_11/sys/ofed/include/rdma/ib_verbs_compat.h Thu Mar 15 17:10:56 2018 (r331009)
@@ -159,11 +159,6 @@ struct ib_mw_bind_info {
int mw_access_flags;
};
-struct ib_phys_buf {
- u64 addr;
- u64 size;
-};
-
struct ib_mr_attr {
struct ib_pd *pd;
u64 device_virt_addr;
@@ -391,7 +386,27 @@ ib_reg_phys_mr(struct ib_pd *pd,
int mr_access_flags,
u64 * iova_start)
{
- return (ERR_PTR(-ENOSYS));
+ struct ib_mr *mr;
+ int err;
+
+ err = ib_check_mr_access(mr_access_flags);
+ if (err)
+ return ERR_PTR(err);
+
+ if (!pd->device->reg_phys_mr)
+ return ERR_PTR(-ENOSYS);
+
+ mr = pd->device->reg_phys_mr(pd, phys_buf_array, num_phys_buf,
+ mr_access_flags, iova_start);
+ if (IS_ERR(mr))
+ return ERR_CAST(mr);
+
+ mr->device = pd->device;
+ mr->pd = pd;
+ mr->uobject = NULL;
+ atomic_inc(&pd->usecnt);
+
+ return (mr);
}
static inline int
More information about the svn-src-projects
mailing list