• Michal Schmidt's avatar
    bnx2x: fix DMA API usage · 8031612d
    Michal Schmidt authored
    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: 4cace675 ("bnx2x: Alloc 4k fragment for each rx ring buffer element")
    Signed-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8031612d
bnx2x.h 78.1 KB