summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/sw/rdmavt/vt.c
diff options
context:
space:
mode:
authorDennis Dalessandro <dennis.dalessandro@intel.com>2016-01-06 10:03:31 -0800
committerDoug Ledford <dledford@redhat.com>2016-03-10 20:37:12 -0500
commit7b1e2099adc8e66f78fee2dd2f10cb8a11362083 (patch)
treeb8d9f6a0e16b47085d040db5a7fa8c33c080d27e /drivers/infiniband/sw/rdmavt/vt.c
parent0b8a8aae02abfbd724186cffe400fbdbf0cb41d6 (diff)
downloadtalos-obmc-linux-7b1e2099adc8e66f78fee2dd2f10cb8a11362083.tar.gz
talos-obmc-linux-7b1e2099adc8e66f78fee2dd2f10cb8a11362083.zip
IB/rdmavt: Move memory registration into rdmavt
Use the memory registration routines in hfi1 and move them to rdmavt. A follow on patch will address removing the duplicated code in the hfi1 and qib drivers. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw/rdmavt/vt.c')
-rw-r--r--drivers/infiniband/sw/rdmavt/vt.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index 2a13e361c808..516c810fad65 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -214,6 +214,8 @@ static int rvt_get_port_immutable(struct ib_device *ibdev, u8 port_num,
int rvt_register_device(struct rvt_dev_info *rdi)
{
/* Validate that drivers have provided the right information */
+ int ret = 0;
+
if (!rdi)
return -EINVAL;
@@ -262,6 +264,12 @@ int rvt_register_device(struct rvt_dev_info *rdi)
CHECK_DRIVER_OVERRIDE(rdi, detach_mcast);
/* Mem Region */
+ ret = rvt_driver_mr_init(rdi);
+ if (ret) {
+ rvt_pr_err(rdi, "Error in driver MR init.\n");
+ goto bail_no_mr;
+ }
+
CHECK_DRIVER_OVERRIDE(rdi, get_dma_mr);
CHECK_DRIVER_OVERRIDE(rdi, reg_user_mr);
CHECK_DRIVER_OVERRIDE(rdi, dereg_mr);
@@ -289,10 +297,21 @@ int rvt_register_device(struct rvt_dev_info *rdi)
spin_lock_init(&rdi->n_pds_lock);
rdi->n_pds_allocated = 0;
+ /* We are now good to announce we exist */
+ ret = ib_register_device(&rdi->ibdev, rdi->driver_f.port_callback);
+ if (ret) {
+ rvt_pr_err(rdi, "Failed to register driver with ib core.\n");
+ goto bail_mr;
+ }
+
rvt_pr_info(rdi, "Registration with rdmavt done.\n");
+ return ret;
- /* We are now good to announce we exist */
- return ib_register_device(&rdi->ibdev, rdi->driver_f.port_callback);
+bail_mr:
+ rvt_mr_exit(rdi);
+
+bail_no_mr:
+ return ret;
}
EXPORT_SYMBOL(rvt_register_device);
@@ -302,5 +321,6 @@ void rvt_unregister_device(struct rvt_dev_info *rdi)
return;
ib_unregister_device(&rdi->ibdev);
+ rvt_mr_exit(rdi);
}
EXPORT_SYMBOL(rvt_unregister_device);
OpenPOWER on IntegriCloud