46 #include <linux/slab.h>
63 spin_unlock_irqrestore(&cq->
spinlock, flags);
85 "removed qp from cq .cq_num=%x real_qp_num=%x",
91 spin_unlock_irqrestore(&cq->
spinlock, flags);
94 "qp not found cq_num=%x real_qp_num=%x",
120 static const u32 additional_cqe = 20;
130 u64 rpage, cqx_fec, h_ret;
134 if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
138 ehca_err(device,
"Unable to create CQ, max number of %i "
140 ehca_err(device,
"To increase the maximum number of CQs "
141 "use the number_of_cqs module parameter.\n");
145 my_cq = kmem_cache_zalloc(cq_cache,
GFP_KERNEL);
147 ehca_err(device,
"Out of memory for ehca_cq struct device=%p",
169 ehca_err(device,
"Can't reserve idr nr. device=%p",
171 goto create_cq_exit1;
181 ehca_err(device,
"Can't allocate new idr entry. device=%p",
183 goto create_cq_exit1;
186 if (my_cq->
token > 0x1FFFFFF) {
188 ehca_err(device,
"Invalid number of cq. device=%p", device);
189 goto create_cq_exit2;
196 param.
nr_cqe = cqe + additional_cqe;
199 if (h_ret != H_SUCCESS) {
200 ehca_err(device,
"hipz_h_alloc_resource_cq() failed "
201 "h_ret=%lli device=%p", h_ret, device);
203 goto create_cq_exit2;
209 ehca_err(device,
"ipz_queue_ctor() failed ipz_rc=%i device=%p",
212 goto create_cq_exit3;
215 for (counter = 0; counter < param.
act_pages; counter++) {
218 ehca_err(device,
"ipz_qpageit_get_inc() "
219 "returns NULL device=%p", device);
221 goto create_cq_exit4;
235 if (h_ret < H_SUCCESS) {
236 ehca_err(device,
"hipz_h_register_rpage_cq() failed "
237 "ehca_cq=%p cq_num=%x h_ret=%lli counter=%i "
241 goto create_cq_exit4;
246 if ((h_ret != H_SUCCESS) || vpage) {
247 ehca_err(device,
"Registration of pages not "
248 "complete ehca_cq=%p cq_num=%x "
252 goto create_cq_exit4;
255 if (h_ret != H_PAGE_REGISTERED) {
256 ehca_err(device,
"Registration of page failed "
257 "ehca_cq=%p cq_num=%x h_ret=%lli "
258 "counter=%i act_pages=%i",
262 goto create_cq_exit4;
269 gal = my_cq->
galpas.kernel;
271 ehca_dbg(device,
"ehca_cq=%p cq_num=%x CQX_FEC=%llx",
287 memset(&resp, 0,
sizeof(resp));
297 if (ib_copy_to_udata(udata, &resp,
sizeof(resp))) {
298 ehca_err(device,
"Copy to udata failed.");
299 goto create_cq_exit4;
310 if (h_ret != H_SUCCESS)
311 ehca_err(device,
"hipz_h_destroy_cq() failed ehca_cq=%p "
312 "cq_num=%x h_ret=%lli", my_cq, my_cq->
cq_number, h_ret);
339 ehca_err(device,
"Resources still referenced in "
340 "user space cq_num=%x", my_cq->
cq_number);
358 if (h_ret == H_R_STATE) {
360 ehca_dbg(device,
"ehca_cq=%p cq_num=%x resource=%llx in err "
361 "state. Try to delete it forcibly.",
365 if (h_ret == H_SUCCESS)
366 ehca_dbg(device,
"cq_num=%x deleted successfully.",
369 if (h_ret != H_SUCCESS) {
370 ehca_err(device,
"hipz_h_destroy_cq() failed h_ret=%lli "
371 "ehca_cq=%p cq_num=%x", h_ret, my_cq, cq_num);