bnx2x: fix DMA API usage
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 26 Jun 2015 15:50:00 +0000 (17:50 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jun 2015 03:25:01 +0000 (20:25 -0700)
commit8031612d7fa8e49589a91da238a93a067826c668
tree9f6e8e33b79fed5adc75395a49faa33949fdbe31
parent0f8b6cea1f3271ccc37dd2847b39e235461e0ced
bnx2x: fix DMA API usage

With CONFIG_DMA_API_DEBUG=y bnx2x triggers the error "DMA-API: device
driver frees DMA memory with wrong function".
On archs where PAGE_SIZE > SGE_PAGE_SIZE it also triggers "DMA-API:
device driver frees DMA memory with different size".

Fix this by making the mapping and unmapping symmetric:
 - Do not map the whole pool page at once. Instead map the
   SGE_PAGE_SIZE-sized pieces individually, so they can be unmapped in
   the same manner.
 - What's mapped using dma_map_page() must be unmapped using
   dma_unmap_page().

Tested on ppc64.

Fixes: 4cace675d687 ("bnx2x: Alloc 4k fragment for each rx ring buffer element")
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
This page took 0.026097 seconds and 5 git commands to generate.