Debian Codegraph @

libibverbs/man/ibv_create_cq_ex.3

raw
1 .\" -*- nroff -*-
2 .\" Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md
3 .\"
4 .TH IBV_CREATE_CQ_EX 3 2016-05-08 libibverbs "Libibverbs Programmer's Manual"
5 .SH "NAME"
6 ibv_create_cq_ex \- create a completion queue (CQ)
7 .SH "SYNOPSIS"
8 .nf
9 .B #include <infiniband/verbs.h>
10 .sp
11 .BI "struct ibv_cq_ex *ibv_create_cq_ex(struct ibv_context " "*context" ",
12 .BI " struct ibv_cq_init_attr_ex " "*cq_attr" );
13 .fi
14 .SH "DESCRIPTION"
15 .B ibv_create_cq_ex()
16 creates a completion queue (CQ) for RDMA device context
17 .I context\fR.
18 The argument
19 .I cq_attr
20 is a pointer to struct ibv_cq_init_attr_ex as defined in <infiniband/verbs.h>.
21 .PP
22 .nf
23 struct ibv_cq_init_attr_ex {
24 .in +8
25 int cqe; /* Minimum number of entries required for CQ */
26 void *cq_context; /* Consumer-supplied context returned for completion events */
27 struct ibv_comp_channel *channel; /* Completion channel where completion events will be queued. May be NULL if completion events will not be used. */
28 int comp_vector; /* Completion vector used to signal completion events. Must be >= 0 and < context->num_comp_vectors. */
29 uint64_t wc_flags; /* The wc_flags that should be returned in ibv_poll_cq_ex. Or'ed bit of enum ibv_wc_flags_ex. */
30 uint32_t comp_mask; /* compatibility mask (extended verb). */
31 uint32_t flags /* One or more flags from enum ibv_create_cq_attr_flags */
32 struct ibv_pd *parent_domain; /* Parent domain to be used by this CQ */
33 .in -8
34 };
35
36 enum ibv_wc_flags_ex {
37 IBV_WC_EX_WITH_BYTE_LEN = 1 << 0, /* Require byte len in WC */
38 IBV_WC_EX_WITH_IMM = 1 << 1, /* Require immediate in WC */
39 IBV_WC_EX_WITH_QP_NUM = 1 << 2, /* Require QP number in WC */
40 IBV_WC_EX_WITH_SRC_QP = 1 << 3, /* Require source QP in WC */
41 IBV_WC_EX_WITH_SLID = 1 << 4, /* Require slid in WC */
42 IBV_WC_EX_WITH_SL = 1 << 5, /* Require sl in WC */
43 IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 6, /* Require dlid path bits in WC */
44 IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 7, /* Require completion device timestamp in WC /*
45 IBV_WC_EX_WITH_CVLAN = 1 << 8, /* Require VLAN info in WC */
46 IBV_WC_EX_WITH_FLOW_TAG = 1 << 9, /* Require flow tag in WC */
47 IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK = 1 << 11, /* Require completion wallclock timestamp in WC */
48 };
49
50 enum ibv_cq_init_attr_mask {
51 IBV_CQ_INIT_ATTR_MASK_FLAGS = 1 << 0,
52 IBV_CQ_INIT_ATTR_MASK_PD = 1 << 1,
53 };
54
55 enum ibv_create_cq_attr_flags {
56 IBV_CREATE_CQ_ATTR_SINGLE_THREADED = 1 << 0, /* This CQ is used from a single threaded, thus no locking is required */
57 IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN = 1 << 1, /* This CQ will not pass to error state if overrun, CQE always will be written to next entry.
58 * An application must be designed to avoid ever overflowing the CQ, otherwise CQEs might be lost.
59 */
60 };
61
62 .SH "Polling an extended CQ"
63 In order to poll an extended CQ efficiently, a user could use the following functions.
64
65 .TP
66 .B Completion iterator functions
67
68 .BI "int ibv_start_poll(struct ibv_cq_ex " "*cq" ", struct ibv_poll_cq_attr " "*attr")
69 .br
70 Start polling a batch of work completions.
71 .I attr
72 is given in order to make this function
73 easily extensible in the future. This function either returns 0 on success or an error code
74 otherwise. When no completions are available on the CQ, ENOENT is returned, but the CQ remains
75 in a valid state. On success, querying the completion's attribute could be done using the query
76 functions described below. If an error code is given, end_poll shouldn't be called.
77
78 .BI "int ibv_next_poll(struct ibv_cq_ex " "*cq")
79 .br
80 This function is called in order to get the next work completion. It has to be called after
81 .I start_poll
82 and before
83 .I end_poll
84 are called. This function either returns 0 on success or an error code
85 otherwise. When no completions are available on the CQ, ENOENT is returned, but the CQ remains
86 in a valid state. On success, querying the completion's attribute could be done using the query
87 functions described below. If an error code is given, end_poll should still be called,
88 indicating this is the end of the polled batch.
89
90 .BI "void ibv_end_poll(struct ibv_cq_ex " "*cq")
91 .br
92 This function indicates the end of polling batch of work completions. After calling this function, the user should start a new batch
93 by calling
94 .I start_poll.
95
96 .TP
97 .B Polling fields in the completion
98 Below members and functions are used in order to poll the current completion. The current completion is the completion which the iterator points to (start_poll and next_poll advances this iterator). Only fields that the user requested via wc_flags in ibv_create_cq_ex could be queried. In addition, some fields are only valid in certain opcodes and status codes.
99
100 .BI "uint64_t wr_id - Can be accessed directly from struct ibv_cq_ex".
101
102 .BI "enum ibv_wc_status - Can be accessed directly from struct ibv_cq_ex".
103
104 .BI "enum ibv_wc_opcode ibv_wc_read_opcode(struct ibv_cq_ex " "*cq"); \c
105 Get the opcode from the current completion.
106
107 .BI "uint32_t ibv_wc_read_vendor_err(struct ibv_cq_ex " "*cq"); \c
108 Get the vendor error from the current completion.
109
110 .BI "uint32_t ibv_wc_read_byte_len(struct ibv_cq_ex " "*cq"); \c
111 Get the payload length from the current completion.
112
113 .BI "__be32 ibv_wc_read_imm_data(struct ibv_cq_ex " "*cq"); \c
114 Get the immediate data field from the current completion.
115
116 .BI "uint32_t ibv_wc_read_invalidated_rkey(struct ibv_cq_ex " "*cq"); \c
117 Get the rkey invalided by the SEND_INVAL from the current completion.
118
119 .BI "uint32_t ibv_wc_read_qp_num(struct ibv_cq_ex " "*cq"); \c
120 Get the QP number field from the current completion.
121
122 .BI "uint32_t ibv_wc_read_src_qp(struct ibv_cq_ex " "*cq"); \c
123 Get the source QP number field from the current completion.
124
125 .BI "unsigned int ibv_wc_read_wc_flags(struct ibv_cq_ex " "*cq"); \c
126 Get the QP flags field from the current completion.
127
128 .BI "uint16_t ibv_wc_read_pkey_index(struct ibv_cq_ex " "*cq"); \c
129 Get the pkey index field from the current completion.
130
131 .BI "uint32_t ibv_wc_read_slid(struct ibv_cq_ex " "*cq"); \c
132 Get the slid field from the current completion.
133
134 .BI "uint8_t ibv_wc_read_sl(struct ibv_cq_ex " "*cq"); \c
135 Get the sl field from the current completion.
136
137 .BI "uint8_t ibv_wc_read_dlid_path_bits(struct ibv_cq_ex " "*cq"); \c
138 Get the dlid_path_bits field from the current completion.
139
140 .BI "uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex " "*cq"); \c
141 Get the completion timestamp from the current completion in HCA clock units.
142
143 .BI "uint64_t ibv_wc_read_completion_wallclock_ns(struct ibv_cq_ex " *cq ");
144 Get the completion timestamp from the current completion and convert it
145 from HCA clock units to wall clock nanoseconds.
146
147 .BI "uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex " "*cq"); \c
148 Get the CVLAN field from the current completion.
149
150 .BI "uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex " "*cq"); \c
151 Get flow tag from the current completion.
152
153 .BI "void ibv_wc_read_tm_info(struct ibv_cq_ex " *cq ","
154 .BI "struct ibv_wc_tm_info " *tm_info "); \c
155 Get tag matching info from the current completion.
156 .nf
157 struct ibv_wc_tm_info {
158 .in +8
159 uint64_t tag; /* tag from TMH */
160 uint32_t priv; /* opaque user data from TMH */
161 .in -8
162 };
163
164 .SH "RETURN VALUE"
165 .B ibv_create_cq_ex()
166 returns a pointer to the CQ, or NULL if the request fails.
167 .SH "NOTES"
168 .B ibv_create_cq_ex()
169 may create a CQ with size greater than or equal to the requested
170 size. Check the cqe attribute in the returned CQ for the actual size.
171 .PP
172 CQ should be destroyed with ibv_destroy_cq.
173 .PP
174 .SH "SEE ALSO"
175 .BR ibv_create_cq (3),
176 .BR ibv_destroy_cq (3),
177 .BR ibv_resize_cq (3),
178 .BR ibv_req_notify_cq (3),
179 .BR ibv_ack_cq_events (3),
180 .BR ibv_create_qp (3),
181 .BR ibv_alloc_parent_domain (3)
182 .SH "AUTHORS"
183 .TP
184 Matan Barak <[email protected]>