diff options
Diffstat (limited to 'drivers/net/ehea/ehea_qmr.c')
-rw-r--r-- | drivers/net/ehea/ehea_qmr.c | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index 89128b6373e3..cd44bb8017d9 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
30 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
31 | #include "ehea.h" | 33 | #include "ehea.h" |
@@ -45,7 +47,7 @@ static void *hw_qpageit_get_inc(struct hw_queue *queue) | |||
45 | queue->current_q_offset -= queue->pagesize; | 47 | queue->current_q_offset -= queue->pagesize; |
46 | retvalue = NULL; | 48 | retvalue = NULL; |
47 | } else if (((u64) retvalue) & (EHEA_PAGESIZE-1)) { | 49 | } else if (((u64) retvalue) & (EHEA_PAGESIZE-1)) { |
48 | ehea_error("not on pageboundary"); | 50 | pr_err("not on pageboundary\n"); |
49 | retvalue = NULL; | 51 | retvalue = NULL; |
50 | } | 52 | } |
51 | return retvalue; | 53 | return retvalue; |
@@ -58,15 +60,15 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages, | |||
58 | int i, k; | 60 | int i, k; |
59 | 61 | ||
60 | if ((pagesize > PAGE_SIZE) || (!pages_per_kpage)) { | 62 | if ((pagesize > PAGE_SIZE) || (!pages_per_kpage)) { |
61 | ehea_error("pagesize conflict! kernel pagesize=%d, " | 63 | pr_err("pagesize conflict! kernel pagesize=%d, ehea pagesize=%d\n", |
62 | "ehea pagesize=%d", (int)PAGE_SIZE, (int)pagesize); | 64 | (int)PAGE_SIZE, (int)pagesize); |
63 | return -EINVAL; | 65 | return -EINVAL; |
64 | } | 66 | } |
65 | 67 | ||
66 | queue->queue_length = nr_of_pages * pagesize; | 68 | queue->queue_length = nr_of_pages * pagesize; |
67 | queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL); | 69 | queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL); |
68 | if (!queue->queue_pages) { | 70 | if (!queue->queue_pages) { |
69 | ehea_error("no mem for queue_pages"); | 71 | pr_err("no mem for queue_pages\n"); |
70 | return -ENOMEM; | 72 | return -ENOMEM; |
71 | } | 73 | } |
72 | 74 | ||
@@ -130,7 +132,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
130 | 132 | ||
131 | cq = kzalloc(sizeof(*cq), GFP_KERNEL); | 133 | cq = kzalloc(sizeof(*cq), GFP_KERNEL); |
132 | if (!cq) { | 134 | if (!cq) { |
133 | ehea_error("no mem for cq"); | 135 | pr_err("no mem for cq\n"); |
134 | goto out_nomem; | 136 | goto out_nomem; |
135 | } | 137 | } |
136 | 138 | ||
@@ -147,7 +149,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
147 | hret = ehea_h_alloc_resource_cq(adapter->handle, &cq->attr, | 149 | hret = ehea_h_alloc_resource_cq(adapter->handle, &cq->attr, |
148 | &cq->fw_handle, &cq->epas); | 150 | &cq->fw_handle, &cq->epas); |
149 | if (hret != H_SUCCESS) { | 151 | if (hret != H_SUCCESS) { |
150 | ehea_error("alloc_resource_cq failed"); | 152 | pr_err("alloc_resource_cq failed\n"); |
151 | goto out_freemem; | 153 | goto out_freemem; |
152 | } | 154 | } |
153 | 155 | ||
@@ -159,7 +161,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
159 | for (counter = 0; counter < cq->attr.nr_pages; counter++) { | 161 | for (counter = 0; counter < cq->attr.nr_pages; counter++) { |
160 | vpage = hw_qpageit_get_inc(&cq->hw_queue); | 162 | vpage = hw_qpageit_get_inc(&cq->hw_queue); |
161 | if (!vpage) { | 163 | if (!vpage) { |
162 | ehea_error("hw_qpageit_get_inc failed"); | 164 | pr_err("hw_qpageit_get_inc failed\n"); |
163 | goto out_kill_hwq; | 165 | goto out_kill_hwq; |
164 | } | 166 | } |
165 | 167 | ||
@@ -168,9 +170,8 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
168 | 0, EHEA_CQ_REGISTER_ORIG, | 170 | 0, EHEA_CQ_REGISTER_ORIG, |
169 | cq->fw_handle, rpage, 1); | 171 | cq->fw_handle, rpage, 1); |
170 | if (hret < H_SUCCESS) { | 172 | if (hret < H_SUCCESS) { |
171 | ehea_error("register_rpage_cq failed ehea_cq=%p " | 173 | pr_err("register_rpage_cq failed ehea_cq=%p hret=%llx counter=%i act_pages=%i\n", |
172 | "hret=%llx counter=%i act_pages=%i", | 174 | cq, hret, counter, cq->attr.nr_pages); |
173 | cq, hret, counter, cq->attr.nr_pages); | ||
174 | goto out_kill_hwq; | 175 | goto out_kill_hwq; |
175 | } | 176 | } |
176 | 177 | ||
@@ -178,14 +179,14 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
178 | vpage = hw_qpageit_get_inc(&cq->hw_queue); | 179 | vpage = hw_qpageit_get_inc(&cq->hw_queue); |
179 | 180 | ||
180 | if ((hret != H_SUCCESS) || (vpage)) { | 181 | if ((hret != H_SUCCESS) || (vpage)) { |
181 | ehea_error("registration of pages not " | 182 | pr_err("registration of pages not complete hret=%llx\n", |
182 | "complete hret=%llx\n", hret); | 183 | hret); |
183 | goto out_kill_hwq; | 184 | goto out_kill_hwq; |
184 | } | 185 | } |
185 | } else { | 186 | } else { |
186 | if (hret != H_PAGE_REGISTERED) { | 187 | if (hret != H_PAGE_REGISTERED) { |
187 | ehea_error("CQ: registration of page failed " | 188 | pr_err("CQ: registration of page failed hret=%llx\n", |
188 | "hret=%llx\n", hret); | 189 | hret); |
189 | goto out_kill_hwq; | 190 | goto out_kill_hwq; |
190 | } | 191 | } |
191 | } | 192 | } |
@@ -241,7 +242,7 @@ int ehea_destroy_cq(struct ehea_cq *cq) | |||
241 | } | 242 | } |
242 | 243 | ||
243 | if (hret != H_SUCCESS) { | 244 | if (hret != H_SUCCESS) { |
244 | ehea_error("destroy CQ failed"); | 245 | pr_err("destroy CQ failed\n"); |
245 | return -EIO; | 246 | return -EIO; |
246 | } | 247 | } |
247 | 248 | ||
@@ -259,7 +260,7 @@ struct ehea_eq *ehea_create_eq(struct ehea_adapter *adapter, | |||
259 | 260 | ||
260 | eq = kzalloc(sizeof(*eq), GFP_KERNEL); | 261 | eq = kzalloc(sizeof(*eq), GFP_KERNEL); |
261 | if (!eq) { | 262 | if (!eq) { |
262 | ehea_error("no mem for eq"); | 263 | pr_err("no mem for eq\n"); |
263 | return NULL; | 264 | return NULL; |
264 | } | 265 | } |
265 | 266 | ||
@@ -272,21 +273,21 @@ struct ehea_eq *ehea_create_eq(struct ehea_adapter *adapter, | |||
272 | hret = ehea_h_alloc_resource_eq(adapter->handle, | 273 | hret = ehea_h_alloc_resource_eq(adapter->handle, |
273 | &eq->attr, &eq->fw_handle); | 274 | &eq->attr, &eq->fw_handle); |
274 | if (hret != H_SUCCESS) { | 275 | if (hret != H_SUCCESS) { |
275 | ehea_error("alloc_resource_eq failed"); | 276 | pr_err("alloc_resource_eq failed\n"); |
276 | goto out_freemem; | 277 | goto out_freemem; |
277 | } | 278 | } |
278 | 279 | ||
279 | ret = hw_queue_ctor(&eq->hw_queue, eq->attr.nr_pages, | 280 | ret = hw_queue_ctor(&eq->hw_queue, eq->attr.nr_pages, |
280 | EHEA_PAGESIZE, sizeof(struct ehea_eqe)); | 281 | EHEA_PAGESIZE, sizeof(struct ehea_eqe)); |
281 | if (ret) { | 282 | if (ret) { |
282 | ehea_error("can't allocate eq pages"); | 283 | pr_err("can't allocate eq pages\n"); |
283 | goto out_freeres; | 284 | goto out_freeres; |
284 | } | 285 | } |
285 | 286 | ||
286 | for (i = 0; i < eq->attr.nr_pages; i++) { | 287 | for (i = 0; i < eq->attr.nr_pages; i++) { |
287 | vpage = hw_qpageit_get_inc(&eq->hw_queue); | 288 | vpage = hw_qpageit_get_inc(&eq->hw_queue); |
288 | if (!vpage) { | 289 | if (!vpage) { |
289 | ehea_error("hw_qpageit_get_inc failed"); | 290 | pr_err("hw_qpageit_get_inc failed\n"); |
290 | hret = H_RESOURCE; | 291 | hret = H_RESOURCE; |
291 | goto out_kill_hwq; | 292 | goto out_kill_hwq; |
292 | } | 293 | } |
@@ -370,7 +371,7 @@ int ehea_destroy_eq(struct ehea_eq *eq) | |||
370 | } | 371 | } |
371 | 372 | ||
372 | if (hret != H_SUCCESS) { | 373 | if (hret != H_SUCCESS) { |
373 | ehea_error("destroy EQ failed"); | 374 | pr_err("destroy EQ failed\n"); |
374 | return -EIO; | 375 | return -EIO; |
375 | } | 376 | } |
376 | 377 | ||
@@ -395,7 +396,7 @@ int ehea_qp_alloc_register(struct ehea_qp *qp, struct hw_queue *hw_queue, | |||
395 | for (cnt = 0; cnt < nr_pages; cnt++) { | 396 | for (cnt = 0; cnt < nr_pages; cnt++) { |
396 | vpage = hw_qpageit_get_inc(hw_queue); | 397 | vpage = hw_qpageit_get_inc(hw_queue); |
397 | if (!vpage) { | 398 | if (!vpage) { |
398 | ehea_error("hw_qpageit_get_inc failed"); | 399 | pr_err("hw_qpageit_get_inc failed\n"); |
399 | goto out_kill_hwq; | 400 | goto out_kill_hwq; |
400 | } | 401 | } |
401 | rpage = virt_to_abs(vpage); | 402 | rpage = virt_to_abs(vpage); |
@@ -403,7 +404,7 @@ int ehea_qp_alloc_register(struct ehea_qp *qp, struct hw_queue *hw_queue, | |||
403 | 0, h_call_q_selector, | 404 | 0, h_call_q_selector, |
404 | qp->fw_handle, rpage, 1); | 405 | qp->fw_handle, rpage, 1); |
405 | if (hret < H_SUCCESS) { | 406 | if (hret < H_SUCCESS) { |
406 | ehea_error("register_rpage_qp failed"); | 407 | pr_err("register_rpage_qp failed\n"); |
407 | goto out_kill_hwq; | 408 | goto out_kill_hwq; |
408 | } | 409 | } |
409 | } | 410 | } |
@@ -432,7 +433,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
432 | 433 | ||
433 | qp = kzalloc(sizeof(*qp), GFP_KERNEL); | 434 | qp = kzalloc(sizeof(*qp), GFP_KERNEL); |
434 | if (!qp) { | 435 | if (!qp) { |
435 | ehea_error("no mem for qp"); | 436 | pr_err("no mem for qp\n"); |
436 | return NULL; | 437 | return NULL; |
437 | } | 438 | } |
438 | 439 | ||
@@ -441,7 +442,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
441 | hret = ehea_h_alloc_resource_qp(adapter->handle, init_attr, pd, | 442 | hret = ehea_h_alloc_resource_qp(adapter->handle, init_attr, pd, |
442 | &qp->fw_handle, &qp->epas); | 443 | &qp->fw_handle, &qp->epas); |
443 | if (hret != H_SUCCESS) { | 444 | if (hret != H_SUCCESS) { |
444 | ehea_error("ehea_h_alloc_resource_qp failed"); | 445 | pr_err("ehea_h_alloc_resource_qp failed\n"); |
445 | goto out_freemem; | 446 | goto out_freemem; |
446 | } | 447 | } |
447 | 448 | ||
@@ -455,7 +456,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
455 | init_attr->act_wqe_size_enc_sq, adapter, | 456 | init_attr->act_wqe_size_enc_sq, adapter, |
456 | 0); | 457 | 0); |
457 | if (ret) { | 458 | if (ret) { |
458 | ehea_error("can't register for sq ret=%x", ret); | 459 | pr_err("can't register for sq ret=%x\n", ret); |
459 | goto out_freeres; | 460 | goto out_freeres; |
460 | } | 461 | } |
461 | 462 | ||
@@ -465,7 +466,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
465 | init_attr->act_wqe_size_enc_rq1, | 466 | init_attr->act_wqe_size_enc_rq1, |
466 | adapter, 1); | 467 | adapter, 1); |
467 | if (ret) { | 468 | if (ret) { |
468 | ehea_error("can't register for rq1 ret=%x", ret); | 469 | pr_err("can't register for rq1 ret=%x\n", ret); |
469 | goto out_kill_hwsq; | 470 | goto out_kill_hwsq; |
470 | } | 471 | } |
471 | 472 | ||
@@ -476,7 +477,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
476 | init_attr->act_wqe_size_enc_rq2, | 477 | init_attr->act_wqe_size_enc_rq2, |
477 | adapter, 2); | 478 | adapter, 2); |
478 | if (ret) { | 479 | if (ret) { |
479 | ehea_error("can't register for rq2 ret=%x", ret); | 480 | pr_err("can't register for rq2 ret=%x\n", ret); |
480 | goto out_kill_hwr1q; | 481 | goto out_kill_hwr1q; |
481 | } | 482 | } |
482 | } | 483 | } |
@@ -488,7 +489,7 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, | |||
488 | init_attr->act_wqe_size_enc_rq3, | 489 | init_attr->act_wqe_size_enc_rq3, |
489 | adapter, 3); | 490 | adapter, 3); |
490 | if (ret) { | 491 | if (ret) { |
491 | ehea_error("can't register for rq3 ret=%x", ret); | 492 | pr_err("can't register for rq3 ret=%x\n", ret); |
492 | goto out_kill_hwr2q; | 493 | goto out_kill_hwr2q; |
493 | } | 494 | } |
494 | } | 495 | } |
@@ -553,7 +554,7 @@ int ehea_destroy_qp(struct ehea_qp *qp) | |||
553 | } | 554 | } |
554 | 555 | ||
555 | if (hret != H_SUCCESS) { | 556 | if (hret != H_SUCCESS) { |
556 | ehea_error("destroy QP failed"); | 557 | pr_err("destroy QP failed\n"); |
557 | return -EIO; | 558 | return -EIO; |
558 | } | 559 | } |
559 | 560 | ||
@@ -842,7 +843,7 @@ static u64 ehea_reg_mr_section(int top, int dir, int idx, u64 *pt, | |||
842 | (hret != H_PAGE_REGISTERED)) { | 843 | (hret != H_PAGE_REGISTERED)) { |
843 | ehea_h_free_resource(adapter->handle, mr->handle, | 844 | ehea_h_free_resource(adapter->handle, mr->handle, |
844 | FORCE_FREE); | 845 | FORCE_FREE); |
845 | ehea_error("register_rpage_mr failed"); | 846 | pr_err("register_rpage_mr failed\n"); |
846 | return hret; | 847 | return hret; |
847 | } | 848 | } |
848 | } | 849 | } |
@@ -896,7 +897,7 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) | |||
896 | 897 | ||
897 | pt = (void *)get_zeroed_page(GFP_KERNEL); | 898 | pt = (void *)get_zeroed_page(GFP_KERNEL); |
898 | if (!pt) { | 899 | if (!pt) { |
899 | ehea_error("no mem"); | 900 | pr_err("no mem\n"); |
900 | ret = -ENOMEM; | 901 | ret = -ENOMEM; |
901 | goto out; | 902 | goto out; |
902 | } | 903 | } |
@@ -906,14 +907,14 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) | |||
906 | &mr->handle, &mr->lkey); | 907 | &mr->handle, &mr->lkey); |
907 | 908 | ||
908 | if (hret != H_SUCCESS) { | 909 | if (hret != H_SUCCESS) { |
909 | ehea_error("alloc_resource_mr failed"); | 910 | pr_err("alloc_resource_mr failed\n"); |
910 | ret = -EIO; | 911 | ret = -EIO; |
911 | goto out; | 912 | goto out; |
912 | } | 913 | } |
913 | 914 | ||
914 | if (!ehea_bmap) { | 915 | if (!ehea_bmap) { |
915 | ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE); | 916 | ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE); |
916 | ehea_error("no busmap available"); | 917 | pr_err("no busmap available\n"); |
917 | ret = -EIO; | 918 | ret = -EIO; |
918 | goto out; | 919 | goto out; |
919 | } | 920 | } |
@@ -929,7 +930,7 @@ int ehea_reg_kernel_mr(struct ehea_adapter *adapter, struct ehea_mr *mr) | |||
929 | 930 | ||
930 | if (hret != H_SUCCESS) { | 931 | if (hret != H_SUCCESS) { |
931 | ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE); | 932 | ehea_h_free_resource(adapter->handle, mr->handle, FORCE_FREE); |
932 | ehea_error("registering mr failed"); | 933 | pr_err("registering mr failed\n"); |
933 | ret = -EIO; | 934 | ret = -EIO; |
934 | goto out; | 935 | goto out; |
935 | } | 936 | } |
@@ -952,7 +953,7 @@ int ehea_rem_mr(struct ehea_mr *mr) | |||
952 | hret = ehea_h_free_resource(mr->adapter->handle, mr->handle, | 953 | hret = ehea_h_free_resource(mr->adapter->handle, mr->handle, |
953 | FORCE_FREE); | 954 | FORCE_FREE); |
954 | if (hret != H_SUCCESS) { | 955 | if (hret != H_SUCCESS) { |
955 | ehea_error("destroy MR failed"); | 956 | pr_err("destroy MR failed\n"); |
956 | return -EIO; | 957 | return -EIO; |
957 | } | 958 | } |
958 | 959 | ||
@@ -987,14 +988,14 @@ void print_error_data(u64 *data) | |||
987 | length = EHEA_PAGESIZE; | 988 | length = EHEA_PAGESIZE; |
988 | 989 | ||
989 | if (type == EHEA_AER_RESTYPE_QP) | 990 | if (type == EHEA_AER_RESTYPE_QP) |
990 | ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, " | 991 | pr_err("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, port=%llX\n", |
991 | "port=%llX", resource, data[6], data[12], data[22]); | 992 | resource, data[6], data[12], data[22]); |
992 | else if (type == EHEA_AER_RESTYPE_CQ) | 993 | else if (type == EHEA_AER_RESTYPE_CQ) |
993 | ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource, | 994 | pr_err("CQ (resource=%llX) state: AER=0x%llX\n", |
994 | data[6]); | 995 | resource, data[6]); |
995 | else if (type == EHEA_AER_RESTYPE_EQ) | 996 | else if (type == EHEA_AER_RESTYPE_EQ) |
996 | ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource, | 997 | pr_err("EQ (resource=%llX) state: AER=0x%llX\n", |
997 | data[6]); | 998 | resource, data[6]); |
998 | 999 | ||
999 | ehea_dump(data, length, "error data"); | 1000 | ehea_dump(data, length, "error data"); |
1000 | } | 1001 | } |
@@ -1008,7 +1009,7 @@ u64 ehea_error_data(struct ehea_adapter *adapter, u64 res_handle, | |||
1008 | 1009 | ||
1009 | rblock = (void *)get_zeroed_page(GFP_KERNEL); | 1010 | rblock = (void *)get_zeroed_page(GFP_KERNEL); |
1010 | if (!rblock) { | 1011 | if (!rblock) { |
1011 | ehea_error("Cannot allocate rblock memory."); | 1012 | pr_err("Cannot allocate rblock memory\n"); |
1012 | goto out; | 1013 | goto out; |
1013 | } | 1014 | } |
1014 | 1015 | ||
@@ -1020,9 +1021,9 @@ u64 ehea_error_data(struct ehea_adapter *adapter, u64 res_handle, | |||
1020 | *aerr = rblock[12]; | 1021 | *aerr = rblock[12]; |
1021 | print_error_data(rblock); | 1022 | print_error_data(rblock); |
1022 | } else if (ret == H_R_STATE) { | 1023 | } else if (ret == H_R_STATE) { |
1023 | ehea_error("No error data available: %llX.", res_handle); | 1024 | pr_err("No error data available: %llX\n", res_handle); |
1024 | } else | 1025 | } else |
1025 | ehea_error("Error data could not be fetched: %llX", res_handle); | 1026 | pr_err("Error data could not be fetched: %llX\n", res_handle); |
1026 | 1027 | ||
1027 | free_page((unsigned long)rblock); | 1028 | free_page((unsigned long)rblock); |
1028 | out: | 1029 | out: |