From: Shannon Nelson <[email protected]>
Date: Mon, 31 Aug 2020 16:35:54 -0700
> @@ -100,6 +100,8 @@ static struct sk_buff *ionic_rx_frags(struct ionic_queue
> *q,
> frag_len = min(len, (u16)PAGE_SIZE);
> len -= frag_len;
>
> + dma_sync_single_for_cpu(dev, dma_unmap_addr(page_info,
> dma_addr),
> + len, DMA_FROM_DEVICE);
> dma_unmap_page(dev, dma_unmap_addr(page_info, dma_addr),
> PAGE_SIZE, DMA_FROM_DEVICE);
> skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
The unmap operation performs a sync, if necessary, for you.
That's the pattern of usage:
map();
device read/write memory
unmap();
That's it, no more, no less.
The time to use sync is when you want to maintain the mapping and keep
using it.