RDMA/rxe: Add elem_offset field to rxe_type_info
The rxe verbs objects each include an rdma-core object 'ib_xxx' and a rxe_pool_entry 'pelem' in addition to rxe specific data. Originally these all had pelem first and ib_xxx second. Currently about half have ib_xxx first and half have pelem first. Saving the offset of the pelem field in rxe_type info will enable making the rxe_pool APIs type safe as the pelem field continues to vary. Link: https://lore.kernel.org/r/20201216231550.27224-4-rpearson@hpe.com Signed-off-by: Bob Pearson <rpearson@hpe.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
c06ee3a014
commit
b994d49ef4
@ -15,21 +15,25 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_UC] = {
|
||||
.name = "rxe-uc",
|
||||
.size = sizeof(struct rxe_ucontext),
|
||||
.elem_offset = offsetof(struct rxe_ucontext, pelem),
|
||||
.flags = RXE_POOL_NO_ALLOC,
|
||||
},
|
||||
[RXE_TYPE_PD] = {
|
||||
.name = "rxe-pd",
|
||||
.size = sizeof(struct rxe_pd),
|
||||
.elem_offset = offsetof(struct rxe_pd, pelem),
|
||||
.flags = RXE_POOL_NO_ALLOC,
|
||||
},
|
||||
[RXE_TYPE_AH] = {
|
||||
.name = "rxe-ah",
|
||||
.size = sizeof(struct rxe_ah),
|
||||
.elem_offset = offsetof(struct rxe_ah, pelem),
|
||||
.flags = RXE_POOL_NO_ALLOC,
|
||||
},
|
||||
[RXE_TYPE_SRQ] = {
|
||||
.name = "rxe-srq",
|
||||
.size = sizeof(struct rxe_srq),
|
||||
.elem_offset = offsetof(struct rxe_srq, pelem),
|
||||
.flags = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC,
|
||||
.min_index = RXE_MIN_SRQ_INDEX,
|
||||
.max_index = RXE_MAX_SRQ_INDEX,
|
||||
@ -37,6 +41,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_QP] = {
|
||||
.name = "rxe-qp",
|
||||
.size = sizeof(struct rxe_qp),
|
||||
.elem_offset = offsetof(struct rxe_qp, pelem),
|
||||
.cleanup = rxe_qp_cleanup,
|
||||
.flags = RXE_POOL_INDEX,
|
||||
.min_index = RXE_MIN_QP_INDEX,
|
||||
@ -45,12 +50,14 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_CQ] = {
|
||||
.name = "rxe-cq",
|
||||
.size = sizeof(struct rxe_cq),
|
||||
.elem_offset = offsetof(struct rxe_cq, pelem),
|
||||
.flags = RXE_POOL_NO_ALLOC,
|
||||
.cleanup = rxe_cq_cleanup,
|
||||
},
|
||||
[RXE_TYPE_MR] = {
|
||||
.name = "rxe-mr",
|
||||
.size = sizeof(struct rxe_mem),
|
||||
.elem_offset = offsetof(struct rxe_mem, pelem),
|
||||
.cleanup = rxe_mem_cleanup,
|
||||
.flags = RXE_POOL_INDEX,
|
||||
.max_index = RXE_MAX_MR_INDEX,
|
||||
@ -59,6 +66,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_MW] = {
|
||||
.name = "rxe-mw",
|
||||
.size = sizeof(struct rxe_mem),
|
||||
.elem_offset = offsetof(struct rxe_mem, pelem),
|
||||
.flags = RXE_POOL_INDEX,
|
||||
.max_index = RXE_MAX_MW_INDEX,
|
||||
.min_index = RXE_MIN_MW_INDEX,
|
||||
@ -66,6 +74,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_MC_GRP] = {
|
||||
.name = "rxe-mc_grp",
|
||||
.size = sizeof(struct rxe_mc_grp),
|
||||
.elem_offset = offsetof(struct rxe_mc_grp, pelem),
|
||||
.cleanup = rxe_mc_cleanup,
|
||||
.flags = RXE_POOL_KEY,
|
||||
.key_offset = offsetof(struct rxe_mc_grp, mgid),
|
||||
@ -74,6 +83,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_MC_ELEM] = {
|
||||
.name = "rxe-mc_elem",
|
||||
.size = sizeof(struct rxe_mc_elem),
|
||||
.elem_offset = offsetof(struct rxe_mc_elem, pelem),
|
||||
.flags = RXE_POOL_ATOMIC,
|
||||
},
|
||||
};
|
||||
|
@ -36,6 +36,7 @@ struct rxe_pool_entry;
|
||||
struct rxe_type_info {
|
||||
const char *name;
|
||||
size_t size;
|
||||
size_t elem_offset;
|
||||
void (*cleanup)(struct rxe_pool_entry *obj);
|
||||
enum rxe_pool_flags flags;
|
||||
u32 max_index;
|
||||
|
Loading…
Reference in New Issue
Block a user