2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Cisco Systems. All rights reserved.
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * $Id: uverbs.h 2559 2005-06-06 19:43:16Z roland $
39 /* Include device.h and fs.h until cdev.h is self-sufficient */
41 #include <linux/device.h>
42 #include <linux/cdev.h>
43 #include <linux/kref.h>
44 #include <linux/idr.h>
47 #include <ib_user_verbs.h>
49 struct ib_uverbs_device
{
52 struct class_device class_dev
;
53 struct ib_device
*ib_dev
;
57 struct ib_uverbs_event_file
{
59 struct ib_uverbs_file
*uverbs_file
;
63 wait_queue_head_t poll_wait
;
64 struct fasync_struct
*async_queue
;
65 struct list_head event_list
;
68 struct ib_uverbs_file
{
70 struct ib_uverbs_device
*device
;
71 struct ib_ucontext
*ucontext
;
72 struct ib_event_handler event_handler
;
73 struct ib_uverbs_event_file async_file
;
74 struct ib_uverbs_event_file comp_file
[1];
77 struct ib_uverbs_async_event
{
78 struct ib_uverbs_async_event_desc desc
;
79 struct list_head list
;
82 struct ib_uverbs_comp_event
{
83 struct ib_uverbs_comp_event_desc desc
;
84 struct list_head list
;
87 struct ib_uobject_mr
{
88 struct ib_uobject uobj
;
89 struct page
*page_list
;
90 struct scatterlist
*sg_list
;
93 extern struct semaphore ib_uverbs_idr_mutex
;
94 extern struct idr ib_uverbs_pd_idr
;
95 extern struct idr ib_uverbs_mr_idr
;
96 extern struct idr ib_uverbs_mw_idr
;
97 extern struct idr ib_uverbs_ah_idr
;
98 extern struct idr ib_uverbs_cq_idr
;
99 extern struct idr ib_uverbs_qp_idr
;
101 void ib_uverbs_comp_handler(struct ib_cq
*cq
, void *cq_context
);
102 void ib_uverbs_cq_event_handler(struct ib_event
*event
, void *context_ptr
);
103 void ib_uverbs_qp_event_handler(struct ib_event
*event
, void *context_ptr
);
105 int ib_umem_get(struct ib_device
*dev
, struct ib_umem
*mem
,
106 void *addr
, size_t size
, int write
);
107 void ib_umem_release(struct ib_device
*dev
, struct ib_umem
*umem
);
108 void ib_umem_release_on_close(struct ib_device
*dev
, struct ib_umem
*umem
);
110 #define IB_UVERBS_DECLARE_CMD(name) \
111 ssize_t ib_uverbs_##name(struct ib_uverbs_file *file, \
112 const char __user *buf, int in_len, \
115 IB_UVERBS_DECLARE_CMD(query_params
);
116 IB_UVERBS_DECLARE_CMD(get_context
);
117 IB_UVERBS_DECLARE_CMD(query_device
);
118 IB_UVERBS_DECLARE_CMD(query_port
);
119 IB_UVERBS_DECLARE_CMD(query_gid
);
120 IB_UVERBS_DECLARE_CMD(query_pkey
);
121 IB_UVERBS_DECLARE_CMD(alloc_pd
);
122 IB_UVERBS_DECLARE_CMD(dealloc_pd
);
123 IB_UVERBS_DECLARE_CMD(reg_mr
);
124 IB_UVERBS_DECLARE_CMD(dereg_mr
);
125 IB_UVERBS_DECLARE_CMD(create_cq
);
126 IB_UVERBS_DECLARE_CMD(destroy_cq
);
127 IB_UVERBS_DECLARE_CMD(create_qp
);
128 IB_UVERBS_DECLARE_CMD(modify_qp
);
129 IB_UVERBS_DECLARE_CMD(destroy_qp
);
130 IB_UVERBS_DECLARE_CMD(attach_mcast
);
131 IB_UVERBS_DECLARE_CMD(detach_mcast
);
133 #endif /* UVERBS_H */