Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * IBM eServer eHCA Infiniband device driver for Linux on POWER |
| 3 | * |
| 4 | * userspace support verbs |
| 5 | * |
| 6 | * Authors: Christoph Raisch <raisch@de.ibm.com> |
| 7 | * Hoang-Nam Nguyen <hnguyen@de.ibm.com> |
| 8 | * Heiko J Schick <schickhj@de.ibm.com> |
| 9 | * |
| 10 | * Copyright (c) 2005 IBM Corporation |
| 11 | * |
| 12 | * All rights reserved. |
| 13 | * |
| 14 | * This source code is distributed under a dual license of GPL v2.0 and OpenIB |
| 15 | * BSD. |
| 16 | * |
| 17 | * OpenIB BSD License |
| 18 | * |
| 19 | * Redistribution and use in source and binary forms, with or without |
| 20 | * modification, are permitted provided that the following conditions are met: |
| 21 | * |
| 22 | * Redistributions of source code must retain the above copyright notice, this |
| 23 | * list of conditions and the following disclaimer. |
| 24 | * |
| 25 | * Redistributions in binary form must reproduce the above copyright notice, |
| 26 | * this list of conditions and the following disclaimer in the documentation |
| 27 | * and/or other materials |
| 28 | * provided with the distribution. |
| 29 | * |
| 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 31 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 32 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 33 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 34 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 35 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 36 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 37 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 38 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 39 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 40 | * POSSIBILITY OF SUCH DAMAGE. |
| 41 | */ |
| 42 | |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 43 | #include <linux/slab.h> |
| 44 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 45 | #include "ehca_classes.h" |
| 46 | #include "ehca_iverbs.h" |
| 47 | #include "ehca_mrmw.h" |
| 48 | #include "ehca_tools.h" |
| 49 | #include "hcp_if.h" |
| 50 | |
| 51 | struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device, |
| 52 | struct ib_udata *udata) |
| 53 | { |
| 54 | struct ehca_ucontext *my_context; |
| 55 | |
| 56 | my_context = kzalloc(sizeof *my_context, GFP_KERNEL); |
| 57 | if (!my_context) { |
| 58 | ehca_err(device, "Out of memory device=%p", device); |
| 59 | return ERR_PTR(-ENOMEM); |
| 60 | } |
| 61 | |
| 62 | return &my_context->ib_ucontext; |
| 63 | } |
| 64 | |
| 65 | int ehca_dealloc_ucontext(struct ib_ucontext *context) |
| 66 | { |
| 67 | kfree(container_of(context, struct ehca_ucontext, ib_ucontext)); |
| 68 | return 0; |
| 69 | } |
| 70 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 71 | static void ehca_mm_open(struct vm_area_struct *vma) |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 72 | { |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 73 | u32 *count = (u32 *)vma->vm_private_data; |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 74 | if (!count) { |
| 75 | ehca_gen_err("Invalid vma struct vm_start=%lx vm_end=%lx", |
| 76 | vma->vm_start, vma->vm_end); |
| 77 | return; |
| 78 | } |
| 79 | (*count)++; |
| 80 | if (!(*count)) |
| 81 | ehca_gen_err("Use count overflow vm_start=%lx vm_end=%lx", |
| 82 | vma->vm_start, vma->vm_end); |
| 83 | ehca_gen_dbg("vm_start=%lx vm_end=%lx count=%x", |
| 84 | vma->vm_start, vma->vm_end, *count); |
| 85 | } |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 86 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 87 | static void ehca_mm_close(struct vm_area_struct *vma) |
| 88 | { |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 89 | u32 *count = (u32 *)vma->vm_private_data; |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 90 | if (!count) { |
| 91 | ehca_gen_err("Invalid vma struct vm_start=%lx vm_end=%lx", |
| 92 | vma->vm_start, vma->vm_end); |
| 93 | return; |
| 94 | } |
| 95 | (*count)--; |
| 96 | ehca_gen_dbg("vm_start=%lx vm_end=%lx count=%x", |
| 97 | vma->vm_start, vma->vm_end, *count); |
| 98 | } |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 99 | |
Alexey Dobriyan | f0f37e2 | 2009-09-27 22:29:37 +0400 | [diff] [blame] | 100 | static const struct vm_operations_struct vm_ops = { |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 101 | .open = ehca_mm_open, |
| 102 | .close = ehca_mm_close, |
| 103 | }; |
| 104 | |
| 105 | static int ehca_mmap_fw(struct vm_area_struct *vma, struct h_galpas *galpas, |
| 106 | u32 *mm_count) |
| 107 | { |
| 108 | int ret; |
| 109 | u64 vsize, physical; |
| 110 | |
| 111 | vsize = vma->vm_end - vma->vm_start; |
Hoang-Nam Nguyen | e390d3b | 2007-09-11 15:31:06 +0200 | [diff] [blame] | 112 | if (vsize < EHCA_PAGESIZE) { |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 113 | ehca_gen_err("invalid vsize=%lx", vma->vm_end - vma->vm_start); |
| 114 | return -EINVAL; |
| 115 | } |
| 116 | |
| 117 | physical = galpas->user.fw_handle; |
| 118 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
Stephen Rothwell | 3750f60 | 2009-01-16 14:55:28 -0800 | [diff] [blame] | 119 | ehca_gen_dbg("vsize=%llx physical=%llx", vsize, physical); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 120 | /* VM_IO | VM_RESERVED are set by remap_pfn_range() */ |
Hoang-Nam Nguyen | e390d3b | 2007-09-11 15:31:06 +0200 | [diff] [blame] | 121 | ret = remap_4k_pfn(vma, vma->vm_start, physical >> EHCA_PAGESHIFT, |
| 122 | vma->vm_page_prot); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 123 | if (unlikely(ret)) { |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 124 | ehca_gen_err("remap_pfn_range() failed ret=%i", ret); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 125 | return -ENOMEM; |
| 126 | } |
| 127 | |
| 128 | vma->vm_private_data = mm_count; |
| 129 | (*mm_count)++; |
| 130 | vma->vm_ops = &vm_ops; |
| 131 | |
| 132 | return 0; |
| 133 | } |
| 134 | |
| 135 | static int ehca_mmap_queue(struct vm_area_struct *vma, struct ipz_queue *queue, |
| 136 | u32 *mm_count) |
| 137 | { |
| 138 | int ret; |
| 139 | u64 start, ofs; |
| 140 | struct page *page; |
| 141 | |
| 142 | vma->vm_flags |= VM_RESERVED; |
| 143 | start = vma->vm_start; |
| 144 | for (ofs = 0; ofs < queue->queue_length; ofs += PAGE_SIZE) { |
| 145 | u64 virt_addr = (u64)ipz_qeit_calc(queue, ofs); |
| 146 | page = virt_to_page(virt_addr); |
| 147 | ret = vm_insert_page(vma, start, page); |
| 148 | if (unlikely(ret)) { |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 149 | ehca_gen_err("vm_insert_page() failed rc=%i", ret); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 150 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 151 | } |
Stefan Roscher | e2f81da | 2007-07-20 16:04:17 +0200 | [diff] [blame] | 152 | start += PAGE_SIZE; |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 153 | } |
| 154 | vma->vm_private_data = mm_count; |
| 155 | (*mm_count)++; |
| 156 | vma->vm_ops = &vm_ops; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 157 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | static int ehca_mmap_cq(struct vm_area_struct *vma, struct ehca_cq *cq, |
| 162 | u32 rsrc_type) |
| 163 | { |
| 164 | int ret; |
| 165 | |
| 166 | switch (rsrc_type) { |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 167 | case 0: /* galpa fw handle */ |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 168 | ehca_dbg(cq->ib_cq.device, "cq_num=%x fw", cq->cq_number); |
| 169 | ret = ehca_mmap_fw(vma, &cq->galpas, &cq->mm_count_galpa); |
| 170 | if (unlikely(ret)) { |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 171 | ehca_err(cq->ib_cq.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 172 | "ehca_mmap_fw() failed rc=%i cq_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 173 | ret, cq->cq_number); |
| 174 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 175 | } |
| 176 | break; |
| 177 | |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 178 | case 1: /* cq queue_addr */ |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 179 | ehca_dbg(cq->ib_cq.device, "cq_num=%x queue", cq->cq_number); |
| 180 | ret = ehca_mmap_queue(vma, &cq->ipz_queue, &cq->mm_count_queue); |
| 181 | if (unlikely(ret)) { |
| 182 | ehca_err(cq->ib_cq.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 183 | "ehca_mmap_queue() failed rc=%i cq_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 184 | ret, cq->cq_number); |
| 185 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 186 | } |
| 187 | break; |
| 188 | |
| 189 | default: |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 190 | ehca_err(cq->ib_cq.device, "bad resource type=%x cq_num=%x", |
| 191 | rsrc_type, cq->cq_number); |
| 192 | return -EINVAL; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 193 | } |
| 194 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 195 | return 0; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 198 | static int ehca_mmap_qp(struct vm_area_struct *vma, struct ehca_qp *qp, |
| 199 | u32 rsrc_type) |
| 200 | { |
| 201 | int ret; |
| 202 | |
| 203 | switch (rsrc_type) { |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 204 | case 0: /* galpa fw handle */ |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 205 | ehca_dbg(qp->ib_qp.device, "qp_num=%x fw", qp->ib_qp.qp_num); |
| 206 | ret = ehca_mmap_fw(vma, &qp->galpas, &qp->mm_count_galpa); |
| 207 | if (unlikely(ret)) { |
| 208 | ehca_err(qp->ib_qp.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 209 | "remap_pfn_range() failed ret=%i qp_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 210 | ret, qp->ib_qp.qp_num); |
| 211 | return -ENOMEM; |
| 212 | } |
| 213 | break; |
| 214 | |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 215 | case 1: /* qp rqueue_addr */ |
Joachim Fenkes | 4da27d6 | 2008-04-23 11:55:45 -0700 | [diff] [blame] | 216 | ehca_dbg(qp->ib_qp.device, "qp_num=%x rq", qp->ib_qp.qp_num); |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 217 | ret = ehca_mmap_queue(vma, &qp->ipz_rqueue, |
| 218 | &qp->mm_count_rqueue); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 219 | if (unlikely(ret)) { |
| 220 | ehca_err(qp->ib_qp.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 221 | "ehca_mmap_queue(rq) failed rc=%i qp_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 222 | ret, qp->ib_qp.qp_num); |
| 223 | return ret; |
| 224 | } |
| 225 | break; |
| 226 | |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 227 | case 2: /* qp squeue_addr */ |
Joachim Fenkes | 4da27d6 | 2008-04-23 11:55:45 -0700 | [diff] [blame] | 228 | ehca_dbg(qp->ib_qp.device, "qp_num=%x sq", qp->ib_qp.qp_num); |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 229 | ret = ehca_mmap_queue(vma, &qp->ipz_squeue, |
| 230 | &qp->mm_count_squeue); |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 231 | if (unlikely(ret)) { |
| 232 | ehca_err(qp->ib_qp.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 233 | "ehca_mmap_queue(sq) failed rc=%i qp_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 234 | ret, qp->ib_qp.qp_num); |
| 235 | return ret; |
| 236 | } |
| 237 | break; |
| 238 | |
| 239 | default: |
| 240 | ehca_err(qp->ib_qp.device, "bad resource type=%x qp=num=%x", |
| 241 | rsrc_type, qp->ib_qp.qp_num); |
| 242 | return -EINVAL; |
| 243 | } |
| 244 | |
| 245 | return 0; |
| 246 | } |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 247 | |
| 248 | int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) |
| 249 | { |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 250 | u64 fileoffset = vma->vm_pgoff; |
| 251 | u32 idr_handle = fileoffset & 0x1FFFFFF; |
| 252 | u32 q_type = (fileoffset >> 27) & 0x1; /* CQ, QP,... */ |
| 253 | u32 rsrc_type = (fileoffset >> 25) & 0x3; /* sq,rq,cmnd_window */ |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 254 | u32 ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 255 | struct ehca_cq *cq; |
| 256 | struct ehca_qp *qp; |
Joachim Fenkes | a6a1294 | 2007-07-09 15:25:10 +0200 | [diff] [blame] | 257 | struct ib_uobject *uobject; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 258 | |
| 259 | switch (q_type) { |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 260 | case 0: /* CQ */ |
Joachim Fenkes | 26ed687 | 2007-07-09 15:31:10 +0200 | [diff] [blame] | 261 | read_lock(&ehca_cq_idr_lock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 262 | cq = idr_find(&ehca_cq_idr, idr_handle); |
Joachim Fenkes | 26ed687 | 2007-07-09 15:31:10 +0200 | [diff] [blame] | 263 | read_unlock(&ehca_cq_idr_lock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 264 | |
| 265 | /* make sure this mmap really belongs to the authorized user */ |
| 266 | if (!cq) |
| 267 | return -EINVAL; |
| 268 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 269 | if (!cq->ib_cq.uobject || cq->ib_cq.uobject->context != context) |
| 270 | return -EINVAL; |
| 271 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 272 | ret = ehca_mmap_cq(vma, cq, rsrc_type); |
| 273 | if (unlikely(ret)) { |
| 274 | ehca_err(cq->ib_cq.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 275 | "ehca_mmap_cq() failed rc=%i cq_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 276 | ret, cq->cq_number); |
| 277 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 278 | } |
| 279 | break; |
| 280 | |
Stefan Roscher | 5281a4b | 2007-09-11 15:29:39 +0200 | [diff] [blame] | 281 | case 1: /* QP */ |
Joachim Fenkes | 26ed687 | 2007-07-09 15:31:10 +0200 | [diff] [blame] | 282 | read_lock(&ehca_qp_idr_lock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 283 | qp = idr_find(&ehca_qp_idr, idr_handle); |
Joachim Fenkes | 26ed687 | 2007-07-09 15:31:10 +0200 | [diff] [blame] | 284 | read_unlock(&ehca_qp_idr_lock); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 285 | |
| 286 | /* make sure this mmap really belongs to the authorized user */ |
| 287 | if (!qp) |
| 288 | return -EINVAL; |
| 289 | |
Joachim Fenkes | a6a1294 | 2007-07-09 15:25:10 +0200 | [diff] [blame] | 290 | uobject = IS_SRQ(qp) ? qp->ib_srq.uobject : qp->ib_qp.uobject; |
| 291 | if (!uobject || uobject->context != context) |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 292 | return -EINVAL; |
| 293 | |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 294 | ret = ehca_mmap_qp(vma, qp, rsrc_type); |
| 295 | if (unlikely(ret)) { |
| 296 | ehca_err(qp->ib_qp.device, |
Joachim Fenkes | e372219 | 2007-09-11 15:32:22 +0200 | [diff] [blame] | 297 | "ehca_mmap_qp() failed rc=%i qp_num=%x", |
Hoang-Nam Nguyen | 4c34bdf | 2007-01-24 00:13:35 +0100 | [diff] [blame] | 298 | ret, qp->ib_qp.qp_num); |
| 299 | return ret; |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 300 | } |
| 301 | break; |
| 302 | |
| 303 | default: |
| 304 | ehca_gen_err("bad queue type %x", q_type); |
| 305 | return -EINVAL; |
| 306 | } |
| 307 | |
| 308 | return 0; |
| 309 | } |