aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_cq.c
diff options
context:
space:
mode:
authorRoland Dreier <roland@topspin.com>2005-06-27 17:36:40 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 18:11:44 -0400
commit64dc81fca7f6d5c51e50ffa850640ad8358acd1f (patch)
tree919ca8d2ea8567a1de4bba989a123b77340b989a /drivers/infiniband/hw/mthca/mthca_cq.c
parentbb2af78bcdbb8801791de33f1775c98b9178daab (diff)
[PATCH] IB/mthca: Use dma_alloc_coherent instead of pci_alloc_consistent
Switch all allocations of coherent memory from pci_alloc_consistent() to dma_alloc_coherent(), so that we can pass GFP_KERNEL. This should help when the system is low on memory. Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_cq.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 3724d9db50a..5dae5b5dc8e 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -636,19 +636,19 @@ static void mthca_free_cq_buf(struct mthca_dev *dev, struct mthca_cq *cq)
636 int size; 636 int size;
637 637
638 if (cq->is_direct) 638 if (cq->is_direct)
639 pci_free_consistent(dev->pdev, 639 dma_free_coherent(&dev->pdev->dev,
640 (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE, 640 (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE,
641 cq->queue.direct.buf, 641 cq->queue.direct.buf,
642 pci_unmap_addr(&cq->queue.direct, 642 pci_unmap_addr(&cq->queue.direct,
643 mapping)); 643 mapping));
644 else { 644 else {
645 size = (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE; 645 size = (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE;
646 for (i = 0; i < (size + PAGE_SIZE - 1) / PAGE_SIZE; ++i) 646 for (i = 0; i < (size + PAGE_SIZE - 1) / PAGE_SIZE; ++i)
647 if (cq->queue.page_list[i].buf) 647 if (cq->queue.page_list[i].buf)
648 pci_free_consistent(dev->pdev, PAGE_SIZE, 648 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
649 cq->queue.page_list[i].buf, 649 cq->queue.page_list[i].buf,
650 pci_unmap_addr(&cq->queue.page_list[i], 650 pci_unmap_addr(&cq->queue.page_list[i],
651 mapping)); 651 mapping));
652 652
653 kfree(cq->queue.page_list); 653 kfree(cq->queue.page_list);
654 } 654 }
@@ -668,8 +668,8 @@ static int mthca_alloc_cq_buf(struct mthca_dev *dev, int size,
668 npages = 1; 668 npages = 1;
669 shift = get_order(size) + PAGE_SHIFT; 669 shift = get_order(size) + PAGE_SHIFT;
670 670
671 cq->queue.direct.buf = pci_alloc_consistent(dev->pdev, 671 cq->queue.direct.buf = dma_alloc_coherent(&dev->pdev->dev,
672 size, &t); 672 size, &t, GFP_KERNEL);
673 if (!cq->queue.direct.buf) 673 if (!cq->queue.direct.buf)
674 return -ENOMEM; 674 return -ENOMEM;
675 675
@@ -707,7 +707,8 @@ static int mthca_alloc_cq_buf(struct mthca_dev *dev, int size,
707 707
708 for (i = 0; i < npages; ++i) { 708 for (i = 0; i < npages; ++i) {
709 cq->queue.page_list[i].buf = 709 cq->queue.page_list[i].buf =
710 pci_alloc_consistent(dev->pdev, PAGE_SIZE, &t); 710 dma_alloc_coherent(&dev->pdev->dev, PAGE_SIZE,
711 &t, GFP_KERNEL);
711 if (!cq->queue.page_list[i].buf) 712 if (!cq->queue.page_list[i].buf)
712 goto err_free; 713 goto err_free;
713 714