|
| 1 | +/* |
| 2 | + * Copyright (c) 2005 Topspin Communications. All rights reserved. |
| 3 | + * Copyright (c) 2005 Cisco Systems. All rights reserved. |
| 4 | + * |
| 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: |
| 10 | + * |
| 11 | + * Redistribution and use in source and binary forms, with or |
| 12 | + * without modification, are permitted provided that the following |
| 13 | + * conditions are met: |
| 14 | + * |
| 15 | + * - Redistributions of source code must retain the above |
| 16 | + * copyright notice, this list of conditions and the following |
| 17 | + * disclaimer. |
| 18 | + * |
| 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. |
| 23 | + * |
| 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 |
| 31 | + * SOFTWARE. |
| 32 | + * |
| 33 | + * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $ |
| 34 | + */ |
| 35 | + |
| 36 | +#ifndef IB_USER_VERBS_H |
| 37 | +#define IB_USER_VERBS_H |
| 38 | + |
| 39 | +#include <linux/types.h> |
| 40 | + |
| 41 | +/* |
| 42 | + * Increment this value if any changes that break userspace ABI |
| 43 | + * compatibility are made. |
| 44 | + */ |
| 45 | +#define IB_USER_VERBS_ABI_VERSION 1 |
| 46 | + |
| 47 | +enum { |
| 48 | + IB_USER_VERBS_CMD_QUERY_PARAMS, |
| 49 | + IB_USER_VERBS_CMD_GET_CONTEXT, |
| 50 | + IB_USER_VERBS_CMD_QUERY_DEVICE, |
| 51 | + IB_USER_VERBS_CMD_QUERY_PORT, |
| 52 | + IB_USER_VERBS_CMD_QUERY_GID, |
| 53 | + IB_USER_VERBS_CMD_QUERY_PKEY, |
| 54 | + IB_USER_VERBS_CMD_ALLOC_PD, |
| 55 | + IB_USER_VERBS_CMD_DEALLOC_PD, |
| 56 | + IB_USER_VERBS_CMD_CREATE_AH, |
| 57 | + IB_USER_VERBS_CMD_MODIFY_AH, |
| 58 | + IB_USER_VERBS_CMD_QUERY_AH, |
| 59 | + IB_USER_VERBS_CMD_DESTROY_AH, |
| 60 | + IB_USER_VERBS_CMD_REG_MR, |
| 61 | + IB_USER_VERBS_CMD_REG_SMR, |
| 62 | + IB_USER_VERBS_CMD_REREG_MR, |
| 63 | + IB_USER_VERBS_CMD_QUERY_MR, |
| 64 | + IB_USER_VERBS_CMD_DEREG_MR, |
| 65 | + IB_USER_VERBS_CMD_ALLOC_MW, |
| 66 | + IB_USER_VERBS_CMD_BIND_MW, |
| 67 | + IB_USER_VERBS_CMD_DEALLOC_MW, |
| 68 | + IB_USER_VERBS_CMD_CREATE_CQ, |
| 69 | + IB_USER_VERBS_CMD_RESIZE_CQ, |
| 70 | + IB_USER_VERBS_CMD_DESTROY_CQ, |
| 71 | + IB_USER_VERBS_CMD_POLL_CQ, |
| 72 | + IB_USER_VERBS_CMD_PEEK_CQ, |
| 73 | + IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, |
| 74 | + IB_USER_VERBS_CMD_CREATE_QP, |
| 75 | + IB_USER_VERBS_CMD_QUERY_QP, |
| 76 | + IB_USER_VERBS_CMD_MODIFY_QP, |
| 77 | + IB_USER_VERBS_CMD_DESTROY_QP, |
| 78 | + IB_USER_VERBS_CMD_POST_SEND, |
| 79 | + IB_USER_VERBS_CMD_POST_RECV, |
| 80 | + IB_USER_VERBS_CMD_ATTACH_MCAST, |
| 81 | + IB_USER_VERBS_CMD_DETACH_MCAST |
| 82 | +}; |
| 83 | + |
| 84 | +/* |
| 85 | + * Make sure that all structs defined in this file remain laid out so |
| 86 | + * that they pack the same way on 32-bit and 64-bit architectures (to |
| 87 | + * avoid incompatibility between 32-bit userspace and 64-bit kernels). |
| 88 | + * In particular do not use pointer types -- pass pointers in __u64 |
| 89 | + * instead. |
| 90 | + */ |
| 91 | + |
| 92 | +struct ib_uverbs_async_event_desc { |
| 93 | + __u64 element; |
| 94 | + __u32 event_type; /* enum ib_event_type */ |
| 95 | + __u32 reserved; |
| 96 | +}; |
| 97 | + |
| 98 | +struct ib_uverbs_comp_event_desc { |
| 99 | + __u64 cq_handle; |
| 100 | +}; |
| 101 | + |
| 102 | +/* |
| 103 | + * All commands from userspace should start with a __u32 command field |
| 104 | + * followed by __u16 in_words and out_words fields (which give the |
| 105 | + * length of the command block and response buffer if any in 32-bit |
| 106 | + * words). The kernel driver will read these fields first and read |
| 107 | + * the rest of the command struct based on these value. |
| 108 | + */ |
| 109 | + |
| 110 | +struct ib_uverbs_cmd_hdr { |
| 111 | + __u32 command; |
| 112 | + __u16 in_words; |
| 113 | + __u16 out_words; |
| 114 | +}; |
| 115 | + |
| 116 | +/* |
| 117 | + * No driver_data for "query params" command, since this is intended |
| 118 | + * to be a core function with no possible device dependence. |
| 119 | + */ |
| 120 | +struct ib_uverbs_query_params { |
| 121 | + __u64 response; |
| 122 | +}; |
| 123 | + |
| 124 | +struct ib_uverbs_query_params_resp { |
| 125 | + __u32 num_cq_events; |
| 126 | +}; |
| 127 | + |
| 128 | +struct ib_uverbs_get_context { |
| 129 | + __u64 response; |
| 130 | + __u64 cq_fd_tab; |
| 131 | + __u64 driver_data[0]; |
| 132 | +}; |
| 133 | + |
| 134 | +struct ib_uverbs_get_context_resp { |
| 135 | + __u32 async_fd; |
| 136 | + __u32 reserved; |
| 137 | +}; |
| 138 | + |
| 139 | +struct ib_uverbs_query_device { |
| 140 | + __u64 response; |
| 141 | + __u64 driver_data[0]; |
| 142 | +}; |
| 143 | + |
| 144 | +struct ib_uverbs_query_device_resp { |
| 145 | + __u64 fw_ver; |
| 146 | + __u64 node_guid; |
| 147 | + __u64 sys_image_guid; |
| 148 | + __u64 max_mr_size; |
| 149 | + __u64 page_size_cap; |
| 150 | + __u32 vendor_id; |
| 151 | + __u32 vendor_part_id; |
| 152 | + __u32 hw_ver; |
| 153 | + __u32 max_qp; |
| 154 | + __u32 max_qp_wr; |
| 155 | + __u32 device_cap_flags; |
| 156 | + __u32 max_sge; |
| 157 | + __u32 max_sge_rd; |
| 158 | + __u32 max_cq; |
| 159 | + __u32 max_cqe; |
| 160 | + __u32 max_mr; |
| 161 | + __u32 max_pd; |
| 162 | + __u32 max_qp_rd_atom; |
| 163 | + __u32 max_ee_rd_atom; |
| 164 | + __u32 max_res_rd_atom; |
| 165 | + __u32 max_qp_init_rd_atom; |
| 166 | + __u32 max_ee_init_rd_atom; |
| 167 | + __u32 atomic_cap; |
| 168 | + __u32 max_ee; |
| 169 | + __u32 max_rdd; |
| 170 | + __u32 max_mw; |
| 171 | + __u32 max_raw_ipv6_qp; |
| 172 | + __u32 max_raw_ethy_qp; |
| 173 | + __u32 max_mcast_grp; |
| 174 | + __u32 max_mcast_qp_attach; |
| 175 | + __u32 max_total_mcast_qp_attach; |
| 176 | + __u32 max_ah; |
| 177 | + __u32 max_fmr; |
| 178 | + __u32 max_map_per_fmr; |
| 179 | + __u32 max_srq; |
| 180 | + __u32 max_srq_wr; |
| 181 | + __u32 max_srq_sge; |
| 182 | + __u16 max_pkeys; |
| 183 | + __u8 local_ca_ack_delay; |
| 184 | + __u8 phys_port_cnt; |
| 185 | + __u8 reserved[4]; |
| 186 | +}; |
| 187 | + |
| 188 | +struct ib_uverbs_query_port { |
| 189 | + __u64 response; |
| 190 | + __u8 port_num; |
| 191 | + __u8 reserved[7]; |
| 192 | + __u64 driver_data[0]; |
| 193 | +}; |
| 194 | + |
| 195 | +struct ib_uverbs_query_port_resp { |
| 196 | + __u32 port_cap_flags; |
| 197 | + __u32 max_msg_sz; |
| 198 | + __u32 bad_pkey_cntr; |
| 199 | + __u32 qkey_viol_cntr; |
| 200 | + __u32 gid_tbl_len; |
| 201 | + __u16 pkey_tbl_len; |
| 202 | + __u16 lid; |
| 203 | + __u16 sm_lid; |
| 204 | + __u8 state; |
| 205 | + __u8 max_mtu; |
| 206 | + __u8 active_mtu; |
| 207 | + __u8 lmc; |
| 208 | + __u8 max_vl_num; |
| 209 | + __u8 sm_sl; |
| 210 | + __u8 subnet_timeout; |
| 211 | + __u8 init_type_reply; |
| 212 | + __u8 active_width; |
| 213 | + __u8 active_speed; |
| 214 | + __u8 phys_state; |
| 215 | + __u8 reserved[3]; |
| 216 | +}; |
| 217 | + |
| 218 | +struct ib_uverbs_query_gid { |
| 219 | + __u64 response; |
| 220 | + __u8 port_num; |
| 221 | + __u8 index; |
| 222 | + __u8 reserved[6]; |
| 223 | + __u64 driver_data[0]; |
| 224 | +}; |
| 225 | + |
| 226 | +struct ib_uverbs_query_gid_resp { |
| 227 | + __u8 gid[16]; |
| 228 | +}; |
| 229 | + |
| 230 | +struct ib_uverbs_query_pkey { |
| 231 | + __u64 response; |
| 232 | + __u8 port_num; |
| 233 | + __u8 index; |
| 234 | + __u8 reserved[6]; |
| 235 | + __u64 driver_data[0]; |
| 236 | +}; |
| 237 | + |
| 238 | +struct ib_uverbs_query_pkey_resp { |
| 239 | + __u16 pkey; |
| 240 | + __u16 reserved; |
| 241 | +}; |
| 242 | + |
| 243 | +struct ib_uverbs_alloc_pd { |
| 244 | + __u64 response; |
| 245 | + __u64 driver_data[0]; |
| 246 | +}; |
| 247 | + |
| 248 | +struct ib_uverbs_alloc_pd_resp { |
| 249 | + __u32 pd_handle; |
| 250 | +}; |
| 251 | + |
| 252 | +struct ib_uverbs_dealloc_pd { |
| 253 | + __u32 pd_handle; |
| 254 | +}; |
| 255 | + |
| 256 | +struct ib_uverbs_reg_mr { |
| 257 | + __u64 response; |
| 258 | + __u64 start; |
| 259 | + __u64 length; |
| 260 | + __u64 hca_va; |
| 261 | + __u32 pd_handle; |
| 262 | + __u32 access_flags; |
| 263 | + __u64 driver_data[0]; |
| 264 | +}; |
| 265 | + |
| 266 | +struct ib_uverbs_reg_mr_resp { |
| 267 | + __u32 mr_handle; |
| 268 | + __u32 lkey; |
| 269 | + __u32 rkey; |
| 270 | +}; |
| 271 | + |
| 272 | +struct ib_uverbs_dereg_mr { |
| 273 | + __u32 mr_handle; |
| 274 | +}; |
| 275 | + |
| 276 | +struct ib_uverbs_create_cq { |
| 277 | + __u64 response; |
| 278 | + __u64 user_handle; |
| 279 | + __u32 cqe; |
| 280 | + __u32 event_handler; |
| 281 | + __u64 driver_data[0]; |
| 282 | +}; |
| 283 | + |
| 284 | +struct ib_uverbs_create_cq_resp { |
| 285 | + __u32 cq_handle; |
| 286 | + __u32 cqe; |
| 287 | +}; |
| 288 | + |
| 289 | +struct ib_uverbs_destroy_cq { |
| 290 | + __u32 cq_handle; |
| 291 | +}; |
| 292 | + |
| 293 | +struct ib_uverbs_create_qp { |
| 294 | + __u64 response; |
| 295 | + __u64 user_handle; |
| 296 | + __u32 pd_handle; |
| 297 | + __u32 send_cq_handle; |
| 298 | + __u32 recv_cq_handle; |
| 299 | + __u32 srq_handle; |
| 300 | + __u32 max_send_wr; |
| 301 | + __u32 max_recv_wr; |
| 302 | + __u32 max_send_sge; |
| 303 | + __u32 max_recv_sge; |
| 304 | + __u32 max_inline_data; |
| 305 | + __u8 sq_sig_all; |
| 306 | + __u8 qp_type; |
| 307 | + __u8 is_srq; |
| 308 | + __u8 reserved; |
| 309 | + __u64 driver_data[0]; |
| 310 | +}; |
| 311 | + |
| 312 | +struct ib_uverbs_create_qp_resp { |
| 313 | + __u32 qp_handle; |
| 314 | + __u32 qpn; |
| 315 | +}; |
| 316 | + |
| 317 | +/* |
| 318 | + * This struct needs to remain a multiple of 8 bytes to keep the |
| 319 | + * alignment of the modify QP parameters. |
| 320 | + */ |
| 321 | +struct ib_uverbs_qp_dest { |
| 322 | + __u8 dgid[16]; |
| 323 | + __u32 flow_label; |
| 324 | + __u16 dlid; |
| 325 | + __u16 reserved; |
| 326 | + __u8 sgid_index; |
| 327 | + __u8 hop_limit; |
| 328 | + __u8 traffic_class; |
| 329 | + __u8 sl; |
| 330 | + __u8 src_path_bits; |
| 331 | + __u8 static_rate; |
| 332 | + __u8 is_global; |
| 333 | + __u8 port_num; |
| 334 | +}; |
| 335 | + |
| 336 | +struct ib_uverbs_modify_qp { |
| 337 | + struct ib_uverbs_qp_dest dest; |
| 338 | + struct ib_uverbs_qp_dest alt_dest; |
| 339 | + __u32 qp_handle; |
| 340 | + __u32 attr_mask; |
| 341 | + __u32 qkey; |
| 342 | + __u32 rq_psn; |
| 343 | + __u32 sq_psn; |
| 344 | + __u32 dest_qp_num; |
| 345 | + __u32 qp_access_flags; |
| 346 | + __u16 pkey_index; |
| 347 | + __u16 alt_pkey_index; |
| 348 | + __u8 qp_state; |
| 349 | + __u8 cur_qp_state; |
| 350 | + __u8 path_mtu; |
| 351 | + __u8 path_mig_state; |
| 352 | + __u8 en_sqd_async_notify; |
| 353 | + __u8 max_rd_atomic; |
| 354 | + __u8 max_dest_rd_atomic; |
| 355 | + __u8 min_rnr_timer; |
| 356 | + __u8 port_num; |
| 357 | + __u8 timeout; |
| 358 | + __u8 retry_cnt; |
| 359 | + __u8 rnr_retry; |
| 360 | + __u8 alt_port_num; |
| 361 | + __u8 alt_timeout; |
| 362 | + __u8 reserved[2]; |
| 363 | + __u64 driver_data[0]; |
| 364 | +}; |
| 365 | + |
| 366 | +struct ib_uverbs_modify_qp_resp { |
| 367 | +}; |
| 368 | + |
| 369 | +struct ib_uverbs_destroy_qp { |
| 370 | + __u32 qp_handle; |
| 371 | +}; |
| 372 | + |
| 373 | +struct ib_uverbs_attach_mcast { |
| 374 | + __u8 gid[16]; |
| 375 | + __u32 qp_handle; |
| 376 | + __u16 mlid; |
| 377 | + __u16 reserved; |
| 378 | + __u64 driver_data[0]; |
| 379 | +}; |
| 380 | + |
| 381 | +struct ib_uverbs_detach_mcast { |
| 382 | + __u8 gid[16]; |
| 383 | + __u32 qp_handle; |
| 384 | + __u16 mlid; |
| 385 | + __u16 reserved; |
| 386 | + __u64 driver_data[0]; |
| 387 | +}; |
| 388 | + |
| 389 | +#endif /* IB_USER_VERBS_H */ |
0 commit comments