Skip to content

Commit dc6be44

Browse files
PatrisiousHaddadrleon
authored andcommitted
RDMA/core: Add device ufile cleanup operation
Add a driver operation to allow preemptive cleanup of ufile HW resources before the standard ufile cleanup flow begins. Thus, expediting the final cleanup phase which leads to fast teardown overall. This allows the use of driver specific clean up procedures to make the cleanup process more efficient. Signed-off-by: Patrisious Haddad <[email protected]> Link: https://patch.msgid.link/cabe00d75132b5732cb515944e3c500a01fb0b4a.1730373303.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 0bd2c61 commit dc6be44

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

drivers/infiniband/core/device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
27592759
SET_DEVICE_OP(dev_ops, resize_cq);
27602760
SET_DEVICE_OP(dev_ops, set_vf_guid);
27612761
SET_DEVICE_OP(dev_ops, set_vf_link_state);
2762+
SET_DEVICE_OP(dev_ops, ufile_hw_cleanup);
27622763

27632764
SET_OBJ_SIZE(dev_ops, ib_ah);
27642765
SET_OBJ_SIZE(dev_ops, ib_counters);

drivers/infiniband/core/rdma_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,14 @@ static void ufile_destroy_ucontext(struct ib_uverbs_file *ufile,
880880
static int __uverbs_cleanup_ufile(struct ib_uverbs_file *ufile,
881881
enum rdma_remove_reason reason)
882882
{
883+
struct uverbs_attr_bundle attrs = { .ufile = ufile };
884+
struct ib_ucontext *ucontext = ufile->ucontext;
885+
struct ib_device *ib_dev = ucontext->device;
883886
struct ib_uobject *obj, *next_obj;
884887
int ret = -EINVAL;
885-
struct uverbs_attr_bundle attrs = { .ufile = ufile };
888+
889+
if (ib_dev->ops.ufile_hw_cleanup)
890+
ib_dev->ops.ufile_hw_cleanup(ufile);
886891

887892
/*
888893
* This shouldn't run while executing other commands on this

include/rdma/ib_verbs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,12 @@ struct ib_device_ops {
26752675
*/
26762676
void (*del_sub_dev)(struct ib_device *sub_dev);
26772677

2678+
/**
2679+
* ufile_cleanup - Attempt to cleanup ubojects HW resources inside
2680+
* the ufile.
2681+
*/
2682+
void (*ufile_hw_cleanup)(struct ib_uverbs_file *ufile);
2683+
26782684
DECLARE_RDMA_OBJ_SIZE(ib_ah);
26792685
DECLARE_RDMA_OBJ_SIZE(ib_counters);
26802686
DECLARE_RDMA_OBJ_SIZE(ib_cq);

0 commit comments

Comments
 (0)