diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-01-20 16:04:37 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-01-24 12:31:32 -0500 |
commit | 0bbb3b7496eabb6779962a998a8a91f4a8e589ff (patch) | |
tree | 621067e9c6fc1c3028c6e4d2d584552c41aba34f | |
parent | 99db9494035f5b9fbb1d579f89c6fa1beba6dbb7 (diff) |
IB/rxe, IB/rdmavt: Use dma_virt_ops instead of duplicating it
Make the rxe and rdmavt drivers use dma_virt_ops. Update the
comments that refer to the source files removed by this patch.
Remove struct ib_dma_mapping_ops. Remove ib_device.dma_ops.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Andrew Boyer <andrew.boyer@dell.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Jonathan Toppins <jtoppins@redhat.com>
Cc: Alex Estrin <alex.estrin@intel.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/sw/rdmavt/Kconfig | 1 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/Makefile | 2 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/dma.c | 198 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/dma.h | 53 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/mr.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/vt.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/vt.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/sw/rxe/Kconfig | 1 | ||||
-rw-r--r-- | drivers/infiniband/sw/rxe/Makefile | 1 | ||||
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_dma.c | 183 | ||||
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_loc.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_verbs.c | 3 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 103 |
13 files changed, 18 insertions, 542 deletions
diff --git a/drivers/infiniband/sw/rdmavt/Kconfig b/drivers/infiniband/sw/rdmavt/Kconfig index 1da8d01a6855..fdd001ce13d8 100644 --- a/drivers/infiniband/sw/rdmavt/Kconfig +++ b/drivers/infiniband/sw/rdmavt/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config INFINIBAND_RDMAVT | 1 | config INFINIBAND_RDMAVT |
2 | tristate "RDMA verbs transport library" | 2 | tristate "RDMA verbs transport library" |
3 | depends on 64BIT | 3 | depends on 64BIT |
4 | select DMA_VIRT_OPS | ||
4 | ---help--- | 5 | ---help--- |
5 | This is a common software verbs provider for RDMA networks. | 6 | This is a common software verbs provider for RDMA networks. |
diff --git a/drivers/infiniband/sw/rdmavt/Makefile b/drivers/infiniband/sw/rdmavt/Makefile index ccaa7992ac97..2a821d2fb569 100644 --- a/drivers/infiniband/sw/rdmavt/Makefile +++ b/drivers/infiniband/sw/rdmavt/Makefile | |||
@@ -7,7 +7,7 @@ | |||
7 | # | 7 | # |
8 | obj-$(CONFIG_INFINIBAND_RDMAVT) += rdmavt.o | 8 | obj-$(CONFIG_INFINIBAND_RDMAVT) += rdmavt.o |
9 | 9 | ||
10 | rdmavt-y := vt.o ah.o cq.o dma.o mad.o mcast.o mmap.o mr.o pd.o qp.o srq.o \ | 10 | rdmavt-y := vt.o ah.o cq.o mad.o mcast.o mmap.o mr.o pd.o qp.o srq.o \ |
11 | trace.o | 11 | trace.o |
12 | 12 | ||
13 | CFLAGS_trace.o = -I$(src) | 13 | CFLAGS_trace.o = -I$(src) |
diff --git a/drivers/infiniband/sw/rdmavt/dma.c b/drivers/infiniband/sw/rdmavt/dma.c deleted file mode 100644 index f2cefb0d9180..000000000000 --- a/drivers/infiniband/sw/rdmavt/dma.c +++ /dev/null | |||
@@ -1,198 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2016 Intel Corporation. | ||
3 | * | ||
4 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
5 | * redistributing this file, you may do so under either license. | ||
6 | * | ||
7 | * GPL LICENSE SUMMARY | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * BSD LICENSE | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * | ||
24 | * - Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * - Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in | ||
28 | * the documentation and/or other materials provided with the | ||
29 | * distribution. | ||
30 | * - Neither the name of Intel Corporation nor the names of its | ||
31 | * contributors may be used to endorse or promote products derived | ||
32 | * from this software without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
45 | * | ||
46 | */ | ||
47 | #include <linux/types.h> | ||
48 | #include <linux/scatterlist.h> | ||
49 | #include <rdma/ib_verbs.h> | ||
50 | |||
51 | #include "dma.h" | ||
52 | |||
53 | #define BAD_DMA_ADDRESS ((u64)0) | ||
54 | |||
55 | /* | ||
56 | * The following functions implement driver specific replacements | ||
57 | * for the ib_dma_*() functions. | ||
58 | * | ||
59 | * These functions return kernel virtual addresses instead of | ||
60 | * device bus addresses since the driver uses the CPU to copy | ||
61 | * data instead of using hardware DMA. | ||
62 | */ | ||
63 | |||
64 | static int rvt_mapping_error(struct ib_device *dev, u64 dma_addr) | ||
65 | { | ||
66 | return dma_addr == BAD_DMA_ADDRESS; | ||
67 | } | ||
68 | |||
69 | static u64 rvt_dma_map_single(struct ib_device *dev, void *cpu_addr, | ||
70 | size_t size, enum dma_data_direction direction) | ||
71 | { | ||
72 | if (WARN_ON(!valid_dma_direction(direction))) | ||
73 | return BAD_DMA_ADDRESS; | ||
74 | |||
75 | return (u64)cpu_addr; | ||
76 | } | ||
77 | |||
78 | static void rvt_dma_unmap_single(struct ib_device *dev, u64 addr, size_t size, | ||
79 | enum dma_data_direction direction) | ||
80 | { | ||
81 | /* This is a stub, nothing to be done here */ | ||
82 | } | ||
83 | |||
84 | static u64 rvt_dma_map_page(struct ib_device *dev, struct page *page, | ||
85 | unsigned long offset, size_t size, | ||
86 | enum dma_data_direction direction) | ||
87 | { | ||
88 | u64 addr; | ||
89 | |||
90 | if (WARN_ON(!valid_dma_direction(direction))) | ||
91 | return BAD_DMA_ADDRESS; | ||
92 | |||
93 | addr = (u64)page_address(page); | ||
94 | if (addr) | ||
95 | addr += offset; | ||
96 | |||
97 | return addr; | ||
98 | } | ||
99 | |||
100 | static void rvt_dma_unmap_page(struct ib_device *dev, u64 addr, size_t size, | ||
101 | enum dma_data_direction direction) | ||
102 | { | ||
103 | /* This is a stub, nothing to be done here */ | ||
104 | } | ||
105 | |||
106 | static int rvt_map_sg(struct ib_device *dev, struct scatterlist *sgl, | ||
107 | int nents, enum dma_data_direction direction) | ||
108 | { | ||
109 | struct scatterlist *sg; | ||
110 | u64 addr; | ||
111 | int i; | ||
112 | int ret = nents; | ||
113 | |||
114 | if (WARN_ON(!valid_dma_direction(direction))) | ||
115 | return 0; | ||
116 | |||
117 | for_each_sg(sgl, sg, nents, i) { | ||
118 | addr = (u64)page_address(sg_page(sg)); | ||
119 | if (!addr) { | ||
120 | ret = 0; | ||
121 | break; | ||
122 | } | ||
123 | sg->dma_address = addr + sg->offset; | ||
124 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | ||
125 | sg->dma_length = sg->length; | ||
126 | #endif | ||
127 | } | ||
128 | return ret; | ||
129 | } | ||
130 | |||
131 | static void rvt_unmap_sg(struct ib_device *dev, | ||
132 | struct scatterlist *sg, int nents, | ||
133 | enum dma_data_direction direction) | ||
134 | { | ||
135 | /* This is a stub, nothing to be done here */ | ||
136 | } | ||
137 | |||
138 | static int rvt_map_sg_attrs(struct ib_device *dev, struct scatterlist *sgl, | ||
139 | int nents, enum dma_data_direction direction, | ||
140 | unsigned long attrs) | ||
141 | { | ||
142 | return rvt_map_sg(dev, sgl, nents, direction); | ||
143 | } | ||
144 | |||
145 | static void rvt_unmap_sg_attrs(struct ib_device *dev, | ||
146 | struct scatterlist *sg, int nents, | ||
147 | enum dma_data_direction direction, | ||
148 | unsigned long attrs) | ||
149 | { | ||
150 | return rvt_unmap_sg(dev, sg, nents, direction); | ||
151 | } | ||
152 | |||
153 | static void rvt_sync_single_for_cpu(struct ib_device *dev, u64 addr, | ||
154 | size_t size, enum dma_data_direction dir) | ||
155 | { | ||
156 | } | ||
157 | |||
158 | static void rvt_sync_single_for_device(struct ib_device *dev, u64 addr, | ||
159 | size_t size, | ||
160 | enum dma_data_direction dir) | ||
161 | { | ||
162 | } | ||
163 | |||
164 | static void *rvt_dma_alloc_coherent(struct ib_device *dev, size_t size, | ||
165 | u64 *dma_handle, gfp_t flag) | ||
166 | { | ||
167 | struct page *p; | ||
168 | void *addr = NULL; | ||
169 | |||
170 | p = alloc_pages(flag, get_order(size)); | ||
171 | if (p) | ||
172 | addr = page_address(p); | ||
173 | if (dma_handle) | ||
174 | *dma_handle = (u64)addr; | ||
175 | return addr; | ||
176 | } | ||
177 | |||
178 | static void rvt_dma_free_coherent(struct ib_device *dev, size_t size, | ||
179 | void *cpu_addr, u64 dma_handle) | ||
180 | { | ||
181 | free_pages((unsigned long)cpu_addr, get_order(size)); | ||
182 | } | ||
183 | |||
184 | struct ib_dma_mapping_ops rvt_default_dma_mapping_ops = { | ||
185 | .mapping_error = rvt_mapping_error, | ||
186 | .map_single = rvt_dma_map_single, | ||
187 | .unmap_single = rvt_dma_unmap_single, | ||
188 | .map_page = rvt_dma_map_page, | ||
189 | .unmap_page = rvt_dma_unmap_page, | ||
190 | .map_sg = rvt_map_sg, | ||
191 | .unmap_sg = rvt_unmap_sg, | ||
192 | .map_sg_attrs = rvt_map_sg_attrs, | ||
193 | .unmap_sg_attrs = rvt_unmap_sg_attrs, | ||
194 | .sync_single_for_cpu = rvt_sync_single_for_cpu, | ||
195 | .sync_single_for_device = rvt_sync_single_for_device, | ||
196 | .alloc_coherent = rvt_dma_alloc_coherent, | ||
197 | .free_coherent = rvt_dma_free_coherent | ||
198 | }; | ||
diff --git a/drivers/infiniband/sw/rdmavt/dma.h b/drivers/infiniband/sw/rdmavt/dma.h deleted file mode 100644 index 979f07e09195..000000000000 --- a/drivers/infiniband/sw/rdmavt/dma.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | #ifndef DEF_RDMAVTDMA_H | ||
2 | #define DEF_RDMAVTDMA_H | ||
3 | |||
4 | /* | ||
5 | * Copyright(c) 2016 Intel Corporation. | ||
6 | * | ||
7 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
8 | * redistributing this file, you may do so under either license. | ||
9 | * | ||
10 | * GPL LICENSE SUMMARY | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of version 2 of the GNU General Public License as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * General Public License for more details. | ||
20 | * | ||
21 | * BSD LICENSE | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * | ||
27 | * - Redistributions of source code must retain the above copyright | ||
28 | * notice, this list of conditions and the following disclaimer. | ||
29 | * - Redistributions in binary form must reproduce the above copyright | ||
30 | * notice, this list of conditions and the following disclaimer in | ||
31 | * the documentation and/or other materials provided with the | ||
32 | * distribution. | ||
33 | * - Neither the name of Intel Corporation nor the names of its | ||
34 | * contributors may be used to endorse or promote products derived | ||
35 | * from this software without specific prior written permission. | ||
36 | * | ||
37 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
38 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
39 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
40 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
41 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
44 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
45 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
46 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
47 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * | ||
49 | */ | ||
50 | |||
51 | extern struct ib_dma_mapping_ops rvt_default_dma_mapping_ops; | ||
52 | |||
53 | #endif /* DEF_RDMAVTDMA_H */ | ||
diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 52fd15276ee6..14d0ac6efd08 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c | |||
@@ -305,8 +305,8 @@ static void __rvt_free_mr(struct rvt_mr *mr) | |||
305 | * @acc: access flags | 305 | * @acc: access flags |
306 | * | 306 | * |
307 | * Return: the memory region on success, otherwise returns an errno. | 307 | * Return: the memory region on success, otherwise returns an errno. |
308 | * Note that all DMA addresses should be created via the | 308 | * Note that all DMA addresses should be created via the functions in |
309 | * struct ib_dma_mapping_ops functions (see dma.c). | 309 | * struct dma_virt_ops. |
310 | */ | 310 | */ |
311 | struct ib_mr *rvt_get_dma_mr(struct ib_pd *pd, int acc) | 311 | struct ib_mr *rvt_get_dma_mr(struct ib_pd *pd, int acc) |
312 | { | 312 | { |
@@ -782,7 +782,7 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, | |||
782 | 782 | ||
783 | /* | 783 | /* |
784 | * We use LKEY == zero for kernel virtual addresses | 784 | * We use LKEY == zero for kernel virtual addresses |
785 | * (see rvt_get_dma_mr and dma.c). | 785 | * (see rvt_get_dma_mr() and dma_virt_ops). |
786 | */ | 786 | */ |
787 | rcu_read_lock(); | 787 | rcu_read_lock(); |
788 | if (sge->lkey == 0) { | 788 | if (sge->lkey == 0) { |
@@ -880,7 +880,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, | |||
880 | 880 | ||
881 | /* | 881 | /* |
882 | * We use RKEY == zero for kernel virtual addresses | 882 | * We use RKEY == zero for kernel virtual addresses |
883 | * (see rvt_get_dma_mr and dma.c). | 883 | * (see rvt_get_dma_mr() and dma_virt_ops). |
884 | */ | 884 | */ |
885 | rcu_read_lock(); | 885 | rcu_read_lock(); |
886 | if (rkey == 0) { | 886 | if (rkey == 0) { |
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c index d430c2f7cec4..19666e52b3b1 100644 --- a/drivers/infiniband/sw/rdmavt/vt.c +++ b/drivers/infiniband/sw/rdmavt/vt.c | |||
@@ -47,6 +47,7 @@ | |||
47 | 47 | ||
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
50 | #include <linux/dma-mapping.h> | ||
50 | #include "vt.h" | 51 | #include "vt.h" |
51 | #include "trace.h" | 52 | #include "trace.h" |
52 | 53 | ||
@@ -777,8 +778,7 @@ int rvt_register_device(struct rvt_dev_info *rdi) | |||
777 | } | 778 | } |
778 | 779 | ||
779 | /* DMA Operations */ | 780 | /* DMA Operations */ |
780 | rdi->ibdev.dma_ops = | 781 | rdi->ibdev.dev.dma_ops = rdi->ibdev.dev.dma_ops ? : &dma_virt_ops; |
781 | rdi->ibdev.dma_ops ? : &rvt_default_dma_mapping_ops; | ||
782 | 782 | ||
783 | /* Protection Domain */ | 783 | /* Protection Domain */ |
784 | spin_lock_init(&rdi->n_pds_lock); | 784 | spin_lock_init(&rdi->n_pds_lock); |
diff --git a/drivers/infiniband/sw/rdmavt/vt.h b/drivers/infiniband/sw/rdmavt/vt.h index 6b01eaa4461b..f363505312be 100644 --- a/drivers/infiniband/sw/rdmavt/vt.h +++ b/drivers/infiniband/sw/rdmavt/vt.h | |||
@@ -50,7 +50,6 @@ | |||
50 | 50 | ||
51 | #include <rdma/rdma_vt.h> | 51 | #include <rdma/rdma_vt.h> |
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include "dma.h" | ||
54 | #include "pd.h" | 53 | #include "pd.h" |
55 | #include "qp.h" | 54 | #include "qp.h" |
56 | #include "ah.h" | 55 | #include "ah.h" |
diff --git a/drivers/infiniband/sw/rxe/Kconfig b/drivers/infiniband/sw/rxe/Kconfig index 1e4e628fe7b0..7d1ac27ed251 100644 --- a/drivers/infiniband/sw/rxe/Kconfig +++ b/drivers/infiniband/sw/rxe/Kconfig | |||
@@ -2,6 +2,7 @@ config RDMA_RXE | |||
2 | tristate "Software RDMA over Ethernet (RoCE) driver" | 2 | tristate "Software RDMA over Ethernet (RoCE) driver" |
3 | depends on INET && PCI && INFINIBAND | 3 | depends on INET && PCI && INFINIBAND |
4 | depends on NET_UDP_TUNNEL | 4 | depends on NET_UDP_TUNNEL |
5 | select DMA_VIRT_OPS | ||
5 | ---help--- | 6 | ---help--- |
6 | This driver implements the InfiniBand RDMA transport over | 7 | This driver implements the InfiniBand RDMA transport over |
7 | the Linux network stack. It enables a system with a | 8 | the Linux network stack. It enables a system with a |
diff --git a/drivers/infiniband/sw/rxe/Makefile b/drivers/infiniband/sw/rxe/Makefile index 3b3fb9d1c470..ec35ff022a42 100644 --- a/drivers/infiniband/sw/rxe/Makefile +++ b/drivers/infiniband/sw/rxe/Makefile | |||
@@ -14,7 +14,6 @@ rdma_rxe-y := \ | |||
14 | rxe_qp.o \ | 14 | rxe_qp.o \ |
15 | rxe_cq.o \ | 15 | rxe_cq.o \ |
16 | rxe_mr.o \ | 16 | rxe_mr.o \ |
17 | rxe_dma.o \ | ||
18 | rxe_opcode.o \ | 17 | rxe_opcode.o \ |
19 | rxe_mmap.o \ | 18 | rxe_mmap.o \ |
20 | rxe_icrc.o \ | 19 | rxe_icrc.o \ |
diff --git a/drivers/infiniband/sw/rxe/rxe_dma.c b/drivers/infiniband/sw/rxe/rxe_dma.c deleted file mode 100644 index a0f8af5851ae..000000000000 --- a/drivers/infiniband/sw/rxe/rxe_dma.c +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. | ||
3 | * Copyright (c) 2015 System Fabric Works, 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 | #include "rxe.h" | ||
35 | #include "rxe_loc.h" | ||
36 | |||
37 | #define DMA_BAD_ADDER ((u64)0) | ||
38 | |||
39 | static int rxe_mapping_error(struct ib_device *dev, u64 dma_addr) | ||
40 | { | ||
41 | return dma_addr == DMA_BAD_ADDER; | ||
42 | } | ||
43 | |||
44 | static u64 rxe_dma_map_single(struct ib_device *dev, | ||
45 | void *cpu_addr, size_t size, | ||
46 | enum dma_data_direction direction) | ||
47 | { | ||
48 | WARN_ON(!valid_dma_direction(direction)); | ||
49 | return (uintptr_t)cpu_addr; | ||
50 | } | ||
51 | |||
52 | static void rxe_dma_unmap_single(struct ib_device *dev, | ||
53 | u64 addr, size_t size, | ||
54 | enum dma_data_direction direction) | ||
55 | { | ||
56 | WARN_ON(!valid_dma_direction(direction)); | ||
57 | } | ||
58 | |||
59 | static u64 rxe_dma_map_page(struct ib_device *dev, | ||
60 | struct page *page, | ||
61 | unsigned long offset, | ||
62 | size_t size, enum dma_data_direction direction) | ||
63 | { | ||
64 | u64 addr; | ||
65 | |||
66 | WARN_ON(!valid_dma_direction(direction)); | ||
67 | |||
68 | if (offset + size > PAGE_SIZE) { | ||
69 | addr = DMA_BAD_ADDER; | ||
70 | goto done; | ||
71 | } | ||
72 | |||
73 | addr = (uintptr_t)page_address(page); | ||
74 | if (addr) | ||
75 | addr += offset; | ||
76 | |||
77 | done: | ||
78 | return addr; | ||
79 | } | ||
80 | |||
81 | static void rxe_dma_unmap_page(struct ib_device *dev, | ||
82 | u64 addr, size_t size, | ||
83 | enum dma_data_direction direction) | ||
84 | { | ||
85 | WARN_ON(!valid_dma_direction(direction)); | ||
86 | } | ||
87 | |||
88 | static int rxe_map_sg(struct ib_device *dev, struct scatterlist *sgl, | ||
89 | int nents, enum dma_data_direction direction) | ||
90 | { | ||
91 | struct scatterlist *sg; | ||
92 | u64 addr; | ||
93 | int i; | ||
94 | int ret = nents; | ||
95 | |||
96 | WARN_ON(!valid_dma_direction(direction)); | ||
97 | |||
98 | for_each_sg(sgl, sg, nents, i) { | ||
99 | addr = (uintptr_t)page_address(sg_page(sg)); | ||
100 | if (!addr) { | ||
101 | ret = 0; | ||
102 | break; | ||
103 | } | ||
104 | sg->dma_address = addr + sg->offset; | ||
105 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | ||
106 | sg->dma_length = sg->length; | ||
107 | #endif | ||
108 | } | ||
109 | |||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | static void rxe_unmap_sg(struct ib_device *dev, | ||
114 | struct scatterlist *sg, int nents, | ||
115 | enum dma_data_direction direction) | ||
116 | { | ||
117 | WARN_ON(!valid_dma_direction(direction)); | ||
118 | } | ||
119 | |||
120 | static int rxe_map_sg_attrs(struct ib_device *dev, struct scatterlist *sgl, | ||
121 | int nents, enum dma_data_direction direction, | ||
122 | unsigned long attrs) | ||
123 | { | ||
124 | return rxe_map_sg(dev, sgl, nents, direction); | ||
125 | } | ||
126 | |||
127 | static void rxe_unmap_sg_attrs(struct ib_device *dev, | ||
128 | struct scatterlist *sg, int nents, | ||
129 | enum dma_data_direction direction, | ||
130 | unsigned long attrs) | ||
131 | { | ||
132 | rxe_unmap_sg(dev, sg, nents, direction); | ||
133 | } | ||
134 | |||
135 | static void rxe_sync_single_for_cpu(struct ib_device *dev, | ||
136 | u64 addr, | ||
137 | size_t size, enum dma_data_direction dir) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | static void rxe_sync_single_for_device(struct ib_device *dev, | ||
142 | u64 addr, | ||
143 | size_t size, enum dma_data_direction dir) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | static void *rxe_dma_alloc_coherent(struct ib_device *dev, size_t size, | ||
148 | u64 *dma_handle, gfp_t flag) | ||
149 | { | ||
150 | struct page *p; | ||
151 | void *addr = NULL; | ||
152 | |||
153 | p = alloc_pages(flag, get_order(size)); | ||
154 | if (p) | ||
155 | addr = page_address(p); | ||
156 | |||
157 | if (dma_handle) | ||
158 | *dma_handle = (uintptr_t)addr; | ||
159 | |||
160 | return addr; | ||
161 | } | ||
162 | |||
163 | static void rxe_dma_free_coherent(struct ib_device *dev, size_t size, | ||
164 | void *cpu_addr, u64 dma_handle) | ||
165 | { | ||
166 | free_pages((unsigned long)cpu_addr, get_order(size)); | ||
167 | } | ||
168 | |||
169 | struct ib_dma_mapping_ops rxe_dma_mapping_ops = { | ||
170 | .mapping_error = rxe_mapping_error, | ||
171 | .map_single = rxe_dma_map_single, | ||
172 | .unmap_single = rxe_dma_unmap_single, | ||
173 | .map_page = rxe_dma_map_page, | ||
174 | .unmap_page = rxe_dma_unmap_page, | ||
175 | .map_sg = rxe_map_sg, | ||
176 | .unmap_sg = rxe_unmap_sg, | ||
177 | .map_sg_attrs = rxe_map_sg_attrs, | ||
178 | .unmap_sg_attrs = rxe_unmap_sg_attrs, | ||
179 | .sync_single_for_cpu = rxe_sync_single_for_cpu, | ||
180 | .sync_single_for_device = rxe_sync_single_for_device, | ||
181 | .alloc_coherent = rxe_dma_alloc_coherent, | ||
182 | .free_coherent = rxe_dma_free_coherent | ||
183 | }; | ||
diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h index 272337e5e948..183a9d379b41 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h | |||
@@ -237,8 +237,6 @@ int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq, | |||
237 | struct ib_srq_attr *attr, enum ib_srq_attr_mask mask, | 237 | struct ib_srq_attr *attr, enum ib_srq_attr_mask mask, |
238 | struct ib_udata *udata); | 238 | struct ib_udata *udata); |
239 | 239 | ||
240 | extern struct ib_dma_mapping_ops rxe_dma_mapping_ops; | ||
241 | |||
242 | void rxe_release(struct kref *kref); | 240 | void rxe_release(struct kref *kref); |
243 | 241 | ||
244 | void rxe_drain_req_pkts(struct rxe_qp *qp, bool notify); | 242 | void rxe_drain_req_pkts(struct rxe_qp *qp, bool notify); |
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index ace58ef8538e..321cca6cf4cd 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * SOFTWARE. | 31 | * SOFTWARE. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/dma-mapping.h> | ||
34 | #include "rxe.h" | 35 | #include "rxe.h" |
35 | #include "rxe_loc.h" | 36 | #include "rxe_loc.h" |
36 | #include "rxe_queue.h" | 37 | #include "rxe_queue.h" |
@@ -1235,7 +1236,7 @@ int rxe_register_device(struct rxe_dev *rxe) | |||
1235 | dev->dev.parent = rxe_dma_device(rxe); | 1236 | dev->dev.parent = rxe_dma_device(rxe); |
1236 | dev->local_dma_lkey = 0; | 1237 | dev->local_dma_lkey = 0; |
1237 | dev->node_guid = rxe_node_guid(rxe); | 1238 | dev->node_guid = rxe_node_guid(rxe); |
1238 | dev->dma_ops = &rxe_dma_mapping_ops; | 1239 | dev->dev.dma_ops = &dma_virt_ops; |
1239 | 1240 | ||
1240 | dev->uverbs_abi_ver = RXE_UVERBS_ABI_VERSION; | 1241 | dev->uverbs_abi_ver = RXE_UVERBS_ABI_VERSION; |
1241 | dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) | 1242 | dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index a20a15f81936..f199c42b9a86 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -1784,53 +1784,6 @@ struct ib_cache { | |||
1784 | enum ib_port_state *port_state_cache; | 1784 | enum ib_port_state *port_state_cache; |
1785 | }; | 1785 | }; |
1786 | 1786 | ||
1787 | struct ib_dma_mapping_ops { | ||
1788 | int (*mapping_error)(struct ib_device *dev, | ||
1789 | u64 dma_addr); | ||
1790 | u64 (*map_single)(struct ib_device *dev, | ||
1791 | void *ptr, size_t size, | ||
1792 | enum dma_data_direction direction); | ||
1793 | void (*unmap_single)(struct ib_device *dev, | ||
1794 | u64 addr, size_t size, | ||
1795 | enum dma_data_direction direction); | ||
1796 | u64 (*map_page)(struct ib_device *dev, | ||
1797 | struct page *page, unsigned long offset, | ||
1798 | size_t size, | ||
1799 | enum dma_data_direction direction); | ||
1800 | void (*unmap_page)(struct ib_device *dev, | ||
1801 | u64 addr, size_t size, | ||
1802 | enum dma_data_direction direction); | ||
1803 | int (*map_sg)(struct ib_device *dev, | ||
1804 | struct scatterlist *sg, int nents, | ||
1805 | enum dma_data_direction direction); | ||
1806 | void (*unmap_sg)(struct ib_device *dev, | ||
1807 | struct scatterlist *sg, int nents, | ||
1808 | enum dma_data_direction direction); | ||
1809 | int (*map_sg_attrs)(struct ib_device *dev, | ||
1810 | struct scatterlist *sg, int nents, | ||
1811 | enum dma_data_direction direction, | ||
1812 | unsigned long attrs); | ||
1813 | void (*unmap_sg_attrs)(struct ib_device *dev, | ||
1814 | struct scatterlist *sg, int nents, | ||
1815 | enum dma_data_direction direction, | ||
1816 | unsigned long attrs); | ||
1817 | void (*sync_single_for_cpu)(struct ib_device *dev, | ||
1818 | u64 dma_handle, | ||
1819 | size_t size, | ||
1820 | enum dma_data_direction dir); | ||
1821 | void (*sync_single_for_device)(struct ib_device *dev, | ||
1822 | u64 dma_handle, | ||
1823 | size_t size, | ||
1824 | enum dma_data_direction dir); | ||
1825 | void *(*alloc_coherent)(struct ib_device *dev, | ||
1826 | size_t size, | ||
1827 | u64 *dma_handle, | ||
1828 | gfp_t flag); | ||
1829 | void (*free_coherent)(struct ib_device *dev, | ||
1830 | size_t size, void *cpu_addr, | ||
1831 | u64 dma_handle); | ||
1832 | }; | ||
1833 | |||
1834 | struct iw_cm_verbs; | 1787 | struct iw_cm_verbs; |
1835 | 1788 | ||
1836 | struct ib_port_immutable { | 1789 | struct ib_port_immutable { |
@@ -2090,7 +2043,6 @@ struct ib_device { | |||
2090 | struct ib_rwq_ind_table_init_attr *init_attr, | 2043 | struct ib_rwq_ind_table_init_attr *init_attr, |
2091 | struct ib_udata *udata); | 2044 | struct ib_udata *udata); |
2092 | int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table); | 2045 | int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table); |
2093 | struct ib_dma_mapping_ops *dma_ops; | ||
2094 | 2046 | ||
2095 | struct module *owner; | 2047 | struct module *owner; |
2096 | struct device dev; | 2048 | struct device dev; |
@@ -2965,8 +2917,6 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) | |||
2965 | */ | 2917 | */ |
2966 | static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr) | 2918 | static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr) |
2967 | { | 2919 | { |
2968 | if (dev->dma_ops) | ||
2969 | return dev->dma_ops->mapping_error(dev, dma_addr); | ||
2970 | return dma_mapping_error(&dev->dev, dma_addr); | 2920 | return dma_mapping_error(&dev->dev, dma_addr); |
2971 | } | 2921 | } |
2972 | 2922 | ||
@@ -2981,8 +2931,6 @@ static inline u64 ib_dma_map_single(struct ib_device *dev, | |||
2981 | void *cpu_addr, size_t size, | 2931 | void *cpu_addr, size_t size, |
2982 | enum dma_data_direction direction) | 2932 | enum dma_data_direction direction) |
2983 | { | 2933 | { |
2984 | if (dev->dma_ops) | ||
2985 | return dev->dma_ops->map_single(dev, cpu_addr, size, direction); | ||
2986 | return dma_map_single(&dev->dev, cpu_addr, size, direction); | 2934 | return dma_map_single(&dev->dev, cpu_addr, size, direction); |
2987 | } | 2935 | } |
2988 | 2936 | ||
@@ -2997,10 +2945,7 @@ static inline void ib_dma_unmap_single(struct ib_device *dev, | |||
2997 | u64 addr, size_t size, | 2945 | u64 addr, size_t size, |
2998 | enum dma_data_direction direction) | 2946 | enum dma_data_direction direction) |
2999 | { | 2947 | { |
3000 | if (dev->dma_ops) | 2948 | dma_unmap_single(&dev->dev, addr, size, direction); |
3001 | dev->dma_ops->unmap_single(dev, addr, size, direction); | ||
3002 | else | ||
3003 | dma_unmap_single(&dev->dev, addr, size, direction); | ||
3004 | } | 2949 | } |
3005 | 2950 | ||
3006 | /** | 2951 | /** |
@@ -3017,8 +2962,6 @@ static inline u64 ib_dma_map_page(struct ib_device *dev, | |||
3017 | size_t size, | 2962 | size_t size, |
3018 | enum dma_data_direction direction) | 2963 | enum dma_data_direction direction) |
3019 | { | 2964 | { |
3020 | if (dev->dma_ops) | ||
3021 | return dev->dma_ops->map_page(dev, page, offset, size, direction); | ||
3022 | return dma_map_page(&dev->dev, page, offset, size, direction); | 2965 | return dma_map_page(&dev->dev, page, offset, size, direction); |
3023 | } | 2966 | } |
3024 | 2967 | ||
@@ -3033,10 +2976,7 @@ static inline void ib_dma_unmap_page(struct ib_device *dev, | |||
3033 | u64 addr, size_t size, | 2976 | u64 addr, size_t size, |
3034 | enum dma_data_direction direction) | 2977 | enum dma_data_direction direction) |
3035 | { | 2978 | { |
3036 | if (dev->dma_ops) | 2979 | dma_unmap_page(&dev->dev, addr, size, direction); |
3037 | dev->dma_ops->unmap_page(dev, addr, size, direction); | ||
3038 | else | ||
3039 | dma_unmap_page(&dev->dev, addr, size, direction); | ||
3040 | } | 2980 | } |
3041 | 2981 | ||
3042 | /** | 2982 | /** |
@@ -3050,8 +2990,6 @@ static inline int ib_dma_map_sg(struct ib_device *dev, | |||
3050 | struct scatterlist *sg, int nents, | 2990 | struct scatterlist *sg, int nents, |
3051 | enum dma_data_direction direction) | 2991 | enum dma_data_direction direction) |
3052 | { | 2992 | { |
3053 | if (dev->dma_ops) | ||
3054 | return dev->dma_ops->map_sg(dev, sg, nents, direction); | ||
3055 | return dma_map_sg(&dev->dev, sg, nents, direction); | 2993 | return dma_map_sg(&dev->dev, sg, nents, direction); |
3056 | } | 2994 | } |
3057 | 2995 | ||
@@ -3066,10 +3004,7 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev, | |||
3066 | struct scatterlist *sg, int nents, | 3004 | struct scatterlist *sg, int nents, |
3067 | enum dma_data_direction direction) | 3005 | enum dma_data_direction direction) |
3068 | { | 3006 | { |
3069 | if (dev->dma_ops) | 3007 | dma_unmap_sg(&dev->dev, sg, nents, direction); |
3070 | dev->dma_ops->unmap_sg(dev, sg, nents, direction); | ||
3071 | else | ||
3072 | dma_unmap_sg(&dev->dev, sg, nents, direction); | ||
3073 | } | 3008 | } |
3074 | 3009 | ||
3075 | static inline int ib_dma_map_sg_attrs(struct ib_device *dev, | 3010 | static inline int ib_dma_map_sg_attrs(struct ib_device *dev, |
@@ -3077,9 +3012,6 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev, | |||
3077 | enum dma_data_direction direction, | 3012 | enum dma_data_direction direction, |
3078 | unsigned long dma_attrs) | 3013 | unsigned long dma_attrs) |
3079 | { | 3014 | { |
3080 | if (dev->dma_ops) | ||
3081 | return dev->dma_ops->map_sg_attrs(dev, sg, nents, direction, | ||
3082 | dma_attrs); | ||
3083 | return dma_map_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); | 3015 | return dma_map_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); |
3084 | } | 3016 | } |
3085 | 3017 | ||
@@ -3088,11 +3020,7 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, | |||
3088 | enum dma_data_direction direction, | 3020 | enum dma_data_direction direction, |
3089 | unsigned long dma_attrs) | 3021 | unsigned long dma_attrs) |
3090 | { | 3022 | { |
3091 | if (dev->dma_ops) | 3023 | dma_unmap_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); |
3092 | return dev->dma_ops->unmap_sg_attrs(dev, sg, nents, direction, | ||
3093 | dma_attrs); | ||
3094 | else | ||
3095 | dma_unmap_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); | ||
3096 | } | 3024 | } |
3097 | /** | 3025 | /** |
3098 | * ib_sg_dma_address - Return the DMA address from a scatter/gather entry | 3026 | * ib_sg_dma_address - Return the DMA address from a scatter/gather entry |
@@ -3134,10 +3062,7 @@ static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, | |||
3134 | size_t size, | 3062 | size_t size, |
3135 | enum dma_data_direction dir) | 3063 | enum dma_data_direction dir) |
3136 | { | 3064 | { |
3137 | if (dev->dma_ops) | 3065 | dma_sync_single_for_cpu(&dev->dev, addr, size, dir); |
3138 | dev->dma_ops->sync_single_for_cpu(dev, addr, size, dir); | ||
3139 | else | ||
3140 | dma_sync_single_for_cpu(&dev->dev, addr, size, dir); | ||
3141 | } | 3066 | } |
3142 | 3067 | ||
3143 | /** | 3068 | /** |
@@ -3152,10 +3077,7 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, | |||
3152 | size_t size, | 3077 | size_t size, |
3153 | enum dma_data_direction dir) | 3078 | enum dma_data_direction dir) |
3154 | { | 3079 | { |
3155 | if (dev->dma_ops) | 3080 | dma_sync_single_for_device(&dev->dev, addr, size, dir); |
3156 | dev->dma_ops->sync_single_for_device(dev, addr, size, dir); | ||
3157 | else | ||
3158 | dma_sync_single_for_device(&dev->dev, addr, size, dir); | ||
3159 | } | 3081 | } |
3160 | 3082 | ||
3161 | /** | 3083 | /** |
@@ -3170,14 +3092,6 @@ static inline void *ib_dma_alloc_coherent(struct ib_device *dev, | |||
3170 | dma_addr_t *dma_handle, | 3092 | dma_addr_t *dma_handle, |
3171 | gfp_t flag) | 3093 | gfp_t flag) |
3172 | { | 3094 | { |
3173 | if (dev->dma_ops) { | ||
3174 | u64 handle; | ||
3175 | void *ret; | ||
3176 | |||
3177 | ret = dev->dma_ops->alloc_coherent(dev, size, &handle, flag); | ||
3178 | *dma_handle = handle; | ||
3179 | return ret; | ||
3180 | } | ||
3181 | return dma_alloc_coherent(&dev->dev, size, dma_handle, flag); | 3095 | return dma_alloc_coherent(&dev->dev, size, dma_handle, flag); |
3182 | } | 3096 | } |
3183 | 3097 | ||
@@ -3192,10 +3106,7 @@ static inline void ib_dma_free_coherent(struct ib_device *dev, | |||
3192 | size_t size, void *cpu_addr, | 3106 | size_t size, void *cpu_addr, |
3193 | dma_addr_t dma_handle) | 3107 | dma_addr_t dma_handle) |
3194 | { | 3108 | { |
3195 | if (dev->dma_ops) | 3109 | dma_free_coherent(&dev->dev, size, cpu_addr, dma_handle); |
3196 | dev->dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | ||
3197 | else | ||
3198 | dma_free_coherent(&dev->dev, size, cpu_addr, dma_handle); | ||
3199 | } | 3110 | } |
3200 | 3111 | ||
3201 | /** | 3112 | /** |