aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_qp.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_qp.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_qp.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index ca73bab11a02..031f690f5455 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -934,7 +934,8 @@ static int mthca_alloc_wqe_buf(struct mthca_dev *dev,
934 mthca_dbg(dev, "Creating direct QP of size %d (shift %d)\n", 934 mthca_dbg(dev, "Creating direct QP of size %d (shift %d)\n",
935 size, shift); 935 size, shift);
936 936
937 qp->queue.direct.buf = pci_alloc_consistent(dev->pdev, size, &t); 937 qp->queue.direct.buf = dma_alloc_coherent(&dev->pdev->dev, size,
938 &t, GFP_KERNEL);
938 if (!qp->queue.direct.buf) 939 if (!qp->queue.direct.buf)
939 goto err_out; 940 goto err_out;
940 941
@@ -973,7 +974,8 @@ static int mthca_alloc_wqe_buf(struct mthca_dev *dev,
973 974
974 for (i = 0; i < npages; ++i) { 975 for (i = 0; i < npages; ++i) {
975 qp->queue.page_list[i].buf = 976 qp->queue.page_list[i].buf =
976 pci_alloc_consistent(dev->pdev, PAGE_SIZE, &t); 977 dma_alloc_coherent(&dev->pdev->dev, PAGE_SIZE,
978 &t, GFP_KERNEL);
977 if (!qp->queue.page_list[i].buf) 979 if (!qp->queue.page_list[i].buf)
978 goto err_out_free; 980 goto err_out_free;
979 981
@@ -996,16 +998,15 @@ static int mthca_alloc_wqe_buf(struct mthca_dev *dev,
996 998
997 err_out_free: 999 err_out_free:
998 if (qp->is_direct) { 1000 if (qp->is_direct) {
999 pci_free_consistent(dev->pdev, size, 1001 dma_free_coherent(&dev->pdev->dev, size, qp->queue.direct.buf,
1000 qp->queue.direct.buf, 1002 pci_unmap_addr(&qp->queue.direct, mapping));
1001 pci_unmap_addr(&qp->queue.direct, mapping));
1002 } else 1003 } else
1003 for (i = 0; i < npages; ++i) { 1004 for (i = 0; i < npages; ++i) {
1004 if (qp->queue.page_list[i].buf) 1005 if (qp->queue.page_list[i].buf)
1005 pci_free_consistent(dev->pdev, PAGE_SIZE, 1006 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
1006 qp->queue.page_list[i].buf, 1007 qp->queue.page_list[i].buf,
1007 pci_unmap_addr(&qp->queue.page_list[i], 1008 pci_unmap_addr(&qp->queue.page_list[i],
1008 mapping)); 1009 mapping));
1009 1010
1010 } 1011 }
1011 1012