Skip to content

Commit

Permalink
IB/core: Rename uverbs event file structure
Browse files Browse the repository at this point in the history
Previously, ib_uverbs_event_file was suffixed by _file as it contained
the actual file information. Since it's now only used as base struct
for ib_uverbs_async_event_file and ib_uverbs_completion_event_file,
we change its name to ib_uverbs_event_queue. This represents its
logical role better.

Fixes: 1e7710f ('IB/core: Change completion channel to use the reworked objects schema')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Matan Barak authored and Doug Ledford committed Apr 20, 2017
1 parent e0fcc61 commit db1b5dd
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 90 deletions.
21 changes: 11 additions & 10 deletions drivers/infiniband/core/uverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@
* an asynchronous event queue file is created and released when the
* event file is closed.
*
* struct ib_uverbs_event_file: One reference is held by the VFS and
* released when the file is closed. For asynchronous event files,
* another reference is held by the corresponding main context file
* and released when that file is closed. For completion event files,
* a reference is taken when a CQ is created that uses the file, and
* released when the CQ is destroyed.
* struct ib_uverbs_event_queue: Base structure for
* struct ib_uverbs_async_event_file and struct ib_uverbs_completion_event_file.
* One reference is held by the VFS and released when the file is closed.
* For asynchronous event files, another reference is held by the corresponding
* main context file and released when that file is closed. For completion
* event files, a reference is taken when a CQ is created that uses the file,
* and released when the CQ is destroyed.
*/

struct ib_uverbs_device {
Expand All @@ -101,7 +102,7 @@ struct ib_uverbs_device {
struct list_head uverbs_events_file_list;
};

struct ib_uverbs_event_file {
struct ib_uverbs_event_queue {
spinlock_t lock;
int is_closed;
wait_queue_head_t poll_wait;
Expand All @@ -110,15 +111,15 @@ struct ib_uverbs_event_file {
};

struct ib_uverbs_async_event_file {
struct ib_uverbs_event_file ev_file;
struct ib_uverbs_event_queue ev_queue;
struct ib_uverbs_file *uverbs_file;
struct kref ref;
struct list_head list;
};

struct ib_uverbs_completion_event_file {
struct ib_uobject_file uobj_file;
struct ib_uverbs_event_file ev_file;
struct ib_uverbs_event_queue ev_queue;
};

struct ib_uverbs_file {
Expand Down Expand Up @@ -191,7 +192,7 @@ struct ib_ucq_object {
};

extern const struct file_operations uverbs_event_fops;
void ib_uverbs_init_event_file(struct ib_uverbs_event_file *ev_file);
void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue);
struct file *ib_uverbs_alloc_async_event_file(struct ib_uverbs_file *uverbs_file,
struct ib_device *ib_dev);
void ib_uverbs_free_async_event_file(struct ib_uverbs_file *uverbs_file);
Expand Down
8 changes: 4 additions & 4 deletions drivers/infiniband/core/uverbs_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,

ev_file = container_of(uobj, struct ib_uverbs_completion_event_file,
uobj_file.uobj);
ib_uverbs_init_event_file(&ev_file->ev_file);
ib_uverbs_init_event_queue(&ev_file->ev_queue);

if (copy_to_user((void __user *) (unsigned long) cmd.response,
&resp, sizeof resp)) {
Expand Down Expand Up @@ -1015,7 +1015,7 @@ static struct ib_ucq_object *create_cq(struct ib_uverbs_file *file,
cq->uobject = &obj->uobject;
cq->comp_handler = ib_uverbs_comp_handler;
cq->event_handler = ib_uverbs_cq_event_handler;
cq->cq_context = &ev_file->ev_file;
cq->cq_context = &ev_file->ev_queue;
atomic_set(&cq->usecnt, 0);

obj->uobject.object = cq;
Expand Down Expand Up @@ -1296,7 +1296,7 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
struct ib_uobject *uobj;
struct ib_cq *cq;
struct ib_ucq_object *obj;
struct ib_uverbs_event_file *ev_file;
struct ib_uverbs_event_queue *ev_queue;
int ret = -EINVAL;

if (copy_from_user(&cmd, buf, sizeof cmd))
Expand All @@ -1313,7 +1313,7 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
*/
uverbs_uobject_get(uobj);
cq = uobj->object;
ev_file = cq->cq_context;
ev_queue = cq->cq_context;
obj = container_of(cq->uobject, struct ib_ucq_object, uobject);

memset(&resp, 0, sizeof(resp));
Expand Down
Loading

0 comments on commit db1b5dd

Please sign in to comment.