RDMA: Handle ucontext allocations by IB/core
Following the PD conversion patch, do the same for ucontext allocations. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
afc1990e08
commit
a2a074ef39
@@ -42,6 +42,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
|
||||
[RXE_TYPE_UC] = {
|
||||
.name = "rxe-uc",
|
||||
.size = sizeof(struct rxe_ucontext),
|
||||
.flags = RXE_POOL_NO_ALLOC,
|
||||
},
|
||||
[RXE_TYPE_PD] = {
|
||||
.name = "rxe-pd",
|
||||
|
@@ -142,22 +142,19 @@ static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
|
||||
return rxe_link_layer(rxe, port_num);
|
||||
}
|
||||
|
||||
static struct ib_ucontext *rxe_alloc_ucontext(struct ib_device *dev,
|
||||
struct ib_udata *udata)
|
||||
static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
|
||||
{
|
||||
struct rxe_dev *rxe = to_rdev(dev);
|
||||
struct rxe_ucontext *uc;
|
||||
struct rxe_dev *rxe = to_rdev(uctx->device);
|
||||
struct rxe_ucontext *uc = to_ruc(uctx);
|
||||
|
||||
uc = rxe_alloc(&rxe->uc_pool);
|
||||
return uc ? &uc->ibuc : ERR_PTR(-ENOMEM);
|
||||
return rxe_add_to_pool(&rxe->uc_pool, &uc->pelem);
|
||||
}
|
||||
|
||||
static int rxe_dealloc_ucontext(struct ib_ucontext *ibuc)
|
||||
static void rxe_dealloc_ucontext(struct ib_ucontext *ibuc)
|
||||
{
|
||||
struct rxe_ucontext *uc = to_ruc(ibuc);
|
||||
|
||||
rxe_drop_ref(uc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rxe_port_immutable(struct ib_device *dev, u8 port_num,
|
||||
@@ -1180,6 +1177,7 @@ static const struct ib_device_ops rxe_dev_ops = {
|
||||
.req_notify_cq = rxe_req_notify_cq,
|
||||
.resize_cq = rxe_resize_cq,
|
||||
INIT_RDMA_OBJ_SIZE(ib_pd, rxe_pd, ibpd),
|
||||
INIT_RDMA_OBJ_SIZE(ib_ucontext, rxe_ucontext, ibuc),
|
||||
};
|
||||
|
||||
int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
|
||||
|
@@ -61,8 +61,8 @@ static inline int psn_compare(u32 psn_a, u32 psn_b)
|
||||
}
|
||||
|
||||
struct rxe_ucontext {
|
||||
struct ib_ucontext ibuc;
|
||||
struct rxe_pool_entry pelem;
|
||||
struct ib_ucontext ibuc;
|
||||
};
|
||||
|
||||
struct rxe_pd {
|
||||
|
Reference in New Issue
Block a user