]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/staging/rdma/amso1100/c2_rnic.c
Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[mirror_ubuntu-zesty-kernel.git] / drivers / staging / rdma / amso1100 / c2_rnic.c
1 /*
2 * Copyright (c) 2005 Ammasso, Inc. All rights reserved.
3 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 */
34
35
36 #include <linux/module.h>
37 #include <linux/moduleparam.h>
38 #include <linux/pci.h>
39 #include <linux/netdevice.h>
40 #include <linux/etherdevice.h>
41 #include <linux/delay.h>
42 #include <linux/ethtool.h>
43 #include <linux/mii.h>
44 #include <linux/if_vlan.h>
45 #include <linux/crc32.h>
46 #include <linux/in.h>
47 #include <linux/ip.h>
48 #include <linux/tcp.h>
49 #include <linux/init.h>
50 #include <linux/dma-mapping.h>
51 #include <linux/mm.h>
52 #include <linux/inet.h>
53 #include <linux/vmalloc.h>
54 #include <linux/slab.h>
55
56 #include <linux/route.h>
57
58 #include <asm/io.h>
59 #include <asm/irq.h>
60 #include <asm/byteorder.h>
61 #include <rdma/ib_smi.h>
62 #include "c2.h"
63 #include "c2_vq.h"
64
65 /* Device capabilities */
66 #define C2_MIN_PAGESIZE 1024
67
68 #define C2_MAX_MRS 32768
69 #define C2_MAX_QPS 16000
70 #define C2_MAX_WQE_SZ 256
71 #define C2_MAX_QP_WR ((128*1024)/C2_MAX_WQE_SZ)
72 #define C2_MAX_SGES 4
73 #define C2_MAX_SGE_RD 1
74 #define C2_MAX_CQS 32768
75 #define C2_MAX_CQES 4096
76 #define C2_MAX_PDS 16384
77
78 /*
79 * Send the adapter INIT message to the amso1100
80 */
81 static int c2_adapter_init(struct c2_dev *c2dev)
82 {
83 struct c2wr_init_req wr;
84
85 memset(&wr, 0, sizeof(wr));
86 c2_wr_set_id(&wr, CCWR_INIT);
87 wr.hdr.context = 0;
88 wr.hint_count = cpu_to_be64(c2dev->hint_count_dma);
89 wr.q0_host_shared = cpu_to_be64(c2dev->req_vq.shared_dma);
90 wr.q1_host_shared = cpu_to_be64(c2dev->rep_vq.shared_dma);
91 wr.q1_host_msg_pool = cpu_to_be64(c2dev->rep_vq.host_dma);
92 wr.q2_host_shared = cpu_to_be64(c2dev->aeq.shared_dma);
93 wr.q2_host_msg_pool = cpu_to_be64(c2dev->aeq.host_dma);
94
95 /* Post the init message */
96 return vq_send_wr(c2dev, (union c2wr *) & wr);
97 }
98
99 /*
100 * Send the adapter TERM message to the amso1100
101 */
102 static void c2_adapter_term(struct c2_dev *c2dev)
103 {
104 struct c2wr_init_req wr;
105
106 memset(&wr, 0, sizeof(wr));
107 c2_wr_set_id(&wr, CCWR_TERM);
108 wr.hdr.context = 0;
109
110 /* Post the init message */
111 vq_send_wr(c2dev, (union c2wr *) & wr);
112 c2dev->init = 0;
113
114 return;
115 }
116
117 /*
118 * Query the adapter
119 */
120 static int c2_rnic_query(struct c2_dev *c2dev, struct ib_device_attr *props)
121 {
122 struct c2_vq_req *vq_req;
123 struct c2wr_rnic_query_req wr;
124 struct c2wr_rnic_query_rep *reply;
125 int err;
126
127 vq_req = vq_req_alloc(c2dev);
128 if (!vq_req)
129 return -ENOMEM;
130
131 c2_wr_set_id(&wr, CCWR_RNIC_QUERY);
132 wr.hdr.context = (unsigned long) vq_req;
133 wr.rnic_handle = c2dev->adapter_handle;
134
135 vq_req_get(c2dev, vq_req);
136
137 err = vq_send_wr(c2dev, (union c2wr *) &wr);
138 if (err) {
139 vq_req_put(c2dev, vq_req);
140 goto bail1;
141 }
142
143 err = vq_wait_for_reply(c2dev, vq_req);
144 if (err)
145 goto bail1;
146
147 reply =
148 (struct c2wr_rnic_query_rep *) (unsigned long) (vq_req->reply_msg);
149 if (!reply)
150 err = -ENOMEM;
151 else
152 err = c2_errno(reply);
153 if (err)
154 goto bail2;
155
156 props->fw_ver =
157 ((u64)be32_to_cpu(reply->fw_ver_major) << 32) |
158 ((be32_to_cpu(reply->fw_ver_minor) & 0xFFFF) << 16) |
159 (be32_to_cpu(reply->fw_ver_patch) & 0xFFFF);
160 memcpy(&props->sys_image_guid, c2dev->netdev->dev_addr, 6);
161 props->max_mr_size = 0xFFFFFFFF;
162 props->page_size_cap = ~(C2_MIN_PAGESIZE-1);
163 props->vendor_id = be32_to_cpu(reply->vendor_id);
164 props->vendor_part_id = be32_to_cpu(reply->part_number);
165 props->hw_ver = be32_to_cpu(reply->hw_version);
166 props->max_qp = be32_to_cpu(reply->max_qps);
167 props->max_qp_wr = be32_to_cpu(reply->max_qp_depth);
168 props->device_cap_flags = c2dev->device_cap_flags;
169 props->max_sge = C2_MAX_SGES;
170 props->max_sge_rd = C2_MAX_SGE_RD;
171 props->max_cq = be32_to_cpu(reply->max_cqs);
172 props->max_cqe = be32_to_cpu(reply->max_cq_depth);
173 props->max_mr = be32_to_cpu(reply->max_mrs);
174 props->max_pd = be32_to_cpu(reply->max_pds);
175 props->max_qp_rd_atom = be32_to_cpu(reply->max_qp_ird);
176 props->max_ee_rd_atom = 0;
177 props->max_res_rd_atom = be32_to_cpu(reply->max_global_ird);
178 props->max_qp_init_rd_atom = be32_to_cpu(reply->max_qp_ord);
179 props->max_ee_init_rd_atom = 0;
180 props->atomic_cap = IB_ATOMIC_NONE;
181 props->max_ee = 0;
182 props->max_rdd = 0;
183 props->max_mw = be32_to_cpu(reply->max_mws);
184 props->max_raw_ipv6_qp = 0;
185 props->max_raw_ethy_qp = 0;
186 props->max_mcast_grp = 0;
187 props->max_mcast_qp_attach = 0;
188 props->max_total_mcast_qp_attach = 0;
189 props->max_ah = 0;
190 props->max_fmr = 0;
191 props->max_map_per_fmr = 0;
192 props->max_srq = 0;
193 props->max_srq_wr = 0;
194 props->max_srq_sge = 0;
195 props->max_pkeys = 0;
196 props->local_ca_ack_delay = 0;
197
198 bail2:
199 vq_repbuf_free(c2dev, reply);
200
201 bail1:
202 vq_req_free(c2dev, vq_req);
203 return err;
204 }
205
206 /*
207 * Add an IP address to the RNIC interface
208 */
209 int c2_add_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask)
210 {
211 struct c2_vq_req *vq_req;
212 struct c2wr_rnic_setconfig_req *wr;
213 struct c2wr_rnic_setconfig_rep *reply;
214 struct c2_netaddr netaddr;
215 int err, len;
216
217 vq_req = vq_req_alloc(c2dev);
218 if (!vq_req)
219 return -ENOMEM;
220
221 len = sizeof(struct c2_netaddr);
222 wr = kmalloc(c2dev->req_vq.msg_size, GFP_KERNEL);
223 if (!wr) {
224 err = -ENOMEM;
225 goto bail0;
226 }
227
228 c2_wr_set_id(wr, CCWR_RNIC_SETCONFIG);
229 wr->hdr.context = (unsigned long) vq_req;
230 wr->rnic_handle = c2dev->adapter_handle;
231 wr->option = cpu_to_be32(C2_CFG_ADD_ADDR);
232
233 netaddr.ip_addr = inaddr;
234 netaddr.netmask = inmask;
235 netaddr.mtu = 0;
236
237 memcpy(wr->data, &netaddr, len);
238
239 vq_req_get(c2dev, vq_req);
240
241 err = vq_send_wr(c2dev, (union c2wr *) wr);
242 if (err) {
243 vq_req_put(c2dev, vq_req);
244 goto bail1;
245 }
246
247 err = vq_wait_for_reply(c2dev, vq_req);
248 if (err)
249 goto bail1;
250
251 reply =
252 (struct c2wr_rnic_setconfig_rep *) (unsigned long) (vq_req->reply_msg);
253 if (!reply) {
254 err = -ENOMEM;
255 goto bail1;
256 }
257
258 err = c2_errno(reply);
259 vq_repbuf_free(c2dev, reply);
260
261 bail1:
262 kfree(wr);
263 bail0:
264 vq_req_free(c2dev, vq_req);
265 return err;
266 }
267
268 /*
269 * Delete an IP address from the RNIC interface
270 */
271 int c2_del_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask)
272 {
273 struct c2_vq_req *vq_req;
274 struct c2wr_rnic_setconfig_req *wr;
275 struct c2wr_rnic_setconfig_rep *reply;
276 struct c2_netaddr netaddr;
277 int err, len;
278
279 vq_req = vq_req_alloc(c2dev);
280 if (!vq_req)
281 return -ENOMEM;
282
283 len = sizeof(struct c2_netaddr);
284 wr = kmalloc(c2dev->req_vq.msg_size, GFP_KERNEL);
285 if (!wr) {
286 err = -ENOMEM;
287 goto bail0;
288 }
289
290 c2_wr_set_id(wr, CCWR_RNIC_SETCONFIG);
291 wr->hdr.context = (unsigned long) vq_req;
292 wr->rnic_handle = c2dev->adapter_handle;
293 wr->option = cpu_to_be32(C2_CFG_DEL_ADDR);
294
295 netaddr.ip_addr = inaddr;
296 netaddr.netmask = inmask;
297 netaddr.mtu = 0;
298
299 memcpy(wr->data, &netaddr, len);
300
301 vq_req_get(c2dev, vq_req);
302
303 err = vq_send_wr(c2dev, (union c2wr *) wr);
304 if (err) {
305 vq_req_put(c2dev, vq_req);
306 goto bail1;
307 }
308
309 err = vq_wait_for_reply(c2dev, vq_req);
310 if (err)
311 goto bail1;
312
313 reply =
314 (struct c2wr_rnic_setconfig_rep *) (unsigned long) (vq_req->reply_msg);
315 if (!reply) {
316 err = -ENOMEM;
317 goto bail1;
318 }
319
320 err = c2_errno(reply);
321 vq_repbuf_free(c2dev, reply);
322
323 bail1:
324 kfree(wr);
325 bail0:
326 vq_req_free(c2dev, vq_req);
327 return err;
328 }
329
330 /*
331 * Open a single RNIC instance to use with all
332 * low level openib calls
333 */
334 static int c2_rnic_open(struct c2_dev *c2dev)
335 {
336 struct c2_vq_req *vq_req;
337 union c2wr wr;
338 struct c2wr_rnic_open_rep *reply;
339 int err;
340
341 vq_req = vq_req_alloc(c2dev);
342 if (vq_req == NULL) {
343 return -ENOMEM;
344 }
345
346 memset(&wr, 0, sizeof(wr));
347 c2_wr_set_id(&wr, CCWR_RNIC_OPEN);
348 wr.rnic_open.req.hdr.context = (unsigned long) (vq_req);
349 wr.rnic_open.req.flags = cpu_to_be16(RNIC_PRIV_MODE);
350 wr.rnic_open.req.port_num = cpu_to_be16(0);
351 wr.rnic_open.req.user_context = (unsigned long) c2dev;
352
353 vq_req_get(c2dev, vq_req);
354
355 err = vq_send_wr(c2dev, &wr);
356 if (err) {
357 vq_req_put(c2dev, vq_req);
358 goto bail0;
359 }
360
361 err = vq_wait_for_reply(c2dev, vq_req);
362 if (err) {
363 goto bail0;
364 }
365
366 reply = (struct c2wr_rnic_open_rep *) (unsigned long) (vq_req->reply_msg);
367 if (!reply) {
368 err = -ENOMEM;
369 goto bail0;
370 }
371
372 if ((err = c2_errno(reply)) != 0) {
373 goto bail1;
374 }
375
376 c2dev->adapter_handle = reply->rnic_handle;
377
378 bail1:
379 vq_repbuf_free(c2dev, reply);
380 bail0:
381 vq_req_free(c2dev, vq_req);
382 return err;
383 }
384
385 /*
386 * Close the RNIC instance
387 */
388 static int c2_rnic_close(struct c2_dev *c2dev)
389 {
390 struct c2_vq_req *vq_req;
391 union c2wr wr;
392 struct c2wr_rnic_close_rep *reply;
393 int err;
394
395 vq_req = vq_req_alloc(c2dev);
396 if (vq_req == NULL) {
397 return -ENOMEM;
398 }
399
400 memset(&wr, 0, sizeof(wr));
401 c2_wr_set_id(&wr, CCWR_RNIC_CLOSE);
402 wr.rnic_close.req.hdr.context = (unsigned long) vq_req;
403 wr.rnic_close.req.rnic_handle = c2dev->adapter_handle;
404
405 vq_req_get(c2dev, vq_req);
406
407 err = vq_send_wr(c2dev, &wr);
408 if (err) {
409 vq_req_put(c2dev, vq_req);
410 goto bail0;
411 }
412
413 err = vq_wait_for_reply(c2dev, vq_req);
414 if (err) {
415 goto bail0;
416 }
417
418 reply = (struct c2wr_rnic_close_rep *) (unsigned long) (vq_req->reply_msg);
419 if (!reply) {
420 err = -ENOMEM;
421 goto bail0;
422 }
423
424 if ((err = c2_errno(reply)) != 0) {
425 goto bail1;
426 }
427
428 c2dev->adapter_handle = 0;
429
430 bail1:
431 vq_repbuf_free(c2dev, reply);
432 bail0:
433 vq_req_free(c2dev, vq_req);
434 return err;
435 }
436
437 /*
438 * Called by c2_probe to initialize the RNIC. This principally
439 * involves initializing the various limits and resource pools that
440 * comprise the RNIC instance.
441 */
442 int c2_rnic_init(struct c2_dev *c2dev)
443 {
444 int err;
445 u32 qsize, msgsize;
446 void *q1_pages;
447 void *q2_pages;
448 void __iomem *mmio_regs;
449
450 /* Device capabilities */
451 c2dev->device_cap_flags =
452 (IB_DEVICE_RESIZE_MAX_WR |
453 IB_DEVICE_CURR_QP_STATE_MOD |
454 IB_DEVICE_SYS_IMAGE_GUID |
455 IB_DEVICE_LOCAL_DMA_LKEY |
456 IB_DEVICE_MEM_WINDOW);
457
458 /* Allocate the qptr_array */
459 c2dev->qptr_array = vzalloc(C2_MAX_CQS * sizeof(void *));
460 if (!c2dev->qptr_array) {
461 return -ENOMEM;
462 }
463
464 /* Initialize the qptr_array */
465 c2dev->qptr_array[0] = (void *) &c2dev->req_vq;
466 c2dev->qptr_array[1] = (void *) &c2dev->rep_vq;
467 c2dev->qptr_array[2] = (void *) &c2dev->aeq;
468
469 /* Initialize data structures */
470 init_waitqueue_head(&c2dev->req_vq_wo);
471 spin_lock_init(&c2dev->vqlock);
472 spin_lock_init(&c2dev->lock);
473
474 /* Allocate MQ shared pointer pool for kernel clients. User
475 * mode client pools are hung off the user context
476 */
477 err = c2_init_mqsp_pool(c2dev, GFP_KERNEL, &c2dev->kern_mqsp_pool);
478 if (err) {
479 goto bail0;
480 }
481
482 /* Allocate shared pointers for Q0, Q1, and Q2 from
483 * the shared pointer pool.
484 */
485
486 c2dev->hint_count = c2_alloc_mqsp(c2dev, c2dev->kern_mqsp_pool,
487 &c2dev->hint_count_dma,
488 GFP_KERNEL);
489 c2dev->req_vq.shared = c2_alloc_mqsp(c2dev, c2dev->kern_mqsp_pool,
490 &c2dev->req_vq.shared_dma,
491 GFP_KERNEL);
492 c2dev->rep_vq.shared = c2_alloc_mqsp(c2dev, c2dev->kern_mqsp_pool,
493 &c2dev->rep_vq.shared_dma,
494 GFP_KERNEL);
495 c2dev->aeq.shared = c2_alloc_mqsp(c2dev, c2dev->kern_mqsp_pool,
496 &c2dev->aeq.shared_dma, GFP_KERNEL);
497 if (!c2dev->hint_count || !c2dev->req_vq.shared ||
498 !c2dev->rep_vq.shared || !c2dev->aeq.shared) {
499 err = -ENOMEM;
500 goto bail1;
501 }
502
503 mmio_regs = c2dev->kva;
504 /* Initialize the Verbs Request Queue */
505 c2_mq_req_init(&c2dev->req_vq, 0,
506 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q0_QSIZE)),
507 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q0_MSGSIZE)),
508 mmio_regs +
509 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q0_POOLSTART)),
510 mmio_regs +
511 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q0_SHARED)),
512 C2_MQ_ADAPTER_TARGET);
513
514 /* Initialize the Verbs Reply Queue */
515 qsize = be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q1_QSIZE));
516 msgsize = be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q1_MSGSIZE));
517 q1_pages = dma_alloc_coherent(&c2dev->pcidev->dev, qsize * msgsize,
518 &c2dev->rep_vq.host_dma, GFP_KERNEL);
519 if (!q1_pages) {
520 err = -ENOMEM;
521 goto bail1;
522 }
523 dma_unmap_addr_set(&c2dev->rep_vq, mapping, c2dev->rep_vq.host_dma);
524 pr_debug("%s rep_vq va %p dma %llx\n", __func__, q1_pages,
525 (unsigned long long) c2dev->rep_vq.host_dma);
526 c2_mq_rep_init(&c2dev->rep_vq,
527 1,
528 qsize,
529 msgsize,
530 q1_pages,
531 mmio_regs +
532 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q1_SHARED)),
533 C2_MQ_HOST_TARGET);
534
535 /* Initialize the Asynchronus Event Queue */
536 qsize = be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q2_QSIZE));
537 msgsize = be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q2_MSGSIZE));
538 q2_pages = dma_alloc_coherent(&c2dev->pcidev->dev, qsize * msgsize,
539 &c2dev->aeq.host_dma, GFP_KERNEL);
540 if (!q2_pages) {
541 err = -ENOMEM;
542 goto bail2;
543 }
544 dma_unmap_addr_set(&c2dev->aeq, mapping, c2dev->aeq.host_dma);
545 pr_debug("%s aeq va %p dma %llx\n", __func__, q2_pages,
546 (unsigned long long) c2dev->aeq.host_dma);
547 c2_mq_rep_init(&c2dev->aeq,
548 2,
549 qsize,
550 msgsize,
551 q2_pages,
552 mmio_regs +
553 be32_to_cpu((__force __be32) readl(mmio_regs + C2_REGS_Q2_SHARED)),
554 C2_MQ_HOST_TARGET);
555
556 /* Initialize the verbs request allocator */
557 err = vq_init(c2dev);
558 if (err)
559 goto bail3;
560
561 /* Enable interrupts on the adapter */
562 writel(0, c2dev->regs + C2_IDIS);
563
564 /* create the WR init message */
565 err = c2_adapter_init(c2dev);
566 if (err)
567 goto bail4;
568 c2dev->init++;
569
570 /* open an adapter instance */
571 err = c2_rnic_open(c2dev);
572 if (err)
573 goto bail4;
574
575 /* Initialize cached the adapter limits */
576 err = c2_rnic_query(c2dev, &c2dev->props);
577 if (err)
578 goto bail5;
579
580 /* Initialize the PD pool */
581 err = c2_init_pd_table(c2dev);
582 if (err)
583 goto bail5;
584
585 /* Initialize the QP pool */
586 c2_init_qp_table(c2dev);
587 return 0;
588
589 bail5:
590 c2_rnic_close(c2dev);
591 bail4:
592 vq_term(c2dev);
593 bail3:
594 dma_free_coherent(&c2dev->pcidev->dev,
595 c2dev->aeq.q_size * c2dev->aeq.msg_size,
596 q2_pages, dma_unmap_addr(&c2dev->aeq, mapping));
597 bail2:
598 dma_free_coherent(&c2dev->pcidev->dev,
599 c2dev->rep_vq.q_size * c2dev->rep_vq.msg_size,
600 q1_pages, dma_unmap_addr(&c2dev->rep_vq, mapping));
601 bail1:
602 c2_free_mqsp_pool(c2dev, c2dev->kern_mqsp_pool);
603 bail0:
604 vfree(c2dev->qptr_array);
605
606 return err;
607 }
608
609 /*
610 * Called by c2_remove to cleanup the RNIC resources.
611 */
612 void c2_rnic_term(struct c2_dev *c2dev)
613 {
614
615 /* Close the open adapter instance */
616 c2_rnic_close(c2dev);
617
618 /* Send the TERM message to the adapter */
619 c2_adapter_term(c2dev);
620
621 /* Disable interrupts on the adapter */
622 writel(1, c2dev->regs + C2_IDIS);
623
624 /* Free the QP pool */
625 c2_cleanup_qp_table(c2dev);
626
627 /* Free the PD pool */
628 c2_cleanup_pd_table(c2dev);
629
630 /* Free the verbs request allocator */
631 vq_term(c2dev);
632
633 /* Free the asynchronus event queue */
634 dma_free_coherent(&c2dev->pcidev->dev,
635 c2dev->aeq.q_size * c2dev->aeq.msg_size,
636 c2dev->aeq.msg_pool.host,
637 dma_unmap_addr(&c2dev->aeq, mapping));
638
639 /* Free the verbs reply queue */
640 dma_free_coherent(&c2dev->pcidev->dev,
641 c2dev->rep_vq.q_size * c2dev->rep_vq.msg_size,
642 c2dev->rep_vq.msg_pool.host,
643 dma_unmap_addr(&c2dev->rep_vq, mapping));
644
645 /* Free the MQ shared pointer pool */
646 c2_free_mqsp_pool(c2dev, c2dev->kern_mqsp_pool);
647
648 /* Free the qptr_array */
649 vfree(c2dev->qptr_array);
650
651 return;
652 }