]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bnx2x: fix DMA API usage
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 26 Jun 2015 15:50:00 +0000 (17:50 +0200)
committerDan Duval <dan.duval@oracle.com>
Mon, 19 Oct 2015 22:04:51 +0000 (18:04 -0400)
commit092e7cded49904133d04099b280eb519f672642d
tree751fedd9e03408385089efb985871c53f3019007
parentec6d28bdfbfeef326fe11d0e08f1d23f4cfc3baa
bnx2x: fix DMA API usage

Orabug: 22066196

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>
(cherry picked from commit 8031612d7fa8e49589a91da238a93a067826c668)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h