2 * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
\r
3 * Copyright (c) 2004, 2008 Intel Corporation. All rights reserved.
\r
4 * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved.
\r
5 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
\r
7 * This software is available to you under the OpenFabrics.org BSD license
\r
10 * Redistribution and use in source and binary forms, with or
\r
11 * without modification, are permitted provided that the following
\r
12 * conditions are met:
\r
14 * - Redistributions of source code must retain the above
\r
15 * copyright notice, this list of conditions and the following
\r
18 * - Redistributions in binary form must reproduce the above
\r
19 * copyright notice, this list of conditions and the following
\r
20 * disclaimer in the documentation and/or other materials
\r
21 * provided with the distribution.
\r
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
\r
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
35 #ifndef INFINIBAND_VERBS_H
\r
36 #define INFINIBAND_VERBS_H
\r
38 #include <windows.h>
\r
39 #include <rdma\winverbs.h>
\r
41 #include <comp_channel.h>
\r
48 * Interfaces based on libibverbs 1.1.2.
\r
51 typedef unsigned __int8 uint8_t;
\r
52 typedef unsigned __int16 uint16_t;
\r
53 typedef unsigned __int32 uint32_t;
\r
54 typedef unsigned __int64 uint64_t;
\r
56 #define EOVERFLOW WV_BUFFER_OVERFLOW
\r
57 #define EISCONN WV_CONNECTION_ACTIVE
\r
58 #define ECONNREFUSED WV_CONNECTION_REFUSED
\r
59 #define ETIMEDOUT WV_TIMEOUT
\r
60 #define ENETUNREACH WV_HOST_UNREACHABLE
\r
61 #define EADDRINUSE WV_ADDRESS_ALREADY_EXISTS
\r
62 #define EALREADY WV_IO_PENDING
\r
63 #define EAFNOSUPPORT WV_INVALID_ADDRESS
\r
64 #define EWOULDBLOCK WV_DEVICE_BUSY
\r
66 #define ECONNRESET WSAECONNRESET
\r
73 uint64_t subnet_prefix;
\r
74 uint64_t interface_id;
\r
81 IBV_NODE_UNKNOWN = -1,
\r
88 enum ibv_transport_type
\r
90 IBV_TRANSPORT_UNKNOWN = WvDeviceUnknown,
\r
91 IBV_TRANSPORT_IB = WvDeviceInfiniband,
\r
92 IBV_TRANSPORT_IWARP = WvDeviceIwarp
\r
95 enum ibv_device_cap_flags
\r
97 IBV_DEVICE_RESIZE_MAX_WR = WV_DEVICE_RESIZE_MAX_WR,
\r
98 IBV_DEVICE_BAD_PKEY_CNTR = WV_DEVICE_BAD_PKEY_COUNTER,
\r
99 IBV_DEVICE_BAD_QKEY_CNTR = WV_DEVICE_BAD_QKEY_COUNTER,
\r
100 IBV_DEVICE_RAW_MULTI = 0,
\r
101 IBV_DEVICE_AUTO_PATH_MIG = WV_DEVICE_PATH_MIGRATION,
\r
102 IBV_DEVICE_CHANGE_PHY_PORT = WV_DEVICE_CHANGE_PHYSICAL_PORT,
\r
103 IBV_DEVICE_UD_AV_PORT_ENFORCE = WV_DEVICE_AH_PORT_CHECKING,
\r
104 IBV_DEVICE_CURR_QP_STATE_MOD = WV_DEVICE_QP_STATE_MODIFIER,
\r
105 IBV_DEVICE_SHUTDOWN_PORT = WV_DEVICE_SHUTDOWN_PORT,
\r
106 IBV_DEVICE_INIT_TYPE = WV_DEVICE_INIT_TYPE,
\r
107 IBV_DEVICE_PORT_ACTIVE_EVENT = WV_DEVICE_PORT_ACTIVE_EVENT,
\r
108 IBV_DEVICE_SYS_IMAGE_GUID = WV_DEVICE_SYSTEM_IMAGE_GUID,
\r
109 IBV_DEVICE_RC_RNR_NAK_GEN = WV_DEVICE_RC_RNR_NAK_GENERATION,
\r
110 IBV_DEVICE_SRQ_RESIZE = WV_DEVICE_SRQ_RESIZE,
\r
111 IBV_DEVICE_N_NOTIFY_CQ = WV_DEVICE_BATCH_NOTIFY_CQ
\r
114 enum ibv_atomic_cap
\r
116 IBV_ATOMIC_NONE = WvAtomicNone,
\r
117 IBV_ATOMIC_HCA = WvAtomicDevice,
\r
118 IBV_ATOMIC_GLOB = WvAtomicNode
\r
121 struct ibv_device_attr
\r
124 uint64_t node_guid;
\r
125 uint64_t sys_image_guid;
\r
126 uint64_t max_mr_size;
\r
127 uint64_t page_size_cap;
\r
128 uint32_t vendor_id;
\r
129 uint32_t vendor_part_id;
\r
133 int device_cap_flags;
\r
140 int max_qp_rd_atom;
\r
141 int max_ee_rd_atom;
\r
142 int max_res_rd_atom;
\r
143 int max_qp_init_rd_atom;
\r
144 int max_ee_init_rd_atom;
\r
145 enum ibv_atomic_cap atomic_cap;
\r
149 int max_raw_ipv6_qp;
\r
150 int max_raw_ethy_qp;
\r
152 int max_mcast_qp_attach;
\r
153 int max_total_mcast_qp_attach;
\r
156 int max_map_per_fmr;
\r
160 uint16_t max_pkeys;
\r
161 uint8_t local_ca_ack_delay;
\r
162 uint8_t phys_port_cnt;
\r
174 enum ibv_port_state
\r
176 IBV_PORT_NOP = WvPortNop,
\r
177 IBV_PORT_DOWN = WvPortDown,
\r
178 IBV_PORT_INIT = WvPortInit,
\r
179 IBV_PORT_ARMED = WvPortArmed,
\r
180 IBV_PORT_ACTIVE = WvPortActive,
\r
181 IBV_PORT_ACTIVE_DEFER = WvPortActiveDefer
\r
184 struct ibv_port_attr
\r
186 enum ibv_port_state state;
\r
187 enum ibv_mtu max_mtu;
\r
188 enum ibv_mtu active_mtu;
\r
190 uint32_t port_cap_flags;
\r
191 uint32_t max_msg_sz;
\r
192 uint32_t bad_pkey_cntr;
\r
193 uint32_t qkey_viol_cntr;
\r
194 uint16_t pkey_tbl_len;
\r
198 uint8_t max_vl_num;
\r
200 uint8_t subnet_timeout;
\r
201 uint8_t init_type_reply;
\r
202 uint8_t active_width;
\r
203 uint8_t active_speed;
\r
204 uint8_t phys_state;
\r
207 // Only device/port level events are currently supported.
\r
208 enum ibv_event_type
\r
211 IBV_EVENT_QP_FATAL,
\r
212 IBV_EVENT_QP_REQ_ERR,
\r
213 IBV_EVENT_QP_ACCESS_ERR,
\r
214 IBV_EVENT_COMM_EST,
\r
215 IBV_EVENT_SQ_DRAINED,
\r
216 IBV_EVENT_PATH_MIG,
\r
217 IBV_EVENT_PATH_MIG_ERR,
\r
218 IBV_EVENT_DEVICE_FATAL,
\r
219 IBV_EVENT_PORT_ACTIVE,
\r
220 IBV_EVENT_PORT_ERR,
\r
221 IBV_EVENT_LID_CHANGE,
\r
222 IBV_EVENT_PKEY_CHANGE,
\r
223 IBV_EVENT_SM_CHANGE,
\r
225 IBV_EVENT_SRQ_LIMIT_REACHED,
\r
226 IBV_EVENT_QP_LAST_WQE_REACHED,
\r
227 IBV_EVENT_CLIENT_REREGISTER
\r
230 struct ibv_async_event
\r
236 struct ibv_srq *srq;
\r
240 enum ibv_event_type event_type;
\r
246 IBV_WC_LOC_LEN_ERR,
\r
247 IBV_WC_LOC_QP_OP_ERR,
\r
248 IBV_WC_LOC_PROT_ERR,
\r
249 IBV_WC_WR_FLUSH_ERR,
\r
250 IBV_WC_MW_BIND_ERR,
\r
251 IBV_WC_REM_ACCESS_ERR,
\r
253 IBV_WC_RNR_RETRY_EXC_ERR,
\r
254 IBV_WC_RESP_TIMEOUT_ERR,
\r
255 IBV_WC_REM_INV_REQ_ERR,
\r
256 IBV_WC_BAD_RESP_ERR,
\r
257 IBV_WC_LOC_ACCESS_ERR,
\r
258 IBV_WC_GENERAL_ERR,
\r
260 IBV_WC_RETRY_EXC_ERR,
\r
261 IBV_WC_REM_ABORT_ERR,
\r
262 IBV_WC_LOC_EEC_OP_ERR,
\r
263 IBV_WC_LOC_RDD_VIOL_ERR,
\r
264 IBV_WC_REM_INV_RD_REQ_ERR,
\r
265 IBV_WC_INV_EECN_ERR,
\r
266 IBV_WC_INV_EEC_STATE_ERR
\r
269 __declspec(dllexport)
\r
270 const char *ibv_wc_status_str(enum ibv_wc_status status);
\r
274 IBV_WC_SEND = WvSend,
\r
275 IBV_WC_RDMA_WRITE = WvRdmaWrite,
\r
276 IBV_WC_RDMA_READ = WvRdmaRead,
\r
277 IBV_WC_COMP_SWAP = WvCompareExchange,
\r
278 IBV_WC_FETCH_ADD = WvFetchAdd,
\r
279 IBV_WC_BIND_MW = WvBindWindow,
\r
281 * Set value of IBV_WC_RECV so consumers can test if a completion is a
\r
282 * receive by testing (opcode & IBV_WC_RECV).
\r
284 IBV_WC_RECV = WvReceive,
\r
285 IBV_WC_RECV_RDMA_WITH_IMM = WvReceiveRdmaWrite
\r
290 IBV_WC_GRH = WV_WC_GRH_VALID,
\r
291 IBV_WC_WITH_IMM = WV_WC_IMMEDIATE
\r
302 enum ibv_wc_opcode opcode;
\r
304 uint32_t vendor_err2;
\r
305 uint32_t vendor_err;
\r
306 enum ibv_wc_status status;
\r
308 enum ibv_wc_flags wc_flags;
\r
309 uint32_t imm_data; /* in network byte order */
\r
311 uint16_t pkey_index;
\r
314 uint8_t dlid_path_bits;
\r
317 enum ibv_access_flags
\r
319 IBV_ACCESS_LOCAL_WRITE = WV_ACCESS_LOCAL_WRITE,
\r
320 IBV_ACCESS_REMOTE_WRITE = WV_ACCESS_REMOTE_WRITE,
\r
321 IBV_ACCESS_REMOTE_READ = WV_ACCESS_REMOTE_READ,
\r
322 IBV_ACCESS_REMOTE_ATOMIC = WV_ACCESS_REMOTE_ATOMIC,
\r
323 IBV_ACCESS_MW_BIND = WV_ACCESS_MW_BIND
\r
328 struct ibv_context *context;
\r
329 IWVProtectionDomain *handle;
\r
332 /* Reregister MR not supported by WinVerbs */
\r
333 enum ibv_rereg_mr_flags
\r
335 IBV_REREG_MR_CHANGE_TRANSLATION = (1 << 0),
\r
336 IBV_REREG_MR_CHANGE_PD = (1 << 1),
\r
337 IBV_REREG_MR_CHANGE_ACCESS = (1 << 2),
\r
338 IBV_REREG_MR_KEEP_VALID = (1 << 3)
\r
343 struct ibv_context *context;
\r
351 /* Memory windows not implemented by WinVerbs */
\r
358 /* Memory windows not implemented by WinVerbs */
\r
361 struct ibv_context *context;
\r
366 struct ibv_global_route
\r
368 union ibv_gid dgid;
\r
369 uint32_t flow_label;
\r
370 uint8_t sgid_index;
\r
372 uint8_t traffic_class;
\r
377 uint32_t version_tclass_flow;
\r
381 union ibv_gid sgid;
\r
382 union ibv_gid dgid;
\r
388 IBV_RATE_2_5_GBPS = 2,
\r
389 IBV_RATE_5_GBPS = 5,
\r
390 IBV_RATE_10_GBPS = 3,
\r
391 IBV_RATE_20_GBPS = 6,
\r
392 IBV_RATE_30_GBPS = 4,
\r
393 IBV_RATE_40_GBPS = 7,
\r
394 IBV_RATE_60_GBPS = 8,
\r
395 IBV_RATE_80_GBPS = 9,
\r
396 IBV_RATE_120_GBPS = 10
\r
400 * ibv_rate_to_mult - Convert the IB rate enum to a multiple of the
\r
401 * base rate of 2.5 Gbit/sec. For example, IBV_RATE_5_GBPS will be
\r
402 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec.
\r
403 * @rate: rate to convert.
\r
405 __declspec(dllexport)
\r
406 int ibv_rate_to_mult(enum ibv_rate rate);
\r
409 * mult_to_ibv_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate enum.
\r
410 * @mult: multiple to convert.
\r
412 __declspec(dllexport)
\r
413 enum ibv_rate mult_to_ibv_rate(int mult);
\r
417 struct ibv_global_route grh;
\r
420 uint8_t src_path_bits;
\r
421 uint8_t static_rate;
\r
426 enum ibv_srq_attr_mask
\r
428 IBV_SRQ_MAX_WR = 1 << 0,
\r
429 IBV_SRQ_LIMIT = 1 << 1
\r
432 struct ibv_srq_attr
\r
436 uint32_t srq_limit;
\r
439 struct ibv_srq_init_attr
\r
442 struct ibv_srq_attr attr;
\r
447 IBV_QPT_RC = WvQpTypeRc,
\r
448 IBV_QPT_UC = WvQpTypeUc,
\r
449 IBV_QPT_UD = WvQpTypeUd
\r
454 uint32_t max_send_wr;
\r
455 uint32_t max_recv_wr;
\r
456 uint32_t max_send_sge;
\r
457 uint32_t max_recv_sge;
\r
458 uint32_t max_inline_data;
\r
461 struct ibv_qp_init_attr
\r
464 struct ibv_cq *send_cq;
\r
465 struct ibv_cq *recv_cq;
\r
466 struct ibv_srq *srq;
\r
467 struct ibv_qp_cap cap;
\r
468 enum ibv_qp_type qp_type;
\r
472 enum ibv_qp_attr_mask
\r
474 IBV_QP_STATE = WV_QP_ATTR_STATE,
\r
475 IBV_QP_CUR_STATE = WV_QP_ATTR_CURRENT_STATE,
\r
476 IBV_QP_EN_SQD_ASYNC_NOTIFY = WV_QP_ATTR_FLAGS,
\r
477 IBV_QP_ACCESS_FLAGS = WV_QP_ATTR_ACCESS_FLAGS,
\r
478 IBV_QP_PKEY_INDEX = WV_QP_ATTR_PKEY_INDEX,
\r
479 IBV_QP_PORT = WV_QP_ATTR_PORT_NUMBER,
\r
480 IBV_QP_QKEY = WV_QP_ATTR_QKEY,
\r
481 IBV_QP_AV = WV_QP_ATTR_AV,
\r
482 IBV_QP_PATH_MTU = WV_QP_ATTR_AV,
\r
483 IBV_QP_TIMEOUT = WV_QP_ATTR_ACK_TIMEOUT,
\r
484 IBV_QP_RETRY_CNT = WV_QP_ATTR_ERROR_RETRY_COUNT,
\r
485 IBV_QP_RNR_RETRY = WV_QP_ATTR_RNR_RETRY_COUNT,
\r
486 IBV_QP_RQ_PSN = WV_QP_ATTR_RECEIVE_PSN,
\r
487 IBV_QP_MAX_QP_RD_ATOMIC = WV_QP_ATTR_INITIATOR_DEPTH,
\r
488 IBV_QP_ALT_PATH = WV_QP_ATTR_ALTERNATE_AV,
\r
489 IBV_QP_MIN_RNR_TIMER = WV_QP_ATTR_RNR_NAK_TIMEOUT,
\r
490 IBV_QP_SQ_PSN = WV_QP_ATTR_SEND_PSN,
\r
491 IBV_QP_MAX_DEST_RD_ATOMIC = WV_QP_ATTR_RESPONDER_RESOURCES,
\r
492 IBV_QP_PATH_MIG_STATE = WV_QP_ATTR_PATH_MIG_STATE,
\r
493 IBV_QP_CAP = WV_QP_ATTR_CAPABILITIES,
\r
494 IBV_QP_DEST_QPN = WV_QP_ATTR_DESTINATION_QPN
\r
499 IBV_QPS_RESET = WvQpStateReset,
\r
500 IBV_QPS_INIT = WvQpStateInit,
\r
501 IBV_QPS_RTR = WvQpStateRtr,
\r
502 IBV_QPS_RTS = WvQpStateRts,
\r
503 IBV_QPS_SQD = WvQpStateSqd,
\r
504 IBV_QPS_SQE = WvQpStateSqError,
\r
505 IBV_QPS_ERR = WvQpStateError
\r
510 IBV_MIG_MIGRATED = WvApmMigrated,
\r
511 IBV_MIG_REARM = WvApmRearm,
\r
512 IBV_MIG_ARMED = WvApmArmed
\r
517 enum ibv_qp_state qp_state;
\r
518 enum ibv_qp_state cur_qp_state;
\r
519 enum ibv_mtu path_mtu;
\r
520 enum ibv_mig_state path_mig_state;
\r
524 uint32_t dest_qp_num;
\r
525 int qp_access_flags;
\r
526 struct ibv_qp_cap cap;
\r
527 struct ibv_ah_attr ah_attr;
\r
528 struct ibv_ah_attr alt_ah_attr;
\r
529 uint16_t pkey_index;
\r
530 uint16_t alt_pkey_index;
\r
531 uint8_t en_sqd_async_notify;
\r
532 uint8_t sq_draining;
\r
533 uint8_t max_rd_atomic;
\r
534 uint8_t max_dest_rd_atomic;
\r
535 uint8_t min_rnr_timer;
\r
540 uint8_t alt_port_num;
\r
541 uint8_t alt_timeout;
\r
546 IBV_WR_SEND = WvSend,
\r
547 IBV_WR_RDMA_WRITE = WvRdmaWrite,
\r
548 IBV_WR_RDMA_READ = WvRdmaRead,
\r
549 IBV_WR_ATOMIC_CMP_AND_SWP = WvCompareExchange,
\r
550 IBV_WR_ATOMIC_FETCH_AND_ADD = WvFetchAdd,
\r
551 IBV_WR_SEND_WITH_IMM = WvSend | 0x80000000,
\r
552 IBV_WR_RDMA_WRITE_WITH_IMM = WvRdmaWrite | 0x80000000,
\r
555 enum ibv_send_flags
\r
557 IBV_SEND_FENCE = WV_SEND_FENCE,
\r
558 IBV_SEND_SIGNALED = WV_SEND_SIGNALED,
\r
559 IBV_SEND_SOLICITED = WV_SEND_SOLICITED,
\r
560 IBV_SEND_INLINE = WV_SEND_INLINE
\r
573 struct ibv_send_wr *next;
\r
574 struct ibv_sge *sg_list;
\r
576 enum ibv_wr_opcode opcode;
\r
577 enum ibv_send_flags send_flags;
\r
578 uint32_t imm_data; /* in network byte order */
\r
583 uint64_t remote_addr;
\r
589 uint64_t remote_addr;
\r
591 uint64_t compare_add;
\r
598 uint32_t remote_qpn;
\r
599 uint32_t remote_qkey;
\r
608 struct ibv_recv_wr *next;
\r
609 struct ibv_sge *sg_list;
\r
613 /* Memory windows not implemented by WinVerbs */
\r
620 enum ibv_send_flags send_flags;
\r
621 enum ibv_access_flags mw_access_flags;
\r
626 struct ibv_context *context;
\r
629 IWVSharedReceiveQueue *handle;
\r
634 struct ibv_context *context;
\r
637 struct ibv_cq *send_cq;
\r
638 struct ibv_cq *recv_cq;
\r
639 struct ibv_srq *srq;
\r
640 IWVQueuePair *handle;
\r
643 IWVDatagramQueuePair *ud_handle;
\r
644 IWVConnectQueuePair *conn_handle;
\r
647 enum ibv_qp_state state;
\r
648 enum ibv_qp_type qp_type;
\r
651 struct ibv_comp_channel
\r
653 struct ibv_context *context;
\r
654 COMP_CHANNEL comp_channel;
\r
659 struct ibv_context *context;
\r
660 struct ibv_comp_channel *channel;
\r
662 IWVCompletionQueue *handle;
\r
664 COMP_ENTRY comp_entry;
\r
665 LONG volatile notify_cnt;
\r
666 LONG volatile ack_cnt;
\r
671 struct ibv_context *context;
\r
673 IWVAddressHandle *handle;
\r
678 struct ibv_context;
\r
682 IBV_SYSFS_NAME_MAX = 64
\r
687 enum ibv_node_type node_type;
\r
688 enum ibv_transport_type transport_type;
\r
689 char name[IBV_SYSFS_NAME_MAX];
\r
694 struct ibv_device *device;
\r
696 COMP_CHANNEL channel;
\r
700 * ibv_get_device_list - Get list of IB devices currently available
\r
701 * @num_devices: optional. if non-NULL, set to the number of devices
\r
702 * returned in the array.
\r
704 * Return a NULL-terminated array of IB devices. The array can be
\r
705 * released with ibv_free_device_list().
\r
707 __declspec(dllexport)
\r
708 struct ibv_device **ibv_get_device_list(int *num_devices);
\r
711 * ibv_free_device_list - Free list from ibv_get_device_list()
\r
713 * Free an array of devices returned from ibv_get_device_list(). Once
\r
714 * the array is freed, pointers to devices that were not opened with
\r
715 * ibv_open_device() are no longer valid. Client code must open all
\r
716 * devices it intends to use before calling ibv_free_device_list().
\r
718 __declspec(dllexport)
\r
719 void ibv_free_device_list(struct ibv_device **list);
\r
722 * ibv_get_device_name - Return kernel device name
\r
724 __declspec(dllexport)
\r
725 const char *ibv_get_device_name(struct ibv_device *device);
\r
728 * ibv_get_device_guid - Return device's node GUID
\r
730 __declspec(dllexport)
\r
731 uint64_t ibv_get_device_guid(struct ibv_device *device);
\r
734 * ibv_open_device - Initialize device for use
\r
736 __declspec(dllexport)
\r
737 struct ibv_context *ibv_open_device(struct ibv_device *device);
\r
740 * ibv_close_device - Release device
\r
742 __declspec(dllexport)
\r
743 int ibv_close_device(struct ibv_context *context);
\r
746 * ibv_get_async_event - Get next async event
\r
747 * @event: Pointer to use to return async event
\r
749 * All async events returned by ibv_get_async_event() must eventually
\r
750 * be acknowledged with ibv_ack_async_event().
\r
752 __declspec(dllexport)
\r
753 int ibv_get_async_event(struct ibv_context *context,
\r
754 struct ibv_async_event *event);
\r
757 * ibv_ack_async_event - Acknowledge an async event
\r
758 * @event: Event to be acknowledged.
\r
760 * All async events which are returned by ibv_get_async_event() must
\r
761 * be acknowledged. To avoid races, destroying an object (CQ, SRQ or
\r
762 * QP) will wait for all affiliated events to be acknowledged, so
\r
763 * there should be a one-to-one correspondence between acks and
\r
766 __declspec(dllexport)
\r
767 void ibv_ack_async_event(struct ibv_async_event *event);
\r
770 * ibv_query_device - Get device properties
\r
772 __declspec(dllexport)
\r
773 int ibv_query_device(struct ibv_context *context,
\r
774 struct ibv_device_attr *device_attr);
\r
777 * ibv_query_port - Get port properties
\r
779 __declspec(dllexport)
\r
780 int ibv_query_port(struct ibv_context *context, uint8_t port_num,
\r
781 struct ibv_port_attr *port_attr);
\r
784 * ibv_query_gid - Get a GID table entry
\r
786 __declspec(dllexport)
\r
787 int ibv_query_gid(struct ibv_context *context, uint8_t port_num,
\r
788 int index, union ibv_gid *gid);
\r
791 * ibv_query_pkey - Get a P_Key table entry
\r
793 __declspec(dllexport)
\r
794 int ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
\r
795 int index, uint16_t *pkey);
\r
798 * ibv_alloc_pd - Allocate a protection domain
\r
800 __declspec(dllexport)
\r
801 struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);
\r
804 * ibv_dealloc_pd - Free a protection domain
\r
806 __declspec(dllexport)
\r
807 int ibv_dealloc_pd(struct ibv_pd *pd);
\r
810 * ibv_reg_mr - Register a memory region
\r
812 __declspec(dllexport)
\r
813 struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr,
\r
814 size_t length, enum ibv_access_flags access);
\r
817 * ibv_dereg_mr - Deregister a memory region
\r
819 __declspec(dllexport)
\r
820 int ibv_dereg_mr(struct ibv_mr *mr);
\r
823 * ibv_create_comp_channel - Create a completion event channel
\r
825 __declspec(dllexport)
\r
826 struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context);
\r
829 * ibv_destroy_comp_channel - Destroy a completion event channel
\r
831 __declspec(dllexport)
\r
832 int ibv_destroy_comp_channel(struct ibv_comp_channel *channel);
\r
835 * ibv_create_cq - Create a completion queue
\r
836 * @context - Context CQ will be attached to
\r
837 * @cqe - Minimum number of entries required for CQ
\r
838 * @cq_context - Consumer-supplied context returned for completion events
\r
839 * @channel - Completion channel where completion events will be queued.
\r
840 * May be NULL if completion events will not be used.
\r
841 * @comp_vector - Completion vector used to signal completion events.
\r
842 * Must be >= 0 and < context->num_comp_vectors.
\r
844 __declspec(dllexport)
\r
845 struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe,
\r
847 struct ibv_comp_channel *channel,
\r
851 * ibv_resize_cq - Modifies the capacity of the CQ.
\r
852 * @cq: The CQ to resize.
\r
853 * @cqe: The minimum size of the CQ.
\r
855 * Users can examine the cq structure to determine the actual CQ size.
\r
857 __declspec(dllexport)
\r
858 int ibv_resize_cq(struct ibv_cq *cq, int cqe);
\r
861 * ibv_destroy_cq - Destroy a completion queue
\r
863 __declspec(dllexport)
\r
864 int ibv_destroy_cq(struct ibv_cq *cq);
\r
867 * ibv_get_cq_event - Read next CQ event
\r
868 * @channel: Channel to get next event from.
\r
869 * @cq: Used to return pointer to CQ.
\r
870 * @cq_context: Used to return consumer-supplied CQ context.
\r
872 * All completion events returned by ibv_get_cq_event() must
\r
873 * eventually be acknowledged with ibv_ack_cq_events().
\r
875 __declspec(dllexport)
\r
876 int ibv_get_cq_event(struct ibv_comp_channel *channel,
\r
877 struct ibv_cq **cq, void **cq_context);
\r
880 * ibv_ack_cq_events - Acknowledge CQ completion events
\r
881 * @cq: CQ to acknowledge events for
\r
882 * @nevents: Number of events to acknowledge.
\r
884 * All completion events which are returned by ibv_get_cq_event() must
\r
885 * be acknowledged. To avoid races, ibv_destroy_cq() will wait for
\r
886 * all completion events to be acknowledged, so there should be a
\r
887 * one-to-one correspondence between acks and successful gets. An
\r
888 * application may accumulate multiple completion events and
\r
889 * acknowledge them in a single call to ibv_ack_cq_events() by passing
\r
890 * the number of events to ack in @nevents.
\r
892 __declspec(dllexport)
\r
893 void ibv_ack_cq_events(struct ibv_cq *cq, unsigned int nevents);
\r
896 * ibv_poll_cq - Poll a CQ for work completions
\r
897 * @cq:the CQ being polled
\r
898 * @num_entries:maximum number of completions to return
\r
899 * @wc:array of at least @num_entries of &struct ibv_wc where completions
\r
902 * Poll a CQ for (possibly multiple) completions. If the return value
\r
903 * is < 0, an error occurred. If the return value is >= 0, it is the
\r
904 * number of completions returned. If the return value is
\r
905 * non-negative and strictly less than num_entries, then the CQ was
\r
908 __declspec(dllexport)
\r
909 int ibv_poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc);
\r
912 * ibv_req_notify_cq - Request completion notification on a CQ. An
\r
913 * event will be added to the completion channel associated with the
\r
914 * CQ when an entry is added to the CQ.
\r
915 * @cq: The completion queue to request notification for.
\r
916 * @solicited_only: If non-zero, an event will be generated only for
\r
917 * the next solicited CQ entry. If zero, any CQ entry, solicited or
\r
918 * not, will generate an event.
\r
920 __declspec(dllexport)
\r
921 int ibv_req_notify_cq(struct ibv_cq *cq, int solicited_only);
\r
924 * ibv_create_srq - Creates a SRQ associated with the specified protection
\r
926 * @pd: The protection domain associated with the SRQ.
\r
927 * @srq_init_attr: A list of initial attributes required to create the SRQ.
\r
929 * srq_attr->max_wr and srq_attr->max_sge are read the determine the
\r
930 * requested size of the SRQ, and set to the actual values allocated
\r
931 * on return. If ibv_create_srq() succeeds, then max_wr and max_sge
\r
932 * will always be at least as large as the requested values.
\r
934 __declspec(dllexport)
\r
935 struct ibv_srq *ibv_create_srq(struct ibv_pd *pd,
\r
936 struct ibv_srq_init_attr *srq_init_attr);
\r
939 * ibv_modify_srq - Modifies the attributes for the specified SRQ.
\r
940 * @srq: The SRQ to modify.
\r
941 * @srq_attr: On input, specifies the SRQ attributes to modify. On output,
\r
942 * the current values of selected SRQ attributes are returned.
\r
943 * @srq_attr_mask: A bit-mask used to specify which attributes of the SRQ
\r
944 * are being modified.
\r
946 * The mask may contain IBV_SRQ_MAX_WR to resize the SRQ and/or
\r
947 * IBV_SRQ_LIMIT to set the SRQ's limit and request notification when
\r
948 * the number of receives queued drops below the limit.
\r
950 __declspec(dllexport)
\r
951 int ibv_modify_srq(struct ibv_srq *srq,
\r
952 struct ibv_srq_attr *srq_attr,
\r
953 enum ibv_srq_attr_mask srq_attr_mask);
\r
956 * ibv_query_srq - Returns the attribute list and current values for the
\r
958 * @srq: The SRQ to query.
\r
959 * @srq_attr: The attributes of the specified SRQ.
\r
961 __declspec(dllexport)
\r
962 int ibv_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr);
\r
965 * ibv_destroy_srq - Destroys the specified SRQ.
\r
966 * @srq: The SRQ to destroy.
\r
968 __declspec(dllexport)
\r
969 int ibv_destroy_srq(struct ibv_srq *srq);
\r
972 * ibv_post_srq_recv - Posts a list of work requests to the specified SRQ.
\r
973 * @srq: The SRQ to post the work request on.
\r
974 * @recv_wr: A list of work requests to post on the receive queue.
\r
975 * @bad_recv_wr: On an immediate failure, this parameter will reference
\r
976 * the work request that failed to be posted on the QP.
\r
978 __declspec(dllexport)
\r
979 int ibv_post_srq_recv(struct ibv_srq *srq,
\r
980 struct ibv_recv_wr *recv_wr,
\r
981 struct ibv_recv_wr **bad_recv_wr);
\r
984 * ibv_create_qp - Create a queue pair.
\r
986 __declspec(dllexport)
\r
987 struct ibv_qp *ibv_create_qp(struct ibv_pd *pd,
\r
988 struct ibv_qp_init_attr *qp_init_attr);
\r
991 * ibv_modify_qp - Modify a queue pair.
\r
993 __declspec(dllexport)
\r
994 int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
\r
995 enum ibv_qp_attr_mask attr_mask);
\r
998 * ibv_query_qp - Returns the attribute list and current values for the
\r
1000 * @qp: The QP to query.
\r
1001 * @attr: The attributes of the specified QP.
\r
1002 * @attr_mask: A bit-mask used to select specific attributes to query.
\r
1003 * @init_attr: Additional attributes of the selected QP.
\r
1005 * The qp_attr_mask may be used to limit the query to gathering only the
\r
1006 * selected attributes.
\r
1008 __declspec(dllexport)
\r
1009 int ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
\r
1010 enum ibv_qp_attr_mask attr_mask,
\r
1011 struct ibv_qp_init_attr *init_attr);
\r
1014 * ibv_destroy_qp - Destroy a queue pair.
\r
1016 __declspec(dllexport)
\r
1017 int ibv_destroy_qp(struct ibv_qp *qp);
\r
1020 * ibv_post_send - Post a list of work requests to a send queue.
\r
1022 * If IBV_SEND_INLINE flag is set, the data buffers can be reused
\r
1023 * immediately after the call returns.
\r
1025 __declspec(dllexport)
\r
1026 int ibv_post_send(struct ibv_qp *qp, struct ibv_send_wr *wr,
\r
1027 struct ibv_send_wr **bad_wr);
\r
1030 * ibv_post_recv - Post a list of work requests to a receive queue.
\r
1032 __declspec(dllexport)
\r
1033 int ibv_post_recv(struct ibv_qp *qp, struct ibv_recv_wr *wr,
\r
1034 struct ibv_recv_wr **bad_wr);
\r
1037 * ibv_create_ah - Create an address handle.
\r
1039 __declspec(dllexport)
\r
1040 struct ibv_ah *ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr);
\r
1043 * ibv_init_ah_from_wc - Initializes address handle attributes from a
\r
1044 * work completion.
\r
1045 * @context: Device context on which the received message arrived.
\r
1046 * @port_num: Port on which the received message arrived.
\r
1047 * @wc: Work completion associated with the received message.
\r
1048 * @grh: References the received global route header. This parameter is
\r
1049 * ignored unless the work completion indicates that the GRH is valid.
\r
1050 * @ah_attr: Returned attributes that can be used when creating an address
\r
1051 * handle for replying to the message.
\r
1053 __declspec(dllexport)
\r
1054 int ibv_init_ah_from_wc(struct ibv_context *context, uint8_t port_num,
\r
1055 struct ibv_wc *wc, struct ibv_grh *grh,
\r
1056 struct ibv_ah_attr *ah_attr);
\r
1059 * ibv_create_ah_from_wc - Creates an address handle associated with the
\r
1060 * sender of the specified work completion.
\r
1061 * @pd: The protection domain associated with the address handle.
\r
1062 * @wc: Work completion information associated with a received message.
\r
1063 * @grh: References the received global route header. This parameter is
\r
1064 * ignored unless the work completion indicates that the GRH is valid.
\r
1065 * @port_num: The outbound port number to associate with the address.
\r
1067 * The address handle is used to reference a local or global destination
\r
1068 * in all UD QP post sends.
\r
1070 __declspec(dllexport)
\r
1071 struct ibv_ah *ibv_create_ah_from_wc(struct ibv_pd *pd, struct ibv_wc *wc,
\r
1072 struct ibv_grh *grh, uint8_t port_num);
\r
1075 * ibv_destroy_ah - Destroy an address handle.
\r
1077 __declspec(dllexport)
\r
1078 int ibv_destroy_ah(struct ibv_ah *ah);
\r
1081 * ibv_attach_mcast - Attaches the specified QP to a multicast group.
\r
1082 * @qp: QP to attach to the multicast group. The QP must be a UD QP.
\r
1083 * @gid: Multicast group GID.
\r
1084 * @lid: Multicast group LID in host byte order.
\r
1086 * In order to route multicast packets correctly, subnet
\r
1087 * administration must have created the multicast group and configured
\r
1088 * the fabric appropriately. The port associated with the specified
\r
1089 * QP must also be a member of the multicast group.
\r
1091 __declspec(dllexport)
\r
1092 int ibv_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
\r
1095 * ibv_detach_mcast - Detaches the specified QP from a multicast group.
\r
1096 * @qp: QP to detach from the multicast group.
\r
1097 * @gid: Multicast group GID.
\r
1098 * @lid: Multicast group LID in host byte order.
\r
1100 __declspec(dllexport)
\r
1101 int ibv_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
\r
1104 * ibv_node_type_str - Return string describing node_type enum value
\r
1106 __declspec(dllexport)
\r
1107 const char *ibv_node_type_str(enum ibv_node_type node_type);
\r
1110 * ibv_port_state_str - Return string describing port_state enum value
\r
1112 __declspec(dllexport)
\r
1113 const char *ibv_port_state_str(enum ibv_port_state port_state);
\r
1116 * ibv_event_type_str - Return string describing event_type enum value
\r
1118 __declspec(dllexport)
\r
1119 const char *ibv_event_type_str(enum ibv_event_type event);
\r
1122 * Windows specific structures and interfaces
\r
1124 struct ibvw_windata
\r
1126 IWVProvider *prov;
\r
1127 COMP_MANAGER *comp_mgr;
\r
1130 #define IBVW_WINDATA_VERSION 1
\r
1132 __declspec(dllexport)
\r
1133 int ibvw_get_windata(struct ibvw_windata *windata, int version);
\r
1135 __declspec(dllexport)
\r
1136 void ibvw_release_windata(struct ibvw_windata *windata, int version);
\r
1138 #ifdef __cplusplus
\r
1142 #endif /* INFINIBAND_VERBS_H */
\r