Skip to content

Commit 3832125

Browse files
matanb10dledford
authored andcommitted
IB/core: Add support for idr types
The new ioctl infrastructure supports driver specific objects. Each such object type has a hot unplug function, allocation size and an order of destruction. When a ucontext is created, a new list is created in this ib_ucontext. This list contains all objects created under this ib_ucontext. When a ib_ucontext is destroyed, we traverse this list several time destroying the various objects by the order mentioned in the object type description. If few object types have the same destruction order, they are destroyed in an order opposite to their creation. Adding an object is done in two parts. First, an object is allocated and added to idr tree. Then, the command's handlers (in downstream patches) could work on this object and fill in its required details. After a successful command, the commit part is called and the user objects become ucontext visible. If the handler failed, alloc_abort should be called. Removing an uboject is done by calling lookup_get with the write flag and finalizing it with destroy_commit. A major change from the previous code is that we actually destroy the kernel object itself in destroy_commit (rather than just the uobject). We should make sure idr (per-uverbs-file) and list (per-ucontext) could be accessed concurrently without corrupting them. Signed-off-by: Matan Barak <[email protected]> Reviewed-by: Yishai Hadas <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 771addf commit 3832125

File tree

5 files changed

+660
-1
lines changed

5 files changed

+660
-1
lines changed

drivers/infiniband/core/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ ib_umad-y := user_mad.o
2929

3030
ib_ucm-y := ucm.o
3131

32-
ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o
32+
ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o \
33+
rdma_core.o

0 commit comments

Comments
 (0)