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>
This commit is contained in:
Dennis Dalessandro
2016-01-06 10:03:31 -08:00
committed by Doug Ledford
parent 0b8a8aae02
commit 7b1e2099ad
4 changed files with 735 additions and 16 deletions

View File

@@ -391,6 +391,7 @@ struct rvt_driver_params {
* Anything driver specific that is not covered by props
* For instance special module parameters. Goes here.
*/
unsigned int lkey_table_size;
};
/*
@@ -416,6 +417,8 @@ struct rvt_pd {
};
struct rvt_dev_info {
struct ib_device ibdev; /* Keep this first. Nothing above here */
/*
* Prior to calling for registration the driver will be responsible for
* allocating space for this structure.
@@ -423,7 +426,6 @@ struct rvt_dev_info {
* The driver will also be responsible for filling in certain members of
* dparms.props
*/
struct ib_device ibdev;
/* Driver specific properties */
struct rvt_driver_params dparms;
@@ -453,7 +455,22 @@ static inline struct rvt_dev_info *ib_to_rvt(struct ib_device *ibdev)
return container_of(ibdev, struct rvt_dev_info, ibdev);
}
static inline void rvt_put_mr(struct rvt_mregion *mr)
{
if (unlikely(atomic_dec_and_test(&mr->refcount)))
complete(&mr->comp);
}
static inline void rvt_get_mr(struct rvt_mregion *mr)
{
atomic_inc(&mr->refcount);
}
int rvt_register_device(struct rvt_dev_info *rvd);
void rvt_unregister_device(struct rvt_dev_info *rvd);
int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge,
u32 len, u64 vaddr, u32 rkey, int acc);
int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd,
struct rvt_sge *isge, struct ib_sge *sge, int acc);
#endif /* DEF_RDMA_VT_H */