diff options
author | Dennis Dalessandro <dennis.dalessandro@intel.com> | 2016-01-06 10:01:42 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-03-10 20:37:10 -0500 |
commit | b92a7568037e2a28f61c3f79c2320431bb24dfab (patch) | |
tree | 3e7646e5c2e1be219e46b101be4427fd4b4f8e50 /include/rdma | |
parent | 8cf4020b2ad0d19f74fed043b882da1b79f52566 (diff) |
IB/rdmavt: Move MR datastructures into rvt
This patch adds the MR datastructures based on hfi1 into rvt. For now the
data structures are defined in include/rdma/rdma_vt.h but once all MR
functionality has been moved from the drivers into rvt these should move to
rdmavt/mr.h
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dean Luick <dean.luick@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 'include/rdma')
-rw-r--r-- | include/rdma/rdma_vt.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h index bf072a436a34..f232e39a5d69 100644 --- a/include/rdma/rdma_vt.h +++ b/include/rdma/rdma_vt.h @@ -56,6 +56,56 @@ #include "ib_verbs.h" /* + * For Memory Regions. This stuff should probably be moved into rdmavt/mr.h once + * drivers no longer need access to the MR directly. + */ + +/* + * A segment is a linear region of low physical memory. + * Used by the verbs layer. + */ +struct rvt_seg { + void *vaddr; + size_t length; +}; + +/* The number of rvt_segs that fit in a page. */ +#define RVT_SEGSZ (PAGE_SIZE / sizeof(struct rvt_seg)) + +struct rvt_segarray { + struct rvt_seg segs[RVT_SEGSZ]; +}; + +struct rvt_mregion { + struct ib_pd *pd; /* shares refcnt of ibmr.pd */ + u64 user_base; /* User's address for this region */ + u64 iova; /* IB start address of this region */ + size_t length; + u32 lkey; + u32 offset; /* offset (bytes) to start of region */ + int access_flags; + u32 max_segs; /* number of rvt_segs in all the arrays */ + u32 mapsz; /* size of the map array */ + u8 page_shift; /* 0 - non unform/non powerof2 sizes */ + u8 lkey_published; /* in global table */ + struct completion comp; /* complete when refcount goes to zero */ + atomic_t refcount; + struct rvt_segarray *map[0]; /* the segments */ +}; + +#define RVT_MAX_LKEY_TABLE_BITS 23 + +struct rvt_lkey_table { + spinlock_t lock; /* protect changes in this struct */ + u32 next; /* next unused index (speeds search) */ + u32 gen; /* generation count */ + u32 max; /* size of the table */ + struct rvt_mregion __rcu **table; +}; + +/* End Memmory Region */ + +/* * Things that are driver specific, module parameters in hfi1 and qib */ struct rvt_driver_params { @@ -119,6 +169,9 @@ struct rvt_dev_info { /* Driver specific properties */ struct rvt_driver_params dparms; + struct rvt_mregion __rcu *dma_mr; + struct rvt_lkey_table lkey_table; + /* PKey Table goes here */ /* |