Commit 58758aa5 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

sfc: Allocate DMA and event rings using GFP_KERNEL

Currently we allocate DMA descriptor rings and event rings using
pci_alloc_consistent() which selects non-blocking behaviour from the
page allocator (GFP_ATOMIC). This is unnecessary, and since we
currently allocate a single contiguous block for each ring (up to 32
pages!) these allocations are likely to fail if there is any
significant memory pressure.  Use dma_alloc_coherent() and GFP_KERNEL
instead.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e42de262
...@@ -263,8 +263,8 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, ...@@ -263,8 +263,8 @@ static int efx_alloc_special_buffer(struct efx_nic *efx,
{ {
len = ALIGN(len, EFX_BUF_SIZE); len = ALIGN(len, EFX_BUF_SIZE);
buffer->addr = pci_alloc_consistent(efx->pci_dev, len, buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len,
&buffer->dma_addr); &buffer->dma_addr, GFP_KERNEL);
if (!buffer->addr) if (!buffer->addr)
return -ENOMEM; return -ENOMEM;
buffer->len = len; buffer->len = len;
...@@ -301,7 +301,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) ...@@ -301,7 +301,7 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer)
(u64)buffer->dma_addr, buffer->len, (u64)buffer->dma_addr, buffer->len,
buffer->addr, (u64)virt_to_phys(buffer->addr)); buffer->addr, (u64)virt_to_phys(buffer->addr));
pci_free_consistent(efx->pci_dev, buffer->len, buffer->addr, dma_free_coherent(&efx->pci_dev->dev, buffer->len, buffer->addr,
buffer->dma_addr); buffer->dma_addr);
buffer->addr = NULL; buffer->addr = NULL;
buffer->entries = 0; buffer->entries = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment