diff options
Diffstat (limited to 'drivers/infiniband/hw/amso1100/c2_cq.c')
-rw-r--r-- | drivers/infiniband/hw/amso1100/c2_cq.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_cq.c b/drivers/infiniband/hw/amso1100/c2_cq.c index 9d7bcc5ade93..05c9154d46f4 100644 --- a/drivers/infiniband/hw/amso1100/c2_cq.c +++ b/drivers/infiniband/hw/amso1100/c2_cq.c | |||
@@ -246,20 +246,17 @@ int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) | |||
246 | 246 | ||
247 | static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq) | 247 | static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq) |
248 | { | 248 | { |
249 | 249 | dma_free_coherent(&c2dev->pcidev->dev, mq->q_size * mq->msg_size, | |
250 | dma_unmap_single(c2dev->ibdev.dma_device, pci_unmap_addr(mq, mapping), | 250 | mq->msg_pool.host, pci_unmap_addr(mq, mapping)); |
251 | mq->q_size * mq->msg_size, DMA_FROM_DEVICE); | ||
252 | free_pages((unsigned long) mq->msg_pool.host, | ||
253 | get_order(mq->q_size * mq->msg_size)); | ||
254 | } | 251 | } |
255 | 252 | ||
256 | static int c2_alloc_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq, int q_size, | 253 | static int c2_alloc_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq, int q_size, |
257 | int msg_size) | 254 | int msg_size) |
258 | { | 255 | { |
259 | unsigned long pool_start; | 256 | u8 *pool_start; |
260 | 257 | ||
261 | pool_start = __get_free_pages(GFP_KERNEL, | 258 | pool_start = dma_alloc_coherent(&c2dev->pcidev->dev, q_size * msg_size, |
262 | get_order(q_size * msg_size)); | 259 | &mq->host_dma, GFP_KERNEL); |
263 | if (!pool_start) | 260 | if (!pool_start) |
264 | return -ENOMEM; | 261 | return -ENOMEM; |
265 | 262 | ||
@@ -267,13 +264,10 @@ static int c2_alloc_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq, int q_size, | |||
267 | 0, /* index (currently unknown) */ | 264 | 0, /* index (currently unknown) */ |
268 | q_size, | 265 | q_size, |
269 | msg_size, | 266 | msg_size, |
270 | (u8 *) pool_start, | 267 | pool_start, |
271 | NULL, /* peer (currently unknown) */ | 268 | NULL, /* peer (currently unknown) */ |
272 | C2_MQ_HOST_TARGET); | 269 | C2_MQ_HOST_TARGET); |
273 | 270 | ||
274 | mq->host_dma = dma_map_single(c2dev->ibdev.dma_device, | ||
275 | (void *)pool_start, | ||
276 | q_size * msg_size, DMA_FROM_DEVICE); | ||
277 | pci_unmap_addr_set(mq, mapping, mq->host_dma); | 271 | pci_unmap_addr_set(mq, mapping, mq->host_dma); |
278 | 272 | ||
279 | return 0; | 273 | return 0; |