RDMA/uverbs: Remove legacy umem field from struct ib_cq

Now that all drivers use helper to get umem and manage the lifetime,
legacy umem field in struct ib_cq is no longer needed. Remove it
along with ib_umem_get_cq_tmp() helper that populated it and both
error and destroy paths.

Link: https://patch.msgid.link/r/20260529134312.2836341-12-jiri@resnulli.us
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Jiri Pirko 2026-05-29 15:43:07 +02:00 committed by Jason Gunthorpe
parent c0a94fecec
commit 7c5bbaaf44
6 changed files with 0 additions and 62 deletions

View File

@ -602,35 +602,6 @@ struct ib_umem *ib_umem_get_cq_buf_or_va(struct ib_device *device,
}
EXPORT_SYMBOL(ib_umem_get_cq_buf_or_va);
/**
* ib_umem_get_cq_tmp - Temporary CQ buffer umem getter.
* @device: IB device.
* @attrs: uverbs attribute bundle.
*
* Pins a CQ buffer described by the legacy CQ buffer attributes.
* Returns NULL when none are supplied.
*
* Will be removed once all CQ drivers have switched to get
* their buffer directly.
*
* Return: caller-owned umem on success; NULL when no legacy attribute
* is supplied; ERR_PTR(...) on error.
*/
struct ib_umem *ib_umem_get_cq_tmp(struct ib_device *device,
struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_buffer_desc desc = {};
int ret;
ret = uverbs_create_cq_get_buffer_desc(attrs, &desc);
if (ret == -ENODATA)
return NULL;
if (ret)
return ERR_PTR(ret);
return ib_umem_get_desc(device, &desc, IB_ACCESS_LOCAL_WRITE);
}
EXPORT_SYMBOL(ib_umem_get_cq_tmp);
/**
* ib_umem_release - release pinned memory
* @umem: umem struct to release

View File

@ -1084,7 +1084,6 @@ static int create_cq(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
err_free:
ib_umem_release(cq->umem);
rdma_restrack_put(&cq->res);
kfree(cq);
err_file:

View File

@ -68,7 +68,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
struct ib_device *ib_dev = attrs->context->device;
struct ib_cq_init_attr attr = {};
struct ib_uobject *ev_file_uobj;
struct ib_umem *umem = NULL;
struct ib_cq *cq;
u64 user_handle;
int ret;
@ -117,16 +116,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
INIT_LIST_HEAD(&obj->comp_list);
INIT_LIST_HEAD(&obj->uevent.event_list);
umem = ib_umem_get_cq_tmp(ib_dev, attrs);
if (IS_ERR(umem)) {
ret = PTR_ERR(umem);
goto err_event_file;
}
cq = rdma_zalloc_drv_obj(ib_dev, ib_cq);
if (!cq) {
ret = -ENOMEM;
ib_umem_release(umem);
goto err_event_file;
}
@ -135,11 +127,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
cq->comp_handler = ib_uverbs_comp_handler;
cq->event_handler = ib_uverbs_cq_event_handler;
cq->cq_context = ev_file ? &ev_file->ev_queue : NULL;
/*
* If UMEM is not provided here, legacy drivers will set it during
* CQ creation based on their internal udata.
*/
cq->umem = umem;
atomic_set(&cq->usecnt, 0);
rdma_restrack_new(&cq->res, RDMA_RESTRACK_CQ);
@ -152,9 +139,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
if (ret)
goto err_free;
/* Check that driver didn't overrun existing umem */
WARN_ON(umem && cq->umem != umem);
obj->uevent.uobject.object = cq;
obj->uevent.uobject.user_handle = user_handle;
rdma_restrack_add(&cq->res);
@ -165,7 +149,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
return ret;
err_free:
ib_umem_release(cq->umem);
rdma_restrack_put(&cq->res);
kfree(cq);
err_event_file:

View File

@ -2221,12 +2221,6 @@ struct ib_cq *__ib_create_cq(struct ib_device *device,
kfree(cq);
return ERR_PTR(ret);
}
/*
* We are in kernel verbs flow and drivers are not allowed
* to set umem pointer, it needs to stay NULL.
*/
WARN_ON_ONCE(cq->umem);
rdma_restrack_add(&cq->res);
return cq;
}
@ -2257,7 +2251,6 @@ int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata)
if (ret)
return ret;
ib_umem_release(cq->umem);
rdma_restrack_del(&cq->res);
kfree(cq);
return ret;

View File

@ -96,8 +96,6 @@ struct ib_umem *ib_umem_get_cq_buf(struct ib_device *device,
struct ib_umem *ib_umem_get_cq_buf_or_va(struct ib_device *device,
const struct uverbs_attr_bundle *attrs,
u64 addr, size_t size, int access);
struct ib_umem *ib_umem_get_cq_tmp(struct ib_device *device,
struct uverbs_attr_bundle *attrs);
static inline struct ib_umem *ib_umem_get_va(struct ib_device *device,
unsigned long addr, size_t size,
@ -229,11 +227,6 @@ ib_umem_get_cq_buf_or_va(struct ib_device *device,
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline struct ib_umem *
ib_umem_get_cq_tmp(struct ib_device *device, struct uverbs_attr_bundle *attrs)
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline void ib_umem_release(struct ib_umem *umem) { }
static inline int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset,
size_t length) {

View File

@ -1738,7 +1738,6 @@ struct ib_cq {
u8 interrupt:1;
u8 shared:1;
unsigned int comp_vector;
struct ib_umem *umem;
/*
* Implementation details of the RDMA core, don't use in drivers: