IB/core: Change idr objects to use the new schema
authorMatan Barak <matanb@mellanox.com>
Tue, 4 Apr 2017 10:31:44 +0000 (13:31 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 5 Apr 2017 17:28:04 +0000 (13:28 -0400)
commitfd3c7904db6e05043398aee5c1448682acfb025b
treec394cf76ca93e0a5a637cd268073ab91590483fd
parent6be60aed126ccd4dfb4a60d1dc2ecec0bca21b2e
IB/core: Change idr objects to use the new schema

This changes only the handlers which deals with idr based objects to
use the new idr allocation, fetching and destruction schema.
This patch consists of the following changes:
(1) Allocation, fetching and destruction is done via idr ops.
(2) Context initializing and release is done through
    uverbs_initialize_ucontext and uverbs_cleanup_ucontext.
(3) Ditching the live flag. Mostly, this is pretty straight
    forward. The only place that is a bit trickier is in
    ib_uverbs_open_qp. Commit [1] added code to check whether
    the uobject is already live and initialized. This mostly
    happens because of a race between open_qp and events.
    We delayed assigning the uobject's pointer in order to
    eliminate this race without using the live variable.

[1] commit a040f95dc819
("IB/core: Fix XRC race condition in ib_uverbs_open_qp")

Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/rdma_core.h
drivers/infiniband/core/uverbs.h
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_main.c
include/rdma/ib_verbs.h
include/rdma/uverbs_std_types.h