diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-09-10 02:41:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-10 15:27:31 -0400 |
commit | 58758aa505edc5b8f8393cee45b54c7485d76de5 (patch) | |
tree | 6935e011c85f37661b2e3928fbfdcbcdb6b8af91 /drivers | |
parent | e42de26249c88a00715ea686993192546d07133e (diff) |
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: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sfc/nic.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index f595d920c7c4..8efe1ca83c1d 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
@@ -263,8 +263,8 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, | |||
263 | { | 263 | { |
264 | len = ALIGN(len, EFX_BUF_SIZE); | 264 | len = ALIGN(len, EFX_BUF_SIZE); |
265 | 265 | ||
266 | buffer->addr = pci_alloc_consistent(efx->pci_dev, len, | 266 | buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len, |
267 | &buffer->dma_addr); | 267 | &buffer->dma_addr, GFP_KERNEL); |
268 | if (!buffer->addr) | 268 | if (!buffer->addr) |
269 | return -ENOMEM; | 269 | return -ENOMEM; |
270 | buffer->len = len; | 270 | buffer->len = len; |
@@ -301,8 +301,8 @@ efx_free_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) | |||
301 | (u64)buffer->dma_addr, buffer->len, | 301 | (u64)buffer->dma_addr, buffer->len, |
302 | buffer->addr, (u64)virt_to_phys(buffer->addr)); | 302 | buffer->addr, (u64)virt_to_phys(buffer->addr)); |
303 | 303 | ||
304 | pci_free_consistent(efx->pci_dev, buffer->len, buffer->addr, | 304 | dma_free_coherent(&efx->pci_dev->dev, buffer->len, buffer->addr, |
305 | buffer->dma_addr); | 305 | buffer->dma_addr); |
306 | buffer->addr = NULL; | 306 | buffer->addr = NULL; |
307 | buffer->entries = 0; | 307 | buffer->entries = 0; |
308 | } | 308 | } |